2
0

index.js 1.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659
  1. import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 9659:
  4. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  5. /* eslint-disable @typescript-eslint/no-explicit-any */
  6. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  7. if (k2 === undefined) k2 = k;
  8. var desc = Object.getOwnPropertyDescriptor(m, k);
  9. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  10. desc = { enumerable: true, get: function() { return m[k]; } };
  11. }
  12. Object.defineProperty(o, k2, desc);
  13. }) : (function(o, m, k, k2) {
  14. if (k2 === undefined) k2 = k;
  15. o[k2] = m[k];
  16. }));
  17. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  18. Object.defineProperty(o, "default", { enumerable: true, value: v });
  19. }) : function(o, v) {
  20. o["default"] = v;
  21. });
  22. var __importStar = (this && this.__importStar) || (function () {
  23. var ownKeys = function(o) {
  24. ownKeys = Object.getOwnPropertyNames || function (o) {
  25. var ar = [];
  26. for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
  27. return ar;
  28. };
  29. return ownKeys(o);
  30. };
  31. return function (mod) {
  32. if (mod && mod.__esModule) return mod;
  33. var result = {};
  34. if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
  35. __setModuleDefault(result, mod);
  36. return result;
  37. };
  38. })();
  39. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  40. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  41. return new (P || (P = Promise))(function (resolve, reject) {
  42. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  43. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  44. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  45. step((generator = generator.apply(thisArg, _arguments || [])).next());
  46. });
  47. };
  48. Object.defineProperty(exports, "__esModule", ({ value: true }));
  49. exports.HttpClient = exports.HttpClientResponse = exports.HttpClientError = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
  50. exports.getProxyUrl = getProxyUrl;
  51. exports.isHttps = isHttps;
  52. const http = __importStar(__nccwpck_require__(8611));
  53. const https = __importStar(__nccwpck_require__(5692));
  54. const pm = __importStar(__nccwpck_require__(3335));
  55. const tunnel = __importStar(__nccwpck_require__(770));
  56. const undici_1 = __nccwpck_require__(6752);
  57. var HttpCodes;
  58. (function (HttpCodes) {
  59. HttpCodes[HttpCodes["OK"] = 200] = "OK";
  60. HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
  61. HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
  62. HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
  63. HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
  64. HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
  65. HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
  66. HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
  67. HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
  68. HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
  69. HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
  70. HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
  71. HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
  72. HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
  73. HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
  74. HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
  75. HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
  76. HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
  77. HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
  78. HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
  79. HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
  80. HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
  81. HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
  82. HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
  83. HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
  84. HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
  85. HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
  86. })(HttpCodes || (exports.HttpCodes = HttpCodes = {}));
  87. var Headers;
  88. (function (Headers) {
  89. Headers["Accept"] = "accept";
  90. Headers["ContentType"] = "content-type";
  91. })(Headers || (exports.Headers = Headers = {}));
  92. var MediaTypes;
  93. (function (MediaTypes) {
  94. MediaTypes["ApplicationJson"] = "application/json";
  95. })(MediaTypes || (exports.MediaTypes = MediaTypes = {}));
  96. /**
  97. * Returns the proxy URL, depending upon the supplied url and proxy environment variables.
  98. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
  99. */
  100. function getProxyUrl(serverUrl) {
  101. const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
  102. return proxyUrl ? proxyUrl.href : '';
  103. }
  104. const HttpRedirectCodes = [
  105. HttpCodes.MovedPermanently,
  106. HttpCodes.ResourceMoved,
  107. HttpCodes.SeeOther,
  108. HttpCodes.TemporaryRedirect,
  109. HttpCodes.PermanentRedirect
  110. ];
  111. const HttpResponseRetryCodes = [
  112. HttpCodes.BadGateway,
  113. HttpCodes.ServiceUnavailable,
  114. HttpCodes.GatewayTimeout
  115. ];
  116. const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
  117. const ExponentialBackoffCeiling = 10;
  118. const ExponentialBackoffTimeSlice = 5;
  119. class HttpClientError extends Error {
  120. constructor(message, statusCode) {
  121. super(message);
  122. this.name = 'HttpClientError';
  123. this.statusCode = statusCode;
  124. Object.setPrototypeOf(this, HttpClientError.prototype);
  125. }
  126. }
  127. exports.HttpClientError = HttpClientError;
  128. class HttpClientResponse {
  129. constructor(message) {
  130. this.message = message;
  131. }
  132. readBody() {
  133. return __awaiter(this, void 0, void 0, function* () {
  134. return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
  135. let output = Buffer.alloc(0);
  136. this.message.on('data', (chunk) => {
  137. output = Buffer.concat([output, chunk]);
  138. });
  139. this.message.on('end', () => {
  140. resolve(output.toString());
  141. });
  142. }));
  143. });
  144. }
  145. readBodyBuffer() {
  146. return __awaiter(this, void 0, void 0, function* () {
  147. return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
  148. const chunks = [];
  149. this.message.on('data', (chunk) => {
  150. chunks.push(chunk);
  151. });
  152. this.message.on('end', () => {
  153. resolve(Buffer.concat(chunks));
  154. });
  155. }));
  156. });
  157. }
  158. }
  159. exports.HttpClientResponse = HttpClientResponse;
  160. function isHttps(requestUrl) {
  161. const parsedUrl = new URL(requestUrl);
  162. return parsedUrl.protocol === 'https:';
  163. }
  164. class HttpClient {
  165. constructor(userAgent, handlers, requestOptions) {
  166. this._ignoreSslError = false;
  167. this._allowRedirects = true;
  168. this._allowRedirectDowngrade = false;
  169. this._maxRedirects = 50;
  170. this._allowRetries = false;
  171. this._maxRetries = 1;
  172. this._keepAlive = false;
  173. this._disposed = false;
  174. this.userAgent = this._getUserAgentWithOrchestrationId(userAgent);
  175. this.handlers = handlers || [];
  176. this.requestOptions = requestOptions;
  177. if (requestOptions) {
  178. if (requestOptions.ignoreSslError != null) {
  179. this._ignoreSslError = requestOptions.ignoreSslError;
  180. }
  181. this._socketTimeout = requestOptions.socketTimeout;
  182. if (requestOptions.allowRedirects != null) {
  183. this._allowRedirects = requestOptions.allowRedirects;
  184. }
  185. if (requestOptions.allowRedirectDowngrade != null) {
  186. this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
  187. }
  188. if (requestOptions.maxRedirects != null) {
  189. this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
  190. }
  191. if (requestOptions.keepAlive != null) {
  192. this._keepAlive = requestOptions.keepAlive;
  193. }
  194. if (requestOptions.allowRetries != null) {
  195. this._allowRetries = requestOptions.allowRetries;
  196. }
  197. if (requestOptions.maxRetries != null) {
  198. this._maxRetries = requestOptions.maxRetries;
  199. }
  200. }
  201. }
  202. options(requestUrl, additionalHeaders) {
  203. return __awaiter(this, void 0, void 0, function* () {
  204. return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
  205. });
  206. }
  207. get(requestUrl, additionalHeaders) {
  208. return __awaiter(this, void 0, void 0, function* () {
  209. return this.request('GET', requestUrl, null, additionalHeaders || {});
  210. });
  211. }
  212. del(requestUrl, additionalHeaders) {
  213. return __awaiter(this, void 0, void 0, function* () {
  214. return this.request('DELETE', requestUrl, null, additionalHeaders || {});
  215. });
  216. }
  217. post(requestUrl, data, additionalHeaders) {
  218. return __awaiter(this, void 0, void 0, function* () {
  219. return this.request('POST', requestUrl, data, additionalHeaders || {});
  220. });
  221. }
  222. patch(requestUrl, data, additionalHeaders) {
  223. return __awaiter(this, void 0, void 0, function* () {
  224. return this.request('PATCH', requestUrl, data, additionalHeaders || {});
  225. });
  226. }
  227. put(requestUrl, data, additionalHeaders) {
  228. return __awaiter(this, void 0, void 0, function* () {
  229. return this.request('PUT', requestUrl, data, additionalHeaders || {});
  230. });
  231. }
  232. head(requestUrl, additionalHeaders) {
  233. return __awaiter(this, void 0, void 0, function* () {
  234. return this.request('HEAD', requestUrl, null, additionalHeaders || {});
  235. });
  236. }
  237. sendStream(verb, requestUrl, stream, additionalHeaders) {
  238. return __awaiter(this, void 0, void 0, function* () {
  239. return this.request(verb, requestUrl, stream, additionalHeaders);
  240. });
  241. }
  242. /**
  243. * Gets a typed object from an endpoint
  244. * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
  245. */
  246. getJson(requestUrl_1) {
  247. return __awaiter(this, arguments, void 0, function* (requestUrl, additionalHeaders = {}) {
  248. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  249. const res = yield this.get(requestUrl, additionalHeaders);
  250. return this._processResponse(res, this.requestOptions);
  251. });
  252. }
  253. postJson(requestUrl_1, obj_1) {
  254. return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
  255. const data = JSON.stringify(obj, null, 2);
  256. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  257. additionalHeaders[Headers.ContentType] =
  258. this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
  259. const res = yield this.post(requestUrl, data, additionalHeaders);
  260. return this._processResponse(res, this.requestOptions);
  261. });
  262. }
  263. putJson(requestUrl_1, obj_1) {
  264. return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
  265. const data = JSON.stringify(obj, null, 2);
  266. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  267. additionalHeaders[Headers.ContentType] =
  268. this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
  269. const res = yield this.put(requestUrl, data, additionalHeaders);
  270. return this._processResponse(res, this.requestOptions);
  271. });
  272. }
  273. patchJson(requestUrl_1, obj_1) {
  274. return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
  275. const data = JSON.stringify(obj, null, 2);
  276. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  277. additionalHeaders[Headers.ContentType] =
  278. this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
  279. const res = yield this.patch(requestUrl, data, additionalHeaders);
  280. return this._processResponse(res, this.requestOptions);
  281. });
  282. }
  283. /**
  284. * Makes a raw http request.
  285. * All other methods such as get, post, patch, and request ultimately call this.
  286. * Prefer get, del, post and patch
  287. */
  288. request(verb, requestUrl, data, headers) {
  289. return __awaiter(this, void 0, void 0, function* () {
  290. if (this._disposed) {
  291. throw new Error('Client has already been disposed.');
  292. }
  293. const parsedUrl = new URL(requestUrl);
  294. let info = this._prepareRequest(verb, parsedUrl, headers);
  295. // Only perform retries on reads since writes may not be idempotent.
  296. const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
  297. ? this._maxRetries + 1
  298. : 1;
  299. let numTries = 0;
  300. let response;
  301. do {
  302. response = yield this.requestRaw(info, data);
  303. // Check if it's an authentication challenge
  304. if (response &&
  305. response.message &&
  306. response.message.statusCode === HttpCodes.Unauthorized) {
  307. let authenticationHandler;
  308. for (const handler of this.handlers) {
  309. if (handler.canHandleAuthentication(response)) {
  310. authenticationHandler = handler;
  311. break;
  312. }
  313. }
  314. if (authenticationHandler) {
  315. return authenticationHandler.handleAuthentication(this, info, data);
  316. }
  317. else {
  318. // We have received an unauthorized response but have no handlers to handle it.
  319. // Let the response return to the caller.
  320. return response;
  321. }
  322. }
  323. let redirectsRemaining = this._maxRedirects;
  324. while (response.message.statusCode &&
  325. HttpRedirectCodes.includes(response.message.statusCode) &&
  326. this._allowRedirects &&
  327. redirectsRemaining > 0) {
  328. const redirectUrl = response.message.headers['location'];
  329. if (!redirectUrl) {
  330. // if there's no location to redirect to, we won't
  331. break;
  332. }
  333. const parsedRedirectUrl = new URL(redirectUrl);
  334. if (parsedUrl.protocol === 'https:' &&
  335. parsedUrl.protocol !== parsedRedirectUrl.protocol &&
  336. !this._allowRedirectDowngrade) {
  337. throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
  338. }
  339. // we need to finish reading the response before reassigning response
  340. // which will leak the open socket.
  341. yield response.readBody();
  342. // strip authorization header if redirected to a different hostname
  343. if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
  344. for (const header in headers) {
  345. // header names are case insensitive
  346. if (header.toLowerCase() === 'authorization') {
  347. delete headers[header];
  348. }
  349. }
  350. }
  351. // let's make the request with the new redirectUrl
  352. info = this._prepareRequest(verb, parsedRedirectUrl, headers);
  353. response = yield this.requestRaw(info, data);
  354. redirectsRemaining--;
  355. }
  356. if (!response.message.statusCode ||
  357. !HttpResponseRetryCodes.includes(response.message.statusCode)) {
  358. // If not a retry code, return immediately instead of retrying
  359. return response;
  360. }
  361. numTries += 1;
  362. if (numTries < maxTries) {
  363. yield response.readBody();
  364. yield this._performExponentialBackoff(numTries);
  365. }
  366. } while (numTries < maxTries);
  367. return response;
  368. });
  369. }
  370. /**
  371. * Needs to be called if keepAlive is set to true in request options.
  372. */
  373. dispose() {
  374. if (this._agent) {
  375. this._agent.destroy();
  376. }
  377. this._disposed = true;
  378. }
  379. /**
  380. * Raw request.
  381. * @param info
  382. * @param data
  383. */
  384. requestRaw(info, data) {
  385. return __awaiter(this, void 0, void 0, function* () {
  386. return new Promise((resolve, reject) => {
  387. function callbackForResult(err, res) {
  388. if (err) {
  389. reject(err);
  390. }
  391. else if (!res) {
  392. // If `err` is not passed, then `res` must be passed.
  393. reject(new Error('Unknown error'));
  394. }
  395. else {
  396. resolve(res);
  397. }
  398. }
  399. this.requestRawWithCallback(info, data, callbackForResult);
  400. });
  401. });
  402. }
  403. /**
  404. * Raw request with callback.
  405. * @param info
  406. * @param data
  407. * @param onResult
  408. */
  409. requestRawWithCallback(info, data, onResult) {
  410. if (typeof data === 'string') {
  411. if (!info.options.headers) {
  412. info.options.headers = {};
  413. }
  414. info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
  415. }
  416. let callbackCalled = false;
  417. function handleResult(err, res) {
  418. if (!callbackCalled) {
  419. callbackCalled = true;
  420. onResult(err, res);
  421. }
  422. }
  423. const req = info.httpModule.request(info.options, (msg) => {
  424. const res = new HttpClientResponse(msg);
  425. handleResult(undefined, res);
  426. });
  427. let socket;
  428. req.on('socket', sock => {
  429. socket = sock;
  430. });
  431. // If we ever get disconnected, we want the socket to timeout eventually
  432. req.setTimeout(this._socketTimeout || 3 * 60000, () => {
  433. if (socket) {
  434. socket.end();
  435. }
  436. handleResult(new Error(`Request timeout: ${info.options.path}`));
  437. });
  438. req.on('error', function (err) {
  439. // err has statusCode property
  440. // res should have headers
  441. handleResult(err);
  442. });
  443. if (data && typeof data === 'string') {
  444. req.write(data, 'utf8');
  445. }
  446. if (data && typeof data !== 'string') {
  447. data.on('close', function () {
  448. req.end();
  449. });
  450. data.pipe(req);
  451. }
  452. else {
  453. req.end();
  454. }
  455. }
  456. /**
  457. * Gets an http agent. This function is useful when you need an http agent that handles
  458. * routing through a proxy server - depending upon the url and proxy environment variables.
  459. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
  460. */
  461. getAgent(serverUrl) {
  462. const parsedUrl = new URL(serverUrl);
  463. return this._getAgent(parsedUrl);
  464. }
  465. getAgentDispatcher(serverUrl) {
  466. const parsedUrl = new URL(serverUrl);
  467. const proxyUrl = pm.getProxyUrl(parsedUrl);
  468. const useProxy = proxyUrl && proxyUrl.hostname;
  469. if (!useProxy) {
  470. return;
  471. }
  472. return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
  473. }
  474. _prepareRequest(method, requestUrl, headers) {
  475. const info = {};
  476. info.parsedUrl = requestUrl;
  477. const usingSsl = info.parsedUrl.protocol === 'https:';
  478. info.httpModule = usingSsl ? https : http;
  479. const defaultPort = usingSsl ? 443 : 80;
  480. info.options = {};
  481. info.options.host = info.parsedUrl.hostname;
  482. info.options.port = info.parsedUrl.port
  483. ? parseInt(info.parsedUrl.port)
  484. : defaultPort;
  485. info.options.path =
  486. (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
  487. info.options.method = method;
  488. info.options.headers = this._mergeHeaders(headers);
  489. if (this.userAgent != null) {
  490. info.options.headers['user-agent'] = this.userAgent;
  491. }
  492. info.options.agent = this._getAgent(info.parsedUrl);
  493. // gives handlers an opportunity to participate
  494. if (this.handlers) {
  495. for (const handler of this.handlers) {
  496. handler.prepareRequest(info.options);
  497. }
  498. }
  499. return info;
  500. }
  501. _mergeHeaders(headers) {
  502. if (this.requestOptions && this.requestOptions.headers) {
  503. return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
  504. }
  505. return lowercaseKeys(headers || {});
  506. }
  507. /**
  508. * Gets an existing header value or returns a default.
  509. * Handles converting number header values to strings since HTTP headers must be strings.
  510. * Note: This returns string | string[] since some headers can have multiple values.
  511. * For headers that must always be a single string (like Content-Type), use the
  512. * specialized _getExistingOrDefaultContentTypeHeader method instead.
  513. */
  514. _getExistingOrDefaultHeader(additionalHeaders, header, _default) {
  515. let clientHeader;
  516. if (this.requestOptions && this.requestOptions.headers) {
  517. const headerValue = lowercaseKeys(this.requestOptions.headers)[header];
  518. if (headerValue) {
  519. clientHeader =
  520. typeof headerValue === 'number' ? headerValue.toString() : headerValue;
  521. }
  522. }
  523. const additionalValue = additionalHeaders[header];
  524. if (additionalValue !== undefined) {
  525. return typeof additionalValue === 'number'
  526. ? additionalValue.toString()
  527. : additionalValue;
  528. }
  529. if (clientHeader !== undefined) {
  530. return clientHeader;
  531. }
  532. return _default;
  533. }
  534. /**
  535. * Specialized version of _getExistingOrDefaultHeader for Content-Type header.
  536. * Always returns a single string (not an array) since Content-Type should be a single value.
  537. * Converts arrays to comma-separated strings and numbers to strings to ensure type safety.
  538. * This was split from _getExistingOrDefaultHeader to provide stricter typing for callers
  539. * that assign the result to places expecting a string (e.g., additionalHeaders[Headers.ContentType]).
  540. */
  541. _getExistingOrDefaultContentTypeHeader(additionalHeaders, _default) {
  542. let clientHeader;
  543. if (this.requestOptions && this.requestOptions.headers) {
  544. const headerValue = lowercaseKeys(this.requestOptions.headers)[Headers.ContentType];
  545. if (headerValue) {
  546. if (typeof headerValue === 'number') {
  547. clientHeader = String(headerValue);
  548. }
  549. else if (Array.isArray(headerValue)) {
  550. clientHeader = headerValue.join(', ');
  551. }
  552. else {
  553. clientHeader = headerValue;
  554. }
  555. }
  556. }
  557. const additionalValue = additionalHeaders[Headers.ContentType];
  558. // Return the first non-undefined value, converting numbers or arrays to strings if necessary
  559. if (additionalValue !== undefined) {
  560. if (typeof additionalValue === 'number') {
  561. return String(additionalValue);
  562. }
  563. else if (Array.isArray(additionalValue)) {
  564. return additionalValue.join(', ');
  565. }
  566. else {
  567. return additionalValue;
  568. }
  569. }
  570. if (clientHeader !== undefined) {
  571. return clientHeader;
  572. }
  573. return _default;
  574. }
  575. _getAgent(parsedUrl) {
  576. let agent;
  577. const proxyUrl = pm.getProxyUrl(parsedUrl);
  578. const useProxy = proxyUrl && proxyUrl.hostname;
  579. if (this._keepAlive && useProxy) {
  580. agent = this._proxyAgent;
  581. }
  582. if (!useProxy) {
  583. agent = this._agent;
  584. }
  585. // if agent is already assigned use that agent.
  586. if (agent) {
  587. return agent;
  588. }
  589. const usingSsl = parsedUrl.protocol === 'https:';
  590. let maxSockets = 100;
  591. if (this.requestOptions) {
  592. maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
  593. }
  594. // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
  595. if (proxyUrl && proxyUrl.hostname) {
  596. const agentOptions = {
  597. maxSockets,
  598. keepAlive: this._keepAlive,
  599. proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
  600. proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
  601. })), { host: proxyUrl.hostname, port: proxyUrl.port })
  602. };
  603. let tunnelAgent;
  604. const overHttps = proxyUrl.protocol === 'https:';
  605. if (usingSsl) {
  606. tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
  607. }
  608. else {
  609. tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
  610. }
  611. agent = tunnelAgent(agentOptions);
  612. this._proxyAgent = agent;
  613. }
  614. // if tunneling agent isn't assigned create a new agent
  615. if (!agent) {
  616. const options = { keepAlive: this._keepAlive, maxSockets };
  617. agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
  618. this._agent = agent;
  619. }
  620. if (usingSsl && this._ignoreSslError) {
  621. // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
  622. // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
  623. // we have to cast it to any and change it directly
  624. agent.options = Object.assign(agent.options || {}, {
  625. rejectUnauthorized: false
  626. });
  627. }
  628. return agent;
  629. }
  630. _getProxyAgentDispatcher(parsedUrl, proxyUrl) {
  631. let proxyAgent;
  632. if (this._keepAlive) {
  633. proxyAgent = this._proxyAgentDispatcher;
  634. }
  635. // if agent is already assigned use that agent.
  636. if (proxyAgent) {
  637. return proxyAgent;
  638. }
  639. const usingSsl = parsedUrl.protocol === 'https:';
  640. proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
  641. token: `Basic ${Buffer.from(`${proxyUrl.username}:${proxyUrl.password}`).toString('base64')}`
  642. })));
  643. this._proxyAgentDispatcher = proxyAgent;
  644. if (usingSsl && this._ignoreSslError) {
  645. // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
  646. // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
  647. // we have to cast it to any and change it directly
  648. proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, {
  649. rejectUnauthorized: false
  650. });
  651. }
  652. return proxyAgent;
  653. }
  654. _getUserAgentWithOrchestrationId(userAgent) {
  655. const baseUserAgent = userAgent || 'actions/http-client';
  656. const orchId = process.env['ACTIONS_ORCHESTRATION_ID'];
  657. if (orchId) {
  658. // Sanitize the orchestration ID to ensure it contains only valid characters
  659. // Valid characters: 0-9, a-z, _, -, .
  660. const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
  661. return `${baseUserAgent} actions_orchestration_id/${sanitizedId}`;
  662. }
  663. return baseUserAgent;
  664. }
  665. _performExponentialBackoff(retryNumber) {
  666. return __awaiter(this, void 0, void 0, function* () {
  667. retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
  668. const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
  669. return new Promise(resolve => setTimeout(() => resolve(), ms));
  670. });
  671. }
  672. _processResponse(res, options) {
  673. return __awaiter(this, void 0, void 0, function* () {
  674. return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
  675. const statusCode = res.message.statusCode || 0;
  676. const response = {
  677. statusCode,
  678. result: null,
  679. headers: {}
  680. };
  681. // not found leads to null obj returned
  682. if (statusCode === HttpCodes.NotFound) {
  683. resolve(response);
  684. }
  685. // get the result from the body
  686. function dateTimeDeserializer(key, value) {
  687. if (typeof value === 'string') {
  688. const a = new Date(value);
  689. if (!isNaN(a.valueOf())) {
  690. return a;
  691. }
  692. }
  693. return value;
  694. }
  695. let obj;
  696. let contents;
  697. try {
  698. contents = yield res.readBody();
  699. if (contents && contents.length > 0) {
  700. if (options && options.deserializeDates) {
  701. obj = JSON.parse(contents, dateTimeDeserializer);
  702. }
  703. else {
  704. obj = JSON.parse(contents);
  705. }
  706. response.result = obj;
  707. }
  708. response.headers = res.message.headers;
  709. }
  710. catch (err) {
  711. // Invalid resource (contents not json); leaving result obj null
  712. }
  713. // note that 3xx redirects are handled by the http layer.
  714. if (statusCode > 299) {
  715. let msg;
  716. // if exception/error in body, attempt to get better error
  717. if (obj && obj.message) {
  718. msg = obj.message;
  719. }
  720. else if (contents && contents.length > 0) {
  721. // it may be the case that the exception is in the body message as string
  722. msg = contents;
  723. }
  724. else {
  725. msg = `Failed request: (${statusCode})`;
  726. }
  727. const err = new HttpClientError(msg, statusCode);
  728. err.result = response.result;
  729. reject(err);
  730. }
  731. else {
  732. resolve(response);
  733. }
  734. }));
  735. });
  736. }
  737. }
  738. exports.HttpClient = HttpClient;
  739. const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
  740. //# sourceMappingURL=index.js.map
  741. /***/ }),
  742. /***/ 3335:
  743. /***/ ((__unused_webpack_module, exports) => {
  744. Object.defineProperty(exports, "__esModule", ({ value: true }));
  745. exports.getProxyUrl = getProxyUrl;
  746. exports.checkBypass = checkBypass;
  747. function getProxyUrl(reqUrl) {
  748. const usingSsl = reqUrl.protocol === 'https:';
  749. if (checkBypass(reqUrl)) {
  750. return undefined;
  751. }
  752. const proxyVar = (() => {
  753. if (usingSsl) {
  754. return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
  755. }
  756. else {
  757. return process.env['http_proxy'] || process.env['HTTP_PROXY'];
  758. }
  759. })();
  760. if (proxyVar) {
  761. try {
  762. return new DecodedURL(proxyVar);
  763. }
  764. catch (_a) {
  765. if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
  766. return new DecodedURL(`http://${proxyVar}`);
  767. }
  768. }
  769. else {
  770. return undefined;
  771. }
  772. }
  773. function checkBypass(reqUrl) {
  774. if (!reqUrl.hostname) {
  775. return false;
  776. }
  777. const reqHost = reqUrl.hostname;
  778. if (isLoopbackAddress(reqHost)) {
  779. return true;
  780. }
  781. const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
  782. if (!noProxy) {
  783. return false;
  784. }
  785. // Determine the request port
  786. let reqPort;
  787. if (reqUrl.port) {
  788. reqPort = Number(reqUrl.port);
  789. }
  790. else if (reqUrl.protocol === 'http:') {
  791. reqPort = 80;
  792. }
  793. else if (reqUrl.protocol === 'https:') {
  794. reqPort = 443;
  795. }
  796. // Format the request hostname and hostname with port
  797. const upperReqHosts = [reqUrl.hostname.toUpperCase()];
  798. if (typeof reqPort === 'number') {
  799. upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
  800. }
  801. // Compare request host against noproxy
  802. for (const upperNoProxyItem of noProxy
  803. .split(',')
  804. .map(x => x.trim().toUpperCase())
  805. .filter(x => x)) {
  806. if (upperNoProxyItem === '*' ||
  807. upperReqHosts.some(x => x === upperNoProxyItem ||
  808. x.endsWith(`.${upperNoProxyItem}`) ||
  809. (upperNoProxyItem.startsWith('.') &&
  810. x.endsWith(`${upperNoProxyItem}`)))) {
  811. return true;
  812. }
  813. }
  814. return false;
  815. }
  816. function isLoopbackAddress(host) {
  817. const hostLower = host.toLowerCase();
  818. return (hostLower === 'localhost' ||
  819. hostLower.startsWith('127.') ||
  820. hostLower.startsWith('[::1]') ||
  821. hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
  822. }
  823. class DecodedURL extends URL {
  824. constructor(url, base) {
  825. super(url, base);
  826. this._decodedUsername = decodeURIComponent(super.username);
  827. this._decodedPassword = decodeURIComponent(super.password);
  828. }
  829. get username() {
  830. return this._decodedUsername;
  831. }
  832. get password() {
  833. return this._decodedPassword;
  834. }
  835. }
  836. //# sourceMappingURL=proxy.js.map
  837. /***/ }),
  838. /***/ 7712:
  839. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  840. const ANY = Symbol('SemVer ANY')
  841. // hoisted class for cyclic dependency
  842. class Comparator {
  843. static get ANY () {
  844. return ANY
  845. }
  846. constructor (comp, options) {
  847. options = parseOptions(options)
  848. if (comp instanceof Comparator) {
  849. if (comp.loose === !!options.loose) {
  850. return comp
  851. } else {
  852. comp = comp.value
  853. }
  854. }
  855. comp = comp.trim().split(/\s+/).join(' ')
  856. debug('comparator', comp, options)
  857. this.options = options
  858. this.loose = !!options.loose
  859. this.parse(comp)
  860. if (this.semver === ANY) {
  861. this.value = ''
  862. } else {
  863. this.value = this.operator + this.semver.version
  864. }
  865. debug('comp', this)
  866. }
  867. parse (comp) {
  868. const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
  869. const m = comp.match(r)
  870. if (!m) {
  871. throw new TypeError(`Invalid comparator: ${comp}`)
  872. }
  873. this.operator = m[1] !== undefined ? m[1] : ''
  874. if (this.operator === '=') {
  875. this.operator = ''
  876. }
  877. // if it literally is just '>' or '' then allow anything.
  878. if (!m[2]) {
  879. this.semver = ANY
  880. } else {
  881. this.semver = new SemVer(m[2], this.options.loose)
  882. }
  883. }
  884. toString () {
  885. return this.value
  886. }
  887. test (version) {
  888. debug('Comparator.test', version, this.options.loose)
  889. if (this.semver === ANY || version === ANY) {
  890. return true
  891. }
  892. if (typeof version === 'string') {
  893. try {
  894. version = new SemVer(version, this.options)
  895. } catch (er) {
  896. return false
  897. }
  898. }
  899. return cmp(version, this.operator, this.semver, this.options)
  900. }
  901. intersects (comp, options) {
  902. if (!(comp instanceof Comparator)) {
  903. throw new TypeError('a Comparator is required')
  904. }
  905. if (this.operator === '') {
  906. if (this.value === '') {
  907. return true
  908. }
  909. return new Range(comp.value, options).test(this.value)
  910. } else if (comp.operator === '') {
  911. if (comp.value === '') {
  912. return true
  913. }
  914. return new Range(this.value, options).test(comp.semver)
  915. }
  916. options = parseOptions(options)
  917. // Special cases where nothing can possibly be lower
  918. if (options.includePrerelease &&
  919. (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
  920. return false
  921. }
  922. if (!options.includePrerelease &&
  923. (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
  924. return false
  925. }
  926. // Same direction increasing (> or >=)
  927. if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
  928. return true
  929. }
  930. // Same direction decreasing (< or <=)
  931. if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
  932. return true
  933. }
  934. // same SemVer and both sides are inclusive (<= or >=)
  935. if (
  936. (this.semver.version === comp.semver.version) &&
  937. this.operator.includes('=') && comp.operator.includes('=')) {
  938. return true
  939. }
  940. // opposite directions less than
  941. if (cmp(this.semver, '<', comp.semver, options) &&
  942. this.operator.startsWith('>') && comp.operator.startsWith('<')) {
  943. return true
  944. }
  945. // opposite directions greater than
  946. if (cmp(this.semver, '>', comp.semver, options) &&
  947. this.operator.startsWith('<') && comp.operator.startsWith('>')) {
  948. return true
  949. }
  950. return false
  951. }
  952. }
  953. module.exports = Comparator
  954. const parseOptions = __nccwpck_require__(5131)
  955. const { safeRe: re, t } = __nccwpck_require__(6102)
  956. const cmp = __nccwpck_require__(9647)
  957. const debug = __nccwpck_require__(1736)
  958. const SemVer = __nccwpck_require__(6644)
  959. const Range = __nccwpck_require__(4535)
  960. /***/ }),
  961. /***/ 4535:
  962. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  963. const SPACE_CHARACTERS = /\s+/g
  964. // hoisted class for cyclic dependency
  965. class Range {
  966. constructor (range, options) {
  967. options = parseOptions(options)
  968. if (range instanceof Range) {
  969. if (
  970. range.loose === !!options.loose &&
  971. range.includePrerelease === !!options.includePrerelease
  972. ) {
  973. return range
  974. } else {
  975. return new Range(range.raw, options)
  976. }
  977. }
  978. if (range instanceof Comparator) {
  979. // just put it in the set and return
  980. this.raw = range.value
  981. this.set = [[range]]
  982. this.formatted = undefined
  983. return this
  984. }
  985. this.options = options
  986. this.loose = !!options.loose
  987. this.includePrerelease = !!options.includePrerelease
  988. // First reduce all whitespace as much as possible so we do not have to rely
  989. // on potentially slow regexes like \s*. This is then stored and used for
  990. // future error messages as well.
  991. this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')
  992. // First, split on ||
  993. this.set = this.raw
  994. .split('||')
  995. // map the range to a 2d array of comparators
  996. .map(r => this.parseRange(r.trim()))
  997. // throw out any comparator lists that are empty
  998. // this generally means that it was not a valid range, which is allowed
  999. // in loose mode, but will still throw if the WHOLE range is invalid.
  1000. .filter(c => c.length)
  1001. if (!this.set.length) {
  1002. throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
  1003. }
  1004. // if we have any that are not the null set, throw out null sets.
  1005. if (this.set.length > 1) {
  1006. // keep the first one, in case they're all null sets
  1007. const first = this.set[0]
  1008. this.set = this.set.filter(c => !isNullSet(c[0]))
  1009. if (this.set.length === 0) {
  1010. this.set = [first]
  1011. } else if (this.set.length > 1) {
  1012. // if we have any that are *, then the range is just *
  1013. for (const c of this.set) {
  1014. if (c.length === 1 && isAny(c[0])) {
  1015. this.set = [c]
  1016. break
  1017. }
  1018. }
  1019. }
  1020. }
  1021. this.formatted = undefined
  1022. }
  1023. get range () {
  1024. if (this.formatted === undefined) {
  1025. this.formatted = ''
  1026. for (let i = 0; i < this.set.length; i++) {
  1027. if (i > 0) {
  1028. this.formatted += '||'
  1029. }
  1030. const comps = this.set[i]
  1031. for (let k = 0; k < comps.length; k++) {
  1032. if (k > 0) {
  1033. this.formatted += ' '
  1034. }
  1035. this.formatted += comps[k].toString().trim()
  1036. }
  1037. }
  1038. }
  1039. return this.formatted
  1040. }
  1041. format () {
  1042. return this.range
  1043. }
  1044. toString () {
  1045. return this.range
  1046. }
  1047. parseRange (range) {
  1048. // strip build metadata so it can't bleed into the version
  1049. range = range.replace(BUILDSTRIPRE, '')
  1050. // memoize range parsing for performance.
  1051. // this is a very hot path, and fully deterministic.
  1052. const memoOpts =
  1053. (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
  1054. (this.options.loose && FLAG_LOOSE)
  1055. const memoKey = memoOpts + ':' + range
  1056. const cached = cache.get(memoKey)
  1057. if (cached) {
  1058. return cached
  1059. }
  1060. const loose = this.options.loose
  1061. // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
  1062. const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
  1063. range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
  1064. debug('hyphen replace', range)
  1065. // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
  1066. range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
  1067. debug('comparator trim', range)
  1068. // `~ 1.2.3` => `~1.2.3`
  1069. range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
  1070. debug('tilde trim', range)
  1071. // `^ 1.2.3` => `^1.2.3`
  1072. range = range.replace(re[t.CARETTRIM], caretTrimReplace)
  1073. debug('caret trim', range)
  1074. // At this point, the range is completely trimmed and
  1075. // ready to be split into comparators.
  1076. let rangeList = range
  1077. .split(' ')
  1078. .map(comp => parseComparator(comp, this.options))
  1079. .join(' ')
  1080. .split(/\s+/)
  1081. // >=0.0.0 is equivalent to *
  1082. .map(comp => replaceGTE0(comp, this.options))
  1083. if (loose) {
  1084. // in loose mode, throw out any that are not valid comparators
  1085. rangeList = rangeList.filter(comp => {
  1086. debug('loose invalid filter', comp, this.options)
  1087. return !!comp.match(re[t.COMPARATORLOOSE])
  1088. })
  1089. }
  1090. debug('range list', rangeList)
  1091. // if any comparators are the null set, then replace with JUST null set
  1092. // if more than one comparator, remove any * comparators
  1093. // also, don't include the same comparator more than once
  1094. const rangeMap = new Map()
  1095. const comparators = rangeList.map(comp => new Comparator(comp, this.options))
  1096. for (const comp of comparators) {
  1097. if (isNullSet(comp)) {
  1098. return [comp]
  1099. }
  1100. rangeMap.set(comp.value, comp)
  1101. }
  1102. if (rangeMap.size > 1 && rangeMap.has('')) {
  1103. rangeMap.delete('')
  1104. }
  1105. const result = [...rangeMap.values()]
  1106. cache.set(memoKey, result)
  1107. return result
  1108. }
  1109. intersects (range, options) {
  1110. if (!(range instanceof Range)) {
  1111. throw new TypeError('a Range is required')
  1112. }
  1113. return this.set.some((thisComparators) => {
  1114. return (
  1115. isSatisfiable(thisComparators, options) &&
  1116. range.set.some((rangeComparators) => {
  1117. return (
  1118. isSatisfiable(rangeComparators, options) &&
  1119. thisComparators.every((thisComparator) => {
  1120. return rangeComparators.every((rangeComparator) => {
  1121. return thisComparator.intersects(rangeComparator, options)
  1122. })
  1123. })
  1124. )
  1125. })
  1126. )
  1127. })
  1128. }
  1129. // if ANY of the sets match ALL of its comparators, then pass
  1130. test (version) {
  1131. if (!version) {
  1132. return false
  1133. }
  1134. if (typeof version === 'string') {
  1135. try {
  1136. version = new SemVer(version, this.options)
  1137. } catch (er) {
  1138. return false
  1139. }
  1140. }
  1141. for (let i = 0; i < this.set.length; i++) {
  1142. if (testSet(this.set[i], version, this.options)) {
  1143. return true
  1144. }
  1145. }
  1146. return false
  1147. }
  1148. }
  1149. module.exports = Range
  1150. const LRU = __nccwpck_require__(1018)
  1151. const cache = new LRU()
  1152. const parseOptions = __nccwpck_require__(5131)
  1153. const Comparator = __nccwpck_require__(7712)
  1154. const debug = __nccwpck_require__(1736)
  1155. const SemVer = __nccwpck_require__(6644)
  1156. const {
  1157. safeRe: re,
  1158. src,
  1159. t,
  1160. comparatorTrimReplace,
  1161. tildeTrimReplace,
  1162. caretTrimReplace,
  1163. } = __nccwpck_require__(6102)
  1164. const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __nccwpck_require__(9962)
  1165. // unbounded global build-metadata stripper used by parseRange
  1166. const BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')
  1167. const isNullSet = c => c.value === '<0.0.0-0'
  1168. const isAny = c => c.value === ''
  1169. // take a set of comparators and determine whether there
  1170. // exists a version which can satisfy it
  1171. const isSatisfiable = (comparators, options) => {
  1172. let result = true
  1173. const remainingComparators = comparators.slice()
  1174. let testComparator = remainingComparators.pop()
  1175. while (result && remainingComparators.length) {
  1176. result = remainingComparators.every((otherComparator) => {
  1177. return testComparator.intersects(otherComparator, options)
  1178. })
  1179. testComparator = remainingComparators.pop()
  1180. }
  1181. return result
  1182. }
  1183. // comprised of xranges, tildes, stars, and gtlt's at this point.
  1184. // already replaced the hyphen ranges
  1185. // turn into a set of JUST comparators.
  1186. const parseComparator = (comp, options) => {
  1187. comp = comp.replace(re[t.BUILD], '')
  1188. debug('comp', comp, options)
  1189. comp = replaceCarets(comp, options)
  1190. debug('caret', comp)
  1191. comp = replaceTildes(comp, options)
  1192. debug('tildes', comp)
  1193. comp = replaceXRanges(comp, options)
  1194. debug('xrange', comp)
  1195. comp = replaceStars(comp, options)
  1196. debug('stars', comp)
  1197. return comp
  1198. }
  1199. const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
  1200. const invalidXRangeOrder = (M, m, p) => (
  1201. (isX(M) && !isX(m)) ||
  1202. (isX(m) && p && !isX(p))
  1203. )
  1204. // ~, ~> --> * (any, kinda silly)
  1205. // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
  1206. // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
  1207. // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
  1208. // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
  1209. // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
  1210. // ~0.0.1 --> >=0.0.1 <0.1.0-0
  1211. const replaceTildes = (comp, options) => {
  1212. return comp
  1213. .trim()
  1214. .split(/\s+/)
  1215. .map((c) => replaceTilde(c, options))
  1216. .join(' ')
  1217. }
  1218. const replaceTilde = (comp, options) => {
  1219. const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
  1220. return comp.replace(r, (_, M, m, p, pr) => {
  1221. debug('tilde', comp, _, M, m, p, pr)
  1222. let ret
  1223. if (isX(M)) {
  1224. ret = ''
  1225. } else if (isX(m)) {
  1226. ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
  1227. } else if (isX(p)) {
  1228. // ~1.2 == >=1.2.0 <1.3.0-0
  1229. ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
  1230. } else if (pr) {
  1231. debug('replaceTilde pr', pr)
  1232. ret = `>=${M}.${m}.${p}-${pr
  1233. } <${M}.${+m + 1}.0-0`
  1234. } else {
  1235. // ~1.2.3 == >=1.2.3 <1.3.0-0
  1236. ret = `>=${M}.${m}.${p
  1237. } <${M}.${+m + 1}.0-0`
  1238. }
  1239. debug('tilde return', ret)
  1240. return ret
  1241. })
  1242. }
  1243. // ^ --> * (any, kinda silly)
  1244. // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
  1245. // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
  1246. // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
  1247. // ^1.2.3 --> >=1.2.3 <2.0.0-0
  1248. // ^1.2.0 --> >=1.2.0 <2.0.0-0
  1249. // ^0.0.1 --> >=0.0.1 <0.0.2-0
  1250. // ^0.1.0 --> >=0.1.0 <0.2.0-0
  1251. const replaceCarets = (comp, options) => {
  1252. return comp
  1253. .trim()
  1254. .split(/\s+/)
  1255. .map((c) => replaceCaret(c, options))
  1256. .join(' ')
  1257. }
  1258. const replaceCaret = (comp, options) => {
  1259. debug('caret', comp, options)
  1260. const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
  1261. const z = options.includePrerelease ? '-0' : ''
  1262. return comp.replace(r, (_, M, m, p, pr) => {
  1263. debug('caret', comp, _, M, m, p, pr)
  1264. let ret
  1265. if (isX(M)) {
  1266. ret = ''
  1267. } else if (isX(m)) {
  1268. ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
  1269. } else if (isX(p)) {
  1270. if (M === '0') {
  1271. ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
  1272. } else {
  1273. ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
  1274. }
  1275. } else if (pr) {
  1276. debug('replaceCaret pr', pr)
  1277. if (M === '0') {
  1278. if (m === '0') {
  1279. ret = `>=${M}.${m}.${p}-${pr
  1280. } <${M}.${m}.${+p + 1}-0`
  1281. } else {
  1282. ret = `>=${M}.${m}.${p}-${pr
  1283. } <${M}.${+m + 1}.0-0`
  1284. }
  1285. } else {
  1286. ret = `>=${M}.${m}.${p}-${pr
  1287. } <${+M + 1}.0.0-0`
  1288. }
  1289. } else {
  1290. debug('no pr')
  1291. if (M === '0') {
  1292. if (m === '0') {
  1293. ret = `>=${M}.${m}.${p
  1294. } <${M}.${m}.${+p + 1}-0`
  1295. } else {
  1296. ret = `>=${M}.${m}.${p
  1297. } <${M}.${+m + 1}.0-0`
  1298. }
  1299. } else {
  1300. ret = `>=${M}.${m}.${p
  1301. } <${+M + 1}.0.0-0`
  1302. }
  1303. }
  1304. debug('caret return', ret)
  1305. return ret
  1306. })
  1307. }
  1308. const replaceXRanges = (comp, options) => {
  1309. debug('replaceXRanges', comp, options)
  1310. return comp
  1311. .split(/\s+/)
  1312. .map((c) => replaceXRange(c, options))
  1313. .join(' ')
  1314. }
  1315. const replaceXRange = (comp, options) => {
  1316. comp = comp.trim()
  1317. const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
  1318. return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
  1319. debug('xRange', comp, ret, gtlt, M, m, p, pr)
  1320. if (invalidXRangeOrder(M, m, p)) {
  1321. return comp
  1322. }
  1323. const xM = isX(M)
  1324. const xm = xM || isX(m)
  1325. const xp = xm || isX(p)
  1326. const anyX = xp
  1327. if (gtlt === '=' && anyX) {
  1328. gtlt = ''
  1329. }
  1330. // if we're including prereleases in the match, then we need
  1331. // to fix this to -0, the lowest possible prerelease value
  1332. pr = options.includePrerelease ? '-0' : ''
  1333. if (xM) {
  1334. if (gtlt === '>' || gtlt === '<') {
  1335. // nothing is allowed
  1336. ret = '<0.0.0-0'
  1337. } else {
  1338. // nothing is forbidden
  1339. ret = '*'
  1340. }
  1341. } else if (gtlt && anyX) {
  1342. // we know patch is an x, because we have any x at all.
  1343. // replace X with 0
  1344. if (xm) {
  1345. m = 0
  1346. }
  1347. p = 0
  1348. if (gtlt === '>') {
  1349. // >1 => >=2.0.0
  1350. // >1.2 => >=1.3.0
  1351. gtlt = '>='
  1352. if (xm) {
  1353. M = +M + 1
  1354. m = 0
  1355. p = 0
  1356. } else {
  1357. m = +m + 1
  1358. p = 0
  1359. }
  1360. } else if (gtlt === '<=') {
  1361. // <=0.7.x is actually <0.8.0, since any 0.7.x should
  1362. // pass. Similarly, <=7.x is actually <8.0.0, etc.
  1363. gtlt = '<'
  1364. if (xm) {
  1365. M = +M + 1
  1366. } else {
  1367. m = +m + 1
  1368. }
  1369. }
  1370. if (gtlt === '<') {
  1371. pr = '-0'
  1372. }
  1373. ret = `${gtlt + M}.${m}.${p}${pr}`
  1374. } else if (xm) {
  1375. ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
  1376. } else if (xp) {
  1377. ret = `>=${M}.${m}.0${pr
  1378. } <${M}.${+m + 1}.0-0`
  1379. }
  1380. debug('xRange return', ret)
  1381. return ret
  1382. })
  1383. }
  1384. // Because * is AND-ed with everything else in the comparator,
  1385. // and '' means "any version", just remove the *s entirely.
  1386. const replaceStars = (comp, options) => {
  1387. debug('replaceStars', comp, options)
  1388. // Looseness is ignored here. star is always as loose as it gets!
  1389. return comp
  1390. .trim()
  1391. .replace(re[t.STAR], '')
  1392. }
  1393. const replaceGTE0 = (comp, options) => {
  1394. debug('replaceGTE0', comp, options)
  1395. return comp
  1396. .trim()
  1397. .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
  1398. }
  1399. // This function is passed to string.replace(re[t.HYPHENRANGE])
  1400. // M, m, patch, prerelease, build
  1401. // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
  1402. // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
  1403. // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
  1404. // TODO build?
  1405. const hyphenReplace = incPr => ($0,
  1406. from, fM, fm, fp, fpr, fb,
  1407. to, tM, tm, tp, tpr) => {
  1408. if (isX(fM)) {
  1409. from = ''
  1410. } else if (isX(fm)) {
  1411. from = `>=${fM}.0.0${incPr ? '-0' : ''}`
  1412. } else if (isX(fp)) {
  1413. from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
  1414. } else if (fpr) {
  1415. from = `>=${from}`
  1416. } else {
  1417. from = `>=${from}${incPr ? '-0' : ''}`
  1418. }
  1419. if (isX(tM)) {
  1420. to = ''
  1421. } else if (isX(tm)) {
  1422. to = `<${+tM + 1}.0.0-0`
  1423. } else if (isX(tp)) {
  1424. to = `<${tM}.${+tm + 1}.0-0`
  1425. } else if (tpr) {
  1426. to = `<=${tM}.${tm}.${tp}-${tpr}`
  1427. } else if (incPr) {
  1428. to = `<${tM}.${tm}.${+tp + 1}-0`
  1429. } else {
  1430. to = `<=${to}`
  1431. }
  1432. return `${from} ${to}`.trim()
  1433. }
  1434. const testSet = (set, version, options) => {
  1435. for (let i = 0; i < set.length; i++) {
  1436. if (!set[i].test(version)) {
  1437. return false
  1438. }
  1439. }
  1440. if (version.prerelease.length && !options.includePrerelease) {
  1441. // Find the set of versions that are allowed to have prereleases
  1442. // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
  1443. // That should allow `1.2.3-pr.2` to pass.
  1444. // However, `1.2.4-alpha.notready` should NOT be allowed,
  1445. // even though it's within the range set by the comparators.
  1446. for (let i = 0; i < set.length; i++) {
  1447. debug(set[i].semver)
  1448. if (set[i].semver === Comparator.ANY) {
  1449. continue
  1450. }
  1451. if (set[i].semver.prerelease.length > 0) {
  1452. const allowed = set[i].semver
  1453. if (allowed.major === version.major &&
  1454. allowed.minor === version.minor &&
  1455. allowed.patch === version.patch) {
  1456. return true
  1457. }
  1458. }
  1459. }
  1460. // Version has a -pre, but it's not one of the ones we like.
  1461. return false
  1462. }
  1463. return true
  1464. }
  1465. /***/ }),
  1466. /***/ 6644:
  1467. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1468. const debug = __nccwpck_require__(1736)
  1469. const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(9962)
  1470. const { safeRe: re, t } = __nccwpck_require__(6102)
  1471. const parseOptions = __nccwpck_require__(5131)
  1472. const { compareIdentifiers } = __nccwpck_require__(3411)
  1473. const isPrereleaseIdentifier = (prerelease, identifier) => {
  1474. const identifiers = identifier.split('.')
  1475. if (identifiers.length > prerelease.length) {
  1476. return false
  1477. }
  1478. for (let i = 0; i < identifiers.length; i++) {
  1479. if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {
  1480. return false
  1481. }
  1482. }
  1483. return true
  1484. }
  1485. class SemVer {
  1486. constructor (version, options) {
  1487. options = parseOptions(options)
  1488. if (version instanceof SemVer) {
  1489. if (version.loose === !!options.loose &&
  1490. version.includePrerelease === !!options.includePrerelease) {
  1491. return version
  1492. } else {
  1493. version = version.version
  1494. }
  1495. } else if (typeof version !== 'string') {
  1496. throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
  1497. }
  1498. if (version.length > MAX_LENGTH) {
  1499. throw new TypeError(
  1500. `version is longer than ${MAX_LENGTH} characters`
  1501. )
  1502. }
  1503. debug('SemVer', version, options)
  1504. this.options = options
  1505. this.loose = !!options.loose
  1506. // this isn't actually relevant for versions, but keep it so that we
  1507. // don't run into trouble passing this.options around.
  1508. this.includePrerelease = !!options.includePrerelease
  1509. const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
  1510. if (!m) {
  1511. throw new TypeError(`Invalid Version: ${version}`)
  1512. }
  1513. this.raw = version
  1514. // these are actually numbers
  1515. this.major = +m[1]
  1516. this.minor = +m[2]
  1517. this.patch = +m[3]
  1518. if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
  1519. throw new TypeError('Invalid major version')
  1520. }
  1521. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
  1522. throw new TypeError('Invalid minor version')
  1523. }
  1524. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
  1525. throw new TypeError('Invalid patch version')
  1526. }
  1527. // numberify any prerelease numeric ids
  1528. if (!m[4]) {
  1529. this.prerelease = []
  1530. } else {
  1531. this.prerelease = m[4].split('.').map((id) => {
  1532. if (/^[0-9]+$/.test(id)) {
  1533. const num = +id
  1534. if (num >= 0 && num < MAX_SAFE_INTEGER) {
  1535. return num
  1536. }
  1537. }
  1538. return id
  1539. })
  1540. }
  1541. this.build = m[5] ? m[5].split('.') : []
  1542. this.format()
  1543. }
  1544. format () {
  1545. this.version = `${this.major}.${this.minor}.${this.patch}`
  1546. if (this.prerelease.length) {
  1547. this.version += `-${this.prerelease.join('.')}`
  1548. }
  1549. return this.version
  1550. }
  1551. toString () {
  1552. return this.version
  1553. }
  1554. compare (other) {
  1555. debug('SemVer.compare', this.version, this.options, other)
  1556. if (!(other instanceof SemVer)) {
  1557. if (typeof other === 'string' && other === this.version) {
  1558. return 0
  1559. }
  1560. other = new SemVer(other, this.options)
  1561. }
  1562. if (other.version === this.version) {
  1563. return 0
  1564. }
  1565. return this.compareMain(other) || this.comparePre(other)
  1566. }
  1567. compareMain (other) {
  1568. if (!(other instanceof SemVer)) {
  1569. other = new SemVer(other, this.options)
  1570. }
  1571. if (this.major < other.major) {
  1572. return -1
  1573. }
  1574. if (this.major > other.major) {
  1575. return 1
  1576. }
  1577. if (this.minor < other.minor) {
  1578. return -1
  1579. }
  1580. if (this.minor > other.minor) {
  1581. return 1
  1582. }
  1583. if (this.patch < other.patch) {
  1584. return -1
  1585. }
  1586. if (this.patch > other.patch) {
  1587. return 1
  1588. }
  1589. return 0
  1590. }
  1591. comparePre (other) {
  1592. if (!(other instanceof SemVer)) {
  1593. other = new SemVer(other, this.options)
  1594. }
  1595. // NOT having a prerelease is > having one
  1596. if (this.prerelease.length && !other.prerelease.length) {
  1597. return -1
  1598. } else if (!this.prerelease.length && other.prerelease.length) {
  1599. return 1
  1600. } else if (!this.prerelease.length && !other.prerelease.length) {
  1601. return 0
  1602. }
  1603. let i = 0
  1604. do {
  1605. const a = this.prerelease[i]
  1606. const b = other.prerelease[i]
  1607. debug('prerelease compare', i, a, b)
  1608. if (a === undefined && b === undefined) {
  1609. return 0
  1610. } else if (b === undefined) {
  1611. return 1
  1612. } else if (a === undefined) {
  1613. return -1
  1614. } else if (a === b) {
  1615. continue
  1616. } else {
  1617. return compareIdentifiers(a, b)
  1618. }
  1619. } while (++i)
  1620. }
  1621. compareBuild (other) {
  1622. if (!(other instanceof SemVer)) {
  1623. other = new SemVer(other, this.options)
  1624. }
  1625. let i = 0
  1626. do {
  1627. const a = this.build[i]
  1628. const b = other.build[i]
  1629. debug('build compare', i, a, b)
  1630. if (a === undefined && b === undefined) {
  1631. return 0
  1632. } else if (b === undefined) {
  1633. return 1
  1634. } else if (a === undefined) {
  1635. return -1
  1636. } else if (a === b) {
  1637. continue
  1638. } else {
  1639. return compareIdentifiers(a, b)
  1640. }
  1641. } while (++i)
  1642. }
  1643. // preminor will bump the version up to the next minor release, and immediately
  1644. // down to pre-release. premajor and prepatch work the same way.
  1645. inc (release, identifier, identifierBase) {
  1646. if (release.startsWith('pre')) {
  1647. if (!identifier && identifierBase === false) {
  1648. throw new Error('invalid increment argument: identifier is empty')
  1649. }
  1650. // Avoid an invalid semver results
  1651. if (identifier) {
  1652. const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])
  1653. if (!match || match[1] !== identifier) {
  1654. throw new Error(`invalid identifier: ${identifier}`)
  1655. }
  1656. }
  1657. }
  1658. switch (release) {
  1659. case 'premajor':
  1660. this.prerelease.length = 0
  1661. this.patch = 0
  1662. this.minor = 0
  1663. this.major++
  1664. this.inc('pre', identifier, identifierBase)
  1665. break
  1666. case 'preminor':
  1667. this.prerelease.length = 0
  1668. this.patch = 0
  1669. this.minor++
  1670. this.inc('pre', identifier, identifierBase)
  1671. break
  1672. case 'prepatch':
  1673. // If this is already a prerelease, it will bump to the next version
  1674. // drop any prereleases that might already exist, since they are not
  1675. // relevant at this point.
  1676. this.prerelease.length = 0
  1677. this.inc('patch', identifier, identifierBase)
  1678. this.inc('pre', identifier, identifierBase)
  1679. break
  1680. // If the input is a non-prerelease version, this acts the same as
  1681. // prepatch.
  1682. case 'prerelease':
  1683. if (this.prerelease.length === 0) {
  1684. this.inc('patch', identifier, identifierBase)
  1685. }
  1686. this.inc('pre', identifier, identifierBase)
  1687. break
  1688. case 'release':
  1689. if (this.prerelease.length === 0) {
  1690. throw new Error(`version ${this.raw} is not a prerelease`)
  1691. }
  1692. this.prerelease.length = 0
  1693. break
  1694. case 'major':
  1695. // If this is a pre-major version, bump up to the same major version.
  1696. // Otherwise increment major.
  1697. // 1.0.0-5 bumps to 1.0.0
  1698. // 1.1.0 bumps to 2.0.0
  1699. if (
  1700. this.minor !== 0 ||
  1701. this.patch !== 0 ||
  1702. this.prerelease.length === 0
  1703. ) {
  1704. this.major++
  1705. }
  1706. this.minor = 0
  1707. this.patch = 0
  1708. this.prerelease = []
  1709. break
  1710. case 'minor':
  1711. // If this is a pre-minor version, bump up to the same minor version.
  1712. // Otherwise increment minor.
  1713. // 1.2.0-5 bumps to 1.2.0
  1714. // 1.2.1 bumps to 1.3.0
  1715. if (this.patch !== 0 || this.prerelease.length === 0) {
  1716. this.minor++
  1717. }
  1718. this.patch = 0
  1719. this.prerelease = []
  1720. break
  1721. case 'patch':
  1722. // If this is not a pre-release version, it will increment the patch.
  1723. // If it is a pre-release it will bump up to the same patch version.
  1724. // 1.2.0-5 patches to 1.2.0
  1725. // 1.2.0 patches to 1.2.1
  1726. if (this.prerelease.length === 0) {
  1727. this.patch++
  1728. }
  1729. this.prerelease = []
  1730. break
  1731. // This probably shouldn't be used publicly.
  1732. // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
  1733. case 'pre': {
  1734. const base = Number(identifierBase) ? 1 : 0
  1735. if (this.prerelease.length === 0) {
  1736. this.prerelease = [base]
  1737. } else {
  1738. let i = this.prerelease.length
  1739. while (--i >= 0) {
  1740. if (typeof this.prerelease[i] === 'number') {
  1741. this.prerelease[i]++
  1742. i = -2
  1743. }
  1744. }
  1745. if (i === -1) {
  1746. // didn't increment anything
  1747. if (identifier === this.prerelease.join('.') && identifierBase === false) {
  1748. throw new Error('invalid increment argument: identifier already exists')
  1749. }
  1750. this.prerelease.push(base)
  1751. }
  1752. }
  1753. if (identifier) {
  1754. // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
  1755. // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
  1756. let prerelease = [identifier, base]
  1757. if (identifierBase === false) {
  1758. prerelease = [identifier]
  1759. }
  1760. if (isPrereleaseIdentifier(this.prerelease, identifier)) {
  1761. const prereleaseBase = this.prerelease[identifier.split('.').length]
  1762. if (isNaN(prereleaseBase)) {
  1763. this.prerelease = prerelease
  1764. }
  1765. } else {
  1766. this.prerelease = prerelease
  1767. }
  1768. }
  1769. break
  1770. }
  1771. default:
  1772. throw new Error(`invalid increment argument: ${release}`)
  1773. }
  1774. this.raw = this.format()
  1775. if (this.build.length) {
  1776. this.raw += `+${this.build.join('.')}`
  1777. }
  1778. return this
  1779. }
  1780. }
  1781. module.exports = SemVer
  1782. /***/ }),
  1783. /***/ 3590:
  1784. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1785. const parse = __nccwpck_require__(2080)
  1786. const clean = (version, options) => {
  1787. const s = parse(version.trim().replace(/^[=v]+/, ''), options)
  1788. return s ? s.version : null
  1789. }
  1790. module.exports = clean
  1791. /***/ }),
  1792. /***/ 9647:
  1793. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1794. const eq = __nccwpck_require__(273)
  1795. const neq = __nccwpck_require__(2991)
  1796. const gt = __nccwpck_require__(3740)
  1797. const gte = __nccwpck_require__(6297)
  1798. const lt = __nccwpck_require__(2115)
  1799. const lte = __nccwpck_require__(9824)
  1800. const cmp = (a, op, b, loose) => {
  1801. switch (op) {
  1802. case '===':
  1803. if (typeof a === 'object') {
  1804. a = a.version
  1805. }
  1806. if (typeof b === 'object') {
  1807. b = b.version
  1808. }
  1809. return a === b
  1810. case '!==':
  1811. if (typeof a === 'object') {
  1812. a = a.version
  1813. }
  1814. if (typeof b === 'object') {
  1815. b = b.version
  1816. }
  1817. return a !== b
  1818. case '':
  1819. case '=':
  1820. case '==':
  1821. return eq(a, b, loose)
  1822. case '!=':
  1823. return neq(a, b, loose)
  1824. case '>':
  1825. return gt(a, b, loose)
  1826. case '>=':
  1827. return gte(a, b, loose)
  1828. case '<':
  1829. return lt(a, b, loose)
  1830. case '<=':
  1831. return lte(a, b, loose)
  1832. default:
  1833. throw new TypeError(`Invalid operator: ${op}`)
  1834. }
  1835. }
  1836. module.exports = cmp
  1837. /***/ }),
  1838. /***/ 6141:
  1839. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1840. const SemVer = __nccwpck_require__(6644)
  1841. const parse = __nccwpck_require__(2080)
  1842. const { safeRe: re, t } = __nccwpck_require__(6102)
  1843. const coerce = (version, options) => {
  1844. if (version instanceof SemVer) {
  1845. return version
  1846. }
  1847. if (typeof version === 'number') {
  1848. version = String(version)
  1849. }
  1850. if (typeof version !== 'string') {
  1851. return null
  1852. }
  1853. options = options || {}
  1854. let match = null
  1855. if (!options.rtl) {
  1856. match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])
  1857. } else {
  1858. // Find the right-most coercible string that does not share
  1859. // a terminus with a more left-ward coercible string.
  1860. // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
  1861. // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
  1862. //
  1863. // Walk through the string checking with a /g regexp
  1864. // Manually set the index so as to pick up overlapping matches.
  1865. // Stop when we get a match that ends at the string end, since no
  1866. // coercible string can be more right-ward without the same terminus.
  1867. const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]
  1868. let next
  1869. while ((next = coerceRtlRegex.exec(version)) &&
  1870. (!match || match.index + match[0].length !== version.length)
  1871. ) {
  1872. if (!match ||
  1873. next.index + next[0].length !== match.index + match[0].length) {
  1874. match = next
  1875. }
  1876. coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length
  1877. }
  1878. // leave it in a clean state
  1879. coerceRtlRegex.lastIndex = -1
  1880. }
  1881. if (match === null) {
  1882. return null
  1883. }
  1884. const major = match[2]
  1885. const minor = match[3] || '0'
  1886. const patch = match[4] || '0'
  1887. const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''
  1888. const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''
  1889. return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
  1890. }
  1891. module.exports = coerce
  1892. /***/ }),
  1893. /***/ 2237:
  1894. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1895. const SemVer = __nccwpck_require__(6644)
  1896. const compareBuild = (a, b, loose) => {
  1897. const versionA = new SemVer(a, loose)
  1898. const versionB = new SemVer(b, loose)
  1899. return versionA.compare(versionB) || versionA.compareBuild(versionB)
  1900. }
  1901. module.exports = compareBuild
  1902. /***/ }),
  1903. /***/ 9539:
  1904. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1905. const compare = __nccwpck_require__(1136)
  1906. const compareLoose = (a, b) => compare(a, b, true)
  1907. module.exports = compareLoose
  1908. /***/ }),
  1909. /***/ 1136:
  1910. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1911. const SemVer = __nccwpck_require__(6644)
  1912. const compare = (a, b, loose) =>
  1913. new SemVer(a, loose).compare(new SemVer(b, loose))
  1914. module.exports = compare
  1915. /***/ }),
  1916. /***/ 3496:
  1917. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1918. const parse = __nccwpck_require__(2080)
  1919. const diff = (version1, version2) => {
  1920. const v1 = parse(version1, null, true)
  1921. const v2 = parse(version2, null, true)
  1922. const comparison = v1.compare(v2)
  1923. if (comparison === 0) {
  1924. return null
  1925. }
  1926. const v1Higher = comparison > 0
  1927. const highVersion = v1Higher ? v1 : v2
  1928. const lowVersion = v1Higher ? v2 : v1
  1929. const highHasPre = !!highVersion.prerelease.length
  1930. const lowHasPre = !!lowVersion.prerelease.length
  1931. if (lowHasPre && !highHasPre) {
  1932. // Going from prerelease -> no prerelease requires some special casing
  1933. // If the low version has only a major, then it will always be a major
  1934. // Some examples:
  1935. // 1.0.0-1 -> 1.0.0
  1936. // 1.0.0-1 -> 1.1.1
  1937. // 1.0.0-1 -> 2.0.0
  1938. if (!lowVersion.patch && !lowVersion.minor) {
  1939. return 'major'
  1940. }
  1941. // If the main part has no difference
  1942. if (lowVersion.compareMain(highVersion) === 0) {
  1943. if (lowVersion.minor && !lowVersion.patch) {
  1944. return 'minor'
  1945. }
  1946. return 'patch'
  1947. }
  1948. }
  1949. // add the `pre` prefix if we are going to a prerelease version
  1950. const prefix = highHasPre ? 'pre' : ''
  1951. if (v1.major !== v2.major) {
  1952. return prefix + 'major'
  1953. }
  1954. if (v1.minor !== v2.minor) {
  1955. return prefix + 'minor'
  1956. }
  1957. if (v1.patch !== v2.patch) {
  1958. return prefix + 'patch'
  1959. }
  1960. // high and low are prereleases
  1961. return 'prerelease'
  1962. }
  1963. module.exports = diff
  1964. /***/ }),
  1965. /***/ 273:
  1966. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1967. const compare = __nccwpck_require__(1136)
  1968. const eq = (a, b, loose) => compare(a, b, loose) === 0
  1969. module.exports = eq
  1970. /***/ }),
  1971. /***/ 3740:
  1972. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1973. const compare = __nccwpck_require__(1136)
  1974. const gt = (a, b, loose) => compare(a, b, loose) > 0
  1975. module.exports = gt
  1976. /***/ }),
  1977. /***/ 6297:
  1978. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1979. const compare = __nccwpck_require__(1136)
  1980. const gte = (a, b, loose) => compare(a, b, loose) >= 0
  1981. module.exports = gte
  1982. /***/ }),
  1983. /***/ 1999:
  1984. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  1985. const SemVer = __nccwpck_require__(6644)
  1986. const inc = (version, release, options, identifier, identifierBase) => {
  1987. if (typeof (options) === 'string') {
  1988. identifierBase = identifier
  1989. identifier = options
  1990. options = undefined
  1991. }
  1992. try {
  1993. return new SemVer(
  1994. version instanceof SemVer ? version.version : version,
  1995. options
  1996. ).inc(release, identifier, identifierBase).version
  1997. } catch (er) {
  1998. return null
  1999. }
  2000. }
  2001. module.exports = inc
  2002. /***/ }),
  2003. /***/ 2115:
  2004. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2005. const compare = __nccwpck_require__(1136)
  2006. const lt = (a, b, loose) => compare(a, b, loose) < 0
  2007. module.exports = lt
  2008. /***/ }),
  2009. /***/ 9824:
  2010. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2011. const compare = __nccwpck_require__(1136)
  2012. const lte = (a, b, loose) => compare(a, b, loose) <= 0
  2013. module.exports = lte
  2014. /***/ }),
  2015. /***/ 474:
  2016. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2017. const SemVer = __nccwpck_require__(6644)
  2018. const major = (a, loose) => new SemVer(a, loose).major
  2019. module.exports = major
  2020. /***/ }),
  2021. /***/ 2430:
  2022. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2023. const SemVer = __nccwpck_require__(6644)
  2024. const minor = (a, loose) => new SemVer(a, loose).minor
  2025. module.exports = minor
  2026. /***/ }),
  2027. /***/ 2991:
  2028. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2029. const compare = __nccwpck_require__(1136)
  2030. const neq = (a, b, loose) => compare(a, b, loose) !== 0
  2031. module.exports = neq
  2032. /***/ }),
  2033. /***/ 2080:
  2034. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2035. const SemVer = __nccwpck_require__(6644)
  2036. const parse = (version, options, throwErrors = false) => {
  2037. if (version instanceof SemVer) {
  2038. return version
  2039. }
  2040. try {
  2041. return new SemVer(version, options)
  2042. } catch (er) {
  2043. if (!throwErrors) {
  2044. return null
  2045. }
  2046. throw er
  2047. }
  2048. }
  2049. module.exports = parse
  2050. /***/ }),
  2051. /***/ 9629:
  2052. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2053. const SemVer = __nccwpck_require__(6644)
  2054. const patch = (a, loose) => new SemVer(a, loose).patch
  2055. module.exports = patch
  2056. /***/ }),
  2057. /***/ 6593:
  2058. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2059. const parse = __nccwpck_require__(2080)
  2060. const prerelease = (version, options) => {
  2061. const parsed = parse(version, options)
  2062. return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
  2063. }
  2064. module.exports = prerelease
  2065. /***/ }),
  2066. /***/ 4018:
  2067. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2068. const compare = __nccwpck_require__(1136)
  2069. const rcompare = (a, b, loose) => compare(b, a, loose)
  2070. module.exports = rcompare
  2071. /***/ }),
  2072. /***/ 1749:
  2073. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2074. const compareBuild = __nccwpck_require__(2237)
  2075. const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
  2076. module.exports = rsort
  2077. /***/ }),
  2078. /***/ 6326:
  2079. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2080. const Range = __nccwpck_require__(4535)
  2081. const satisfies = (version, range, options) => {
  2082. try {
  2083. range = new Range(range, options)
  2084. } catch (er) {
  2085. return false
  2086. }
  2087. return range.test(version)
  2088. }
  2089. module.exports = satisfies
  2090. /***/ }),
  2091. /***/ 5783:
  2092. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2093. const compareBuild = __nccwpck_require__(2237)
  2094. const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
  2095. module.exports = sort
  2096. /***/ }),
  2097. /***/ 7537:
  2098. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2099. const parse = __nccwpck_require__(2080)
  2100. const constants = __nccwpck_require__(9962)
  2101. const SemVer = __nccwpck_require__(6644)
  2102. const truncate = (version, truncation, options) => {
  2103. if (!constants.RELEASE_TYPES.includes(truncation)) {
  2104. return null
  2105. }
  2106. const clonedVersion = cloneInputVersion(version, options)
  2107. return clonedVersion && doTruncation(clonedVersion, truncation)
  2108. }
  2109. const cloneInputVersion = (version, options) => {
  2110. const versionStringToParse = (
  2111. version instanceof SemVer ? version.version : version
  2112. )
  2113. return parse(versionStringToParse, options)
  2114. }
  2115. const doTruncation = (version, truncation) => {
  2116. if (isPrerelease(truncation)) {
  2117. return version.version
  2118. }
  2119. version.prerelease = []
  2120. switch (truncation) {
  2121. case 'major':
  2122. version.minor = 0
  2123. version.patch = 0
  2124. break
  2125. case 'minor':
  2126. version.patch = 0
  2127. break
  2128. }
  2129. return version.format()
  2130. }
  2131. const isPrerelease = (type) => {
  2132. return type.startsWith('pre')
  2133. }
  2134. module.exports = truncate
  2135. /***/ }),
  2136. /***/ 3769:
  2137. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2138. const parse = __nccwpck_require__(2080)
  2139. const valid = (version, options) => {
  2140. const v = parse(version, options)
  2141. return v ? v.version : null
  2142. }
  2143. module.exports = valid
  2144. /***/ }),
  2145. /***/ 885:
  2146. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2147. // just pre-load all the stuff that index.js lazily exports
  2148. const internalRe = __nccwpck_require__(6102)
  2149. const constants = __nccwpck_require__(9962)
  2150. const SemVer = __nccwpck_require__(6644)
  2151. const identifiers = __nccwpck_require__(3411)
  2152. const parse = __nccwpck_require__(2080)
  2153. const valid = __nccwpck_require__(3769)
  2154. const clean = __nccwpck_require__(3590)
  2155. const inc = __nccwpck_require__(1999)
  2156. const diff = __nccwpck_require__(3496)
  2157. const major = __nccwpck_require__(474)
  2158. const minor = __nccwpck_require__(2430)
  2159. const patch = __nccwpck_require__(9629)
  2160. const prerelease = __nccwpck_require__(6593)
  2161. const compare = __nccwpck_require__(1136)
  2162. const rcompare = __nccwpck_require__(4018)
  2163. const compareLoose = __nccwpck_require__(9539)
  2164. const compareBuild = __nccwpck_require__(2237)
  2165. const sort = __nccwpck_require__(5783)
  2166. const rsort = __nccwpck_require__(1749)
  2167. const gt = __nccwpck_require__(3740)
  2168. const lt = __nccwpck_require__(2115)
  2169. const eq = __nccwpck_require__(273)
  2170. const neq = __nccwpck_require__(2991)
  2171. const gte = __nccwpck_require__(6297)
  2172. const lte = __nccwpck_require__(9824)
  2173. const cmp = __nccwpck_require__(9647)
  2174. const coerce = __nccwpck_require__(6141)
  2175. const truncate = __nccwpck_require__(7537)
  2176. const Comparator = __nccwpck_require__(7712)
  2177. const Range = __nccwpck_require__(4535)
  2178. const satisfies = __nccwpck_require__(6326)
  2179. const toComparators = __nccwpck_require__(7583)
  2180. const maxSatisfying = __nccwpck_require__(3036)
  2181. const minSatisfying = __nccwpck_require__(7534)
  2182. const minVersion = __nccwpck_require__(9725)
  2183. const validRange = __nccwpck_require__(9282)
  2184. const outside = __nccwpck_require__(9955)
  2185. const gtr = __nccwpck_require__(2915)
  2186. const ltr = __nccwpck_require__(1102)
  2187. const intersects = __nccwpck_require__(7116)
  2188. const simplifyRange = __nccwpck_require__(6077)
  2189. const subset = __nccwpck_require__(1880)
  2190. module.exports = {
  2191. parse,
  2192. valid,
  2193. clean,
  2194. inc,
  2195. diff,
  2196. major,
  2197. minor,
  2198. patch,
  2199. prerelease,
  2200. compare,
  2201. rcompare,
  2202. compareLoose,
  2203. compareBuild,
  2204. sort,
  2205. rsort,
  2206. gt,
  2207. lt,
  2208. eq,
  2209. neq,
  2210. gte,
  2211. lte,
  2212. cmp,
  2213. coerce,
  2214. truncate,
  2215. Comparator,
  2216. Range,
  2217. satisfies,
  2218. toComparators,
  2219. maxSatisfying,
  2220. minSatisfying,
  2221. minVersion,
  2222. validRange,
  2223. outside,
  2224. gtr,
  2225. ltr,
  2226. intersects,
  2227. simplifyRange,
  2228. subset,
  2229. SemVer,
  2230. re: internalRe.re,
  2231. src: internalRe.src,
  2232. tokens: internalRe.t,
  2233. SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
  2234. RELEASE_TYPES: constants.RELEASE_TYPES,
  2235. compareIdentifiers: identifiers.compareIdentifiers,
  2236. rcompareIdentifiers: identifiers.rcompareIdentifiers,
  2237. }
  2238. /***/ }),
  2239. /***/ 9962:
  2240. /***/ ((module) => {
  2241. // Note: this is the semver.org version of the spec that it implements
  2242. // Not necessarily the package version of this code.
  2243. const SEMVER_SPEC_VERSION = '2.0.0'
  2244. const MAX_LENGTH = 256
  2245. const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
  2246. /* istanbul ignore next */ 9007199254740991
  2247. // Max safe segment length for coercion.
  2248. const MAX_SAFE_COMPONENT_LENGTH = 16
  2249. // Max safe length for a build identifier. The max length minus 6 characters for
  2250. // the shortest version with a build 0.0.0+BUILD.
  2251. const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
  2252. const RELEASE_TYPES = [
  2253. 'major',
  2254. 'premajor',
  2255. 'minor',
  2256. 'preminor',
  2257. 'patch',
  2258. 'prepatch',
  2259. 'prerelease',
  2260. ]
  2261. module.exports = {
  2262. MAX_LENGTH,
  2263. MAX_SAFE_COMPONENT_LENGTH,
  2264. MAX_SAFE_BUILD_LENGTH,
  2265. MAX_SAFE_INTEGER,
  2266. RELEASE_TYPES,
  2267. SEMVER_SPEC_VERSION,
  2268. FLAG_INCLUDE_PRERELEASE: 0b001,
  2269. FLAG_LOOSE: 0b010,
  2270. }
  2271. /***/ }),
  2272. /***/ 1736:
  2273. /***/ ((module) => {
  2274. const debug = (
  2275. typeof process === 'object' &&
  2276. process.env &&
  2277. process.env.NODE_DEBUG &&
  2278. /\bsemver\b/i.test(process.env.NODE_DEBUG)
  2279. ) ? (...args) => console.error('SEMVER', ...args)
  2280. : () => {}
  2281. module.exports = debug
  2282. /***/ }),
  2283. /***/ 3411:
  2284. /***/ ((module) => {
  2285. const numeric = /^[0-9]+$/
  2286. const compareIdentifiers = (a, b) => {
  2287. if (typeof a === 'number' && typeof b === 'number') {
  2288. return a === b ? 0 : a < b ? -1 : 1
  2289. }
  2290. const anum = numeric.test(a)
  2291. const bnum = numeric.test(b)
  2292. if (anum && bnum) {
  2293. a = +a
  2294. b = +b
  2295. }
  2296. return a === b ? 0
  2297. : (anum && !bnum) ? -1
  2298. : (bnum && !anum) ? 1
  2299. : a < b ? -1
  2300. : 1
  2301. }
  2302. const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
  2303. module.exports = {
  2304. compareIdentifiers,
  2305. rcompareIdentifiers,
  2306. }
  2307. /***/ }),
  2308. /***/ 1018:
  2309. /***/ ((module) => {
  2310. class LRUCache {
  2311. constructor () {
  2312. this.max = 1000
  2313. this.map = new Map()
  2314. }
  2315. get (key) {
  2316. const value = this.map.get(key)
  2317. if (value === undefined) {
  2318. return undefined
  2319. } else {
  2320. // Remove the key from the map and add it to the end
  2321. this.map.delete(key)
  2322. this.map.set(key, value)
  2323. return value
  2324. }
  2325. }
  2326. delete (key) {
  2327. return this.map.delete(key)
  2328. }
  2329. set (key, value) {
  2330. const deleted = this.delete(key)
  2331. if (!deleted && value !== undefined) {
  2332. // If cache is full, delete the least recently used item
  2333. if (this.map.size >= this.max) {
  2334. const firstKey = this.map.keys().next().value
  2335. this.delete(firstKey)
  2336. }
  2337. this.map.set(key, value)
  2338. }
  2339. return this
  2340. }
  2341. }
  2342. module.exports = LRUCache
  2343. /***/ }),
  2344. /***/ 5131:
  2345. /***/ ((module) => {
  2346. // parse out just the options we care about
  2347. const looseOption = Object.freeze({ loose: true })
  2348. const emptyOpts = Object.freeze({ })
  2349. const parseOptions = options => {
  2350. if (!options) {
  2351. return emptyOpts
  2352. }
  2353. if (typeof options !== 'object') {
  2354. return looseOption
  2355. }
  2356. return options
  2357. }
  2358. module.exports = parseOptions
  2359. /***/ }),
  2360. /***/ 6102:
  2361. /***/ ((module, exports, __nccwpck_require__) => {
  2362. const {
  2363. MAX_SAFE_COMPONENT_LENGTH,
  2364. MAX_SAFE_BUILD_LENGTH,
  2365. MAX_LENGTH,
  2366. } = __nccwpck_require__(9962)
  2367. const debug = __nccwpck_require__(1736)
  2368. exports = module.exports = {}
  2369. // The actual regexps go on exports.re
  2370. const re = exports.re = []
  2371. const safeRe = exports.safeRe = []
  2372. const src = exports.src = []
  2373. const safeSrc = exports.safeSrc = []
  2374. const t = exports.t = {}
  2375. let R = 0
  2376. const LETTERDASHNUMBER = '[a-zA-Z0-9-]'
  2377. // Replace some greedy regex tokens to prevent regex dos issues. These regex are
  2378. // used internally via the safeRe object since all inputs in this library get
  2379. // normalized first to trim and collapse all extra whitespace. The original
  2380. // regexes are exported for userland consumption and lower level usage. A
  2381. // future breaking change could export the safer regex only with a note that
  2382. // all input should have extra whitespace removed.
  2383. const safeRegexReplacements = [
  2384. ['\\s', 1],
  2385. ['\\d', MAX_LENGTH],
  2386. [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
  2387. ]
  2388. const makeSafeRegex = (value) => {
  2389. for (const [token, max] of safeRegexReplacements) {
  2390. value = value
  2391. .split(`${token}*`).join(`${token}{0,${max}}`)
  2392. .split(`${token}+`).join(`${token}{1,${max}}`)
  2393. }
  2394. return value
  2395. }
  2396. const createToken = (name, value, isGlobal) => {
  2397. const safe = makeSafeRegex(value)
  2398. const index = R++
  2399. debug(name, index, value)
  2400. t[name] = index
  2401. src[index] = value
  2402. safeSrc[index] = safe
  2403. re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
  2404. safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
  2405. }
  2406. // The following Regular Expressions can be used for tokenizing,
  2407. // validating, and parsing SemVer version strings.
  2408. // ## Numeric Identifier
  2409. // A single `0`, or a non-zero digit followed by zero or more digits.
  2410. createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
  2411. createToken('NUMERICIDENTIFIERLOOSE', '\\d+')
  2412. // ## Non-numeric Identifier
  2413. // Zero or more digits, followed by a letter or hyphen, and then zero or
  2414. // more letters, digits, or hyphens.
  2415. createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)
  2416. // ## Main Version
  2417. // Three dot-separated numeric identifiers.
  2418. createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
  2419. `(${src[t.NUMERICIDENTIFIER]})\\.` +
  2420. `(${src[t.NUMERICIDENTIFIER]})`)
  2421. createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
  2422. `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
  2423. `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
  2424. // ## Pre-release Version Identifier
  2425. // A numeric identifier, or a non-numeric identifier.
  2426. // Non-numeric identifiers include numeric identifiers but can be longer.
  2427. // Therefore non-numeric identifiers must go first.
  2428. createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
  2429. }|${src[t.NUMERICIDENTIFIER]})`)
  2430. createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
  2431. }|${src[t.NUMERICIDENTIFIERLOOSE]})`)
  2432. // ## Pre-release Version
  2433. // Hyphen, followed by one or more dot-separated pre-release version
  2434. // identifiers.
  2435. createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
  2436. }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
  2437. createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
  2438. }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
  2439. // ## Build Metadata Identifier
  2440. // Any combination of digits, letters, or hyphens.
  2441. createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)
  2442. // ## Build Metadata
  2443. // Plus sign, followed by one or more period-separated build metadata
  2444. // identifiers.
  2445. createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
  2446. }(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
  2447. // ## Full Version String
  2448. // A main version, followed optionally by a pre-release version and
  2449. // build metadata.
  2450. // Note that the only major, minor, patch, and pre-release sections of
  2451. // the version string are capturing groups. The build metadata is not a
  2452. // capturing group, because it should not ever be used in version
  2453. // comparison.
  2454. createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
  2455. }${src[t.PRERELEASE]}?${
  2456. src[t.BUILD]}?`)
  2457. createToken('FULL', `^${src[t.FULLPLAIN]}$`)
  2458. // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
  2459. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
  2460. // common in the npm registry.
  2461. createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
  2462. }${src[t.PRERELEASELOOSE]}?${
  2463. src[t.BUILD]}?`)
  2464. createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
  2465. createToken('GTLT', '((?:<|>)?=?)')
  2466. // Something like "2.*" or "1.2.x".
  2467. // Note that "x.x" is a valid xRange identifier, meaning "any version"
  2468. // Only the first item is strictly required.
  2469. createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
  2470. createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
  2471. createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
  2472. `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
  2473. `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
  2474. `(?:${src[t.PRERELEASE]})?${
  2475. src[t.BUILD]}?` +
  2476. `)?)?`)
  2477. createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
  2478. `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
  2479. `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
  2480. `(?:${src[t.PRERELEASELOOSE]})?${
  2481. src[t.BUILD]}?` +
  2482. `)?)?`)
  2483. createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
  2484. createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
  2485. // Coercion.
  2486. // Extract anything that could conceivably be a part of a valid semver
  2487. createToken('COERCEPLAIN', `${'(^|[^\\d])' +
  2488. '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
  2489. `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
  2490. `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)
  2491. createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`)
  2492. createToken('COERCEFULL', src[t.COERCEPLAIN] +
  2493. `(?:${src[t.PRERELEASE]})?` +
  2494. `(?:${src[t.BUILD]})?` +
  2495. `(?:$|[^\\d])`)
  2496. createToken('COERCERTL', src[t.COERCE], true)
  2497. createToken('COERCERTLFULL', src[t.COERCEFULL], true)
  2498. // Tilde ranges.
  2499. // Meaning is "reasonably at or greater than"
  2500. createToken('LONETILDE', '(?:~>?)')
  2501. createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
  2502. exports.tildeTrimReplace = '$1~'
  2503. createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
  2504. createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
  2505. // Caret ranges.
  2506. // Meaning is "at least and backwards compatible with"
  2507. createToken('LONECARET', '(?:\\^)')
  2508. createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
  2509. exports.caretTrimReplace = '$1^'
  2510. createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
  2511. createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
  2512. // A simple gt/lt/eq thing, or just "" to indicate "any version"
  2513. createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
  2514. createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
  2515. // An expression to strip any whitespace between the gtlt and the thing
  2516. // it modifies, so that `> 1.2.3` ==> `>1.2.3`
  2517. createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
  2518. }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
  2519. exports.comparatorTrimReplace = '$1$2$3'
  2520. // Something like `1.2.3 - 1.2.4`
  2521. // Note that these all use the loose form, because they'll be
  2522. // checked against either the strict or loose comparator form
  2523. // later.
  2524. createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
  2525. `\\s+-\\s+` +
  2526. `(${src[t.XRANGEPLAIN]})` +
  2527. `\\s*$`)
  2528. createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
  2529. `\\s+-\\s+` +
  2530. `(${src[t.XRANGEPLAINLOOSE]})` +
  2531. `\\s*$`)
  2532. // Star ranges basically just allow anything at all.
  2533. createToken('STAR', '(<|>)?=?\\s*\\*')
  2534. // >=0.0.0 is like a star
  2535. createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
  2536. createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
  2537. /***/ }),
  2538. /***/ 2915:
  2539. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2540. // Determine if version is greater than all the versions possible in the range.
  2541. const outside = __nccwpck_require__(9955)
  2542. const gtr = (version, range, options) => outside(version, range, '>', options)
  2543. module.exports = gtr
  2544. /***/ }),
  2545. /***/ 7116:
  2546. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2547. const Range = __nccwpck_require__(4535)
  2548. const intersects = (r1, r2, options) => {
  2549. r1 = new Range(r1, options)
  2550. r2 = new Range(r2, options)
  2551. return r1.intersects(r2, options)
  2552. }
  2553. module.exports = intersects
  2554. /***/ }),
  2555. /***/ 1102:
  2556. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2557. const outside = __nccwpck_require__(9955)
  2558. // Determine if version is less than all the versions possible in the range
  2559. const ltr = (version, range, options) => outside(version, range, '<', options)
  2560. module.exports = ltr
  2561. /***/ }),
  2562. /***/ 3036:
  2563. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2564. const SemVer = __nccwpck_require__(6644)
  2565. const Range = __nccwpck_require__(4535)
  2566. const maxSatisfying = (versions, range, options) => {
  2567. let max = null
  2568. let maxSV = null
  2569. let rangeObj = null
  2570. try {
  2571. rangeObj = new Range(range, options)
  2572. } catch (er) {
  2573. return null
  2574. }
  2575. versions.forEach((v) => {
  2576. if (rangeObj.test(v)) {
  2577. // satisfies(v, range, options)
  2578. if (!max || maxSV.compare(v) === -1) {
  2579. // compare(max, v, true)
  2580. max = v
  2581. maxSV = new SemVer(max, options)
  2582. }
  2583. }
  2584. })
  2585. return max
  2586. }
  2587. module.exports = maxSatisfying
  2588. /***/ }),
  2589. /***/ 7534:
  2590. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2591. const SemVer = __nccwpck_require__(6644)
  2592. const Range = __nccwpck_require__(4535)
  2593. const minSatisfying = (versions, range, options) => {
  2594. let min = null
  2595. let minSV = null
  2596. let rangeObj = null
  2597. try {
  2598. rangeObj = new Range(range, options)
  2599. } catch (er) {
  2600. return null
  2601. }
  2602. versions.forEach((v) => {
  2603. if (rangeObj.test(v)) {
  2604. // satisfies(v, range, options)
  2605. if (!min || minSV.compare(v) === 1) {
  2606. // compare(min, v, true)
  2607. min = v
  2608. minSV = new SemVer(min, options)
  2609. }
  2610. }
  2611. })
  2612. return min
  2613. }
  2614. module.exports = minSatisfying
  2615. /***/ }),
  2616. /***/ 9725:
  2617. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2618. const SemVer = __nccwpck_require__(6644)
  2619. const Range = __nccwpck_require__(4535)
  2620. const gt = __nccwpck_require__(3740)
  2621. const minVersion = (range, loose) => {
  2622. range = new Range(range, loose)
  2623. let minver = new SemVer('0.0.0')
  2624. if (range.test(minver)) {
  2625. return minver
  2626. }
  2627. minver = new SemVer('0.0.0-0')
  2628. if (range.test(minver)) {
  2629. return minver
  2630. }
  2631. minver = null
  2632. for (let i = 0; i < range.set.length; ++i) {
  2633. const comparators = range.set[i]
  2634. let setMin = null
  2635. comparators.forEach((comparator) => {
  2636. // Clone to avoid manipulating the comparator's semver object.
  2637. const compver = new SemVer(comparator.semver.version)
  2638. switch (comparator.operator) {
  2639. case '>':
  2640. if (compver.prerelease.length === 0) {
  2641. compver.patch++
  2642. } else {
  2643. compver.prerelease.push(0)
  2644. }
  2645. compver.raw = compver.format()
  2646. /* fallthrough */
  2647. case '':
  2648. case '>=':
  2649. if (!setMin || gt(compver, setMin)) {
  2650. setMin = compver
  2651. }
  2652. break
  2653. case '<':
  2654. case '<=':
  2655. /* Ignore maximum versions */
  2656. break
  2657. /* istanbul ignore next */
  2658. default:
  2659. throw new Error(`Unexpected operation: ${comparator.operator}`)
  2660. }
  2661. })
  2662. if (setMin && (!minver || gt(minver, setMin))) {
  2663. minver = setMin
  2664. }
  2665. }
  2666. if (minver && range.test(minver)) {
  2667. return minver
  2668. }
  2669. return null
  2670. }
  2671. module.exports = minVersion
  2672. /***/ }),
  2673. /***/ 9955:
  2674. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2675. const SemVer = __nccwpck_require__(6644)
  2676. const Comparator = __nccwpck_require__(7712)
  2677. const { ANY } = Comparator
  2678. const Range = __nccwpck_require__(4535)
  2679. const satisfies = __nccwpck_require__(6326)
  2680. const gt = __nccwpck_require__(3740)
  2681. const lt = __nccwpck_require__(2115)
  2682. const lte = __nccwpck_require__(9824)
  2683. const gte = __nccwpck_require__(6297)
  2684. const outside = (version, range, hilo, options) => {
  2685. version = new SemVer(version, options)
  2686. range = new Range(range, options)
  2687. let gtfn, ltefn, ltfn, comp, ecomp
  2688. switch (hilo) {
  2689. case '>':
  2690. gtfn = gt
  2691. ltefn = lte
  2692. ltfn = lt
  2693. comp = '>'
  2694. ecomp = '>='
  2695. break
  2696. case '<':
  2697. gtfn = lt
  2698. ltefn = gte
  2699. ltfn = gt
  2700. comp = '<'
  2701. ecomp = '<='
  2702. break
  2703. default:
  2704. throw new TypeError('Must provide a hilo val of "<" or ">"')
  2705. }
  2706. // If it satisfies the range it is not outside
  2707. if (satisfies(version, range, options)) {
  2708. return false
  2709. }
  2710. // From now on, variable terms are as if we're in "gtr" mode.
  2711. // but note that everything is flipped for the "ltr" function.
  2712. for (let i = 0; i < range.set.length; ++i) {
  2713. const comparators = range.set[i]
  2714. let high = null
  2715. let low = null
  2716. comparators.forEach((comparator) => {
  2717. if (comparator.semver === ANY) {
  2718. comparator = new Comparator('>=0.0.0')
  2719. }
  2720. high = high || comparator
  2721. low = low || comparator
  2722. if (gtfn(comparator.semver, high.semver, options)) {
  2723. high = comparator
  2724. } else if (ltfn(comparator.semver, low.semver, options)) {
  2725. low = comparator
  2726. }
  2727. })
  2728. // If the edge version comparator has a operator then our version
  2729. // isn't outside it
  2730. if (high.operator === comp || high.operator === ecomp) {
  2731. return false
  2732. }
  2733. // If the lowest version comparator has an operator and our version
  2734. // is less than it then it isn't higher than the range
  2735. if ((!low.operator || low.operator === comp) &&
  2736. ltefn(version, low.semver)) {
  2737. return false
  2738. } else if (low.operator === ecomp && ltfn(version, low.semver)) {
  2739. return false
  2740. }
  2741. }
  2742. return true
  2743. }
  2744. module.exports = outside
  2745. /***/ }),
  2746. /***/ 6077:
  2747. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2748. // given a set of versions and a range, create a "simplified" range
  2749. // that includes the same versions that the original range does
  2750. // If the original range is shorter than the simplified one, return that.
  2751. const satisfies = __nccwpck_require__(6326)
  2752. const compare = __nccwpck_require__(1136)
  2753. module.exports = (versions, range, options) => {
  2754. const set = []
  2755. let first = null
  2756. let prev = null
  2757. const v = versions.sort((a, b) => compare(a, b, options))
  2758. for (const version of v) {
  2759. const included = satisfies(version, range, options)
  2760. if (included) {
  2761. prev = version
  2762. if (!first) {
  2763. first = version
  2764. }
  2765. } else {
  2766. if (prev) {
  2767. set.push([first, prev])
  2768. }
  2769. prev = null
  2770. first = null
  2771. }
  2772. }
  2773. if (first) {
  2774. set.push([first, null])
  2775. }
  2776. const ranges = []
  2777. for (const [min, max] of set) {
  2778. if (min === max) {
  2779. ranges.push(min)
  2780. } else if (!max && min === v[0]) {
  2781. ranges.push('*')
  2782. } else if (!max) {
  2783. ranges.push(`>=${min}`)
  2784. } else if (min === v[0]) {
  2785. ranges.push(`<=${max}`)
  2786. } else {
  2787. ranges.push(`${min} - ${max}`)
  2788. }
  2789. }
  2790. const simplified = ranges.join(' || ')
  2791. const original = typeof range.raw === 'string' ? range.raw : String(range)
  2792. return simplified.length < original.length ? simplified : range
  2793. }
  2794. /***/ }),
  2795. /***/ 1880:
  2796. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  2797. const Range = __nccwpck_require__(4535)
  2798. const Comparator = __nccwpck_require__(7712)
  2799. const { ANY } = Comparator
  2800. const satisfies = __nccwpck_require__(6326)
  2801. const compare = __nccwpck_require__(1136)
  2802. // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
  2803. // - Every simple range `r1, r2, ...` is a null set, OR
  2804. // - Every simple range `r1, r2, ...` which is not a null set is a subset of
  2805. // some `R1, R2, ...`
  2806. //
  2807. // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
  2808. // - If c is only the ANY comparator
  2809. // - If C is only the ANY comparator, return true
  2810. // - Else if in prerelease mode, return false
  2811. // - else replace c with `[>=0.0.0]`
  2812. // - If C is only the ANY comparator
  2813. // - if in prerelease mode, return true
  2814. // - else replace C with `[>=0.0.0]`
  2815. // - Let EQ be the set of = comparators in c
  2816. // - If EQ is more than one, return true (null set)
  2817. // - Let GT be the highest > or >= comparator in c
  2818. // - Let LT be the lowest < or <= comparator in c
  2819. // - If GT and LT, and GT.semver > LT.semver, return true (null set)
  2820. // - If any C is a = range, and GT or LT are set, return false
  2821. // - If EQ
  2822. // - If GT, and EQ does not satisfy GT, return true (null set)
  2823. // - If LT, and EQ does not satisfy LT, return true (null set)
  2824. // - If EQ satisfies every C, return true
  2825. // - Else return false
  2826. // - If GT
  2827. // - If GT.semver is lower than any > or >= comp in C, return false
  2828. // - If GT is >=, and GT.semver does not satisfy every C, return false
  2829. // - If GT.semver has a prerelease, and not in prerelease mode
  2830. // - If no C has a prerelease and the GT.semver tuple, return false
  2831. // - If LT
  2832. // - If LT.semver is greater than any < or <= comp in C, return false
  2833. // - If LT is <=, and LT.semver does not satisfy every C, return false
  2834. // - If LT.semver has a prerelease, and not in prerelease mode
  2835. // - If no C has a prerelease and the LT.semver tuple, return false
  2836. // - Else return true
  2837. const subset = (sub, dom, options = {}) => {
  2838. if (sub === dom) {
  2839. return true
  2840. }
  2841. sub = new Range(sub, options)
  2842. dom = new Range(dom, options)
  2843. let sawNonNull = false
  2844. OUTER: for (const simpleSub of sub.set) {
  2845. for (const simpleDom of dom.set) {
  2846. const isSub = simpleSubset(simpleSub, simpleDom, options)
  2847. sawNonNull = sawNonNull || isSub !== null
  2848. if (isSub) {
  2849. continue OUTER
  2850. }
  2851. }
  2852. // the null set is a subset of everything, but null simple ranges in
  2853. // a complex range should be ignored. so if we saw a non-null range,
  2854. // then we know this isn't a subset, but if EVERY simple range was null,
  2855. // then it is a subset.
  2856. if (sawNonNull) {
  2857. return false
  2858. }
  2859. }
  2860. return true
  2861. }
  2862. const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]
  2863. const minimumVersion = [new Comparator('>=0.0.0')]
  2864. const simpleSubset = (sub, dom, options) => {
  2865. if (sub === dom) {
  2866. return true
  2867. }
  2868. if (sub.length === 1 && sub[0].semver === ANY) {
  2869. if (dom.length === 1 && dom[0].semver === ANY) {
  2870. return true
  2871. } else if (options.includePrerelease) {
  2872. sub = minimumVersionWithPreRelease
  2873. } else {
  2874. sub = minimumVersion
  2875. }
  2876. }
  2877. if (dom.length === 1 && dom[0].semver === ANY) {
  2878. if (options.includePrerelease) {
  2879. return true
  2880. } else {
  2881. dom = minimumVersion
  2882. }
  2883. }
  2884. const eqSet = new Set()
  2885. let gt, lt
  2886. for (const c of sub) {
  2887. if (c.operator === '>' || c.operator === '>=') {
  2888. gt = higherGT(gt, c, options)
  2889. } else if (c.operator === '<' || c.operator === '<=') {
  2890. lt = lowerLT(lt, c, options)
  2891. } else {
  2892. eqSet.add(c.semver)
  2893. }
  2894. }
  2895. if (eqSet.size > 1) {
  2896. return null
  2897. }
  2898. let gtltComp
  2899. if (gt && lt) {
  2900. gtltComp = compare(gt.semver, lt.semver, options)
  2901. if (gtltComp > 0) {
  2902. return null
  2903. } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
  2904. return null
  2905. }
  2906. }
  2907. // will iterate one or zero times
  2908. for (const eq of eqSet) {
  2909. if (gt && !satisfies(eq, String(gt), options)) {
  2910. return null
  2911. }
  2912. if (lt && !satisfies(eq, String(lt), options)) {
  2913. return null
  2914. }
  2915. for (const c of dom) {
  2916. if (!satisfies(eq, String(c), options)) {
  2917. return false
  2918. }
  2919. }
  2920. return true
  2921. }
  2922. let higher, lower
  2923. let hasDomLT, hasDomGT
  2924. // if the subset has a prerelease, we need a comparator in the superset
  2925. // with the same tuple and a prerelease, or it's not a subset
  2926. let needDomLTPre = lt &&
  2927. !options.includePrerelease &&
  2928. lt.semver.prerelease.length ? lt.semver : false
  2929. let needDomGTPre = gt &&
  2930. !options.includePrerelease &&
  2931. gt.semver.prerelease.length ? gt.semver : false
  2932. // exception: <1.2.3-0 is the same as <1.2.3
  2933. if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
  2934. lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
  2935. needDomLTPre = false
  2936. }
  2937. for (const c of dom) {
  2938. hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
  2939. hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
  2940. if (gt) {
  2941. if (needDomGTPre) {
  2942. if (c.semver.prerelease && c.semver.prerelease.length &&
  2943. c.semver.major === needDomGTPre.major &&
  2944. c.semver.minor === needDomGTPre.minor &&
  2945. c.semver.patch === needDomGTPre.patch) {
  2946. needDomGTPre = false
  2947. }
  2948. }
  2949. if (c.operator === '>' || c.operator === '>=') {
  2950. higher = higherGT(gt, c, options)
  2951. if (higher === c && higher !== gt) {
  2952. return false
  2953. }
  2954. } else if (gt.operator === '>=' && !c.test(gt.semver)) {
  2955. return false
  2956. }
  2957. }
  2958. if (lt) {
  2959. if (needDomLTPre) {
  2960. if (c.semver.prerelease && c.semver.prerelease.length &&
  2961. c.semver.major === needDomLTPre.major &&
  2962. c.semver.minor === needDomLTPre.minor &&
  2963. c.semver.patch === needDomLTPre.patch) {
  2964. needDomLTPre = false
  2965. }
  2966. }
  2967. if (c.operator === '<' || c.operator === '<=') {
  2968. lower = lowerLT(lt, c, options)
  2969. if (lower === c && lower !== lt) {
  2970. return false
  2971. }
  2972. } else if (lt.operator === '<=' && !c.test(lt.semver)) {
  2973. return false
  2974. }
  2975. }
  2976. if (!c.operator && (lt || gt) && gtltComp !== 0) {
  2977. return false
  2978. }
  2979. }
  2980. // if there was a < or >, and nothing in the dom, then must be false
  2981. // UNLESS it was limited by another range in the other direction.
  2982. // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
  2983. if (gt && hasDomLT && !lt && gtltComp !== 0) {
  2984. return false
  2985. }
  2986. if (lt && hasDomGT && !gt && gtltComp !== 0) {
  2987. return false
  2988. }
  2989. // we needed a prerelease range in a specific tuple, but didn't get one
  2990. // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
  2991. // because it includes prereleases in the 1.2.3 tuple
  2992. if (needDomGTPre || needDomLTPre) {
  2993. return false
  2994. }
  2995. return true
  2996. }
  2997. // >=1.2.3 is lower than >1.2.3
  2998. const higherGT = (a, b, options) => {
  2999. if (!a) {
  3000. return b
  3001. }
  3002. const comp = compare(a.semver, b.semver, options)
  3003. return comp > 0 ? a
  3004. : comp < 0 ? b
  3005. : b.operator === '>' && a.operator === '>=' ? b
  3006. : a
  3007. }
  3008. // <=1.2.3 is higher than <1.2.3
  3009. const lowerLT = (a, b, options) => {
  3010. if (!a) {
  3011. return b
  3012. }
  3013. const comp = compare(a.semver, b.semver, options)
  3014. return comp < 0 ? a
  3015. : comp > 0 ? b
  3016. : b.operator === '<' && a.operator === '<=' ? b
  3017. : a
  3018. }
  3019. module.exports = subset
  3020. /***/ }),
  3021. /***/ 7583:
  3022. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  3023. const Range = __nccwpck_require__(4535)
  3024. // Mostly just for testing and legacy API reasons
  3025. const toComparators = (range, options) =>
  3026. new Range(range, options).set
  3027. .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
  3028. module.exports = toComparators
  3029. /***/ }),
  3030. /***/ 9282:
  3031. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  3032. const Range = __nccwpck_require__(4535)
  3033. const validRange = (range, options) => {
  3034. try {
  3035. // Return '*' instead of '' so that truthiness works.
  3036. // This will throw if it's invalid anyway
  3037. return new Range(range, options).range || '*'
  3038. } catch (er) {
  3039. return null
  3040. }
  3041. }
  3042. module.exports = validRange
  3043. /***/ }),
  3044. /***/ 770:
  3045. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  3046. module.exports = __nccwpck_require__(218);
  3047. /***/ }),
  3048. /***/ 218:
  3049. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  3050. var net = __nccwpck_require__(9278);
  3051. var tls = __nccwpck_require__(4756);
  3052. var http = __nccwpck_require__(8611);
  3053. var https = __nccwpck_require__(5692);
  3054. var events = __nccwpck_require__(4434);
  3055. var assert = __nccwpck_require__(2613);
  3056. var util = __nccwpck_require__(9023);
  3057. exports.httpOverHttp = httpOverHttp;
  3058. exports.httpsOverHttp = httpsOverHttp;
  3059. exports.httpOverHttps = httpOverHttps;
  3060. exports.httpsOverHttps = httpsOverHttps;
  3061. function httpOverHttp(options) {
  3062. var agent = new TunnelingAgent(options);
  3063. agent.request = http.request;
  3064. return agent;
  3065. }
  3066. function httpsOverHttp(options) {
  3067. var agent = new TunnelingAgent(options);
  3068. agent.request = http.request;
  3069. agent.createSocket = createSecureSocket;
  3070. agent.defaultPort = 443;
  3071. return agent;
  3072. }
  3073. function httpOverHttps(options) {
  3074. var agent = new TunnelingAgent(options);
  3075. agent.request = https.request;
  3076. return agent;
  3077. }
  3078. function httpsOverHttps(options) {
  3079. var agent = new TunnelingAgent(options);
  3080. agent.request = https.request;
  3081. agent.createSocket = createSecureSocket;
  3082. agent.defaultPort = 443;
  3083. return agent;
  3084. }
  3085. function TunnelingAgent(options) {
  3086. var self = this;
  3087. self.options = options || {};
  3088. self.proxyOptions = self.options.proxy || {};
  3089. self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;
  3090. self.requests = [];
  3091. self.sockets = [];
  3092. self.on('free', function onFree(socket, host, port, localAddress) {
  3093. var options = toOptions(host, port, localAddress);
  3094. for (var i = 0, len = self.requests.length; i < len; ++i) {
  3095. var pending = self.requests[i];
  3096. if (pending.host === options.host && pending.port === options.port) {
  3097. // Detect the request to connect same origin server,
  3098. // reuse the connection.
  3099. self.requests.splice(i, 1);
  3100. pending.request.onSocket(socket);
  3101. return;
  3102. }
  3103. }
  3104. socket.destroy();
  3105. self.removeSocket(socket);
  3106. });
  3107. }
  3108. util.inherits(TunnelingAgent, events.EventEmitter);
  3109. TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {
  3110. var self = this;
  3111. var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));
  3112. if (self.sockets.length >= this.maxSockets) {
  3113. // We are over limit so we'll add it to the queue.
  3114. self.requests.push(options);
  3115. return;
  3116. }
  3117. // If we are under maxSockets create a new one.
  3118. self.createSocket(options, function(socket) {
  3119. socket.on('free', onFree);
  3120. socket.on('close', onCloseOrRemove);
  3121. socket.on('agentRemove', onCloseOrRemove);
  3122. req.onSocket(socket);
  3123. function onFree() {
  3124. self.emit('free', socket, options);
  3125. }
  3126. function onCloseOrRemove(err) {
  3127. self.removeSocket(socket);
  3128. socket.removeListener('free', onFree);
  3129. socket.removeListener('close', onCloseOrRemove);
  3130. socket.removeListener('agentRemove', onCloseOrRemove);
  3131. }
  3132. });
  3133. };
  3134. TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
  3135. var self = this;
  3136. var placeholder = {};
  3137. self.sockets.push(placeholder);
  3138. var connectOptions = mergeOptions({}, self.proxyOptions, {
  3139. method: 'CONNECT',
  3140. path: options.host + ':' + options.port,
  3141. agent: false,
  3142. headers: {
  3143. host: options.host + ':' + options.port
  3144. }
  3145. });
  3146. if (options.localAddress) {
  3147. connectOptions.localAddress = options.localAddress;
  3148. }
  3149. if (connectOptions.proxyAuth) {
  3150. connectOptions.headers = connectOptions.headers || {};
  3151. connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
  3152. new Buffer(connectOptions.proxyAuth).toString('base64');
  3153. }
  3154. debug('making CONNECT request');
  3155. var connectReq = self.request(connectOptions);
  3156. connectReq.useChunkedEncodingByDefault = false; // for v0.6
  3157. connectReq.once('response', onResponse); // for v0.6
  3158. connectReq.once('upgrade', onUpgrade); // for v0.6
  3159. connectReq.once('connect', onConnect); // for v0.7 or later
  3160. connectReq.once('error', onError);
  3161. connectReq.end();
  3162. function onResponse(res) {
  3163. // Very hacky. This is necessary to avoid http-parser leaks.
  3164. res.upgrade = true;
  3165. }
  3166. function onUpgrade(res, socket, head) {
  3167. // Hacky.
  3168. process.nextTick(function() {
  3169. onConnect(res, socket, head);
  3170. });
  3171. }
  3172. function onConnect(res, socket, head) {
  3173. connectReq.removeAllListeners();
  3174. socket.removeAllListeners();
  3175. if (res.statusCode !== 200) {
  3176. debug('tunneling socket could not be established, statusCode=%d',
  3177. res.statusCode);
  3178. socket.destroy();
  3179. var error = new Error('tunneling socket could not be established, ' +
  3180. 'statusCode=' + res.statusCode);
  3181. error.code = 'ECONNRESET';
  3182. options.request.emit('error', error);
  3183. self.removeSocket(placeholder);
  3184. return;
  3185. }
  3186. if (head.length > 0) {
  3187. debug('got illegal response body from proxy');
  3188. socket.destroy();
  3189. var error = new Error('got illegal response body from proxy');
  3190. error.code = 'ECONNRESET';
  3191. options.request.emit('error', error);
  3192. self.removeSocket(placeholder);
  3193. return;
  3194. }
  3195. debug('tunneling connection has established');
  3196. self.sockets[self.sockets.indexOf(placeholder)] = socket;
  3197. return cb(socket);
  3198. }
  3199. function onError(cause) {
  3200. connectReq.removeAllListeners();
  3201. debug('tunneling socket could not be established, cause=%s\n',
  3202. cause.message, cause.stack);
  3203. var error = new Error('tunneling socket could not be established, ' +
  3204. 'cause=' + cause.message);
  3205. error.code = 'ECONNRESET';
  3206. options.request.emit('error', error);
  3207. self.removeSocket(placeholder);
  3208. }
  3209. };
  3210. TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
  3211. var pos = this.sockets.indexOf(socket)
  3212. if (pos === -1) {
  3213. return;
  3214. }
  3215. this.sockets.splice(pos, 1);
  3216. var pending = this.requests.shift();
  3217. if (pending) {
  3218. // If we have pending requests and a socket gets closed a new one
  3219. // needs to be created to take over in the pool for the one that closed.
  3220. this.createSocket(pending, function(socket) {
  3221. pending.request.onSocket(socket);
  3222. });
  3223. }
  3224. };
  3225. function createSecureSocket(options, cb) {
  3226. var self = this;
  3227. TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
  3228. var hostHeader = options.request.getHeader('host');
  3229. var tlsOptions = mergeOptions({}, self.options, {
  3230. socket: socket,
  3231. servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host
  3232. });
  3233. // 0 is dummy port for v0.6
  3234. var secureSocket = tls.connect(0, tlsOptions);
  3235. self.sockets[self.sockets.indexOf(socket)] = secureSocket;
  3236. cb(secureSocket);
  3237. });
  3238. }
  3239. function toOptions(host, port, localAddress) {
  3240. if (typeof host === 'string') { // since v0.10
  3241. return {
  3242. host: host,
  3243. port: port,
  3244. localAddress: localAddress
  3245. };
  3246. }
  3247. return host; // for v0.11 or later
  3248. }
  3249. function mergeOptions(target) {
  3250. for (var i = 1, len = arguments.length; i < len; ++i) {
  3251. var overrides = arguments[i];
  3252. if (typeof overrides === 'object') {
  3253. var keys = Object.keys(overrides);
  3254. for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
  3255. var k = keys[j];
  3256. if (overrides[k] !== undefined) {
  3257. target[k] = overrides[k];
  3258. }
  3259. }
  3260. }
  3261. }
  3262. return target;
  3263. }
  3264. var debug;
  3265. if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
  3266. debug = function() {
  3267. var args = Array.prototype.slice.call(arguments);
  3268. if (typeof args[0] === 'string') {
  3269. args[0] = 'TUNNEL: ' + args[0];
  3270. } else {
  3271. args.unshift('TUNNEL:');
  3272. }
  3273. console.error.apply(console, args);
  3274. }
  3275. } else {
  3276. debug = function() {};
  3277. }
  3278. exports.debug = debug; // for test
  3279. /***/ }),
  3280. /***/ 6752:
  3281. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  3282. const Client = __nccwpck_require__(3701)
  3283. const Dispatcher = __nccwpck_require__(883)
  3284. const Pool = __nccwpck_require__(628)
  3285. const BalancedPool = __nccwpck_require__(837)
  3286. const Agent = __nccwpck_require__(7405)
  3287. const ProxyAgent = __nccwpck_require__(6672)
  3288. const EnvHttpProxyAgent = __nccwpck_require__(3137)
  3289. const RetryAgent = __nccwpck_require__(50)
  3290. const errors = __nccwpck_require__(8707)
  3291. const util = __nccwpck_require__(3440)
  3292. const { InvalidArgumentError } = errors
  3293. const api = __nccwpck_require__(6615)
  3294. const buildConnector = __nccwpck_require__(9136)
  3295. const MockClient = __nccwpck_require__(7365)
  3296. const MockAgent = __nccwpck_require__(7501)
  3297. const MockPool = __nccwpck_require__(4004)
  3298. const mockErrors = __nccwpck_require__(2429)
  3299. const RetryHandler = __nccwpck_require__(7816)
  3300. const { getGlobalDispatcher, setGlobalDispatcher } = __nccwpck_require__(2581)
  3301. const DecoratorHandler = __nccwpck_require__(8155)
  3302. const RedirectHandler = __nccwpck_require__(8754)
  3303. const createRedirectInterceptor = __nccwpck_require__(5092)
  3304. Object.assign(Dispatcher.prototype, api)
  3305. module.exports.Dispatcher = Dispatcher
  3306. module.exports.Client = Client
  3307. module.exports.Pool = Pool
  3308. module.exports.BalancedPool = BalancedPool
  3309. module.exports.Agent = Agent
  3310. module.exports.ProxyAgent = ProxyAgent
  3311. module.exports.EnvHttpProxyAgent = EnvHttpProxyAgent
  3312. module.exports.RetryAgent = RetryAgent
  3313. module.exports.RetryHandler = RetryHandler
  3314. module.exports.DecoratorHandler = DecoratorHandler
  3315. module.exports.RedirectHandler = RedirectHandler
  3316. module.exports.createRedirectInterceptor = createRedirectInterceptor
  3317. module.exports.interceptors = {
  3318. redirect: __nccwpck_require__(1514),
  3319. retry: __nccwpck_require__(2026),
  3320. dump: __nccwpck_require__(8060),
  3321. dns: __nccwpck_require__(379)
  3322. }
  3323. module.exports.buildConnector = buildConnector
  3324. module.exports.errors = errors
  3325. module.exports.util = {
  3326. parseHeaders: util.parseHeaders,
  3327. headerNameToString: util.headerNameToString
  3328. }
  3329. function makeDispatcher (fn) {
  3330. return (url, opts, handler) => {
  3331. if (typeof opts === 'function') {
  3332. handler = opts
  3333. opts = null
  3334. }
  3335. if (!url || (typeof url !== 'string' && typeof url !== 'object' && !(url instanceof URL))) {
  3336. throw new InvalidArgumentError('invalid url')
  3337. }
  3338. if (opts != null && typeof opts !== 'object') {
  3339. throw new InvalidArgumentError('invalid opts')
  3340. }
  3341. if (opts && opts.path != null) {
  3342. if (typeof opts.path !== 'string') {
  3343. throw new InvalidArgumentError('invalid opts.path')
  3344. }
  3345. let path = opts.path
  3346. if (!opts.path.startsWith('/')) {
  3347. path = `/${path}`
  3348. }
  3349. url = new URL(util.parseOrigin(url).origin + path)
  3350. } else {
  3351. if (!opts) {
  3352. opts = typeof url === 'object' ? url : {}
  3353. }
  3354. url = util.parseURL(url)
  3355. }
  3356. const { agent, dispatcher = getGlobalDispatcher() } = opts
  3357. if (agent) {
  3358. throw new InvalidArgumentError('unsupported opts.agent. Did you mean opts.client?')
  3359. }
  3360. return fn.call(dispatcher, {
  3361. ...opts,
  3362. origin: url.origin,
  3363. path: url.search ? `${url.pathname}${url.search}` : url.pathname,
  3364. method: opts.method || (opts.body ? 'PUT' : 'GET')
  3365. }, handler)
  3366. }
  3367. }
  3368. module.exports.setGlobalDispatcher = setGlobalDispatcher
  3369. module.exports.getGlobalDispatcher = getGlobalDispatcher
  3370. const fetchImpl = (__nccwpck_require__(4398).fetch)
  3371. module.exports.fetch = async function fetch (init, options = undefined) {
  3372. try {
  3373. return await fetchImpl(init, options)
  3374. } catch (err) {
  3375. if (err && typeof err === 'object') {
  3376. Error.captureStackTrace(err)
  3377. }
  3378. throw err
  3379. }
  3380. }
  3381. module.exports.Headers = __nccwpck_require__(660).Headers
  3382. module.exports.Response = __nccwpck_require__(9051).Response
  3383. module.exports.Request = __nccwpck_require__(9967).Request
  3384. module.exports.FormData = __nccwpck_require__(5910).FormData
  3385. module.exports.File = globalThis.File ?? (__nccwpck_require__(4573).File)
  3386. module.exports.FileReader = __nccwpck_require__(8355).FileReader
  3387. const { setGlobalOrigin, getGlobalOrigin } = __nccwpck_require__(1059)
  3388. module.exports.setGlobalOrigin = setGlobalOrigin
  3389. module.exports.getGlobalOrigin = getGlobalOrigin
  3390. const { CacheStorage } = __nccwpck_require__(3245)
  3391. const { kConstruct } = __nccwpck_require__(109)
  3392. // Cache & CacheStorage are tightly coupled with fetch. Even if it may run
  3393. // in an older version of Node, it doesn't have any use without fetch.
  3394. module.exports.caches = new CacheStorage(kConstruct)
  3395. const { deleteCookie, getCookies, getSetCookies, setCookie } = __nccwpck_require__(9061)
  3396. module.exports.deleteCookie = deleteCookie
  3397. module.exports.getCookies = getCookies
  3398. module.exports.getSetCookies = getSetCookies
  3399. module.exports.setCookie = setCookie
  3400. const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(1900)
  3401. module.exports.parseMIMEType = parseMIMEType
  3402. module.exports.serializeAMimeType = serializeAMimeType
  3403. const { CloseEvent, ErrorEvent, MessageEvent } = __nccwpck_require__(5188)
  3404. module.exports.WebSocket = __nccwpck_require__(3726).WebSocket
  3405. module.exports.CloseEvent = CloseEvent
  3406. module.exports.ErrorEvent = ErrorEvent
  3407. module.exports.MessageEvent = MessageEvent
  3408. module.exports.request = makeDispatcher(api.request)
  3409. module.exports.stream = makeDispatcher(api.stream)
  3410. module.exports.pipeline = makeDispatcher(api.pipeline)
  3411. module.exports.connect = makeDispatcher(api.connect)
  3412. module.exports.upgrade = makeDispatcher(api.upgrade)
  3413. module.exports.MockClient = MockClient
  3414. module.exports.MockPool = MockPool
  3415. module.exports.MockAgent = MockAgent
  3416. module.exports.mockErrors = mockErrors
  3417. const { EventSource } = __nccwpck_require__(1238)
  3418. module.exports.EventSource = EventSource
  3419. /***/ }),
  3420. /***/ 158:
  3421. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  3422. const { addAbortListener } = __nccwpck_require__(3440)
  3423. const { RequestAbortedError } = __nccwpck_require__(8707)
  3424. const kListener = Symbol('kListener')
  3425. const kSignal = Symbol('kSignal')
  3426. function abort (self) {
  3427. if (self.abort) {
  3428. self.abort(self[kSignal]?.reason)
  3429. } else {
  3430. self.reason = self[kSignal]?.reason ?? new RequestAbortedError()
  3431. }
  3432. removeSignal(self)
  3433. }
  3434. function addSignal (self, signal) {
  3435. self.reason = null
  3436. self[kSignal] = null
  3437. self[kListener] = null
  3438. if (!signal) {
  3439. return
  3440. }
  3441. if (signal.aborted) {
  3442. abort(self)
  3443. return
  3444. }
  3445. self[kSignal] = signal
  3446. self[kListener] = () => {
  3447. abort(self)
  3448. }
  3449. addAbortListener(self[kSignal], self[kListener])
  3450. }
  3451. function removeSignal (self) {
  3452. if (!self[kSignal]) {
  3453. return
  3454. }
  3455. if ('removeEventListener' in self[kSignal]) {
  3456. self[kSignal].removeEventListener('abort', self[kListener])
  3457. } else {
  3458. self[kSignal].removeListener('abort', self[kListener])
  3459. }
  3460. self[kSignal] = null
  3461. self[kListener] = null
  3462. }
  3463. module.exports = {
  3464. addSignal,
  3465. removeSignal
  3466. }
  3467. /***/ }),
  3468. /***/ 2279:
  3469. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  3470. const assert = __nccwpck_require__(4589)
  3471. const { AsyncResource } = __nccwpck_require__(6698)
  3472. const { InvalidArgumentError, SocketError } = __nccwpck_require__(8707)
  3473. const util = __nccwpck_require__(3440)
  3474. const { addSignal, removeSignal } = __nccwpck_require__(158)
  3475. class ConnectHandler extends AsyncResource {
  3476. constructor (opts, callback) {
  3477. if (!opts || typeof opts !== 'object') {
  3478. throw new InvalidArgumentError('invalid opts')
  3479. }
  3480. if (typeof callback !== 'function') {
  3481. throw new InvalidArgumentError('invalid callback')
  3482. }
  3483. const { signal, opaque, responseHeaders } = opts
  3484. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  3485. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  3486. }
  3487. super('UNDICI_CONNECT')
  3488. this.opaque = opaque || null
  3489. this.responseHeaders = responseHeaders || null
  3490. this.callback = callback
  3491. this.abort = null
  3492. addSignal(this, signal)
  3493. }
  3494. onConnect (abort, context) {
  3495. if (this.reason) {
  3496. abort(this.reason)
  3497. return
  3498. }
  3499. assert(this.callback)
  3500. this.abort = abort
  3501. this.context = context
  3502. }
  3503. onHeaders () {
  3504. throw new SocketError('bad connect', null)
  3505. }
  3506. onUpgrade (statusCode, rawHeaders, socket) {
  3507. const { callback, opaque, context } = this
  3508. removeSignal(this)
  3509. this.callback = null
  3510. let headers = rawHeaders
  3511. // Indicates is an HTTP2Session
  3512. if (headers != null) {
  3513. headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  3514. }
  3515. this.runInAsyncScope(callback, null, null, {
  3516. statusCode,
  3517. headers,
  3518. socket,
  3519. opaque,
  3520. context
  3521. })
  3522. }
  3523. onError (err) {
  3524. const { callback, opaque } = this
  3525. removeSignal(this)
  3526. if (callback) {
  3527. this.callback = null
  3528. queueMicrotask(() => {
  3529. this.runInAsyncScope(callback, null, err, { opaque })
  3530. })
  3531. }
  3532. }
  3533. }
  3534. function connect (opts, callback) {
  3535. if (callback === undefined) {
  3536. return new Promise((resolve, reject) => {
  3537. connect.call(this, opts, (err, data) => {
  3538. return err ? reject(err) : resolve(data)
  3539. })
  3540. })
  3541. }
  3542. try {
  3543. const connectHandler = new ConnectHandler(opts, callback)
  3544. this.dispatch({ ...opts, method: 'CONNECT' }, connectHandler)
  3545. } catch (err) {
  3546. if (typeof callback !== 'function') {
  3547. throw err
  3548. }
  3549. const opaque = opts?.opaque
  3550. queueMicrotask(() => callback(err, { opaque }))
  3551. }
  3552. }
  3553. module.exports = connect
  3554. /***/ }),
  3555. /***/ 6862:
  3556. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  3557. const {
  3558. Readable,
  3559. Duplex,
  3560. PassThrough
  3561. } = __nccwpck_require__(7075)
  3562. const {
  3563. InvalidArgumentError,
  3564. InvalidReturnValueError,
  3565. RequestAbortedError
  3566. } = __nccwpck_require__(8707)
  3567. const util = __nccwpck_require__(3440)
  3568. const { AsyncResource } = __nccwpck_require__(6698)
  3569. const { addSignal, removeSignal } = __nccwpck_require__(158)
  3570. const assert = __nccwpck_require__(4589)
  3571. const kResume = Symbol('resume')
  3572. class PipelineRequest extends Readable {
  3573. constructor () {
  3574. super({ autoDestroy: true })
  3575. this[kResume] = null
  3576. }
  3577. _read () {
  3578. const { [kResume]: resume } = this
  3579. if (resume) {
  3580. this[kResume] = null
  3581. resume()
  3582. }
  3583. }
  3584. _destroy (err, callback) {
  3585. this._read()
  3586. callback(err)
  3587. }
  3588. }
  3589. class PipelineResponse extends Readable {
  3590. constructor (resume) {
  3591. super({ autoDestroy: true })
  3592. this[kResume] = resume
  3593. }
  3594. _read () {
  3595. this[kResume]()
  3596. }
  3597. _destroy (err, callback) {
  3598. if (!err && !this._readableState.endEmitted) {
  3599. err = new RequestAbortedError()
  3600. }
  3601. callback(err)
  3602. }
  3603. }
  3604. class PipelineHandler extends AsyncResource {
  3605. constructor (opts, handler) {
  3606. if (!opts || typeof opts !== 'object') {
  3607. throw new InvalidArgumentError('invalid opts')
  3608. }
  3609. if (typeof handler !== 'function') {
  3610. throw new InvalidArgumentError('invalid handler')
  3611. }
  3612. const { signal, method, opaque, onInfo, responseHeaders } = opts
  3613. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  3614. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  3615. }
  3616. if (method === 'CONNECT') {
  3617. throw new InvalidArgumentError('invalid method')
  3618. }
  3619. if (onInfo && typeof onInfo !== 'function') {
  3620. throw new InvalidArgumentError('invalid onInfo callback')
  3621. }
  3622. super('UNDICI_PIPELINE')
  3623. this.opaque = opaque || null
  3624. this.responseHeaders = responseHeaders || null
  3625. this.handler = handler
  3626. this.abort = null
  3627. this.context = null
  3628. this.onInfo = onInfo || null
  3629. this.req = new PipelineRequest().on('error', util.nop)
  3630. this.ret = new Duplex({
  3631. readableObjectMode: opts.objectMode,
  3632. autoDestroy: true,
  3633. read: () => {
  3634. const { body } = this
  3635. if (body?.resume) {
  3636. body.resume()
  3637. }
  3638. },
  3639. write: (chunk, encoding, callback) => {
  3640. const { req } = this
  3641. if (req.push(chunk, encoding) || req._readableState.destroyed) {
  3642. callback()
  3643. } else {
  3644. req[kResume] = callback
  3645. }
  3646. },
  3647. destroy: (err, callback) => {
  3648. const { body, req, res, ret, abort } = this
  3649. if (!err && !ret._readableState.endEmitted) {
  3650. err = new RequestAbortedError()
  3651. }
  3652. if (abort && err) {
  3653. abort()
  3654. }
  3655. util.destroy(body, err)
  3656. util.destroy(req, err)
  3657. util.destroy(res, err)
  3658. removeSignal(this)
  3659. callback(err)
  3660. }
  3661. }).on('prefinish', () => {
  3662. const { req } = this
  3663. // Node < 15 does not call _final in same tick.
  3664. req.push(null)
  3665. })
  3666. this.res = null
  3667. addSignal(this, signal)
  3668. }
  3669. onConnect (abort, context) {
  3670. const { ret, res } = this
  3671. if (this.reason) {
  3672. abort(this.reason)
  3673. return
  3674. }
  3675. assert(!res, 'pipeline cannot be retried')
  3676. assert(!ret.destroyed)
  3677. this.abort = abort
  3678. this.context = context
  3679. }
  3680. onHeaders (statusCode, rawHeaders, resume) {
  3681. const { opaque, handler, context } = this
  3682. if (statusCode < 200) {
  3683. if (this.onInfo) {
  3684. const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  3685. this.onInfo({ statusCode, headers })
  3686. }
  3687. return
  3688. }
  3689. this.res = new PipelineResponse(resume)
  3690. let body
  3691. try {
  3692. this.handler = null
  3693. const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  3694. body = this.runInAsyncScope(handler, null, {
  3695. statusCode,
  3696. headers,
  3697. opaque,
  3698. body: this.res,
  3699. context
  3700. })
  3701. } catch (err) {
  3702. this.res.on('error', util.nop)
  3703. throw err
  3704. }
  3705. if (!body || typeof body.on !== 'function') {
  3706. throw new InvalidReturnValueError('expected Readable')
  3707. }
  3708. body
  3709. .on('data', (chunk) => {
  3710. const { ret, body } = this
  3711. if (!ret.push(chunk) && body.pause) {
  3712. body.pause()
  3713. }
  3714. })
  3715. .on('error', (err) => {
  3716. const { ret } = this
  3717. util.destroy(ret, err)
  3718. })
  3719. .on('end', () => {
  3720. const { ret } = this
  3721. ret.push(null)
  3722. })
  3723. .on('close', () => {
  3724. const { ret } = this
  3725. if (!ret._readableState.ended) {
  3726. util.destroy(ret, new RequestAbortedError())
  3727. }
  3728. })
  3729. this.body = body
  3730. }
  3731. onData (chunk) {
  3732. const { res } = this
  3733. return res.push(chunk)
  3734. }
  3735. onComplete (trailers) {
  3736. const { res } = this
  3737. res.push(null)
  3738. }
  3739. onError (err) {
  3740. const { ret } = this
  3741. this.handler = null
  3742. util.destroy(ret, err)
  3743. }
  3744. }
  3745. function pipeline (opts, handler) {
  3746. try {
  3747. const pipelineHandler = new PipelineHandler(opts, handler)
  3748. this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler)
  3749. return pipelineHandler.ret
  3750. } catch (err) {
  3751. return new PassThrough().destroy(err)
  3752. }
  3753. }
  3754. module.exports = pipeline
  3755. /***/ }),
  3756. /***/ 4043:
  3757. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  3758. const assert = __nccwpck_require__(4589)
  3759. const { Readable } = __nccwpck_require__(9927)
  3760. const { InvalidArgumentError, RequestAbortedError } = __nccwpck_require__(8707)
  3761. const util = __nccwpck_require__(3440)
  3762. const { getResolveErrorBodyCallback } = __nccwpck_require__(7655)
  3763. const { AsyncResource } = __nccwpck_require__(6698)
  3764. class RequestHandler extends AsyncResource {
  3765. constructor (opts, callback) {
  3766. if (!opts || typeof opts !== 'object') {
  3767. throw new InvalidArgumentError('invalid opts')
  3768. }
  3769. const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError, highWaterMark } = opts
  3770. try {
  3771. if (typeof callback !== 'function') {
  3772. throw new InvalidArgumentError('invalid callback')
  3773. }
  3774. if (highWaterMark && (typeof highWaterMark !== 'number' || highWaterMark < 0)) {
  3775. throw new InvalidArgumentError('invalid highWaterMark')
  3776. }
  3777. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  3778. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  3779. }
  3780. if (method === 'CONNECT') {
  3781. throw new InvalidArgumentError('invalid method')
  3782. }
  3783. if (onInfo && typeof onInfo !== 'function') {
  3784. throw new InvalidArgumentError('invalid onInfo callback')
  3785. }
  3786. super('UNDICI_REQUEST')
  3787. } catch (err) {
  3788. if (util.isStream(body)) {
  3789. util.destroy(body.on('error', util.nop), err)
  3790. }
  3791. throw err
  3792. }
  3793. this.method = method
  3794. this.responseHeaders = responseHeaders || null
  3795. this.opaque = opaque || null
  3796. this.callback = callback
  3797. this.res = null
  3798. this.abort = null
  3799. this.body = body
  3800. this.trailers = {}
  3801. this.context = null
  3802. this.onInfo = onInfo || null
  3803. this.throwOnError = throwOnError
  3804. this.highWaterMark = highWaterMark
  3805. this.signal = signal
  3806. this.reason = null
  3807. this.removeAbortListener = null
  3808. if (util.isStream(body)) {
  3809. body.on('error', (err) => {
  3810. this.onError(err)
  3811. })
  3812. }
  3813. if (this.signal) {
  3814. if (this.signal.aborted) {
  3815. this.reason = this.signal.reason ?? new RequestAbortedError()
  3816. } else {
  3817. this.removeAbortListener = util.addAbortListener(this.signal, () => {
  3818. this.reason = this.signal.reason ?? new RequestAbortedError()
  3819. if (this.res) {
  3820. util.destroy(this.res.on('error', util.nop), this.reason)
  3821. } else if (this.abort) {
  3822. this.abort(this.reason)
  3823. }
  3824. if (this.removeAbortListener) {
  3825. this.res?.off('close', this.removeAbortListener)
  3826. this.removeAbortListener()
  3827. this.removeAbortListener = null
  3828. }
  3829. })
  3830. }
  3831. }
  3832. }
  3833. onConnect (abort, context) {
  3834. if (this.reason) {
  3835. abort(this.reason)
  3836. return
  3837. }
  3838. assert(this.callback)
  3839. this.abort = abort
  3840. this.context = context
  3841. }
  3842. onHeaders (statusCode, rawHeaders, resume, statusMessage) {
  3843. const { callback, opaque, abort, context, responseHeaders, highWaterMark } = this
  3844. const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  3845. if (statusCode < 200) {
  3846. if (this.onInfo) {
  3847. this.onInfo({ statusCode, headers })
  3848. }
  3849. return
  3850. }
  3851. const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers
  3852. const contentType = parsedHeaders['content-type']
  3853. const contentLength = parsedHeaders['content-length']
  3854. const res = new Readable({
  3855. resume,
  3856. abort,
  3857. contentType,
  3858. contentLength: this.method !== 'HEAD' && contentLength
  3859. ? Number(contentLength)
  3860. : null,
  3861. highWaterMark
  3862. })
  3863. if (this.removeAbortListener) {
  3864. res.on('close', this.removeAbortListener)
  3865. }
  3866. this.callback = null
  3867. this.res = res
  3868. if (callback !== null) {
  3869. if (this.throwOnError && statusCode >= 400) {
  3870. this.runInAsyncScope(getResolveErrorBodyCallback, null,
  3871. { callback, body: res, contentType, statusCode, statusMessage, headers }
  3872. )
  3873. } else {
  3874. this.runInAsyncScope(callback, null, null, {
  3875. statusCode,
  3876. headers,
  3877. trailers: this.trailers,
  3878. opaque,
  3879. body: res,
  3880. context
  3881. })
  3882. }
  3883. }
  3884. }
  3885. onData (chunk) {
  3886. return this.res.push(chunk)
  3887. }
  3888. onComplete (trailers) {
  3889. util.parseHeaders(trailers, this.trailers)
  3890. this.res.push(null)
  3891. }
  3892. onError (err) {
  3893. const { res, callback, body, opaque } = this
  3894. if (callback) {
  3895. // TODO: Does this need queueMicrotask?
  3896. this.callback = null
  3897. queueMicrotask(() => {
  3898. this.runInAsyncScope(callback, null, err, { opaque })
  3899. })
  3900. }
  3901. if (res) {
  3902. this.res = null
  3903. // Ensure all queued handlers are invoked before destroying res.
  3904. queueMicrotask(() => {
  3905. util.destroy(res, err)
  3906. })
  3907. }
  3908. if (body) {
  3909. this.body = null
  3910. util.destroy(body, err)
  3911. }
  3912. if (this.removeAbortListener) {
  3913. res?.off('close', this.removeAbortListener)
  3914. this.removeAbortListener()
  3915. this.removeAbortListener = null
  3916. }
  3917. }
  3918. }
  3919. function request (opts, callback) {
  3920. if (callback === undefined) {
  3921. return new Promise((resolve, reject) => {
  3922. request.call(this, opts, (err, data) => {
  3923. return err ? reject(err) : resolve(data)
  3924. })
  3925. })
  3926. }
  3927. try {
  3928. this.dispatch(opts, new RequestHandler(opts, callback))
  3929. } catch (err) {
  3930. if (typeof callback !== 'function') {
  3931. throw err
  3932. }
  3933. const opaque = opts?.opaque
  3934. queueMicrotask(() => callback(err, { opaque }))
  3935. }
  3936. }
  3937. module.exports = request
  3938. module.exports.RequestHandler = RequestHandler
  3939. /***/ }),
  3940. /***/ 3560:
  3941. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  3942. const assert = __nccwpck_require__(4589)
  3943. const { finished, PassThrough } = __nccwpck_require__(7075)
  3944. const { InvalidArgumentError, InvalidReturnValueError } = __nccwpck_require__(8707)
  3945. const util = __nccwpck_require__(3440)
  3946. const { getResolveErrorBodyCallback } = __nccwpck_require__(7655)
  3947. const { AsyncResource } = __nccwpck_require__(6698)
  3948. const { addSignal, removeSignal } = __nccwpck_require__(158)
  3949. class StreamHandler extends AsyncResource {
  3950. constructor (opts, factory, callback) {
  3951. if (!opts || typeof opts !== 'object') {
  3952. throw new InvalidArgumentError('invalid opts')
  3953. }
  3954. const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError } = opts
  3955. try {
  3956. if (typeof callback !== 'function') {
  3957. throw new InvalidArgumentError('invalid callback')
  3958. }
  3959. if (typeof factory !== 'function') {
  3960. throw new InvalidArgumentError('invalid factory')
  3961. }
  3962. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  3963. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  3964. }
  3965. if (method === 'CONNECT') {
  3966. throw new InvalidArgumentError('invalid method')
  3967. }
  3968. if (onInfo && typeof onInfo !== 'function') {
  3969. throw new InvalidArgumentError('invalid onInfo callback')
  3970. }
  3971. super('UNDICI_STREAM')
  3972. } catch (err) {
  3973. if (util.isStream(body)) {
  3974. util.destroy(body.on('error', util.nop), err)
  3975. }
  3976. throw err
  3977. }
  3978. this.responseHeaders = responseHeaders || null
  3979. this.opaque = opaque || null
  3980. this.factory = factory
  3981. this.callback = callback
  3982. this.res = null
  3983. this.abort = null
  3984. this.context = null
  3985. this.trailers = null
  3986. this.body = body
  3987. this.onInfo = onInfo || null
  3988. this.throwOnError = throwOnError || false
  3989. if (util.isStream(body)) {
  3990. body.on('error', (err) => {
  3991. this.onError(err)
  3992. })
  3993. }
  3994. addSignal(this, signal)
  3995. }
  3996. onConnect (abort, context) {
  3997. if (this.reason) {
  3998. abort(this.reason)
  3999. return
  4000. }
  4001. assert(this.callback)
  4002. this.abort = abort
  4003. this.context = context
  4004. }
  4005. onHeaders (statusCode, rawHeaders, resume, statusMessage) {
  4006. const { factory, opaque, context, callback, responseHeaders } = this
  4007. const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  4008. if (statusCode < 200) {
  4009. if (this.onInfo) {
  4010. this.onInfo({ statusCode, headers })
  4011. }
  4012. return
  4013. }
  4014. this.factory = null
  4015. let res
  4016. if (this.throwOnError && statusCode >= 400) {
  4017. const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers
  4018. const contentType = parsedHeaders['content-type']
  4019. res = new PassThrough()
  4020. this.callback = null
  4021. this.runInAsyncScope(getResolveErrorBodyCallback, null,
  4022. { callback, body: res, contentType, statusCode, statusMessage, headers }
  4023. )
  4024. } else {
  4025. if (factory === null) {
  4026. return
  4027. }
  4028. res = this.runInAsyncScope(factory, null, {
  4029. statusCode,
  4030. headers,
  4031. opaque,
  4032. context
  4033. })
  4034. if (
  4035. !res ||
  4036. typeof res.write !== 'function' ||
  4037. typeof res.end !== 'function' ||
  4038. typeof res.on !== 'function'
  4039. ) {
  4040. throw new InvalidReturnValueError('expected Writable')
  4041. }
  4042. // TODO: Avoid finished. It registers an unnecessary amount of listeners.
  4043. finished(res, { readable: false }, (err) => {
  4044. const { callback, res, opaque, trailers, abort } = this
  4045. this.res = null
  4046. if (err || !res.readable) {
  4047. util.destroy(res, err)
  4048. }
  4049. this.callback = null
  4050. this.runInAsyncScope(callback, null, err || null, { opaque, trailers })
  4051. if (err) {
  4052. abort()
  4053. }
  4054. })
  4055. }
  4056. res.on('drain', resume)
  4057. this.res = res
  4058. const needDrain = res.writableNeedDrain !== undefined
  4059. ? res.writableNeedDrain
  4060. : res._writableState?.needDrain
  4061. return needDrain !== true
  4062. }
  4063. onData (chunk) {
  4064. const { res } = this
  4065. return res ? res.write(chunk) : true
  4066. }
  4067. onComplete (trailers) {
  4068. const { res } = this
  4069. removeSignal(this)
  4070. if (!res) {
  4071. return
  4072. }
  4073. this.trailers = util.parseHeaders(trailers)
  4074. res.end()
  4075. }
  4076. onError (err) {
  4077. const { res, callback, opaque, body } = this
  4078. removeSignal(this)
  4079. this.factory = null
  4080. if (res) {
  4081. this.res = null
  4082. util.destroy(res, err)
  4083. } else if (callback) {
  4084. this.callback = null
  4085. queueMicrotask(() => {
  4086. this.runInAsyncScope(callback, null, err, { opaque })
  4087. })
  4088. }
  4089. if (body) {
  4090. this.body = null
  4091. util.destroy(body, err)
  4092. }
  4093. }
  4094. }
  4095. function stream (opts, factory, callback) {
  4096. if (callback === undefined) {
  4097. return new Promise((resolve, reject) => {
  4098. stream.call(this, opts, factory, (err, data) => {
  4099. return err ? reject(err) : resolve(data)
  4100. })
  4101. })
  4102. }
  4103. try {
  4104. this.dispatch(opts, new StreamHandler(opts, factory, callback))
  4105. } catch (err) {
  4106. if (typeof callback !== 'function') {
  4107. throw err
  4108. }
  4109. const opaque = opts?.opaque
  4110. queueMicrotask(() => callback(err, { opaque }))
  4111. }
  4112. }
  4113. module.exports = stream
  4114. /***/ }),
  4115. /***/ 1882:
  4116. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4117. const { InvalidArgumentError, SocketError } = __nccwpck_require__(8707)
  4118. const { AsyncResource } = __nccwpck_require__(6698)
  4119. const util = __nccwpck_require__(3440)
  4120. const { addSignal, removeSignal } = __nccwpck_require__(158)
  4121. const assert = __nccwpck_require__(4589)
  4122. class UpgradeHandler extends AsyncResource {
  4123. constructor (opts, callback) {
  4124. if (!opts || typeof opts !== 'object') {
  4125. throw new InvalidArgumentError('invalid opts')
  4126. }
  4127. if (typeof callback !== 'function') {
  4128. throw new InvalidArgumentError('invalid callback')
  4129. }
  4130. const { signal, opaque, responseHeaders } = opts
  4131. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  4132. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  4133. }
  4134. super('UNDICI_UPGRADE')
  4135. this.responseHeaders = responseHeaders || null
  4136. this.opaque = opaque || null
  4137. this.callback = callback
  4138. this.abort = null
  4139. this.context = null
  4140. addSignal(this, signal)
  4141. }
  4142. onConnect (abort, context) {
  4143. if (this.reason) {
  4144. abort(this.reason)
  4145. return
  4146. }
  4147. assert(this.callback)
  4148. this.abort = abort
  4149. this.context = null
  4150. }
  4151. onHeaders () {
  4152. throw new SocketError('bad upgrade', null)
  4153. }
  4154. onUpgrade (statusCode, rawHeaders, socket) {
  4155. assert(statusCode === 101)
  4156. const { callback, opaque, context } = this
  4157. removeSignal(this)
  4158. this.callback = null
  4159. const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  4160. this.runInAsyncScope(callback, null, null, {
  4161. headers,
  4162. socket,
  4163. opaque,
  4164. context
  4165. })
  4166. }
  4167. onError (err) {
  4168. const { callback, opaque } = this
  4169. removeSignal(this)
  4170. if (callback) {
  4171. this.callback = null
  4172. queueMicrotask(() => {
  4173. this.runInAsyncScope(callback, null, err, { opaque })
  4174. })
  4175. }
  4176. }
  4177. }
  4178. function upgrade (opts, callback) {
  4179. if (callback === undefined) {
  4180. return new Promise((resolve, reject) => {
  4181. upgrade.call(this, opts, (err, data) => {
  4182. return err ? reject(err) : resolve(data)
  4183. })
  4184. })
  4185. }
  4186. try {
  4187. const upgradeHandler = new UpgradeHandler(opts, callback)
  4188. this.dispatch({
  4189. ...opts,
  4190. method: opts.method || 'GET',
  4191. upgrade: opts.protocol || 'Websocket'
  4192. }, upgradeHandler)
  4193. } catch (err) {
  4194. if (typeof callback !== 'function') {
  4195. throw err
  4196. }
  4197. const opaque = opts?.opaque
  4198. queueMicrotask(() => callback(err, { opaque }))
  4199. }
  4200. }
  4201. module.exports = upgrade
  4202. /***/ }),
  4203. /***/ 6615:
  4204. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4205. module.exports.request = __nccwpck_require__(4043)
  4206. module.exports.stream = __nccwpck_require__(3560)
  4207. module.exports.pipeline = __nccwpck_require__(6862)
  4208. module.exports.upgrade = __nccwpck_require__(1882)
  4209. module.exports.connect = __nccwpck_require__(2279)
  4210. /***/ }),
  4211. /***/ 9927:
  4212. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4213. // Ported from https://github.com/nodejs/undici/pull/907
  4214. const assert = __nccwpck_require__(4589)
  4215. const { Readable } = __nccwpck_require__(7075)
  4216. const { RequestAbortedError, NotSupportedError, InvalidArgumentError, AbortError } = __nccwpck_require__(8707)
  4217. const util = __nccwpck_require__(3440)
  4218. const { ReadableStreamFrom } = __nccwpck_require__(3440)
  4219. const kConsume = Symbol('kConsume')
  4220. const kReading = Symbol('kReading')
  4221. const kBody = Symbol('kBody')
  4222. const kAbort = Symbol('kAbort')
  4223. const kContentType = Symbol('kContentType')
  4224. const kContentLength = Symbol('kContentLength')
  4225. const noop = () => {}
  4226. class BodyReadable extends Readable {
  4227. constructor ({
  4228. resume,
  4229. abort,
  4230. contentType = '',
  4231. contentLength,
  4232. highWaterMark = 64 * 1024 // Same as nodejs fs streams.
  4233. }) {
  4234. super({
  4235. autoDestroy: true,
  4236. read: resume,
  4237. highWaterMark
  4238. })
  4239. this._readableState.dataEmitted = false
  4240. this[kAbort] = abort
  4241. this[kConsume] = null
  4242. this[kBody] = null
  4243. this[kContentType] = contentType
  4244. this[kContentLength] = contentLength
  4245. // Is stream being consumed through Readable API?
  4246. // This is an optimization so that we avoid checking
  4247. // for 'data' and 'readable' listeners in the hot path
  4248. // inside push().
  4249. this[kReading] = false
  4250. }
  4251. destroy (err) {
  4252. if (!err && !this._readableState.endEmitted) {
  4253. err = new RequestAbortedError()
  4254. }
  4255. if (err) {
  4256. this[kAbort]()
  4257. }
  4258. return super.destroy(err)
  4259. }
  4260. _destroy (err, callback) {
  4261. // Workaround for Node "bug". If the stream is destroyed in same
  4262. // tick as it is created, then a user who is waiting for a
  4263. // promise (i.e micro tick) for installing a 'error' listener will
  4264. // never get a chance and will always encounter an unhandled exception.
  4265. if (!this[kReading]) {
  4266. setImmediate(() => {
  4267. callback(err)
  4268. })
  4269. } else {
  4270. callback(err)
  4271. }
  4272. }
  4273. on (ev, ...args) {
  4274. if (ev === 'data' || ev === 'readable') {
  4275. this[kReading] = true
  4276. }
  4277. return super.on(ev, ...args)
  4278. }
  4279. addListener (ev, ...args) {
  4280. return this.on(ev, ...args)
  4281. }
  4282. off (ev, ...args) {
  4283. const ret = super.off(ev, ...args)
  4284. if (ev === 'data' || ev === 'readable') {
  4285. this[kReading] = (
  4286. this.listenerCount('data') > 0 ||
  4287. this.listenerCount('readable') > 0
  4288. )
  4289. }
  4290. return ret
  4291. }
  4292. removeListener (ev, ...args) {
  4293. return this.off(ev, ...args)
  4294. }
  4295. push (chunk) {
  4296. if (this[kConsume] && chunk !== null) {
  4297. consumePush(this[kConsume], chunk)
  4298. return this[kReading] ? super.push(chunk) : true
  4299. }
  4300. return super.push(chunk)
  4301. }
  4302. // https://fetch.spec.whatwg.org/#dom-body-text
  4303. async text () {
  4304. return consume(this, 'text')
  4305. }
  4306. // https://fetch.spec.whatwg.org/#dom-body-json
  4307. async json () {
  4308. return consume(this, 'json')
  4309. }
  4310. // https://fetch.spec.whatwg.org/#dom-body-blob
  4311. async blob () {
  4312. return consume(this, 'blob')
  4313. }
  4314. // https://fetch.spec.whatwg.org/#dom-body-bytes
  4315. async bytes () {
  4316. return consume(this, 'bytes')
  4317. }
  4318. // https://fetch.spec.whatwg.org/#dom-body-arraybuffer
  4319. async arrayBuffer () {
  4320. return consume(this, 'arrayBuffer')
  4321. }
  4322. // https://fetch.spec.whatwg.org/#dom-body-formdata
  4323. async formData () {
  4324. // TODO: Implement.
  4325. throw new NotSupportedError()
  4326. }
  4327. // https://fetch.spec.whatwg.org/#dom-body-bodyused
  4328. get bodyUsed () {
  4329. return util.isDisturbed(this)
  4330. }
  4331. // https://fetch.spec.whatwg.org/#dom-body-body
  4332. get body () {
  4333. if (!this[kBody]) {
  4334. this[kBody] = ReadableStreamFrom(this)
  4335. if (this[kConsume]) {
  4336. // TODO: Is this the best way to force a lock?
  4337. this[kBody].getReader() // Ensure stream is locked.
  4338. assert(this[kBody].locked)
  4339. }
  4340. }
  4341. return this[kBody]
  4342. }
  4343. async dump (opts) {
  4344. let limit = Number.isFinite(opts?.limit) ? opts.limit : 128 * 1024
  4345. const signal = opts?.signal
  4346. if (signal != null && (typeof signal !== 'object' || !('aborted' in signal))) {
  4347. throw new InvalidArgumentError('signal must be an AbortSignal')
  4348. }
  4349. signal?.throwIfAborted()
  4350. if (this._readableState.closeEmitted) {
  4351. return null
  4352. }
  4353. return await new Promise((resolve, reject) => {
  4354. if (this[kContentLength] > limit) {
  4355. this.destroy(new AbortError())
  4356. }
  4357. const onAbort = () => {
  4358. this.destroy(signal.reason ?? new AbortError())
  4359. }
  4360. signal?.addEventListener('abort', onAbort)
  4361. this
  4362. .on('close', function () {
  4363. signal?.removeEventListener('abort', onAbort)
  4364. if (signal?.aborted) {
  4365. reject(signal.reason ?? new AbortError())
  4366. } else {
  4367. resolve(null)
  4368. }
  4369. })
  4370. .on('error', noop)
  4371. .on('data', function (chunk) {
  4372. limit -= chunk.length
  4373. if (limit <= 0) {
  4374. this.destroy()
  4375. }
  4376. })
  4377. .resume()
  4378. })
  4379. }
  4380. }
  4381. // https://streams.spec.whatwg.org/#readablestream-locked
  4382. function isLocked (self) {
  4383. // Consume is an implicit lock.
  4384. return (self[kBody] && self[kBody].locked === true) || self[kConsume]
  4385. }
  4386. // https://fetch.spec.whatwg.org/#body-unusable
  4387. function isUnusable (self) {
  4388. return util.isDisturbed(self) || isLocked(self)
  4389. }
  4390. async function consume (stream, type) {
  4391. assert(!stream[kConsume])
  4392. return new Promise((resolve, reject) => {
  4393. if (isUnusable(stream)) {
  4394. const rState = stream._readableState
  4395. if (rState.destroyed && rState.closeEmitted === false) {
  4396. stream
  4397. .on('error', err => {
  4398. reject(err)
  4399. })
  4400. .on('close', () => {
  4401. reject(new TypeError('unusable'))
  4402. })
  4403. } else {
  4404. reject(rState.errored ?? new TypeError('unusable'))
  4405. }
  4406. } else {
  4407. queueMicrotask(() => {
  4408. stream[kConsume] = {
  4409. type,
  4410. stream,
  4411. resolve,
  4412. reject,
  4413. length: 0,
  4414. body: []
  4415. }
  4416. stream
  4417. .on('error', function (err) {
  4418. consumeFinish(this[kConsume], err)
  4419. })
  4420. .on('close', function () {
  4421. if (this[kConsume].body !== null) {
  4422. consumeFinish(this[kConsume], new RequestAbortedError())
  4423. }
  4424. })
  4425. consumeStart(stream[kConsume])
  4426. })
  4427. }
  4428. })
  4429. }
  4430. function consumeStart (consume) {
  4431. if (consume.body === null) {
  4432. return
  4433. }
  4434. const { _readableState: state } = consume.stream
  4435. if (state.bufferIndex) {
  4436. const start = state.bufferIndex
  4437. const end = state.buffer.length
  4438. for (let n = start; n < end; n++) {
  4439. consumePush(consume, state.buffer[n])
  4440. }
  4441. } else {
  4442. for (const chunk of state.buffer) {
  4443. consumePush(consume, chunk)
  4444. }
  4445. }
  4446. if (state.endEmitted) {
  4447. consumeEnd(this[kConsume])
  4448. } else {
  4449. consume.stream.on('end', function () {
  4450. consumeEnd(this[kConsume])
  4451. })
  4452. }
  4453. consume.stream.resume()
  4454. while (consume.stream.read() != null) {
  4455. // Loop
  4456. }
  4457. }
  4458. /**
  4459. * @param {Buffer[]} chunks
  4460. * @param {number} length
  4461. */
  4462. function chunksDecode (chunks, length) {
  4463. if (chunks.length === 0 || length === 0) {
  4464. return ''
  4465. }
  4466. const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks, length)
  4467. const bufferLength = buffer.length
  4468. // Skip BOM.
  4469. const start =
  4470. bufferLength > 2 &&
  4471. buffer[0] === 0xef &&
  4472. buffer[1] === 0xbb &&
  4473. buffer[2] === 0xbf
  4474. ? 3
  4475. : 0
  4476. return buffer.utf8Slice(start, bufferLength)
  4477. }
  4478. /**
  4479. * @param {Buffer[]} chunks
  4480. * @param {number} length
  4481. * @returns {Uint8Array}
  4482. */
  4483. function chunksConcat (chunks, length) {
  4484. if (chunks.length === 0 || length === 0) {
  4485. return new Uint8Array(0)
  4486. }
  4487. if (chunks.length === 1) {
  4488. // fast-path
  4489. return new Uint8Array(chunks[0])
  4490. }
  4491. const buffer = new Uint8Array(Buffer.allocUnsafeSlow(length).buffer)
  4492. let offset = 0
  4493. for (let i = 0; i < chunks.length; ++i) {
  4494. const chunk = chunks[i]
  4495. buffer.set(chunk, offset)
  4496. offset += chunk.length
  4497. }
  4498. return buffer
  4499. }
  4500. function consumeEnd (consume) {
  4501. const { type, body, resolve, stream, length } = consume
  4502. try {
  4503. if (type === 'text') {
  4504. resolve(chunksDecode(body, length))
  4505. } else if (type === 'json') {
  4506. resolve(JSON.parse(chunksDecode(body, length)))
  4507. } else if (type === 'arrayBuffer') {
  4508. resolve(chunksConcat(body, length).buffer)
  4509. } else if (type === 'blob') {
  4510. resolve(new Blob(body, { type: stream[kContentType] }))
  4511. } else if (type === 'bytes') {
  4512. resolve(chunksConcat(body, length))
  4513. }
  4514. consumeFinish(consume)
  4515. } catch (err) {
  4516. stream.destroy(err)
  4517. }
  4518. }
  4519. function consumePush (consume, chunk) {
  4520. consume.length += chunk.length
  4521. consume.body.push(chunk)
  4522. }
  4523. function consumeFinish (consume, err) {
  4524. if (consume.body === null) {
  4525. return
  4526. }
  4527. if (err) {
  4528. consume.reject(err)
  4529. } else {
  4530. consume.resolve()
  4531. }
  4532. consume.type = null
  4533. consume.stream = null
  4534. consume.resolve = null
  4535. consume.reject = null
  4536. consume.length = 0
  4537. consume.body = null
  4538. }
  4539. module.exports = { Readable: BodyReadable, chunksDecode }
  4540. /***/ }),
  4541. /***/ 7655:
  4542. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4543. const assert = __nccwpck_require__(4589)
  4544. const {
  4545. ResponseStatusCodeError
  4546. } = __nccwpck_require__(8707)
  4547. const { chunksDecode } = __nccwpck_require__(9927)
  4548. const CHUNK_LIMIT = 128 * 1024
  4549. async function getResolveErrorBodyCallback ({ callback, body, contentType, statusCode, statusMessage, headers }) {
  4550. assert(body)
  4551. let chunks = []
  4552. let length = 0
  4553. try {
  4554. for await (const chunk of body) {
  4555. chunks.push(chunk)
  4556. length += chunk.length
  4557. if (length > CHUNK_LIMIT) {
  4558. chunks = []
  4559. length = 0
  4560. break
  4561. }
  4562. }
  4563. } catch {
  4564. chunks = []
  4565. length = 0
  4566. // Do nothing....
  4567. }
  4568. const message = `Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`
  4569. if (statusCode === 204 || !contentType || !length) {
  4570. queueMicrotask(() => callback(new ResponseStatusCodeError(message, statusCode, headers)))
  4571. return
  4572. }
  4573. const stackTraceLimit = Error.stackTraceLimit
  4574. Error.stackTraceLimit = 0
  4575. let payload
  4576. try {
  4577. if (isContentTypeApplicationJson(contentType)) {
  4578. payload = JSON.parse(chunksDecode(chunks, length))
  4579. } else if (isContentTypeText(contentType)) {
  4580. payload = chunksDecode(chunks, length)
  4581. }
  4582. } catch {
  4583. // process in a callback to avoid throwing in the microtask queue
  4584. } finally {
  4585. Error.stackTraceLimit = stackTraceLimit
  4586. }
  4587. queueMicrotask(() => callback(new ResponseStatusCodeError(message, statusCode, headers, payload)))
  4588. }
  4589. const isContentTypeApplicationJson = (contentType) => {
  4590. return (
  4591. contentType.length > 15 &&
  4592. contentType[11] === '/' &&
  4593. contentType[0] === 'a' &&
  4594. contentType[1] === 'p' &&
  4595. contentType[2] === 'p' &&
  4596. contentType[3] === 'l' &&
  4597. contentType[4] === 'i' &&
  4598. contentType[5] === 'c' &&
  4599. contentType[6] === 'a' &&
  4600. contentType[7] === 't' &&
  4601. contentType[8] === 'i' &&
  4602. contentType[9] === 'o' &&
  4603. contentType[10] === 'n' &&
  4604. contentType[12] === 'j' &&
  4605. contentType[13] === 's' &&
  4606. contentType[14] === 'o' &&
  4607. contentType[15] === 'n'
  4608. )
  4609. }
  4610. const isContentTypeText = (contentType) => {
  4611. return (
  4612. contentType.length > 4 &&
  4613. contentType[4] === '/' &&
  4614. contentType[0] === 't' &&
  4615. contentType[1] === 'e' &&
  4616. contentType[2] === 'x' &&
  4617. contentType[3] === 't'
  4618. )
  4619. }
  4620. module.exports = {
  4621. getResolveErrorBodyCallback,
  4622. isContentTypeApplicationJson,
  4623. isContentTypeText
  4624. }
  4625. /***/ }),
  4626. /***/ 9136:
  4627. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4628. const net = __nccwpck_require__(7030)
  4629. const assert = __nccwpck_require__(4589)
  4630. const util = __nccwpck_require__(3440)
  4631. const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(8707)
  4632. const timers = __nccwpck_require__(6603)
  4633. function noop () {}
  4634. let tls // include tls conditionally since it is not always available
  4635. // TODO: session re-use does not wait for the first
  4636. // connection to resolve the session and might therefore
  4637. // resolve the same servername multiple times even when
  4638. // re-use is enabled.
  4639. let SessionCache
  4640. // FIXME: remove workaround when the Node bug is fixed
  4641. // https://github.com/nodejs/node/issues/49344#issuecomment-1741776308
  4642. if (global.FinalizationRegistry && !(process.env.NODE_V8_COVERAGE || process.env.UNDICI_NO_FG)) {
  4643. SessionCache = class WeakSessionCache {
  4644. constructor (maxCachedSessions) {
  4645. this._maxCachedSessions = maxCachedSessions
  4646. this._sessionCache = new Map()
  4647. this._sessionRegistry = new global.FinalizationRegistry((key) => {
  4648. if (this._sessionCache.size < this._maxCachedSessions) {
  4649. return
  4650. }
  4651. const ref = this._sessionCache.get(key)
  4652. if (ref !== undefined && ref.deref() === undefined) {
  4653. this._sessionCache.delete(key)
  4654. }
  4655. })
  4656. }
  4657. get (sessionKey) {
  4658. const ref = this._sessionCache.get(sessionKey)
  4659. return ref ? ref.deref() : null
  4660. }
  4661. set (sessionKey, session) {
  4662. if (this._maxCachedSessions === 0) {
  4663. return
  4664. }
  4665. this._sessionCache.set(sessionKey, new WeakRef(session))
  4666. this._sessionRegistry.register(session, sessionKey)
  4667. }
  4668. }
  4669. } else {
  4670. SessionCache = class SimpleSessionCache {
  4671. constructor (maxCachedSessions) {
  4672. this._maxCachedSessions = maxCachedSessions
  4673. this._sessionCache = new Map()
  4674. }
  4675. get (sessionKey) {
  4676. return this._sessionCache.get(sessionKey)
  4677. }
  4678. set (sessionKey, session) {
  4679. if (this._maxCachedSessions === 0) {
  4680. return
  4681. }
  4682. if (this._sessionCache.size >= this._maxCachedSessions) {
  4683. // remove the oldest session
  4684. const { value: oldestKey } = this._sessionCache.keys().next()
  4685. this._sessionCache.delete(oldestKey)
  4686. }
  4687. this._sessionCache.set(sessionKey, session)
  4688. }
  4689. }
  4690. }
  4691. function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, session: customSession, ...opts }) {
  4692. if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) {
  4693. throw new InvalidArgumentError('maxCachedSessions must be a positive integer or zero')
  4694. }
  4695. const options = { path: socketPath, ...opts }
  4696. const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions)
  4697. timeout = timeout == null ? 10e3 : timeout
  4698. allowH2 = allowH2 != null ? allowH2 : false
  4699. return function connect ({ hostname, host, protocol, port, servername, localAddress, httpSocket }, callback) {
  4700. let socket
  4701. if (protocol === 'https:') {
  4702. if (!tls) {
  4703. tls = __nccwpck_require__(1692)
  4704. }
  4705. servername = servername || options.servername || util.getServerName(host) || null
  4706. const sessionKey = servername || hostname
  4707. assert(sessionKey)
  4708. const session = customSession || sessionCache.get(sessionKey) || null
  4709. port = port || 443
  4710. socket = tls.connect({
  4711. highWaterMark: 16384, // TLS in node can't have bigger HWM anyway...
  4712. ...options,
  4713. servername,
  4714. session,
  4715. localAddress,
  4716. // TODO(HTTP/2): Add support for h2c
  4717. ALPNProtocols: allowH2 ? ['http/1.1', 'h2'] : ['http/1.1'],
  4718. socket: httpSocket, // upgrade socket connection
  4719. port,
  4720. host: hostname
  4721. })
  4722. socket
  4723. .on('session', function (session) {
  4724. // TODO (fix): Can a session become invalid once established? Don't think so?
  4725. sessionCache.set(sessionKey, session)
  4726. })
  4727. } else {
  4728. assert(!httpSocket, 'httpSocket can only be sent on TLS update')
  4729. port = port || 80
  4730. socket = net.connect({
  4731. highWaterMark: 64 * 1024, // Same as nodejs fs streams.
  4732. ...options,
  4733. localAddress,
  4734. port,
  4735. host: hostname
  4736. })
  4737. }
  4738. // Set TCP keep alive options on the socket here instead of in connect() for the case of assigning the socket
  4739. if (options.keepAlive == null || options.keepAlive) {
  4740. const keepAliveInitialDelay = options.keepAliveInitialDelay === undefined ? 60e3 : options.keepAliveInitialDelay
  4741. socket.setKeepAlive(true, keepAliveInitialDelay)
  4742. }
  4743. const clearConnectTimeout = setupConnectTimeout(new WeakRef(socket), { timeout, hostname, port })
  4744. socket
  4745. .setNoDelay(true)
  4746. .once(protocol === 'https:' ? 'secureConnect' : 'connect', function () {
  4747. queueMicrotask(clearConnectTimeout)
  4748. if (callback) {
  4749. const cb = callback
  4750. callback = null
  4751. cb(null, this)
  4752. }
  4753. })
  4754. .on('error', function (err) {
  4755. queueMicrotask(clearConnectTimeout)
  4756. if (callback) {
  4757. const cb = callback
  4758. callback = null
  4759. cb(err)
  4760. }
  4761. })
  4762. return socket
  4763. }
  4764. }
  4765. /**
  4766. * @param {WeakRef<net.Socket>} socketWeakRef
  4767. * @param {object} opts
  4768. * @param {number} opts.timeout
  4769. * @param {string} opts.hostname
  4770. * @param {number} opts.port
  4771. * @returns {() => void}
  4772. */
  4773. const setupConnectTimeout = process.platform === 'win32'
  4774. ? (socketWeakRef, opts) => {
  4775. if (!opts.timeout) {
  4776. return noop
  4777. }
  4778. let s1 = null
  4779. let s2 = null
  4780. const fastTimer = timers.setFastTimeout(() => {
  4781. // setImmediate is added to make sure that we prioritize socket error events over timeouts
  4782. s1 = setImmediate(() => {
  4783. // Windows needs an extra setImmediate probably due to implementation differences in the socket logic
  4784. s2 = setImmediate(() => onConnectTimeout(socketWeakRef.deref(), opts))
  4785. })
  4786. }, opts.timeout)
  4787. return () => {
  4788. timers.clearFastTimeout(fastTimer)
  4789. clearImmediate(s1)
  4790. clearImmediate(s2)
  4791. }
  4792. }
  4793. : (socketWeakRef, opts) => {
  4794. if (!opts.timeout) {
  4795. return noop
  4796. }
  4797. let s1 = null
  4798. const fastTimer = timers.setFastTimeout(() => {
  4799. // setImmediate is added to make sure that we prioritize socket error events over timeouts
  4800. s1 = setImmediate(() => {
  4801. onConnectTimeout(socketWeakRef.deref(), opts)
  4802. })
  4803. }, opts.timeout)
  4804. return () => {
  4805. timers.clearFastTimeout(fastTimer)
  4806. clearImmediate(s1)
  4807. }
  4808. }
  4809. /**
  4810. * @param {net.Socket} socket
  4811. * @param {object} opts
  4812. * @param {number} opts.timeout
  4813. * @param {string} opts.hostname
  4814. * @param {number} opts.port
  4815. */
  4816. function onConnectTimeout (socket, opts) {
  4817. // The socket could be already garbage collected
  4818. if (socket == null) {
  4819. return
  4820. }
  4821. let message = 'Connect Timeout Error'
  4822. if (Array.isArray(socket.autoSelectFamilyAttemptedAddresses)) {
  4823. message += ` (attempted addresses: ${socket.autoSelectFamilyAttemptedAddresses.join(', ')},`
  4824. } else {
  4825. message += ` (attempted address: ${opts.hostname}:${opts.port},`
  4826. }
  4827. message += ` timeout: ${opts.timeout}ms)`
  4828. util.destroy(socket, new ConnectTimeoutError(message))
  4829. }
  4830. module.exports = buildConnector
  4831. /***/ }),
  4832. /***/ 735:
  4833. /***/ ((module) => {
  4834. /** @type {Record<string, string | undefined>} */
  4835. const headerNameLowerCasedRecord = {}
  4836. // https://developer.mozilla.org/docs/Web/HTTP/Headers
  4837. const wellknownHeaderNames = [
  4838. 'Accept',
  4839. 'Accept-Encoding',
  4840. 'Accept-Language',
  4841. 'Accept-Ranges',
  4842. 'Access-Control-Allow-Credentials',
  4843. 'Access-Control-Allow-Headers',
  4844. 'Access-Control-Allow-Methods',
  4845. 'Access-Control-Allow-Origin',
  4846. 'Access-Control-Expose-Headers',
  4847. 'Access-Control-Max-Age',
  4848. 'Access-Control-Request-Headers',
  4849. 'Access-Control-Request-Method',
  4850. 'Age',
  4851. 'Allow',
  4852. 'Alt-Svc',
  4853. 'Alt-Used',
  4854. 'Authorization',
  4855. 'Cache-Control',
  4856. 'Clear-Site-Data',
  4857. 'Connection',
  4858. 'Content-Disposition',
  4859. 'Content-Encoding',
  4860. 'Content-Language',
  4861. 'Content-Length',
  4862. 'Content-Location',
  4863. 'Content-Range',
  4864. 'Content-Security-Policy',
  4865. 'Content-Security-Policy-Report-Only',
  4866. 'Content-Type',
  4867. 'Cookie',
  4868. 'Cross-Origin-Embedder-Policy',
  4869. 'Cross-Origin-Opener-Policy',
  4870. 'Cross-Origin-Resource-Policy',
  4871. 'Date',
  4872. 'Device-Memory',
  4873. 'Downlink',
  4874. 'ECT',
  4875. 'ETag',
  4876. 'Expect',
  4877. 'Expect-CT',
  4878. 'Expires',
  4879. 'Forwarded',
  4880. 'From',
  4881. 'Host',
  4882. 'If-Match',
  4883. 'If-Modified-Since',
  4884. 'If-None-Match',
  4885. 'If-Range',
  4886. 'If-Unmodified-Since',
  4887. 'Keep-Alive',
  4888. 'Last-Modified',
  4889. 'Link',
  4890. 'Location',
  4891. 'Max-Forwards',
  4892. 'Origin',
  4893. 'Permissions-Policy',
  4894. 'Pragma',
  4895. 'Proxy-Authenticate',
  4896. 'Proxy-Authorization',
  4897. 'RTT',
  4898. 'Range',
  4899. 'Referer',
  4900. 'Referrer-Policy',
  4901. 'Refresh',
  4902. 'Retry-After',
  4903. 'Sec-WebSocket-Accept',
  4904. 'Sec-WebSocket-Extensions',
  4905. 'Sec-WebSocket-Key',
  4906. 'Sec-WebSocket-Protocol',
  4907. 'Sec-WebSocket-Version',
  4908. 'Server',
  4909. 'Server-Timing',
  4910. 'Service-Worker-Allowed',
  4911. 'Service-Worker-Navigation-Preload',
  4912. 'Set-Cookie',
  4913. 'SourceMap',
  4914. 'Strict-Transport-Security',
  4915. 'Supports-Loading-Mode',
  4916. 'TE',
  4917. 'Timing-Allow-Origin',
  4918. 'Trailer',
  4919. 'Transfer-Encoding',
  4920. 'Upgrade',
  4921. 'Upgrade-Insecure-Requests',
  4922. 'User-Agent',
  4923. 'Vary',
  4924. 'Via',
  4925. 'WWW-Authenticate',
  4926. 'X-Content-Type-Options',
  4927. 'X-DNS-Prefetch-Control',
  4928. 'X-Frame-Options',
  4929. 'X-Permitted-Cross-Domain-Policies',
  4930. 'X-Powered-By',
  4931. 'X-Requested-With',
  4932. 'X-XSS-Protection'
  4933. ]
  4934. for (let i = 0; i < wellknownHeaderNames.length; ++i) {
  4935. const key = wellknownHeaderNames[i]
  4936. const lowerCasedKey = key.toLowerCase()
  4937. headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] =
  4938. lowerCasedKey
  4939. }
  4940. // Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
  4941. Object.setPrototypeOf(headerNameLowerCasedRecord, null)
  4942. module.exports = {
  4943. wellknownHeaderNames,
  4944. headerNameLowerCasedRecord
  4945. }
  4946. /***/ }),
  4947. /***/ 2414:
  4948. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4949. const diagnosticsChannel = __nccwpck_require__(3053)
  4950. const util = __nccwpck_require__(7975)
  4951. const undiciDebugLog = util.debuglog('undici')
  4952. const fetchDebuglog = util.debuglog('fetch')
  4953. const websocketDebuglog = util.debuglog('websocket')
  4954. let isClientSet = false
  4955. const channels = {
  4956. // Client
  4957. beforeConnect: diagnosticsChannel.channel('undici:client:beforeConnect'),
  4958. connected: diagnosticsChannel.channel('undici:client:connected'),
  4959. connectError: diagnosticsChannel.channel('undici:client:connectError'),
  4960. sendHeaders: diagnosticsChannel.channel('undici:client:sendHeaders'),
  4961. // Request
  4962. create: diagnosticsChannel.channel('undici:request:create'),
  4963. bodySent: diagnosticsChannel.channel('undici:request:bodySent'),
  4964. headers: diagnosticsChannel.channel('undici:request:headers'),
  4965. trailers: diagnosticsChannel.channel('undici:request:trailers'),
  4966. error: diagnosticsChannel.channel('undici:request:error'),
  4967. // WebSocket
  4968. open: diagnosticsChannel.channel('undici:websocket:open'),
  4969. close: diagnosticsChannel.channel('undici:websocket:close'),
  4970. socketError: diagnosticsChannel.channel('undici:websocket:socket_error'),
  4971. ping: diagnosticsChannel.channel('undici:websocket:ping'),
  4972. pong: diagnosticsChannel.channel('undici:websocket:pong')
  4973. }
  4974. if (undiciDebugLog.enabled || fetchDebuglog.enabled) {
  4975. const debuglog = fetchDebuglog.enabled ? fetchDebuglog : undiciDebugLog
  4976. // Track all Client events
  4977. diagnosticsChannel.channel('undici:client:beforeConnect').subscribe(evt => {
  4978. const {
  4979. connectParams: { version, protocol, port, host }
  4980. } = evt
  4981. debuglog(
  4982. 'connecting to %s using %s%s',
  4983. `${host}${port ? `:${port}` : ''}`,
  4984. protocol,
  4985. version
  4986. )
  4987. })
  4988. diagnosticsChannel.channel('undici:client:connected').subscribe(evt => {
  4989. const {
  4990. connectParams: { version, protocol, port, host }
  4991. } = evt
  4992. debuglog(
  4993. 'connected to %s using %s%s',
  4994. `${host}${port ? `:${port}` : ''}`,
  4995. protocol,
  4996. version
  4997. )
  4998. })
  4999. diagnosticsChannel.channel('undici:client:connectError').subscribe(evt => {
  5000. const {
  5001. connectParams: { version, protocol, port, host },
  5002. error
  5003. } = evt
  5004. debuglog(
  5005. 'connection to %s using %s%s errored - %s',
  5006. `${host}${port ? `:${port}` : ''}`,
  5007. protocol,
  5008. version,
  5009. error.message
  5010. )
  5011. })
  5012. diagnosticsChannel.channel('undici:client:sendHeaders').subscribe(evt => {
  5013. const {
  5014. request: { method, path, origin }
  5015. } = evt
  5016. debuglog('sending request to %s %s/%s', method, origin, path)
  5017. })
  5018. // Track Request events
  5019. diagnosticsChannel.channel('undici:request:headers').subscribe(evt => {
  5020. const {
  5021. request: { method, path, origin },
  5022. response: { statusCode }
  5023. } = evt
  5024. debuglog(
  5025. 'received response to %s %s/%s - HTTP %d',
  5026. method,
  5027. origin,
  5028. path,
  5029. statusCode
  5030. )
  5031. })
  5032. diagnosticsChannel.channel('undici:request:trailers').subscribe(evt => {
  5033. const {
  5034. request: { method, path, origin }
  5035. } = evt
  5036. debuglog('trailers received from %s %s/%s', method, origin, path)
  5037. })
  5038. diagnosticsChannel.channel('undici:request:error').subscribe(evt => {
  5039. const {
  5040. request: { method, path, origin },
  5041. error
  5042. } = evt
  5043. debuglog(
  5044. 'request to %s %s/%s errored - %s',
  5045. method,
  5046. origin,
  5047. path,
  5048. error.message
  5049. )
  5050. })
  5051. isClientSet = true
  5052. }
  5053. if (websocketDebuglog.enabled) {
  5054. if (!isClientSet) {
  5055. const debuglog = undiciDebugLog.enabled ? undiciDebugLog : websocketDebuglog
  5056. diagnosticsChannel.channel('undici:client:beforeConnect').subscribe(evt => {
  5057. const {
  5058. connectParams: { version, protocol, port, host }
  5059. } = evt
  5060. debuglog(
  5061. 'connecting to %s%s using %s%s',
  5062. host,
  5063. port ? `:${port}` : '',
  5064. protocol,
  5065. version
  5066. )
  5067. })
  5068. diagnosticsChannel.channel('undici:client:connected').subscribe(evt => {
  5069. const {
  5070. connectParams: { version, protocol, port, host }
  5071. } = evt
  5072. debuglog(
  5073. 'connected to %s%s using %s%s',
  5074. host,
  5075. port ? `:${port}` : '',
  5076. protocol,
  5077. version
  5078. )
  5079. })
  5080. diagnosticsChannel.channel('undici:client:connectError').subscribe(evt => {
  5081. const {
  5082. connectParams: { version, protocol, port, host },
  5083. error
  5084. } = evt
  5085. debuglog(
  5086. 'connection to %s%s using %s%s errored - %s',
  5087. host,
  5088. port ? `:${port}` : '',
  5089. protocol,
  5090. version,
  5091. error.message
  5092. )
  5093. })
  5094. diagnosticsChannel.channel('undici:client:sendHeaders').subscribe(evt => {
  5095. const {
  5096. request: { method, path, origin }
  5097. } = evt
  5098. debuglog('sending request to %s %s/%s', method, origin, path)
  5099. })
  5100. }
  5101. // Track all WebSocket events
  5102. diagnosticsChannel.channel('undici:websocket:open').subscribe(evt => {
  5103. const {
  5104. address: { address, port }
  5105. } = evt
  5106. websocketDebuglog('connection opened %s%s', address, port ? `:${port}` : '')
  5107. })
  5108. diagnosticsChannel.channel('undici:websocket:close').subscribe(evt => {
  5109. const { websocket, code, reason } = evt
  5110. websocketDebuglog(
  5111. 'closed connection to %s - %s %s',
  5112. websocket.url,
  5113. code,
  5114. reason
  5115. )
  5116. })
  5117. diagnosticsChannel.channel('undici:websocket:socket_error').subscribe(err => {
  5118. websocketDebuglog('connection errored - %s', err.message)
  5119. })
  5120. diagnosticsChannel.channel('undici:websocket:ping').subscribe(evt => {
  5121. websocketDebuglog('ping received')
  5122. })
  5123. diagnosticsChannel.channel('undici:websocket:pong').subscribe(evt => {
  5124. websocketDebuglog('pong received')
  5125. })
  5126. }
  5127. module.exports = {
  5128. channels
  5129. }
  5130. /***/ }),
  5131. /***/ 8707:
  5132. /***/ ((module) => {
  5133. const kUndiciError = Symbol.for('undici.error.UND_ERR')
  5134. class UndiciError extends Error {
  5135. constructor (message) {
  5136. super(message)
  5137. this.name = 'UndiciError'
  5138. this.code = 'UND_ERR'
  5139. }
  5140. static [Symbol.hasInstance] (instance) {
  5141. return instance && instance[kUndiciError] === true
  5142. }
  5143. [kUndiciError] = true
  5144. }
  5145. const kConnectTimeoutError = Symbol.for('undici.error.UND_ERR_CONNECT_TIMEOUT')
  5146. class ConnectTimeoutError extends UndiciError {
  5147. constructor (message) {
  5148. super(message)
  5149. this.name = 'ConnectTimeoutError'
  5150. this.message = message || 'Connect Timeout Error'
  5151. this.code = 'UND_ERR_CONNECT_TIMEOUT'
  5152. }
  5153. static [Symbol.hasInstance] (instance) {
  5154. return instance && instance[kConnectTimeoutError] === true
  5155. }
  5156. [kConnectTimeoutError] = true
  5157. }
  5158. const kHeadersTimeoutError = Symbol.for('undici.error.UND_ERR_HEADERS_TIMEOUT')
  5159. class HeadersTimeoutError extends UndiciError {
  5160. constructor (message) {
  5161. super(message)
  5162. this.name = 'HeadersTimeoutError'
  5163. this.message = message || 'Headers Timeout Error'
  5164. this.code = 'UND_ERR_HEADERS_TIMEOUT'
  5165. }
  5166. static [Symbol.hasInstance] (instance) {
  5167. return instance && instance[kHeadersTimeoutError] === true
  5168. }
  5169. [kHeadersTimeoutError] = true
  5170. }
  5171. const kHeadersOverflowError = Symbol.for('undici.error.UND_ERR_HEADERS_OVERFLOW')
  5172. class HeadersOverflowError extends UndiciError {
  5173. constructor (message) {
  5174. super(message)
  5175. this.name = 'HeadersOverflowError'
  5176. this.message = message || 'Headers Overflow Error'
  5177. this.code = 'UND_ERR_HEADERS_OVERFLOW'
  5178. }
  5179. static [Symbol.hasInstance] (instance) {
  5180. return instance && instance[kHeadersOverflowError] === true
  5181. }
  5182. [kHeadersOverflowError] = true
  5183. }
  5184. const kBodyTimeoutError = Symbol.for('undici.error.UND_ERR_BODY_TIMEOUT')
  5185. class BodyTimeoutError extends UndiciError {
  5186. constructor (message) {
  5187. super(message)
  5188. this.name = 'BodyTimeoutError'
  5189. this.message = message || 'Body Timeout Error'
  5190. this.code = 'UND_ERR_BODY_TIMEOUT'
  5191. }
  5192. static [Symbol.hasInstance] (instance) {
  5193. return instance && instance[kBodyTimeoutError] === true
  5194. }
  5195. [kBodyTimeoutError] = true
  5196. }
  5197. const kResponseStatusCodeError = Symbol.for('undici.error.UND_ERR_RESPONSE_STATUS_CODE')
  5198. class ResponseStatusCodeError extends UndiciError {
  5199. constructor (message, statusCode, headers, body) {
  5200. super(message)
  5201. this.name = 'ResponseStatusCodeError'
  5202. this.message = message || 'Response Status Code Error'
  5203. this.code = 'UND_ERR_RESPONSE_STATUS_CODE'
  5204. this.body = body
  5205. this.status = statusCode
  5206. this.statusCode = statusCode
  5207. this.headers = headers
  5208. }
  5209. static [Symbol.hasInstance] (instance) {
  5210. return instance && instance[kResponseStatusCodeError] === true
  5211. }
  5212. [kResponseStatusCodeError] = true
  5213. }
  5214. const kInvalidArgumentError = Symbol.for('undici.error.UND_ERR_INVALID_ARG')
  5215. class InvalidArgumentError extends UndiciError {
  5216. constructor (message) {
  5217. super(message)
  5218. this.name = 'InvalidArgumentError'
  5219. this.message = message || 'Invalid Argument Error'
  5220. this.code = 'UND_ERR_INVALID_ARG'
  5221. }
  5222. static [Symbol.hasInstance] (instance) {
  5223. return instance && instance[kInvalidArgumentError] === true
  5224. }
  5225. [kInvalidArgumentError] = true
  5226. }
  5227. const kInvalidReturnValueError = Symbol.for('undici.error.UND_ERR_INVALID_RETURN_VALUE')
  5228. class InvalidReturnValueError extends UndiciError {
  5229. constructor (message) {
  5230. super(message)
  5231. this.name = 'InvalidReturnValueError'
  5232. this.message = message || 'Invalid Return Value Error'
  5233. this.code = 'UND_ERR_INVALID_RETURN_VALUE'
  5234. }
  5235. static [Symbol.hasInstance] (instance) {
  5236. return instance && instance[kInvalidReturnValueError] === true
  5237. }
  5238. [kInvalidReturnValueError] = true
  5239. }
  5240. const kAbortError = Symbol.for('undici.error.UND_ERR_ABORT')
  5241. class AbortError extends UndiciError {
  5242. constructor (message) {
  5243. super(message)
  5244. this.name = 'AbortError'
  5245. this.message = message || 'The operation was aborted'
  5246. this.code = 'UND_ERR_ABORT'
  5247. }
  5248. static [Symbol.hasInstance] (instance) {
  5249. return instance && instance[kAbortError] === true
  5250. }
  5251. [kAbortError] = true
  5252. }
  5253. const kRequestAbortedError = Symbol.for('undici.error.UND_ERR_ABORTED')
  5254. class RequestAbortedError extends AbortError {
  5255. constructor (message) {
  5256. super(message)
  5257. this.name = 'AbortError'
  5258. this.message = message || 'Request aborted'
  5259. this.code = 'UND_ERR_ABORTED'
  5260. }
  5261. static [Symbol.hasInstance] (instance) {
  5262. return instance && instance[kRequestAbortedError] === true
  5263. }
  5264. [kRequestAbortedError] = true
  5265. }
  5266. const kInformationalError = Symbol.for('undici.error.UND_ERR_INFO')
  5267. class InformationalError extends UndiciError {
  5268. constructor (message) {
  5269. super(message)
  5270. this.name = 'InformationalError'
  5271. this.message = message || 'Request information'
  5272. this.code = 'UND_ERR_INFO'
  5273. }
  5274. static [Symbol.hasInstance] (instance) {
  5275. return instance && instance[kInformationalError] === true
  5276. }
  5277. [kInformationalError] = true
  5278. }
  5279. const kRequestContentLengthMismatchError = Symbol.for('undici.error.UND_ERR_REQ_CONTENT_LENGTH_MISMATCH')
  5280. class RequestContentLengthMismatchError extends UndiciError {
  5281. constructor (message) {
  5282. super(message)
  5283. this.name = 'RequestContentLengthMismatchError'
  5284. this.message = message || 'Request body length does not match content-length header'
  5285. this.code = 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
  5286. }
  5287. static [Symbol.hasInstance] (instance) {
  5288. return instance && instance[kRequestContentLengthMismatchError] === true
  5289. }
  5290. [kRequestContentLengthMismatchError] = true
  5291. }
  5292. const kResponseContentLengthMismatchError = Symbol.for('undici.error.UND_ERR_RES_CONTENT_LENGTH_MISMATCH')
  5293. class ResponseContentLengthMismatchError extends UndiciError {
  5294. constructor (message) {
  5295. super(message)
  5296. this.name = 'ResponseContentLengthMismatchError'
  5297. this.message = message || 'Response body length does not match content-length header'
  5298. this.code = 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH'
  5299. }
  5300. static [Symbol.hasInstance] (instance) {
  5301. return instance && instance[kResponseContentLengthMismatchError] === true
  5302. }
  5303. [kResponseContentLengthMismatchError] = true
  5304. }
  5305. const kClientDestroyedError = Symbol.for('undici.error.UND_ERR_DESTROYED')
  5306. class ClientDestroyedError extends UndiciError {
  5307. constructor (message) {
  5308. super(message)
  5309. this.name = 'ClientDestroyedError'
  5310. this.message = message || 'The client is destroyed'
  5311. this.code = 'UND_ERR_DESTROYED'
  5312. }
  5313. static [Symbol.hasInstance] (instance) {
  5314. return instance && instance[kClientDestroyedError] === true
  5315. }
  5316. [kClientDestroyedError] = true
  5317. }
  5318. const kClientClosedError = Symbol.for('undici.error.UND_ERR_CLOSED')
  5319. class ClientClosedError extends UndiciError {
  5320. constructor (message) {
  5321. super(message)
  5322. this.name = 'ClientClosedError'
  5323. this.message = message || 'The client is closed'
  5324. this.code = 'UND_ERR_CLOSED'
  5325. }
  5326. static [Symbol.hasInstance] (instance) {
  5327. return instance && instance[kClientClosedError] === true
  5328. }
  5329. [kClientClosedError] = true
  5330. }
  5331. const kSocketError = Symbol.for('undici.error.UND_ERR_SOCKET')
  5332. class SocketError extends UndiciError {
  5333. constructor (message, socket) {
  5334. super(message)
  5335. this.name = 'SocketError'
  5336. this.message = message || 'Socket error'
  5337. this.code = 'UND_ERR_SOCKET'
  5338. this.socket = socket
  5339. }
  5340. static [Symbol.hasInstance] (instance) {
  5341. return instance && instance[kSocketError] === true
  5342. }
  5343. [kSocketError] = true
  5344. }
  5345. const kNotSupportedError = Symbol.for('undici.error.UND_ERR_NOT_SUPPORTED')
  5346. class NotSupportedError extends UndiciError {
  5347. constructor (message) {
  5348. super(message)
  5349. this.name = 'NotSupportedError'
  5350. this.message = message || 'Not supported error'
  5351. this.code = 'UND_ERR_NOT_SUPPORTED'
  5352. }
  5353. static [Symbol.hasInstance] (instance) {
  5354. return instance && instance[kNotSupportedError] === true
  5355. }
  5356. [kNotSupportedError] = true
  5357. }
  5358. const kBalancedPoolMissingUpstreamError = Symbol.for('undici.error.UND_ERR_BPL_MISSING_UPSTREAM')
  5359. class BalancedPoolMissingUpstreamError extends UndiciError {
  5360. constructor (message) {
  5361. super(message)
  5362. this.name = 'MissingUpstreamError'
  5363. this.message = message || 'No upstream has been added to the BalancedPool'
  5364. this.code = 'UND_ERR_BPL_MISSING_UPSTREAM'
  5365. }
  5366. static [Symbol.hasInstance] (instance) {
  5367. return instance && instance[kBalancedPoolMissingUpstreamError] === true
  5368. }
  5369. [kBalancedPoolMissingUpstreamError] = true
  5370. }
  5371. const kHTTPParserError = Symbol.for('undici.error.UND_ERR_HTTP_PARSER')
  5372. class HTTPParserError extends Error {
  5373. constructor (message, code, data) {
  5374. super(message)
  5375. this.name = 'HTTPParserError'
  5376. this.code = code ? `HPE_${code}` : undefined
  5377. this.data = data ? data.toString() : undefined
  5378. }
  5379. static [Symbol.hasInstance] (instance) {
  5380. return instance && instance[kHTTPParserError] === true
  5381. }
  5382. [kHTTPParserError] = true
  5383. }
  5384. const kResponseExceededMaxSizeError = Symbol.for('undici.error.UND_ERR_RES_EXCEEDED_MAX_SIZE')
  5385. class ResponseExceededMaxSizeError extends UndiciError {
  5386. constructor (message) {
  5387. super(message)
  5388. this.name = 'ResponseExceededMaxSizeError'
  5389. this.message = message || 'Response content exceeded max size'
  5390. this.code = 'UND_ERR_RES_EXCEEDED_MAX_SIZE'
  5391. }
  5392. static [Symbol.hasInstance] (instance) {
  5393. return instance && instance[kResponseExceededMaxSizeError] === true
  5394. }
  5395. [kResponseExceededMaxSizeError] = true
  5396. }
  5397. const kRequestRetryError = Symbol.for('undici.error.UND_ERR_REQ_RETRY')
  5398. class RequestRetryError extends UndiciError {
  5399. constructor (message, code, { headers, data }) {
  5400. super(message)
  5401. this.name = 'RequestRetryError'
  5402. this.message = message || 'Request retry error'
  5403. this.code = 'UND_ERR_REQ_RETRY'
  5404. this.statusCode = code
  5405. this.data = data
  5406. this.headers = headers
  5407. }
  5408. static [Symbol.hasInstance] (instance) {
  5409. return instance && instance[kRequestRetryError] === true
  5410. }
  5411. [kRequestRetryError] = true
  5412. }
  5413. const kResponseError = Symbol.for('undici.error.UND_ERR_RESPONSE')
  5414. class ResponseError extends UndiciError {
  5415. constructor (message, code, { headers, data }) {
  5416. super(message)
  5417. this.name = 'ResponseError'
  5418. this.message = message || 'Response error'
  5419. this.code = 'UND_ERR_RESPONSE'
  5420. this.statusCode = code
  5421. this.data = data
  5422. this.headers = headers
  5423. }
  5424. static [Symbol.hasInstance] (instance) {
  5425. return instance && instance[kResponseError] === true
  5426. }
  5427. [kResponseError] = true
  5428. }
  5429. const kSecureProxyConnectionError = Symbol.for('undici.error.UND_ERR_PRX_TLS')
  5430. class SecureProxyConnectionError extends UndiciError {
  5431. constructor (cause, message, options) {
  5432. super(message, { cause, ...(options ?? {}) })
  5433. this.name = 'SecureProxyConnectionError'
  5434. this.message = message || 'Secure Proxy Connection failed'
  5435. this.code = 'UND_ERR_PRX_TLS'
  5436. this.cause = cause
  5437. }
  5438. static [Symbol.hasInstance] (instance) {
  5439. return instance && instance[kSecureProxyConnectionError] === true
  5440. }
  5441. [kSecureProxyConnectionError] = true
  5442. }
  5443. const kMessageSizeExceededError = Symbol.for('undici.error.UND_ERR_WS_MESSAGE_SIZE_EXCEEDED')
  5444. class MessageSizeExceededError extends UndiciError {
  5445. constructor (message) {
  5446. super(message)
  5447. this.name = 'MessageSizeExceededError'
  5448. this.message = message || 'Max decompressed message size exceeded'
  5449. this.code = 'UND_ERR_WS_MESSAGE_SIZE_EXCEEDED'
  5450. }
  5451. static [Symbol.hasInstance] (instance) {
  5452. return instance && instance[kMessageSizeExceededError] === true
  5453. }
  5454. get [kMessageSizeExceededError] () {
  5455. return true
  5456. }
  5457. }
  5458. module.exports = {
  5459. AbortError,
  5460. HTTPParserError,
  5461. UndiciError,
  5462. HeadersTimeoutError,
  5463. HeadersOverflowError,
  5464. BodyTimeoutError,
  5465. RequestContentLengthMismatchError,
  5466. ConnectTimeoutError,
  5467. ResponseStatusCodeError,
  5468. InvalidArgumentError,
  5469. InvalidReturnValueError,
  5470. RequestAbortedError,
  5471. ClientDestroyedError,
  5472. ClientClosedError,
  5473. InformationalError,
  5474. SocketError,
  5475. NotSupportedError,
  5476. ResponseContentLengthMismatchError,
  5477. BalancedPoolMissingUpstreamError,
  5478. ResponseExceededMaxSizeError,
  5479. RequestRetryError,
  5480. ResponseError,
  5481. SecureProxyConnectionError,
  5482. MessageSizeExceededError
  5483. }
  5484. /***/ }),
  5485. /***/ 4655:
  5486. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  5487. const {
  5488. InvalidArgumentError,
  5489. NotSupportedError
  5490. } = __nccwpck_require__(8707)
  5491. const assert = __nccwpck_require__(4589)
  5492. const {
  5493. isValidHTTPToken,
  5494. isValidHeaderValue,
  5495. isStream,
  5496. destroy,
  5497. isBuffer,
  5498. isFormDataLike,
  5499. isIterable,
  5500. isBlobLike,
  5501. buildURL,
  5502. validateHandler,
  5503. getServerName,
  5504. normalizedMethodRecords
  5505. } = __nccwpck_require__(3440)
  5506. const { channels } = __nccwpck_require__(2414)
  5507. const { headerNameLowerCasedRecord } = __nccwpck_require__(735)
  5508. // Verifies that a given path is valid does not contain control chars \x00 to \x20
  5509. const invalidPathRegex = /[^\u0021-\u00ff]/
  5510. const kHandler = Symbol('handler')
  5511. class Request {
  5512. constructor (origin, {
  5513. path,
  5514. method,
  5515. body,
  5516. headers,
  5517. query,
  5518. idempotent,
  5519. blocking,
  5520. upgrade,
  5521. headersTimeout,
  5522. bodyTimeout,
  5523. reset,
  5524. throwOnError,
  5525. expectContinue,
  5526. servername
  5527. }, handler) {
  5528. if (typeof path !== 'string') {
  5529. throw new InvalidArgumentError('path must be a string')
  5530. } else if (
  5531. path[0] !== '/' &&
  5532. !(path.startsWith('http://') || path.startsWith('https://')) &&
  5533. method !== 'CONNECT'
  5534. ) {
  5535. throw new InvalidArgumentError('path must be an absolute URL or start with a slash')
  5536. } else if (invalidPathRegex.test(path)) {
  5537. throw new InvalidArgumentError('invalid request path')
  5538. }
  5539. if (typeof method !== 'string') {
  5540. throw new InvalidArgumentError('method must be a string')
  5541. } else if (normalizedMethodRecords[method] === undefined && !isValidHTTPToken(method)) {
  5542. throw new InvalidArgumentError('invalid request method')
  5543. }
  5544. if (upgrade && typeof upgrade !== 'string') {
  5545. throw new InvalidArgumentError('upgrade must be a string')
  5546. }
  5547. if (upgrade && !isValidHeaderValue(upgrade)) {
  5548. throw new InvalidArgumentError('invalid upgrade header')
  5549. }
  5550. if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) {
  5551. throw new InvalidArgumentError('invalid headersTimeout')
  5552. }
  5553. if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) {
  5554. throw new InvalidArgumentError('invalid bodyTimeout')
  5555. }
  5556. if (reset != null && typeof reset !== 'boolean') {
  5557. throw new InvalidArgumentError('invalid reset')
  5558. }
  5559. if (expectContinue != null && typeof expectContinue !== 'boolean') {
  5560. throw new InvalidArgumentError('invalid expectContinue')
  5561. }
  5562. this.headersTimeout = headersTimeout
  5563. this.bodyTimeout = bodyTimeout
  5564. this.throwOnError = throwOnError === true
  5565. this.method = method
  5566. this.abort = null
  5567. if (body == null) {
  5568. this.body = null
  5569. } else if (isStream(body)) {
  5570. this.body = body
  5571. const rState = this.body._readableState
  5572. if (!rState || !rState.autoDestroy) {
  5573. this.endHandler = function autoDestroy () {
  5574. destroy(this)
  5575. }
  5576. this.body.on('end', this.endHandler)
  5577. }
  5578. this.errorHandler = err => {
  5579. if (this.abort) {
  5580. this.abort(err)
  5581. } else {
  5582. this.error = err
  5583. }
  5584. }
  5585. this.body.on('error', this.errorHandler)
  5586. } else if (isBuffer(body)) {
  5587. this.body = body.byteLength ? body : null
  5588. } else if (ArrayBuffer.isView(body)) {
  5589. this.body = body.buffer.byteLength ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : null
  5590. } else if (body instanceof ArrayBuffer) {
  5591. this.body = body.byteLength ? Buffer.from(body) : null
  5592. } else if (typeof body === 'string') {
  5593. this.body = body.length ? Buffer.from(body) : null
  5594. } else if (isFormDataLike(body) || isIterable(body) || isBlobLike(body)) {
  5595. this.body = body
  5596. } else {
  5597. throw new InvalidArgumentError('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable')
  5598. }
  5599. this.completed = false
  5600. this.aborted = false
  5601. this.upgrade = upgrade || null
  5602. this.path = query ? buildURL(path, query) : path
  5603. this.origin = origin
  5604. this.idempotent = idempotent == null
  5605. ? method === 'HEAD' || method === 'GET'
  5606. : idempotent
  5607. this.blocking = blocking == null ? false : blocking
  5608. this.reset = reset == null ? null : reset
  5609. this.host = null
  5610. this.contentLength = null
  5611. this.contentType = null
  5612. this.headers = []
  5613. // Only for H2
  5614. this.expectContinue = expectContinue != null ? expectContinue : false
  5615. if (Array.isArray(headers)) {
  5616. if (headers.length % 2 !== 0) {
  5617. throw new InvalidArgumentError('headers array must be even')
  5618. }
  5619. for (let i = 0; i < headers.length; i += 2) {
  5620. processHeader(this, headers[i], headers[i + 1])
  5621. }
  5622. } else if (headers && typeof headers === 'object') {
  5623. if (headers[Symbol.iterator]) {
  5624. for (const header of headers) {
  5625. if (!Array.isArray(header) || header.length !== 2) {
  5626. throw new InvalidArgumentError('headers must be in key-value pair format')
  5627. }
  5628. processHeader(this, header[0], header[1])
  5629. }
  5630. } else {
  5631. const keys = Object.keys(headers)
  5632. for (let i = 0; i < keys.length; ++i) {
  5633. processHeader(this, keys[i], headers[keys[i]])
  5634. }
  5635. }
  5636. } else if (headers != null) {
  5637. throw new InvalidArgumentError('headers must be an object or an array')
  5638. }
  5639. validateHandler(handler, method, upgrade)
  5640. this.servername = servername || getServerName(this.host)
  5641. this[kHandler] = handler
  5642. if (channels.create.hasSubscribers) {
  5643. channels.create.publish({ request: this })
  5644. }
  5645. }
  5646. onBodySent (chunk) {
  5647. if (this[kHandler].onBodySent) {
  5648. try {
  5649. return this[kHandler].onBodySent(chunk)
  5650. } catch (err) {
  5651. this.abort(err)
  5652. }
  5653. }
  5654. }
  5655. onRequestSent () {
  5656. if (channels.bodySent.hasSubscribers) {
  5657. channels.bodySent.publish({ request: this })
  5658. }
  5659. if (this[kHandler].onRequestSent) {
  5660. try {
  5661. return this[kHandler].onRequestSent()
  5662. } catch (err) {
  5663. this.abort(err)
  5664. }
  5665. }
  5666. }
  5667. onConnect (abort) {
  5668. assert(!this.aborted)
  5669. assert(!this.completed)
  5670. if (this.error) {
  5671. abort(this.error)
  5672. } else {
  5673. this.abort = abort
  5674. return this[kHandler].onConnect(abort)
  5675. }
  5676. }
  5677. onResponseStarted () {
  5678. return this[kHandler].onResponseStarted?.()
  5679. }
  5680. onHeaders (statusCode, headers, resume, statusText) {
  5681. assert(!this.aborted)
  5682. assert(!this.completed)
  5683. if (channels.headers.hasSubscribers) {
  5684. channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })
  5685. }
  5686. try {
  5687. return this[kHandler].onHeaders(statusCode, headers, resume, statusText)
  5688. } catch (err) {
  5689. this.abort(err)
  5690. }
  5691. }
  5692. onData (chunk) {
  5693. assert(!this.aborted)
  5694. assert(!this.completed)
  5695. try {
  5696. return this[kHandler].onData(chunk)
  5697. } catch (err) {
  5698. this.abort(err)
  5699. return false
  5700. }
  5701. }
  5702. /**
  5703. * @param {number|null} statusCode
  5704. * @param {Buffer[]|null} headers
  5705. * @param {import('node:stream').Duplex} socket
  5706. * @param {string} [statusText]
  5707. */
  5708. onUpgrade (statusCode, headers, socket, statusText = '') {
  5709. this.onFinally()
  5710. assert(!this.aborted)
  5711. assert(!this.completed)
  5712. if (statusCode !== null) {
  5713. this.#publishUpgradeHeaders(statusCode, headers, statusText)
  5714. }
  5715. const result = this[kHandler].onUpgrade(statusCode, headers, socket)
  5716. if (!this.aborted) {
  5717. this.completed = true
  5718. if (statusCode !== null) {
  5719. this.#publishUpgradeTrailers()
  5720. }
  5721. }
  5722. return result
  5723. }
  5724. /**
  5725. * @param {number} statusCode
  5726. * @param {import('node:http2').IncomingHttpHeaders} headers
  5727. * @param {(headers: import('node:http2').IncomingHttpHeaders) => Buffer[]} parseHeaders
  5728. * @param {string} [statusText]
  5729. */
  5730. onUpgradeResponse (statusCode, headers, parseHeaders, statusText = '') {
  5731. assert(!this.aborted)
  5732. assert(this.completed)
  5733. if (channels.headers.hasSubscribers) {
  5734. this.#publishUpgradeHeaders(statusCode, parseHeaders(headers), statusText)
  5735. }
  5736. this.#publishUpgradeTrailers()
  5737. }
  5738. /**
  5739. * @param {Error} error
  5740. */
  5741. onUpgradeError (error) {
  5742. assert(!this.aborted)
  5743. assert(this.completed)
  5744. if (channels.error.hasSubscribers) {
  5745. channels.error.publish({ request: this, error })
  5746. }
  5747. }
  5748. /**
  5749. * @param {number} statusCode
  5750. * @param {Buffer[]} headers
  5751. * @param {string} statusText
  5752. */
  5753. #publishUpgradeHeaders (statusCode, headers, statusText) {
  5754. if (channels.headers.hasSubscribers) {
  5755. channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })
  5756. }
  5757. }
  5758. #publishUpgradeTrailers () {
  5759. if (channels.trailers.hasSubscribers) {
  5760. channels.trailers.publish({ request: this, trailers: [] })
  5761. }
  5762. }
  5763. onComplete (trailers) {
  5764. this.onFinally()
  5765. assert(!this.aborted)
  5766. this.completed = true
  5767. if (channels.trailers.hasSubscribers) {
  5768. channels.trailers.publish({ request: this, trailers })
  5769. }
  5770. try {
  5771. return this[kHandler].onComplete(trailers)
  5772. } catch (err) {
  5773. // TODO (fix): This might be a bad idea?
  5774. this.onError(err)
  5775. }
  5776. }
  5777. onError (error) {
  5778. this.onFinally()
  5779. if (channels.error.hasSubscribers) {
  5780. channels.error.publish({ request: this, error })
  5781. }
  5782. if (this.aborted) {
  5783. return
  5784. }
  5785. this.aborted = true
  5786. return this[kHandler].onError(error)
  5787. }
  5788. onFinally () {
  5789. if (this.errorHandler) {
  5790. this.body.off('error', this.errorHandler)
  5791. this.errorHandler = null
  5792. }
  5793. if (this.endHandler) {
  5794. this.body.off('end', this.endHandler)
  5795. this.endHandler = null
  5796. }
  5797. }
  5798. addHeader (key, value) {
  5799. processHeader(this, key, value)
  5800. return this
  5801. }
  5802. }
  5803. function processHeader (request, key, val) {
  5804. if (val && (typeof val === 'object' && !Array.isArray(val))) {
  5805. throw new InvalidArgumentError(`invalid ${key} header`)
  5806. } else if (val === undefined) {
  5807. return
  5808. }
  5809. let headerName = headerNameLowerCasedRecord[key]
  5810. if (headerName === undefined) {
  5811. headerName = key.toLowerCase()
  5812. if (headerNameLowerCasedRecord[headerName] === undefined && !isValidHTTPToken(headerName)) {
  5813. throw new InvalidArgumentError('invalid header key')
  5814. }
  5815. }
  5816. if (Array.isArray(val)) {
  5817. const arr = []
  5818. for (let i = 0; i < val.length; i++) {
  5819. if (typeof val[i] === 'string') {
  5820. if (!isValidHeaderValue(val[i])) {
  5821. throw new InvalidArgumentError(`invalid ${key} header`)
  5822. }
  5823. arr.push(val[i])
  5824. } else if (val[i] === null) {
  5825. arr.push('')
  5826. } else if (typeof val[i] === 'object') {
  5827. throw new InvalidArgumentError(`invalid ${key} header`)
  5828. } else {
  5829. // Coerce primitives (and reject unsafe coercions such as functions
  5830. // with a crafted toString/Symbol.toPrimitive).
  5831. const str = `${val[i]}`
  5832. if (!isValidHeaderValue(str)) {
  5833. throw new InvalidArgumentError(`invalid ${key} header`)
  5834. }
  5835. arr.push(str)
  5836. }
  5837. }
  5838. val = arr
  5839. } else if (typeof val === 'string') {
  5840. if (!isValidHeaderValue(val)) {
  5841. throw new InvalidArgumentError(`invalid ${key} header`)
  5842. }
  5843. } else if (val === null) {
  5844. val = ''
  5845. } else {
  5846. // Coerce primitives (and reject unsafe coercions such as functions
  5847. // with a crafted toString/Symbol.toPrimitive).
  5848. val = `${val}`
  5849. if (!isValidHeaderValue(val)) {
  5850. throw new InvalidArgumentError(`invalid ${key} header`)
  5851. }
  5852. }
  5853. if (headerName === 'host') {
  5854. if (request.host !== null) {
  5855. throw new InvalidArgumentError('duplicate host header')
  5856. }
  5857. if (typeof val !== 'string') {
  5858. throw new InvalidArgumentError('invalid host header')
  5859. }
  5860. // Consumed by Client
  5861. request.host = val
  5862. } else if (headerName === 'content-length') {
  5863. if (request.contentLength !== null) {
  5864. throw new InvalidArgumentError('duplicate content-length header')
  5865. }
  5866. request.contentLength = parseInt(val, 10)
  5867. if (!Number.isFinite(request.contentLength)) {
  5868. throw new InvalidArgumentError('invalid content-length header')
  5869. }
  5870. } else if (request.contentType === null && headerName === 'content-type') {
  5871. request.contentType = val
  5872. request.headers.push(key, val)
  5873. } else if (headerName === 'transfer-encoding' || headerName === 'keep-alive' || headerName === 'upgrade') {
  5874. throw new InvalidArgumentError(`invalid ${headerName} header`)
  5875. } else if (headerName === 'connection') {
  5876. const value = typeof val === 'string' ? val.toLowerCase() : null
  5877. if (value !== 'close' && value !== 'keep-alive') {
  5878. throw new InvalidArgumentError('invalid connection header')
  5879. }
  5880. if (value === 'close') {
  5881. request.reset = true
  5882. }
  5883. } else if (headerName === 'expect') {
  5884. throw new NotSupportedError('expect header not supported')
  5885. } else {
  5886. request.headers.push(key, val)
  5887. }
  5888. }
  5889. module.exports = Request
  5890. /***/ }),
  5891. /***/ 6443:
  5892. /***/ ((module) => {
  5893. module.exports = {
  5894. kClose: Symbol('close'),
  5895. kDestroy: Symbol('destroy'),
  5896. kDispatch: Symbol('dispatch'),
  5897. kUrl: Symbol('url'),
  5898. kWriting: Symbol('writing'),
  5899. kResuming: Symbol('resuming'),
  5900. kQueue: Symbol('queue'),
  5901. kConnect: Symbol('connect'),
  5902. kConnecting: Symbol('connecting'),
  5903. kKeepAliveDefaultTimeout: Symbol('default keep alive timeout'),
  5904. kKeepAliveMaxTimeout: Symbol('max keep alive timeout'),
  5905. kKeepAliveTimeoutThreshold: Symbol('keep alive timeout threshold'),
  5906. kKeepAliveTimeoutValue: Symbol('keep alive timeout'),
  5907. kKeepAlive: Symbol('keep alive'),
  5908. kHeadersTimeout: Symbol('headers timeout'),
  5909. kBodyTimeout: Symbol('body timeout'),
  5910. kServerName: Symbol('server name'),
  5911. kLocalAddress: Symbol('local address'),
  5912. kHost: Symbol('host'),
  5913. kNoRef: Symbol('no ref'),
  5914. kBodyUsed: Symbol('used'),
  5915. kBody: Symbol('abstracted request body'),
  5916. kRunning: Symbol('running'),
  5917. kBlocking: Symbol('blocking'),
  5918. kPending: Symbol('pending'),
  5919. kSize: Symbol('size'),
  5920. kBusy: Symbol('busy'),
  5921. kQueued: Symbol('queued'),
  5922. kFree: Symbol('free'),
  5923. kConnected: Symbol('connected'),
  5924. kClosed: Symbol('closed'),
  5925. kNeedDrain: Symbol('need drain'),
  5926. kReset: Symbol('reset'),
  5927. kDestroyed: Symbol.for('nodejs.stream.destroyed'),
  5928. kResume: Symbol('resume'),
  5929. kOnError: Symbol('on error'),
  5930. kMaxHeadersSize: Symbol('max headers size'),
  5931. kRunningIdx: Symbol('running index'),
  5932. kPendingIdx: Symbol('pending index'),
  5933. kError: Symbol('error'),
  5934. kClients: Symbol('clients'),
  5935. kClient: Symbol('client'),
  5936. kParser: Symbol('parser'),
  5937. kOnDestroyed: Symbol('destroy callbacks'),
  5938. kPipelining: Symbol('pipelining'),
  5939. kSocket: Symbol('socket'),
  5940. kHostHeader: Symbol('host header'),
  5941. kConnector: Symbol('connector'),
  5942. kStrictContentLength: Symbol('strict content length'),
  5943. kMaxRedirections: Symbol('maxRedirections'),
  5944. kMaxRequests: Symbol('maxRequestsPerClient'),
  5945. kProxy: Symbol('proxy agent options'),
  5946. kCounter: Symbol('socket request counter'),
  5947. kInterceptors: Symbol('dispatch interceptors'),
  5948. kMaxResponseSize: Symbol('max response size'),
  5949. kHTTP2Session: Symbol('http2Session'),
  5950. kHTTP2SessionState: Symbol('http2Session state'),
  5951. kRetryHandlerDefaultRetry: Symbol('retry agent default retry'),
  5952. kConstruct: Symbol('constructable'),
  5953. kListeners: Symbol('listeners'),
  5954. kHTTPContext: Symbol('http context'),
  5955. kMaxConcurrentStreams: Symbol('max concurrent streams'),
  5956. kNoProxyAgent: Symbol('no proxy agent'),
  5957. kHttpProxyAgent: Symbol('http proxy agent'),
  5958. kHttpsProxyAgent: Symbol('https proxy agent')
  5959. }
  5960. /***/ }),
  5961. /***/ 7752:
  5962. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  5963. const {
  5964. wellknownHeaderNames,
  5965. headerNameLowerCasedRecord
  5966. } = __nccwpck_require__(735)
  5967. class TstNode {
  5968. /** @type {any} */
  5969. value = null
  5970. /** @type {null | TstNode} */
  5971. left = null
  5972. /** @type {null | TstNode} */
  5973. middle = null
  5974. /** @type {null | TstNode} */
  5975. right = null
  5976. /** @type {number} */
  5977. code
  5978. /**
  5979. * @param {string} key
  5980. * @param {any} value
  5981. * @param {number} index
  5982. */
  5983. constructor (key, value, index) {
  5984. if (index === undefined || index >= key.length) {
  5985. throw new TypeError('Unreachable')
  5986. }
  5987. const code = this.code = key.charCodeAt(index)
  5988. // check code is ascii string
  5989. if (code > 0x7F) {
  5990. throw new TypeError('key must be ascii string')
  5991. }
  5992. if (key.length !== ++index) {
  5993. this.middle = new TstNode(key, value, index)
  5994. } else {
  5995. this.value = value
  5996. }
  5997. }
  5998. /**
  5999. * @param {string} key
  6000. * @param {any} value
  6001. */
  6002. add (key, value) {
  6003. const length = key.length
  6004. if (length === 0) {
  6005. throw new TypeError('Unreachable')
  6006. }
  6007. let index = 0
  6008. let node = this
  6009. while (true) {
  6010. const code = key.charCodeAt(index)
  6011. // check code is ascii string
  6012. if (code > 0x7F) {
  6013. throw new TypeError('key must be ascii string')
  6014. }
  6015. if (node.code === code) {
  6016. if (length === ++index) {
  6017. node.value = value
  6018. break
  6019. } else if (node.middle !== null) {
  6020. node = node.middle
  6021. } else {
  6022. node.middle = new TstNode(key, value, index)
  6023. break
  6024. }
  6025. } else if (node.code < code) {
  6026. if (node.left !== null) {
  6027. node = node.left
  6028. } else {
  6029. node.left = new TstNode(key, value, index)
  6030. break
  6031. }
  6032. } else if (node.right !== null) {
  6033. node = node.right
  6034. } else {
  6035. node.right = new TstNode(key, value, index)
  6036. break
  6037. }
  6038. }
  6039. }
  6040. /**
  6041. * @param {Uint8Array} key
  6042. * @return {TstNode | null}
  6043. */
  6044. search (key) {
  6045. const keylength = key.length
  6046. let index = 0
  6047. let node = this
  6048. while (node !== null && index < keylength) {
  6049. let code = key[index]
  6050. // A-Z
  6051. // First check if it is bigger than 0x5a.
  6052. // Lowercase letters have higher char codes than uppercase ones.
  6053. // Also we assume that headers will mostly contain lowercase characters.
  6054. if (code <= 0x5a && code >= 0x41) {
  6055. // Lowercase for uppercase.
  6056. code |= 32
  6057. }
  6058. while (node !== null) {
  6059. if (code === node.code) {
  6060. if (keylength === ++index) {
  6061. // Returns Node since it is the last key.
  6062. return node
  6063. }
  6064. node = node.middle
  6065. break
  6066. }
  6067. node = node.code < code ? node.left : node.right
  6068. }
  6069. }
  6070. return null
  6071. }
  6072. }
  6073. class TernarySearchTree {
  6074. /** @type {TstNode | null} */
  6075. node = null
  6076. /**
  6077. * @param {string} key
  6078. * @param {any} value
  6079. * */
  6080. insert (key, value) {
  6081. if (this.node === null) {
  6082. this.node = new TstNode(key, value, 0)
  6083. } else {
  6084. this.node.add(key, value)
  6085. }
  6086. }
  6087. /**
  6088. * @param {Uint8Array} key
  6089. * @return {any}
  6090. */
  6091. lookup (key) {
  6092. return this.node?.search(key)?.value ?? null
  6093. }
  6094. }
  6095. const tree = new TernarySearchTree()
  6096. for (let i = 0; i < wellknownHeaderNames.length; ++i) {
  6097. const key = headerNameLowerCasedRecord[wellknownHeaderNames[i]]
  6098. tree.insert(key, key)
  6099. }
  6100. module.exports = {
  6101. TernarySearchTree,
  6102. tree
  6103. }
  6104. /***/ }),
  6105. /***/ 3440:
  6106. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  6107. const assert = __nccwpck_require__(4589)
  6108. const { kDestroyed, kBodyUsed, kListeners, kBody } = __nccwpck_require__(6443)
  6109. const { IncomingMessage } = __nccwpck_require__(7067)
  6110. const stream = __nccwpck_require__(7075)
  6111. const net = __nccwpck_require__(7030)
  6112. const { Blob } = __nccwpck_require__(4573)
  6113. const nodeUtil = __nccwpck_require__(7975)
  6114. const { stringify } = __nccwpck_require__(1792)
  6115. const { EventEmitter: EE } = __nccwpck_require__(8474)
  6116. const { InvalidArgumentError } = __nccwpck_require__(8707)
  6117. const { headerNameLowerCasedRecord } = __nccwpck_require__(735)
  6118. const { tree } = __nccwpck_require__(7752)
  6119. const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
  6120. class BodyAsyncIterable {
  6121. constructor (body) {
  6122. this[kBody] = body
  6123. this[kBodyUsed] = false
  6124. }
  6125. async * [Symbol.asyncIterator] () {
  6126. assert(!this[kBodyUsed], 'disturbed')
  6127. this[kBodyUsed] = true
  6128. yield * this[kBody]
  6129. }
  6130. }
  6131. function wrapRequestBody (body) {
  6132. if (isStream(body)) {
  6133. // TODO (fix): Provide some way for the user to cache the file to e.g. /tmp
  6134. // so that it can be dispatched again?
  6135. // TODO (fix): Do we need 100-expect support to provide a way to do this properly?
  6136. if (bodyLength(body) === 0) {
  6137. body
  6138. .on('data', function () {
  6139. assert(false)
  6140. })
  6141. }
  6142. if (typeof body.readableDidRead !== 'boolean') {
  6143. body[kBodyUsed] = false
  6144. EE.prototype.on.call(body, 'data', function () {
  6145. this[kBodyUsed] = true
  6146. })
  6147. }
  6148. return body
  6149. } else if (body && typeof body.pipeTo === 'function') {
  6150. // TODO (fix): We can't access ReadableStream internal state
  6151. // to determine whether or not it has been disturbed. This is just
  6152. // a workaround.
  6153. return new BodyAsyncIterable(body)
  6154. } else if (
  6155. body &&
  6156. typeof body !== 'string' &&
  6157. !ArrayBuffer.isView(body) &&
  6158. isIterable(body)
  6159. ) {
  6160. // TODO: Should we allow re-using iterable if !this.opts.idempotent
  6161. // or through some other flag?
  6162. return new BodyAsyncIterable(body)
  6163. } else {
  6164. return body
  6165. }
  6166. }
  6167. function nop () {}
  6168. function isStream (obj) {
  6169. return obj && typeof obj === 'object' && typeof obj.pipe === 'function' && typeof obj.on === 'function'
  6170. }
  6171. // based on https://github.com/node-fetch/fetch-blob/blob/8ab587d34080de94140b54f07168451e7d0b655e/index.js#L229-L241 (MIT License)
  6172. function isBlobLike (object) {
  6173. if (object === null) {
  6174. return false
  6175. } else if (object instanceof Blob) {
  6176. return true
  6177. } else if (typeof object !== 'object') {
  6178. return false
  6179. } else {
  6180. const sTag = object[Symbol.toStringTag]
  6181. return (sTag === 'Blob' || sTag === 'File') && (
  6182. ('stream' in object && typeof object.stream === 'function') ||
  6183. ('arrayBuffer' in object && typeof object.arrayBuffer === 'function')
  6184. )
  6185. }
  6186. }
  6187. function buildURL (url, queryParams) {
  6188. if (url.includes('?') || url.includes('#')) {
  6189. throw new Error('Query params cannot be passed when url already contains "?" or "#".')
  6190. }
  6191. const stringified = stringify(queryParams)
  6192. if (stringified) {
  6193. url += '?' + stringified
  6194. }
  6195. return url
  6196. }
  6197. function isValidPort (port) {
  6198. const value = parseInt(port, 10)
  6199. return (
  6200. value === Number(port) &&
  6201. value >= 0 &&
  6202. value <= 65535
  6203. )
  6204. }
  6205. function isHttpOrHttpsPrefixed (value) {
  6206. return (
  6207. value != null &&
  6208. value[0] === 'h' &&
  6209. value[1] === 't' &&
  6210. value[2] === 't' &&
  6211. value[3] === 'p' &&
  6212. (
  6213. value[4] === ':' ||
  6214. (
  6215. value[4] === 's' &&
  6216. value[5] === ':'
  6217. )
  6218. )
  6219. )
  6220. }
  6221. function parseURL (url) {
  6222. if (typeof url === 'string') {
  6223. url = new URL(url)
  6224. if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
  6225. throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
  6226. }
  6227. return url
  6228. }
  6229. if (!url || typeof url !== 'object') {
  6230. throw new InvalidArgumentError('Invalid URL: The URL argument must be a non-null object.')
  6231. }
  6232. if (!(url instanceof URL)) {
  6233. if (url.port != null && url.port !== '' && isValidPort(url.port) === false) {
  6234. throw new InvalidArgumentError('Invalid URL: port must be a valid integer or a string representation of an integer.')
  6235. }
  6236. if (url.path != null && typeof url.path !== 'string') {
  6237. throw new InvalidArgumentError('Invalid URL path: the path must be a string or null/undefined.')
  6238. }
  6239. if (url.pathname != null && typeof url.pathname !== 'string') {
  6240. throw new InvalidArgumentError('Invalid URL pathname: the pathname must be a string or null/undefined.')
  6241. }
  6242. if (url.hostname != null && typeof url.hostname !== 'string') {
  6243. throw new InvalidArgumentError('Invalid URL hostname: the hostname must be a string or null/undefined.')
  6244. }
  6245. if (url.origin != null && typeof url.origin !== 'string') {
  6246. throw new InvalidArgumentError('Invalid URL origin: the origin must be a string or null/undefined.')
  6247. }
  6248. if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
  6249. throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
  6250. }
  6251. const port = url.port != null
  6252. ? url.port
  6253. : (url.protocol === 'https:' ? 443 : 80)
  6254. let origin = url.origin != null
  6255. ? url.origin
  6256. : `${url.protocol || ''}//${url.hostname || ''}:${port}`
  6257. let path = url.path != null
  6258. ? url.path
  6259. : `${url.pathname || ''}${url.search || ''}`
  6260. if (origin[origin.length - 1] === '/') {
  6261. origin = origin.slice(0, origin.length - 1)
  6262. }
  6263. if (path && path[0] !== '/') {
  6264. path = `/${path}`
  6265. }
  6266. // new URL(path, origin) is unsafe when `path` contains an absolute URL
  6267. // From https://developer.mozilla.org/en-US/docs/Web/API/URL/URL:
  6268. // If first parameter is a relative URL, second param is required, and will be used as the base URL.
  6269. // If first parameter is an absolute URL, a given second param will be ignored.
  6270. return new URL(`${origin}${path}`)
  6271. }
  6272. if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
  6273. throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
  6274. }
  6275. return url
  6276. }
  6277. function parseOrigin (url) {
  6278. url = parseURL(url)
  6279. if (url.pathname !== '/' || url.search || url.hash) {
  6280. throw new InvalidArgumentError('invalid url')
  6281. }
  6282. return url
  6283. }
  6284. function getHostname (host) {
  6285. if (host[0] === '[') {
  6286. const idx = host.indexOf(']')
  6287. assert(idx !== -1)
  6288. return host.substring(1, idx)
  6289. }
  6290. const idx = host.indexOf(':')
  6291. if (idx === -1) return host
  6292. return host.substring(0, idx)
  6293. }
  6294. // IP addresses are not valid server names per RFC6066
  6295. // > Currently, the only server names supported are DNS hostnames
  6296. function getServerName (host) {
  6297. if (!host) {
  6298. return null
  6299. }
  6300. assert(typeof host === 'string')
  6301. const servername = getHostname(host)
  6302. if (net.isIP(servername)) {
  6303. return ''
  6304. }
  6305. return servername
  6306. }
  6307. function deepClone (obj) {
  6308. return JSON.parse(JSON.stringify(obj))
  6309. }
  6310. function isAsyncIterable (obj) {
  6311. return !!(obj != null && typeof obj[Symbol.asyncIterator] === 'function')
  6312. }
  6313. function isIterable (obj) {
  6314. return !!(obj != null && (typeof obj[Symbol.iterator] === 'function' || typeof obj[Symbol.asyncIterator] === 'function'))
  6315. }
  6316. function bodyLength (body) {
  6317. if (body == null) {
  6318. return 0
  6319. } else if (isStream(body)) {
  6320. const state = body._readableState
  6321. return state && state.objectMode === false && state.ended === true && Number.isFinite(state.length)
  6322. ? state.length
  6323. : null
  6324. } else if (isBlobLike(body)) {
  6325. return body.size != null ? body.size : null
  6326. } else if (isBuffer(body)) {
  6327. return body.byteLength
  6328. }
  6329. return null
  6330. }
  6331. function isDestroyed (body) {
  6332. return body && !!(body.destroyed || body[kDestroyed] || (stream.isDestroyed?.(body)))
  6333. }
  6334. function destroy (stream, err) {
  6335. if (stream == null || !isStream(stream) || isDestroyed(stream)) {
  6336. return
  6337. }
  6338. if (typeof stream.destroy === 'function') {
  6339. if (Object.getPrototypeOf(stream).constructor === IncomingMessage) {
  6340. // See: https://github.com/nodejs/node/pull/38505/files
  6341. stream.socket = null
  6342. }
  6343. stream.destroy(err)
  6344. } else if (err) {
  6345. queueMicrotask(() => {
  6346. stream.emit('error', err)
  6347. })
  6348. }
  6349. if (stream.destroyed !== true) {
  6350. stream[kDestroyed] = true
  6351. }
  6352. }
  6353. const KEEPALIVE_TIMEOUT_EXPR = /timeout=(\d+)/
  6354. function parseKeepAliveTimeout (val) {
  6355. const m = val.toString().match(KEEPALIVE_TIMEOUT_EXPR)
  6356. return m ? parseInt(m[1], 10) * 1000 : null
  6357. }
  6358. /**
  6359. * Retrieves a header name and returns its lowercase value.
  6360. * @param {string | Buffer} value Header name
  6361. * @returns {string}
  6362. */
  6363. function headerNameToString (value) {
  6364. return typeof value === 'string'
  6365. ? headerNameLowerCasedRecord[value] ?? value.toLowerCase()
  6366. : tree.lookup(value) ?? value.toString('latin1').toLowerCase()
  6367. }
  6368. /**
  6369. * Receive the buffer as a string and return its lowercase value.
  6370. * @param {Buffer} value Header name
  6371. * @returns {string}
  6372. */
  6373. function bufferToLowerCasedHeaderName (value) {
  6374. return tree.lookup(value) ?? value.toString('latin1').toLowerCase()
  6375. }
  6376. /**
  6377. * @param {Record<string, string | string[]> | (Buffer | string | (Buffer | string)[])[]} headers
  6378. * @param {Record<string, string | string[]>} [obj]
  6379. * @returns {Record<string, string | string[]>}
  6380. */
  6381. function parseHeaders (headers, obj) {
  6382. if (obj === undefined) obj = {}
  6383. for (let i = 0; i < headers.length; i += 2) {
  6384. const key = headerNameToString(headers[i])
  6385. let val = obj[key]
  6386. if (val) {
  6387. if (typeof val === 'string') {
  6388. val = [val]
  6389. obj[key] = val
  6390. }
  6391. val.push(headers[i + 1].toString('utf8'))
  6392. } else {
  6393. const headersValue = headers[i + 1]
  6394. if (typeof headersValue === 'string') {
  6395. obj[key] = headersValue
  6396. } else {
  6397. obj[key] = Array.isArray(headersValue) ? headersValue.map(x => x.toString('utf8')) : headersValue.toString('utf8')
  6398. }
  6399. }
  6400. }
  6401. // See https://github.com/nodejs/node/pull/46528
  6402. if ('content-length' in obj && 'content-disposition' in obj) {
  6403. obj['content-disposition'] = Buffer.from(obj['content-disposition']).toString('latin1')
  6404. }
  6405. return obj
  6406. }
  6407. function parseRawHeaders (headers) {
  6408. const len = headers.length
  6409. const ret = new Array(len)
  6410. let hasContentLength = false
  6411. let contentDispositionIdx = -1
  6412. let key
  6413. let val
  6414. let kLen = 0
  6415. for (let n = 0; n < headers.length; n += 2) {
  6416. key = headers[n]
  6417. val = headers[n + 1]
  6418. typeof key !== 'string' && (key = key.toString())
  6419. typeof val !== 'string' && (val = val.toString('utf8'))
  6420. kLen = key.length
  6421. if (kLen === 14 && key[7] === '-' && (key === 'content-length' || key.toLowerCase() === 'content-length')) {
  6422. hasContentLength = true
  6423. } else if (kLen === 19 && key[7] === '-' && (key === 'content-disposition' || key.toLowerCase() === 'content-disposition')) {
  6424. contentDispositionIdx = n + 1
  6425. }
  6426. ret[n] = key
  6427. ret[n + 1] = val
  6428. }
  6429. // See https://github.com/nodejs/node/pull/46528
  6430. if (hasContentLength && contentDispositionIdx !== -1) {
  6431. ret[contentDispositionIdx] = Buffer.from(ret[contentDispositionIdx]).toString('latin1')
  6432. }
  6433. return ret
  6434. }
  6435. function isBuffer (buffer) {
  6436. // See, https://github.com/mcollina/undici/pull/319
  6437. return buffer instanceof Uint8Array || Buffer.isBuffer(buffer)
  6438. }
  6439. function validateHandler (handler, method, upgrade) {
  6440. if (!handler || typeof handler !== 'object') {
  6441. throw new InvalidArgumentError('handler must be an object')
  6442. }
  6443. if (typeof handler.onConnect !== 'function') {
  6444. throw new InvalidArgumentError('invalid onConnect method')
  6445. }
  6446. if (typeof handler.onError !== 'function') {
  6447. throw new InvalidArgumentError('invalid onError method')
  6448. }
  6449. if (typeof handler.onBodySent !== 'function' && handler.onBodySent !== undefined) {
  6450. throw new InvalidArgumentError('invalid onBodySent method')
  6451. }
  6452. if (upgrade || method === 'CONNECT') {
  6453. if (typeof handler.onUpgrade !== 'function') {
  6454. throw new InvalidArgumentError('invalid onUpgrade method')
  6455. }
  6456. } else {
  6457. if (typeof handler.onHeaders !== 'function') {
  6458. throw new InvalidArgumentError('invalid onHeaders method')
  6459. }
  6460. if (typeof handler.onData !== 'function') {
  6461. throw new InvalidArgumentError('invalid onData method')
  6462. }
  6463. if (typeof handler.onComplete !== 'function') {
  6464. throw new InvalidArgumentError('invalid onComplete method')
  6465. }
  6466. }
  6467. }
  6468. // A body is disturbed if it has been read from and it cannot
  6469. // be re-used without losing state or data.
  6470. function isDisturbed (body) {
  6471. // TODO (fix): Why is body[kBodyUsed] needed?
  6472. return !!(body && (stream.isDisturbed(body) || body[kBodyUsed]))
  6473. }
  6474. function isErrored (body) {
  6475. return !!(body && stream.isErrored(body))
  6476. }
  6477. function isReadable (body) {
  6478. return !!(body && stream.isReadable(body))
  6479. }
  6480. function getSocketInfo (socket) {
  6481. return {
  6482. localAddress: socket.localAddress,
  6483. localPort: socket.localPort,
  6484. remoteAddress: socket.remoteAddress,
  6485. remotePort: socket.remotePort,
  6486. remoteFamily: socket.remoteFamily,
  6487. timeout: socket.timeout,
  6488. bytesWritten: socket.bytesWritten,
  6489. bytesRead: socket.bytesRead
  6490. }
  6491. }
  6492. /** @type {globalThis['ReadableStream']} */
  6493. function ReadableStreamFrom (iterable) {
  6494. // We cannot use ReadableStream.from here because it does not return a byte stream.
  6495. let iterator
  6496. return new ReadableStream(
  6497. {
  6498. async start () {
  6499. iterator = iterable[Symbol.asyncIterator]()
  6500. },
  6501. async pull (controller) {
  6502. const { done, value } = await iterator.next()
  6503. if (done) {
  6504. queueMicrotask(() => {
  6505. controller.close()
  6506. controller.byobRequest?.respond(0)
  6507. })
  6508. } else {
  6509. const buf = Buffer.isBuffer(value) ? value : Buffer.from(value)
  6510. if (buf.byteLength) {
  6511. controller.enqueue(new Uint8Array(buf))
  6512. }
  6513. }
  6514. return controller.desiredSize > 0
  6515. },
  6516. async cancel (reason) {
  6517. await iterator.return()
  6518. },
  6519. type: 'bytes'
  6520. }
  6521. )
  6522. }
  6523. // The chunk should be a FormData instance and contains
  6524. // all the required methods.
  6525. function isFormDataLike (object) {
  6526. return (
  6527. object &&
  6528. typeof object === 'object' &&
  6529. typeof object.append === 'function' &&
  6530. typeof object.delete === 'function' &&
  6531. typeof object.get === 'function' &&
  6532. typeof object.getAll === 'function' &&
  6533. typeof object.has === 'function' &&
  6534. typeof object.set === 'function' &&
  6535. object[Symbol.toStringTag] === 'FormData'
  6536. )
  6537. }
  6538. function addAbortListener (signal, listener) {
  6539. if ('addEventListener' in signal) {
  6540. signal.addEventListener('abort', listener, { once: true })
  6541. return () => signal.removeEventListener('abort', listener)
  6542. }
  6543. signal.addListener('abort', listener)
  6544. return () => signal.removeListener('abort', listener)
  6545. }
  6546. const hasToWellFormed = typeof String.prototype.toWellFormed === 'function'
  6547. const hasIsWellFormed = typeof String.prototype.isWellFormed === 'function'
  6548. /**
  6549. * @param {string} val
  6550. */
  6551. function toUSVString (val) {
  6552. return hasToWellFormed ? `${val}`.toWellFormed() : nodeUtil.toUSVString(val)
  6553. }
  6554. /**
  6555. * @param {string} val
  6556. */
  6557. // TODO: move this to webidl
  6558. function isUSVString (val) {
  6559. return hasIsWellFormed ? `${val}`.isWellFormed() : toUSVString(val) === `${val}`
  6560. }
  6561. /**
  6562. * @see https://tools.ietf.org/html/rfc7230#section-3.2.6
  6563. * @param {number} c
  6564. */
  6565. function isTokenCharCode (c) {
  6566. switch (c) {
  6567. case 0x22:
  6568. case 0x28:
  6569. case 0x29:
  6570. case 0x2c:
  6571. case 0x2f:
  6572. case 0x3a:
  6573. case 0x3b:
  6574. case 0x3c:
  6575. case 0x3d:
  6576. case 0x3e:
  6577. case 0x3f:
  6578. case 0x40:
  6579. case 0x5b:
  6580. case 0x5c:
  6581. case 0x5d:
  6582. case 0x7b:
  6583. case 0x7d:
  6584. // DQUOTE and "(),/:;<=>?@[\]{}"
  6585. return false
  6586. default:
  6587. // VCHAR %x21-7E
  6588. return c >= 0x21 && c <= 0x7e
  6589. }
  6590. }
  6591. /**
  6592. * @param {string} characters
  6593. */
  6594. function isValidHTTPToken (characters) {
  6595. if (characters.length === 0) {
  6596. return false
  6597. }
  6598. for (let i = 0; i < characters.length; ++i) {
  6599. if (!isTokenCharCode(characters.charCodeAt(i))) {
  6600. return false
  6601. }
  6602. }
  6603. return true
  6604. }
  6605. // headerCharRegex have been lifted from
  6606. // https://github.com/nodejs/node/blob/main/lib/_http_common.js
  6607. /**
  6608. * Matches if val contains an invalid field-vchar
  6609. * field-value = *( field-content / obs-fold )
  6610. * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
  6611. * field-vchar = VCHAR / obs-text
  6612. */
  6613. const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/
  6614. /**
  6615. * @param {string} characters
  6616. */
  6617. function isValidHeaderValue (characters) {
  6618. return !headerCharRegex.test(characters)
  6619. }
  6620. // Parsed accordingly to RFC 9110
  6621. // https://www.rfc-editor.org/rfc/rfc9110#field.content-range
  6622. function parseRangeHeader (range) {
  6623. if (range == null || range === '') return { start: 0, end: null, size: null }
  6624. const m = range ? range.match(/^bytes (\d+)-(\d+)\/(\d+)?$/) : null
  6625. return m
  6626. ? {
  6627. start: parseInt(m[1]),
  6628. end: m[2] ? parseInt(m[2]) : null,
  6629. size: m[3] ? parseInt(m[3]) : null
  6630. }
  6631. : null
  6632. }
  6633. function addListener (obj, name, listener) {
  6634. const listeners = (obj[kListeners] ??= [])
  6635. listeners.push([name, listener])
  6636. obj.on(name, listener)
  6637. return obj
  6638. }
  6639. function removeAllListeners (obj) {
  6640. for (const [name, listener] of obj[kListeners] ?? []) {
  6641. obj.removeListener(name, listener)
  6642. }
  6643. obj[kListeners] = null
  6644. }
  6645. function errorRequest (client, request, err) {
  6646. try {
  6647. request.onError(err)
  6648. assert(request.aborted)
  6649. } catch (err) {
  6650. client.emit('error', err)
  6651. }
  6652. }
  6653. const kEnumerableProperty = Object.create(null)
  6654. kEnumerableProperty.enumerable = true
  6655. const normalizedMethodRecordsBase = {
  6656. delete: 'DELETE',
  6657. DELETE: 'DELETE',
  6658. get: 'GET',
  6659. GET: 'GET',
  6660. head: 'HEAD',
  6661. HEAD: 'HEAD',
  6662. options: 'OPTIONS',
  6663. OPTIONS: 'OPTIONS',
  6664. post: 'POST',
  6665. POST: 'POST',
  6666. put: 'PUT',
  6667. PUT: 'PUT'
  6668. }
  6669. const normalizedMethodRecords = {
  6670. ...normalizedMethodRecordsBase,
  6671. patch: 'patch',
  6672. PATCH: 'PATCH'
  6673. }
  6674. // Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
  6675. Object.setPrototypeOf(normalizedMethodRecordsBase, null)
  6676. Object.setPrototypeOf(normalizedMethodRecords, null)
  6677. module.exports = {
  6678. kEnumerableProperty,
  6679. nop,
  6680. isDisturbed,
  6681. isErrored,
  6682. isReadable,
  6683. toUSVString,
  6684. isUSVString,
  6685. isBlobLike,
  6686. parseOrigin,
  6687. parseURL,
  6688. getServerName,
  6689. isStream,
  6690. isIterable,
  6691. isAsyncIterable,
  6692. isDestroyed,
  6693. headerNameToString,
  6694. bufferToLowerCasedHeaderName,
  6695. addListener,
  6696. removeAllListeners,
  6697. errorRequest,
  6698. parseRawHeaders,
  6699. parseHeaders,
  6700. parseKeepAliveTimeout,
  6701. destroy,
  6702. bodyLength,
  6703. deepClone,
  6704. ReadableStreamFrom,
  6705. isBuffer,
  6706. validateHandler,
  6707. getSocketInfo,
  6708. isFormDataLike,
  6709. buildURL,
  6710. addAbortListener,
  6711. isValidHTTPToken,
  6712. isValidHeaderValue,
  6713. isTokenCharCode,
  6714. parseRangeHeader,
  6715. normalizedMethodRecordsBase,
  6716. normalizedMethodRecords,
  6717. isValidPort,
  6718. isHttpOrHttpsPrefixed,
  6719. nodeMajor,
  6720. nodeMinor,
  6721. safeHTTPMethods: ['GET', 'HEAD', 'OPTIONS', 'TRACE'],
  6722. wrapRequestBody
  6723. }
  6724. /***/ }),
  6725. /***/ 7405:
  6726. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  6727. const { InvalidArgumentError } = __nccwpck_require__(8707)
  6728. const { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(6443)
  6729. const DispatcherBase = __nccwpck_require__(1841)
  6730. const Pool = __nccwpck_require__(628)
  6731. const Client = __nccwpck_require__(3701)
  6732. const util = __nccwpck_require__(3440)
  6733. const createRedirectInterceptor = __nccwpck_require__(5092)
  6734. const kOnConnect = Symbol('onConnect')
  6735. const kOnDisconnect = Symbol('onDisconnect')
  6736. const kOnConnectionError = Symbol('onConnectionError')
  6737. const kMaxRedirections = Symbol('maxRedirections')
  6738. const kOnDrain = Symbol('onDrain')
  6739. const kFactory = Symbol('factory')
  6740. const kOptions = Symbol('options')
  6741. function defaultFactory (origin, opts) {
  6742. return opts && opts.connections === 1
  6743. ? new Client(origin, opts)
  6744. : new Pool(origin, opts)
  6745. }
  6746. class Agent extends DispatcherBase {
  6747. constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
  6748. if (typeof factory !== 'function') {
  6749. throw new InvalidArgumentError('factory must be a function.')
  6750. }
  6751. if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
  6752. throw new InvalidArgumentError('connect must be a function or an object')
  6753. }
  6754. if (!Number.isInteger(maxRedirections) || maxRedirections < 0) {
  6755. throw new InvalidArgumentError('maxRedirections must be a positive number')
  6756. }
  6757. super(options)
  6758. if (connect && typeof connect !== 'function') {
  6759. connect = { ...connect }
  6760. }
  6761. this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent)
  6762. ? options.interceptors.Agent
  6763. : [createRedirectInterceptor({ maxRedirections })]
  6764. this[kOptions] = { ...util.deepClone(options), connect }
  6765. this[kOptions].interceptors = options.interceptors
  6766. ? { ...options.interceptors }
  6767. : undefined
  6768. this[kMaxRedirections] = maxRedirections
  6769. this[kFactory] = factory
  6770. this[kClients] = new Map()
  6771. this[kOnDrain] = (origin, targets) => {
  6772. this.emit('drain', origin, [this, ...targets])
  6773. }
  6774. this[kOnConnect] = (origin, targets) => {
  6775. this.emit('connect', origin, [this, ...targets])
  6776. }
  6777. this[kOnDisconnect] = (origin, targets, err) => {
  6778. this.emit('disconnect', origin, [this, ...targets], err)
  6779. }
  6780. this[kOnConnectionError] = (origin, targets, err) => {
  6781. this.emit('connectionError', origin, [this, ...targets], err)
  6782. }
  6783. }
  6784. get [kRunning] () {
  6785. let ret = 0
  6786. for (const client of this[kClients].values()) {
  6787. ret += client[kRunning]
  6788. }
  6789. return ret
  6790. }
  6791. [kDispatch] (opts, handler) {
  6792. let key
  6793. if (opts.origin && (typeof opts.origin === 'string' || opts.origin instanceof URL)) {
  6794. key = String(opts.origin)
  6795. } else {
  6796. throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.')
  6797. }
  6798. let dispatcher = this[kClients].get(key)
  6799. if (!dispatcher) {
  6800. dispatcher = this[kFactory](opts.origin, this[kOptions])
  6801. .on('drain', this[kOnDrain])
  6802. .on('connect', this[kOnConnect])
  6803. .on('disconnect', this[kOnDisconnect])
  6804. .on('connectionError', this[kOnConnectionError])
  6805. // This introduces a tiny memory leak, as dispatchers are never removed from the map.
  6806. // TODO(mcollina): remove te timer when the client/pool do not have any more
  6807. // active connections.
  6808. this[kClients].set(key, dispatcher)
  6809. }
  6810. return dispatcher.dispatch(opts, handler)
  6811. }
  6812. async [kClose] () {
  6813. const closePromises = []
  6814. for (const client of this[kClients].values()) {
  6815. closePromises.push(client.close())
  6816. }
  6817. this[kClients].clear()
  6818. await Promise.all(closePromises)
  6819. }
  6820. async [kDestroy] (err) {
  6821. const destroyPromises = []
  6822. for (const client of this[kClients].values()) {
  6823. destroyPromises.push(client.destroy(err))
  6824. }
  6825. this[kClients].clear()
  6826. await Promise.all(destroyPromises)
  6827. }
  6828. }
  6829. module.exports = Agent
  6830. /***/ }),
  6831. /***/ 837:
  6832. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  6833. const {
  6834. BalancedPoolMissingUpstreamError,
  6835. InvalidArgumentError
  6836. } = __nccwpck_require__(8707)
  6837. const {
  6838. PoolBase,
  6839. kClients,
  6840. kNeedDrain,
  6841. kAddClient,
  6842. kRemoveClient,
  6843. kGetDispatcher
  6844. } = __nccwpck_require__(2128)
  6845. const Pool = __nccwpck_require__(628)
  6846. const { kUrl, kInterceptors } = __nccwpck_require__(6443)
  6847. const { parseOrigin } = __nccwpck_require__(3440)
  6848. const kFactory = Symbol('factory')
  6849. const kOptions = Symbol('options')
  6850. const kGreatestCommonDivisor = Symbol('kGreatestCommonDivisor')
  6851. const kCurrentWeight = Symbol('kCurrentWeight')
  6852. const kIndex = Symbol('kIndex')
  6853. const kWeight = Symbol('kWeight')
  6854. const kMaxWeightPerServer = Symbol('kMaxWeightPerServer')
  6855. const kErrorPenalty = Symbol('kErrorPenalty')
  6856. /**
  6857. * Calculate the greatest common divisor of two numbers by
  6858. * using the Euclidean algorithm.
  6859. *
  6860. * @param {number} a
  6861. * @param {number} b
  6862. * @returns {number}
  6863. */
  6864. function getGreatestCommonDivisor (a, b) {
  6865. if (a === 0) return b
  6866. while (b !== 0) {
  6867. const t = b
  6868. b = a % b
  6869. a = t
  6870. }
  6871. return a
  6872. }
  6873. function defaultFactory (origin, opts) {
  6874. return new Pool(origin, opts)
  6875. }
  6876. class BalancedPool extends PoolBase {
  6877. constructor (upstreams = [], { factory = defaultFactory, ...opts } = {}) {
  6878. super()
  6879. this[kOptions] = opts
  6880. this[kIndex] = -1
  6881. this[kCurrentWeight] = 0
  6882. this[kMaxWeightPerServer] = this[kOptions].maxWeightPerServer || 100
  6883. this[kErrorPenalty] = this[kOptions].errorPenalty || 15
  6884. if (!Array.isArray(upstreams)) {
  6885. upstreams = [upstreams]
  6886. }
  6887. if (typeof factory !== 'function') {
  6888. throw new InvalidArgumentError('factory must be a function.')
  6889. }
  6890. this[kInterceptors] = opts.interceptors?.BalancedPool && Array.isArray(opts.interceptors.BalancedPool)
  6891. ? opts.interceptors.BalancedPool
  6892. : []
  6893. this[kFactory] = factory
  6894. for (const upstream of upstreams) {
  6895. this.addUpstream(upstream)
  6896. }
  6897. this._updateBalancedPoolStats()
  6898. }
  6899. addUpstream (upstream) {
  6900. const upstreamOrigin = parseOrigin(upstream).origin
  6901. if (this[kClients].find((pool) => (
  6902. pool[kUrl].origin === upstreamOrigin &&
  6903. pool.closed !== true &&
  6904. pool.destroyed !== true
  6905. ))) {
  6906. return this
  6907. }
  6908. const pool = this[kFactory](upstreamOrigin, Object.assign({}, this[kOptions]))
  6909. this[kAddClient](pool)
  6910. pool.on('connect', () => {
  6911. pool[kWeight] = Math.min(this[kMaxWeightPerServer], pool[kWeight] + this[kErrorPenalty])
  6912. })
  6913. pool.on('connectionError', () => {
  6914. pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty])
  6915. this._updateBalancedPoolStats()
  6916. })
  6917. pool.on('disconnect', (...args) => {
  6918. const err = args[2]
  6919. if (err && err.code === 'UND_ERR_SOCKET') {
  6920. // decrease the weight of the pool.
  6921. pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty])
  6922. this._updateBalancedPoolStats()
  6923. }
  6924. })
  6925. for (const client of this[kClients]) {
  6926. client[kWeight] = this[kMaxWeightPerServer]
  6927. }
  6928. this._updateBalancedPoolStats()
  6929. return this
  6930. }
  6931. _updateBalancedPoolStats () {
  6932. let result = 0
  6933. for (let i = 0; i < this[kClients].length; i++) {
  6934. result = getGreatestCommonDivisor(this[kClients][i][kWeight], result)
  6935. }
  6936. this[kGreatestCommonDivisor] = result
  6937. }
  6938. removeUpstream (upstream) {
  6939. const upstreamOrigin = parseOrigin(upstream).origin
  6940. const pool = this[kClients].find((pool) => (
  6941. pool[kUrl].origin === upstreamOrigin &&
  6942. pool.closed !== true &&
  6943. pool.destroyed !== true
  6944. ))
  6945. if (pool) {
  6946. this[kRemoveClient](pool)
  6947. }
  6948. return this
  6949. }
  6950. get upstreams () {
  6951. return this[kClients]
  6952. .filter(dispatcher => dispatcher.closed !== true && dispatcher.destroyed !== true)
  6953. .map((p) => p[kUrl].origin)
  6954. }
  6955. [kGetDispatcher] () {
  6956. // We validate that pools is greater than 0,
  6957. // otherwise we would have to wait until an upstream
  6958. // is added, which might never happen.
  6959. if (this[kClients].length === 0) {
  6960. throw new BalancedPoolMissingUpstreamError()
  6961. }
  6962. const dispatcher = this[kClients].find(dispatcher => (
  6963. !dispatcher[kNeedDrain] &&
  6964. dispatcher.closed !== true &&
  6965. dispatcher.destroyed !== true
  6966. ))
  6967. if (!dispatcher) {
  6968. return
  6969. }
  6970. const allClientsBusy = this[kClients].map(pool => pool[kNeedDrain]).reduce((a, b) => a && b, true)
  6971. if (allClientsBusy) {
  6972. return
  6973. }
  6974. let counter = 0
  6975. let maxWeightIndex = this[kClients].findIndex(pool => !pool[kNeedDrain])
  6976. while (counter++ < this[kClients].length) {
  6977. this[kIndex] = (this[kIndex] + 1) % this[kClients].length
  6978. const pool = this[kClients][this[kIndex]]
  6979. // find pool index with the largest weight
  6980. if (pool[kWeight] > this[kClients][maxWeightIndex][kWeight] && !pool[kNeedDrain]) {
  6981. maxWeightIndex = this[kIndex]
  6982. }
  6983. // decrease the current weight every `this[kClients].length`.
  6984. if (this[kIndex] === 0) {
  6985. // Set the current weight to the next lower weight.
  6986. this[kCurrentWeight] = this[kCurrentWeight] - this[kGreatestCommonDivisor]
  6987. if (this[kCurrentWeight] <= 0) {
  6988. this[kCurrentWeight] = this[kMaxWeightPerServer]
  6989. }
  6990. }
  6991. if (pool[kWeight] >= this[kCurrentWeight] && (!pool[kNeedDrain])) {
  6992. return pool
  6993. }
  6994. }
  6995. this[kCurrentWeight] = this[kClients][maxWeightIndex][kWeight]
  6996. this[kIndex] = maxWeightIndex
  6997. return this[kClients][maxWeightIndex]
  6998. }
  6999. }
  7000. module.exports = BalancedPool
  7001. /***/ }),
  7002. /***/ 637:
  7003. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  7004. /* global WebAssembly */
  7005. const assert = __nccwpck_require__(4589)
  7006. const util = __nccwpck_require__(3440)
  7007. const { channels } = __nccwpck_require__(2414)
  7008. const timers = __nccwpck_require__(6603)
  7009. const {
  7010. RequestContentLengthMismatchError,
  7011. ResponseContentLengthMismatchError,
  7012. RequestAbortedError,
  7013. InvalidArgumentError,
  7014. HeadersTimeoutError,
  7015. HeadersOverflowError,
  7016. SocketError,
  7017. InformationalError,
  7018. BodyTimeoutError,
  7019. HTTPParserError,
  7020. ResponseExceededMaxSizeError
  7021. } = __nccwpck_require__(8707)
  7022. const {
  7023. kUrl,
  7024. kReset,
  7025. kClient,
  7026. kParser,
  7027. kBlocking,
  7028. kRunning,
  7029. kPending,
  7030. kSize,
  7031. kWriting,
  7032. kQueue,
  7033. kNoRef,
  7034. kKeepAliveDefaultTimeout,
  7035. kHostHeader,
  7036. kPendingIdx,
  7037. kRunningIdx,
  7038. kError,
  7039. kPipelining,
  7040. kSocket,
  7041. kKeepAliveTimeoutValue,
  7042. kMaxHeadersSize,
  7043. kKeepAliveMaxTimeout,
  7044. kKeepAliveTimeoutThreshold,
  7045. kHeadersTimeout,
  7046. kBodyTimeout,
  7047. kStrictContentLength,
  7048. kMaxRequests,
  7049. kCounter,
  7050. kMaxResponseSize,
  7051. kOnError,
  7052. kResume,
  7053. kHTTPContext
  7054. } = __nccwpck_require__(6443)
  7055. const constants = __nccwpck_require__(2824)
  7056. const EMPTY_BUF = Buffer.alloc(0)
  7057. const FastBuffer = Buffer[Symbol.species]
  7058. const addListener = util.addListener
  7059. const removeAllListeners = util.removeAllListeners
  7060. const kIdleSocketValidation = Symbol('kIdleSocketValidation')
  7061. const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout')
  7062. const kSocketUsed = Symbol('kSocketUsed')
  7063. let extractBody
  7064. async function lazyllhttp () {
  7065. const llhttpWasmData = process.env.JEST_WORKER_ID ? __nccwpck_require__(3870) : undefined
  7066. let mod
  7067. try {
  7068. mod = await WebAssembly.compile(__nccwpck_require__(3434))
  7069. } catch (e) {
  7070. /* istanbul ignore next */
  7071. // We could check if the error was caused by the simd option not
  7072. // being enabled, but the occurring of this other error
  7073. // * https://github.com/emscripten-core/emscripten/issues/11495
  7074. // got me to remove that check to avoid breaking Node 12.
  7075. mod = await WebAssembly.compile(llhttpWasmData || __nccwpck_require__(3870))
  7076. }
  7077. return await WebAssembly.instantiate(mod, {
  7078. env: {
  7079. /* eslint-disable camelcase */
  7080. wasm_on_url: (p, at, len) => {
  7081. /* istanbul ignore next */
  7082. return 0
  7083. },
  7084. wasm_on_status: (p, at, len) => {
  7085. assert(currentParser.ptr === p)
  7086. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  7087. return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  7088. },
  7089. wasm_on_message_begin: (p) => {
  7090. assert(currentParser.ptr === p)
  7091. return currentParser.onMessageBegin() || 0
  7092. },
  7093. wasm_on_header_field: (p, at, len) => {
  7094. assert(currentParser.ptr === p)
  7095. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  7096. return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  7097. },
  7098. wasm_on_header_value: (p, at, len) => {
  7099. assert(currentParser.ptr === p)
  7100. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  7101. return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  7102. },
  7103. wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => {
  7104. assert(currentParser.ptr === p)
  7105. return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0
  7106. },
  7107. wasm_on_body: (p, at, len) => {
  7108. assert(currentParser.ptr === p)
  7109. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  7110. return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  7111. },
  7112. wasm_on_message_complete: (p) => {
  7113. assert(currentParser.ptr === p)
  7114. return currentParser.onMessageComplete() || 0
  7115. }
  7116. /* eslint-enable camelcase */
  7117. }
  7118. })
  7119. }
  7120. let llhttpInstance = null
  7121. let llhttpPromise = lazyllhttp()
  7122. llhttpPromise.catch()
  7123. let currentParser = null
  7124. let currentBufferRef = null
  7125. let currentBufferSize = 0
  7126. let currentBufferPtr = null
  7127. const USE_NATIVE_TIMER = 0
  7128. const USE_FAST_TIMER = 1
  7129. // Use fast timers for headers and body to take eventual event loop
  7130. // latency into account.
  7131. const TIMEOUT_HEADERS = 2 | USE_FAST_TIMER
  7132. const TIMEOUT_BODY = 4 | USE_FAST_TIMER
  7133. // Use native timers to ignore event loop latency for keep-alive
  7134. // handling.
  7135. const TIMEOUT_KEEP_ALIVE = 8 | USE_NATIVE_TIMER
  7136. class Parser {
  7137. constructor (client, socket, { exports }) {
  7138. assert(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0)
  7139. this.llhttp = exports
  7140. this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE)
  7141. this.client = client
  7142. this.socket = socket
  7143. this.timeout = null
  7144. this.timeoutValue = null
  7145. this.timeoutType = null
  7146. this.statusCode = null
  7147. this.statusText = ''
  7148. this.upgrade = false
  7149. this.headers = []
  7150. this.headersSize = 0
  7151. this.headersMaxSize = client[kMaxHeadersSize]
  7152. this.shouldKeepAlive = false
  7153. this.paused = false
  7154. this.resume = this.resume.bind(this)
  7155. this.bytesRead = 0
  7156. this.keepAlive = ''
  7157. this.contentLength = ''
  7158. this.connection = ''
  7159. this.maxResponseSize = client[kMaxResponseSize]
  7160. }
  7161. setTimeout (delay, type) {
  7162. // If the existing timer and the new timer are of different timer type
  7163. // (fast or native) or have different delay, we need to clear the existing
  7164. // timer and set a new one.
  7165. if (
  7166. delay !== this.timeoutValue ||
  7167. (type & USE_FAST_TIMER) ^ (this.timeoutType & USE_FAST_TIMER)
  7168. ) {
  7169. // If a timeout is already set, clear it with clearTimeout of the fast
  7170. // timer implementation, as it can clear fast and native timers.
  7171. if (this.timeout) {
  7172. timers.clearTimeout(this.timeout)
  7173. this.timeout = null
  7174. }
  7175. if (delay) {
  7176. if (type & USE_FAST_TIMER) {
  7177. this.timeout = timers.setFastTimeout(onParserTimeout, delay, new WeakRef(this))
  7178. } else {
  7179. this.timeout = setTimeout(onParserTimeout, delay, new WeakRef(this))
  7180. this.timeout.unref()
  7181. }
  7182. }
  7183. this.timeoutValue = delay
  7184. } else if (this.timeout) {
  7185. // istanbul ignore else: only for jest
  7186. if (this.timeout.refresh) {
  7187. this.timeout.refresh()
  7188. }
  7189. }
  7190. this.timeoutType = type
  7191. }
  7192. resume () {
  7193. if (this.socket.destroyed || !this.paused) {
  7194. return
  7195. }
  7196. assert(this.ptr != null)
  7197. assert(currentParser == null)
  7198. this.llhttp.llhttp_resume(this.ptr)
  7199. assert(this.timeoutType === TIMEOUT_BODY)
  7200. if (this.timeout) {
  7201. // istanbul ignore else: only for jest
  7202. if (this.timeout.refresh) {
  7203. this.timeout.refresh()
  7204. }
  7205. }
  7206. this.paused = false
  7207. this.execute(this.socket.read() || EMPTY_BUF) // Flush parser.
  7208. this.readMore()
  7209. }
  7210. readMore () {
  7211. while (!this.paused && this.ptr) {
  7212. const chunk = this.socket.read()
  7213. if (chunk === null) {
  7214. break
  7215. }
  7216. this.execute(chunk)
  7217. }
  7218. }
  7219. execute (data) {
  7220. assert(this.ptr != null)
  7221. assert(currentParser == null)
  7222. assert(!this.paused)
  7223. const { socket, llhttp } = this
  7224. if (data.length > currentBufferSize) {
  7225. if (currentBufferPtr) {
  7226. llhttp.free(currentBufferPtr)
  7227. }
  7228. currentBufferSize = Math.ceil(data.length / 4096) * 4096
  7229. currentBufferPtr = llhttp.malloc(currentBufferSize)
  7230. }
  7231. new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(data)
  7232. // Call `execute` on the wasm parser.
  7233. // We pass the `llhttp_parser` pointer address, the pointer address of buffer view data,
  7234. // and finally the length of bytes to parse.
  7235. // The return value is an error code or `constants.ERROR.OK`.
  7236. try {
  7237. let ret
  7238. try {
  7239. currentBufferRef = data
  7240. currentParser = this
  7241. ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, data.length)
  7242. /* eslint-disable-next-line no-useless-catch */
  7243. } catch (err) {
  7244. /* istanbul ignore next: difficult to make a test case for */
  7245. throw err
  7246. } finally {
  7247. currentParser = null
  7248. currentBufferRef = null
  7249. }
  7250. const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr
  7251. if (ret !== constants.ERROR.OK) {
  7252. const body = data.subarray(offset)
  7253. if (ret === constants.ERROR.PAUSED_UPGRADE) {
  7254. this.onUpgrade(body)
  7255. } else if (ret === constants.ERROR.PAUSED) {
  7256. this.paused = true
  7257. socket.unshift(body)
  7258. } else {
  7259. throw this.createError(ret, body)
  7260. }
  7261. }
  7262. } catch (err) {
  7263. util.destroy(socket, err)
  7264. }
  7265. }
  7266. finish () {
  7267. assert(currentParser === null)
  7268. assert(this.ptr != null)
  7269. assert(!this.paused)
  7270. const { llhttp } = this
  7271. let ret
  7272. try {
  7273. currentParser = this
  7274. ret = llhttp.llhttp_finish(this.ptr)
  7275. } finally {
  7276. currentParser = null
  7277. }
  7278. if (ret === constants.ERROR.OK) {
  7279. return null
  7280. }
  7281. if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) {
  7282. this.paused = true
  7283. return null
  7284. }
  7285. return this.createError(ret, EMPTY_BUF)
  7286. }
  7287. createError (ret, data) {
  7288. const { llhttp, contentLength, bytesRead } = this
  7289. if (contentLength && bytesRead !== parseInt(contentLength, 10)) {
  7290. return new ResponseContentLengthMismatchError()
  7291. }
  7292. const ptr = llhttp.llhttp_get_error_reason(this.ptr)
  7293. let message = ''
  7294. if (ptr) {
  7295. const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
  7296. message =
  7297. 'Response does not match the HTTP/1.1 protocol (' +
  7298. Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
  7299. ')'
  7300. }
  7301. return new HTTPParserError(message, constants.ERROR[ret], data)
  7302. }
  7303. destroy () {
  7304. assert(this.ptr != null)
  7305. assert(currentParser == null)
  7306. this.llhttp.llhttp_free(this.ptr)
  7307. this.ptr = null
  7308. this.timeout && timers.clearTimeout(this.timeout)
  7309. this.timeout = null
  7310. this.timeoutValue = null
  7311. this.timeoutType = null
  7312. this.paused = false
  7313. }
  7314. onStatus (buf) {
  7315. this.statusText = buf.toString()
  7316. }
  7317. onMessageBegin () {
  7318. const { socket, client } = this
  7319. /* istanbul ignore next: difficult to make a test case for */
  7320. if (socket.destroyed) {
  7321. return -1
  7322. }
  7323. if (client[kRunning] === 0) {
  7324. util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
  7325. return -1
  7326. }
  7327. const request = client[kQueue][client[kRunningIdx]]
  7328. if (!request) {
  7329. return -1
  7330. }
  7331. request.onResponseStarted()
  7332. }
  7333. onHeaderField (buf) {
  7334. const len = this.headers.length
  7335. if ((len & 1) === 0) {
  7336. this.headers.push(buf)
  7337. } else {
  7338. this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf])
  7339. }
  7340. this.trackHeader(buf.length)
  7341. }
  7342. onHeaderValue (buf) {
  7343. let len = this.headers.length
  7344. if ((len & 1) === 1) {
  7345. this.headers.push(buf)
  7346. len += 1
  7347. } else {
  7348. this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf])
  7349. }
  7350. const key = this.headers[len - 2]
  7351. if (key.length === 10) {
  7352. const headerName = util.bufferToLowerCasedHeaderName(key)
  7353. if (headerName === 'keep-alive') {
  7354. this.keepAlive += buf.toString()
  7355. } else if (headerName === 'connection') {
  7356. this.connection += buf.toString()
  7357. }
  7358. } else if (key.length === 14 && util.bufferToLowerCasedHeaderName(key) === 'content-length') {
  7359. this.contentLength += buf.toString()
  7360. }
  7361. this.trackHeader(buf.length)
  7362. }
  7363. trackHeader (len) {
  7364. this.headersSize += len
  7365. if (this.headersSize >= this.headersMaxSize) {
  7366. util.destroy(this.socket, new HeadersOverflowError())
  7367. }
  7368. }
  7369. onUpgrade (head) {
  7370. const { upgrade, client, socket, headers, statusCode, statusText } = this
  7371. assert(upgrade)
  7372. assert(client[kSocket] === socket)
  7373. assert(!socket.destroyed)
  7374. assert(!this.paused)
  7375. assert((headers.length & 1) === 0)
  7376. const request = client[kQueue][client[kRunningIdx]]
  7377. assert(request)
  7378. assert(request.upgrade || request.method === 'CONNECT')
  7379. this.statusCode = null
  7380. this.statusText = ''
  7381. this.shouldKeepAlive = null
  7382. this.headers = []
  7383. this.headersSize = 0
  7384. socket.unshift(head)
  7385. socket[kParser].destroy()
  7386. socket[kParser] = null
  7387. socket[kClient] = null
  7388. socket[kError] = null
  7389. removeAllListeners(socket)
  7390. client[kSocket] = null
  7391. client[kHTTPContext] = null // TODO (fix): This is hacky...
  7392. client[kQueue][client[kRunningIdx]++] = null
  7393. client.emit('disconnect', client[kUrl], [client], new InformationalError('upgrade'))
  7394. try {
  7395. request.onUpgrade(statusCode, headers, socket, statusText)
  7396. } catch (error) {
  7397. util.errorRequest(client, request, error)
  7398. util.destroy(socket, error)
  7399. }
  7400. client[kResume]()
  7401. }
  7402. onHeadersComplete (statusCode, upgrade, shouldKeepAlive) {
  7403. const { client, socket, headers, statusText } = this
  7404. /* istanbul ignore next: difficult to make a test case for */
  7405. if (socket.destroyed) {
  7406. return -1
  7407. }
  7408. if (client[kRunning] === 0) {
  7409. util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
  7410. return -1
  7411. }
  7412. const request = client[kQueue][client[kRunningIdx]]
  7413. /* istanbul ignore next: difficult to make a test case for */
  7414. if (!request) {
  7415. return -1
  7416. }
  7417. assert(!this.upgrade)
  7418. assert(this.statusCode < 200)
  7419. if (statusCode === 100) {
  7420. util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
  7421. return -1
  7422. }
  7423. /* this can only happen if server is misbehaving */
  7424. if (upgrade && !request.upgrade) {
  7425. util.destroy(socket, new SocketError('bad upgrade', util.getSocketInfo(socket)))
  7426. return -1
  7427. }
  7428. assert(this.timeoutType === TIMEOUT_HEADERS)
  7429. this.statusCode = statusCode
  7430. this.shouldKeepAlive = (
  7431. shouldKeepAlive ||
  7432. // Override llhttp value which does not allow keepAlive for HEAD.
  7433. (request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive')
  7434. )
  7435. if (this.statusCode >= 200) {
  7436. const bodyTimeout = request.bodyTimeout != null
  7437. ? request.bodyTimeout
  7438. : client[kBodyTimeout]
  7439. this.setTimeout(bodyTimeout, TIMEOUT_BODY)
  7440. } else if (this.timeout) {
  7441. // istanbul ignore else: only for jest
  7442. if (this.timeout.refresh) {
  7443. this.timeout.refresh()
  7444. }
  7445. }
  7446. if (request.method === 'CONNECT') {
  7447. assert(client[kRunning] === 1)
  7448. this.upgrade = true
  7449. return 2
  7450. }
  7451. if (upgrade) {
  7452. assert(client[kRunning] === 1)
  7453. this.upgrade = true
  7454. return 2
  7455. }
  7456. assert((this.headers.length & 1) === 0)
  7457. this.headers = []
  7458. this.headersSize = 0
  7459. if (this.shouldKeepAlive && client[kPipelining]) {
  7460. const keepAliveTimeout = this.keepAlive ? util.parseKeepAliveTimeout(this.keepAlive) : null
  7461. if (keepAliveTimeout != null) {
  7462. const timeout = Math.min(
  7463. keepAliveTimeout - client[kKeepAliveTimeoutThreshold],
  7464. client[kKeepAliveMaxTimeout]
  7465. )
  7466. if (timeout <= 0) {
  7467. socket[kReset] = true
  7468. } else {
  7469. client[kKeepAliveTimeoutValue] = timeout
  7470. }
  7471. } else {
  7472. client[kKeepAliveTimeoutValue] = client[kKeepAliveDefaultTimeout]
  7473. }
  7474. } else {
  7475. // Stop more requests from being dispatched.
  7476. socket[kReset] = true
  7477. }
  7478. const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false
  7479. if (request.aborted) {
  7480. return -1
  7481. }
  7482. if (request.method === 'HEAD') {
  7483. return 1
  7484. }
  7485. if (statusCode < 200) {
  7486. return 1
  7487. }
  7488. if (socket[kBlocking]) {
  7489. socket[kBlocking] = false
  7490. client[kResume]()
  7491. }
  7492. return pause ? constants.ERROR.PAUSED : 0
  7493. }
  7494. onBody (buf) {
  7495. const { client, socket, statusCode, maxResponseSize } = this
  7496. if (socket.destroyed) {
  7497. return -1
  7498. }
  7499. const request = client[kQueue][client[kRunningIdx]]
  7500. assert(request)
  7501. assert(this.timeoutType === TIMEOUT_BODY)
  7502. if (this.timeout) {
  7503. // istanbul ignore else: only for jest
  7504. if (this.timeout.refresh) {
  7505. this.timeout.refresh()
  7506. }
  7507. }
  7508. assert(statusCode >= 200)
  7509. if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) {
  7510. util.destroy(socket, new ResponseExceededMaxSizeError())
  7511. return -1
  7512. }
  7513. this.bytesRead += buf.length
  7514. if (request.onData(buf) === false) {
  7515. return constants.ERROR.PAUSED
  7516. }
  7517. }
  7518. onMessageComplete () {
  7519. const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this
  7520. if (socket.destroyed && (!statusCode || shouldKeepAlive)) {
  7521. return -1
  7522. }
  7523. if (upgrade) {
  7524. return
  7525. }
  7526. assert(statusCode >= 100)
  7527. assert((this.headers.length & 1) === 0)
  7528. const request = client[kQueue][client[kRunningIdx]]
  7529. assert(request)
  7530. this.statusCode = null
  7531. this.statusText = ''
  7532. this.bytesRead = 0
  7533. this.contentLength = ''
  7534. this.keepAlive = ''
  7535. this.connection = ''
  7536. this.headers = []
  7537. this.headersSize = 0
  7538. if (statusCode < 200) {
  7539. return
  7540. }
  7541. /* istanbul ignore next: should be handled by llhttp? */
  7542. if (request.method !== 'HEAD' && contentLength && bytesRead !== parseInt(contentLength, 10)) {
  7543. util.destroy(socket, new ResponseContentLengthMismatchError())
  7544. return -1
  7545. }
  7546. request.onComplete(headers)
  7547. client[kQueue][client[kRunningIdx]++] = null
  7548. socket[kSocketUsed] = true
  7549. if (socket[kWriting]) {
  7550. assert(client[kRunning] === 0)
  7551. // Response completed before request.
  7552. util.destroy(socket, new InformationalError('reset'))
  7553. return constants.ERROR.PAUSED
  7554. } else if (!shouldKeepAlive) {
  7555. util.destroy(socket, new InformationalError('reset'))
  7556. return constants.ERROR.PAUSED
  7557. } else if (socket[kReset] && client[kRunning] === 0) {
  7558. // Destroy socket once all requests have completed.
  7559. // The request at the tail of the pipeline is the one
  7560. // that requested reset and no further requests should
  7561. // have been queued since then.
  7562. util.destroy(socket, new InformationalError('reset'))
  7563. return constants.ERROR.PAUSED
  7564. } else if (client[kPipelining] == null || client[kPipelining] === 1) {
  7565. // We must wait a full event loop cycle to reuse this socket to make sure
  7566. // that non-spec compliant servers are not closing the connection even if they
  7567. // said they won't.
  7568. setImmediate(() => client[kResume]())
  7569. } else {
  7570. client[kResume]()
  7571. }
  7572. }
  7573. }
  7574. function onParserTimeout (parser) {
  7575. const { socket, timeoutType, client, paused } = parser.deref()
  7576. /* istanbul ignore else */
  7577. if (timeoutType === TIMEOUT_HEADERS) {
  7578. if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) {
  7579. assert(!paused, 'cannot be paused while waiting for headers')
  7580. util.destroy(socket, new HeadersTimeoutError())
  7581. }
  7582. } else if (timeoutType === TIMEOUT_BODY) {
  7583. if (!paused) {
  7584. util.destroy(socket, new BodyTimeoutError())
  7585. }
  7586. } else if (timeoutType === TIMEOUT_KEEP_ALIVE) {
  7587. assert(client[kRunning] === 0 && client[kKeepAliveTimeoutValue])
  7588. util.destroy(socket, new InformationalError('socket idle timeout'))
  7589. }
  7590. }
  7591. async function connectH1 (client, socket) {
  7592. client[kSocket] = socket
  7593. if (!llhttpInstance) {
  7594. llhttpInstance = await llhttpPromise
  7595. llhttpPromise = null
  7596. }
  7597. socket[kNoRef] = false
  7598. socket[kWriting] = false
  7599. socket[kReset] = false
  7600. socket[kBlocking] = false
  7601. socket[kIdleSocketValidation] = 0
  7602. socket[kIdleSocketValidationTimeout] = null
  7603. socket[kSocketUsed] = false
  7604. socket[kParser] = new Parser(client, socket, llhttpInstance)
  7605. addListener(socket, 'error', function (err) {
  7606. assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
  7607. const parser = this[kParser]
  7608. // On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
  7609. // to the user.
  7610. if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
  7611. const parserErr = parser.finish()
  7612. if (parserErr) {
  7613. this[kError] = parserErr
  7614. this[kClient][kOnError](parserErr)
  7615. }
  7616. return
  7617. }
  7618. this[kError] = err
  7619. this[kClient][kOnError](err)
  7620. })
  7621. addListener(socket, 'readable', function () {
  7622. const parser = this[kParser]
  7623. if (parser) {
  7624. parser.readMore()
  7625. }
  7626. })
  7627. addListener(socket, 'end', function () {
  7628. const parser = this[kParser]
  7629. if (parser.statusCode && !parser.shouldKeepAlive) {
  7630. const parserErr = parser.finish()
  7631. if (parserErr) {
  7632. util.destroy(this, parserErr)
  7633. }
  7634. return
  7635. }
  7636. util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this)))
  7637. })
  7638. addListener(socket, 'close', function () {
  7639. const client = this[kClient]
  7640. const parser = this[kParser]
  7641. clearIdleSocketValidation(this)
  7642. if (parser) {
  7643. if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
  7644. this[kError] = parser.finish() || this[kError]
  7645. }
  7646. this[kParser].destroy()
  7647. this[kParser] = null
  7648. }
  7649. const err = this[kError] || new SocketError('closed', util.getSocketInfo(this))
  7650. client[kSocket] = null
  7651. client[kHTTPContext] = null // TODO (fix): This is hacky...
  7652. if (client.destroyed) {
  7653. assert(client[kPending] === 0)
  7654. // Fail entire queue.
  7655. const requests = client[kQueue].splice(client[kRunningIdx])
  7656. for (let i = 0; i < requests.length; i++) {
  7657. const request = requests[i]
  7658. util.errorRequest(client, request, err)
  7659. }
  7660. } else if (client[kRunning] > 0 && err.code !== 'UND_ERR_INFO') {
  7661. // Fail head of pipeline.
  7662. const request = client[kQueue][client[kRunningIdx]]
  7663. client[kQueue][client[kRunningIdx]++] = null
  7664. util.errorRequest(client, request, err)
  7665. }
  7666. client[kPendingIdx] = client[kRunningIdx]
  7667. assert(client[kRunning] === 0)
  7668. client.emit('disconnect', client[kUrl], [client], err)
  7669. client[kResume]()
  7670. })
  7671. let closed = false
  7672. socket.on('close', () => {
  7673. closed = true
  7674. })
  7675. return {
  7676. version: 'h1',
  7677. defaultPipelining: 1,
  7678. write (...args) {
  7679. return writeH1(client, ...args)
  7680. },
  7681. resume () {
  7682. resumeH1(client)
  7683. },
  7684. destroy (err, callback) {
  7685. if (closed) {
  7686. queueMicrotask(callback)
  7687. } else {
  7688. socket.destroy(err).on('close', callback)
  7689. }
  7690. },
  7691. get destroyed () {
  7692. return socket.destroyed
  7693. },
  7694. busy (request) {
  7695. if (socket[kWriting] || socket[kReset] || socket[kBlocking] || socket[kIdleSocketValidation] === 1) {
  7696. return true
  7697. }
  7698. if (request) {
  7699. if (client[kRunning] > 0 && !request.idempotent) {
  7700. // Non-idempotent request cannot be retried.
  7701. // Ensure that no other requests are inflight and
  7702. // could cause failure.
  7703. return true
  7704. }
  7705. if (client[kRunning] > 0 && (request.upgrade || request.method === 'CONNECT')) {
  7706. // Don't dispatch an upgrade until all preceding requests have completed.
  7707. // A misbehaving server might upgrade the connection before all pipelined
  7708. // request has completed.
  7709. return true
  7710. }
  7711. if (client[kRunning] > 0 && util.bodyLength(request.body) !== 0 &&
  7712. (util.isStream(request.body) || util.isAsyncIterable(request.body) || util.isFormDataLike(request.body))) {
  7713. // Request with stream or iterator body can error while other requests
  7714. // are inflight and indirectly error those as well.
  7715. // Ensure this doesn't happen by waiting for inflight
  7716. // to complete before dispatching.
  7717. // Request with stream or iterator body cannot be retried.
  7718. // Ensure that no other requests are inflight and
  7719. // could cause failure.
  7720. return true
  7721. }
  7722. }
  7723. return false
  7724. }
  7725. }
  7726. }
  7727. function clearIdleSocketValidation (socket) {
  7728. if (socket[kIdleSocketValidationTimeout]) {
  7729. clearImmediate(socket[kIdleSocketValidationTimeout])
  7730. socket[kIdleSocketValidationTimeout] = null
  7731. }
  7732. socket[kIdleSocketValidation] = 0
  7733. }
  7734. function scheduleIdleSocketValidation (client, socket) {
  7735. socket[kIdleSocketValidation] = 1
  7736. // Yield to the check phase (after poll) so unsolicited bytes / FIN / RST
  7737. // already pending on this idle keep-alive socket are processed before the
  7738. // next request is written (GHSA-35p6-xmwp-9g52).
  7739. //
  7740. // setTimeout(0) pays Node's ~1ms timer floor on every sequential reuse
  7741. // (#5493). setImmediate avoids that, but an *unref'd* Immediate lets poll
  7742. // block for ~500ms when the event loop is otherwise idle (#5600 / #5606).
  7743. // A ref'd Immediate both keeps the pending request alive and makes poll
  7744. // return immediately — the hybrid those issues asked for.
  7745. socket[kIdleSocketValidationTimeout] = setImmediate(() => {
  7746. socket[kIdleSocketValidationTimeout] = null
  7747. socket[kIdleSocketValidation] = 2
  7748. if (client[kSocket] === socket && !socket.destroyed) {
  7749. client[kResume]()
  7750. }
  7751. })
  7752. }
  7753. /**
  7754. * @param {import('./client.js')} client
  7755. */
  7756. function resumeH1 (client) {
  7757. const socket = client[kSocket]
  7758. if (socket && !socket.destroyed) {
  7759. if (client[kSize] === 0) {
  7760. if (!socket[kNoRef] && socket.unref) {
  7761. socket.unref()
  7762. socket[kNoRef] = true
  7763. }
  7764. } else if (socket[kNoRef] && socket.ref) {
  7765. socket.ref()
  7766. socket[kNoRef] = false
  7767. }
  7768. if (client[kRunning] === 0 && client[kPending] > 0 && socket[kSocketUsed]) {
  7769. if (socket[kIdleSocketValidation] === 0) {
  7770. scheduleIdleSocketValidation(client, socket)
  7771. socket[kParser].readMore()
  7772. if (socket.destroyed) {
  7773. return
  7774. }
  7775. return
  7776. }
  7777. if (socket[kIdleSocketValidation] === 1) {
  7778. socket[kParser].readMore()
  7779. if (socket.destroyed) {
  7780. return
  7781. }
  7782. return
  7783. }
  7784. }
  7785. if (client[kRunning] === 0) {
  7786. socket[kParser].readMore()
  7787. if (socket.destroyed) {
  7788. return
  7789. }
  7790. }
  7791. if (client[kSize] === 0) {
  7792. if (socket[kParser].timeoutType !== TIMEOUT_KEEP_ALIVE) {
  7793. socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_KEEP_ALIVE)
  7794. }
  7795. } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) {
  7796. if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) {
  7797. const request = client[kQueue][client[kRunningIdx]]
  7798. const headersTimeout = request.headersTimeout != null
  7799. ? request.headersTimeout
  7800. : client[kHeadersTimeout]
  7801. socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS)
  7802. }
  7803. }
  7804. }
  7805. }
  7806. // https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2
  7807. function shouldSendContentLength (method) {
  7808. return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
  7809. }
  7810. function writeH1 (client, request) {
  7811. const { method, path, host, upgrade, blocking, reset } = request
  7812. let { body, headers, contentLength } = request
  7813. // https://tools.ietf.org/html/rfc7231#section-4.3.1
  7814. // https://tools.ietf.org/html/rfc7231#section-4.3.2
  7815. // https://tools.ietf.org/html/rfc7231#section-4.3.5
  7816. // Sending a payload body on a request that does not
  7817. // expect it can cause undefined behavior on some
  7818. // servers and corrupt connection state. Do not
  7819. // re-use the connection for further requests.
  7820. const expectsPayload = (
  7821. method === 'PUT' ||
  7822. method === 'POST' ||
  7823. method === 'PATCH' ||
  7824. method === 'QUERY' ||
  7825. method === 'PROPFIND' ||
  7826. method === 'PROPPATCH'
  7827. )
  7828. if (util.isFormDataLike(body)) {
  7829. if (!extractBody) {
  7830. extractBody = (__nccwpck_require__(4492).extractBody)
  7831. }
  7832. const [bodyStream, contentType] = extractBody(body)
  7833. if (request.contentType == null) {
  7834. headers.push('content-type', contentType)
  7835. }
  7836. body = bodyStream.stream
  7837. contentLength = bodyStream.length
  7838. } else if (util.isBlobLike(body) && request.contentType == null) {
  7839. const contentType = body.type
  7840. if (contentType) {
  7841. const contentTypeValue = `${contentType}`
  7842. if (!util.isValidHeaderValue(contentTypeValue)) {
  7843. util.errorRequest(client, request, new InvalidArgumentError('invalid content-type header'))
  7844. return false
  7845. }
  7846. headers.push('content-type', contentTypeValue)
  7847. }
  7848. }
  7849. if (body && typeof body.read === 'function') {
  7850. // Try to read EOF in order to get length.
  7851. body.read(0)
  7852. }
  7853. const bodyLength = util.bodyLength(body)
  7854. contentLength = bodyLength ?? contentLength
  7855. if (contentLength === null) {
  7856. contentLength = request.contentLength
  7857. }
  7858. if (contentLength === 0 && !expectsPayload) {
  7859. // https://tools.ietf.org/html/rfc7230#section-3.3.2
  7860. // A user agent SHOULD NOT send a Content-Length header field when
  7861. // the request message does not contain a payload body and the method
  7862. // semantics do not anticipate such a body.
  7863. contentLength = null
  7864. }
  7865. // https://github.com/nodejs/undici/issues/2046
  7866. // A user agent may send a Content-Length header with 0 value, this should be allowed.
  7867. if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength !== null && request.contentLength !== contentLength) {
  7868. if (client[kStrictContentLength]) {
  7869. util.errorRequest(client, request, new RequestContentLengthMismatchError())
  7870. return false
  7871. }
  7872. process.emitWarning(new RequestContentLengthMismatchError())
  7873. }
  7874. const socket = client[kSocket]
  7875. clearIdleSocketValidation(socket)
  7876. /**
  7877. * @param {Error} [error]
  7878. */
  7879. const abort = (error) => {
  7880. if (request.aborted) {
  7881. return
  7882. }
  7883. if (request.completed) {
  7884. if (request.upgrade || request.method === 'CONNECT') {
  7885. util.destroy(socket, new InformationalError('aborted'))
  7886. }
  7887. return
  7888. }
  7889. util.errorRequest(client, request, error || new RequestAbortedError())
  7890. util.destroy(body)
  7891. util.destroy(socket, new InformationalError('aborted'))
  7892. }
  7893. try {
  7894. request.onConnect(abort)
  7895. } catch (err) {
  7896. util.errorRequest(client, request, err)
  7897. }
  7898. if (request.aborted) {
  7899. return false
  7900. }
  7901. if (method === 'HEAD') {
  7902. // https://github.com/mcollina/undici/issues/258
  7903. // Close after a HEAD request to interop with misbehaving servers
  7904. // that may send a body in the response.
  7905. socket[kReset] = true
  7906. }
  7907. if (upgrade || method === 'CONNECT') {
  7908. // On CONNECT or upgrade, block pipeline from dispatching further
  7909. // requests on this connection.
  7910. socket[kReset] = true
  7911. }
  7912. if (reset != null) {
  7913. socket[kReset] = reset
  7914. }
  7915. if (client[kMaxRequests] && socket[kCounter]++ >= client[kMaxRequests]) {
  7916. socket[kReset] = true
  7917. }
  7918. if (blocking) {
  7919. socket[kBlocking] = true
  7920. }
  7921. let header = `${method} ${path} HTTP/1.1\r\n`
  7922. if (typeof host === 'string') {
  7923. header += `host: ${host}\r\n`
  7924. } else {
  7925. header += client[kHostHeader]
  7926. }
  7927. if (upgrade) {
  7928. header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n`
  7929. } else if (client[kPipelining] && !socket[kReset]) {
  7930. header += 'connection: keep-alive\r\n'
  7931. } else {
  7932. header += 'connection: close\r\n'
  7933. }
  7934. if (Array.isArray(headers)) {
  7935. for (let n = 0; n < headers.length; n += 2) {
  7936. const key = headers[n + 0]
  7937. const val = headers[n + 1]
  7938. if (Array.isArray(val)) {
  7939. for (let i = 0; i < val.length; i++) {
  7940. header += `${key}: ${val[i]}\r\n`
  7941. }
  7942. } else {
  7943. header += `${key}: ${val}\r\n`
  7944. }
  7945. }
  7946. }
  7947. if (channels.sendHeaders.hasSubscribers) {
  7948. channels.sendHeaders.publish({ request, headers: header, socket })
  7949. }
  7950. /* istanbul ignore else: assertion */
  7951. if (!body || bodyLength === 0) {
  7952. writeBuffer(abort, null, client, request, socket, contentLength, header, expectsPayload)
  7953. } else if (util.isBuffer(body)) {
  7954. writeBuffer(abort, body, client, request, socket, contentLength, header, expectsPayload)
  7955. } else if (util.isBlobLike(body)) {
  7956. if (typeof body.stream === 'function') {
  7957. writeIterable(abort, body.stream(), client, request, socket, contentLength, header, expectsPayload)
  7958. } else {
  7959. writeBlob(abort, body, client, request, socket, contentLength, header, expectsPayload)
  7960. }
  7961. } else if (util.isStream(body)) {
  7962. writeStream(abort, body, client, request, socket, contentLength, header, expectsPayload)
  7963. } else if (util.isIterable(body)) {
  7964. writeIterable(abort, body, client, request, socket, contentLength, header, expectsPayload)
  7965. } else {
  7966. assert(false)
  7967. }
  7968. return true
  7969. }
  7970. function writeStream (abort, body, client, request, socket, contentLength, header, expectsPayload) {
  7971. assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined')
  7972. let finished = false
  7973. const writer = new AsyncWriter({ abort, socket, request, contentLength, client, expectsPayload, header })
  7974. const onData = function (chunk) {
  7975. if (finished) {
  7976. return
  7977. }
  7978. try {
  7979. if (!writer.write(chunk) && this.pause) {
  7980. this.pause()
  7981. }
  7982. } catch (err) {
  7983. util.destroy(this, err)
  7984. }
  7985. }
  7986. const onDrain = function () {
  7987. if (finished) {
  7988. return
  7989. }
  7990. if (body.resume) {
  7991. body.resume()
  7992. }
  7993. }
  7994. const onClose = function () {
  7995. // 'close' might be emitted *before* 'error' for
  7996. // broken streams. Wait a tick to avoid this case.
  7997. queueMicrotask(() => {
  7998. // It's only safe to remove 'error' listener after
  7999. // 'close'.
  8000. body.removeListener('error', onFinished)
  8001. })
  8002. if (!finished) {
  8003. const err = new RequestAbortedError()
  8004. queueMicrotask(() => onFinished(err))
  8005. }
  8006. }
  8007. const onFinished = function (err) {
  8008. if (finished) {
  8009. return
  8010. }
  8011. finished = true
  8012. assert(socket.destroyed || (socket[kWriting] && client[kRunning] <= 1))
  8013. socket
  8014. .off('drain', onDrain)
  8015. .off('error', onFinished)
  8016. body
  8017. .removeListener('data', onData)
  8018. .removeListener('end', onFinished)
  8019. .removeListener('close', onClose)
  8020. if (!err) {
  8021. try {
  8022. writer.end()
  8023. } catch (er) {
  8024. err = er
  8025. }
  8026. }
  8027. writer.destroy(err)
  8028. if (err && (err.code !== 'UND_ERR_INFO' || err.message !== 'reset')) {
  8029. util.destroy(body, err)
  8030. } else {
  8031. util.destroy(body)
  8032. }
  8033. }
  8034. body
  8035. .on('data', onData)
  8036. .on('end', onFinished)
  8037. .on('error', onFinished)
  8038. .on('close', onClose)
  8039. if (body.resume) {
  8040. body.resume()
  8041. }
  8042. socket
  8043. .on('drain', onDrain)
  8044. .on('error', onFinished)
  8045. if (body.errorEmitted ?? body.errored) {
  8046. setImmediate(() => onFinished(body.errored))
  8047. } else if (body.endEmitted ?? body.readableEnded) {
  8048. setImmediate(() => onFinished(null))
  8049. }
  8050. if (body.closeEmitted ?? body.closed) {
  8051. setImmediate(onClose)
  8052. }
  8053. }
  8054. function writeBuffer (abort, body, client, request, socket, contentLength, header, expectsPayload) {
  8055. try {
  8056. if (!body) {
  8057. if (contentLength === 0) {
  8058. socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1')
  8059. } else {
  8060. assert(contentLength === null, 'no body must not have content length')
  8061. socket.write(`${header}\r\n`, 'latin1')
  8062. }
  8063. } else if (util.isBuffer(body)) {
  8064. assert(contentLength === body.byteLength, 'buffer body must have content length')
  8065. socket.cork()
  8066. socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1')
  8067. socket.write(body)
  8068. socket.uncork()
  8069. request.onBodySent(body)
  8070. if (!expectsPayload && request.reset !== false) {
  8071. socket[kReset] = true
  8072. }
  8073. }
  8074. request.onRequestSent()
  8075. client[kResume]()
  8076. } catch (err) {
  8077. abort(err)
  8078. }
  8079. }
  8080. async function writeBlob (abort, body, client, request, socket, contentLength, header, expectsPayload) {
  8081. assert(contentLength === body.size, 'blob body must have content length')
  8082. try {
  8083. if (contentLength != null && contentLength !== body.size) {
  8084. throw new RequestContentLengthMismatchError()
  8085. }
  8086. const buffer = Buffer.from(await body.arrayBuffer())
  8087. socket.cork()
  8088. socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1')
  8089. socket.write(buffer)
  8090. socket.uncork()
  8091. request.onBodySent(buffer)
  8092. request.onRequestSent()
  8093. if (!expectsPayload && request.reset !== false) {
  8094. socket[kReset] = true
  8095. }
  8096. client[kResume]()
  8097. } catch (err) {
  8098. abort(err)
  8099. }
  8100. }
  8101. async function writeIterable (abort, body, client, request, socket, contentLength, header, expectsPayload) {
  8102. assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined')
  8103. let callback = null
  8104. function onDrain () {
  8105. if (callback) {
  8106. const cb = callback
  8107. callback = null
  8108. cb()
  8109. }
  8110. }
  8111. const waitForDrain = () => new Promise((resolve, reject) => {
  8112. assert(callback === null)
  8113. if (socket[kError]) {
  8114. reject(socket[kError])
  8115. } else {
  8116. callback = resolve
  8117. }
  8118. })
  8119. socket
  8120. .on('close', onDrain)
  8121. .on('drain', onDrain)
  8122. const writer = new AsyncWriter({ abort, socket, request, contentLength, client, expectsPayload, header })
  8123. try {
  8124. // It's up to the user to somehow abort the async iterable.
  8125. for await (const chunk of body) {
  8126. if (socket[kError]) {
  8127. throw socket[kError]
  8128. }
  8129. if (!writer.write(chunk)) {
  8130. await waitForDrain()
  8131. }
  8132. }
  8133. writer.end()
  8134. } catch (err) {
  8135. writer.destroy(err)
  8136. } finally {
  8137. socket
  8138. .off('close', onDrain)
  8139. .off('drain', onDrain)
  8140. }
  8141. }
  8142. class AsyncWriter {
  8143. constructor ({ abort, socket, request, contentLength, client, expectsPayload, header }) {
  8144. this.socket = socket
  8145. this.request = request
  8146. this.contentLength = contentLength
  8147. this.client = client
  8148. this.bytesWritten = 0
  8149. this.expectsPayload = expectsPayload
  8150. this.header = header
  8151. this.abort = abort
  8152. socket[kWriting] = true
  8153. }
  8154. write (chunk) {
  8155. const { socket, request, contentLength, client, bytesWritten, expectsPayload, header } = this
  8156. if (socket[kError]) {
  8157. throw socket[kError]
  8158. }
  8159. if (socket.destroyed) {
  8160. return false
  8161. }
  8162. const len = Buffer.byteLength(chunk)
  8163. if (!len) {
  8164. return true
  8165. }
  8166. // We should defer writing chunks.
  8167. if (contentLength !== null && bytesWritten + len > contentLength) {
  8168. if (client[kStrictContentLength]) {
  8169. throw new RequestContentLengthMismatchError()
  8170. }
  8171. process.emitWarning(new RequestContentLengthMismatchError())
  8172. }
  8173. socket.cork()
  8174. if (bytesWritten === 0) {
  8175. if (!expectsPayload && request.reset !== false) {
  8176. socket[kReset] = true
  8177. }
  8178. if (contentLength === null) {
  8179. socket.write(`${header}transfer-encoding: chunked\r\n`, 'latin1')
  8180. } else {
  8181. socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1')
  8182. }
  8183. }
  8184. if (contentLength === null) {
  8185. socket.write(`\r\n${len.toString(16)}\r\n`, 'latin1')
  8186. }
  8187. this.bytesWritten += len
  8188. const ret = socket.write(chunk)
  8189. socket.uncork()
  8190. request.onBodySent(chunk)
  8191. if (!ret) {
  8192. if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
  8193. // istanbul ignore else: only for jest
  8194. if (socket[kParser].timeout.refresh) {
  8195. socket[kParser].timeout.refresh()
  8196. }
  8197. }
  8198. }
  8199. return ret
  8200. }
  8201. end () {
  8202. const { socket, contentLength, client, bytesWritten, expectsPayload, header, request } = this
  8203. request.onRequestSent()
  8204. socket[kWriting] = false
  8205. if (socket[kError]) {
  8206. throw socket[kError]
  8207. }
  8208. if (socket.destroyed) {
  8209. return
  8210. }
  8211. if (bytesWritten === 0) {
  8212. if (expectsPayload) {
  8213. // https://tools.ietf.org/html/rfc7230#section-3.3.2
  8214. // A user agent SHOULD send a Content-Length in a request message when
  8215. // no Transfer-Encoding is sent and the request method defines a meaning
  8216. // for an enclosed payload body.
  8217. socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1')
  8218. } else {
  8219. socket.write(`${header}\r\n`, 'latin1')
  8220. }
  8221. } else if (contentLength === null) {
  8222. socket.write('\r\n0\r\n\r\n', 'latin1')
  8223. }
  8224. if (contentLength !== null && bytesWritten !== contentLength) {
  8225. if (client[kStrictContentLength]) {
  8226. throw new RequestContentLengthMismatchError()
  8227. } else {
  8228. process.emitWarning(new RequestContentLengthMismatchError())
  8229. }
  8230. }
  8231. if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
  8232. // istanbul ignore else: only for jest
  8233. if (socket[kParser].timeout.refresh) {
  8234. socket[kParser].timeout.refresh()
  8235. }
  8236. }
  8237. client[kResume]()
  8238. }
  8239. destroy (err) {
  8240. const { socket, client, abort } = this
  8241. socket[kWriting] = false
  8242. if (err) {
  8243. assert(client[kRunning] <= 1, 'pipeline should only contain this request')
  8244. abort(err)
  8245. }
  8246. }
  8247. }
  8248. module.exports = connectH1
  8249. /***/ }),
  8250. /***/ 8788:
  8251. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  8252. const assert = __nccwpck_require__(4589)
  8253. const { errorMonitor } = __nccwpck_require__(8474)
  8254. const { pipeline } = __nccwpck_require__(7075)
  8255. const util = __nccwpck_require__(3440)
  8256. const {
  8257. RequestContentLengthMismatchError,
  8258. RequestAbortedError,
  8259. SocketError,
  8260. InformationalError
  8261. } = __nccwpck_require__(8707)
  8262. const {
  8263. kUrl,
  8264. kReset,
  8265. kClient,
  8266. kRunning,
  8267. kPending,
  8268. kQueue,
  8269. kPendingIdx,
  8270. kRunningIdx,
  8271. kError,
  8272. kSocket,
  8273. kStrictContentLength,
  8274. kOnError,
  8275. kMaxConcurrentStreams,
  8276. kHTTP2Session,
  8277. kResume,
  8278. kSize,
  8279. kHTTPContext
  8280. } = __nccwpck_require__(6443)
  8281. const kOpenStreams = Symbol('open streams')
  8282. let extractBody
  8283. // Experimental
  8284. let h2ExperimentalWarned = false
  8285. /** @type {import('http2')} */
  8286. let http2
  8287. try {
  8288. http2 = __nccwpck_require__(2467)
  8289. } catch {
  8290. // @ts-ignore
  8291. http2 = { constants: {} }
  8292. }
  8293. const {
  8294. constants: {
  8295. HTTP2_HEADER_AUTHORITY,
  8296. HTTP2_HEADER_METHOD,
  8297. HTTP2_HEADER_PATH,
  8298. HTTP2_HEADER_SCHEME,
  8299. HTTP2_HEADER_CONTENT_LENGTH,
  8300. HTTP2_HEADER_EXPECT,
  8301. HTTP2_HEADER_STATUS
  8302. }
  8303. } = http2
  8304. function parseH2Headers (headers) {
  8305. const result = []
  8306. for (const [name, value] of Object.entries(headers)) {
  8307. // h2 may concat the header value by array
  8308. // e.g. Set-Cookie
  8309. if (Array.isArray(value)) {
  8310. for (const subvalue of value) {
  8311. // we need to provide each header value of header name
  8312. // because the headers handler expect name-value pair
  8313. result.push(Buffer.from(name), Buffer.from(subvalue))
  8314. }
  8315. } else {
  8316. result.push(Buffer.from(name), Buffer.from(value))
  8317. }
  8318. }
  8319. return result
  8320. }
  8321. /**
  8322. * @param {import('node:http2').IncomingHttpHeaders} headers
  8323. * @returns {Buffer[]}
  8324. */
  8325. function parseH2ResponseHeaders (headers) {
  8326. const { [HTTP2_HEADER_STATUS]: _statusCode, ...realHeaders } = headers
  8327. return parseH2Headers(realHeaders)
  8328. }
  8329. async function connectH2 (client, socket) {
  8330. client[kSocket] = socket
  8331. if (!h2ExperimentalWarned) {
  8332. h2ExperimentalWarned = true
  8333. process.emitWarning('H2 support is experimental, expect them to change at any time.', {
  8334. code: 'UNDICI-H2'
  8335. })
  8336. }
  8337. const session = http2.connect(client[kUrl], {
  8338. createConnection: () => socket,
  8339. peerMaxConcurrentStreams: client[kMaxConcurrentStreams]
  8340. })
  8341. session[kOpenStreams] = 0
  8342. session[kClient] = client
  8343. session[kSocket] = socket
  8344. util.addListener(session, 'error', onHttp2SessionError)
  8345. util.addListener(session, 'frameError', onHttp2FrameError)
  8346. util.addListener(session, 'end', onHttp2SessionEnd)
  8347. util.addListener(session, 'goaway', onHTTP2GoAway)
  8348. util.addListener(session, 'close', function () {
  8349. const { [kClient]: client } = this
  8350. const { [kSocket]: socket } = client
  8351. const err = this[kSocket][kError] || this[kError] || new SocketError('closed', util.getSocketInfo(socket))
  8352. client[kHTTP2Session] = null
  8353. if (client.destroyed) {
  8354. assert(client[kPending] === 0)
  8355. // Fail entire queue.
  8356. const requests = client[kQueue].splice(client[kRunningIdx])
  8357. for (let i = 0; i < requests.length; i++) {
  8358. const request = requests[i]
  8359. util.errorRequest(client, request, err)
  8360. }
  8361. }
  8362. })
  8363. session.unref()
  8364. client[kHTTP2Session] = session
  8365. socket[kHTTP2Session] = session
  8366. util.addListener(socket, 'error', function (err) {
  8367. assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
  8368. this[kError] = err
  8369. this[kClient][kOnError](err)
  8370. })
  8371. util.addListener(socket, 'end', function () {
  8372. util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this)))
  8373. })
  8374. util.addListener(socket, 'close', function () {
  8375. const err = this[kError] || new SocketError('closed', util.getSocketInfo(this))
  8376. client[kSocket] = null
  8377. if (this[kHTTP2Session] != null) {
  8378. this[kHTTP2Session].destroy(err)
  8379. }
  8380. client[kPendingIdx] = client[kRunningIdx]
  8381. assert(client[kRunning] === 0)
  8382. client.emit('disconnect', client[kUrl], [client], err)
  8383. client[kResume]()
  8384. })
  8385. let closed = false
  8386. socket.on('close', () => {
  8387. closed = true
  8388. })
  8389. return {
  8390. version: 'h2',
  8391. defaultPipelining: Infinity,
  8392. write (...args) {
  8393. return writeH2(client, ...args)
  8394. },
  8395. resume () {
  8396. resumeH2(client)
  8397. },
  8398. destroy (err, callback) {
  8399. if (closed) {
  8400. queueMicrotask(callback)
  8401. } else {
  8402. // Destroying the socket will trigger the session close
  8403. socket.destroy(err).on('close', callback)
  8404. }
  8405. },
  8406. get destroyed () {
  8407. return socket.destroyed
  8408. },
  8409. busy () {
  8410. return false
  8411. }
  8412. }
  8413. }
  8414. function resumeH2 (client) {
  8415. const socket = client[kSocket]
  8416. if (socket?.destroyed === false) {
  8417. if (client[kSize] === 0 && client[kMaxConcurrentStreams] === 0) {
  8418. socket.unref()
  8419. client[kHTTP2Session].unref()
  8420. } else {
  8421. socket.ref()
  8422. client[kHTTP2Session].ref()
  8423. }
  8424. }
  8425. }
  8426. function onHttp2SessionError (err) {
  8427. assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
  8428. this[kSocket][kError] = err
  8429. this[kClient][kOnError](err)
  8430. }
  8431. function onHttp2FrameError (type, code, id) {
  8432. if (id === 0) {
  8433. const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`)
  8434. this[kSocket][kError] = err
  8435. this[kClient][kOnError](err)
  8436. }
  8437. }
  8438. function onHttp2SessionEnd () {
  8439. const err = new SocketError('other side closed', util.getSocketInfo(this[kSocket]))
  8440. this.destroy(err)
  8441. util.destroy(this[kSocket], err)
  8442. }
  8443. /**
  8444. * This is the root cause of #3011
  8445. * We need to handle GOAWAY frames properly, and trigger the session close
  8446. * along with the socket right away
  8447. */
  8448. function onHTTP2GoAway (code) {
  8449. // We cannot recover, so best to close the session and the socket
  8450. const err = this[kError] || new SocketError(`HTTP/2: "GOAWAY" frame received with code ${code}`, util.getSocketInfo(this))
  8451. const client = this[kClient]
  8452. client[kSocket] = null
  8453. client[kHTTPContext] = null
  8454. if (this[kHTTP2Session] != null) {
  8455. this[kHTTP2Session].destroy(err)
  8456. this[kHTTP2Session] = null
  8457. }
  8458. util.destroy(this[kSocket], err)
  8459. // Fail head of pipeline.
  8460. if (client[kRunningIdx] < client[kQueue].length) {
  8461. const request = client[kQueue][client[kRunningIdx]]
  8462. client[kQueue][client[kRunningIdx]++] = null
  8463. util.errorRequest(client, request, err)
  8464. client[kPendingIdx] = client[kRunningIdx]
  8465. }
  8466. assert(client[kRunning] === 0)
  8467. client.emit('disconnect', client[kUrl], [client], err)
  8468. client[kResume]()
  8469. }
  8470. // https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2
  8471. function shouldSendContentLength (method) {
  8472. return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
  8473. }
  8474. function writeH2 (client, request) {
  8475. const session = client[kHTTP2Session]
  8476. const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request
  8477. let { body } = request
  8478. if (upgrade) {
  8479. util.errorRequest(client, request, new Error('Upgrade not supported for H2'))
  8480. return false
  8481. }
  8482. const headers = {}
  8483. for (let n = 0; n < reqHeaders.length; n += 2) {
  8484. const key = reqHeaders[n + 0]
  8485. const val = reqHeaders[n + 1]
  8486. if (Array.isArray(val)) {
  8487. for (let i = 0; i < val.length; i++) {
  8488. if (headers[key]) {
  8489. headers[key] += `,${val[i]}`
  8490. } else {
  8491. headers[key] = val[i]
  8492. }
  8493. }
  8494. } else {
  8495. headers[key] = val
  8496. }
  8497. }
  8498. /** @type {import('node:http2').ClientHttp2Stream} */
  8499. let stream
  8500. const { hostname, port } = client[kUrl]
  8501. headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ''}`
  8502. headers[HTTP2_HEADER_METHOD] = method
  8503. /**
  8504. * @param {Error} [error]
  8505. */
  8506. const abort = (error) => {
  8507. if (request.aborted) {
  8508. return
  8509. }
  8510. if (request.completed) {
  8511. if (method === 'CONNECT' && stream != null) {
  8512. util.destroy(stream, error || new RequestAbortedError())
  8513. }
  8514. return
  8515. }
  8516. error = error || new RequestAbortedError()
  8517. util.errorRequest(client, request, error)
  8518. if (stream != null) {
  8519. util.destroy(stream, error)
  8520. }
  8521. // We do not destroy the socket as we can continue using the session
  8522. // the stream get's destroyed and the session remains to create new streams
  8523. util.destroy(body, error)
  8524. client[kQueue][client[kRunningIdx]++] = null
  8525. client[kResume]()
  8526. }
  8527. try {
  8528. // We are already connected, streams are pending.
  8529. // We can call on connect, and wait for abort
  8530. request.onConnect(abort)
  8531. } catch (err) {
  8532. util.errorRequest(client, request, err)
  8533. }
  8534. if (request.aborted) {
  8535. return false
  8536. }
  8537. if (method === 'CONNECT') {
  8538. session.ref()
  8539. // We disabled endStream to allow the user to write to the stream
  8540. stream = session.request(headers, { endStream: false, signal })
  8541. let upgradeResponseFinished = false
  8542. /**
  8543. * @param {import('node:http2').IncomingHttpHeaders} headers
  8544. */
  8545. const onResponse = (headers) => {
  8546. upgradeResponseFinished = true
  8547. stream.off(errorMonitor, onUpgradeError)
  8548. request.onUpgradeResponse(Number(headers[HTTP2_HEADER_STATUS]), headers, parseH2ResponseHeaders)
  8549. }
  8550. /**
  8551. * @param {Error} error
  8552. */
  8553. const onUpgradeError = (error) => {
  8554. upgradeResponseFinished = true
  8555. stream.off('response', onResponse)
  8556. request.onUpgradeError(error)
  8557. }
  8558. const onReady = () => {
  8559. try {
  8560. request.onUpgrade(null, null, stream)
  8561. } catch (error) {
  8562. stream.off('response', onResponse)
  8563. abort(error)
  8564. return
  8565. }
  8566. if (request.aborted) {
  8567. return
  8568. }
  8569. stream.off('error', abort)
  8570. stream.once(errorMonitor, onUpgradeError)
  8571. client[kQueue][client[kRunningIdx]++] = null
  8572. }
  8573. stream.once('response', onResponse)
  8574. stream.once('error', abort)
  8575. ++session[kOpenStreams]
  8576. onReady()
  8577. stream.once('close', () => {
  8578. if (!upgradeResponseFinished && request.completed) {
  8579. stream.off('response', onResponse)
  8580. stream.off(errorMonitor, onUpgradeError)
  8581. request.onUpgradeError(new InformationalError(`HTTP/2: "stream error" received - code ${stream.rstCode}`))
  8582. }
  8583. session[kOpenStreams] -= 1
  8584. if (session[kOpenStreams] === 0) session.unref()
  8585. })
  8586. return true
  8587. }
  8588. // https://tools.ietf.org/html/rfc7540#section-8.3
  8589. // :path and :scheme headers must be omitted when sending CONNECT
  8590. headers[HTTP2_HEADER_PATH] = path
  8591. headers[HTTP2_HEADER_SCHEME] = 'https'
  8592. // https://tools.ietf.org/html/rfc7231#section-4.3.1
  8593. // https://tools.ietf.org/html/rfc7231#section-4.3.2
  8594. // https://tools.ietf.org/html/rfc7231#section-4.3.5
  8595. // Sending a payload body on a request that does not
  8596. // expect it can cause undefined behavior on some
  8597. // servers and corrupt connection state. Do not
  8598. // re-use the connection for further requests.
  8599. const expectsPayload = (
  8600. method === 'PUT' ||
  8601. method === 'POST' ||
  8602. method === 'PATCH'
  8603. )
  8604. if (body && typeof body.read === 'function') {
  8605. // Try to read EOF in order to get length.
  8606. body.read(0)
  8607. }
  8608. let contentLength = util.bodyLength(body)
  8609. if (util.isFormDataLike(body)) {
  8610. extractBody ??= (__nccwpck_require__(4492).extractBody)
  8611. const [bodyStream, contentType] = extractBody(body)
  8612. headers['content-type'] = contentType
  8613. body = bodyStream.stream
  8614. contentLength = bodyStream.length
  8615. }
  8616. if (contentLength == null) {
  8617. contentLength = request.contentLength
  8618. }
  8619. if (contentLength === 0 || !expectsPayload) {
  8620. // https://tools.ietf.org/html/rfc7230#section-3.3.2
  8621. // A user agent SHOULD NOT send a Content-Length header field when
  8622. // the request message does not contain a payload body and the method
  8623. // semantics do not anticipate such a body.
  8624. contentLength = null
  8625. }
  8626. // https://github.com/nodejs/undici/issues/2046
  8627. // A user agent may send a Content-Length header with 0 value, this should be allowed.
  8628. if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength != null && request.contentLength !== contentLength) {
  8629. if (client[kStrictContentLength]) {
  8630. util.errorRequest(client, request, new RequestContentLengthMismatchError())
  8631. return false
  8632. }
  8633. process.emitWarning(new RequestContentLengthMismatchError())
  8634. }
  8635. if (contentLength != null) {
  8636. assert(body, 'no body must not have content length')
  8637. headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}`
  8638. }
  8639. session.ref()
  8640. const shouldEndStream = method === 'GET' || method === 'HEAD' || body === null
  8641. if (expectContinue) {
  8642. headers[HTTP2_HEADER_EXPECT] = '100-continue'
  8643. stream = session.request(headers, { endStream: shouldEndStream, signal })
  8644. stream.once('continue', writeBodyH2)
  8645. } else {
  8646. stream = session.request(headers, {
  8647. endStream: shouldEndStream,
  8648. signal
  8649. })
  8650. writeBodyH2()
  8651. }
  8652. // Increment counter as we have new streams open
  8653. ++session[kOpenStreams]
  8654. stream.once('response', headers => {
  8655. const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers
  8656. request.onResponseStarted()
  8657. // Due to the stream nature, it is possible we face a race condition
  8658. // where the stream has been assigned, but the request has been aborted
  8659. // the request remains in-flight and headers hasn't been received yet
  8660. // for those scenarios, best effort is to destroy the stream immediately
  8661. // as there's no value to keep it open.
  8662. if (request.aborted) {
  8663. const err = new RequestAbortedError()
  8664. util.errorRequest(client, request, err)
  8665. util.destroy(stream, err)
  8666. return
  8667. }
  8668. if (request.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), '') === false) {
  8669. stream.pause()
  8670. }
  8671. stream.on('data', (chunk) => {
  8672. if (request.onData(chunk) === false) {
  8673. stream.pause()
  8674. }
  8675. })
  8676. })
  8677. stream.once('end', () => {
  8678. // When state is null, it means we haven't consumed body and the stream still do not have
  8679. // a state.
  8680. // Present specially when using pipeline or stream
  8681. if (stream.state?.state == null || stream.state.state < 6) {
  8682. request.onComplete([])
  8683. }
  8684. if (session[kOpenStreams] === 0) {
  8685. // Stream is closed or half-closed-remote (6), decrement counter and cleanup
  8686. // It does not have sense to continue working with the stream as we do not
  8687. // have yet RST_STREAM support on client-side
  8688. session.unref()
  8689. }
  8690. abort(new InformationalError('HTTP/2: stream half-closed (remote)'))
  8691. client[kQueue][client[kRunningIdx]++] = null
  8692. client[kPendingIdx] = client[kRunningIdx]
  8693. client[kResume]()
  8694. })
  8695. stream.once('close', () => {
  8696. session[kOpenStreams] -= 1
  8697. if (session[kOpenStreams] === 0) {
  8698. session.unref()
  8699. }
  8700. })
  8701. stream.once('error', function (err) {
  8702. abort(err)
  8703. })
  8704. stream.once('frameError', (type, code) => {
  8705. abort(new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`))
  8706. })
  8707. // stream.on('aborted', () => {
  8708. // // TODO(HTTP/2): Support aborted
  8709. // })
  8710. // stream.on('timeout', () => {
  8711. // // TODO(HTTP/2): Support timeout
  8712. // })
  8713. // stream.on('push', headers => {
  8714. // // TODO(HTTP/2): Support push
  8715. // })
  8716. // stream.on('trailers', headers => {
  8717. // // TODO(HTTP/2): Support trailers
  8718. // })
  8719. return true
  8720. function writeBodyH2 () {
  8721. /* istanbul ignore else: assertion */
  8722. if (!body || contentLength === 0) {
  8723. writeBuffer(
  8724. abort,
  8725. stream,
  8726. null,
  8727. client,
  8728. request,
  8729. client[kSocket],
  8730. contentLength,
  8731. expectsPayload
  8732. )
  8733. } else if (util.isBuffer(body)) {
  8734. writeBuffer(
  8735. abort,
  8736. stream,
  8737. body,
  8738. client,
  8739. request,
  8740. client[kSocket],
  8741. contentLength,
  8742. expectsPayload
  8743. )
  8744. } else if (util.isBlobLike(body)) {
  8745. if (typeof body.stream === 'function') {
  8746. writeIterable(
  8747. abort,
  8748. stream,
  8749. body.stream(),
  8750. client,
  8751. request,
  8752. client[kSocket],
  8753. contentLength,
  8754. expectsPayload
  8755. )
  8756. } else {
  8757. writeBlob(
  8758. abort,
  8759. stream,
  8760. body,
  8761. client,
  8762. request,
  8763. client[kSocket],
  8764. contentLength,
  8765. expectsPayload
  8766. )
  8767. }
  8768. } else if (util.isStream(body)) {
  8769. writeStream(
  8770. abort,
  8771. client[kSocket],
  8772. expectsPayload,
  8773. stream,
  8774. body,
  8775. client,
  8776. request,
  8777. contentLength
  8778. )
  8779. } else if (util.isIterable(body)) {
  8780. writeIterable(
  8781. abort,
  8782. stream,
  8783. body,
  8784. client,
  8785. request,
  8786. client[kSocket],
  8787. contentLength,
  8788. expectsPayload
  8789. )
  8790. } else {
  8791. assert(false)
  8792. }
  8793. }
  8794. }
  8795. function writeBuffer (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) {
  8796. try {
  8797. if (body != null && util.isBuffer(body)) {
  8798. assert(contentLength === body.byteLength, 'buffer body must have content length')
  8799. h2stream.cork()
  8800. h2stream.write(body)
  8801. h2stream.uncork()
  8802. h2stream.end()
  8803. request.onBodySent(body)
  8804. }
  8805. if (!expectsPayload) {
  8806. socket[kReset] = true
  8807. }
  8808. request.onRequestSent()
  8809. client[kResume]()
  8810. } catch (error) {
  8811. abort(error)
  8812. }
  8813. }
  8814. function writeStream (abort, socket, expectsPayload, h2stream, body, client, request, contentLength) {
  8815. assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined')
  8816. // For HTTP/2, is enough to pipe the stream
  8817. const pipe = pipeline(
  8818. body,
  8819. h2stream,
  8820. (err) => {
  8821. if (err) {
  8822. util.destroy(pipe, err)
  8823. abort(err)
  8824. } else {
  8825. util.removeAllListeners(pipe)
  8826. request.onRequestSent()
  8827. if (!expectsPayload) {
  8828. socket[kReset] = true
  8829. }
  8830. client[kResume]()
  8831. }
  8832. }
  8833. )
  8834. util.addListener(pipe, 'data', onPipeData)
  8835. function onPipeData (chunk) {
  8836. request.onBodySent(chunk)
  8837. }
  8838. }
  8839. async function writeBlob (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) {
  8840. assert(contentLength === body.size, 'blob body must have content length')
  8841. try {
  8842. if (contentLength != null && contentLength !== body.size) {
  8843. throw new RequestContentLengthMismatchError()
  8844. }
  8845. const buffer = Buffer.from(await body.arrayBuffer())
  8846. h2stream.cork()
  8847. h2stream.write(buffer)
  8848. h2stream.uncork()
  8849. h2stream.end()
  8850. request.onBodySent(buffer)
  8851. request.onRequestSent()
  8852. if (!expectsPayload) {
  8853. socket[kReset] = true
  8854. }
  8855. client[kResume]()
  8856. } catch (err) {
  8857. abort(err)
  8858. }
  8859. }
  8860. async function writeIterable (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) {
  8861. assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined')
  8862. let callback = null
  8863. function onDrain () {
  8864. if (callback) {
  8865. const cb = callback
  8866. callback = null
  8867. cb()
  8868. }
  8869. }
  8870. const waitForDrain = () => new Promise((resolve, reject) => {
  8871. assert(callback === null)
  8872. if (socket[kError]) {
  8873. reject(socket[kError])
  8874. } else {
  8875. callback = resolve
  8876. }
  8877. })
  8878. h2stream
  8879. .on('close', onDrain)
  8880. .on('drain', onDrain)
  8881. try {
  8882. // It's up to the user to somehow abort the async iterable.
  8883. for await (const chunk of body) {
  8884. if (socket[kError]) {
  8885. throw socket[kError]
  8886. }
  8887. const res = h2stream.write(chunk)
  8888. request.onBodySent(chunk)
  8889. if (!res) {
  8890. await waitForDrain()
  8891. }
  8892. }
  8893. h2stream.end()
  8894. request.onRequestSent()
  8895. if (!expectsPayload) {
  8896. socket[kReset] = true
  8897. }
  8898. client[kResume]()
  8899. } catch (err) {
  8900. abort(err)
  8901. } finally {
  8902. h2stream
  8903. .off('close', onDrain)
  8904. .off('drain', onDrain)
  8905. }
  8906. }
  8907. module.exports = connectH2
  8908. /***/ }),
  8909. /***/ 3701:
  8910. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  8911. // @ts-check
  8912. const assert = __nccwpck_require__(4589)
  8913. const net = __nccwpck_require__(7030)
  8914. const http = __nccwpck_require__(7067)
  8915. const util = __nccwpck_require__(3440)
  8916. const { channels } = __nccwpck_require__(2414)
  8917. const Request = __nccwpck_require__(4655)
  8918. const DispatcherBase = __nccwpck_require__(1841)
  8919. const {
  8920. InvalidArgumentError,
  8921. InformationalError,
  8922. ClientDestroyedError
  8923. } = __nccwpck_require__(8707)
  8924. const buildConnector = __nccwpck_require__(9136)
  8925. const {
  8926. kUrl,
  8927. kServerName,
  8928. kClient,
  8929. kBusy,
  8930. kConnect,
  8931. kResuming,
  8932. kRunning,
  8933. kPending,
  8934. kSize,
  8935. kQueue,
  8936. kConnected,
  8937. kConnecting,
  8938. kNeedDrain,
  8939. kKeepAliveDefaultTimeout,
  8940. kHostHeader,
  8941. kPendingIdx,
  8942. kRunningIdx,
  8943. kError,
  8944. kPipelining,
  8945. kKeepAliveTimeoutValue,
  8946. kMaxHeadersSize,
  8947. kKeepAliveMaxTimeout,
  8948. kKeepAliveTimeoutThreshold,
  8949. kHeadersTimeout,
  8950. kBodyTimeout,
  8951. kStrictContentLength,
  8952. kConnector,
  8953. kMaxRedirections,
  8954. kMaxRequests,
  8955. kCounter,
  8956. kClose,
  8957. kDestroy,
  8958. kDispatch,
  8959. kInterceptors,
  8960. kLocalAddress,
  8961. kMaxResponseSize,
  8962. kOnError,
  8963. kHTTPContext,
  8964. kMaxConcurrentStreams,
  8965. kResume
  8966. } = __nccwpck_require__(6443)
  8967. const connectH1 = __nccwpck_require__(637)
  8968. const connectH2 = __nccwpck_require__(8788)
  8969. let deprecatedInterceptorWarned = false
  8970. const kClosedResolve = Symbol('kClosedResolve')
  8971. const noop = () => {}
  8972. function getPipelining (client) {
  8973. return client[kPipelining] ?? client[kHTTPContext]?.defaultPipelining ?? 1
  8974. }
  8975. /**
  8976. * @type {import('../../types/client.js').default}
  8977. */
  8978. class Client extends DispatcherBase {
  8979. /**
  8980. *
  8981. * @param {string|URL} url
  8982. * @param {import('../../types/client.js').Client.Options} options
  8983. */
  8984. constructor (url, {
  8985. interceptors,
  8986. maxHeaderSize,
  8987. headersTimeout,
  8988. socketTimeout,
  8989. requestTimeout,
  8990. connectTimeout,
  8991. bodyTimeout,
  8992. idleTimeout,
  8993. keepAlive,
  8994. keepAliveTimeout,
  8995. maxKeepAliveTimeout,
  8996. keepAliveMaxTimeout,
  8997. keepAliveTimeoutThreshold,
  8998. socketPath,
  8999. pipelining,
  9000. tls,
  9001. strictContentLength,
  9002. maxCachedSessions,
  9003. maxRedirections,
  9004. connect,
  9005. maxRequestsPerClient,
  9006. localAddress,
  9007. maxResponseSize,
  9008. autoSelectFamily,
  9009. autoSelectFamilyAttemptTimeout,
  9010. // h2
  9011. maxConcurrentStreams,
  9012. allowH2,
  9013. webSocket
  9014. } = {}) {
  9015. super({ webSocket })
  9016. if (keepAlive !== undefined) {
  9017. throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
  9018. }
  9019. if (socketTimeout !== undefined) {
  9020. throw new InvalidArgumentError('unsupported socketTimeout, use headersTimeout & bodyTimeout instead')
  9021. }
  9022. if (requestTimeout !== undefined) {
  9023. throw new InvalidArgumentError('unsupported requestTimeout, use headersTimeout & bodyTimeout instead')
  9024. }
  9025. if (idleTimeout !== undefined) {
  9026. throw new InvalidArgumentError('unsupported idleTimeout, use keepAliveTimeout instead')
  9027. }
  9028. if (maxKeepAliveTimeout !== undefined) {
  9029. throw new InvalidArgumentError('unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead')
  9030. }
  9031. if (maxHeaderSize != null && !Number.isFinite(maxHeaderSize)) {
  9032. throw new InvalidArgumentError('invalid maxHeaderSize')
  9033. }
  9034. if (socketPath != null && typeof socketPath !== 'string') {
  9035. throw new InvalidArgumentError('invalid socketPath')
  9036. }
  9037. if (connectTimeout != null && (!Number.isFinite(connectTimeout) || connectTimeout < 0)) {
  9038. throw new InvalidArgumentError('invalid connectTimeout')
  9039. }
  9040. if (keepAliveTimeout != null && (!Number.isFinite(keepAliveTimeout) || keepAliveTimeout <= 0)) {
  9041. throw new InvalidArgumentError('invalid keepAliveTimeout')
  9042. }
  9043. if (keepAliveMaxTimeout != null && (!Number.isFinite(keepAliveMaxTimeout) || keepAliveMaxTimeout <= 0)) {
  9044. throw new InvalidArgumentError('invalid keepAliveMaxTimeout')
  9045. }
  9046. if (keepAliveTimeoutThreshold != null && !Number.isFinite(keepAliveTimeoutThreshold)) {
  9047. throw new InvalidArgumentError('invalid keepAliveTimeoutThreshold')
  9048. }
  9049. if (headersTimeout != null && (!Number.isInteger(headersTimeout) || headersTimeout < 0)) {
  9050. throw new InvalidArgumentError('headersTimeout must be a positive integer or zero')
  9051. }
  9052. if (bodyTimeout != null && (!Number.isInteger(bodyTimeout) || bodyTimeout < 0)) {
  9053. throw new InvalidArgumentError('bodyTimeout must be a positive integer or zero')
  9054. }
  9055. if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
  9056. throw new InvalidArgumentError('connect must be a function or an object')
  9057. }
  9058. if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
  9059. throw new InvalidArgumentError('maxRedirections must be a positive number')
  9060. }
  9061. if (maxRequestsPerClient != null && (!Number.isInteger(maxRequestsPerClient) || maxRequestsPerClient < 0)) {
  9062. throw new InvalidArgumentError('maxRequestsPerClient must be a positive number')
  9063. }
  9064. if (localAddress != null && (typeof localAddress !== 'string' || net.isIP(localAddress) === 0)) {
  9065. throw new InvalidArgumentError('localAddress must be valid string IP address')
  9066. }
  9067. if (maxResponseSize != null && (!Number.isInteger(maxResponseSize) || maxResponseSize < -1)) {
  9068. throw new InvalidArgumentError('maxResponseSize must be a positive number')
  9069. }
  9070. if (
  9071. autoSelectFamilyAttemptTimeout != null &&
  9072. (!Number.isInteger(autoSelectFamilyAttemptTimeout) || autoSelectFamilyAttemptTimeout < -1)
  9073. ) {
  9074. throw new InvalidArgumentError('autoSelectFamilyAttemptTimeout must be a positive number')
  9075. }
  9076. // h2
  9077. if (allowH2 != null && typeof allowH2 !== 'boolean') {
  9078. throw new InvalidArgumentError('allowH2 must be a valid boolean value')
  9079. }
  9080. if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== 'number' || maxConcurrentStreams < 1)) {
  9081. throw new InvalidArgumentError('maxConcurrentStreams must be a positive integer, greater than 0')
  9082. }
  9083. if (typeof connect !== 'function') {
  9084. connect = buildConnector({
  9085. ...tls,
  9086. maxCachedSessions,
  9087. allowH2,
  9088. socketPath,
  9089. timeout: connectTimeout,
  9090. ...(autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined),
  9091. ...connect
  9092. })
  9093. }
  9094. if (interceptors?.Client && Array.isArray(interceptors.Client)) {
  9095. this[kInterceptors] = interceptors.Client
  9096. if (!deprecatedInterceptorWarned) {
  9097. deprecatedInterceptorWarned = true
  9098. process.emitWarning('Client.Options#interceptor is deprecated. Use Dispatcher#compose instead.', {
  9099. code: 'UNDICI-CLIENT-INTERCEPTOR-DEPRECATED'
  9100. })
  9101. }
  9102. } else {
  9103. this[kInterceptors] = [createRedirectInterceptor({ maxRedirections })]
  9104. }
  9105. this[kUrl] = util.parseOrigin(url)
  9106. this[kConnector] = connect
  9107. this[kPipelining] = pipelining != null ? pipelining : 1
  9108. this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize
  9109. this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout
  9110. this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout
  9111. this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 2e3 : keepAliveTimeoutThreshold
  9112. this[kKeepAliveTimeoutValue] = this[kKeepAliveDefaultTimeout]
  9113. this[kServerName] = null
  9114. this[kLocalAddress] = localAddress != null ? localAddress : null
  9115. this[kResuming] = 0 // 0, idle, 1, scheduled, 2 resuming
  9116. this[kNeedDrain] = 0 // 0, idle, 1, scheduled, 2 resuming
  9117. this[kHostHeader] = `host: ${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}\r\n`
  9118. this[kBodyTimeout] = bodyTimeout != null ? bodyTimeout : 300e3
  9119. this[kHeadersTimeout] = headersTimeout != null ? headersTimeout : 300e3
  9120. this[kStrictContentLength] = strictContentLength == null ? true : strictContentLength
  9121. this[kMaxRedirections] = maxRedirections
  9122. this[kMaxRequests] = maxRequestsPerClient
  9123. this[kClosedResolve] = null
  9124. this[kMaxResponseSize] = maxResponseSize > -1 ? maxResponseSize : -1
  9125. this[kMaxConcurrentStreams] = maxConcurrentStreams != null ? maxConcurrentStreams : 100 // Max peerConcurrentStreams for a Node h2 server
  9126. this[kHTTPContext] = null
  9127. // kQueue is built up of 3 sections separated by
  9128. // the kRunningIdx and kPendingIdx indices.
  9129. // | complete | running | pending |
  9130. // ^ kRunningIdx ^ kPendingIdx ^ kQueue.length
  9131. // kRunningIdx points to the first running element.
  9132. // kPendingIdx points to the first pending element.
  9133. // This implements a fast queue with an amortized
  9134. // time of O(1).
  9135. this[kQueue] = []
  9136. this[kRunningIdx] = 0
  9137. this[kPendingIdx] = 0
  9138. this[kResume] = (sync) => resume(this, sync)
  9139. this[kOnError] = (err) => onError(this, err)
  9140. }
  9141. get pipelining () {
  9142. return this[kPipelining]
  9143. }
  9144. set pipelining (value) {
  9145. this[kPipelining] = value
  9146. this[kResume](true)
  9147. }
  9148. get [kPending] () {
  9149. return this[kQueue].length - this[kPendingIdx]
  9150. }
  9151. get [kRunning] () {
  9152. return this[kPendingIdx] - this[kRunningIdx]
  9153. }
  9154. get [kSize] () {
  9155. return this[kQueue].length - this[kRunningIdx]
  9156. }
  9157. get [kConnected] () {
  9158. return !!this[kHTTPContext] && !this[kConnecting] && !this[kHTTPContext].destroyed
  9159. }
  9160. get [kBusy] () {
  9161. return Boolean(
  9162. this[kHTTPContext]?.busy(null) ||
  9163. (this[kSize] >= (getPipelining(this) || 1)) ||
  9164. this[kPending] > 0
  9165. )
  9166. }
  9167. /* istanbul ignore: only used for test */
  9168. [kConnect] (cb) {
  9169. connect(this)
  9170. this.once('connect', cb)
  9171. }
  9172. [kDispatch] (opts, handler) {
  9173. const origin = opts.origin || this[kUrl].origin
  9174. const request = new Request(origin, opts, handler)
  9175. this[kQueue].push(request)
  9176. if (this[kResuming]) {
  9177. // Do nothing.
  9178. } else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) {
  9179. // Wait a tick in case stream/iterator is ended in the same tick.
  9180. this[kResuming] = 1
  9181. queueMicrotask(() => resume(this))
  9182. } else {
  9183. this[kResume](true)
  9184. }
  9185. if (this[kResuming] && this[kNeedDrain] !== 2 && this[kBusy]) {
  9186. this[kNeedDrain] = 2
  9187. }
  9188. return this[kNeedDrain] < 2
  9189. }
  9190. async [kClose] () {
  9191. // TODO: for H2 we need to gracefully flush the remaining enqueued
  9192. // request and close each stream.
  9193. return new Promise((resolve) => {
  9194. if (this[kSize]) {
  9195. this[kClosedResolve] = resolve
  9196. } else {
  9197. resolve(null)
  9198. }
  9199. })
  9200. }
  9201. async [kDestroy] (err) {
  9202. return new Promise((resolve) => {
  9203. const requests = this[kQueue].splice(this[kPendingIdx])
  9204. for (let i = 0; i < requests.length; i++) {
  9205. const request = requests[i]
  9206. util.errorRequest(this, request, err)
  9207. }
  9208. const callback = () => {
  9209. if (this[kClosedResolve]) {
  9210. // TODO (fix): Should we error here with ClientDestroyedError?
  9211. this[kClosedResolve]()
  9212. this[kClosedResolve] = null
  9213. }
  9214. resolve(null)
  9215. }
  9216. if (this[kHTTPContext]) {
  9217. this[kHTTPContext].destroy(err, callback)
  9218. this[kHTTPContext] = null
  9219. } else {
  9220. queueMicrotask(callback)
  9221. }
  9222. this[kResume]()
  9223. })
  9224. }
  9225. }
  9226. const createRedirectInterceptor = __nccwpck_require__(5092)
  9227. function onError (client, err) {
  9228. if (
  9229. client[kRunning] === 0 &&
  9230. err.code !== 'UND_ERR_INFO' &&
  9231. err.code !== 'UND_ERR_SOCKET'
  9232. ) {
  9233. // Error is not caused by running request and not a recoverable
  9234. // socket error.
  9235. assert(client[kPendingIdx] === client[kRunningIdx])
  9236. const requests = client[kQueue].splice(client[kRunningIdx])
  9237. for (let i = 0; i < requests.length; i++) {
  9238. const request = requests[i]
  9239. util.errorRequest(client, request, err)
  9240. }
  9241. assert(client[kSize] === 0)
  9242. }
  9243. }
  9244. /**
  9245. * @param {Client} client
  9246. * @returns
  9247. */
  9248. async function connect (client) {
  9249. assert(!client[kConnecting])
  9250. assert(!client[kHTTPContext])
  9251. let { host, hostname, protocol, port } = client[kUrl]
  9252. // Resolve ipv6
  9253. if (hostname[0] === '[') {
  9254. const idx = hostname.indexOf(']')
  9255. assert(idx !== -1)
  9256. const ip = hostname.substring(1, idx)
  9257. assert(net.isIP(ip))
  9258. hostname = ip
  9259. }
  9260. client[kConnecting] = true
  9261. if (channels.beforeConnect.hasSubscribers) {
  9262. channels.beforeConnect.publish({
  9263. connectParams: {
  9264. host,
  9265. hostname,
  9266. protocol,
  9267. port,
  9268. version: client[kHTTPContext]?.version,
  9269. servername: client[kServerName],
  9270. localAddress: client[kLocalAddress]
  9271. },
  9272. connector: client[kConnector]
  9273. })
  9274. }
  9275. try {
  9276. const socket = await new Promise((resolve, reject) => {
  9277. client[kConnector]({
  9278. host,
  9279. hostname,
  9280. protocol,
  9281. port,
  9282. servername: client[kServerName],
  9283. localAddress: client[kLocalAddress]
  9284. }, (err, socket) => {
  9285. if (err) {
  9286. reject(err)
  9287. } else {
  9288. resolve(socket)
  9289. }
  9290. })
  9291. })
  9292. if (client.destroyed) {
  9293. util.destroy(socket.on('error', noop), new ClientDestroyedError())
  9294. return
  9295. }
  9296. assert(socket)
  9297. try {
  9298. client[kHTTPContext] = socket.alpnProtocol === 'h2'
  9299. ? await connectH2(client, socket)
  9300. : await connectH1(client, socket)
  9301. } catch (err) {
  9302. socket.destroy().on('error', noop)
  9303. throw err
  9304. }
  9305. client[kConnecting] = false
  9306. socket[kCounter] = 0
  9307. socket[kMaxRequests] = client[kMaxRequests]
  9308. socket[kClient] = client
  9309. socket[kError] = null
  9310. if (channels.connected.hasSubscribers) {
  9311. channels.connected.publish({
  9312. connectParams: {
  9313. host,
  9314. hostname,
  9315. protocol,
  9316. port,
  9317. version: client[kHTTPContext]?.version,
  9318. servername: client[kServerName],
  9319. localAddress: client[kLocalAddress]
  9320. },
  9321. connector: client[kConnector],
  9322. socket
  9323. })
  9324. }
  9325. client.emit('connect', client[kUrl], [client])
  9326. } catch (err) {
  9327. if (client.destroyed) {
  9328. return
  9329. }
  9330. client[kConnecting] = false
  9331. if (channels.connectError.hasSubscribers) {
  9332. channels.connectError.publish({
  9333. connectParams: {
  9334. host,
  9335. hostname,
  9336. protocol,
  9337. port,
  9338. version: client[kHTTPContext]?.version,
  9339. servername: client[kServerName],
  9340. localAddress: client[kLocalAddress]
  9341. },
  9342. connector: client[kConnector],
  9343. error: err
  9344. })
  9345. }
  9346. if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') {
  9347. assert(client[kRunning] === 0)
  9348. while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) {
  9349. const request = client[kQueue][client[kPendingIdx]++]
  9350. util.errorRequest(client, request, err)
  9351. }
  9352. } else {
  9353. onError(client, err)
  9354. }
  9355. client.emit('connectionError', client[kUrl], [client], err)
  9356. }
  9357. client[kResume]()
  9358. }
  9359. function emitDrain (client) {
  9360. client[kNeedDrain] = 0
  9361. client.emit('drain', client[kUrl], [client])
  9362. }
  9363. function resume (client, sync) {
  9364. if (client[kResuming] === 2) {
  9365. return
  9366. }
  9367. client[kResuming] = 2
  9368. _resume(client, sync)
  9369. client[kResuming] = 0
  9370. if (client[kRunningIdx] > 256) {
  9371. client[kQueue].splice(0, client[kRunningIdx])
  9372. client[kPendingIdx] -= client[kRunningIdx]
  9373. client[kRunningIdx] = 0
  9374. }
  9375. }
  9376. function _resume (client, sync) {
  9377. while (true) {
  9378. if (client.destroyed) {
  9379. assert(client[kPending] === 0)
  9380. return
  9381. }
  9382. if (client[kClosedResolve] && !client[kSize]) {
  9383. client[kClosedResolve]()
  9384. client[kClosedResolve] = null
  9385. return
  9386. }
  9387. if (client[kHTTPContext]) {
  9388. client[kHTTPContext].resume()
  9389. }
  9390. if (client[kBusy]) {
  9391. client[kNeedDrain] = 2
  9392. } else if (client[kNeedDrain] === 2) {
  9393. if (sync) {
  9394. client[kNeedDrain] = 1
  9395. queueMicrotask(() => emitDrain(client))
  9396. } else {
  9397. emitDrain(client)
  9398. }
  9399. continue
  9400. }
  9401. if (client[kPending] === 0) {
  9402. return
  9403. }
  9404. if (client[kRunning] >= (getPipelining(client) || 1)) {
  9405. return
  9406. }
  9407. const request = client[kQueue][client[kPendingIdx]]
  9408. if (client[kUrl].protocol === 'https:' && client[kServerName] !== request.servername) {
  9409. if (client[kRunning] > 0) {
  9410. return
  9411. }
  9412. client[kServerName] = request.servername
  9413. client[kHTTPContext]?.destroy(new InformationalError('servername changed'), () => {
  9414. client[kHTTPContext] = null
  9415. resume(client)
  9416. })
  9417. }
  9418. if (client[kConnecting]) {
  9419. return
  9420. }
  9421. if (!client[kHTTPContext]) {
  9422. connect(client)
  9423. return
  9424. }
  9425. if (client[kHTTPContext].destroyed) {
  9426. return
  9427. }
  9428. if (client[kHTTPContext].busy(request)) {
  9429. return
  9430. }
  9431. if (!request.aborted && client[kHTTPContext].write(request)) {
  9432. client[kPendingIdx]++
  9433. } else {
  9434. client[kQueue].splice(client[kPendingIdx], 1)
  9435. }
  9436. }
  9437. }
  9438. module.exports = Client
  9439. /***/ }),
  9440. /***/ 1841:
  9441. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9442. const Dispatcher = __nccwpck_require__(883)
  9443. const {
  9444. ClientDestroyedError,
  9445. ClientClosedError,
  9446. InvalidArgumentError
  9447. } = __nccwpck_require__(8707)
  9448. const { kDestroy, kClose, kClosed, kDestroyed, kDispatch, kInterceptors } = __nccwpck_require__(6443)
  9449. const kOnDestroyed = Symbol('onDestroyed')
  9450. const kOnClosed = Symbol('onClosed')
  9451. const kInterceptedDispatch = Symbol('Intercepted Dispatch')
  9452. const kWebSocketOptions = Symbol('webSocketOptions')
  9453. class DispatcherBase extends Dispatcher {
  9454. constructor (opts) {
  9455. super()
  9456. this[kDestroyed] = false
  9457. this[kOnDestroyed] = null
  9458. this[kClosed] = false
  9459. this[kOnClosed] = []
  9460. this[kWebSocketOptions] = opts?.webSocket ?? {}
  9461. }
  9462. get webSocketOptions () {
  9463. return {
  9464. maxFragments: this[kWebSocketOptions].maxFragments ?? 131072,
  9465. maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
  9466. }
  9467. }
  9468. get destroyed () {
  9469. return this[kDestroyed]
  9470. }
  9471. get closed () {
  9472. return this[kClosed]
  9473. }
  9474. get interceptors () {
  9475. return this[kInterceptors]
  9476. }
  9477. set interceptors (newInterceptors) {
  9478. if (newInterceptors) {
  9479. for (let i = newInterceptors.length - 1; i >= 0; i--) {
  9480. const interceptor = this[kInterceptors][i]
  9481. if (typeof interceptor !== 'function') {
  9482. throw new InvalidArgumentError('interceptor must be an function')
  9483. }
  9484. }
  9485. }
  9486. this[kInterceptors] = newInterceptors
  9487. }
  9488. close (callback) {
  9489. if (callback === undefined) {
  9490. return new Promise((resolve, reject) => {
  9491. this.close((err, data) => {
  9492. return err ? reject(err) : resolve(data)
  9493. })
  9494. })
  9495. }
  9496. if (typeof callback !== 'function') {
  9497. throw new InvalidArgumentError('invalid callback')
  9498. }
  9499. if (this[kDestroyed]) {
  9500. queueMicrotask(() => callback(new ClientDestroyedError(), null))
  9501. return
  9502. }
  9503. if (this[kClosed]) {
  9504. if (this[kOnClosed]) {
  9505. this[kOnClosed].push(callback)
  9506. } else {
  9507. queueMicrotask(() => callback(null, null))
  9508. }
  9509. return
  9510. }
  9511. this[kClosed] = true
  9512. this[kOnClosed].push(callback)
  9513. const onClosed = () => {
  9514. const callbacks = this[kOnClosed]
  9515. this[kOnClosed] = null
  9516. for (let i = 0; i < callbacks.length; i++) {
  9517. callbacks[i](null, null)
  9518. }
  9519. }
  9520. // Should not error.
  9521. this[kClose]()
  9522. .then(() => this.destroy())
  9523. .then(() => {
  9524. queueMicrotask(onClosed)
  9525. })
  9526. }
  9527. destroy (err, callback) {
  9528. if (typeof err === 'function') {
  9529. callback = err
  9530. err = null
  9531. }
  9532. if (callback === undefined) {
  9533. return new Promise((resolve, reject) => {
  9534. this.destroy(err, (err, data) => {
  9535. return err ? /* istanbul ignore next: should never error */ reject(err) : resolve(data)
  9536. })
  9537. })
  9538. }
  9539. if (typeof callback !== 'function') {
  9540. throw new InvalidArgumentError('invalid callback')
  9541. }
  9542. if (this[kDestroyed]) {
  9543. if (this[kOnDestroyed]) {
  9544. this[kOnDestroyed].push(callback)
  9545. } else {
  9546. queueMicrotask(() => callback(null, null))
  9547. }
  9548. return
  9549. }
  9550. if (!err) {
  9551. err = new ClientDestroyedError()
  9552. }
  9553. this[kDestroyed] = true
  9554. this[kOnDestroyed] = this[kOnDestroyed] || []
  9555. this[kOnDestroyed].push(callback)
  9556. const onDestroyed = () => {
  9557. const callbacks = this[kOnDestroyed]
  9558. this[kOnDestroyed] = null
  9559. for (let i = 0; i < callbacks.length; i++) {
  9560. callbacks[i](null, null)
  9561. }
  9562. }
  9563. // Should not error.
  9564. this[kDestroy](err).then(() => {
  9565. queueMicrotask(onDestroyed)
  9566. })
  9567. }
  9568. [kInterceptedDispatch] (opts, handler) {
  9569. if (!this[kInterceptors] || this[kInterceptors].length === 0) {
  9570. this[kInterceptedDispatch] = this[kDispatch]
  9571. return this[kDispatch](opts, handler)
  9572. }
  9573. let dispatch = this[kDispatch].bind(this)
  9574. for (let i = this[kInterceptors].length - 1; i >= 0; i--) {
  9575. dispatch = this[kInterceptors][i](dispatch)
  9576. }
  9577. this[kInterceptedDispatch] = dispatch
  9578. return dispatch(opts, handler)
  9579. }
  9580. dispatch (opts, handler) {
  9581. if (!handler || typeof handler !== 'object') {
  9582. throw new InvalidArgumentError('handler must be an object')
  9583. }
  9584. try {
  9585. if (!opts || typeof opts !== 'object') {
  9586. throw new InvalidArgumentError('opts must be an object.')
  9587. }
  9588. if (this[kDestroyed] || this[kOnDestroyed]) {
  9589. throw new ClientDestroyedError()
  9590. }
  9591. if (this[kClosed]) {
  9592. throw new ClientClosedError()
  9593. }
  9594. return this[kInterceptedDispatch](opts, handler)
  9595. } catch (err) {
  9596. if (typeof handler.onError !== 'function') {
  9597. throw new InvalidArgumentError('invalid onError method')
  9598. }
  9599. handler.onError(err)
  9600. return false
  9601. }
  9602. }
  9603. }
  9604. module.exports = DispatcherBase
  9605. /***/ }),
  9606. /***/ 883:
  9607. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9608. const EventEmitter = __nccwpck_require__(8474)
  9609. class Dispatcher extends EventEmitter {
  9610. dispatch () {
  9611. throw new Error('not implemented')
  9612. }
  9613. close () {
  9614. throw new Error('not implemented')
  9615. }
  9616. destroy () {
  9617. throw new Error('not implemented')
  9618. }
  9619. compose (...args) {
  9620. // So we handle [interceptor1, interceptor2] or interceptor1, interceptor2, ...
  9621. const interceptors = Array.isArray(args[0]) ? args[0] : args
  9622. let dispatch = this.dispatch.bind(this)
  9623. for (const interceptor of interceptors) {
  9624. if (interceptor == null) {
  9625. continue
  9626. }
  9627. if (typeof interceptor !== 'function') {
  9628. throw new TypeError(`invalid interceptor, expected function received ${typeof interceptor}`)
  9629. }
  9630. dispatch = interceptor(dispatch)
  9631. if (dispatch == null || typeof dispatch !== 'function' || dispatch.length !== 2) {
  9632. throw new TypeError('invalid interceptor')
  9633. }
  9634. }
  9635. return new ComposedDispatcher(this, dispatch)
  9636. }
  9637. }
  9638. class ComposedDispatcher extends Dispatcher {
  9639. #dispatcher = null
  9640. #dispatch = null
  9641. constructor (dispatcher, dispatch) {
  9642. super()
  9643. this.#dispatcher = dispatcher
  9644. this.#dispatch = dispatch
  9645. }
  9646. dispatch (...args) {
  9647. this.#dispatch(...args)
  9648. }
  9649. close (...args) {
  9650. return this.#dispatcher.close(...args)
  9651. }
  9652. destroy (...args) {
  9653. return this.#dispatcher.destroy(...args)
  9654. }
  9655. }
  9656. module.exports = Dispatcher
  9657. /***/ }),
  9658. /***/ 3137:
  9659. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9660. const DispatcherBase = __nccwpck_require__(1841)
  9661. const { kClose, kDestroy, kClosed, kDestroyed, kDispatch, kNoProxyAgent, kHttpProxyAgent, kHttpsProxyAgent } = __nccwpck_require__(6443)
  9662. const ProxyAgent = __nccwpck_require__(6672)
  9663. const Agent = __nccwpck_require__(7405)
  9664. const DEFAULT_PORTS = {
  9665. 'http:': 80,
  9666. 'https:': 443
  9667. }
  9668. let experimentalWarned = false
  9669. class EnvHttpProxyAgent extends DispatcherBase {
  9670. #noProxyValue = null
  9671. #noProxyEntries = null
  9672. #opts = null
  9673. constructor (opts = {}) {
  9674. super()
  9675. this.#opts = opts
  9676. if (!experimentalWarned) {
  9677. experimentalWarned = true
  9678. process.emitWarning('EnvHttpProxyAgent is experimental, expect them to change at any time.', {
  9679. code: 'UNDICI-EHPA'
  9680. })
  9681. }
  9682. const { httpProxy, httpsProxy, noProxy, ...agentOpts } = opts
  9683. this[kNoProxyAgent] = new Agent(agentOpts)
  9684. const HTTP_PROXY = httpProxy ?? process.env.http_proxy ?? process.env.HTTP_PROXY
  9685. if (HTTP_PROXY) {
  9686. this[kHttpProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTP_PROXY })
  9687. } else {
  9688. this[kHttpProxyAgent] = this[kNoProxyAgent]
  9689. }
  9690. const HTTPS_PROXY = httpsProxy ?? process.env.https_proxy ?? process.env.HTTPS_PROXY
  9691. if (HTTPS_PROXY) {
  9692. this[kHttpsProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTPS_PROXY })
  9693. } else {
  9694. this[kHttpsProxyAgent] = this[kHttpProxyAgent]
  9695. }
  9696. this.#parseNoProxy()
  9697. }
  9698. [kDispatch] (opts, handler) {
  9699. const url = new URL(opts.origin)
  9700. const agent = this.#getProxyAgentForUrl(url)
  9701. return agent.dispatch(opts, handler)
  9702. }
  9703. async [kClose] () {
  9704. await this[kNoProxyAgent].close()
  9705. if (!this[kHttpProxyAgent][kClosed]) {
  9706. await this[kHttpProxyAgent].close()
  9707. }
  9708. if (!this[kHttpsProxyAgent][kClosed]) {
  9709. await this[kHttpsProxyAgent].close()
  9710. }
  9711. }
  9712. async [kDestroy] (err) {
  9713. await this[kNoProxyAgent].destroy(err)
  9714. if (!this[kHttpProxyAgent][kDestroyed]) {
  9715. await this[kHttpProxyAgent].destroy(err)
  9716. }
  9717. if (!this[kHttpsProxyAgent][kDestroyed]) {
  9718. await this[kHttpsProxyAgent].destroy(err)
  9719. }
  9720. }
  9721. #getProxyAgentForUrl (url) {
  9722. let { protocol, host: hostname, port } = url
  9723. // Stripping ports in this way instead of using parsedUrl.hostname to make
  9724. // sure that the brackets around IPv6 addresses are kept.
  9725. hostname = hostname.replace(/:\d*$/, '').toLowerCase()
  9726. port = Number.parseInt(port, 10) || DEFAULT_PORTS[protocol] || 0
  9727. if (!this.#shouldProxy(hostname, port)) {
  9728. return this[kNoProxyAgent]
  9729. }
  9730. if (protocol === 'https:') {
  9731. return this[kHttpsProxyAgent]
  9732. }
  9733. return this[kHttpProxyAgent]
  9734. }
  9735. #shouldProxy (hostname, port) {
  9736. if (this.#noProxyChanged) {
  9737. this.#parseNoProxy()
  9738. }
  9739. if (this.#noProxyEntries.length === 0) {
  9740. return true // Always proxy if NO_PROXY is not set or empty.
  9741. }
  9742. if (this.#noProxyValue === '*') {
  9743. return false // Never proxy if wildcard is set.
  9744. }
  9745. for (let i = 0; i < this.#noProxyEntries.length; i++) {
  9746. const entry = this.#noProxyEntries[i]
  9747. if (entry.port && entry.port !== port) {
  9748. continue // Skip if ports don't match.
  9749. }
  9750. if (!/^[.*]/.test(entry.hostname)) {
  9751. // No wildcards, so don't proxy only if there is not an exact match.
  9752. if (hostname === entry.hostname) {
  9753. return false
  9754. }
  9755. } else {
  9756. // Don't proxy if the hostname ends with the no_proxy host.
  9757. if (hostname.endsWith(entry.hostname.replace(/^\*/, ''))) {
  9758. return false
  9759. }
  9760. }
  9761. }
  9762. return true
  9763. }
  9764. #parseNoProxy () {
  9765. const noProxyValue = this.#opts.noProxy ?? this.#noProxyEnv
  9766. const noProxySplit = noProxyValue.split(/[,\s]/)
  9767. const noProxyEntries = []
  9768. for (let i = 0; i < noProxySplit.length; i++) {
  9769. const entry = noProxySplit[i]
  9770. if (!entry) {
  9771. continue
  9772. }
  9773. const parsed = entry.match(/^(.+):(\d+)$/)
  9774. noProxyEntries.push({
  9775. hostname: (parsed ? parsed[1] : entry).toLowerCase(),
  9776. port: parsed ? Number.parseInt(parsed[2], 10) : 0
  9777. })
  9778. }
  9779. this.#noProxyValue = noProxyValue
  9780. this.#noProxyEntries = noProxyEntries
  9781. }
  9782. get #noProxyChanged () {
  9783. if (this.#opts.noProxy !== undefined) {
  9784. return false
  9785. }
  9786. return this.#noProxyValue !== this.#noProxyEnv
  9787. }
  9788. get #noProxyEnv () {
  9789. return process.env.no_proxy ?? process.env.NO_PROXY ?? ''
  9790. }
  9791. }
  9792. module.exports = EnvHttpProxyAgent
  9793. /***/ }),
  9794. /***/ 4660:
  9795. /***/ ((module) => {
  9796. /* eslint-disable */
  9797. // Extracted from node/lib/internal/fixed_queue.js
  9798. // Currently optimal queue size, tested on V8 6.0 - 6.6. Must be power of two.
  9799. const kSize = 2048;
  9800. const kMask = kSize - 1;
  9801. // The FixedQueue is implemented as a singly-linked list of fixed-size
  9802. // circular buffers. It looks something like this:
  9803. //
  9804. // head tail
  9805. // | |
  9806. // v v
  9807. // +-----------+ <-----\ +-----------+ <------\ +-----------+
  9808. // | [null] | \----- | next | \------- | next |
  9809. // +-----------+ +-----------+ +-----------+
  9810. // | item | <-- bottom | item | <-- bottom | [empty] |
  9811. // | item | | item | | [empty] |
  9812. // | item | | item | | [empty] |
  9813. // | item | | item | | [empty] |
  9814. // | item | | item | bottom --> | item |
  9815. // | item | | item | | item |
  9816. // | ... | | ... | | ... |
  9817. // | item | | item | | item |
  9818. // | item | | item | | item |
  9819. // | [empty] | <-- top | item | | item |
  9820. // | [empty] | | item | | item |
  9821. // | [empty] | | [empty] | <-- top top --> | [empty] |
  9822. // +-----------+ +-----------+ +-----------+
  9823. //
  9824. // Or, if there is only one circular buffer, it looks something
  9825. // like either of these:
  9826. //
  9827. // head tail head tail
  9828. // | | | |
  9829. // v v v v
  9830. // +-----------+ +-----------+
  9831. // | [null] | | [null] |
  9832. // +-----------+ +-----------+
  9833. // | [empty] | | item |
  9834. // | [empty] | | item |
  9835. // | item | <-- bottom top --> | [empty] |
  9836. // | item | | [empty] |
  9837. // | [empty] | <-- top bottom --> | item |
  9838. // | [empty] | | item |
  9839. // +-----------+ +-----------+
  9840. //
  9841. // Adding a value means moving `top` forward by one, removing means
  9842. // moving `bottom` forward by one. After reaching the end, the queue
  9843. // wraps around.
  9844. //
  9845. // When `top === bottom` the current queue is empty and when
  9846. // `top + 1 === bottom` it's full. This wastes a single space of storage
  9847. // but allows much quicker checks.
  9848. class FixedCircularBuffer {
  9849. constructor() {
  9850. this.bottom = 0;
  9851. this.top = 0;
  9852. this.list = new Array(kSize);
  9853. this.next = null;
  9854. }
  9855. isEmpty() {
  9856. return this.top === this.bottom;
  9857. }
  9858. isFull() {
  9859. return ((this.top + 1) & kMask) === this.bottom;
  9860. }
  9861. push(data) {
  9862. this.list[this.top] = data;
  9863. this.top = (this.top + 1) & kMask;
  9864. }
  9865. shift() {
  9866. const nextItem = this.list[this.bottom];
  9867. if (nextItem === undefined)
  9868. return null;
  9869. this.list[this.bottom] = undefined;
  9870. this.bottom = (this.bottom + 1) & kMask;
  9871. return nextItem;
  9872. }
  9873. }
  9874. module.exports = class FixedQueue {
  9875. constructor() {
  9876. this.head = this.tail = new FixedCircularBuffer();
  9877. }
  9878. isEmpty() {
  9879. return this.head.isEmpty();
  9880. }
  9881. push(data) {
  9882. if (this.head.isFull()) {
  9883. // Head is full: Creates a new queue, sets the old queue's `.next` to it,
  9884. // and sets it as the new main queue.
  9885. this.head = this.head.next = new FixedCircularBuffer();
  9886. }
  9887. this.head.push(data);
  9888. }
  9889. shift() {
  9890. const tail = this.tail;
  9891. const next = tail.shift();
  9892. if (tail.isEmpty() && tail.next !== null) {
  9893. // If there is another queue, it forms the new tail.
  9894. this.tail = tail.next;
  9895. }
  9896. return next;
  9897. }
  9898. };
  9899. /***/ }),
  9900. /***/ 2128:
  9901. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9902. const DispatcherBase = __nccwpck_require__(1841)
  9903. const FixedQueue = __nccwpck_require__(4660)
  9904. const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(6443)
  9905. const PoolStats = __nccwpck_require__(3246)
  9906. const kClients = Symbol('clients')
  9907. const kNeedDrain = Symbol('needDrain')
  9908. const kQueue = Symbol('queue')
  9909. const kClosedResolve = Symbol('closed resolve')
  9910. const kOnDrain = Symbol('onDrain')
  9911. const kOnConnect = Symbol('onConnect')
  9912. const kOnDisconnect = Symbol('onDisconnect')
  9913. const kOnConnectionError = Symbol('onConnectionError')
  9914. const kGetDispatcher = Symbol('get dispatcher')
  9915. const kAddClient = Symbol('add client')
  9916. const kRemoveClient = Symbol('remove client')
  9917. const kStats = Symbol('stats')
  9918. class PoolBase extends DispatcherBase {
  9919. constructor (opts) {
  9920. super(opts)
  9921. this[kQueue] = new FixedQueue()
  9922. this[kClients] = []
  9923. this[kQueued] = 0
  9924. const pool = this
  9925. this[kOnDrain] = function onDrain (origin, targets) {
  9926. const queue = pool[kQueue]
  9927. let needDrain = false
  9928. while (!needDrain) {
  9929. const item = queue.shift()
  9930. if (!item) {
  9931. break
  9932. }
  9933. pool[kQueued]--
  9934. needDrain = !this.dispatch(item.opts, item.handler)
  9935. }
  9936. this[kNeedDrain] = needDrain
  9937. if (!this[kNeedDrain] && pool[kNeedDrain]) {
  9938. pool[kNeedDrain] = false
  9939. pool.emit('drain', origin, [pool, ...targets])
  9940. }
  9941. if (pool[kClosedResolve] && queue.isEmpty()) {
  9942. Promise
  9943. .all(pool[kClients].map(c => c.close()))
  9944. .then(pool[kClosedResolve])
  9945. }
  9946. }
  9947. this[kOnConnect] = (origin, targets) => {
  9948. pool.emit('connect', origin, [pool, ...targets])
  9949. }
  9950. this[kOnDisconnect] = (origin, targets, err) => {
  9951. pool.emit('disconnect', origin, [pool, ...targets], err)
  9952. }
  9953. this[kOnConnectionError] = (origin, targets, err) => {
  9954. pool.emit('connectionError', origin, [pool, ...targets], err)
  9955. }
  9956. this[kStats] = new PoolStats(this)
  9957. }
  9958. get [kBusy] () {
  9959. return this[kNeedDrain]
  9960. }
  9961. get [kConnected] () {
  9962. return this[kClients].filter(client => client[kConnected]).length
  9963. }
  9964. get [kFree] () {
  9965. return this[kClients].filter(client => client[kConnected] && !client[kNeedDrain]).length
  9966. }
  9967. get [kPending] () {
  9968. let ret = this[kQueued]
  9969. for (const { [kPending]: pending } of this[kClients]) {
  9970. ret += pending
  9971. }
  9972. return ret
  9973. }
  9974. get [kRunning] () {
  9975. let ret = 0
  9976. for (const { [kRunning]: running } of this[kClients]) {
  9977. ret += running
  9978. }
  9979. return ret
  9980. }
  9981. get [kSize] () {
  9982. let ret = this[kQueued]
  9983. for (const { [kSize]: size } of this[kClients]) {
  9984. ret += size
  9985. }
  9986. return ret
  9987. }
  9988. get stats () {
  9989. return this[kStats]
  9990. }
  9991. async [kClose] () {
  9992. if (this[kQueue].isEmpty()) {
  9993. await Promise.all(this[kClients].map(c => c.close()))
  9994. } else {
  9995. await new Promise((resolve) => {
  9996. this[kClosedResolve] = resolve
  9997. })
  9998. }
  9999. }
  10000. async [kDestroy] (err) {
  10001. while (true) {
  10002. const item = this[kQueue].shift()
  10003. if (!item) {
  10004. break
  10005. }
  10006. item.handler.onError(err)
  10007. }
  10008. await Promise.all(this[kClients].map(c => c.destroy(err)))
  10009. }
  10010. [kDispatch] (opts, handler) {
  10011. const dispatcher = this[kGetDispatcher]()
  10012. if (!dispatcher) {
  10013. this[kNeedDrain] = true
  10014. this[kQueue].push({ opts, handler })
  10015. this[kQueued]++
  10016. } else if (!dispatcher.dispatch(opts, handler)) {
  10017. dispatcher[kNeedDrain] = true
  10018. this[kNeedDrain] = !this[kGetDispatcher]()
  10019. }
  10020. return !this[kNeedDrain]
  10021. }
  10022. [kAddClient] (client) {
  10023. client
  10024. .on('drain', this[kOnDrain])
  10025. .on('connect', this[kOnConnect])
  10026. .on('disconnect', this[kOnDisconnect])
  10027. .on('connectionError', this[kOnConnectionError])
  10028. this[kClients].push(client)
  10029. if (this[kNeedDrain]) {
  10030. queueMicrotask(() => {
  10031. if (this[kNeedDrain]) {
  10032. this[kOnDrain](client[kUrl], [this, client])
  10033. }
  10034. })
  10035. }
  10036. return this
  10037. }
  10038. [kRemoveClient] (client) {
  10039. client.close(() => {
  10040. const idx = this[kClients].indexOf(client)
  10041. if (idx !== -1) {
  10042. this[kClients].splice(idx, 1)
  10043. }
  10044. })
  10045. this[kNeedDrain] = this[kClients].some(dispatcher => (
  10046. !dispatcher[kNeedDrain] &&
  10047. dispatcher.closed !== true &&
  10048. dispatcher.destroyed !== true
  10049. ))
  10050. }
  10051. }
  10052. module.exports = {
  10053. PoolBase,
  10054. kClients,
  10055. kNeedDrain,
  10056. kAddClient,
  10057. kRemoveClient,
  10058. kGetDispatcher
  10059. }
  10060. /***/ }),
  10061. /***/ 3246:
  10062. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10063. const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(6443)
  10064. const kPool = Symbol('pool')
  10065. class PoolStats {
  10066. constructor (pool) {
  10067. this[kPool] = pool
  10068. }
  10069. get connected () {
  10070. return this[kPool][kConnected]
  10071. }
  10072. get free () {
  10073. return this[kPool][kFree]
  10074. }
  10075. get pending () {
  10076. return this[kPool][kPending]
  10077. }
  10078. get queued () {
  10079. return this[kPool][kQueued]
  10080. }
  10081. get running () {
  10082. return this[kPool][kRunning]
  10083. }
  10084. get size () {
  10085. return this[kPool][kSize]
  10086. }
  10087. }
  10088. module.exports = PoolStats
  10089. /***/ }),
  10090. /***/ 628:
  10091. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10092. const {
  10093. PoolBase,
  10094. kClients,
  10095. kNeedDrain,
  10096. kAddClient,
  10097. kGetDispatcher
  10098. } = __nccwpck_require__(2128)
  10099. const Client = __nccwpck_require__(3701)
  10100. const {
  10101. InvalidArgumentError
  10102. } = __nccwpck_require__(8707)
  10103. const util = __nccwpck_require__(3440)
  10104. const { kUrl, kInterceptors } = __nccwpck_require__(6443)
  10105. const buildConnector = __nccwpck_require__(9136)
  10106. const kOptions = Symbol('options')
  10107. const kConnections = Symbol('connections')
  10108. const kFactory = Symbol('factory')
  10109. function defaultFactory (origin, opts) {
  10110. return new Client(origin, opts)
  10111. }
  10112. class Pool extends PoolBase {
  10113. constructor (origin, {
  10114. connections,
  10115. factory = defaultFactory,
  10116. connect,
  10117. connectTimeout,
  10118. tls,
  10119. maxCachedSessions,
  10120. socketPath,
  10121. autoSelectFamily,
  10122. autoSelectFamilyAttemptTimeout,
  10123. allowH2,
  10124. ...options
  10125. } = {}) {
  10126. if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
  10127. throw new InvalidArgumentError('invalid connections')
  10128. }
  10129. if (typeof factory !== 'function') {
  10130. throw new InvalidArgumentError('factory must be a function.')
  10131. }
  10132. if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
  10133. throw new InvalidArgumentError('connect must be a function or an object')
  10134. }
  10135. if (typeof connect !== 'function') {
  10136. connect = buildConnector({
  10137. ...tls,
  10138. maxCachedSessions,
  10139. allowH2,
  10140. socketPath,
  10141. timeout: connectTimeout,
  10142. ...(autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined),
  10143. ...connect
  10144. })
  10145. }
  10146. super(options)
  10147. this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool)
  10148. ? options.interceptors.Pool
  10149. : []
  10150. this[kConnections] = connections || null
  10151. this[kUrl] = util.parseOrigin(origin)
  10152. this[kOptions] = { ...util.deepClone(options), connect, allowH2 }
  10153. this[kOptions].interceptors = options.interceptors
  10154. ? { ...options.interceptors }
  10155. : undefined
  10156. this[kFactory] = factory
  10157. this.on('connectionError', (origin, targets, error) => {
  10158. // If a connection error occurs, we remove the client from the pool,
  10159. // and emit a connectionError event. They will not be re-used.
  10160. // Fixes https://github.com/nodejs/undici/issues/3895
  10161. for (const target of targets) {
  10162. // Do not use kRemoveClient here, as it will close the client,
  10163. // but the client cannot be closed in this state.
  10164. const idx = this[kClients].indexOf(target)
  10165. if (idx !== -1) {
  10166. this[kClients].splice(idx, 1)
  10167. }
  10168. }
  10169. })
  10170. }
  10171. [kGetDispatcher] () {
  10172. for (const client of this[kClients]) {
  10173. if (!client[kNeedDrain]) {
  10174. return client
  10175. }
  10176. }
  10177. if (!this[kConnections] || this[kClients].length < this[kConnections]) {
  10178. const dispatcher = this[kFactory](this[kUrl], this[kOptions])
  10179. this[kAddClient](dispatcher)
  10180. return dispatcher
  10181. }
  10182. }
  10183. }
  10184. module.exports = Pool
  10185. /***/ }),
  10186. /***/ 6672:
  10187. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10188. const { kProxy, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(6443)
  10189. const { URL } = __nccwpck_require__(3136)
  10190. const Agent = __nccwpck_require__(7405)
  10191. const Pool = __nccwpck_require__(628)
  10192. const DispatcherBase = __nccwpck_require__(1841)
  10193. const { InvalidArgumentError, RequestAbortedError, SecureProxyConnectionError } = __nccwpck_require__(8707)
  10194. const buildConnector = __nccwpck_require__(9136)
  10195. const Client = __nccwpck_require__(3701)
  10196. const kAgent = Symbol('proxy agent')
  10197. const kClient = Symbol('proxy client')
  10198. const kProxyHeaders = Symbol('proxy headers')
  10199. const kRequestTls = Symbol('request tls settings')
  10200. const kProxyTls = Symbol('proxy tls settings')
  10201. const kConnectEndpoint = Symbol('connect endpoint function')
  10202. const kTunnelProxy = Symbol('tunnel proxy')
  10203. function defaultProtocolPort (protocol) {
  10204. return protocol === 'https:' ? 443 : 80
  10205. }
  10206. function defaultFactory (origin, opts) {
  10207. return new Pool(origin, opts)
  10208. }
  10209. const noop = () => {}
  10210. function defaultAgentFactory (origin, opts) {
  10211. if (opts.connections === 1) {
  10212. return new Client(origin, opts)
  10213. }
  10214. return new Pool(origin, opts)
  10215. }
  10216. class Http1ProxyWrapper extends DispatcherBase {
  10217. #client
  10218. constructor (proxyUrl, { headers = {}, connect, factory }) {
  10219. super()
  10220. if (!proxyUrl) {
  10221. throw new InvalidArgumentError('Proxy URL is mandatory')
  10222. }
  10223. this[kProxyHeaders] = headers
  10224. if (factory) {
  10225. this.#client = factory(proxyUrl, { connect })
  10226. } else {
  10227. this.#client = new Client(proxyUrl, { connect })
  10228. }
  10229. }
  10230. [kDispatch] (opts, handler) {
  10231. const onHeaders = handler.onHeaders
  10232. handler.onHeaders = function (statusCode, data, resume) {
  10233. if (statusCode === 407) {
  10234. if (typeof handler.onError === 'function') {
  10235. handler.onError(new InvalidArgumentError('Proxy Authentication Required (407)'))
  10236. }
  10237. return
  10238. }
  10239. if (onHeaders) onHeaders.call(this, statusCode, data, resume)
  10240. }
  10241. // Rewrite request as an HTTP1 Proxy request, without tunneling.
  10242. const {
  10243. origin,
  10244. path = '/',
  10245. headers = {}
  10246. } = opts
  10247. opts.path = origin + path
  10248. if (!('host' in headers) && !('Host' in headers)) {
  10249. const { host } = new URL(origin)
  10250. headers.host = host
  10251. }
  10252. opts.headers = { ...this[kProxyHeaders], ...headers }
  10253. return this.#client[kDispatch](opts, handler)
  10254. }
  10255. async [kClose] () {
  10256. return this.#client.close()
  10257. }
  10258. async [kDestroy] (err) {
  10259. return this.#client.destroy(err)
  10260. }
  10261. }
  10262. class ProxyAgent extends DispatcherBase {
  10263. constructor (opts) {
  10264. super()
  10265. if (!opts || (typeof opts === 'object' && !(opts instanceof URL) && !opts.uri)) {
  10266. throw new InvalidArgumentError('Proxy uri is mandatory')
  10267. }
  10268. const { clientFactory = defaultFactory } = opts
  10269. if (typeof clientFactory !== 'function') {
  10270. throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.')
  10271. }
  10272. const { proxyTunnel = true } = opts
  10273. const url = this.#getUrl(opts)
  10274. const { href, origin, port, protocol, username, password, hostname: proxyHostname } = url
  10275. this[kProxy] = { uri: href, protocol }
  10276. this[kInterceptors] = opts.interceptors?.ProxyAgent && Array.isArray(opts.interceptors.ProxyAgent)
  10277. ? opts.interceptors.ProxyAgent
  10278. : []
  10279. this[kRequestTls] = opts.requestTls
  10280. this[kProxyTls] = opts.proxyTls
  10281. this[kProxyHeaders] = opts.headers || {}
  10282. this[kTunnelProxy] = proxyTunnel
  10283. if (opts.auth && opts.token) {
  10284. throw new InvalidArgumentError('opts.auth cannot be used in combination with opts.token')
  10285. } else if (opts.auth) {
  10286. /* @deprecated in favour of opts.token */
  10287. this[kProxyHeaders]['proxy-authorization'] = `Basic ${opts.auth}`
  10288. } else if (opts.token) {
  10289. this[kProxyHeaders]['proxy-authorization'] = opts.token
  10290. } else if (username && password) {
  10291. this[kProxyHeaders]['proxy-authorization'] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString('base64')}`
  10292. }
  10293. const connect = buildConnector({ ...opts.proxyTls })
  10294. this[kConnectEndpoint] = buildConnector({ ...opts.requestTls })
  10295. const agentFactory = opts.factory || defaultAgentFactory
  10296. const factory = (origin, options) => {
  10297. const { protocol } = new URL(origin)
  10298. if (!this[kTunnelProxy] && protocol === 'http:' && this[kProxy].protocol === 'http:') {
  10299. return new Http1ProxyWrapper(this[kProxy].uri, {
  10300. headers: this[kProxyHeaders],
  10301. connect,
  10302. factory: agentFactory
  10303. })
  10304. }
  10305. return agentFactory(origin, options)
  10306. }
  10307. this[kClient] = clientFactory(url, { connect })
  10308. this[kAgent] = new Agent({
  10309. ...opts,
  10310. factory,
  10311. connect: async (opts, callback) => {
  10312. let requestedPath = opts.host
  10313. if (!opts.port) {
  10314. requestedPath += `:${defaultProtocolPort(opts.protocol)}`
  10315. }
  10316. try {
  10317. const { socket, statusCode } = await this[kClient].connect({
  10318. origin,
  10319. port,
  10320. path: requestedPath,
  10321. signal: opts.signal,
  10322. headers: {
  10323. ...this[kProxyHeaders],
  10324. host: opts.host
  10325. },
  10326. servername: this[kProxyTls]?.servername || proxyHostname
  10327. })
  10328. if (statusCode !== 200) {
  10329. socket.on('error', noop).destroy()
  10330. callback(new RequestAbortedError(`Proxy response (${statusCode}) !== 200 when HTTP Tunneling`))
  10331. }
  10332. if (opts.protocol !== 'https:') {
  10333. callback(null, socket)
  10334. return
  10335. }
  10336. let servername
  10337. if (this[kRequestTls]) {
  10338. servername = this[kRequestTls].servername
  10339. } else {
  10340. servername = opts.servername
  10341. }
  10342. this[kConnectEndpoint]({ ...opts, servername, httpSocket: socket }, callback)
  10343. } catch (err) {
  10344. if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') {
  10345. // Throw a custom error to avoid loop in client.js#connect
  10346. callback(new SecureProxyConnectionError(err))
  10347. } else {
  10348. callback(err)
  10349. }
  10350. }
  10351. }
  10352. })
  10353. }
  10354. dispatch (opts, handler) {
  10355. const headers = buildHeaders(opts.headers)
  10356. throwIfProxyAuthIsSent(headers)
  10357. if (headers && !('host' in headers) && !('Host' in headers)) {
  10358. const { host } = new URL(opts.origin)
  10359. headers.host = host
  10360. }
  10361. return this[kAgent].dispatch(
  10362. {
  10363. ...opts,
  10364. headers
  10365. },
  10366. handler
  10367. )
  10368. }
  10369. /**
  10370. * @param {import('../types/proxy-agent').ProxyAgent.Options | string | URL} opts
  10371. * @returns {URL}
  10372. */
  10373. #getUrl (opts) {
  10374. if (typeof opts === 'string') {
  10375. return new URL(opts)
  10376. } else if (opts instanceof URL) {
  10377. return opts
  10378. } else {
  10379. return new URL(opts.uri)
  10380. }
  10381. }
  10382. async [kClose] () {
  10383. await this[kAgent].close()
  10384. await this[kClient].close()
  10385. }
  10386. async [kDestroy] () {
  10387. await this[kAgent].destroy()
  10388. await this[kClient].destroy()
  10389. }
  10390. }
  10391. /**
  10392. * @param {string[] | Record<string, string>} headers
  10393. * @returns {Record<string, string>}
  10394. */
  10395. function buildHeaders (headers) {
  10396. // When using undici.fetch, the headers list is stored
  10397. // as an array.
  10398. if (Array.isArray(headers)) {
  10399. /** @type {Record<string, string>} */
  10400. const headersPair = {}
  10401. for (let i = 0; i < headers.length; i += 2) {
  10402. headersPair[headers[i]] = headers[i + 1]
  10403. }
  10404. return headersPair
  10405. }
  10406. return headers
  10407. }
  10408. /**
  10409. * @param {Record<string, string>} headers
  10410. *
  10411. * Previous versions of ProxyAgent suggests the Proxy-Authorization in request headers
  10412. * Nevertheless, it was changed and to avoid a security vulnerability by end users
  10413. * this check was created.
  10414. * It should be removed in the next major version for performance reasons
  10415. */
  10416. function throwIfProxyAuthIsSent (headers) {
  10417. const existProxyAuth = headers && Object.keys(headers)
  10418. .find((key) => key.toLowerCase() === 'proxy-authorization')
  10419. if (existProxyAuth) {
  10420. throw new InvalidArgumentError('Proxy-Authorization should be sent in ProxyAgent constructor')
  10421. }
  10422. }
  10423. module.exports = ProxyAgent
  10424. /***/ }),
  10425. /***/ 50:
  10426. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10427. const Dispatcher = __nccwpck_require__(883)
  10428. const RetryHandler = __nccwpck_require__(7816)
  10429. class RetryAgent extends Dispatcher {
  10430. #agent = null
  10431. #options = null
  10432. constructor (agent, options = {}) {
  10433. super(options)
  10434. this.#agent = agent
  10435. this.#options = options
  10436. }
  10437. dispatch (opts, handler) {
  10438. const retry = new RetryHandler({
  10439. ...opts,
  10440. retryOptions: this.#options
  10441. }, {
  10442. dispatch: this.#agent.dispatch.bind(this.#agent),
  10443. handler
  10444. })
  10445. return this.#agent.dispatch(opts, retry)
  10446. }
  10447. close () {
  10448. return this.#agent.close()
  10449. }
  10450. destroy () {
  10451. return this.#agent.destroy()
  10452. }
  10453. }
  10454. module.exports = RetryAgent
  10455. /***/ }),
  10456. /***/ 2581:
  10457. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10458. // We include a version number for the Dispatcher API. In case of breaking changes,
  10459. // this version number must be increased to avoid conflicts.
  10460. const globalDispatcher = Symbol.for('undici.globalDispatcher.1')
  10461. const { InvalidArgumentError } = __nccwpck_require__(8707)
  10462. const Agent = __nccwpck_require__(7405)
  10463. if (getGlobalDispatcher() === undefined) {
  10464. setGlobalDispatcher(new Agent())
  10465. }
  10466. function setGlobalDispatcher (agent) {
  10467. if (!agent || typeof agent.dispatch !== 'function') {
  10468. throw new InvalidArgumentError('Argument agent must implement Agent')
  10469. }
  10470. Object.defineProperty(globalThis, globalDispatcher, {
  10471. value: agent,
  10472. writable: true,
  10473. enumerable: false,
  10474. configurable: false
  10475. })
  10476. }
  10477. function getGlobalDispatcher () {
  10478. return globalThis[globalDispatcher]
  10479. }
  10480. module.exports = {
  10481. setGlobalDispatcher,
  10482. getGlobalDispatcher
  10483. }
  10484. /***/ }),
  10485. /***/ 8155:
  10486. /***/ ((module) => {
  10487. module.exports = class DecoratorHandler {
  10488. #handler
  10489. constructor (handler) {
  10490. if (typeof handler !== 'object' || handler === null) {
  10491. throw new TypeError('handler must be an object')
  10492. }
  10493. this.#handler = handler
  10494. }
  10495. onConnect (...args) {
  10496. return this.#handler.onConnect?.(...args)
  10497. }
  10498. onError (...args) {
  10499. return this.#handler.onError?.(...args)
  10500. }
  10501. onUpgrade (...args) {
  10502. return this.#handler.onUpgrade?.(...args)
  10503. }
  10504. onResponseStarted (...args) {
  10505. return this.#handler.onResponseStarted?.(...args)
  10506. }
  10507. onHeaders (...args) {
  10508. return this.#handler.onHeaders?.(...args)
  10509. }
  10510. onData (...args) {
  10511. return this.#handler.onData?.(...args)
  10512. }
  10513. onComplete (...args) {
  10514. return this.#handler.onComplete?.(...args)
  10515. }
  10516. onBodySent (...args) {
  10517. return this.#handler.onBodySent?.(...args)
  10518. }
  10519. }
  10520. /***/ }),
  10521. /***/ 8754:
  10522. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10523. const util = __nccwpck_require__(3440)
  10524. const { kBodyUsed } = __nccwpck_require__(6443)
  10525. const assert = __nccwpck_require__(4589)
  10526. const { InvalidArgumentError } = __nccwpck_require__(8707)
  10527. const EE = __nccwpck_require__(8474)
  10528. const redirectableStatusCodes = [300, 301, 302, 303, 307, 308]
  10529. const kBody = Symbol('body')
  10530. class BodyAsyncIterable {
  10531. constructor (body) {
  10532. this[kBody] = body
  10533. this[kBodyUsed] = false
  10534. }
  10535. async * [Symbol.asyncIterator] () {
  10536. assert(!this[kBodyUsed], 'disturbed')
  10537. this[kBodyUsed] = true
  10538. yield * this[kBody]
  10539. }
  10540. }
  10541. class RedirectHandler {
  10542. constructor (dispatch, maxRedirections, opts, handler) {
  10543. if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
  10544. throw new InvalidArgumentError('maxRedirections must be a positive number')
  10545. }
  10546. util.validateHandler(handler, opts.method, opts.upgrade)
  10547. this.dispatch = dispatch
  10548. this.location = null
  10549. this.abort = null
  10550. this.opts = { ...opts, maxRedirections: 0 } // opts must be a copy
  10551. this.maxRedirections = maxRedirections
  10552. this.handler = handler
  10553. this.history = []
  10554. this.redirectionLimitReached = false
  10555. if (util.isStream(this.opts.body)) {
  10556. // TODO (fix): Provide some way for the user to cache the file to e.g. /tmp
  10557. // so that it can be dispatched again?
  10558. // TODO (fix): Do we need 100-expect support to provide a way to do this properly?
  10559. if (util.bodyLength(this.opts.body) === 0) {
  10560. this.opts.body
  10561. .on('data', function () {
  10562. assert(false)
  10563. })
  10564. }
  10565. if (typeof this.opts.body.readableDidRead !== 'boolean') {
  10566. this.opts.body[kBodyUsed] = false
  10567. EE.prototype.on.call(this.opts.body, 'data', function () {
  10568. this[kBodyUsed] = true
  10569. })
  10570. }
  10571. } else if (this.opts.body && typeof this.opts.body.pipeTo === 'function') {
  10572. // TODO (fix): We can't access ReadableStream internal state
  10573. // to determine whether or not it has been disturbed. This is just
  10574. // a workaround.
  10575. this.opts.body = new BodyAsyncIterable(this.opts.body)
  10576. } else if (
  10577. this.opts.body &&
  10578. typeof this.opts.body !== 'string' &&
  10579. !ArrayBuffer.isView(this.opts.body) &&
  10580. util.isIterable(this.opts.body)
  10581. ) {
  10582. // TODO: Should we allow re-using iterable if !this.opts.idempotent
  10583. // or through some other flag?
  10584. this.opts.body = new BodyAsyncIterable(this.opts.body)
  10585. }
  10586. }
  10587. onConnect (abort) {
  10588. this.abort = abort
  10589. this.handler.onConnect(abort, { history: this.history })
  10590. }
  10591. onUpgrade (statusCode, headers, socket) {
  10592. this.handler.onUpgrade(statusCode, headers, socket)
  10593. }
  10594. onError (error) {
  10595. this.handler.onError(error)
  10596. }
  10597. onHeaders (statusCode, headers, resume, statusText) {
  10598. this.location = this.history.length >= this.maxRedirections || util.isDisturbed(this.opts.body)
  10599. ? null
  10600. : parseLocation(statusCode, headers)
  10601. if (this.opts.throwOnMaxRedirect && this.history.length >= this.maxRedirections) {
  10602. if (this.request) {
  10603. this.request.abort(new Error('max redirects'))
  10604. }
  10605. this.redirectionLimitReached = true
  10606. this.abort(new Error('max redirects'))
  10607. return
  10608. }
  10609. if (this.opts.origin) {
  10610. this.history.push(new URL(this.opts.path, this.opts.origin))
  10611. }
  10612. if (!this.location) {
  10613. return this.handler.onHeaders(statusCode, headers, resume, statusText)
  10614. }
  10615. const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)))
  10616. const path = search ? `${pathname}${search}` : pathname
  10617. // Remove headers referring to the original URL.
  10618. // By default it is Host only, unless it's a 303 (see below), which removes also all Content-* headers.
  10619. // https://tools.ietf.org/html/rfc7231#section-6.4
  10620. this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin)
  10621. this.opts.path = path
  10622. this.opts.origin = origin
  10623. this.opts.maxRedirections = 0
  10624. this.opts.query = null
  10625. // https://tools.ietf.org/html/rfc7231#section-6.4.4
  10626. // In case of HTTP 303, always replace method to be either HEAD or GET
  10627. if (statusCode === 303 && this.opts.method !== 'HEAD') {
  10628. this.opts.method = 'GET'
  10629. this.opts.body = null
  10630. }
  10631. }
  10632. onData (chunk) {
  10633. if (this.location) {
  10634. /*
  10635. https://tools.ietf.org/html/rfc7231#section-6.4
  10636. TLDR: undici always ignores 3xx response bodies.
  10637. Redirection is used to serve the requested resource from another URL, so it is assumes that
  10638. no body is generated (and thus can be ignored). Even though generating a body is not prohibited.
  10639. For status 301, 302, 303, 307 and 308 (the latter from RFC 7238), the specs mention that the body usually
  10640. (which means it's optional and not mandated) contain just an hyperlink to the value of
  10641. the Location response header, so the body can be ignored safely.
  10642. For status 300, which is "Multiple Choices", the spec mentions both generating a Location
  10643. response header AND a response body with the other possible location to follow.
  10644. Since the spec explicitly chooses not to specify a format for such body and leave it to
  10645. servers and browsers implementors, we ignore the body as there is no specified way to eventually parse it.
  10646. */
  10647. } else {
  10648. return this.handler.onData(chunk)
  10649. }
  10650. }
  10651. onComplete (trailers) {
  10652. if (this.location) {
  10653. /*
  10654. https://tools.ietf.org/html/rfc7231#section-6.4
  10655. TLDR: undici always ignores 3xx response trailers as they are not expected in case of redirections
  10656. and neither are useful if present.
  10657. See comment on onData method above for more detailed information.
  10658. */
  10659. this.location = null
  10660. this.abort = null
  10661. this.dispatch(this.opts, this)
  10662. } else {
  10663. this.handler.onComplete(trailers)
  10664. }
  10665. }
  10666. onBodySent (chunk) {
  10667. if (this.handler.onBodySent) {
  10668. this.handler.onBodySent(chunk)
  10669. }
  10670. }
  10671. }
  10672. function parseLocation (statusCode, headers) {
  10673. if (redirectableStatusCodes.indexOf(statusCode) === -1) {
  10674. return null
  10675. }
  10676. for (let i = 0; i < headers.length; i += 2) {
  10677. if (headers[i].length === 8 && util.headerNameToString(headers[i]) === 'location') {
  10678. return headers[i + 1]
  10679. }
  10680. }
  10681. }
  10682. // https://tools.ietf.org/html/rfc7231#section-6.4.4
  10683. function shouldRemoveHeader (header, removeContent, unknownOrigin) {
  10684. if (header.length === 4) {
  10685. return util.headerNameToString(header) === 'host'
  10686. }
  10687. if (removeContent && util.headerNameToString(header).startsWith('content-')) {
  10688. return true
  10689. }
  10690. if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) {
  10691. const name = util.headerNameToString(header)
  10692. return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization'
  10693. }
  10694. return false
  10695. }
  10696. // https://tools.ietf.org/html/rfc7231#section-6.4
  10697. function cleanRequestHeaders (headers, removeContent, unknownOrigin) {
  10698. const ret = []
  10699. if (Array.isArray(headers)) {
  10700. for (let i = 0; i < headers.length; i += 2) {
  10701. if (!shouldRemoveHeader(headers[i], removeContent, unknownOrigin)) {
  10702. ret.push(headers[i], headers[i + 1])
  10703. }
  10704. }
  10705. } else if (headers && typeof headers === 'object') {
  10706. for (const key of Object.keys(headers)) {
  10707. if (!shouldRemoveHeader(key, removeContent, unknownOrigin)) {
  10708. ret.push(key, headers[key])
  10709. }
  10710. }
  10711. } else {
  10712. assert(headers == null, 'headers must be an object or an array')
  10713. }
  10714. return ret
  10715. }
  10716. module.exports = RedirectHandler
  10717. /***/ }),
  10718. /***/ 7816:
  10719. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10720. const assert = __nccwpck_require__(4589)
  10721. const { kRetryHandlerDefaultRetry } = __nccwpck_require__(6443)
  10722. const { RequestRetryError } = __nccwpck_require__(8707)
  10723. const {
  10724. isDisturbed,
  10725. parseHeaders,
  10726. parseRangeHeader,
  10727. wrapRequestBody
  10728. } = __nccwpck_require__(3440)
  10729. function calculateRetryAfterHeader (retryAfter) {
  10730. const current = Date.now()
  10731. return new Date(retryAfter).getTime() - current
  10732. }
  10733. function validatePartialResponseContentLength (headers, range, statusCode, retryCount) {
  10734. const contentLength = headers['content-length']
  10735. if (contentLength == null) {
  10736. return null
  10737. }
  10738. if (!Number.isFinite(range.start) || !Number.isFinite(range.end)) {
  10739. return null
  10740. }
  10741. const length = Number(contentLength)
  10742. const expectedLength = range.end - range.start + 1
  10743. if (!Number.isFinite(length) || length !== expectedLength) {
  10744. return new RequestRetryError('Content-Length mismatch', statusCode, {
  10745. headers,
  10746. data: { count: retryCount }
  10747. })
  10748. }
  10749. return null
  10750. }
  10751. class RetryHandler {
  10752. constructor (opts, handlers) {
  10753. const { retryOptions, ...dispatchOpts } = opts
  10754. const {
  10755. // Retry scoped
  10756. retry: retryFn,
  10757. maxRetries,
  10758. maxTimeout,
  10759. minTimeout,
  10760. timeoutFactor,
  10761. // Response scoped
  10762. methods,
  10763. errorCodes,
  10764. retryAfter,
  10765. statusCodes
  10766. } = retryOptions ?? {}
  10767. this.dispatch = handlers.dispatch
  10768. this.handler = handlers.handler
  10769. this.opts = { ...dispatchOpts, body: wrapRequestBody(opts.body) }
  10770. this.abort = null
  10771. this.aborted = false
  10772. this.retryOpts = {
  10773. retry: retryFn ?? RetryHandler[kRetryHandlerDefaultRetry],
  10774. retryAfter: retryAfter ?? true,
  10775. maxTimeout: maxTimeout ?? 30 * 1000, // 30s,
  10776. minTimeout: minTimeout ?? 500, // .5s
  10777. timeoutFactor: timeoutFactor ?? 2,
  10778. maxRetries: maxRetries ?? 5,
  10779. // What errors we should retry
  10780. methods: methods ?? ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'],
  10781. // Indicates which errors to retry
  10782. statusCodes: statusCodes ?? [500, 502, 503, 504, 429],
  10783. // List of errors to retry
  10784. errorCodes: errorCodes ?? [
  10785. 'ECONNRESET',
  10786. 'ECONNREFUSED',
  10787. 'ENOTFOUND',
  10788. 'ENETDOWN',
  10789. 'ENETUNREACH',
  10790. 'EHOSTDOWN',
  10791. 'EHOSTUNREACH',
  10792. 'EPIPE',
  10793. 'UND_ERR_SOCKET'
  10794. ]
  10795. }
  10796. this.retryCount = 0
  10797. this.retryCountCheckpoint = 0
  10798. this.start = 0
  10799. this.end = null
  10800. this.etag = null
  10801. this.resume = null
  10802. this.headersSent = false
  10803. // Handle possible onConnect duplication
  10804. this.handler.onConnect(reason => {
  10805. this.aborted = true
  10806. if (this.abort) {
  10807. this.abort(reason)
  10808. } else {
  10809. this.reason = reason
  10810. }
  10811. })
  10812. }
  10813. checkpointResponseEnd (headers, resume) {
  10814. if (this.end == null && this.opts.method !== 'HEAD') {
  10815. const contentLength = headers['content-length']
  10816. this.end = contentLength != null ? Number(contentLength) - 1 : null
  10817. assert(
  10818. this.end == null || Number.isFinite(this.end),
  10819. 'invalid content-length'
  10820. )
  10821. }
  10822. this.resume = this.end != null ? resume : null
  10823. }
  10824. onRequestSent () {
  10825. if (this.handler.onRequestSent) {
  10826. this.handler.onRequestSent()
  10827. }
  10828. }
  10829. onUpgrade (statusCode, headers, socket) {
  10830. if (this.handler.onUpgrade) {
  10831. this.handler.onUpgrade(statusCode, headers, socket)
  10832. }
  10833. }
  10834. onConnect (abort) {
  10835. if (this.aborted) {
  10836. abort(this.reason)
  10837. } else {
  10838. this.abort = abort
  10839. }
  10840. }
  10841. onBodySent (chunk) {
  10842. if (this.handler.onBodySent) return this.handler.onBodySent(chunk)
  10843. }
  10844. static [kRetryHandlerDefaultRetry] (err, { state, opts }, cb) {
  10845. const { statusCode, code, headers } = err
  10846. const { method, retryOptions } = opts
  10847. const {
  10848. maxRetries,
  10849. minTimeout,
  10850. maxTimeout,
  10851. timeoutFactor,
  10852. statusCodes,
  10853. errorCodes,
  10854. methods
  10855. } = retryOptions
  10856. const { counter } = state
  10857. // Any code that is not a Undici's originated and allowed to retry
  10858. if (code && code !== 'UND_ERR_REQ_RETRY' && !errorCodes.includes(code)) {
  10859. cb(err)
  10860. return
  10861. }
  10862. // If a set of method are provided and the current method is not in the list
  10863. if (Array.isArray(methods) && !methods.includes(method)) {
  10864. cb(err)
  10865. return
  10866. }
  10867. // If a set of status code are provided and the current status code is not in the list
  10868. if (
  10869. statusCode != null &&
  10870. Array.isArray(statusCodes) &&
  10871. !statusCodes.includes(statusCode)
  10872. ) {
  10873. cb(err)
  10874. return
  10875. }
  10876. // If we reached the max number of retries
  10877. if (counter > maxRetries) {
  10878. cb(err)
  10879. return
  10880. }
  10881. let retryAfterHeader = headers?.['retry-after']
  10882. if (retryAfterHeader) {
  10883. retryAfterHeader = Number(retryAfterHeader)
  10884. retryAfterHeader = Number.isNaN(retryAfterHeader)
  10885. ? calculateRetryAfterHeader(retryAfterHeader)
  10886. : retryAfterHeader * 1e3 // Retry-After is in seconds
  10887. }
  10888. const retryTimeout =
  10889. retryAfterHeader > 0
  10890. ? Math.min(retryAfterHeader, maxTimeout)
  10891. : Math.min(minTimeout * timeoutFactor ** (counter - 1), maxTimeout)
  10892. setTimeout(() => cb(null), retryTimeout)
  10893. }
  10894. onHeaders (statusCode, rawHeaders, resume, statusMessage) {
  10895. const headers = parseHeaders(rawHeaders)
  10896. this.retryCount += 1
  10897. if (statusCode >= 300) {
  10898. // Only expose a response if no earlier attempt has reached the caller.
  10899. // Otherwise abort this attempt so the error settles the existing body
  10900. // instead of replacing it with a new response.
  10901. if (!this.headersSent && this.retryOpts.statusCodes.includes(statusCode) === false) {
  10902. this.headersSent = true
  10903. this.checkpointResponseEnd(headers, resume)
  10904. return this.handler.onHeaders(
  10905. statusCode,
  10906. rawHeaders,
  10907. resume,
  10908. statusMessage
  10909. )
  10910. } else {
  10911. this.abort(
  10912. new RequestRetryError('Request failed', statusCode, {
  10913. headers,
  10914. data: {
  10915. count: this.retryCount
  10916. }
  10917. })
  10918. )
  10919. return false
  10920. }
  10921. }
  10922. // Checkpoint for resume from where we left it
  10923. if (this.resume != null) {
  10924. this.resume = null
  10925. // Only Partial Content 206 supposed to provide Content-Range,
  10926. // any other status code that partially consumed the payload
  10927. // should not be retry because it would result in downstream
  10928. // wrongly concatanete multiple responses.
  10929. if (statusCode !== 206 && (this.start > 0 || statusCode !== 200)) {
  10930. this.abort(
  10931. new RequestRetryError('server does not support the range header and the payload was partially consumed', statusCode, {
  10932. headers,
  10933. data: { count: this.retryCount }
  10934. })
  10935. )
  10936. return false
  10937. }
  10938. const contentRange = parseRangeHeader(headers['content-range'])
  10939. // If no content range
  10940. if (!contentRange) {
  10941. this.abort(
  10942. new RequestRetryError('Content-Range mismatch', statusCode, {
  10943. headers,
  10944. data: { count: this.retryCount }
  10945. })
  10946. )
  10947. return false
  10948. }
  10949. // Let's start with a weak etag check
  10950. if (this.etag != null && this.etag !== headers.etag) {
  10951. this.abort(
  10952. new RequestRetryError('ETag mismatch', statusCode, {
  10953. headers,
  10954. data: { count: this.retryCount }
  10955. })
  10956. )
  10957. return false
  10958. }
  10959. const contentLengthError = validatePartialResponseContentLength(headers, contentRange, statusCode, this.retryCount)
  10960. if (contentLengthError != null) {
  10961. this.abort(contentLengthError)
  10962. return false
  10963. }
  10964. const { start, size, end = size - 1 } = contentRange
  10965. if (this.start !== start || (this.end != null && this.end !== end)) {
  10966. this.abort(
  10967. new RequestRetryError('Content-Range mismatch', statusCode, {
  10968. headers,
  10969. data: { count: this.retryCount }
  10970. })
  10971. )
  10972. return false
  10973. }
  10974. this.resume = resume
  10975. return true
  10976. }
  10977. if (this.end == null) {
  10978. if (statusCode === 206) {
  10979. // First time we receive 206
  10980. const range = parseRangeHeader(headers['content-range'])
  10981. if (range == null) {
  10982. this.headersSent = true
  10983. return this.handler.onHeaders(
  10984. statusCode,
  10985. rawHeaders,
  10986. resume,
  10987. statusMessage
  10988. )
  10989. }
  10990. const contentLengthError = validatePartialResponseContentLength(headers, range, statusCode, this.retryCount)
  10991. if (contentLengthError != null) {
  10992. this.abort(contentLengthError)
  10993. return false
  10994. }
  10995. const { start, size, end = size - 1 } = range
  10996. assert(
  10997. start != null && Number.isFinite(start),
  10998. 'content-range mismatch'
  10999. )
  11000. assert(end != null && Number.isFinite(end), 'invalid content-length')
  11001. this.start = start
  11002. this.end = end
  11003. }
  11004. // We make our best to checkpoint the body for further range headers
  11005. if (this.end == null) {
  11006. const contentLength = headers['content-length']
  11007. this.end = contentLength != null ? Number(contentLength) - 1 : null
  11008. }
  11009. assert(Number.isFinite(this.start))
  11010. assert(
  11011. this.end == null || Number.isFinite(this.end),
  11012. 'invalid content-length'
  11013. )
  11014. this.resume = resume
  11015. this.headersSent = true
  11016. this.etag = headers.etag != null ? headers.etag : null
  11017. // Weak etags are not useful for comparison nor cache
  11018. // for instance not safe to assume if the response is byte-per-byte
  11019. // equal
  11020. if (this.etag != null && this.etag.startsWith('W/')) {
  11021. this.etag = null
  11022. }
  11023. return this.handler.onHeaders(
  11024. statusCode,
  11025. rawHeaders,
  11026. resume,
  11027. statusMessage
  11028. )
  11029. }
  11030. const err = new RequestRetryError('Request failed', statusCode, {
  11031. headers,
  11032. data: { count: this.retryCount }
  11033. })
  11034. this.abort(err)
  11035. return false
  11036. }
  11037. onData (chunk) {
  11038. this.start += chunk.length
  11039. return this.handler.onData(chunk)
  11040. }
  11041. onComplete (rawTrailers) {
  11042. this.retryCount = 0
  11043. return this.handler.onComplete(rawTrailers)
  11044. }
  11045. onError (err) {
  11046. if (this.aborted || isDisturbed(this.opts.body) || (this.headersSent && this.resume == null)) {
  11047. return this.handler.onError(err)
  11048. }
  11049. // We reconcile in case of a mix between network errors
  11050. // and server error response
  11051. if (this.retryCount - this.retryCountCheckpoint > 0) {
  11052. // We count the difference between the last checkpoint and the current retry count
  11053. this.retryCount =
  11054. this.retryCountCheckpoint +
  11055. (this.retryCount - this.retryCountCheckpoint)
  11056. } else {
  11057. this.retryCount += 1
  11058. }
  11059. this.retryOpts.retry(
  11060. err,
  11061. {
  11062. state: { counter: this.retryCount },
  11063. opts: { retryOptions: this.retryOpts, ...this.opts }
  11064. },
  11065. onRetry.bind(this)
  11066. )
  11067. function onRetry (err) {
  11068. if (err != null || this.aborted || isDisturbed(this.opts.body)) {
  11069. return this.handler.onError(err)
  11070. }
  11071. if (this.start !== 0) {
  11072. const headers = { range: `bytes=${this.start}-${this.end ?? ''}` }
  11073. // Weak etag check - weak etags will make comparison algorithms never match
  11074. if (this.etag != null) {
  11075. headers['if-match'] = this.etag
  11076. }
  11077. this.opts = {
  11078. ...this.opts,
  11079. headers: {
  11080. ...this.opts.headers,
  11081. ...headers
  11082. }
  11083. }
  11084. }
  11085. try {
  11086. this.retryCountCheckpoint = this.retryCount
  11087. this.dispatch(this.opts, this)
  11088. } catch (err) {
  11089. this.handler.onError(err)
  11090. }
  11091. }
  11092. }
  11093. }
  11094. module.exports = RetryHandler
  11095. /***/ }),
  11096. /***/ 379:
  11097. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11098. const { isIP } = __nccwpck_require__(7030)
  11099. const { lookup } = __nccwpck_require__(610)
  11100. const DecoratorHandler = __nccwpck_require__(8155)
  11101. const { InvalidArgumentError, InformationalError } = __nccwpck_require__(8707)
  11102. const maxInt = Math.pow(2, 31) - 1
  11103. class DNSInstance {
  11104. #maxTTL = 0
  11105. #maxItems = 0
  11106. #records = new Map()
  11107. dualStack = true
  11108. affinity = null
  11109. lookup = null
  11110. pick = null
  11111. constructor (opts) {
  11112. this.#maxTTL = opts.maxTTL
  11113. this.#maxItems = opts.maxItems
  11114. this.dualStack = opts.dualStack
  11115. this.affinity = opts.affinity
  11116. this.lookup = opts.lookup ?? this.#defaultLookup
  11117. this.pick = opts.pick ?? this.#defaultPick
  11118. }
  11119. get full () {
  11120. return this.#records.size === this.#maxItems
  11121. }
  11122. runLookup (origin, opts, cb) {
  11123. const ips = this.#records.get(origin.hostname)
  11124. // If full, we just return the origin
  11125. if (ips == null && this.full) {
  11126. cb(null, origin.origin)
  11127. return
  11128. }
  11129. const newOpts = {
  11130. affinity: this.affinity,
  11131. dualStack: this.dualStack,
  11132. lookup: this.lookup,
  11133. pick: this.pick,
  11134. ...opts.dns,
  11135. maxTTL: this.#maxTTL,
  11136. maxItems: this.#maxItems
  11137. }
  11138. // If no IPs we lookup
  11139. if (ips == null) {
  11140. this.lookup(origin, newOpts, (err, addresses) => {
  11141. if (err || addresses == null || addresses.length === 0) {
  11142. cb(err ?? new InformationalError('No DNS entries found'))
  11143. return
  11144. }
  11145. this.setRecords(origin, addresses)
  11146. const records = this.#records.get(origin.hostname)
  11147. const ip = this.pick(
  11148. origin,
  11149. records,
  11150. newOpts.affinity
  11151. )
  11152. let port
  11153. if (typeof ip.port === 'number') {
  11154. port = `:${ip.port}`
  11155. } else if (origin.port !== '') {
  11156. port = `:${origin.port}`
  11157. } else {
  11158. port = ''
  11159. }
  11160. cb(
  11161. null,
  11162. `${origin.protocol}//${
  11163. ip.family === 6 ? `[${ip.address}]` : ip.address
  11164. }${port}`
  11165. )
  11166. })
  11167. } else {
  11168. // If there's IPs we pick
  11169. const ip = this.pick(
  11170. origin,
  11171. ips,
  11172. newOpts.affinity
  11173. )
  11174. // If no IPs we lookup - deleting old records
  11175. if (ip == null) {
  11176. this.#records.delete(origin.hostname)
  11177. this.runLookup(origin, opts, cb)
  11178. return
  11179. }
  11180. let port
  11181. if (typeof ip.port === 'number') {
  11182. port = `:${ip.port}`
  11183. } else if (origin.port !== '') {
  11184. port = `:${origin.port}`
  11185. } else {
  11186. port = ''
  11187. }
  11188. cb(
  11189. null,
  11190. `${origin.protocol}//${
  11191. ip.family === 6 ? `[${ip.address}]` : ip.address
  11192. }${port}`
  11193. )
  11194. }
  11195. }
  11196. #defaultLookup (origin, opts, cb) {
  11197. lookup(
  11198. origin.hostname,
  11199. {
  11200. all: true,
  11201. family: this.dualStack === false ? this.affinity : 0,
  11202. order: 'ipv4first'
  11203. },
  11204. (err, addresses) => {
  11205. if (err) {
  11206. return cb(err)
  11207. }
  11208. const results = new Map()
  11209. for (const addr of addresses) {
  11210. // On linux we found duplicates, we attempt to remove them with
  11211. // the latest record
  11212. results.set(`${addr.address}:${addr.family}`, addr)
  11213. }
  11214. cb(null, results.values())
  11215. }
  11216. )
  11217. }
  11218. #defaultPick (origin, hostnameRecords, affinity) {
  11219. let ip = null
  11220. const { records, offset } = hostnameRecords
  11221. let family
  11222. if (this.dualStack) {
  11223. if (affinity == null) {
  11224. // Balance between ip families
  11225. if (offset == null || offset === maxInt) {
  11226. hostnameRecords.offset = 0
  11227. affinity = 4
  11228. } else {
  11229. hostnameRecords.offset++
  11230. affinity = (hostnameRecords.offset & 1) === 1 ? 6 : 4
  11231. }
  11232. }
  11233. if (records[affinity] != null && records[affinity].ips.length > 0) {
  11234. family = records[affinity]
  11235. } else {
  11236. family = records[affinity === 4 ? 6 : 4]
  11237. }
  11238. } else {
  11239. family = records[affinity]
  11240. }
  11241. // If no IPs we return null
  11242. if (family == null || family.ips.length === 0) {
  11243. return ip
  11244. }
  11245. if (family.offset == null || family.offset === maxInt) {
  11246. family.offset = 0
  11247. } else {
  11248. family.offset++
  11249. }
  11250. const position = family.offset % family.ips.length
  11251. ip = family.ips[position] ?? null
  11252. if (ip == null) {
  11253. return ip
  11254. }
  11255. if (Date.now() - ip.timestamp > ip.ttl) { // record TTL is already in ms
  11256. // We delete expired records
  11257. // It is possible that they have different TTL, so we manage them individually
  11258. family.ips.splice(position, 1)
  11259. return this.pick(origin, hostnameRecords, affinity)
  11260. }
  11261. return ip
  11262. }
  11263. setRecords (origin, addresses) {
  11264. const timestamp = Date.now()
  11265. const records = { records: { 4: null, 6: null } }
  11266. for (const record of addresses) {
  11267. record.timestamp = timestamp
  11268. if (typeof record.ttl === 'number') {
  11269. // The record TTL is expected to be in ms
  11270. record.ttl = Math.min(record.ttl, this.#maxTTL)
  11271. } else {
  11272. record.ttl = this.#maxTTL
  11273. }
  11274. const familyRecords = records.records[record.family] ?? { ips: [] }
  11275. familyRecords.ips.push(record)
  11276. records.records[record.family] = familyRecords
  11277. }
  11278. this.#records.set(origin.hostname, records)
  11279. }
  11280. getHandler (meta, opts) {
  11281. return new DNSDispatchHandler(this, meta, opts)
  11282. }
  11283. }
  11284. class DNSDispatchHandler extends DecoratorHandler {
  11285. #state = null
  11286. #opts = null
  11287. #dispatch = null
  11288. #handler = null
  11289. #origin = null
  11290. constructor (state, { origin, handler, dispatch }, opts) {
  11291. super(handler)
  11292. this.#origin = origin
  11293. this.#handler = handler
  11294. this.#opts = { ...opts }
  11295. this.#state = state
  11296. this.#dispatch = dispatch
  11297. }
  11298. onError (err) {
  11299. switch (err.code) {
  11300. case 'ETIMEDOUT':
  11301. case 'ECONNREFUSED': {
  11302. if (this.#state.dualStack) {
  11303. // We delete the record and retry
  11304. this.#state.runLookup(this.#origin, this.#opts, (err, newOrigin) => {
  11305. if (err) {
  11306. return this.#handler.onError(err)
  11307. }
  11308. const dispatchOpts = {
  11309. ...this.#opts,
  11310. origin: newOrigin
  11311. }
  11312. this.#dispatch(dispatchOpts, this)
  11313. })
  11314. // if dual-stack disabled, we error out
  11315. return
  11316. }
  11317. this.#handler.onError(err)
  11318. return
  11319. }
  11320. case 'ENOTFOUND':
  11321. this.#state.deleteRecord(this.#origin)
  11322. // eslint-disable-next-line no-fallthrough
  11323. default:
  11324. this.#handler.onError(err)
  11325. break
  11326. }
  11327. }
  11328. }
  11329. module.exports = interceptorOpts => {
  11330. if (
  11331. interceptorOpts?.maxTTL != null &&
  11332. (typeof interceptorOpts?.maxTTL !== 'number' || interceptorOpts?.maxTTL < 0)
  11333. ) {
  11334. throw new InvalidArgumentError('Invalid maxTTL. Must be a positive number')
  11335. }
  11336. if (
  11337. interceptorOpts?.maxItems != null &&
  11338. (typeof interceptorOpts?.maxItems !== 'number' ||
  11339. interceptorOpts?.maxItems < 1)
  11340. ) {
  11341. throw new InvalidArgumentError(
  11342. 'Invalid maxItems. Must be a positive number and greater than zero'
  11343. )
  11344. }
  11345. if (
  11346. interceptorOpts?.affinity != null &&
  11347. interceptorOpts?.affinity !== 4 &&
  11348. interceptorOpts?.affinity !== 6
  11349. ) {
  11350. throw new InvalidArgumentError('Invalid affinity. Must be either 4 or 6')
  11351. }
  11352. if (
  11353. interceptorOpts?.dualStack != null &&
  11354. typeof interceptorOpts?.dualStack !== 'boolean'
  11355. ) {
  11356. throw new InvalidArgumentError('Invalid dualStack. Must be a boolean')
  11357. }
  11358. if (
  11359. interceptorOpts?.lookup != null &&
  11360. typeof interceptorOpts?.lookup !== 'function'
  11361. ) {
  11362. throw new InvalidArgumentError('Invalid lookup. Must be a function')
  11363. }
  11364. if (
  11365. interceptorOpts?.pick != null &&
  11366. typeof interceptorOpts?.pick !== 'function'
  11367. ) {
  11368. throw new InvalidArgumentError('Invalid pick. Must be a function')
  11369. }
  11370. const dualStack = interceptorOpts?.dualStack ?? true
  11371. let affinity
  11372. if (dualStack) {
  11373. affinity = interceptorOpts?.affinity ?? null
  11374. } else {
  11375. affinity = interceptorOpts?.affinity ?? 4
  11376. }
  11377. const opts = {
  11378. maxTTL: interceptorOpts?.maxTTL ?? 10e3, // Expressed in ms
  11379. lookup: interceptorOpts?.lookup ?? null,
  11380. pick: interceptorOpts?.pick ?? null,
  11381. dualStack,
  11382. affinity,
  11383. maxItems: interceptorOpts?.maxItems ?? Infinity
  11384. }
  11385. const instance = new DNSInstance(opts)
  11386. return dispatch => {
  11387. return function dnsInterceptor (origDispatchOpts, handler) {
  11388. const origin =
  11389. origDispatchOpts.origin.constructor === URL
  11390. ? origDispatchOpts.origin
  11391. : new URL(origDispatchOpts.origin)
  11392. if (isIP(origin.hostname) !== 0) {
  11393. return dispatch(origDispatchOpts, handler)
  11394. }
  11395. instance.runLookup(origin, origDispatchOpts, (err, newOrigin) => {
  11396. if (err) {
  11397. return handler.onError(err)
  11398. }
  11399. let dispatchOpts = null
  11400. dispatchOpts = {
  11401. ...origDispatchOpts,
  11402. servername: origin.hostname, // For SNI on TLS
  11403. origin: newOrigin,
  11404. headers: {
  11405. host: origin.hostname,
  11406. ...origDispatchOpts.headers
  11407. }
  11408. }
  11409. dispatch(
  11410. dispatchOpts,
  11411. instance.getHandler({ origin, dispatch, handler }, origDispatchOpts)
  11412. )
  11413. })
  11414. return true
  11415. }
  11416. }
  11417. }
  11418. /***/ }),
  11419. /***/ 8060:
  11420. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11421. const util = __nccwpck_require__(3440)
  11422. const { InvalidArgumentError, RequestAbortedError } = __nccwpck_require__(8707)
  11423. const DecoratorHandler = __nccwpck_require__(8155)
  11424. class DumpHandler extends DecoratorHandler {
  11425. #maxSize = 1024 * 1024
  11426. #abort = null
  11427. #dumped = false
  11428. #aborted = false
  11429. #size = 0
  11430. #reason = null
  11431. #handler = null
  11432. constructor ({ maxSize }, handler) {
  11433. super(handler)
  11434. if (maxSize != null && (!Number.isFinite(maxSize) || maxSize < 1)) {
  11435. throw new InvalidArgumentError('maxSize must be a number greater than 0')
  11436. }
  11437. this.#maxSize = maxSize ?? this.#maxSize
  11438. this.#handler = handler
  11439. }
  11440. onConnect (abort) {
  11441. this.#abort = abort
  11442. this.#handler.onConnect(this.#customAbort.bind(this))
  11443. }
  11444. #customAbort (reason) {
  11445. this.#aborted = true
  11446. this.#reason = reason
  11447. }
  11448. // TODO: will require adjustment after new hooks are out
  11449. onHeaders (statusCode, rawHeaders, resume, statusMessage) {
  11450. const headers = util.parseHeaders(rawHeaders)
  11451. const contentLength = headers['content-length']
  11452. if (contentLength != null && contentLength > this.#maxSize) {
  11453. throw new RequestAbortedError(
  11454. `Response size (${contentLength}) larger than maxSize (${
  11455. this.#maxSize
  11456. })`
  11457. )
  11458. }
  11459. if (this.#aborted) {
  11460. return true
  11461. }
  11462. return this.#handler.onHeaders(
  11463. statusCode,
  11464. rawHeaders,
  11465. resume,
  11466. statusMessage
  11467. )
  11468. }
  11469. onError (err) {
  11470. if (this.#dumped) {
  11471. return
  11472. }
  11473. err = this.#reason ?? err
  11474. this.#handler.onError(err)
  11475. }
  11476. onData (chunk) {
  11477. this.#size = this.#size + chunk.length
  11478. if (this.#size >= this.#maxSize) {
  11479. this.#dumped = true
  11480. if (this.#aborted) {
  11481. this.#handler.onError(this.#reason)
  11482. } else {
  11483. this.#handler.onComplete([])
  11484. }
  11485. }
  11486. return true
  11487. }
  11488. onComplete (trailers) {
  11489. if (this.#dumped) {
  11490. return
  11491. }
  11492. if (this.#aborted) {
  11493. this.#handler.onError(this.reason)
  11494. return
  11495. }
  11496. this.#handler.onComplete(trailers)
  11497. }
  11498. }
  11499. function createDumpInterceptor (
  11500. { maxSize: defaultMaxSize } = {
  11501. maxSize: 1024 * 1024
  11502. }
  11503. ) {
  11504. return dispatch => {
  11505. return function Intercept (opts, handler) {
  11506. const { dumpMaxSize = defaultMaxSize } =
  11507. opts
  11508. const dumpHandler = new DumpHandler(
  11509. { maxSize: dumpMaxSize },
  11510. handler
  11511. )
  11512. return dispatch(opts, dumpHandler)
  11513. }
  11514. }
  11515. }
  11516. module.exports = createDumpInterceptor
  11517. /***/ }),
  11518. /***/ 5092:
  11519. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11520. const RedirectHandler = __nccwpck_require__(8754)
  11521. function createRedirectInterceptor ({ maxRedirections: defaultMaxRedirections }) {
  11522. return (dispatch) => {
  11523. return function Intercept (opts, handler) {
  11524. const { maxRedirections = defaultMaxRedirections } = opts
  11525. if (!maxRedirections) {
  11526. return dispatch(opts, handler)
  11527. }
  11528. const redirectHandler = new RedirectHandler(dispatch, maxRedirections, opts, handler)
  11529. opts = { ...opts, maxRedirections: 0 } // Stop sub dispatcher from also redirecting.
  11530. return dispatch(opts, redirectHandler)
  11531. }
  11532. }
  11533. }
  11534. module.exports = createRedirectInterceptor
  11535. /***/ }),
  11536. /***/ 1514:
  11537. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11538. const RedirectHandler = __nccwpck_require__(8754)
  11539. module.exports = opts => {
  11540. const globalMaxRedirections = opts?.maxRedirections
  11541. return dispatch => {
  11542. return function redirectInterceptor (opts, handler) {
  11543. const { maxRedirections = globalMaxRedirections, ...baseOpts } = opts
  11544. if (!maxRedirections) {
  11545. return dispatch(opts, handler)
  11546. }
  11547. const redirectHandler = new RedirectHandler(
  11548. dispatch,
  11549. maxRedirections,
  11550. opts,
  11551. handler
  11552. )
  11553. return dispatch(baseOpts, redirectHandler)
  11554. }
  11555. }
  11556. }
  11557. /***/ }),
  11558. /***/ 2026:
  11559. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11560. const RetryHandler = __nccwpck_require__(7816)
  11561. module.exports = globalOpts => {
  11562. return dispatch => {
  11563. return function retryInterceptor (opts, handler) {
  11564. return dispatch(
  11565. opts,
  11566. new RetryHandler(
  11567. { ...opts, retryOptions: { ...globalOpts, ...opts.retryOptions } },
  11568. {
  11569. handler,
  11570. dispatch
  11571. }
  11572. )
  11573. )
  11574. }
  11575. }
  11576. }
  11577. /***/ }),
  11578. /***/ 2824:
  11579. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  11580. Object.defineProperty(exports, "__esModule", ({ value: true }));
  11581. exports.SPECIAL_HEADERS = exports.HEADER_STATE = exports.MINOR = exports.MAJOR = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.STRICT_TOKEN = exports.HEX = exports.URL_CHAR = exports.STRICT_URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.FINISH = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0;
  11582. const utils_1 = __nccwpck_require__(172);
  11583. // C headers
  11584. var ERROR;
  11585. (function (ERROR) {
  11586. ERROR[ERROR["OK"] = 0] = "OK";
  11587. ERROR[ERROR["INTERNAL"] = 1] = "INTERNAL";
  11588. ERROR[ERROR["STRICT"] = 2] = "STRICT";
  11589. ERROR[ERROR["LF_EXPECTED"] = 3] = "LF_EXPECTED";
  11590. ERROR[ERROR["UNEXPECTED_CONTENT_LENGTH"] = 4] = "UNEXPECTED_CONTENT_LENGTH";
  11591. ERROR[ERROR["CLOSED_CONNECTION"] = 5] = "CLOSED_CONNECTION";
  11592. ERROR[ERROR["INVALID_METHOD"] = 6] = "INVALID_METHOD";
  11593. ERROR[ERROR["INVALID_URL"] = 7] = "INVALID_URL";
  11594. ERROR[ERROR["INVALID_CONSTANT"] = 8] = "INVALID_CONSTANT";
  11595. ERROR[ERROR["INVALID_VERSION"] = 9] = "INVALID_VERSION";
  11596. ERROR[ERROR["INVALID_HEADER_TOKEN"] = 10] = "INVALID_HEADER_TOKEN";
  11597. ERROR[ERROR["INVALID_CONTENT_LENGTH"] = 11] = "INVALID_CONTENT_LENGTH";
  11598. ERROR[ERROR["INVALID_CHUNK_SIZE"] = 12] = "INVALID_CHUNK_SIZE";
  11599. ERROR[ERROR["INVALID_STATUS"] = 13] = "INVALID_STATUS";
  11600. ERROR[ERROR["INVALID_EOF_STATE"] = 14] = "INVALID_EOF_STATE";
  11601. ERROR[ERROR["INVALID_TRANSFER_ENCODING"] = 15] = "INVALID_TRANSFER_ENCODING";
  11602. ERROR[ERROR["CB_MESSAGE_BEGIN"] = 16] = "CB_MESSAGE_BEGIN";
  11603. ERROR[ERROR["CB_HEADERS_COMPLETE"] = 17] = "CB_HEADERS_COMPLETE";
  11604. ERROR[ERROR["CB_MESSAGE_COMPLETE"] = 18] = "CB_MESSAGE_COMPLETE";
  11605. ERROR[ERROR["CB_CHUNK_HEADER"] = 19] = "CB_CHUNK_HEADER";
  11606. ERROR[ERROR["CB_CHUNK_COMPLETE"] = 20] = "CB_CHUNK_COMPLETE";
  11607. ERROR[ERROR["PAUSED"] = 21] = "PAUSED";
  11608. ERROR[ERROR["PAUSED_UPGRADE"] = 22] = "PAUSED_UPGRADE";
  11609. ERROR[ERROR["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE";
  11610. ERROR[ERROR["USER"] = 24] = "USER";
  11611. })(ERROR = exports.ERROR || (exports.ERROR = {}));
  11612. var TYPE;
  11613. (function (TYPE) {
  11614. TYPE[TYPE["BOTH"] = 0] = "BOTH";
  11615. TYPE[TYPE["REQUEST"] = 1] = "REQUEST";
  11616. TYPE[TYPE["RESPONSE"] = 2] = "RESPONSE";
  11617. })(TYPE = exports.TYPE || (exports.TYPE = {}));
  11618. var FLAGS;
  11619. (function (FLAGS) {
  11620. FLAGS[FLAGS["CONNECTION_KEEP_ALIVE"] = 1] = "CONNECTION_KEEP_ALIVE";
  11621. FLAGS[FLAGS["CONNECTION_CLOSE"] = 2] = "CONNECTION_CLOSE";
  11622. FLAGS[FLAGS["CONNECTION_UPGRADE"] = 4] = "CONNECTION_UPGRADE";
  11623. FLAGS[FLAGS["CHUNKED"] = 8] = "CHUNKED";
  11624. FLAGS[FLAGS["UPGRADE"] = 16] = "UPGRADE";
  11625. FLAGS[FLAGS["CONTENT_LENGTH"] = 32] = "CONTENT_LENGTH";
  11626. FLAGS[FLAGS["SKIPBODY"] = 64] = "SKIPBODY";
  11627. FLAGS[FLAGS["TRAILING"] = 128] = "TRAILING";
  11628. // 1 << 8 is unused
  11629. FLAGS[FLAGS["TRANSFER_ENCODING"] = 512] = "TRANSFER_ENCODING";
  11630. })(FLAGS = exports.FLAGS || (exports.FLAGS = {}));
  11631. var LENIENT_FLAGS;
  11632. (function (LENIENT_FLAGS) {
  11633. LENIENT_FLAGS[LENIENT_FLAGS["HEADERS"] = 1] = "HEADERS";
  11634. LENIENT_FLAGS[LENIENT_FLAGS["CHUNKED_LENGTH"] = 2] = "CHUNKED_LENGTH";
  11635. LENIENT_FLAGS[LENIENT_FLAGS["KEEP_ALIVE"] = 4] = "KEEP_ALIVE";
  11636. })(LENIENT_FLAGS = exports.LENIENT_FLAGS || (exports.LENIENT_FLAGS = {}));
  11637. var METHODS;
  11638. (function (METHODS) {
  11639. METHODS[METHODS["DELETE"] = 0] = "DELETE";
  11640. METHODS[METHODS["GET"] = 1] = "GET";
  11641. METHODS[METHODS["HEAD"] = 2] = "HEAD";
  11642. METHODS[METHODS["POST"] = 3] = "POST";
  11643. METHODS[METHODS["PUT"] = 4] = "PUT";
  11644. /* pathological */
  11645. METHODS[METHODS["CONNECT"] = 5] = "CONNECT";
  11646. METHODS[METHODS["OPTIONS"] = 6] = "OPTIONS";
  11647. METHODS[METHODS["TRACE"] = 7] = "TRACE";
  11648. /* WebDAV */
  11649. METHODS[METHODS["COPY"] = 8] = "COPY";
  11650. METHODS[METHODS["LOCK"] = 9] = "LOCK";
  11651. METHODS[METHODS["MKCOL"] = 10] = "MKCOL";
  11652. METHODS[METHODS["MOVE"] = 11] = "MOVE";
  11653. METHODS[METHODS["PROPFIND"] = 12] = "PROPFIND";
  11654. METHODS[METHODS["PROPPATCH"] = 13] = "PROPPATCH";
  11655. METHODS[METHODS["SEARCH"] = 14] = "SEARCH";
  11656. METHODS[METHODS["UNLOCK"] = 15] = "UNLOCK";
  11657. METHODS[METHODS["BIND"] = 16] = "BIND";
  11658. METHODS[METHODS["REBIND"] = 17] = "REBIND";
  11659. METHODS[METHODS["UNBIND"] = 18] = "UNBIND";
  11660. METHODS[METHODS["ACL"] = 19] = "ACL";
  11661. /* subversion */
  11662. METHODS[METHODS["REPORT"] = 20] = "REPORT";
  11663. METHODS[METHODS["MKACTIVITY"] = 21] = "MKACTIVITY";
  11664. METHODS[METHODS["CHECKOUT"] = 22] = "CHECKOUT";
  11665. METHODS[METHODS["MERGE"] = 23] = "MERGE";
  11666. /* upnp */
  11667. METHODS[METHODS["M-SEARCH"] = 24] = "M-SEARCH";
  11668. METHODS[METHODS["NOTIFY"] = 25] = "NOTIFY";
  11669. METHODS[METHODS["SUBSCRIBE"] = 26] = "SUBSCRIBE";
  11670. METHODS[METHODS["UNSUBSCRIBE"] = 27] = "UNSUBSCRIBE";
  11671. /* RFC-5789 */
  11672. METHODS[METHODS["PATCH"] = 28] = "PATCH";
  11673. METHODS[METHODS["PURGE"] = 29] = "PURGE";
  11674. /* CalDAV */
  11675. METHODS[METHODS["MKCALENDAR"] = 30] = "MKCALENDAR";
  11676. /* RFC-2068, section 19.6.1.2 */
  11677. METHODS[METHODS["LINK"] = 31] = "LINK";
  11678. METHODS[METHODS["UNLINK"] = 32] = "UNLINK";
  11679. /* icecast */
  11680. METHODS[METHODS["SOURCE"] = 33] = "SOURCE";
  11681. /* RFC-7540, section 11.6 */
  11682. METHODS[METHODS["PRI"] = 34] = "PRI";
  11683. /* RFC-2326 RTSP */
  11684. METHODS[METHODS["DESCRIBE"] = 35] = "DESCRIBE";
  11685. METHODS[METHODS["ANNOUNCE"] = 36] = "ANNOUNCE";
  11686. METHODS[METHODS["SETUP"] = 37] = "SETUP";
  11687. METHODS[METHODS["PLAY"] = 38] = "PLAY";
  11688. METHODS[METHODS["PAUSE"] = 39] = "PAUSE";
  11689. METHODS[METHODS["TEARDOWN"] = 40] = "TEARDOWN";
  11690. METHODS[METHODS["GET_PARAMETER"] = 41] = "GET_PARAMETER";
  11691. METHODS[METHODS["SET_PARAMETER"] = 42] = "SET_PARAMETER";
  11692. METHODS[METHODS["REDIRECT"] = 43] = "REDIRECT";
  11693. METHODS[METHODS["RECORD"] = 44] = "RECORD";
  11694. /* RAOP */
  11695. METHODS[METHODS["FLUSH"] = 45] = "FLUSH";
  11696. })(METHODS = exports.METHODS || (exports.METHODS = {}));
  11697. exports.METHODS_HTTP = [
  11698. METHODS.DELETE,
  11699. METHODS.GET,
  11700. METHODS.HEAD,
  11701. METHODS.POST,
  11702. METHODS.PUT,
  11703. METHODS.CONNECT,
  11704. METHODS.OPTIONS,
  11705. METHODS.TRACE,
  11706. METHODS.COPY,
  11707. METHODS.LOCK,
  11708. METHODS.MKCOL,
  11709. METHODS.MOVE,
  11710. METHODS.PROPFIND,
  11711. METHODS.PROPPATCH,
  11712. METHODS.SEARCH,
  11713. METHODS.UNLOCK,
  11714. METHODS.BIND,
  11715. METHODS.REBIND,
  11716. METHODS.UNBIND,
  11717. METHODS.ACL,
  11718. METHODS.REPORT,
  11719. METHODS.MKACTIVITY,
  11720. METHODS.CHECKOUT,
  11721. METHODS.MERGE,
  11722. METHODS['M-SEARCH'],
  11723. METHODS.NOTIFY,
  11724. METHODS.SUBSCRIBE,
  11725. METHODS.UNSUBSCRIBE,
  11726. METHODS.PATCH,
  11727. METHODS.PURGE,
  11728. METHODS.MKCALENDAR,
  11729. METHODS.LINK,
  11730. METHODS.UNLINK,
  11731. METHODS.PRI,
  11732. // TODO(indutny): should we allow it with HTTP?
  11733. METHODS.SOURCE,
  11734. ];
  11735. exports.METHODS_ICE = [
  11736. METHODS.SOURCE,
  11737. ];
  11738. exports.METHODS_RTSP = [
  11739. METHODS.OPTIONS,
  11740. METHODS.DESCRIBE,
  11741. METHODS.ANNOUNCE,
  11742. METHODS.SETUP,
  11743. METHODS.PLAY,
  11744. METHODS.PAUSE,
  11745. METHODS.TEARDOWN,
  11746. METHODS.GET_PARAMETER,
  11747. METHODS.SET_PARAMETER,
  11748. METHODS.REDIRECT,
  11749. METHODS.RECORD,
  11750. METHODS.FLUSH,
  11751. // For AirPlay
  11752. METHODS.GET,
  11753. METHODS.POST,
  11754. ];
  11755. exports.METHOD_MAP = utils_1.enumToMap(METHODS);
  11756. exports.H_METHOD_MAP = {};
  11757. Object.keys(exports.METHOD_MAP).forEach((key) => {
  11758. if (/^H/.test(key)) {
  11759. exports.H_METHOD_MAP[key] = exports.METHOD_MAP[key];
  11760. }
  11761. });
  11762. var FINISH;
  11763. (function (FINISH) {
  11764. FINISH[FINISH["SAFE"] = 0] = "SAFE";
  11765. FINISH[FINISH["SAFE_WITH_CB"] = 1] = "SAFE_WITH_CB";
  11766. FINISH[FINISH["UNSAFE"] = 2] = "UNSAFE";
  11767. })(FINISH = exports.FINISH || (exports.FINISH = {}));
  11768. exports.ALPHA = [];
  11769. for (let i = 'A'.charCodeAt(0); i <= 'Z'.charCodeAt(0); i++) {
  11770. // Upper case
  11771. exports.ALPHA.push(String.fromCharCode(i));
  11772. // Lower case
  11773. exports.ALPHA.push(String.fromCharCode(i + 0x20));
  11774. }
  11775. exports.NUM_MAP = {
  11776. 0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
  11777. 5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
  11778. };
  11779. exports.HEX_MAP = {
  11780. 0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
  11781. 5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
  11782. A: 0XA, B: 0XB, C: 0XC, D: 0XD, E: 0XE, F: 0XF,
  11783. a: 0xa, b: 0xb, c: 0xc, d: 0xd, e: 0xe, f: 0xf,
  11784. };
  11785. exports.NUM = [
  11786. '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  11787. ];
  11788. exports.ALPHANUM = exports.ALPHA.concat(exports.NUM);
  11789. exports.MARK = ['-', '_', '.', '!', '~', '*', '\'', '(', ')'];
  11790. exports.USERINFO_CHARS = exports.ALPHANUM
  11791. .concat(exports.MARK)
  11792. .concat(['%', ';', ':', '&', '=', '+', '$', ',']);
  11793. // TODO(indutny): use RFC
  11794. exports.STRICT_URL_CHAR = [
  11795. '!', '"', '$', '%', '&', '\'',
  11796. '(', ')', '*', '+', ',', '-', '.', '/',
  11797. ':', ';', '<', '=', '>',
  11798. '@', '[', '\\', ']', '^', '_',
  11799. '`',
  11800. '{', '|', '}', '~',
  11801. ].concat(exports.ALPHANUM);
  11802. exports.URL_CHAR = exports.STRICT_URL_CHAR
  11803. .concat(['\t', '\f']);
  11804. // All characters with 0x80 bit set to 1
  11805. for (let i = 0x80; i <= 0xff; i++) {
  11806. exports.URL_CHAR.push(i);
  11807. }
  11808. exports.HEX = exports.NUM.concat(['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']);
  11809. /* Tokens as defined by rfc 2616. Also lowercases them.
  11810. * token = 1*<any CHAR except CTLs or separators>
  11811. * separators = "(" | ")" | "<" | ">" | "@"
  11812. * | "," | ";" | ":" | "\" | <">
  11813. * | "/" | "[" | "]" | "?" | "="
  11814. * | "{" | "}" | SP | HT
  11815. */
  11816. exports.STRICT_TOKEN = [
  11817. '!', '#', '$', '%', '&', '\'',
  11818. '*', '+', '-', '.',
  11819. '^', '_', '`',
  11820. '|', '~',
  11821. ].concat(exports.ALPHANUM);
  11822. exports.TOKEN = exports.STRICT_TOKEN.concat([' ']);
  11823. /*
  11824. * Verify that a char is a valid visible (printable) US-ASCII
  11825. * character or %x80-FF
  11826. */
  11827. exports.HEADER_CHARS = ['\t'];
  11828. for (let i = 32; i <= 255; i++) {
  11829. if (i !== 127) {
  11830. exports.HEADER_CHARS.push(i);
  11831. }
  11832. }
  11833. // ',' = \x44
  11834. exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS.filter((c) => c !== 44);
  11835. exports.MAJOR = exports.NUM_MAP;
  11836. exports.MINOR = exports.MAJOR;
  11837. var HEADER_STATE;
  11838. (function (HEADER_STATE) {
  11839. HEADER_STATE[HEADER_STATE["GENERAL"] = 0] = "GENERAL";
  11840. HEADER_STATE[HEADER_STATE["CONNECTION"] = 1] = "CONNECTION";
  11841. HEADER_STATE[HEADER_STATE["CONTENT_LENGTH"] = 2] = "CONTENT_LENGTH";
  11842. HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING"] = 3] = "TRANSFER_ENCODING";
  11843. HEADER_STATE[HEADER_STATE["UPGRADE"] = 4] = "UPGRADE";
  11844. HEADER_STATE[HEADER_STATE["CONNECTION_KEEP_ALIVE"] = 5] = "CONNECTION_KEEP_ALIVE";
  11845. HEADER_STATE[HEADER_STATE["CONNECTION_CLOSE"] = 6] = "CONNECTION_CLOSE";
  11846. HEADER_STATE[HEADER_STATE["CONNECTION_UPGRADE"] = 7] = "CONNECTION_UPGRADE";
  11847. HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING_CHUNKED"] = 8] = "TRANSFER_ENCODING_CHUNKED";
  11848. })(HEADER_STATE = exports.HEADER_STATE || (exports.HEADER_STATE = {}));
  11849. exports.SPECIAL_HEADERS = {
  11850. 'connection': HEADER_STATE.CONNECTION,
  11851. 'content-length': HEADER_STATE.CONTENT_LENGTH,
  11852. 'proxy-connection': HEADER_STATE.CONNECTION,
  11853. 'transfer-encoding': HEADER_STATE.TRANSFER_ENCODING,
  11854. 'upgrade': HEADER_STATE.UPGRADE,
  11855. };
  11856. //# sourceMappingURL=constants.js.map
  11857. /***/ }),
  11858. /***/ 3870:
  11859. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11860. const { Buffer } = __nccwpck_require__(4573)
  11861. module.exports = Buffer.from('AGFzbQEAAAABJwdgAX8Bf2ADf39/AX9gAX8AYAJ/fwBgBH9/f38Bf2AAAGADf39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQAEA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4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cbdCECIAAoAgAhAAJAA0AgACIDKAIEQXhxIARGDQEgAkEddiEAIAJBAXQhAiADIABBBHFqQRBqIgcoAgAiAA0ACyAHIAE2AgAgASADNgIYIAEgATYCDCABIAE2AggMAQsgAygCCCIAIAE2AgwgAyABNgIIIAFBADYCGCABIAM2AgwgASAANgIIC0Gs0ABBrNAAKAIAQQFrIgBBfyAAGzYCAAsLBwAgAC0AKAsHACAALQAqCwcAIAAtACsLBwAgAC0AKQsHACAALwEyCwcAIAAtAC4LQAEEfyAAKAIYIQEgAC0ALSECIAAtACghAyAAKAI4IQQgABAwIAAgBDYCOCAAIAM6ACggACACOgAtIAAgATYCGAu74gECB38DfiABIAJqIQQCQCAAIgIoAgwiAA0AIAIoAgQEQCACIAE2AgQLIwBBEGsiCCQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAIoAhwiA0EBaw7dAdoBAdkBAgMEBQYHCAkKCwwNDtgBDxDXARES1gETFBUWFxgZGhvgAd8BHB0e1QEfICEiIyQl1AEmJygpKiss0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QAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAgJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAn8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCADDsYBAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHyAhIyUmKCorLC8wMTIzNDU2Nzk6Ozw9lANAQkRFRklLTk9QUVJTVFVWWFpbXF1eX2BhYmNkZWZnaGpsb3Bxc3V2eHl6e3x/gAGBAYIBgwGEAYUBhgGHAYgBiQGKAYsBjAGNAY4BjwGQAZEBkgGTAZQBlQGWAZcBmAGZAZoBmwGcAZ0BngGfAaABoQGiAaMBpAGlAaYB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R0dHR0AXQLIAFBAWohAUHmACEDDJgCCyABQQFqIQFB5wAhAwyXAgtB/QAhAyABIARGDa8CIAIoAgAiACAEIAFraiEFIAEgAGtBAmohBgJAA0AgAS0AACAAQe3PAGotAABHDXIgAEECRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAiAFNgIADLACCyACQQA2AgAgBkEBaiEBQRAMcwtB/gAhAyABIARGDa4CIAIoAgAiACAEIAFraiEFIAEgAGtBBWohBgJAA0AgAS0AACAAQfbOAGotAABHDXEgAEEFRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAiAFNgIADK8CCyACQQA2AgAgBkEBaiEBQRYMcgtB/wAhAyABIARGDa0CIAIoAgAiACAEIAFraiEFIAEgAGtBA2ohBgJAA0AgAS0AACAAQfzOAGotAABHDXAgAEEDRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAiAFNgIADK4CCyACQQA2AgAgBkEBaiEBQQUMcQsgASAERgRAQYABIQMMrQILIAEtAABB2QBHDW4gAUEBaiEBQQgMcAsgASAERgRAQYEBIQMMrAILAkACQCABLQAAQc4Aaw4DAG8BbwsgAUEBaiEBQesAIQMMkwILIAFBAWohAUHsACEDDJICCyABIARGBEBBggEhAwyrAgsCQAJAIAEtAABByABrDggAbm5ubm5uAW4LIAFBAWohAUHqACEDDJICCyABQQFqIQFB7QAhAwyRAgtBgwEhAyABIARGDakCIAIoAgAiACAEIAFraiEFIAEgAGtBAmohBgJAA0AgAS0AACAAQYDPAGotAABHDWwgAEECRg0BIABBAWohACAEIAFBAWoiAUcNAAsgAiAFNgIADKoCCyACQQA2AgAgBkEBaiEBQQAMbQtBhAEhAyABIARGDagCIAIoAgAiACAEIAFraiEFIAEgAGtBBGohBgJAA0AgAS0AACAAQYPPAGotAABHDWsgAEEERg0BIABBAWohACAEIAFBAWoiAUcNAAsgAiAFNgIADKkCCyACQQA2AgAgBkEBaiEBQSMMbAsgASAERgRAQYUBIQMMqAILAkACQCABLQAAQcwAaw4IAGtra2trawFrCyABQ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QQA2AgQgAiAAIAEQJSIARQ0RIAJB5QA2AhwgAiABNgIUIAIgADYCDEEAIQMMtAELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0gIAJB0wA2AhwgAiABNgIUIAIgADYCDEEAIQMMswELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0iIAJB0gA2AhwgAiABNgIUIAIgADYCDEEAIQMMsgELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0OIAJB5QA2AhwgAiABNgIUIAIgADYCDEEAIQMMsQELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0dIAJB0wA2AhwgAiABNgIUIAIgADYCDEEAIQMMsAELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0fIAJB0gA2AhwgAiABNgIUIAIgADYCDEEAIQMMrwELIABBP0cNASABQQFqCyEBQQUhAwyUAQtBACEDIAJBADYCHCACIAE2AhQgAkH9EjYCECACQQc2AgwMrAELIAJBADYCHCACIAE2AhQgAkHcCDYCECACQQc2AgxBACEDDKsBCyACKAIEIQAgAkEANgIEIAIgACABECUiAEUNByACQeUANgIcIAIgATYCFCACIAA2AgxBACEDDKoBCyACKAIEIQAgAkEANgIEIAIgACABECUiAEUNFiACQdMANgIcIAIgATYCFCACIAA2AgxBACEDDKkBCyACKAIEIQAgAkEANgIEIAIgACABECUiAEUNGCACQdIANgIcIAIgATYCFCACIAA2AgxBACEDDKgBCyACQQA2AhwgAiABNgIUIAJBxgo2AhAgAkEHNgIMQQAhAwynAQsgAigCBCEAIAJBADYCBCACIAAgARAlIgBFDQMgAkHlADYCHCACIAE2AhQgAiAANgIMQQAhAwymAQsgAigCBCEAIAJBADYCBCACIAAgARAlIgBFDRIgAkHTADYCHCACIAE2AhQgAiAANgIMQQAhAwylAQsgAigCBCEAIAJBADYCBCACIAAgARAlIgBFDRQgAkHSADYCHCACIAE2AhQgAiAANgIMQQAhAwykAQsgAigCBCEAIAJBADYCBCACIAAgARAlIgBFDQAgAkHlADYCHCACIAE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BAQBB+cYACwQBAAABAEGRxwAL3wEBAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAEH6yAALBAEAAAIAQZDJAAtfAwQAAAQEBAQEBAQEBAQEBQQEBAQEBAQEBAQEBAAEAAYHBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQABAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAQAQfrKAAsEAQAAAQBBkMsACwEBAEGqywALQQIAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAEH6zAALBAEAAAEAQZDNAAsBAQBBms0ACwYCAAAAAAIAQbHNAAs6AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBB8M4AC5YBTk9VTkNFRUNLT1VUTkVDVEVURUNSSUJFTFVTSEVURUFEU0VBUkNIUkdFQ1RJVklUWUxFTkRBUlZFT1RJRllQVElPTlNDSFNFQVlTVEFUQ0hHRU9SRElSRUNUT1JUUkNIUEFSQU1FVEVSVVJDRUJTQ1JJQkVBUkRPV05BQ0VJTkROS0NLVUJTQ1JJQkVIVFRQL0FEVFAv', 'base64')
  11862. /***/ }),
  11863. /***/ 3434:
  11864. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11865. const { Buffer } = __nccwpck_require__(4573)
  11866. module.exports =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ZBAXEgAEEBdGtBPmohAgsgASACNgIcIAFCADcCECACQQJ0QbzSAGohAAJAQZDQACgCACIDQQEgAnQiB3FFBEAgACABNgIAQZDQACADIAdyNgIAIAEgADYCGCABIAE2AgggASABNgIMDAELIARBGSACQQF2a0EAIAJBH0cbdCECIAAoAgAhAAJAA0AgACIDKAIEQXhxIARGDQEgAkEddiEAIAJBAXQhAiADIABBBHFqQRBqIgcoAgAiAA0ACyAHIAE2AgAgASADNgIYIAEgATYCDCABIAE2AggMAQsgAygCCCIAIAE2AgwgAyABNgIIIAFBADYCGCABIAM2AgwgASAANgIIC0Gs0ABBrNAAKAIAQQFrIgBBfyAAGzYCAAsLBwAgAC0AKAsHACAALQAqCwcAIAAtACsLBwAgAC0AKQsHACAALwEyCwcAIAAtAC4LQAEEfyAAKAIYIQEgAC0ALSECIAAtACghAyAAKAI4IQQgABAwIAAgBDYCOCAAIAM6ACggACACOgAtIAAgATYCGAu74gECB38DfiABIAJqIQQCQCAAIgIoAgwiAA0AIAIoAgQEQCACIAE2AgQLIwBBEGsiCCQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJA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AAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAgJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAn8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCADDsYBAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHyAhIyUmKCorLC8wMTIzNDU2Nzk6Ozw9lANAQkRFRklLTk9QUVJTVFVW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M8AELIAFBAWohAUGKASEDDO8BCyABQQFqIQFBjwEhAwzuAQsgAUEBaiEBQZEBIQMM7QELQacBIQMgASAERg2FAiACKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEHtzwBqLQAARw1IIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAIgBTYCAAyGAgsgAkEANgIAIAZBAWohAUERDEkLQagBIQMgASAERg2EAiACKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEHCzwBqLQAARw1HIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAIgBTYCAAyFAgsgAkEANgIAIAZBAWohAUEsDEgLQakBIQMgASAERg2DAiACKAIAIgAgBCABa2ohBSABIABrQQRqIQYCQANAIAEtAAAgAEHFzwBqLQAARw1GIABBBEYNASAAQQFqIQAgBCABQQFqIgFHDQALIAIgBTYCAAyEAgsgAkEANgIAIAZBAWohAUErDEcLQaoBIQMgASAERg2CAiACKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEHKzwBqLQAARw1FIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAIgBTYCAAyDAgsgAkEANgIAIAZBAWohAUEUDEYLIAEgBEYEQEGrASEDDIICCwJAAkACQAJAIAEtAABBwgBrDg8AAQJHR0dHR0dHR0dHRwNHCyABQQFqIQFBkwEhAwzrAQsgAUEBaiEBQZQBIQMM6gELIAFBAWohAUGVASEDDOkBCyABQQFqIQFBlgEhAwzoAQsgASAERgRAQawBIQMMgQILIAEtAABBxQBHDUIgAUEBaiEBDD0LQa0BIQMgASAERg3/ASACKAIAIgAgBCABa2ohBSABIABrQQJqIQYCQANAIAEtAAAgAEHNzwBqLQAARw1CIABBAkYNASAAQQFqIQAgBCABQQFqIgFHDQALIAIgBTYCAAyAAgsgAkEANgIAIAZBAWohAUEODEMLIAEgBEYEQEGuASEDDP8BCyABLQAAQdAARw1AIAFBAWohAUElDEILQa8BIQMgASAERg39ASACKAIA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AJBADYCHCACIAE2AhQgAkGMHDYCECACQQc2AgxBACEDDLcBCyACQQA2AhwgAiABNgIUIAJBww82AhAgAkEHNgIMQQAhAwy2AQsgAkEANgIcIAIgATYCFCACQcMPNgIQIAJBBzYCDEEAIQMMtQELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0RIAJB5QA2AhwgAiABNgIUIAIgADYCDEEAIQMMtAELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0gIAJB0wA2AhwgAiABNgIUIAIgADYCDEEAIQMMswELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0iIAJB0gA2AhwgAiABNgIUIAIgADYCDEEAIQMMsgELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0OIAJB5QA2AhwgAiABNgIUIAIgADYCDEEAIQMMsQELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0dIAJB0wA2AhwgAiABNgIUIAIgADYCDEEAIQMMsAELIAIoAgQhACACQQA2AgQgAiAAIAEQJSIARQ0fIAJB0gA2AhwgAiABNgIUIAIgADYCDEEAIQMMrwELIABBP0cNASABQQFqCyEBQQUhAwyUAQtBACEDIAJBADYCHCACIAE2AhQgAkH9EjYCECACQQc2AgwMrAELIAJBADYCHCACIAE2AhQgAkHcCDYCECACQQc2AgxBACEDDKsBCyACKAIEIQAgAkEANgIEIAIgACABECUiAEUNByACQeUANgIcIAIgATYCFCACIAA2AgxBACEDDKoBCyACKAIEIQAgAkEANgIEIAIgACABECUiAEUNFiACQdMANgIcIAIgATYCFCACIAA2AgxBACEDDKkBCyACKAIEIQAgAkEANgIEIAIgACABECUiAEUNGCACQdIANgIcIAIgATYCFCACIAA2AgxBACEDDKgBCyACQQA2AhwgAiABNgIUIAJBxgo2AhAgAkEHNgIMQQAhAwynAQsgAigCBCEAIAJBADYCBCACIAAgARAlIgBFDQMgAkHlADYCHCACIAE2AhQgAiAANgIMQQAhAwymAQsgAigCBCEAIAJBADYCBCACIAAgARAlIgBFDRIgAkHTAD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CEJIAAoAgwiAyAARwRAQZzQACgCABogAyAAKAIIIgE2AgggASADNgIMDBALIABBFGoiAigCACIBRQRAIAAoAhAiAUUNAyAAQRBqIQILA0AgAiEHIAEiA0EUaiICKAIAIgENACADQRBqIQIgAygCECIBDQALIAdBADYCAAwPC0F/IQQgAEG/f0sNACAAQRNqIgFBcHEhBEGQ0AAoAgAiCEUNAEEAIARrIQUCQAJAAkACf0EAIARBgAJJDQAaQR8gBEH///8HSw0AGiAEQSYgAUEIdmciAGt2QQFxIABBAXRrQT5qCyIGQQJ0QbzSAGooAgAiAkUEQEEAIQFBACEDDAELQQAhASAEQRkgBkEBdmtBACAGQR9HG3QhAEEAIQMDQAJAIAIoAgRBeHEgBGsiByAFTw0AIAIhAyAHIgUNAEEAIQUgAiEBDAMLIAEgAkEUaigCACIHIAcgAiAAQR12QQRxakEQaigCACICRhsgASAHGyEBIABBAXQhACACDQALCyABIANyRQRAQQAhA0ECIAZ0IgBBACAAa3IgCHEiAEUNAyAAaEECdEG80gBqKAIAIQELIAFFDQELA0AgASgCBEF4cSAEayICIAVJIQAgAiAFIAAbIQUgASADIAAbIQMgASgCECIABH8gAAUgAUEUaigCAAsiAQ0ACwsgA0UNACAFQZTQACgCACAEa08NACADKAIYIQcgAyADKAIMIgBHBEBBnNAAKAIAGiAAIAMoAggiATYCCCABIAA2AgwMDgsgA0EUaiICKAIAIgFFBEAgAygCECIBRQ0DIANBEGohAgsDQCACIQYgASIAQRRqIgIoAgAiAQ0AIABBEGohAiAAKAIQIgENAAsgBkEANgIADA0LQZTQACgCACIDIARPBEBBoNAAKAIAIQECQCADIARrIgJBEE8EQCABIARqIgAgAkEBcjYCBCABIANqIAI2AgAgASAEQQNyNgIEDAELIAEgA0EDcjYCBCABIANqIgAgACgCBEEBcjYCBEEAIQBBACECC0GU0AAgAjYCAEGg0AAgADYCACABQQhqIQEMDwtBmNAAKAIAIgMgBEsEQCAEIAlqIgAgAyAEayIBQQFyNgIEQaTQACAANgIAQZjQACAB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FlMRU5EQVJWRU9USUZZUFRJT05TQ0hTRUFZU1RBVENIR0VPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFSFRUUC9BRFRQLw==', 'base64')
  11867. /***/ }),
  11868. /***/ 172:
  11869. /***/ ((__unused_webpack_module, exports) => {
  11870. Object.defineProperty(exports, "__esModule", ({ value: true }));
  11871. exports.enumToMap = void 0;
  11872. function enumToMap(obj) {
  11873. const res = {};
  11874. Object.keys(obj).forEach((key) => {
  11875. const value = obj[key];
  11876. if (typeof value === 'number') {
  11877. res[key] = value;
  11878. }
  11879. });
  11880. return res;
  11881. }
  11882. exports.enumToMap = enumToMap;
  11883. //# sourceMappingURL=utils.js.map
  11884. /***/ }),
  11885. /***/ 7501:
  11886. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11887. const { kClients } = __nccwpck_require__(6443)
  11888. const Agent = __nccwpck_require__(7405)
  11889. const {
  11890. kAgent,
  11891. kMockAgentSet,
  11892. kMockAgentGet,
  11893. kDispatches,
  11894. kIsMockActive,
  11895. kNetConnect,
  11896. kGetNetConnect,
  11897. kOptions,
  11898. kFactory
  11899. } = __nccwpck_require__(1117)
  11900. const MockClient = __nccwpck_require__(7365)
  11901. const MockPool = __nccwpck_require__(4004)
  11902. const { matchValue, buildMockOptions } = __nccwpck_require__(3397)
  11903. const { InvalidArgumentError, UndiciError } = __nccwpck_require__(8707)
  11904. const Dispatcher = __nccwpck_require__(883)
  11905. const Pluralizer = __nccwpck_require__(1529)
  11906. const PendingInterceptorsFormatter = __nccwpck_require__(6142)
  11907. class MockAgent extends Dispatcher {
  11908. constructor (opts) {
  11909. super(opts)
  11910. this[kNetConnect] = true
  11911. this[kIsMockActive] = true
  11912. // Instantiate Agent and encapsulate
  11913. if ((opts?.agent && typeof opts.agent.dispatch !== 'function')) {
  11914. throw new InvalidArgumentError('Argument opts.agent must implement Agent')
  11915. }
  11916. const agent = opts?.agent ? opts.agent : new Agent(opts)
  11917. this[kAgent] = agent
  11918. this[kClients] = agent[kClients]
  11919. this[kOptions] = buildMockOptions(opts)
  11920. }
  11921. get (origin) {
  11922. let dispatcher = this[kMockAgentGet](origin)
  11923. if (!dispatcher) {
  11924. dispatcher = this[kFactory](origin)
  11925. this[kMockAgentSet](origin, dispatcher)
  11926. }
  11927. return dispatcher
  11928. }
  11929. dispatch (opts, handler) {
  11930. // Call MockAgent.get to perform additional setup before dispatching as normal
  11931. this.get(opts.origin)
  11932. return this[kAgent].dispatch(opts, handler)
  11933. }
  11934. async close () {
  11935. await this[kAgent].close()
  11936. this[kClients].clear()
  11937. }
  11938. deactivate () {
  11939. this[kIsMockActive] = false
  11940. }
  11941. activate () {
  11942. this[kIsMockActive] = true
  11943. }
  11944. enableNetConnect (matcher) {
  11945. if (typeof matcher === 'string' || typeof matcher === 'function' || matcher instanceof RegExp) {
  11946. if (Array.isArray(this[kNetConnect])) {
  11947. this[kNetConnect].push(matcher)
  11948. } else {
  11949. this[kNetConnect] = [matcher]
  11950. }
  11951. } else if (typeof matcher === 'undefined') {
  11952. this[kNetConnect] = true
  11953. } else {
  11954. throw new InvalidArgumentError('Unsupported matcher. Must be one of String|Function|RegExp.')
  11955. }
  11956. }
  11957. disableNetConnect () {
  11958. this[kNetConnect] = false
  11959. }
  11960. // This is required to bypass issues caused by using global symbols - see:
  11961. // https://github.com/nodejs/undici/issues/1447
  11962. get isMockActive () {
  11963. return this[kIsMockActive]
  11964. }
  11965. [kMockAgentSet] (origin, dispatcher) {
  11966. this[kClients].set(origin, dispatcher)
  11967. }
  11968. [kFactory] (origin) {
  11969. const mockOptions = Object.assign({ agent: this }, this[kOptions])
  11970. return this[kOptions] && this[kOptions].connections === 1
  11971. ? new MockClient(origin, mockOptions)
  11972. : new MockPool(origin, mockOptions)
  11973. }
  11974. [kMockAgentGet] (origin) {
  11975. // First check if we can immediately find it
  11976. const client = this[kClients].get(origin)
  11977. if (client) {
  11978. return client
  11979. }
  11980. // If the origin is not a string create a dummy parent pool and return to user
  11981. if (typeof origin !== 'string') {
  11982. const dispatcher = this[kFactory]('http://localhost:9999')
  11983. this[kMockAgentSet](origin, dispatcher)
  11984. return dispatcher
  11985. }
  11986. // If we match, create a pool and assign the same dispatches
  11987. for (const [keyMatcher, nonExplicitDispatcher] of Array.from(this[kClients])) {
  11988. if (nonExplicitDispatcher && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) {
  11989. const dispatcher = this[kFactory](origin)
  11990. this[kMockAgentSet](origin, dispatcher)
  11991. dispatcher[kDispatches] = nonExplicitDispatcher[kDispatches]
  11992. return dispatcher
  11993. }
  11994. }
  11995. }
  11996. [kGetNetConnect] () {
  11997. return this[kNetConnect]
  11998. }
  11999. pendingInterceptors () {
  12000. const mockAgentClients = this[kClients]
  12001. return Array.from(mockAgentClients.entries())
  12002. .flatMap(([origin, scope]) => scope[kDispatches].map(dispatch => ({ ...dispatch, origin })))
  12003. .filter(({ pending }) => pending)
  12004. }
  12005. assertNoPendingInterceptors ({ pendingInterceptorsFormatter = new PendingInterceptorsFormatter() } = {}) {
  12006. const pending = this.pendingInterceptors()
  12007. if (pending.length === 0) {
  12008. return
  12009. }
  12010. const pluralizer = new Pluralizer('interceptor', 'interceptors').pluralize(pending.length)
  12011. throw new UndiciError(`
  12012. ${pluralizer.count} ${pluralizer.noun} ${pluralizer.is} pending:
  12013. ${pendingInterceptorsFormatter.format(pending)}
  12014. `.trim())
  12015. }
  12016. }
  12017. module.exports = MockAgent
  12018. /***/ }),
  12019. /***/ 7365:
  12020. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12021. const { promisify } = __nccwpck_require__(7975)
  12022. const Client = __nccwpck_require__(3701)
  12023. const { buildMockDispatch } = __nccwpck_require__(3397)
  12024. const {
  12025. kDispatches,
  12026. kMockAgent,
  12027. kClose,
  12028. kOriginalClose,
  12029. kOrigin,
  12030. kOriginalDispatch,
  12031. kConnected
  12032. } = __nccwpck_require__(1117)
  12033. const { MockInterceptor } = __nccwpck_require__(1511)
  12034. const Symbols = __nccwpck_require__(6443)
  12035. const { InvalidArgumentError } = __nccwpck_require__(8707)
  12036. /**
  12037. * MockClient provides an API that extends the Client to influence the mockDispatches.
  12038. */
  12039. class MockClient extends Client {
  12040. constructor (origin, opts) {
  12041. super(origin, opts)
  12042. if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') {
  12043. throw new InvalidArgumentError('Argument opts.agent must implement Agent')
  12044. }
  12045. this[kMockAgent] = opts.agent
  12046. this[kOrigin] = origin
  12047. this[kDispatches] = []
  12048. this[kConnected] = 1
  12049. this[kOriginalDispatch] = this.dispatch
  12050. this[kOriginalClose] = this.close.bind(this)
  12051. this.dispatch = buildMockDispatch.call(this)
  12052. this.close = this[kClose]
  12053. }
  12054. get [Symbols.kConnected] () {
  12055. return this[kConnected]
  12056. }
  12057. /**
  12058. * Sets up the base interceptor for mocking replies from undici.
  12059. */
  12060. intercept (opts) {
  12061. return new MockInterceptor(opts, this[kDispatches])
  12062. }
  12063. async [kClose] () {
  12064. await promisify(this[kOriginalClose])()
  12065. this[kConnected] = 0
  12066. this[kMockAgent][Symbols.kClients].delete(this[kOrigin])
  12067. }
  12068. }
  12069. module.exports = MockClient
  12070. /***/ }),
  12071. /***/ 2429:
  12072. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12073. const { UndiciError } = __nccwpck_require__(8707)
  12074. const kMockNotMatchedError = Symbol.for('undici.error.UND_MOCK_ERR_MOCK_NOT_MATCHED')
  12075. /**
  12076. * The request does not match any registered mock dispatches.
  12077. */
  12078. class MockNotMatchedError extends UndiciError {
  12079. constructor (message) {
  12080. super(message)
  12081. Error.captureStackTrace(this, MockNotMatchedError)
  12082. this.name = 'MockNotMatchedError'
  12083. this.message = message || 'The request does not match any registered mock dispatches'
  12084. this.code = 'UND_MOCK_ERR_MOCK_NOT_MATCHED'
  12085. }
  12086. static [Symbol.hasInstance] (instance) {
  12087. return instance && instance[kMockNotMatchedError] === true
  12088. }
  12089. [kMockNotMatchedError] = true
  12090. }
  12091. module.exports = {
  12092. MockNotMatchedError
  12093. }
  12094. /***/ }),
  12095. /***/ 1511:
  12096. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12097. const { getResponseData, buildKey, addMockDispatch } = __nccwpck_require__(3397)
  12098. const {
  12099. kDispatches,
  12100. kDispatchKey,
  12101. kDefaultHeaders,
  12102. kDefaultTrailers,
  12103. kContentLength,
  12104. kMockDispatch
  12105. } = __nccwpck_require__(1117)
  12106. const { InvalidArgumentError } = __nccwpck_require__(8707)
  12107. const { buildURL } = __nccwpck_require__(3440)
  12108. /**
  12109. * Defines the scope API for an interceptor reply
  12110. */
  12111. class MockScope {
  12112. constructor (mockDispatch) {
  12113. this[kMockDispatch] = mockDispatch
  12114. }
  12115. /**
  12116. * Delay a reply by a set amount in ms.
  12117. */
  12118. delay (waitInMs) {
  12119. if (typeof waitInMs !== 'number' || !Number.isInteger(waitInMs) || waitInMs <= 0) {
  12120. throw new InvalidArgumentError('waitInMs must be a valid integer > 0')
  12121. }
  12122. this[kMockDispatch].delay = waitInMs
  12123. return this
  12124. }
  12125. /**
  12126. * For a defined reply, never mark as consumed.
  12127. */
  12128. persist () {
  12129. this[kMockDispatch].persist = true
  12130. return this
  12131. }
  12132. /**
  12133. * Allow one to define a reply for a set amount of matching requests.
  12134. */
  12135. times (repeatTimes) {
  12136. if (typeof repeatTimes !== 'number' || !Number.isInteger(repeatTimes) || repeatTimes <= 0) {
  12137. throw new InvalidArgumentError('repeatTimes must be a valid integer > 0')
  12138. }
  12139. this[kMockDispatch].times = repeatTimes
  12140. return this
  12141. }
  12142. }
  12143. /**
  12144. * Defines an interceptor for a Mock
  12145. */
  12146. class MockInterceptor {
  12147. constructor (opts, mockDispatches) {
  12148. if (typeof opts !== 'object') {
  12149. throw new InvalidArgumentError('opts must be an object')
  12150. }
  12151. if (typeof opts.path === 'undefined') {
  12152. throw new InvalidArgumentError('opts.path must be defined')
  12153. }
  12154. if (typeof opts.method === 'undefined') {
  12155. opts.method = 'GET'
  12156. }
  12157. // See https://github.com/nodejs/undici/issues/1245
  12158. // As per RFC 3986, clients are not supposed to send URI
  12159. // fragments to servers when they retrieve a document,
  12160. if (typeof opts.path === 'string') {
  12161. if (opts.query) {
  12162. opts.path = buildURL(opts.path, opts.query)
  12163. } else {
  12164. // Matches https://github.com/nodejs/undici/blob/main/lib/web/fetch/index.js#L1811
  12165. const parsedURL = new URL(opts.path, 'data://')
  12166. opts.path = parsedURL.pathname + parsedURL.search
  12167. }
  12168. }
  12169. if (typeof opts.method === 'string') {
  12170. opts.method = opts.method.toUpperCase()
  12171. }
  12172. this[kDispatchKey] = buildKey(opts)
  12173. this[kDispatches] = mockDispatches
  12174. this[kDefaultHeaders] = {}
  12175. this[kDefaultTrailers] = {}
  12176. this[kContentLength] = false
  12177. }
  12178. createMockScopeDispatchData ({ statusCode, data, responseOptions }) {
  12179. const responseData = getResponseData(data)
  12180. const contentLength = this[kContentLength] ? { 'content-length': responseData.length } : {}
  12181. const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }
  12182. const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }
  12183. return { statusCode, data, headers, trailers }
  12184. }
  12185. validateReplyParameters (replyParameters) {
  12186. if (typeof replyParameters.statusCode === 'undefined') {
  12187. throw new InvalidArgumentError('statusCode must be defined')
  12188. }
  12189. if (typeof replyParameters.responseOptions !== 'object' || replyParameters.responseOptions === null) {
  12190. throw new InvalidArgumentError('responseOptions must be an object')
  12191. }
  12192. }
  12193. /**
  12194. * Mock an undici request with a defined reply.
  12195. */
  12196. reply (replyOptionsCallbackOrStatusCode) {
  12197. // Values of reply aren't available right now as they
  12198. // can only be available when the reply callback is invoked.
  12199. if (typeof replyOptionsCallbackOrStatusCode === 'function') {
  12200. // We'll first wrap the provided callback in another function,
  12201. // this function will properly resolve the data from the callback
  12202. // when invoked.
  12203. const wrappedDefaultsCallback = (opts) => {
  12204. // Our reply options callback contains the parameter for statusCode, data and options.
  12205. const resolvedData = replyOptionsCallbackOrStatusCode(opts)
  12206. // Check if it is in the right format
  12207. if (typeof resolvedData !== 'object' || resolvedData === null) {
  12208. throw new InvalidArgumentError('reply options callback must return an object')
  12209. }
  12210. const replyParameters = { data: '', responseOptions: {}, ...resolvedData }
  12211. this.validateReplyParameters(replyParameters)
  12212. // Since the values can be obtained immediately we return them
  12213. // from this higher order function that will be resolved later.
  12214. return {
  12215. ...this.createMockScopeDispatchData(replyParameters)
  12216. }
  12217. }
  12218. // Add usual dispatch data, but this time set the data parameter to function that will eventually provide data.
  12219. const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], wrappedDefaultsCallback)
  12220. return new MockScope(newMockDispatch)
  12221. }
  12222. // We can have either one or three parameters, if we get here,
  12223. // we should have 1-3 parameters. So we spread the arguments of
  12224. // this function to obtain the parameters, since replyData will always
  12225. // just be the statusCode.
  12226. const replyParameters = {
  12227. statusCode: replyOptionsCallbackOrStatusCode,
  12228. data: arguments[1] === undefined ? '' : arguments[1],
  12229. responseOptions: arguments[2] === undefined ? {} : arguments[2]
  12230. }
  12231. this.validateReplyParameters(replyParameters)
  12232. // Send in-already provided data like usual
  12233. const dispatchData = this.createMockScopeDispatchData(replyParameters)
  12234. const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], dispatchData)
  12235. return new MockScope(newMockDispatch)
  12236. }
  12237. /**
  12238. * Mock an undici request with a defined error.
  12239. */
  12240. replyWithError (error) {
  12241. if (typeof error === 'undefined') {
  12242. throw new InvalidArgumentError('error must be defined')
  12243. }
  12244. const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error })
  12245. return new MockScope(newMockDispatch)
  12246. }
  12247. /**
  12248. * Set default reply headers on the interceptor for subsequent replies
  12249. */
  12250. defaultReplyHeaders (headers) {
  12251. if (typeof headers === 'undefined') {
  12252. throw new InvalidArgumentError('headers must be defined')
  12253. }
  12254. this[kDefaultHeaders] = headers
  12255. return this
  12256. }
  12257. /**
  12258. * Set default reply trailers on the interceptor for subsequent replies
  12259. */
  12260. defaultReplyTrailers (trailers) {
  12261. if (typeof trailers === 'undefined') {
  12262. throw new InvalidArgumentError('trailers must be defined')
  12263. }
  12264. this[kDefaultTrailers] = trailers
  12265. return this
  12266. }
  12267. /**
  12268. * Set reply content length header for replies on the interceptor
  12269. */
  12270. replyContentLength () {
  12271. this[kContentLength] = true
  12272. return this
  12273. }
  12274. }
  12275. module.exports.MockInterceptor = MockInterceptor
  12276. module.exports.MockScope = MockScope
  12277. /***/ }),
  12278. /***/ 4004:
  12279. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12280. const { promisify } = __nccwpck_require__(7975)
  12281. const Pool = __nccwpck_require__(628)
  12282. const { buildMockDispatch } = __nccwpck_require__(3397)
  12283. const {
  12284. kDispatches,
  12285. kMockAgent,
  12286. kClose,
  12287. kOriginalClose,
  12288. kOrigin,
  12289. kOriginalDispatch,
  12290. kConnected
  12291. } = __nccwpck_require__(1117)
  12292. const { MockInterceptor } = __nccwpck_require__(1511)
  12293. const Symbols = __nccwpck_require__(6443)
  12294. const { InvalidArgumentError } = __nccwpck_require__(8707)
  12295. /**
  12296. * MockPool provides an API that extends the Pool to influence the mockDispatches.
  12297. */
  12298. class MockPool extends Pool {
  12299. constructor (origin, opts) {
  12300. super(origin, opts)
  12301. if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') {
  12302. throw new InvalidArgumentError('Argument opts.agent must implement Agent')
  12303. }
  12304. this[kMockAgent] = opts.agent
  12305. this[kOrigin] = origin
  12306. this[kDispatches] = []
  12307. this[kConnected] = 1
  12308. this[kOriginalDispatch] = this.dispatch
  12309. this[kOriginalClose] = this.close.bind(this)
  12310. this.dispatch = buildMockDispatch.call(this)
  12311. this.close = this[kClose]
  12312. }
  12313. get [Symbols.kConnected] () {
  12314. return this[kConnected]
  12315. }
  12316. /**
  12317. * Sets up the base interceptor for mocking replies from undici.
  12318. */
  12319. intercept (opts) {
  12320. return new MockInterceptor(opts, this[kDispatches])
  12321. }
  12322. async [kClose] () {
  12323. await promisify(this[kOriginalClose])()
  12324. this[kConnected] = 0
  12325. this[kMockAgent][Symbols.kClients].delete(this[kOrigin])
  12326. }
  12327. }
  12328. module.exports = MockPool
  12329. /***/ }),
  12330. /***/ 1117:
  12331. /***/ ((module) => {
  12332. module.exports = {
  12333. kAgent: Symbol('agent'),
  12334. kOptions: Symbol('options'),
  12335. kFactory: Symbol('factory'),
  12336. kDispatches: Symbol('dispatches'),
  12337. kDispatchKey: Symbol('dispatch key'),
  12338. kDefaultHeaders: Symbol('default headers'),
  12339. kDefaultTrailers: Symbol('default trailers'),
  12340. kContentLength: Symbol('content length'),
  12341. kMockAgent: Symbol('mock agent'),
  12342. kMockAgentSet: Symbol('mock agent set'),
  12343. kMockAgentGet: Symbol('mock agent get'),
  12344. kMockDispatch: Symbol('mock dispatch'),
  12345. kClose: Symbol('close'),
  12346. kOriginalClose: Symbol('original agent close'),
  12347. kOrigin: Symbol('origin'),
  12348. kIsMockActive: Symbol('is mock active'),
  12349. kNetConnect: Symbol('net connect'),
  12350. kGetNetConnect: Symbol('get net connect'),
  12351. kConnected: Symbol('connected')
  12352. }
  12353. /***/ }),
  12354. /***/ 3397:
  12355. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12356. const { MockNotMatchedError } = __nccwpck_require__(2429)
  12357. const {
  12358. kDispatches,
  12359. kMockAgent,
  12360. kOriginalDispatch,
  12361. kOrigin,
  12362. kGetNetConnect
  12363. } = __nccwpck_require__(1117)
  12364. const { buildURL } = __nccwpck_require__(3440)
  12365. const { STATUS_CODES } = __nccwpck_require__(7067)
  12366. const {
  12367. types: {
  12368. isPromise
  12369. }
  12370. } = __nccwpck_require__(7975)
  12371. function matchValue (match, value) {
  12372. if (typeof match === 'string') {
  12373. return match === value
  12374. }
  12375. if (match instanceof RegExp) {
  12376. return match.test(value)
  12377. }
  12378. if (typeof match === 'function') {
  12379. return match(value) === true
  12380. }
  12381. return false
  12382. }
  12383. function lowerCaseEntries (headers) {
  12384. return Object.fromEntries(
  12385. Object.entries(headers).map(([headerName, headerValue]) => {
  12386. return [headerName.toLocaleLowerCase(), headerValue]
  12387. })
  12388. )
  12389. }
  12390. /**
  12391. * @param {import('../../index').Headers|string[]|Record<string, string>} headers
  12392. * @param {string} key
  12393. */
  12394. function getHeaderByName (headers, key) {
  12395. if (Array.isArray(headers)) {
  12396. for (let i = 0; i < headers.length; i += 2) {
  12397. if (headers[i].toLocaleLowerCase() === key.toLocaleLowerCase()) {
  12398. return headers[i + 1]
  12399. }
  12400. }
  12401. return undefined
  12402. } else if (typeof headers.get === 'function') {
  12403. return headers.get(key)
  12404. } else {
  12405. return lowerCaseEntries(headers)[key.toLocaleLowerCase()]
  12406. }
  12407. }
  12408. /** @param {string[]} headers */
  12409. function buildHeadersFromArray (headers) { // fetch HeadersList
  12410. const clone = headers.slice()
  12411. const entries = []
  12412. for (let index = 0; index < clone.length; index += 2) {
  12413. entries.push([clone[index], clone[index + 1]])
  12414. }
  12415. return Object.fromEntries(entries)
  12416. }
  12417. function matchHeaders (mockDispatch, headers) {
  12418. if (typeof mockDispatch.headers === 'function') {
  12419. if (Array.isArray(headers)) { // fetch HeadersList
  12420. headers = buildHeadersFromArray(headers)
  12421. }
  12422. return mockDispatch.headers(headers ? lowerCaseEntries(headers) : {})
  12423. }
  12424. if (typeof mockDispatch.headers === 'undefined') {
  12425. return true
  12426. }
  12427. if (typeof headers !== 'object' || typeof mockDispatch.headers !== 'object') {
  12428. return false
  12429. }
  12430. for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch.headers)) {
  12431. const headerValue = getHeaderByName(headers, matchHeaderName)
  12432. if (!matchValue(matchHeaderValue, headerValue)) {
  12433. return false
  12434. }
  12435. }
  12436. return true
  12437. }
  12438. function safeUrl (path) {
  12439. if (typeof path !== 'string') {
  12440. return path
  12441. }
  12442. const pathSegments = path.split('?')
  12443. if (pathSegments.length !== 2) {
  12444. return path
  12445. }
  12446. const qp = new URLSearchParams(pathSegments.pop())
  12447. qp.sort()
  12448. return [...pathSegments, qp.toString()].join('?')
  12449. }
  12450. function matchKey (mockDispatch, { path, method, body, headers }) {
  12451. const pathMatch = matchValue(mockDispatch.path, path)
  12452. const methodMatch = matchValue(mockDispatch.method, method)
  12453. const bodyMatch = typeof mockDispatch.body !== 'undefined' ? matchValue(mockDispatch.body, body) : true
  12454. const headersMatch = matchHeaders(mockDispatch, headers)
  12455. return pathMatch && methodMatch && bodyMatch && headersMatch
  12456. }
  12457. function getResponseData (data) {
  12458. if (Buffer.isBuffer(data)) {
  12459. return data
  12460. } else if (data instanceof Uint8Array) {
  12461. return data
  12462. } else if (data instanceof ArrayBuffer) {
  12463. return data
  12464. } else if (typeof data === 'object') {
  12465. return JSON.stringify(data)
  12466. } else {
  12467. return data.toString()
  12468. }
  12469. }
  12470. function getMockDispatch (mockDispatches, key) {
  12471. const basePath = key.query ? buildURL(key.path, key.query) : key.path
  12472. const resolvedPath = typeof basePath === 'string' ? safeUrl(basePath) : basePath
  12473. // Match path
  12474. let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path }) => matchValue(safeUrl(path), resolvedPath))
  12475. if (matchedMockDispatches.length === 0) {
  12476. throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`)
  12477. }
  12478. // Match method
  12479. matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method))
  12480. if (matchedMockDispatches.length === 0) {
  12481. throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}' on path '${resolvedPath}'`)
  12482. }
  12483. // Match body
  12484. matchedMockDispatches = matchedMockDispatches.filter(({ body }) => typeof body !== 'undefined' ? matchValue(body, key.body) : true)
  12485. if (matchedMockDispatches.length === 0) {
  12486. throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}' on path '${resolvedPath}'`)
  12487. }
  12488. // Match headers
  12489. matchedMockDispatches = matchedMockDispatches.filter((mockDispatch) => matchHeaders(mockDispatch, key.headers))
  12490. if (matchedMockDispatches.length === 0) {
  12491. const headers = typeof key.headers === 'object' ? JSON.stringify(key.headers) : key.headers
  12492. throw new MockNotMatchedError(`Mock dispatch not matched for headers '${headers}' on path '${resolvedPath}'`)
  12493. }
  12494. return matchedMockDispatches[0]
  12495. }
  12496. function addMockDispatch (mockDispatches, key, data) {
  12497. const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false }
  12498. const replyData = typeof data === 'function' ? { callback: data } : { ...data }
  12499. const newMockDispatch = { ...baseData, ...key, pending: true, data: { error: null, ...replyData } }
  12500. mockDispatches.push(newMockDispatch)
  12501. return newMockDispatch
  12502. }
  12503. function deleteMockDispatch (mockDispatches, key) {
  12504. const index = mockDispatches.findIndex(dispatch => {
  12505. if (!dispatch.consumed) {
  12506. return false
  12507. }
  12508. return matchKey(dispatch, key)
  12509. })
  12510. if (index !== -1) {
  12511. mockDispatches.splice(index, 1)
  12512. }
  12513. }
  12514. function buildKey (opts) {
  12515. const { path, method, body, headers, query } = opts
  12516. return {
  12517. path,
  12518. method,
  12519. body,
  12520. headers,
  12521. query
  12522. }
  12523. }
  12524. function generateKeyValues (data) {
  12525. const keys = Object.keys(data)
  12526. const result = []
  12527. for (let i = 0; i < keys.length; ++i) {
  12528. const key = keys[i]
  12529. const value = data[key]
  12530. const name = Buffer.from(`${key}`)
  12531. if (Array.isArray(value)) {
  12532. for (let j = 0; j < value.length; ++j) {
  12533. result.push(name, Buffer.from(`${value[j]}`))
  12534. }
  12535. } else {
  12536. result.push(name, Buffer.from(`${value}`))
  12537. }
  12538. }
  12539. return result
  12540. }
  12541. /**
  12542. * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
  12543. * @param {number} statusCode
  12544. */
  12545. function getStatusText (statusCode) {
  12546. return STATUS_CODES[statusCode] || 'unknown'
  12547. }
  12548. async function getResponse (body) {
  12549. const buffers = []
  12550. for await (const data of body) {
  12551. buffers.push(data)
  12552. }
  12553. return Buffer.concat(buffers).toString('utf8')
  12554. }
  12555. /**
  12556. * Mock dispatch function used to simulate undici dispatches
  12557. */
  12558. function mockDispatch (opts, handler) {
  12559. // Get mock dispatch from built key
  12560. const key = buildKey(opts)
  12561. const mockDispatch = getMockDispatch(this[kDispatches], key)
  12562. mockDispatch.timesInvoked++
  12563. // Here's where we resolve a callback if a callback is present for the dispatch data.
  12564. if (mockDispatch.data.callback) {
  12565. mockDispatch.data = { ...mockDispatch.data, ...mockDispatch.data.callback(opts) }
  12566. }
  12567. // Parse mockDispatch data
  12568. const { data: { statusCode, data, headers, trailers, error }, delay, persist } = mockDispatch
  12569. const { timesInvoked, times } = mockDispatch
  12570. // If it's used up and not persistent, mark as consumed
  12571. mockDispatch.consumed = !persist && timesInvoked >= times
  12572. mockDispatch.pending = timesInvoked < times
  12573. // If specified, trigger dispatch error
  12574. if (error !== null) {
  12575. deleteMockDispatch(this[kDispatches], key)
  12576. handler.onError(error)
  12577. return true
  12578. }
  12579. // Handle the request with a delay if necessary
  12580. if (typeof delay === 'number' && delay > 0) {
  12581. setTimeout(() => {
  12582. handleReply(this[kDispatches])
  12583. }, delay)
  12584. } else {
  12585. handleReply(this[kDispatches])
  12586. }
  12587. function handleReply (mockDispatches, _data = data) {
  12588. // fetch's HeadersList is a 1D string array
  12589. const optsHeaders = Array.isArray(opts.headers)
  12590. ? buildHeadersFromArray(opts.headers)
  12591. : opts.headers
  12592. const body = typeof _data === 'function'
  12593. ? _data({ ...opts, headers: optsHeaders })
  12594. : _data
  12595. // util.types.isPromise is likely needed for jest.
  12596. if (isPromise(body)) {
  12597. // If handleReply is asynchronous, throwing an error
  12598. // in the callback will reject the promise, rather than
  12599. // synchronously throw the error, which breaks some tests.
  12600. // Rather, we wait for the callback to resolve if it is a
  12601. // promise, and then re-run handleReply with the new body.
  12602. body.then((newData) => handleReply(mockDispatches, newData))
  12603. return
  12604. }
  12605. const responseData = getResponseData(body)
  12606. const responseHeaders = generateKeyValues(headers)
  12607. const responseTrailers = generateKeyValues(trailers)
  12608. handler.onConnect?.(err => handler.onError(err), null)
  12609. handler.onHeaders?.(statusCode, responseHeaders, resume, getStatusText(statusCode))
  12610. handler.onData?.(Buffer.from(responseData))
  12611. handler.onComplete?.(responseTrailers)
  12612. deleteMockDispatch(mockDispatches, key)
  12613. }
  12614. function resume () {}
  12615. return true
  12616. }
  12617. function buildMockDispatch () {
  12618. const agent = this[kMockAgent]
  12619. const origin = this[kOrigin]
  12620. const originalDispatch = this[kOriginalDispatch]
  12621. return function dispatch (opts, handler) {
  12622. if (agent.isMockActive) {
  12623. try {
  12624. mockDispatch.call(this, opts, handler)
  12625. } catch (error) {
  12626. if (error instanceof MockNotMatchedError) {
  12627. const netConnect = agent[kGetNetConnect]()
  12628. if (netConnect === false) {
  12629. throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`)
  12630. }
  12631. if (checkNetConnect(netConnect, origin)) {
  12632. originalDispatch.call(this, opts, handler)
  12633. } else {
  12634. throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`)
  12635. }
  12636. } else {
  12637. throw error
  12638. }
  12639. }
  12640. } else {
  12641. originalDispatch.call(this, opts, handler)
  12642. }
  12643. }
  12644. }
  12645. function checkNetConnect (netConnect, origin) {
  12646. const url = new URL(origin)
  12647. if (netConnect === true) {
  12648. return true
  12649. } else if (Array.isArray(netConnect) && netConnect.some((matcher) => matchValue(matcher, url.host))) {
  12650. return true
  12651. }
  12652. return false
  12653. }
  12654. function buildMockOptions (opts) {
  12655. if (opts) {
  12656. const { agent, ...mockOptions } = opts
  12657. return mockOptions
  12658. }
  12659. }
  12660. module.exports = {
  12661. getResponseData,
  12662. getMockDispatch,
  12663. addMockDispatch,
  12664. deleteMockDispatch,
  12665. buildKey,
  12666. generateKeyValues,
  12667. matchValue,
  12668. getResponse,
  12669. getStatusText,
  12670. mockDispatch,
  12671. buildMockDispatch,
  12672. checkNetConnect,
  12673. buildMockOptions,
  12674. getHeaderByName,
  12675. buildHeadersFromArray
  12676. }
  12677. /***/ }),
  12678. /***/ 6142:
  12679. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12680. const { Transform } = __nccwpck_require__(7075)
  12681. const { Console } = __nccwpck_require__(7540)
  12682. const PERSISTENT = process.versions.icu ? '✅' : 'Y '
  12683. const NOT_PERSISTENT = process.versions.icu ? '❌' : 'N '
  12684. /**
  12685. * Gets the output of `console.table(…)` as a string.
  12686. */
  12687. module.exports = class PendingInterceptorsFormatter {
  12688. constructor ({ disableColors } = {}) {
  12689. this.transform = new Transform({
  12690. transform (chunk, _enc, cb) {
  12691. cb(null, chunk)
  12692. }
  12693. })
  12694. this.logger = new Console({
  12695. stdout: this.transform,
  12696. inspectOptions: {
  12697. colors: !disableColors && !process.env.CI
  12698. }
  12699. })
  12700. }
  12701. format (pendingInterceptors) {
  12702. const withPrettyHeaders = pendingInterceptors.map(
  12703. ({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
  12704. Method: method,
  12705. Origin: origin,
  12706. Path: path,
  12707. 'Status code': statusCode,
  12708. Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
  12709. Invocations: timesInvoked,
  12710. Remaining: persist ? Infinity : times - timesInvoked
  12711. }))
  12712. this.logger.table(withPrettyHeaders)
  12713. return this.transform.read().toString()
  12714. }
  12715. }
  12716. /***/ }),
  12717. /***/ 1529:
  12718. /***/ ((module) => {
  12719. const singulars = {
  12720. pronoun: 'it',
  12721. is: 'is',
  12722. was: 'was',
  12723. this: 'this'
  12724. }
  12725. const plurals = {
  12726. pronoun: 'they',
  12727. is: 'are',
  12728. was: 'were',
  12729. this: 'these'
  12730. }
  12731. module.exports = class Pluralizer {
  12732. constructor (singular, plural) {
  12733. this.singular = singular
  12734. this.plural = plural
  12735. }
  12736. pluralize (count) {
  12737. const one = count === 1
  12738. const keys = one ? singulars : plurals
  12739. const noun = one ? this.singular : this.plural
  12740. return { ...keys, count, noun }
  12741. }
  12742. }
  12743. /***/ }),
  12744. /***/ 6603:
  12745. /***/ ((module) => {
  12746. /**
  12747. * This module offers an optimized timer implementation designed for scenarios
  12748. * where high precision is not critical.
  12749. *
  12750. * The timer achieves faster performance by using a low-resolution approach,
  12751. * with an accuracy target of within 500ms. This makes it particularly useful
  12752. * for timers with delays of 1 second or more, where exact timing is less
  12753. * crucial.
  12754. *
  12755. * It's important to note that Node.js timers are inherently imprecise, as
  12756. * delays can occur due to the event loop being blocked by other operations.
  12757. * Consequently, timers may trigger later than their scheduled time.
  12758. */
  12759. /**
  12760. * The fastNow variable contains the internal fast timer clock value.
  12761. *
  12762. * @type {number}
  12763. */
  12764. let fastNow = 0
  12765. /**
  12766. * RESOLUTION_MS represents the target resolution time in milliseconds.
  12767. *
  12768. * @type {number}
  12769. * @default 1000
  12770. */
  12771. const RESOLUTION_MS = 1e3
  12772. /**
  12773. * TICK_MS defines the desired interval in milliseconds between each tick.
  12774. * The target value is set to half the resolution time, minus 1 ms, to account
  12775. * for potential event loop overhead.
  12776. *
  12777. * @type {number}
  12778. * @default 499
  12779. */
  12780. const TICK_MS = (RESOLUTION_MS >> 1) - 1
  12781. /**
  12782. * fastNowTimeout is a Node.js timer used to manage and process
  12783. * the FastTimers stored in the `fastTimers` array.
  12784. *
  12785. * @type {NodeJS.Timeout}
  12786. */
  12787. let fastNowTimeout
  12788. /**
  12789. * The kFastTimer symbol is used to identify FastTimer instances.
  12790. *
  12791. * @type {Symbol}
  12792. */
  12793. const kFastTimer = Symbol('kFastTimer')
  12794. /**
  12795. * The fastTimers array contains all active FastTimers.
  12796. *
  12797. * @type {FastTimer[]}
  12798. */
  12799. const fastTimers = []
  12800. /**
  12801. * These constants represent the various states of a FastTimer.
  12802. */
  12803. /**
  12804. * The `NOT_IN_LIST` constant indicates that the FastTimer is not included
  12805. * in the `fastTimers` array. Timers with this status will not be processed
  12806. * during the next tick by the `onTick` function.
  12807. *
  12808. * A FastTimer can be re-added to the `fastTimers` array by invoking the
  12809. * `refresh` method on the FastTimer instance.
  12810. *
  12811. * @type {-2}
  12812. */
  12813. const NOT_IN_LIST = -2
  12814. /**
  12815. * The `TO_BE_CLEARED` constant indicates that the FastTimer is scheduled
  12816. * for removal from the `fastTimers` array. A FastTimer in this state will
  12817. * be removed in the next tick by the `onTick` function and will no longer
  12818. * be processed.
  12819. *
  12820. * This status is also set when the `clear` method is called on the FastTimer instance.
  12821. *
  12822. * @type {-1}
  12823. */
  12824. const TO_BE_CLEARED = -1
  12825. /**
  12826. * The `PENDING` constant signifies that the FastTimer is awaiting processing
  12827. * in the next tick by the `onTick` function. Timers with this status will have
  12828. * their `_idleStart` value set and their status updated to `ACTIVE` in the next tick.
  12829. *
  12830. * @type {0}
  12831. */
  12832. const PENDING = 0
  12833. /**
  12834. * The `ACTIVE` constant indicates that the FastTimer is active and waiting
  12835. * for its timer to expire. During the next tick, the `onTick` function will
  12836. * check if the timer has expired, and if so, it will execute the associated callback.
  12837. *
  12838. * @type {1}
  12839. */
  12840. const ACTIVE = 1
  12841. /**
  12842. * The onTick function processes the fastTimers array.
  12843. *
  12844. * @returns {void}
  12845. */
  12846. function onTick () {
  12847. /**
  12848. * Increment the fastNow value by the TICK_MS value, despite the actual time
  12849. * that has passed since the last tick. This approach ensures independence
  12850. * from the system clock and delays caused by a blocked event loop.
  12851. *
  12852. * @type {number}
  12853. */
  12854. fastNow += TICK_MS
  12855. /**
  12856. * The `idx` variable is used to iterate over the `fastTimers` array.
  12857. * Expired timers are removed by replacing them with the last element in the array.
  12858. * Consequently, `idx` is only incremented when the current element is not removed.
  12859. *
  12860. * @type {number}
  12861. */
  12862. let idx = 0
  12863. /**
  12864. * The len variable will contain the length of the fastTimers array
  12865. * and will be decremented when a FastTimer should be removed from the
  12866. * fastTimers array.
  12867. *
  12868. * @type {number}
  12869. */
  12870. let len = fastTimers.length
  12871. while (idx < len) {
  12872. /**
  12873. * @type {FastTimer}
  12874. */
  12875. const timer = fastTimers[idx]
  12876. // If the timer is in the ACTIVE state and the timer has expired, it will
  12877. // be processed in the next tick.
  12878. if (timer._state === PENDING) {
  12879. // Set the _idleStart value to the fastNow value minus the TICK_MS value
  12880. // to account for the time the timer was in the PENDING state.
  12881. timer._idleStart = fastNow - TICK_MS
  12882. timer._state = ACTIVE
  12883. } else if (
  12884. timer._state === ACTIVE &&
  12885. fastNow >= timer._idleStart + timer._idleTimeout
  12886. ) {
  12887. timer._state = TO_BE_CLEARED
  12888. timer._idleStart = -1
  12889. timer._onTimeout(timer._timerArg)
  12890. }
  12891. if (timer._state === TO_BE_CLEARED) {
  12892. timer._state = NOT_IN_LIST
  12893. // Move the last element to the current index and decrement len if it is
  12894. // not the only element in the array.
  12895. if (--len !== 0) {
  12896. fastTimers[idx] = fastTimers[len]
  12897. }
  12898. } else {
  12899. ++idx
  12900. }
  12901. }
  12902. // Set the length of the fastTimers array to the new length and thus
  12903. // removing the excess FastTimers elements from the array.
  12904. fastTimers.length = len
  12905. // If there are still active FastTimers in the array, refresh the Timer.
  12906. // If there are no active FastTimers, the timer will be refreshed again
  12907. // when a new FastTimer is instantiated.
  12908. if (fastTimers.length !== 0) {
  12909. refreshTimeout()
  12910. }
  12911. }
  12912. function refreshTimeout () {
  12913. // If the fastNowTimeout is already set, refresh it.
  12914. if (fastNowTimeout) {
  12915. fastNowTimeout.refresh()
  12916. // fastNowTimeout is not instantiated yet, create a new Timer.
  12917. } else {
  12918. clearTimeout(fastNowTimeout)
  12919. fastNowTimeout = setTimeout(onTick, TICK_MS)
  12920. // If the Timer has an unref method, call it to allow the process to exit if
  12921. // there are no other active handles.
  12922. if (fastNowTimeout.unref) {
  12923. fastNowTimeout.unref()
  12924. }
  12925. }
  12926. }
  12927. /**
  12928. * The `FastTimer` class is a data structure designed to store and manage
  12929. * timer information.
  12930. */
  12931. class FastTimer {
  12932. [kFastTimer] = true
  12933. /**
  12934. * The state of the timer, which can be one of the following:
  12935. * - NOT_IN_LIST (-2)
  12936. * - TO_BE_CLEARED (-1)
  12937. * - PENDING (0)
  12938. * - ACTIVE (1)
  12939. *
  12940. * @type {-2|-1|0|1}
  12941. * @private
  12942. */
  12943. _state = NOT_IN_LIST
  12944. /**
  12945. * The number of milliseconds to wait before calling the callback.
  12946. *
  12947. * @type {number}
  12948. * @private
  12949. */
  12950. _idleTimeout = -1
  12951. /**
  12952. * The time in milliseconds when the timer was started. This value is used to
  12953. * calculate when the timer should expire.
  12954. *
  12955. * @type {number}
  12956. * @default -1
  12957. * @private
  12958. */
  12959. _idleStart = -1
  12960. /**
  12961. * The function to be executed when the timer expires.
  12962. * @type {Function}
  12963. * @private
  12964. */
  12965. _onTimeout
  12966. /**
  12967. * The argument to be passed to the callback when the timer expires.
  12968. *
  12969. * @type {*}
  12970. * @private
  12971. */
  12972. _timerArg
  12973. /**
  12974. * @constructor
  12975. * @param {Function} callback A function to be executed after the timer
  12976. * expires.
  12977. * @param {number} delay The time, in milliseconds that the timer should wait
  12978. * before the specified function or code is executed.
  12979. * @param {*} arg
  12980. */
  12981. constructor (callback, delay, arg) {
  12982. this._onTimeout = callback
  12983. this._idleTimeout = delay
  12984. this._timerArg = arg
  12985. this.refresh()
  12986. }
  12987. /**
  12988. * Sets the timer's start time to the current time, and reschedules the timer
  12989. * to call its callback at the previously specified duration adjusted to the
  12990. * current time.
  12991. * Using this on a timer that has already called its callback will reactivate
  12992. * the timer.
  12993. *
  12994. * @returns {void}
  12995. */
  12996. refresh () {
  12997. // In the special case that the timer is not in the list of active timers,
  12998. // add it back to the array to be processed in the next tick by the onTick
  12999. // function.
  13000. if (this._state === NOT_IN_LIST) {
  13001. fastTimers.push(this)
  13002. }
  13003. // If the timer is the only active timer, refresh the fastNowTimeout for
  13004. // better resolution.
  13005. if (!fastNowTimeout || fastTimers.length === 1) {
  13006. refreshTimeout()
  13007. }
  13008. // Setting the state to PENDING will cause the timer to be reset in the
  13009. // next tick by the onTick function.
  13010. this._state = PENDING
  13011. }
  13012. /**
  13013. * The `clear` method cancels the timer, preventing it from executing.
  13014. *
  13015. * @returns {void}
  13016. * @private
  13017. */
  13018. clear () {
  13019. // Set the state to TO_BE_CLEARED to mark the timer for removal in the next
  13020. // tick by the onTick function.
  13021. this._state = TO_BE_CLEARED
  13022. // Reset the _idleStart value to -1 to indicate that the timer is no longer
  13023. // active.
  13024. this._idleStart = -1
  13025. }
  13026. }
  13027. /**
  13028. * This module exports a setTimeout and clearTimeout function that can be
  13029. * used as a drop-in replacement for the native functions.
  13030. */
  13031. module.exports = {
  13032. /**
  13033. * The setTimeout() method sets a timer which executes a function once the
  13034. * timer expires.
  13035. * @param {Function} callback A function to be executed after the timer
  13036. * expires.
  13037. * @param {number} delay The time, in milliseconds that the timer should
  13038. * wait before the specified function or code is executed.
  13039. * @param {*} [arg] An optional argument to be passed to the callback function
  13040. * when the timer expires.
  13041. * @returns {NodeJS.Timeout|FastTimer}
  13042. */
  13043. setTimeout (callback, delay, arg) {
  13044. // If the delay is less than or equal to the RESOLUTION_MS value return a
  13045. // native Node.js Timer instance.
  13046. return delay <= RESOLUTION_MS
  13047. ? setTimeout(callback, delay, arg)
  13048. : new FastTimer(callback, delay, arg)
  13049. },
  13050. /**
  13051. * The clearTimeout method cancels an instantiated Timer previously created
  13052. * by calling setTimeout.
  13053. *
  13054. * @param {NodeJS.Timeout|FastTimer} timeout
  13055. */
  13056. clearTimeout (timeout) {
  13057. // If the timeout is a FastTimer, call its own clear method.
  13058. if (timeout[kFastTimer]) {
  13059. /**
  13060. * @type {FastTimer}
  13061. */
  13062. timeout.clear()
  13063. // Otherwise it is an instance of a native NodeJS.Timeout, so call the
  13064. // Node.js native clearTimeout function.
  13065. } else {
  13066. clearTimeout(timeout)
  13067. }
  13068. },
  13069. /**
  13070. * The setFastTimeout() method sets a fastTimer which executes a function once
  13071. * the timer expires.
  13072. * @param {Function} callback A function to be executed after the timer
  13073. * expires.
  13074. * @param {number} delay The time, in milliseconds that the timer should
  13075. * wait before the specified function or code is executed.
  13076. * @param {*} [arg] An optional argument to be passed to the callback function
  13077. * when the timer expires.
  13078. * @returns {FastTimer}
  13079. */
  13080. setFastTimeout (callback, delay, arg) {
  13081. return new FastTimer(callback, delay, arg)
  13082. },
  13083. /**
  13084. * The clearTimeout method cancels an instantiated FastTimer previously
  13085. * created by calling setFastTimeout.
  13086. *
  13087. * @param {FastTimer} timeout
  13088. */
  13089. clearFastTimeout (timeout) {
  13090. timeout.clear()
  13091. },
  13092. /**
  13093. * The now method returns the value of the internal fast timer clock.
  13094. *
  13095. * @returns {number}
  13096. */
  13097. now () {
  13098. return fastNow
  13099. },
  13100. /**
  13101. * Trigger the onTick function to process the fastTimers array.
  13102. * Exported for testing purposes only.
  13103. * Marking as deprecated to discourage any use outside of testing.
  13104. * @deprecated
  13105. * @param {number} [delay=0] The delay in milliseconds to add to the now value.
  13106. */
  13107. tick (delay = 0) {
  13108. fastNow += delay - RESOLUTION_MS + 1
  13109. onTick()
  13110. onTick()
  13111. },
  13112. /**
  13113. * Reset FastTimers.
  13114. * Exported for testing purposes only.
  13115. * Marking as deprecated to discourage any use outside of testing.
  13116. * @deprecated
  13117. */
  13118. reset () {
  13119. fastNow = 0
  13120. fastTimers.length = 0
  13121. clearTimeout(fastNowTimeout)
  13122. fastNowTimeout = null
  13123. },
  13124. /**
  13125. * Exporting for testing purposes only.
  13126. * Marking as deprecated to discourage any use outside of testing.
  13127. * @deprecated
  13128. */
  13129. kFastTimer
  13130. }
  13131. /***/ }),
  13132. /***/ 9634:
  13133. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  13134. const { kConstruct } = __nccwpck_require__(109)
  13135. const { urlEquals, getFieldValues } = __nccwpck_require__(6798)
  13136. const { kEnumerableProperty, isDisturbed } = __nccwpck_require__(3440)
  13137. const { webidl } = __nccwpck_require__(5893)
  13138. const { Response, cloneResponse, fromInnerResponse } = __nccwpck_require__(9051)
  13139. const { Request, fromInnerRequest } = __nccwpck_require__(9967)
  13140. const { kState } = __nccwpck_require__(3627)
  13141. const { fetching } = __nccwpck_require__(4398)
  13142. const { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = __nccwpck_require__(3168)
  13143. const assert = __nccwpck_require__(4589)
  13144. /**
  13145. * @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation
  13146. * @typedef {Object} CacheBatchOperation
  13147. * @property {'delete' | 'put'} type
  13148. * @property {any} request
  13149. * @property {any} response
  13150. * @property {import('../../types/cache').CacheQueryOptions} options
  13151. */
  13152. /**
  13153. * @see https://w3c.github.io/ServiceWorker/#dfn-request-response-list
  13154. * @typedef {[any, any][]} requestResponseList
  13155. */
  13156. class Cache {
  13157. /**
  13158. * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-request-response-list
  13159. * @type {requestResponseList}
  13160. */
  13161. #relevantRequestResponseList
  13162. constructor () {
  13163. if (arguments[0] !== kConstruct) {
  13164. webidl.illegalConstructor()
  13165. }
  13166. webidl.util.markAsUncloneable(this)
  13167. this.#relevantRequestResponseList = arguments[1]
  13168. }
  13169. async match (request, options = {}) {
  13170. webidl.brandCheck(this, Cache)
  13171. const prefix = 'Cache.match'
  13172. webidl.argumentLengthCheck(arguments, 1, prefix)
  13173. request = webidl.converters.RequestInfo(request, prefix, 'request')
  13174. options = webidl.converters.CacheQueryOptions(options, prefix, 'options')
  13175. const p = this.#internalMatchAll(request, options, 1)
  13176. if (p.length === 0) {
  13177. return
  13178. }
  13179. return p[0]
  13180. }
  13181. async matchAll (request = undefined, options = {}) {
  13182. webidl.brandCheck(this, Cache)
  13183. const prefix = 'Cache.matchAll'
  13184. if (request !== undefined) request = webidl.converters.RequestInfo(request, prefix, 'request')
  13185. options = webidl.converters.CacheQueryOptions(options, prefix, 'options')
  13186. return this.#internalMatchAll(request, options)
  13187. }
  13188. async add (request) {
  13189. webidl.brandCheck(this, Cache)
  13190. const prefix = 'Cache.add'
  13191. webidl.argumentLengthCheck(arguments, 1, prefix)
  13192. request = webidl.converters.RequestInfo(request, prefix, 'request')
  13193. // 1.
  13194. const requests = [request]
  13195. // 2.
  13196. const responseArrayPromise = this.addAll(requests)
  13197. // 3.
  13198. return await responseArrayPromise
  13199. }
  13200. async addAll (requests) {
  13201. webidl.brandCheck(this, Cache)
  13202. const prefix = 'Cache.addAll'
  13203. webidl.argumentLengthCheck(arguments, 1, prefix)
  13204. // 1.
  13205. const responsePromises = []
  13206. // 2.
  13207. const requestList = []
  13208. // 3.
  13209. for (let request of requests) {
  13210. if (request === undefined) {
  13211. throw webidl.errors.conversionFailed({
  13212. prefix,
  13213. argument: 'Argument 1',
  13214. types: ['undefined is not allowed']
  13215. })
  13216. }
  13217. request = webidl.converters.RequestInfo(request)
  13218. if (typeof request === 'string') {
  13219. continue
  13220. }
  13221. // 3.1
  13222. const r = request[kState]
  13223. // 3.2
  13224. if (!urlIsHttpHttpsScheme(r.url) || r.method !== 'GET') {
  13225. throw webidl.errors.exception({
  13226. header: prefix,
  13227. message: 'Expected http/s scheme when method is not GET.'
  13228. })
  13229. }
  13230. }
  13231. // 4.
  13232. /** @type {ReturnType<typeof fetching>[]} */
  13233. const fetchControllers = []
  13234. // 5.
  13235. for (const request of requests) {
  13236. // 5.1
  13237. const r = new Request(request)[kState]
  13238. // 5.2
  13239. if (!urlIsHttpHttpsScheme(r.url)) {
  13240. throw webidl.errors.exception({
  13241. header: prefix,
  13242. message: 'Expected http/s scheme.'
  13243. })
  13244. }
  13245. // 5.4
  13246. r.initiator = 'fetch'
  13247. r.destination = 'subresource'
  13248. // 5.5
  13249. requestList.push(r)
  13250. // 5.6
  13251. const responsePromise = createDeferredPromise()
  13252. // 5.7
  13253. fetchControllers.push(fetching({
  13254. request: r,
  13255. processResponse (response) {
  13256. // 1.
  13257. if (response.type === 'error' || response.status === 206 || response.status < 200 || response.status > 299) {
  13258. responsePromise.reject(webidl.errors.exception({
  13259. header: 'Cache.addAll',
  13260. message: 'Received an invalid status code or the request failed.'
  13261. }))
  13262. } else if (response.headersList.contains('vary')) { // 2.
  13263. // 2.1
  13264. const fieldValues = getFieldValues(response.headersList.get('vary'))
  13265. // 2.2
  13266. for (const fieldValue of fieldValues) {
  13267. // 2.2.1
  13268. if (fieldValue === '*') {
  13269. responsePromise.reject(webidl.errors.exception({
  13270. header: 'Cache.addAll',
  13271. message: 'invalid vary field value'
  13272. }))
  13273. for (const controller of fetchControllers) {
  13274. controller.abort()
  13275. }
  13276. return
  13277. }
  13278. }
  13279. }
  13280. },
  13281. processResponseEndOfBody (response) {
  13282. // 1.
  13283. if (response.aborted) {
  13284. responsePromise.reject(new DOMException('aborted', 'AbortError'))
  13285. return
  13286. }
  13287. // 2.
  13288. responsePromise.resolve(response)
  13289. }
  13290. }))
  13291. // 5.8
  13292. responsePromises.push(responsePromise.promise)
  13293. }
  13294. // 6.
  13295. const p = Promise.all(responsePromises)
  13296. // 7.
  13297. const responses = await p
  13298. // 7.1
  13299. const operations = []
  13300. // 7.2
  13301. let index = 0
  13302. // 7.3
  13303. for (const response of responses) {
  13304. // 7.3.1
  13305. /** @type {CacheBatchOperation} */
  13306. const operation = {
  13307. type: 'put', // 7.3.2
  13308. request: requestList[index], // 7.3.3
  13309. response // 7.3.4
  13310. }
  13311. operations.push(operation) // 7.3.5
  13312. index++ // 7.3.6
  13313. }
  13314. // 7.5
  13315. const cacheJobPromise = createDeferredPromise()
  13316. // 7.6.1
  13317. let errorData = null
  13318. // 7.6.2
  13319. try {
  13320. this.#batchCacheOperations(operations)
  13321. } catch (e) {
  13322. errorData = e
  13323. }
  13324. // 7.6.3
  13325. queueMicrotask(() => {
  13326. // 7.6.3.1
  13327. if (errorData === null) {
  13328. cacheJobPromise.resolve(undefined)
  13329. } else {
  13330. // 7.6.3.2
  13331. cacheJobPromise.reject(errorData)
  13332. }
  13333. })
  13334. // 7.7
  13335. return cacheJobPromise.promise
  13336. }
  13337. async put (request, response) {
  13338. webidl.brandCheck(this, Cache)
  13339. const prefix = 'Cache.put'
  13340. webidl.argumentLengthCheck(arguments, 2, prefix)
  13341. request = webidl.converters.RequestInfo(request, prefix, 'request')
  13342. response = webidl.converters.Response(response, prefix, 'response')
  13343. // 1.
  13344. let innerRequest = null
  13345. // 2.
  13346. if (request instanceof Request) {
  13347. innerRequest = request[kState]
  13348. } else { // 3.
  13349. innerRequest = new Request(request)[kState]
  13350. }
  13351. // 4.
  13352. if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== 'GET') {
  13353. throw webidl.errors.exception({
  13354. header: prefix,
  13355. message: 'Expected an http/s scheme when method is not GET'
  13356. })
  13357. }
  13358. // 5.
  13359. const innerResponse = response[kState]
  13360. // 6.
  13361. if (innerResponse.status === 206) {
  13362. throw webidl.errors.exception({
  13363. header: prefix,
  13364. message: 'Got 206 status'
  13365. })
  13366. }
  13367. // 7.
  13368. if (innerResponse.headersList.contains('vary')) {
  13369. // 7.1.
  13370. const fieldValues = getFieldValues(innerResponse.headersList.get('vary'))
  13371. // 7.2.
  13372. for (const fieldValue of fieldValues) {
  13373. // 7.2.1
  13374. if (fieldValue === '*') {
  13375. throw webidl.errors.exception({
  13376. header: prefix,
  13377. message: 'Got * vary field value'
  13378. })
  13379. }
  13380. }
  13381. }
  13382. // 8.
  13383. if (innerResponse.body && (isDisturbed(innerResponse.body.stream) || innerResponse.body.stream.locked)) {
  13384. throw webidl.errors.exception({
  13385. header: prefix,
  13386. message: 'Response body is locked or disturbed'
  13387. })
  13388. }
  13389. // 9.
  13390. const clonedResponse = cloneResponse(innerResponse)
  13391. // 10.
  13392. const bodyReadPromise = createDeferredPromise()
  13393. // 11.
  13394. if (innerResponse.body != null) {
  13395. // 11.1
  13396. const stream = innerResponse.body.stream
  13397. // 11.2
  13398. const reader = stream.getReader()
  13399. // 11.3
  13400. readAllBytes(reader).then(bodyReadPromise.resolve, bodyReadPromise.reject)
  13401. } else {
  13402. bodyReadPromise.resolve(undefined)
  13403. }
  13404. // 12.
  13405. /** @type {CacheBatchOperation[]} */
  13406. const operations = []
  13407. // 13.
  13408. /** @type {CacheBatchOperation} */
  13409. const operation = {
  13410. type: 'put', // 14.
  13411. request: innerRequest, // 15.
  13412. response: clonedResponse // 16.
  13413. }
  13414. // 17.
  13415. operations.push(operation)
  13416. // 19.
  13417. const bytes = await bodyReadPromise.promise
  13418. if (clonedResponse.body != null) {
  13419. clonedResponse.body.source = bytes
  13420. }
  13421. // 19.1
  13422. const cacheJobPromise = createDeferredPromise()
  13423. // 19.2.1
  13424. let errorData = null
  13425. // 19.2.2
  13426. try {
  13427. this.#batchCacheOperations(operations)
  13428. } catch (e) {
  13429. errorData = e
  13430. }
  13431. // 19.2.3
  13432. queueMicrotask(() => {
  13433. // 19.2.3.1
  13434. if (errorData === null) {
  13435. cacheJobPromise.resolve()
  13436. } else { // 19.2.3.2
  13437. cacheJobPromise.reject(errorData)
  13438. }
  13439. })
  13440. return cacheJobPromise.promise
  13441. }
  13442. async delete (request, options = {}) {
  13443. webidl.brandCheck(this, Cache)
  13444. const prefix = 'Cache.delete'
  13445. webidl.argumentLengthCheck(arguments, 1, prefix)
  13446. request = webidl.converters.RequestInfo(request, prefix, 'request')
  13447. options = webidl.converters.CacheQueryOptions(options, prefix, 'options')
  13448. /**
  13449. * @type {Request}
  13450. */
  13451. let r = null
  13452. if (request instanceof Request) {
  13453. r = request[kState]
  13454. if (r.method !== 'GET' && !options.ignoreMethod) {
  13455. return false
  13456. }
  13457. } else {
  13458. assert(typeof request === 'string')
  13459. r = new Request(request)[kState]
  13460. }
  13461. /** @type {CacheBatchOperation[]} */
  13462. const operations = []
  13463. /** @type {CacheBatchOperation} */
  13464. const operation = {
  13465. type: 'delete',
  13466. request: r,
  13467. options
  13468. }
  13469. operations.push(operation)
  13470. const cacheJobPromise = createDeferredPromise()
  13471. let errorData = null
  13472. let requestResponses
  13473. try {
  13474. requestResponses = this.#batchCacheOperations(operations)
  13475. } catch (e) {
  13476. errorData = e
  13477. }
  13478. queueMicrotask(() => {
  13479. if (errorData === null) {
  13480. cacheJobPromise.resolve(!!requestResponses?.length)
  13481. } else {
  13482. cacheJobPromise.reject(errorData)
  13483. }
  13484. })
  13485. return cacheJobPromise.promise
  13486. }
  13487. /**
  13488. * @see https://w3c.github.io/ServiceWorker/#dom-cache-keys
  13489. * @param {any} request
  13490. * @param {import('../../types/cache').CacheQueryOptions} options
  13491. * @returns {Promise<readonly Request[]>}
  13492. */
  13493. async keys (request = undefined, options = {}) {
  13494. webidl.brandCheck(this, Cache)
  13495. const prefix = 'Cache.keys'
  13496. if (request !== undefined) request = webidl.converters.RequestInfo(request, prefix, 'request')
  13497. options = webidl.converters.CacheQueryOptions(options, prefix, 'options')
  13498. // 1.
  13499. let r = null
  13500. // 2.
  13501. if (request !== undefined) {
  13502. // 2.1
  13503. if (request instanceof Request) {
  13504. // 2.1.1
  13505. r = request[kState]
  13506. // 2.1.2
  13507. if (r.method !== 'GET' && !options.ignoreMethod) {
  13508. return []
  13509. }
  13510. } else if (typeof request === 'string') { // 2.2
  13511. r = new Request(request)[kState]
  13512. }
  13513. }
  13514. // 4.
  13515. const promise = createDeferredPromise()
  13516. // 5.
  13517. // 5.1
  13518. const requests = []
  13519. // 5.2
  13520. if (request === undefined) {
  13521. // 5.2.1
  13522. for (const requestResponse of this.#relevantRequestResponseList) {
  13523. // 5.2.1.1
  13524. requests.push(requestResponse[0])
  13525. }
  13526. } else { // 5.3
  13527. // 5.3.1
  13528. const requestResponses = this.#queryCache(r, options)
  13529. // 5.3.2
  13530. for (const requestResponse of requestResponses) {
  13531. // 5.3.2.1
  13532. requests.push(requestResponse[0])
  13533. }
  13534. }
  13535. // 5.4
  13536. queueMicrotask(() => {
  13537. // 5.4.1
  13538. const requestList = []
  13539. // 5.4.2
  13540. for (const request of requests) {
  13541. const requestObject = fromInnerRequest(
  13542. request,
  13543. new AbortController().signal,
  13544. 'immutable'
  13545. )
  13546. // 5.4.2.1
  13547. requestList.push(requestObject)
  13548. }
  13549. // 5.4.3
  13550. promise.resolve(Object.freeze(requestList))
  13551. })
  13552. return promise.promise
  13553. }
  13554. /**
  13555. * @see https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm
  13556. * @param {CacheBatchOperation[]} operations
  13557. * @returns {requestResponseList}
  13558. */
  13559. #batchCacheOperations (operations) {
  13560. // 1.
  13561. const cache = this.#relevantRequestResponseList
  13562. // 2.
  13563. const backupCache = [...cache]
  13564. // 3.
  13565. const addedItems = []
  13566. // 4.1
  13567. const resultList = []
  13568. try {
  13569. // 4.2
  13570. for (const operation of operations) {
  13571. // 4.2.1
  13572. if (operation.type !== 'delete' && operation.type !== 'put') {
  13573. throw webidl.errors.exception({
  13574. header: 'Cache.#batchCacheOperations',
  13575. message: 'operation type does not match "delete" or "put"'
  13576. })
  13577. }
  13578. // 4.2.2
  13579. if (operation.type === 'delete' && operation.response != null) {
  13580. throw webidl.errors.exception({
  13581. header: 'Cache.#batchCacheOperations',
  13582. message: 'delete operation should not have an associated response'
  13583. })
  13584. }
  13585. // 4.2.3
  13586. if (this.#queryCache(operation.request, operation.options, addedItems).length) {
  13587. throw new DOMException('???', 'InvalidStateError')
  13588. }
  13589. // 4.2.4
  13590. let requestResponses
  13591. // 4.2.5
  13592. if (operation.type === 'delete') {
  13593. // 4.2.5.1
  13594. requestResponses = this.#queryCache(operation.request, operation.options)
  13595. // TODO: the spec is wrong, this is needed to pass WPTs
  13596. if (requestResponses.length === 0) {
  13597. return []
  13598. }
  13599. // 4.2.5.2
  13600. for (const requestResponse of requestResponses) {
  13601. const idx = cache.indexOf(requestResponse)
  13602. assert(idx !== -1)
  13603. // 4.2.5.2.1
  13604. cache.splice(idx, 1)
  13605. }
  13606. } else if (operation.type === 'put') { // 4.2.6
  13607. // 4.2.6.1
  13608. if (operation.response == null) {
  13609. throw webidl.errors.exception({
  13610. header: 'Cache.#batchCacheOperations',
  13611. message: 'put operation should have an associated response'
  13612. })
  13613. }
  13614. // 4.2.6.2
  13615. const r = operation.request
  13616. // 4.2.6.3
  13617. if (!urlIsHttpHttpsScheme(r.url)) {
  13618. throw webidl.errors.exception({
  13619. header: 'Cache.#batchCacheOperations',
  13620. message: 'expected http or https scheme'
  13621. })
  13622. }
  13623. // 4.2.6.4
  13624. if (r.method !== 'GET') {
  13625. throw webidl.errors.exception({
  13626. header: 'Cache.#batchCacheOperations',
  13627. message: 'not get method'
  13628. })
  13629. }
  13630. // 4.2.6.5
  13631. if (operation.options != null) {
  13632. throw webidl.errors.exception({
  13633. header: 'Cache.#batchCacheOperations',
  13634. message: 'options must not be defined'
  13635. })
  13636. }
  13637. // 4.2.6.6
  13638. requestResponses = this.#queryCache(operation.request)
  13639. // 4.2.6.7
  13640. for (const requestResponse of requestResponses) {
  13641. const idx = cache.indexOf(requestResponse)
  13642. assert(idx !== -1)
  13643. // 4.2.6.7.1
  13644. cache.splice(idx, 1)
  13645. }
  13646. // 4.2.6.8
  13647. cache.push([operation.request, operation.response])
  13648. // 4.2.6.10
  13649. addedItems.push([operation.request, operation.response])
  13650. }
  13651. // 4.2.7
  13652. resultList.push([operation.request, operation.response])
  13653. }
  13654. // 4.3
  13655. return resultList
  13656. } catch (e) { // 5.
  13657. // 5.1
  13658. this.#relevantRequestResponseList.length = 0
  13659. // 5.2
  13660. this.#relevantRequestResponseList = backupCache
  13661. // 5.3
  13662. throw e
  13663. }
  13664. }
  13665. /**
  13666. * @see https://w3c.github.io/ServiceWorker/#query-cache
  13667. * @param {any} requestQuery
  13668. * @param {import('../../types/cache').CacheQueryOptions} options
  13669. * @param {requestResponseList} targetStorage
  13670. * @returns {requestResponseList}
  13671. */
  13672. #queryCache (requestQuery, options, targetStorage) {
  13673. /** @type {requestResponseList} */
  13674. const resultList = []
  13675. const storage = targetStorage ?? this.#relevantRequestResponseList
  13676. for (const requestResponse of storage) {
  13677. const [cachedRequest, cachedResponse] = requestResponse
  13678. if (this.#requestMatchesCachedItem(requestQuery, cachedRequest, cachedResponse, options)) {
  13679. resultList.push(requestResponse)
  13680. }
  13681. }
  13682. return resultList
  13683. }
  13684. /**
  13685. * @see https://w3c.github.io/ServiceWorker/#request-matches-cached-item-algorithm
  13686. * @param {any} requestQuery
  13687. * @param {any} request
  13688. * @param {any | null} response
  13689. * @param {import('../../types/cache').CacheQueryOptions | undefined} options
  13690. * @returns {boolean}
  13691. */
  13692. #requestMatchesCachedItem (requestQuery, request, response = null, options) {
  13693. // if (options?.ignoreMethod === false && request.method === 'GET') {
  13694. // return false
  13695. // }
  13696. const queryURL = new URL(requestQuery.url)
  13697. const cachedURL = new URL(request.url)
  13698. if (options?.ignoreSearch) {
  13699. cachedURL.search = ''
  13700. queryURL.search = ''
  13701. }
  13702. if (!urlEquals(queryURL, cachedURL, true)) {
  13703. return false
  13704. }
  13705. if (
  13706. response == null ||
  13707. options?.ignoreVary ||
  13708. !response.headersList.contains('vary')
  13709. ) {
  13710. return true
  13711. }
  13712. const fieldValues = getFieldValues(response.headersList.get('vary'))
  13713. for (const fieldValue of fieldValues) {
  13714. if (fieldValue === '*') {
  13715. return false
  13716. }
  13717. const requestValue = request.headersList.get(fieldValue)
  13718. const queryValue = requestQuery.headersList.get(fieldValue)
  13719. // If one has the header and the other doesn't, or one has
  13720. // a different value than the other, return false
  13721. if (requestValue !== queryValue) {
  13722. return false
  13723. }
  13724. }
  13725. return true
  13726. }
  13727. #internalMatchAll (request, options, maxResponses = Infinity) {
  13728. // 1.
  13729. let r = null
  13730. // 2.
  13731. if (request !== undefined) {
  13732. if (request instanceof Request) {
  13733. // 2.1.1
  13734. r = request[kState]
  13735. // 2.1.2
  13736. if (r.method !== 'GET' && !options.ignoreMethod) {
  13737. return []
  13738. }
  13739. } else if (typeof request === 'string') {
  13740. // 2.2.1
  13741. r = new Request(request)[kState]
  13742. }
  13743. }
  13744. // 5.
  13745. // 5.1
  13746. const responses = []
  13747. // 5.2
  13748. if (request === undefined) {
  13749. // 5.2.1
  13750. for (const requestResponse of this.#relevantRequestResponseList) {
  13751. responses.push(requestResponse[1])
  13752. }
  13753. } else { // 5.3
  13754. // 5.3.1
  13755. const requestResponses = this.#queryCache(r, options)
  13756. // 5.3.2
  13757. for (const requestResponse of requestResponses) {
  13758. responses.push(requestResponse[1])
  13759. }
  13760. }
  13761. // 5.4
  13762. // We don't implement CORs so we don't need to loop over the responses, yay!
  13763. // 5.5.1
  13764. const responseList = []
  13765. // 5.5.2
  13766. for (const response of responses) {
  13767. // 5.5.2.1
  13768. const responseObject = fromInnerResponse(response, 'immutable')
  13769. responseList.push(responseObject.clone())
  13770. if (responseList.length >= maxResponses) {
  13771. break
  13772. }
  13773. }
  13774. // 6.
  13775. return Object.freeze(responseList)
  13776. }
  13777. }
  13778. Object.defineProperties(Cache.prototype, {
  13779. [Symbol.toStringTag]: {
  13780. value: 'Cache',
  13781. configurable: true
  13782. },
  13783. match: kEnumerableProperty,
  13784. matchAll: kEnumerableProperty,
  13785. add: kEnumerableProperty,
  13786. addAll: kEnumerableProperty,
  13787. put: kEnumerableProperty,
  13788. delete: kEnumerableProperty,
  13789. keys: kEnumerableProperty
  13790. })
  13791. const cacheQueryOptionConverters = [
  13792. {
  13793. key: 'ignoreSearch',
  13794. converter: webidl.converters.boolean,
  13795. defaultValue: () => false
  13796. },
  13797. {
  13798. key: 'ignoreMethod',
  13799. converter: webidl.converters.boolean,
  13800. defaultValue: () => false
  13801. },
  13802. {
  13803. key: 'ignoreVary',
  13804. converter: webidl.converters.boolean,
  13805. defaultValue: () => false
  13806. }
  13807. ]
  13808. webidl.converters.CacheQueryOptions = webidl.dictionaryConverter(cacheQueryOptionConverters)
  13809. webidl.converters.MultiCacheQueryOptions = webidl.dictionaryConverter([
  13810. ...cacheQueryOptionConverters,
  13811. {
  13812. key: 'cacheName',
  13813. converter: webidl.converters.DOMString
  13814. }
  13815. ])
  13816. webidl.converters.Response = webidl.interfaceConverter(Response)
  13817. webidl.converters['sequence<RequestInfo>'] = webidl.sequenceConverter(
  13818. webidl.converters.RequestInfo
  13819. )
  13820. module.exports = {
  13821. Cache
  13822. }
  13823. /***/ }),
  13824. /***/ 3245:
  13825. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  13826. const { kConstruct } = __nccwpck_require__(109)
  13827. const { Cache } = __nccwpck_require__(9634)
  13828. const { webidl } = __nccwpck_require__(5893)
  13829. const { kEnumerableProperty } = __nccwpck_require__(3440)
  13830. class CacheStorage {
  13831. /**
  13832. * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-name-to-cache-map
  13833. * @type {Map<string, import('./cache').requestResponseList}
  13834. */
  13835. #caches = new Map()
  13836. constructor () {
  13837. if (arguments[0] !== kConstruct) {
  13838. webidl.illegalConstructor()
  13839. }
  13840. webidl.util.markAsUncloneable(this)
  13841. }
  13842. async match (request, options = {}) {
  13843. webidl.brandCheck(this, CacheStorage)
  13844. webidl.argumentLengthCheck(arguments, 1, 'CacheStorage.match')
  13845. request = webidl.converters.RequestInfo(request)
  13846. options = webidl.converters.MultiCacheQueryOptions(options)
  13847. // 1.
  13848. if (options.cacheName != null) {
  13849. // 1.1.1.1
  13850. if (this.#caches.has(options.cacheName)) {
  13851. // 1.1.1.1.1
  13852. const cacheList = this.#caches.get(options.cacheName)
  13853. const cache = new Cache(kConstruct, cacheList)
  13854. return await cache.match(request, options)
  13855. }
  13856. } else { // 2.
  13857. // 2.2
  13858. for (const cacheList of this.#caches.values()) {
  13859. const cache = new Cache(kConstruct, cacheList)
  13860. // 2.2.1.2
  13861. const response = await cache.match(request, options)
  13862. if (response !== undefined) {
  13863. return response
  13864. }
  13865. }
  13866. }
  13867. }
  13868. /**
  13869. * @see https://w3c.github.io/ServiceWorker/#cache-storage-has
  13870. * @param {string} cacheName
  13871. * @returns {Promise<boolean>}
  13872. */
  13873. async has (cacheName) {
  13874. webidl.brandCheck(this, CacheStorage)
  13875. const prefix = 'CacheStorage.has'
  13876. webidl.argumentLengthCheck(arguments, 1, prefix)
  13877. cacheName = webidl.converters.DOMString(cacheName, prefix, 'cacheName')
  13878. // 2.1.1
  13879. // 2.2
  13880. return this.#caches.has(cacheName)
  13881. }
  13882. /**
  13883. * @see https://w3c.github.io/ServiceWorker/#dom-cachestorage-open
  13884. * @param {string} cacheName
  13885. * @returns {Promise<Cache>}
  13886. */
  13887. async open (cacheName) {
  13888. webidl.brandCheck(this, CacheStorage)
  13889. const prefix = 'CacheStorage.open'
  13890. webidl.argumentLengthCheck(arguments, 1, prefix)
  13891. cacheName = webidl.converters.DOMString(cacheName, prefix, 'cacheName')
  13892. // 2.1
  13893. if (this.#caches.has(cacheName)) {
  13894. // await caches.open('v1') !== await caches.open('v1')
  13895. // 2.1.1
  13896. const cache = this.#caches.get(cacheName)
  13897. // 2.1.1.1
  13898. return new Cache(kConstruct, cache)
  13899. }
  13900. // 2.2
  13901. const cache = []
  13902. // 2.3
  13903. this.#caches.set(cacheName, cache)
  13904. // 2.4
  13905. return new Cache(kConstruct, cache)
  13906. }
  13907. /**
  13908. * @see https://w3c.github.io/ServiceWorker/#cache-storage-delete
  13909. * @param {string} cacheName
  13910. * @returns {Promise<boolean>}
  13911. */
  13912. async delete (cacheName) {
  13913. webidl.brandCheck(this, CacheStorage)
  13914. const prefix = 'CacheStorage.delete'
  13915. webidl.argumentLengthCheck(arguments, 1, prefix)
  13916. cacheName = webidl.converters.DOMString(cacheName, prefix, 'cacheName')
  13917. return this.#caches.delete(cacheName)
  13918. }
  13919. /**
  13920. * @see https://w3c.github.io/ServiceWorker/#cache-storage-keys
  13921. * @returns {Promise<string[]>}
  13922. */
  13923. async keys () {
  13924. webidl.brandCheck(this, CacheStorage)
  13925. // 2.1
  13926. const keys = this.#caches.keys()
  13927. // 2.2
  13928. return [...keys]
  13929. }
  13930. }
  13931. Object.defineProperties(CacheStorage.prototype, {
  13932. [Symbol.toStringTag]: {
  13933. value: 'CacheStorage',
  13934. configurable: true
  13935. },
  13936. match: kEnumerableProperty,
  13937. has: kEnumerableProperty,
  13938. open: kEnumerableProperty,
  13939. delete: kEnumerableProperty,
  13940. keys: kEnumerableProperty
  13941. })
  13942. module.exports = {
  13943. CacheStorage
  13944. }
  13945. /***/ }),
  13946. /***/ 109:
  13947. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  13948. module.exports = {
  13949. kConstruct: (__nccwpck_require__(6443).kConstruct)
  13950. }
  13951. /***/ }),
  13952. /***/ 6798:
  13953. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  13954. const assert = __nccwpck_require__(4589)
  13955. const { URLSerializer } = __nccwpck_require__(1900)
  13956. const { isValidHeaderName } = __nccwpck_require__(3168)
  13957. /**
  13958. * @see https://url.spec.whatwg.org/#concept-url-equals
  13959. * @param {URL} A
  13960. * @param {URL} B
  13961. * @param {boolean | undefined} excludeFragment
  13962. * @returns {boolean}
  13963. */
  13964. function urlEquals (A, B, excludeFragment = false) {
  13965. const serializedA = URLSerializer(A, excludeFragment)
  13966. const serializedB = URLSerializer(B, excludeFragment)
  13967. return serializedA === serializedB
  13968. }
  13969. /**
  13970. * @see https://github.com/chromium/chromium/blob/694d20d134cb553d8d89e5500b9148012b1ba299/content/browser/cache_storage/cache_storage_cache.cc#L260-L262
  13971. * @param {string} header
  13972. */
  13973. function getFieldValues (header) {
  13974. assert(header !== null)
  13975. const values = []
  13976. for (let value of header.split(',')) {
  13977. value = value.trim()
  13978. if (isValidHeaderName(value)) {
  13979. values.push(value)
  13980. }
  13981. }
  13982. return values
  13983. }
  13984. module.exports = {
  13985. urlEquals,
  13986. getFieldValues
  13987. }
  13988. /***/ }),
  13989. /***/ 1276:
  13990. /***/ ((module) => {
  13991. // https://wicg.github.io/cookie-store/#cookie-maximum-attribute-value-size
  13992. const maxAttributeValueSize = 1024
  13993. // https://wicg.github.io/cookie-store/#cookie-maximum-name-value-pair-size
  13994. const maxNameValuePairSize = 4096
  13995. module.exports = {
  13996. maxAttributeValueSize,
  13997. maxNameValuePairSize
  13998. }
  13999. /***/ }),
  14000. /***/ 9061:
  14001. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  14002. const { parseSetCookie } = __nccwpck_require__(1978)
  14003. const { stringify } = __nccwpck_require__(7797)
  14004. const { webidl } = __nccwpck_require__(5893)
  14005. const { Headers } = __nccwpck_require__(660)
  14006. /**
  14007. * @typedef {Object} Cookie
  14008. * @property {string} name
  14009. * @property {string} value
  14010. * @property {Date|number|undefined} expires
  14011. * @property {number|undefined} maxAge
  14012. * @property {string|undefined} domain
  14013. * @property {string|undefined} path
  14014. * @property {boolean|undefined} secure
  14015. * @property {boolean|undefined} httpOnly
  14016. * @property {'Strict'|'Lax'|'None'} sameSite
  14017. * @property {string[]} unparsed
  14018. */
  14019. /**
  14020. * @param {Headers} headers
  14021. * @returns {Record<string, string>}
  14022. */
  14023. function getCookies (headers) {
  14024. webidl.argumentLengthCheck(arguments, 1, 'getCookies')
  14025. webidl.brandCheck(headers, Headers, { strict: false })
  14026. const cookie = headers.get('cookie')
  14027. const out = {}
  14028. if (!cookie) {
  14029. return out
  14030. }
  14031. for (const piece of cookie.split(';')) {
  14032. const [name, ...value] = piece.split('=')
  14033. out[name.trim()] = value.join('=')
  14034. }
  14035. return out
  14036. }
  14037. /**
  14038. * @param {Headers} headers
  14039. * @param {string} name
  14040. * @param {{ path?: string, domain?: string }|undefined} attributes
  14041. * @returns {void}
  14042. */
  14043. function deleteCookie (headers, name, attributes) {
  14044. webidl.brandCheck(headers, Headers, { strict: false })
  14045. const prefix = 'deleteCookie'
  14046. webidl.argumentLengthCheck(arguments, 2, prefix)
  14047. name = webidl.converters.DOMString(name, prefix, 'name')
  14048. attributes = webidl.converters.DeleteCookieAttributes(attributes)
  14049. // Matches behavior of
  14050. // https://github.com/denoland/deno_std/blob/63827b16330b82489a04614027c33b7904e08be5/http/cookie.ts#L278
  14051. setCookie(headers, {
  14052. name,
  14053. value: '',
  14054. expires: new Date(0),
  14055. ...attributes
  14056. })
  14057. }
  14058. /**
  14059. * @param {Headers} headers
  14060. * @returns {Cookie[]}
  14061. */
  14062. function getSetCookies (headers) {
  14063. webidl.argumentLengthCheck(arguments, 1, 'getSetCookies')
  14064. webidl.brandCheck(headers, Headers, { strict: false })
  14065. const cookies = headers.getSetCookie()
  14066. if (!cookies) {
  14067. return []
  14068. }
  14069. return cookies.map((pair) => parseSetCookie(pair))
  14070. }
  14071. /**
  14072. * @param {Headers} headers
  14073. * @param {Cookie} cookie
  14074. * @returns {void}
  14075. */
  14076. function setCookie (headers, cookie) {
  14077. webidl.argumentLengthCheck(arguments, 2, 'setCookie')
  14078. webidl.brandCheck(headers, Headers, { strict: false })
  14079. cookie = webidl.converters.Cookie(cookie)
  14080. const str = stringify(cookie)
  14081. if (str) {
  14082. headers.append('Set-Cookie', str)
  14083. }
  14084. }
  14085. webidl.converters.DeleteCookieAttributes = webidl.dictionaryConverter([
  14086. {
  14087. converter: webidl.nullableConverter(webidl.converters.DOMString),
  14088. key: 'path',
  14089. defaultValue: () => null
  14090. },
  14091. {
  14092. converter: webidl.nullableConverter(webidl.converters.DOMString),
  14093. key: 'domain',
  14094. defaultValue: () => null
  14095. }
  14096. ])
  14097. webidl.converters.Cookie = webidl.dictionaryConverter([
  14098. {
  14099. converter: webidl.converters.DOMString,
  14100. key: 'name'
  14101. },
  14102. {
  14103. converter: webidl.converters.DOMString,
  14104. key: 'value'
  14105. },
  14106. {
  14107. converter: webidl.nullableConverter((value) => {
  14108. if (typeof value === 'number') {
  14109. return webidl.converters['unsigned long long'](value)
  14110. }
  14111. return new Date(value)
  14112. }),
  14113. key: 'expires',
  14114. defaultValue: () => null
  14115. },
  14116. {
  14117. converter: webidl.nullableConverter(webidl.converters['long long']),
  14118. key: 'maxAge',
  14119. defaultValue: () => null
  14120. },
  14121. {
  14122. converter: webidl.nullableConverter(webidl.converters.DOMString),
  14123. key: 'domain',
  14124. defaultValue: () => null
  14125. },
  14126. {
  14127. converter: webidl.nullableConverter(webidl.converters.DOMString),
  14128. key: 'path',
  14129. defaultValue: () => null
  14130. },
  14131. {
  14132. converter: webidl.nullableConverter(webidl.converters.boolean),
  14133. key: 'secure',
  14134. defaultValue: () => null
  14135. },
  14136. {
  14137. converter: webidl.nullableConverter(webidl.converters.boolean),
  14138. key: 'httpOnly',
  14139. defaultValue: () => null
  14140. },
  14141. {
  14142. converter: webidl.converters.USVString,
  14143. key: 'sameSite',
  14144. allowedValues: ['Strict', 'Lax', 'None']
  14145. },
  14146. {
  14147. converter: webidl.sequenceConverter(webidl.converters.DOMString),
  14148. key: 'unparsed',
  14149. defaultValue: () => new Array(0)
  14150. }
  14151. ])
  14152. module.exports = {
  14153. getCookies,
  14154. deleteCookie,
  14155. getSetCookies,
  14156. setCookie
  14157. }
  14158. /***/ }),
  14159. /***/ 1978:
  14160. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  14161. const { maxNameValuePairSize, maxAttributeValueSize } = __nccwpck_require__(1276)
  14162. const { isCTLExcludingHtab } = __nccwpck_require__(7797)
  14163. const { collectASequenceOfCodePointsFast } = __nccwpck_require__(1900)
  14164. const assert = __nccwpck_require__(4589)
  14165. /**
  14166. * @description Parses the field-value attributes of a set-cookie header string.
  14167. * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4
  14168. * @param {string} header
  14169. * @returns if the header is invalid, null will be returned
  14170. */
  14171. function parseSetCookie (header) {
  14172. // 1. If the set-cookie-string contains a %x00-08 / %x0A-1F / %x7F
  14173. // character (CTL characters excluding HTAB): Abort these steps and
  14174. // ignore the set-cookie-string entirely.
  14175. if (isCTLExcludingHtab(header)) {
  14176. return null
  14177. }
  14178. let nameValuePair = ''
  14179. let unparsedAttributes = ''
  14180. let name = ''
  14181. let value = ''
  14182. // 2. If the set-cookie-string contains a %x3B (";") character:
  14183. if (header.includes(';')) {
  14184. // 1. The name-value-pair string consists of the characters up to,
  14185. // but not including, the first %x3B (";"), and the unparsed-
  14186. // attributes consist of the remainder of the set-cookie-string
  14187. // (including the %x3B (";") in question).
  14188. const position = { position: 0 }
  14189. nameValuePair = collectASequenceOfCodePointsFast(';', header, position)
  14190. unparsedAttributes = header.slice(position.position)
  14191. } else {
  14192. // Otherwise:
  14193. // 1. The name-value-pair string consists of all the characters
  14194. // contained in the set-cookie-string, and the unparsed-
  14195. // attributes is the empty string.
  14196. nameValuePair = header
  14197. }
  14198. // 3. If the name-value-pair string lacks a %x3D ("=") character, then
  14199. // the name string is empty, and the value string is the value of
  14200. // name-value-pair.
  14201. if (!nameValuePair.includes('=')) {
  14202. value = nameValuePair
  14203. } else {
  14204. // Otherwise, the name string consists of the characters up to, but
  14205. // not including, the first %x3D ("=") character, and the (possibly
  14206. // empty) value string consists of the characters after the first
  14207. // %x3D ("=") character.
  14208. const position = { position: 0 }
  14209. name = collectASequenceOfCodePointsFast(
  14210. '=',
  14211. nameValuePair,
  14212. position
  14213. )
  14214. value = nameValuePair.slice(position.position + 1)
  14215. }
  14216. // 4. Remove any leading or trailing WSP characters from the name
  14217. // string and the value string.
  14218. name = name.trim()
  14219. value = value.trim()
  14220. // 5. If the sum of the lengths of the name string and the value string
  14221. // is more than 4096 octets, abort these steps and ignore the set-
  14222. // cookie-string entirely.
  14223. if (name.length + value.length > maxNameValuePairSize) {
  14224. return null
  14225. }
  14226. // 6. The cookie-name is the name string, and the cookie-value is the
  14227. // value string.
  14228. return {
  14229. name, value, ...parseUnparsedAttributes(unparsedAttributes)
  14230. }
  14231. }
  14232. /**
  14233. * Parses the remaining attributes of a set-cookie header
  14234. * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4
  14235. * @param {string} unparsedAttributes
  14236. * @param {[Object.<string, unknown>]={}} cookieAttributeList
  14237. */
  14238. function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {}) {
  14239. // 1. If the unparsed-attributes string is empty, skip the rest of
  14240. // these steps.
  14241. if (unparsedAttributes.length === 0) {
  14242. return cookieAttributeList
  14243. }
  14244. // 2. Discard the first character of the unparsed-attributes (which
  14245. // will be a %x3B (";") character).
  14246. assert(unparsedAttributes[0] === ';')
  14247. unparsedAttributes = unparsedAttributes.slice(1)
  14248. let cookieAv = ''
  14249. // 3. If the remaining unparsed-attributes contains a %x3B (";")
  14250. // character:
  14251. if (unparsedAttributes.includes(';')) {
  14252. // 1. Consume the characters of the unparsed-attributes up to, but
  14253. // not including, the first %x3B (";") character.
  14254. cookieAv = collectASequenceOfCodePointsFast(
  14255. ';',
  14256. unparsedAttributes,
  14257. { position: 0 }
  14258. )
  14259. unparsedAttributes = unparsedAttributes.slice(cookieAv.length)
  14260. } else {
  14261. // Otherwise:
  14262. // 1. Consume the remainder of the unparsed-attributes.
  14263. cookieAv = unparsedAttributes
  14264. unparsedAttributes = ''
  14265. }
  14266. // Let the cookie-av string be the characters consumed in this step.
  14267. let attributeName = ''
  14268. let attributeValue = ''
  14269. // 4. If the cookie-av string contains a %x3D ("=") character:
  14270. if (cookieAv.includes('=')) {
  14271. // 1. The (possibly empty) attribute-name string consists of the
  14272. // characters up to, but not including, the first %x3D ("=")
  14273. // character, and the (possibly empty) attribute-value string
  14274. // consists of the characters after the first %x3D ("=")
  14275. // character.
  14276. const position = { position: 0 }
  14277. attributeName = collectASequenceOfCodePointsFast(
  14278. '=',
  14279. cookieAv,
  14280. position
  14281. )
  14282. attributeValue = cookieAv.slice(position.position + 1)
  14283. } else {
  14284. // Otherwise:
  14285. // 1. The attribute-name string consists of the entire cookie-av
  14286. // string, and the attribute-value string is empty.
  14287. attributeName = cookieAv
  14288. }
  14289. // 5. Remove any leading or trailing WSP characters from the attribute-
  14290. // name string and the attribute-value string.
  14291. attributeName = attributeName.trim()
  14292. attributeValue = attributeValue.trim()
  14293. // 6. If the attribute-value is longer than 1024 octets, ignore the
  14294. // cookie-av string and return to Step 1 of this algorithm.
  14295. if (attributeValue.length > maxAttributeValueSize) {
  14296. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14297. }
  14298. // 7. Process the attribute-name and attribute-value according to the
  14299. // requirements in the following subsections. (Notice that
  14300. // attributes with unrecognized attribute-names are ignored.)
  14301. const attributeNameLowercase = attributeName.toLowerCase()
  14302. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.1
  14303. // If the attribute-name case-insensitively matches the string
  14304. // "Expires", the user agent MUST process the cookie-av as follows.
  14305. if (attributeNameLowercase === 'expires') {
  14306. // 1. Let the expiry-time be the result of parsing the attribute-value
  14307. // as cookie-date (see Section 5.1.1).
  14308. const expiryTime = new Date(attributeValue)
  14309. // 2. If the attribute-value failed to parse as a cookie date, ignore
  14310. // the cookie-av.
  14311. cookieAttributeList.expires = expiryTime
  14312. } else if (attributeNameLowercase === 'max-age') {
  14313. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.2
  14314. // If the attribute-name case-insensitively matches the string "Max-
  14315. // Age", the user agent MUST process the cookie-av as follows.
  14316. // 1. If the first character of the attribute-value is not a DIGIT or a
  14317. // "-" character, ignore the cookie-av.
  14318. const charCode = attributeValue.charCodeAt(0)
  14319. if ((charCode < 48 || charCode > 57) && attributeValue[0] !== '-') {
  14320. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14321. }
  14322. // 2. If the remainder of attribute-value contains a non-DIGIT
  14323. // character, ignore the cookie-av.
  14324. if (!/^\d+$/.test(attributeValue)) {
  14325. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14326. }
  14327. // 3. Let delta-seconds be the attribute-value converted to an integer.
  14328. const deltaSeconds = Number(attributeValue)
  14329. // 4. Let cookie-age-limit be the maximum age of the cookie (which
  14330. // SHOULD be 400 days or less, see Section 4.1.2.2).
  14331. // 5. Set delta-seconds to the smaller of its present value and cookie-
  14332. // age-limit.
  14333. // deltaSeconds = Math.min(deltaSeconds * 1000, maxExpiresMs)
  14334. // 6. If delta-seconds is less than or equal to zero (0), let expiry-
  14335. // time be the earliest representable date and time. Otherwise, let
  14336. // the expiry-time be the current date and time plus delta-seconds
  14337. // seconds.
  14338. // const expiryTime = deltaSeconds <= 0 ? Date.now() : Date.now() + deltaSeconds
  14339. // 7. Append an attribute to the cookie-attribute-list with an
  14340. // attribute-name of Max-Age and an attribute-value of expiry-time.
  14341. cookieAttributeList.maxAge = deltaSeconds
  14342. } else if (attributeNameLowercase === 'domain') {
  14343. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.3
  14344. // If the attribute-name case-insensitively matches the string "Domain",
  14345. // the user agent MUST process the cookie-av as follows.
  14346. // 1. Let cookie-domain be the attribute-value.
  14347. let cookieDomain = attributeValue
  14348. // 2. If cookie-domain starts with %x2E ("."), let cookie-domain be
  14349. // cookie-domain without its leading %x2E (".").
  14350. if (cookieDomain[0] === '.') {
  14351. cookieDomain = cookieDomain.slice(1)
  14352. }
  14353. // 3. Convert the cookie-domain to lower case.
  14354. cookieDomain = cookieDomain.toLowerCase()
  14355. // 4. Append an attribute to the cookie-attribute-list with an
  14356. // attribute-name of Domain and an attribute-value of cookie-domain.
  14357. cookieAttributeList.domain = cookieDomain
  14358. } else if (attributeNameLowercase === 'path') {
  14359. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.4
  14360. // If the attribute-name case-insensitively matches the string "Path",
  14361. // the user agent MUST process the cookie-av as follows.
  14362. // 1. If the attribute-value is empty or if the first character of the
  14363. // attribute-value is not %x2F ("/"):
  14364. let cookiePath = ''
  14365. if (attributeValue.length === 0 || attributeValue[0] !== '/') {
  14366. // 1. Let cookie-path be the default-path.
  14367. cookiePath = '/'
  14368. } else {
  14369. // Otherwise:
  14370. // 1. Let cookie-path be the attribute-value.
  14371. cookiePath = attributeValue
  14372. }
  14373. // 2. Append an attribute to the cookie-attribute-list with an
  14374. // attribute-name of Path and an attribute-value of cookie-path.
  14375. cookieAttributeList.path = cookiePath
  14376. } else if (attributeNameLowercase === 'secure') {
  14377. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.5
  14378. // If the attribute-name case-insensitively matches the string "Secure",
  14379. // the user agent MUST append an attribute to the cookie-attribute-list
  14380. // with an attribute-name of Secure and an empty attribute-value.
  14381. cookieAttributeList.secure = true
  14382. } else if (attributeNameLowercase === 'httponly') {
  14383. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.6
  14384. // If the attribute-name case-insensitively matches the string
  14385. // "HttpOnly", the user agent MUST append an attribute to the cookie-
  14386. // attribute-list with an attribute-name of HttpOnly and an empty
  14387. // attribute-value.
  14388. cookieAttributeList.httpOnly = true
  14389. } else if (attributeNameLowercase === 'samesite') {
  14390. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.7
  14391. // If the attribute-name case-insensitively matches the string
  14392. // "SameSite", the user agent MUST process the cookie-av as follows:
  14393. const attributeValueLowercase = attributeValue.toLowerCase()
  14394. // 1. If cookie-av's attribute-value is a case-insensitive match for
  14395. // "None", append an attribute to the cookie-attribute-list with an
  14396. // attribute-name of "SameSite" and an attribute-value of "None".
  14397. if (attributeValueLowercase === 'none') {
  14398. cookieAttributeList.sameSite = 'None'
  14399. } else if (attributeValueLowercase === 'strict') {
  14400. // 2. If cookie-av's attribute-value is a case-insensitive match for
  14401. // "Strict", append an attribute to the cookie-attribute-list with
  14402. // an attribute-name of "SameSite" and an attribute-value of
  14403. // "Strict".
  14404. cookieAttributeList.sameSite = 'Strict'
  14405. } else if (attributeValueLowercase === 'lax') {
  14406. // 3. If cookie-av's attribute-value is a case-insensitive match for
  14407. // "Lax", append an attribute to the cookie-attribute-list with an
  14408. // attribute-name of "SameSite" and an attribute-value of "Lax".
  14409. cookieAttributeList.sameSite = 'Lax'
  14410. }
  14411. } else {
  14412. cookieAttributeList.unparsed ??= []
  14413. cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`)
  14414. }
  14415. // 8. Return to Step 1 of this algorithm.
  14416. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14417. }
  14418. module.exports = {
  14419. parseSetCookie,
  14420. parseUnparsedAttributes
  14421. }
  14422. /***/ }),
  14423. /***/ 7797:
  14424. /***/ ((module) => {
  14425. /**
  14426. * @param {string} value
  14427. * @returns {boolean}
  14428. */
  14429. function isCTLExcludingHtab (value) {
  14430. for (let i = 0; i < value.length; ++i) {
  14431. const code = value.charCodeAt(i)
  14432. if (
  14433. (code >= 0x00 && code <= 0x08) ||
  14434. (code >= 0x0A && code <= 0x1F) ||
  14435. code === 0x7F
  14436. ) {
  14437. return true
  14438. }
  14439. }
  14440. return false
  14441. }
  14442. /**
  14443. CHAR = <any US-ASCII character (octets 0 - 127)>
  14444. token = 1*<any CHAR except CTLs or separators>
  14445. separators = "(" | ")" | "<" | ">" | "@"
  14446. | "," | ";" | ":" | "\" | <">
  14447. | "/" | "[" | "]" | "?" | "="
  14448. | "{" | "}" | SP | HT
  14449. * @param {string} name
  14450. */
  14451. function validateCookieName (name) {
  14452. for (let i = 0; i < name.length; ++i) {
  14453. const code = name.charCodeAt(i)
  14454. if (
  14455. code < 0x21 || // exclude CTLs (0-31), SP and HT
  14456. code > 0x7E || // exclude non-ascii and DEL
  14457. code === 0x22 || // "
  14458. code === 0x28 || // (
  14459. code === 0x29 || // )
  14460. code === 0x3C || // <
  14461. code === 0x3E || // >
  14462. code === 0x40 || // @
  14463. code === 0x2C || // ,
  14464. code === 0x3B || // ;
  14465. code === 0x3A || // :
  14466. code === 0x5C || // \
  14467. code === 0x2F || // /
  14468. code === 0x5B || // [
  14469. code === 0x5D || // ]
  14470. code === 0x3F || // ?
  14471. code === 0x3D || // =
  14472. code === 0x7B || // {
  14473. code === 0x7D // }
  14474. ) {
  14475. throw new Error('Invalid cookie name')
  14476. }
  14477. }
  14478. }
  14479. /**
  14480. cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
  14481. cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
  14482. ; US-ASCII characters excluding CTLs,
  14483. ; whitespace DQUOTE, comma, semicolon,
  14484. ; and backslash
  14485. * @param {string} value
  14486. */
  14487. function validateCookieValue (value) {
  14488. let len = value.length
  14489. let i = 0
  14490. // if the value is wrapped in DQUOTE
  14491. if (value[0] === '"') {
  14492. if (len === 1 || value[len - 1] !== '"') {
  14493. throw new Error('Invalid cookie value')
  14494. }
  14495. --len
  14496. ++i
  14497. }
  14498. while (i < len) {
  14499. const code = value.charCodeAt(i++)
  14500. if (
  14501. code < 0x21 || // exclude CTLs (0-31)
  14502. code > 0x7E || // non-ascii and DEL (127)
  14503. code === 0x22 || // "
  14504. code === 0x2C || // ,
  14505. code === 0x3B || // ;
  14506. code === 0x5C // \
  14507. ) {
  14508. throw new Error('Invalid cookie value')
  14509. }
  14510. }
  14511. }
  14512. /**
  14513. * path-value = <any CHAR except CTLs or ";">
  14514. * @param {string} path
  14515. */
  14516. function validateCookiePath (path) {
  14517. for (let i = 0; i < path.length; ++i) {
  14518. const code = path.charCodeAt(i)
  14519. if (
  14520. code < 0x20 || // exclude CTLs (0-31)
  14521. code > 0x7E || // exclude DEL and non-ascii
  14522. code === 0x3B // ;
  14523. ) {
  14524. throw new Error('Invalid cookie path')
  14525. }
  14526. }
  14527. }
  14528. /**
  14529. * <let-dig> ::= <letter> | <digit>
  14530. *
  14531. * <letter> ::= any one of the 52 alphabetic characters A through Z in
  14532. * upper case and a through z in lower case
  14533. *
  14534. * <digit> ::= any one of the ten digits 0 through 9r
  14535. *
  14536. * @see https://www.rfc-editor.org/rfc/rfc1034#section-3.5
  14537. * @param {number} code
  14538. */
  14539. function isLetterOrDigit (code) {
  14540. return (
  14541. (code >= 0x30 && code <= 0x39) || // 0-9
  14542. (code >= 0x41 && code <= 0x5A) || // A-Z
  14543. (code >= 0x61 && code <= 0x7A) // a-z
  14544. )
  14545. }
  14546. /**
  14547. * Validates a cookie domain against the "preferred name syntax".
  14548. *
  14549. * <domain> ::= <subdomain> | " "
  14550. * <subdomain> ::= <label> | <subdomain> "." <label>
  14551. * <label> ::= <let-dig> [ [ <ldh-str> ] <let-dig> ]
  14552. * <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
  14553. * <let-dig-hyp> ::= <let-dig> | "-"
  14554. *
  14555. * @see https://www.rfc-editor.org/rfc/rfc1034#section-3.5
  14556. * @see https://www.rfc-editor.org/rfc/rfc1123#section-2.1
  14557. * @see https://www.rfc-editor.org/rfc/rfc1035#section-2.3.4
  14558. * @param {string} domain
  14559. */
  14560. function validateCookieDomain (domain) {
  14561. // <domain> ::= <subdomain> | " "
  14562. if (domain === ' ') {
  14563. return
  14564. }
  14565. if (domain.length > 255) {
  14566. throw new Error('Invalid cookie domain')
  14567. }
  14568. let labelLength = 0
  14569. for (let i = 0; i < domain.length; ++i) {
  14570. const code = domain.charCodeAt(i)
  14571. if (code === 0x2E) {
  14572. if (labelLength === 0) {
  14573. throw new Error('Invalid cookie domain')
  14574. }
  14575. if (domain.charCodeAt(i - 1) === 0x2D) { // "-"
  14576. throw new Error('Invalid cookie domain')
  14577. }
  14578. labelLength = 0
  14579. continue
  14580. }
  14581. if (labelLength === 0 && !isLetterOrDigit(code)) {
  14582. throw new Error('Invalid cookie domain')
  14583. }
  14584. if (!isLetterOrDigit(code) && code !== 0x2D) { // "-"
  14585. throw new Error('Invalid cookie domain')
  14586. }
  14587. if (++labelLength > 63) {
  14588. throw new Error('Invalid cookie domain')
  14589. }
  14590. }
  14591. if (labelLength === 0 || domain.charCodeAt(domain.length - 1) === 0x2D) { // "-"
  14592. throw new Error('Invalid cookie domain')
  14593. }
  14594. }
  14595. const IMFDays = [
  14596. 'Sun', 'Mon', 'Tue', 'Wed',
  14597. 'Thu', 'Fri', 'Sat'
  14598. ]
  14599. const IMFMonths = [
  14600. 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  14601. 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
  14602. ]
  14603. const IMFPaddedNumbers = Array(61).fill(0).map((_, i) => i.toString().padStart(2, '0'))
  14604. /**
  14605. * @see https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1
  14606. * @param {number|Date} date
  14607. IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT
  14608. ; fixed length/zone/capitalization subset of the format
  14609. ; see Section 3.3 of [RFC5322]
  14610. day-name = %x4D.6F.6E ; "Mon", case-sensitive
  14611. / %x54.75.65 ; "Tue", case-sensitive
  14612. / %x57.65.64 ; "Wed", case-sensitive
  14613. / %x54.68.75 ; "Thu", case-sensitive
  14614. / %x46.72.69 ; "Fri", case-sensitive
  14615. / %x53.61.74 ; "Sat", case-sensitive
  14616. / %x53.75.6E ; "Sun", case-sensitive
  14617. date1 = day SP month SP year
  14618. ; e.g., 02 Jun 1982
  14619. day = 2DIGIT
  14620. month = %x4A.61.6E ; "Jan", case-sensitive
  14621. / %x46.65.62 ; "Feb", case-sensitive
  14622. / %x4D.61.72 ; "Mar", case-sensitive
  14623. / %x41.70.72 ; "Apr", case-sensitive
  14624. / %x4D.61.79 ; "May", case-sensitive
  14625. / %x4A.75.6E ; "Jun", case-sensitive
  14626. / %x4A.75.6C ; "Jul", case-sensitive
  14627. / %x41.75.67 ; "Aug", case-sensitive
  14628. / %x53.65.70 ; "Sep", case-sensitive
  14629. / %x4F.63.74 ; "Oct", case-sensitive
  14630. / %x4E.6F.76 ; "Nov", case-sensitive
  14631. / %x44.65.63 ; "Dec", case-sensitive
  14632. year = 4DIGIT
  14633. GMT = %x47.4D.54 ; "GMT", case-sensitive
  14634. time-of-day = hour ":" minute ":" second
  14635. ; 00:00:00 - 23:59:60 (leap second)
  14636. hour = 2DIGIT
  14637. minute = 2DIGIT
  14638. second = 2DIGIT
  14639. */
  14640. function toIMFDate (date) {
  14641. if (typeof date === 'number') {
  14642. date = new Date(date)
  14643. }
  14644. return `${IMFDays[date.getUTCDay()]}, ${IMFPaddedNumbers[date.getUTCDate()]} ${IMFMonths[date.getUTCMonth()]} ${date.getUTCFullYear()} ${IMFPaddedNumbers[date.getUTCHours()]}:${IMFPaddedNumbers[date.getUTCMinutes()]}:${IMFPaddedNumbers[date.getUTCSeconds()]} GMT`
  14645. }
  14646. /**
  14647. max-age-av = "Max-Age=" non-zero-digit *DIGIT
  14648. ; In practice, both expires-av and max-age-av
  14649. ; are limited to dates representable by the
  14650. ; user agent.
  14651. * @param {number} maxAge
  14652. */
  14653. function validateCookieMaxAge (maxAge) {
  14654. if (maxAge < 0) {
  14655. throw new Error('Invalid cookie max-age')
  14656. }
  14657. }
  14658. /**
  14659. * @see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1
  14660. * @param {import('./index').Cookie} cookie
  14661. */
  14662. function stringify (cookie) {
  14663. if (cookie.name.length === 0) {
  14664. return null
  14665. }
  14666. validateCookieName(cookie.name)
  14667. validateCookieValue(cookie.value)
  14668. const out = [`${cookie.name}=${cookie.value}`]
  14669. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.1
  14670. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.2
  14671. if (cookie.name.startsWith('__Secure-')) {
  14672. cookie.secure = true
  14673. }
  14674. if (cookie.name.startsWith('__Host-')) {
  14675. cookie.secure = true
  14676. cookie.domain = null
  14677. cookie.path = '/'
  14678. }
  14679. if (cookie.secure) {
  14680. out.push('Secure')
  14681. }
  14682. if (cookie.httpOnly) {
  14683. out.push('HttpOnly')
  14684. }
  14685. if (typeof cookie.maxAge === 'number') {
  14686. validateCookieMaxAge(cookie.maxAge)
  14687. out.push(`Max-Age=${cookie.maxAge}`)
  14688. }
  14689. if (cookie.domain) {
  14690. validateCookieDomain(cookie.domain)
  14691. out.push(`Domain=${cookie.domain}`)
  14692. }
  14693. if (cookie.path) {
  14694. validateCookiePath(cookie.path)
  14695. out.push(`Path=${cookie.path}`)
  14696. }
  14697. if (cookie.expires && cookie.expires.toString() !== 'Invalid Date') {
  14698. out.push(`Expires=${toIMFDate(cookie.expires)}`)
  14699. }
  14700. if (cookie.sameSite) {
  14701. out.push(`SameSite=${cookie.sameSite}`)
  14702. }
  14703. for (const part of cookie.unparsed) {
  14704. if (!part.includes('=')) {
  14705. throw new Error('Invalid unparsed')
  14706. }
  14707. const [key, ...value] = part.split('=')
  14708. const trimmedKey = key.trim()
  14709. const joinedValue = value.join('=')
  14710. validateCookieName(trimmedKey)
  14711. validateCookieValue(joinedValue)
  14712. out.push(`${trimmedKey}=${joinedValue}`)
  14713. }
  14714. return out.join('; ')
  14715. }
  14716. module.exports = {
  14717. isCTLExcludingHtab,
  14718. validateCookieName,
  14719. validateCookiePath,
  14720. validateCookieValue,
  14721. toIMFDate,
  14722. stringify
  14723. }
  14724. /***/ }),
  14725. /***/ 4031:
  14726. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  14727. const { Transform } = __nccwpck_require__(7075)
  14728. const { isASCIINumber, isValidLastEventId } = __nccwpck_require__(4811)
  14729. /**
  14730. * @type {number[]} BOM
  14731. */
  14732. const BOM = [0xEF, 0xBB, 0xBF]
  14733. /**
  14734. * @type {10} LF
  14735. */
  14736. const LF = 0x0A
  14737. /**
  14738. * @type {13} CR
  14739. */
  14740. const CR = 0x0D
  14741. /**
  14742. * @type {58} COLON
  14743. */
  14744. const COLON = 0x3A
  14745. /**
  14746. * @type {32} SPACE
  14747. */
  14748. const SPACE = 0x20
  14749. const DATA = Buffer.from('data')
  14750. const EVENT = Buffer.from('event')
  14751. const ID = Buffer.from('id')
  14752. const RETRY = Buffer.from('retry')
  14753. function isASCIINumberBytes (buffer, start) {
  14754. if (start >= buffer.length) {
  14755. return false
  14756. }
  14757. for (let i = start; i < buffer.length; i++) {
  14758. if (buffer[i] < 0x30 || buffer[i] > 0x39) {
  14759. return false
  14760. }
  14761. }
  14762. return true
  14763. }
  14764. function isValidLastEventIdBytes (buffer, start) {
  14765. for (let i = start; i < buffer.length; i++) {
  14766. if (buffer[i] === 0x00) {
  14767. return false
  14768. }
  14769. }
  14770. return true
  14771. }
  14772. function isFieldName (line, length, field) {
  14773. if (length !== field.length) {
  14774. return false
  14775. }
  14776. for (let i = 0; i < length; i++) {
  14777. if (line[i] !== field[i]) {
  14778. return false
  14779. }
  14780. }
  14781. return true
  14782. }
  14783. /**
  14784. * @typedef {object} EventSourceStreamEvent
  14785. * @type {object}
  14786. * @property {string} [event] The event type.
  14787. * @property {string} [data] The data of the message.
  14788. * @property {string} [id] A unique ID for the event.
  14789. * @property {string} [retry] The reconnection time, in milliseconds.
  14790. */
  14791. /**
  14792. * @typedef eventSourceSettings
  14793. * @type {object}
  14794. * @property {string} lastEventId The last event ID received from the server.
  14795. * @property {string} origin The origin of the event source.
  14796. * @property {number} reconnectionTime The reconnection time, in milliseconds.
  14797. */
  14798. class EventSourceStream extends Transform {
  14799. /**
  14800. * @type {eventSourceSettings}
  14801. */
  14802. state = null
  14803. /**
  14804. * Leading byte-order-mark check.
  14805. * @type {boolean}
  14806. */
  14807. checkBOM = true
  14808. /**
  14809. * @type {boolean}
  14810. */
  14811. crlfCheck = false
  14812. /**
  14813. * @type {boolean}
  14814. */
  14815. eventEndCheck = false
  14816. /**
  14817. * @type {Buffer[]}
  14818. */
  14819. chunks = []
  14820. chunkIndex = 0
  14821. pos = 0
  14822. lineChunkIndex = 0
  14823. linePos = 0
  14824. event = {
  14825. data: undefined,
  14826. event: undefined,
  14827. id: undefined,
  14828. retry: undefined
  14829. }
  14830. /**
  14831. * @param {object} options
  14832. * @param {eventSourceSettings} options.eventSourceSettings
  14833. * @param {Function} [options.push]
  14834. */
  14835. constructor (options = {}) {
  14836. // Enable object mode as EventSourceStream emits objects of shape
  14837. // EventSourceStreamEvent
  14838. options.readableObjectMode = true
  14839. super(options)
  14840. this.state = options.eventSourceSettings || {}
  14841. if (options.push) {
  14842. this.push = options.push
  14843. }
  14844. }
  14845. /**
  14846. * @param {Buffer} chunk
  14847. * @param {string} _encoding
  14848. * @param {Function} callback
  14849. * @returns {void}
  14850. */
  14851. _transform (chunk, _encoding, callback) {
  14852. if (chunk.length === 0) {
  14853. callback()
  14854. return
  14855. }
  14856. this.chunks.push(chunk)
  14857. // Strip leading byte-order-mark if we opened the stream and started
  14858. // the processing of the incoming data
  14859. if (this.checkBOM) {
  14860. if (this.handleBOM()) {
  14861. callback()
  14862. return
  14863. }
  14864. }
  14865. while (this.hasCurrentByte()) {
  14866. const byte = this.currentByte()
  14867. // If the previous line ended with an end-of-line, we need to check
  14868. // if the next character is also an end-of-line.
  14869. if (this.eventEndCheck) {
  14870. // If the the current character is an end-of-line, then the event
  14871. // is finished and we can process it
  14872. // If the previous line ended with a carriage return, we need to
  14873. // check if the current character is a line feed and remove it
  14874. // from the buffer.
  14875. if (this.crlfCheck) {
  14876. // If the current character is a line feed, we can remove it
  14877. // from the buffer and reset the crlfCheck flag
  14878. if (byte === LF) {
  14879. this.crlfCheck = false
  14880. this.consumeCurrentByte()
  14881. // It is possible that the line feed is not the end of the
  14882. // event. We need to check if the next character is an
  14883. // end-of-line character to determine if the event is
  14884. // finished. We simply continue the loop to check the next
  14885. // character.
  14886. // As we removed the line feed from the buffer and set the
  14887. // crlfCheck flag to false, we basically don't make any
  14888. // distinction between a line feed and a carriage return.
  14889. continue
  14890. }
  14891. this.crlfCheck = false
  14892. }
  14893. if (byte === LF || byte === CR) {
  14894. // If the current character is a carriage return, we need to
  14895. // set the crlfCheck flag to true, as we need to check if the
  14896. // next character is a line feed so we can remove it from the
  14897. // buffer
  14898. if (byte === CR) {
  14899. this.crlfCheck = true
  14900. }
  14901. this.consumeCurrentByte()
  14902. if (this.hasPendingEvent()) {
  14903. this.processEvent(this.event)
  14904. }
  14905. this.clearEvent()
  14906. continue
  14907. }
  14908. // If the current character is not an end-of-line, then the event
  14909. // is not finished and we have to reset the eventEndCheck flag
  14910. this.eventEndCheck = false
  14911. continue
  14912. }
  14913. // If the current character is an end-of-line, we can process the
  14914. // line
  14915. if (byte === LF || byte === CR) {
  14916. // If the current character is a carriage return, we need to
  14917. // set the crlfCheck flag to true, as we need to check if the
  14918. // next character is a line feed
  14919. if (byte === CR) {
  14920. this.crlfCheck = true
  14921. }
  14922. // In any case, we can process the line as we reached an
  14923. // end-of-line character
  14924. this.parseLine(this.readLine(), this.event)
  14925. this.consumeCurrentByte()
  14926. // A line was processed and this could be the end of the event. We need
  14927. // to check if the next line is empty to determine if the event is
  14928. // finished.
  14929. this.eventEndCheck = true
  14930. continue
  14931. }
  14932. this.advanceCursor()
  14933. }
  14934. callback()
  14935. }
  14936. /**
  14937. * @param {Buffer} line
  14938. * @param {EventStreamEvent} event
  14939. */
  14940. parseLine (line, event) {
  14941. // If the line is empty (a blank line)
  14942. // Dispatch the event, as defined below.
  14943. // This will be handled in the _transform method
  14944. if (line.length === 0) {
  14945. return
  14946. }
  14947. // If the line starts with a U+003A COLON character (:)
  14948. // Ignore the line.
  14949. const colonPosition = line.indexOf(COLON)
  14950. if (colonPosition === 0) {
  14951. return
  14952. }
  14953. let fieldLength = line.length
  14954. let valueStart = line.length
  14955. // If the line contains a U+003A COLON character (:)
  14956. if (colonPosition !== -1) {
  14957. fieldLength = colonPosition
  14958. // Collect the characters on the line after the first U+003A COLON
  14959. // character (:), and let value be that string.
  14960. // If value starts with a U+0020 SPACE character, remove it from value.
  14961. valueStart = colonPosition + 1
  14962. if (line[valueStart] === SPACE) {
  14963. ++valueStart
  14964. }
  14965. }
  14966. if (isFieldName(line, fieldLength, DATA)) {
  14967. const value = line.toString('utf8', valueStart)
  14968. if (event.data === undefined) {
  14969. event.data = value
  14970. } else {
  14971. event.data += `\n${value}`
  14972. }
  14973. return
  14974. }
  14975. if (isFieldName(line, fieldLength, RETRY)) {
  14976. if (isASCIINumberBytes(line, valueStart)) {
  14977. event.retry = line.toString('utf8', valueStart)
  14978. }
  14979. return
  14980. }
  14981. if (isFieldName(line, fieldLength, ID)) {
  14982. if (isValidLastEventIdBytes(line, valueStart)) {
  14983. event.id = line.toString('utf8', valueStart)
  14984. }
  14985. return
  14986. }
  14987. if (isFieldName(line, fieldLength, EVENT)) {
  14988. const value = line.toString('utf8', valueStart)
  14989. if (value.length > 0) {
  14990. event.event = value
  14991. }
  14992. }
  14993. }
  14994. /**
  14995. * @param {EventSourceStreamEvent} event
  14996. */
  14997. processEvent (event) {
  14998. if (event.retry && isASCIINumber(event.retry)) {
  14999. this.state.reconnectionTime = parseInt(event.retry, 10)
  15000. }
  15001. if (event.id && isValidLastEventId(event.id)) {
  15002. this.state.lastEventId = event.id
  15003. }
  15004. // only dispatch event, when data is provided
  15005. if (event.data !== undefined) {
  15006. this.push({
  15007. type: event.event || 'message',
  15008. options: {
  15009. data: event.data,
  15010. lastEventId: this.state.lastEventId,
  15011. origin: this.state.origin
  15012. }
  15013. })
  15014. }
  15015. }
  15016. clearEvent () {
  15017. this.event.data = undefined
  15018. this.event.event = undefined
  15019. this.event.id = undefined
  15020. this.event.retry = undefined
  15021. }
  15022. hasPendingEvent () {
  15023. return this.event.data !== undefined ||
  15024. this.event.event !== undefined ||
  15025. this.event.id !== undefined ||
  15026. this.event.retry !== undefined
  15027. }
  15028. hasCurrentByte () {
  15029. return this.chunkIndex < this.chunks.length &&
  15030. this.pos < this.chunks[this.chunkIndex].length
  15031. }
  15032. currentByte () {
  15033. return this.chunks[this.chunkIndex][this.pos]
  15034. }
  15035. consumeCurrentByte () {
  15036. this.advanceCursor()
  15037. this.syncLineStartToCursor()
  15038. }
  15039. advanceCursor () {
  15040. this.pos++
  15041. while (this.chunkIndex < this.chunks.length && this.pos >= this.chunks[this.chunkIndex].length) {
  15042. this.chunkIndex++
  15043. this.pos = 0
  15044. }
  15045. }
  15046. syncLineStartToCursor () {
  15047. this.lineChunkIndex = this.chunkIndex
  15048. this.linePos = this.pos
  15049. this.dropConsumedChunks()
  15050. }
  15051. dropConsumedChunks () {
  15052. while (this.lineChunkIndex > 0) {
  15053. this.chunks.shift()
  15054. this.lineChunkIndex--
  15055. this.chunkIndex--
  15056. }
  15057. if (this.chunkIndex === this.chunks.length) {
  15058. this.chunks.length = 0
  15059. this.chunkIndex = 0
  15060. this.pos = 0
  15061. this.lineChunkIndex = 0
  15062. this.linePos = 0
  15063. }
  15064. }
  15065. readLine () {
  15066. if (this.lineChunkIndex === this.chunkIndex) {
  15067. return this.chunks[this.chunkIndex].subarray(this.linePos, this.pos)
  15068. }
  15069. const chunks = []
  15070. let length = 0
  15071. for (let i = this.lineChunkIndex; i <= this.chunkIndex; i++) {
  15072. const chunk = this.chunks[i]
  15073. const start = i === this.lineChunkIndex ? this.linePos : 0
  15074. const end = i === this.chunkIndex ? this.pos : chunk.length
  15075. const slice = chunk.subarray(start, end)
  15076. length += slice.length
  15077. chunks.push(slice)
  15078. }
  15079. return Buffer.concat(chunks, length)
  15080. }
  15081. peekBufferedByte (offset) {
  15082. let chunkIndex = this.lineChunkIndex
  15083. let pos = this.linePos
  15084. while (chunkIndex < this.chunks.length) {
  15085. const chunk = this.chunks[chunkIndex]
  15086. const remaining = chunk.length - pos
  15087. if (offset < remaining) {
  15088. return chunk[pos + offset]
  15089. }
  15090. offset -= remaining
  15091. chunkIndex++
  15092. pos = 0
  15093. }
  15094. }
  15095. discardLeadingBytes (count) {
  15096. while (count > 0 && this.lineChunkIndex < this.chunks.length) {
  15097. const chunk = this.chunks[this.lineChunkIndex]
  15098. const remaining = chunk.length - this.linePos
  15099. if (count < remaining) {
  15100. this.linePos += count
  15101. count = 0
  15102. } else {
  15103. count -= remaining
  15104. this.lineChunkIndex++
  15105. this.linePos = 0
  15106. }
  15107. }
  15108. this.chunkIndex = this.lineChunkIndex
  15109. this.pos = this.linePos
  15110. this.dropConsumedChunks()
  15111. }
  15112. handleBOM () {
  15113. const first = this.peekBufferedByte(0)
  15114. const second = this.peekBufferedByte(1)
  15115. const third = this.peekBufferedByte(2)
  15116. if (second === undefined) {
  15117. if (first === BOM[0]) {
  15118. return true
  15119. }
  15120. this.checkBOM = false
  15121. return true
  15122. }
  15123. if (third === undefined) {
  15124. if (first === BOM[0] && second === BOM[1]) {
  15125. return true
  15126. }
  15127. this.checkBOM = false
  15128. return false
  15129. }
  15130. if (first === BOM[0] && second === BOM[1] && third === BOM[2]) {
  15131. this.discardLeadingBytes(3)
  15132. }
  15133. this.checkBOM = false
  15134. return !this.hasCurrentByte()
  15135. }
  15136. }
  15137. module.exports = {
  15138. EventSourceStream
  15139. }
  15140. /***/ }),
  15141. /***/ 1238:
  15142. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  15143. const { pipeline } = __nccwpck_require__(7075)
  15144. const { fetching } = __nccwpck_require__(4398)
  15145. const { makeRequest } = __nccwpck_require__(9967)
  15146. const { webidl } = __nccwpck_require__(5893)
  15147. const { EventSourceStream } = __nccwpck_require__(4031)
  15148. const { parseMIMEType } = __nccwpck_require__(1900)
  15149. const { createFastMessageEvent } = __nccwpck_require__(5188)
  15150. const { isNetworkError } = __nccwpck_require__(9051)
  15151. const { delay } = __nccwpck_require__(4811)
  15152. const { kEnumerableProperty } = __nccwpck_require__(3440)
  15153. const { environmentSettingsObject } = __nccwpck_require__(3168)
  15154. let experimentalWarned = false
  15155. /**
  15156. * A reconnection time, in milliseconds. This must initially be an implementation-defined value,
  15157. * probably in the region of a few seconds.
  15158. *
  15159. * In Comparison:
  15160. * - Chrome uses 3000ms.
  15161. * - Deno uses 5000ms.
  15162. *
  15163. * @type {3000}
  15164. */
  15165. const defaultReconnectionTime = 3000
  15166. /**
  15167. * The readyState attribute represents the state of the connection.
  15168. * @enum
  15169. * @readonly
  15170. * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#dom-eventsource-readystate-dev
  15171. */
  15172. /**
  15173. * The connection has not yet been established, or it was closed and the user
  15174. * agent is reconnecting.
  15175. * @type {0}
  15176. */
  15177. const CONNECTING = 0
  15178. /**
  15179. * The user agent has an open connection and is dispatching events as it
  15180. * receives them.
  15181. * @type {1}
  15182. */
  15183. const OPEN = 1
  15184. /**
  15185. * The connection is not open, and the user agent is not trying to reconnect.
  15186. * @type {2}
  15187. */
  15188. const CLOSED = 2
  15189. /**
  15190. * Requests for the element will have their mode set to "cors" and their credentials mode set to "same-origin".
  15191. * @type {'anonymous'}
  15192. */
  15193. const ANONYMOUS = 'anonymous'
  15194. /**
  15195. * Requests for the element will have their mode set to "cors" and their credentials mode set to "include".
  15196. * @type {'use-credentials'}
  15197. */
  15198. const USE_CREDENTIALS = 'use-credentials'
  15199. /**
  15200. * The EventSource interface is used to receive server-sent events. It
  15201. * connects to a server over HTTP and receives events in text/event-stream
  15202. * format without closing the connection.
  15203. * @extends {EventTarget}
  15204. * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events
  15205. * @api public
  15206. */
  15207. class EventSource extends EventTarget {
  15208. #events = {
  15209. open: null,
  15210. error: null,
  15211. message: null
  15212. }
  15213. #url = null
  15214. #withCredentials = false
  15215. #readyState = CONNECTING
  15216. #request = null
  15217. #controller = null
  15218. #dispatcher
  15219. /**
  15220. * @type {import('./eventsource-stream').eventSourceSettings}
  15221. */
  15222. #state
  15223. /**
  15224. * Creates a new EventSource object.
  15225. * @param {string} url
  15226. * @param {EventSourceInit} [eventSourceInitDict]
  15227. * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#the-eventsource-interface
  15228. */
  15229. constructor (url, eventSourceInitDict = {}) {
  15230. // 1. Let ev be a new EventSource object.
  15231. super()
  15232. webidl.util.markAsUncloneable(this)
  15233. const prefix = 'EventSource constructor'
  15234. webidl.argumentLengthCheck(arguments, 1, prefix)
  15235. if (!experimentalWarned) {
  15236. experimentalWarned = true
  15237. process.emitWarning('EventSource is experimental, expect them to change at any time.', {
  15238. code: 'UNDICI-ES'
  15239. })
  15240. }
  15241. url = webidl.converters.USVString(url, prefix, 'url')
  15242. eventSourceInitDict = webidl.converters.EventSourceInitDict(eventSourceInitDict, prefix, 'eventSourceInitDict')
  15243. this.#dispatcher = eventSourceInitDict.dispatcher
  15244. this.#state = {
  15245. lastEventId: '',
  15246. reconnectionTime: defaultReconnectionTime
  15247. }
  15248. // 2. Let settings be ev's relevant settings object.
  15249. // https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
  15250. const settings = environmentSettingsObject
  15251. let urlRecord
  15252. try {
  15253. // 3. Let urlRecord be the result of encoding-parsing a URL given url, relative to settings.
  15254. urlRecord = new URL(url, settings.settingsObject.baseUrl)
  15255. this.#state.origin = urlRecord.origin
  15256. } catch (e) {
  15257. // 4. If urlRecord is failure, then throw a "SyntaxError" DOMException.
  15258. throw new DOMException(e, 'SyntaxError')
  15259. }
  15260. // 5. Set ev's url to urlRecord.
  15261. this.#url = urlRecord.href
  15262. // 6. Let corsAttributeState be Anonymous.
  15263. let corsAttributeState = ANONYMOUS
  15264. // 7. If the value of eventSourceInitDict's withCredentials member is true,
  15265. // then set corsAttributeState to Use Credentials and set ev's
  15266. // withCredentials attribute to true.
  15267. if (eventSourceInitDict.withCredentials) {
  15268. corsAttributeState = USE_CREDENTIALS
  15269. this.#withCredentials = true
  15270. }
  15271. // 8. Let request be the result of creating a potential-CORS request given
  15272. // urlRecord, the empty string, and corsAttributeState.
  15273. const initRequest = {
  15274. redirect: 'follow',
  15275. keepalive: true,
  15276. // @see https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes
  15277. mode: 'cors',
  15278. credentials: corsAttributeState === 'anonymous'
  15279. ? 'same-origin'
  15280. : 'omit',
  15281. referrer: 'no-referrer'
  15282. }
  15283. // 9. Set request's client to settings.
  15284. initRequest.client = environmentSettingsObject.settingsObject
  15285. // 10. User agents may set (`Accept`, `text/event-stream`) in request's header list.
  15286. initRequest.headersList = [['accept', { name: 'accept', value: 'text/event-stream' }]]
  15287. // 11. Set request's cache mode to "no-store".
  15288. initRequest.cache = 'no-store'
  15289. // 12. Set request's initiator type to "other".
  15290. initRequest.initiator = 'other'
  15291. initRequest.urlList = [new URL(this.#url)]
  15292. // 13. Set ev's request to request.
  15293. this.#request = makeRequest(initRequest)
  15294. this.#connect()
  15295. }
  15296. /**
  15297. * Returns the state of this EventSource object's connection. It can have the
  15298. * values described below.
  15299. * @returns {0|1|2}
  15300. * @readonly
  15301. */
  15302. get readyState () {
  15303. return this.#readyState
  15304. }
  15305. /**
  15306. * Returns the URL providing the event stream.
  15307. * @readonly
  15308. * @returns {string}
  15309. */
  15310. get url () {
  15311. return this.#url
  15312. }
  15313. /**
  15314. * Returns a boolean indicating whether the EventSource object was
  15315. * instantiated with CORS credentials set (true), or not (false, the default).
  15316. */
  15317. get withCredentials () {
  15318. return this.#withCredentials
  15319. }
  15320. #connect () {
  15321. if (this.#readyState === CLOSED) return
  15322. this.#readyState = CONNECTING
  15323. const fetchParams = {
  15324. request: this.#request,
  15325. dispatcher: this.#dispatcher
  15326. }
  15327. // 14. Let processEventSourceEndOfBody given response res be the following step: if res is not a network error, then reestablish the connection.
  15328. const processEventSourceEndOfBody = (response) => {
  15329. if (isNetworkError(response)) {
  15330. this.dispatchEvent(new Event('error'))
  15331. this.close()
  15332. }
  15333. this.#reconnect()
  15334. }
  15335. // 15. Fetch request, with processResponseEndOfBody set to processEventSourceEndOfBody...
  15336. fetchParams.processResponseEndOfBody = processEventSourceEndOfBody
  15337. // and processResponse set to the following steps given response res:
  15338. fetchParams.processResponse = (response) => {
  15339. // 1. If res is an aborted network error, then fail the connection.
  15340. if (isNetworkError(response)) {
  15341. // 1. When a user agent is to fail the connection, the user agent
  15342. // must queue a task which, if the readyState attribute is set to a
  15343. // value other than CLOSED, sets the readyState attribute to CLOSED
  15344. // and fires an event named error at the EventSource object. Once the
  15345. // user agent has failed the connection, it does not attempt to
  15346. // reconnect.
  15347. if (response.aborted) {
  15348. this.close()
  15349. this.dispatchEvent(new Event('error'))
  15350. return
  15351. // 2. Otherwise, if res is a network error, then reestablish the
  15352. // connection, unless the user agent knows that to be futile, in
  15353. // which case the user agent may fail the connection.
  15354. } else {
  15355. this.#reconnect()
  15356. return
  15357. }
  15358. }
  15359. // 3. Otherwise, if res's status is not 200, or if res's `Content-Type`
  15360. // is not `text/event-stream`, then fail the connection.
  15361. const contentType = response.headersList.get('content-type', true)
  15362. const mimeType = contentType !== null ? parseMIMEType(contentType) : 'failure'
  15363. const contentTypeValid = mimeType !== 'failure' && mimeType.essence === 'text/event-stream'
  15364. if (
  15365. response.status !== 200 ||
  15366. contentTypeValid === false
  15367. ) {
  15368. this.close()
  15369. this.dispatchEvent(new Event('error'))
  15370. return
  15371. }
  15372. // 4. Otherwise, announce the connection and interpret res's body
  15373. // line by line.
  15374. // When a user agent is to announce the connection, the user agent
  15375. // must queue a task which, if the readyState attribute is set to a
  15376. // value other than CLOSED, sets the readyState attribute to OPEN
  15377. // and fires an event named open at the EventSource object.
  15378. // @see https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model
  15379. this.#readyState = OPEN
  15380. this.dispatchEvent(new Event('open'))
  15381. // If redirected to a different origin, set the origin to the new origin.
  15382. this.#state.origin = response.urlList[response.urlList.length - 1].origin
  15383. const eventSourceStream = new EventSourceStream({
  15384. eventSourceSettings: this.#state,
  15385. push: (event) => {
  15386. this.dispatchEvent(createFastMessageEvent(
  15387. event.type,
  15388. event.options
  15389. ))
  15390. }
  15391. })
  15392. pipeline(response.body.stream,
  15393. eventSourceStream,
  15394. (error) => {
  15395. if (
  15396. error?.aborted === false
  15397. ) {
  15398. this.close()
  15399. this.dispatchEvent(new Event('error'))
  15400. }
  15401. })
  15402. }
  15403. this.#controller = fetching(fetchParams)
  15404. }
  15405. /**
  15406. * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model
  15407. * @returns {Promise<void>}
  15408. */
  15409. async #reconnect () {
  15410. // When a user agent is to reestablish the connection, the user agent must
  15411. // run the following steps. These steps are run in parallel, not as part of
  15412. // a task. (The tasks that it queues, of course, are run like normal tasks
  15413. // and not themselves in parallel.)
  15414. // 1. Queue a task to run the following steps:
  15415. // 1. If the readyState attribute is set to CLOSED, abort the task.
  15416. if (this.#readyState === CLOSED) return
  15417. // 2. Set the readyState attribute to CONNECTING.
  15418. this.#readyState = CONNECTING
  15419. // 3. Fire an event named error at the EventSource object.
  15420. this.dispatchEvent(new Event('error'))
  15421. // 2. Wait a delay equal to the reconnection time of the event source.
  15422. await delay(this.#state.reconnectionTime)
  15423. // 5. Queue a task to run the following steps:
  15424. // 1. If the EventSource object's readyState attribute is not set to
  15425. // CONNECTING, then return.
  15426. if (this.#readyState !== CONNECTING) return
  15427. // 2. Let request be the EventSource object's request.
  15428. // 3. If the EventSource object's last event ID string is not the empty
  15429. // string, then:
  15430. // 1. Let lastEventIDValue be the EventSource object's last event ID
  15431. // string, encoded as UTF-8.
  15432. // 2. Set (`Last-Event-ID`, lastEventIDValue) in request's header
  15433. // list.
  15434. if (this.#state.lastEventId.length) {
  15435. this.#request.headersList.set('last-event-id', this.#state.lastEventId, true)
  15436. }
  15437. // 4. Fetch request and process the response obtained in this fashion, if any, as described earlier in this section.
  15438. this.#connect()
  15439. }
  15440. /**
  15441. * Closes the connection, if any, and sets the readyState attribute to
  15442. * CLOSED.
  15443. */
  15444. close () {
  15445. webidl.brandCheck(this, EventSource)
  15446. if (this.#readyState === CLOSED) return
  15447. this.#readyState = CLOSED
  15448. this.#controller.abort()
  15449. this.#request = null
  15450. }
  15451. get onopen () {
  15452. return this.#events.open
  15453. }
  15454. set onopen (fn) {
  15455. if (this.#events.open) {
  15456. this.removeEventListener('open', this.#events.open)
  15457. }
  15458. if (typeof fn === 'function') {
  15459. this.#events.open = fn
  15460. this.addEventListener('open', fn)
  15461. } else {
  15462. this.#events.open = null
  15463. }
  15464. }
  15465. get onmessage () {
  15466. return this.#events.message
  15467. }
  15468. set onmessage (fn) {
  15469. if (this.#events.message) {
  15470. this.removeEventListener('message', this.#events.message)
  15471. }
  15472. if (typeof fn === 'function') {
  15473. this.#events.message = fn
  15474. this.addEventListener('message', fn)
  15475. } else {
  15476. this.#events.message = null
  15477. }
  15478. }
  15479. get onerror () {
  15480. return this.#events.error
  15481. }
  15482. set onerror (fn) {
  15483. if (this.#events.error) {
  15484. this.removeEventListener('error', this.#events.error)
  15485. }
  15486. if (typeof fn === 'function') {
  15487. this.#events.error = fn
  15488. this.addEventListener('error', fn)
  15489. } else {
  15490. this.#events.error = null
  15491. }
  15492. }
  15493. }
  15494. const constantsPropertyDescriptors = {
  15495. CONNECTING: {
  15496. __proto__: null,
  15497. configurable: false,
  15498. enumerable: true,
  15499. value: CONNECTING,
  15500. writable: false
  15501. },
  15502. OPEN: {
  15503. __proto__: null,
  15504. configurable: false,
  15505. enumerable: true,
  15506. value: OPEN,
  15507. writable: false
  15508. },
  15509. CLOSED: {
  15510. __proto__: null,
  15511. configurable: false,
  15512. enumerable: true,
  15513. value: CLOSED,
  15514. writable: false
  15515. }
  15516. }
  15517. Object.defineProperties(EventSource, constantsPropertyDescriptors)
  15518. Object.defineProperties(EventSource.prototype, constantsPropertyDescriptors)
  15519. Object.defineProperties(EventSource.prototype, {
  15520. close: kEnumerableProperty,
  15521. onerror: kEnumerableProperty,
  15522. onmessage: kEnumerableProperty,
  15523. onopen: kEnumerableProperty,
  15524. readyState: kEnumerableProperty,
  15525. url: kEnumerableProperty,
  15526. withCredentials: kEnumerableProperty
  15527. })
  15528. webidl.converters.EventSourceInitDict = webidl.dictionaryConverter([
  15529. {
  15530. key: 'withCredentials',
  15531. converter: webidl.converters.boolean,
  15532. defaultValue: () => false
  15533. },
  15534. {
  15535. key: 'dispatcher', // undici only
  15536. converter: webidl.converters.any
  15537. }
  15538. ])
  15539. module.exports = {
  15540. EventSource,
  15541. defaultReconnectionTime
  15542. }
  15543. /***/ }),
  15544. /***/ 4811:
  15545. /***/ ((module) => {
  15546. /**
  15547. * Checks if the given value is a valid LastEventId.
  15548. * @param {string} value
  15549. * @returns {boolean}
  15550. */
  15551. function isValidLastEventId (value) {
  15552. // LastEventId should not contain U+0000 NULL
  15553. return value.indexOf('\u0000') === -1
  15554. }
  15555. /**
  15556. * Checks if the given value is a base 10 digit.
  15557. * @param {string} value
  15558. * @returns {boolean}
  15559. */
  15560. function isASCIINumber (value) {
  15561. if (value.length === 0) return false
  15562. for (let i = 0; i < value.length; i++) {
  15563. if (value.charCodeAt(i) < 0x30 || value.charCodeAt(i) > 0x39) return false
  15564. }
  15565. return true
  15566. }
  15567. // https://github.com/nodejs/undici/issues/2664
  15568. function delay (ms) {
  15569. return new Promise((resolve) => {
  15570. setTimeout(resolve, ms).unref()
  15571. })
  15572. }
  15573. module.exports = {
  15574. isValidLastEventId,
  15575. isASCIINumber,
  15576. delay
  15577. }
  15578. /***/ }),
  15579. /***/ 4492:
  15580. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  15581. const util = __nccwpck_require__(3440)
  15582. const {
  15583. ReadableStreamFrom,
  15584. isBlobLike,
  15585. isReadableStreamLike,
  15586. readableStreamClose,
  15587. createDeferredPromise,
  15588. fullyReadBody,
  15589. extractMimeType,
  15590. utf8DecodeBytes
  15591. } = __nccwpck_require__(3168)
  15592. const { FormData } = __nccwpck_require__(5910)
  15593. const { kState } = __nccwpck_require__(3627)
  15594. const { webidl } = __nccwpck_require__(5893)
  15595. const { Blob } = __nccwpck_require__(4573)
  15596. const assert = __nccwpck_require__(4589)
  15597. const { isErrored, isDisturbed } = __nccwpck_require__(7075)
  15598. const { isArrayBuffer } = __nccwpck_require__(3429)
  15599. const { serializeAMimeType } = __nccwpck_require__(1900)
  15600. const { multipartFormDataParser } = __nccwpck_require__(116)
  15601. let random
  15602. try {
  15603. const crypto = __nccwpck_require__(7598)
  15604. random = (max) => crypto.randomInt(0, max)
  15605. } catch {
  15606. random = (max) => Math.floor(Math.random(max))
  15607. }
  15608. const textEncoder = new TextEncoder()
  15609. function noop () {}
  15610. const hasFinalizationRegistry = globalThis.FinalizationRegistry && process.version.indexOf('v18') !== 0
  15611. let streamRegistry
  15612. if (hasFinalizationRegistry) {
  15613. streamRegistry = new FinalizationRegistry((weakRef) => {
  15614. const stream = weakRef.deref()
  15615. if (stream && !stream.locked && !isDisturbed(stream) && !isErrored(stream)) {
  15616. stream.cancel('Response object has been garbage collected').catch(noop)
  15617. }
  15618. })
  15619. }
  15620. // https://fetch.spec.whatwg.org/#concept-bodyinit-extract
  15621. function extractBody (object, keepalive = false) {
  15622. // 1. Let stream be null.
  15623. let stream = null
  15624. // 2. If object is a ReadableStream object, then set stream to object.
  15625. if (object instanceof ReadableStream) {
  15626. stream = object
  15627. } else if (isBlobLike(object)) {
  15628. // 3. Otherwise, if object is a Blob object, set stream to the
  15629. // result of running object’s get stream.
  15630. stream = object.stream()
  15631. } else {
  15632. // 4. Otherwise, set stream to a new ReadableStream object, and set
  15633. // up stream with byte reading support.
  15634. stream = new ReadableStream({
  15635. async pull (controller) {
  15636. const buffer = typeof source === 'string' ? textEncoder.encode(source) : source
  15637. if (buffer.byteLength) {
  15638. controller.enqueue(buffer)
  15639. }
  15640. queueMicrotask(() => readableStreamClose(controller))
  15641. },
  15642. start () {},
  15643. type: 'bytes'
  15644. })
  15645. }
  15646. // 5. Assert: stream is a ReadableStream object.
  15647. assert(isReadableStreamLike(stream))
  15648. // 6. Let action be null.
  15649. let action = null
  15650. // 7. Let source be null.
  15651. let source = null
  15652. // 8. Let length be null.
  15653. let length = null
  15654. // 9. Let type be null.
  15655. let type = null
  15656. // 10. Switch on object:
  15657. if (typeof object === 'string') {
  15658. // Set source to the UTF-8 encoding of object.
  15659. // Note: setting source to a Uint8Array here breaks some mocking assumptions.
  15660. source = object
  15661. // Set type to `text/plain;charset=UTF-8`.
  15662. type = 'text/plain;charset=UTF-8'
  15663. } else if (object instanceof URLSearchParams) {
  15664. // URLSearchParams
  15665. // spec says to run application/x-www-form-urlencoded on body.list
  15666. // this is implemented in Node.js as apart of an URLSearchParams instance toString method
  15667. // See: https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L490
  15668. // and https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L1100
  15669. // Set source to the result of running the application/x-www-form-urlencoded serializer with object’s list.
  15670. source = object.toString()
  15671. // Set type to `application/x-www-form-urlencoded;charset=UTF-8`.
  15672. type = 'application/x-www-form-urlencoded;charset=UTF-8'
  15673. } else if (isArrayBuffer(object)) {
  15674. // BufferSource/ArrayBuffer
  15675. // Set source to a copy of the bytes held by object.
  15676. source = new Uint8Array(object.slice())
  15677. } else if (ArrayBuffer.isView(object)) {
  15678. // BufferSource/ArrayBufferView
  15679. // Set source to a copy of the bytes held by object.
  15680. source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
  15681. } else if (util.isFormDataLike(object)) {
  15682. const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
  15683. const prefix = `--${boundary}\r\nContent-Disposition: form-data`
  15684. /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
  15685. const escape = (str) =>
  15686. str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22')
  15687. const normalizeLinefeeds = (value) => value.replace(/\r?\n|\r/g, '\r\n')
  15688. // Set action to this step: run the multipart/form-data
  15689. // encoding algorithm, with object’s entry list and UTF-8.
  15690. // - This ensures that the body is immutable and can't be changed afterwords
  15691. // - That the content-length is calculated in advance.
  15692. // - And that all parts are pre-encoded and ready to be sent.
  15693. const blobParts = []
  15694. const rn = new Uint8Array([13, 10]) // '\r\n'
  15695. length = 0
  15696. let hasUnknownSizeValue = false
  15697. for (const [name, value] of object) {
  15698. if (typeof value === 'string') {
  15699. const chunk = textEncoder.encode(prefix +
  15700. `; name="${escape(normalizeLinefeeds(name))}"` +
  15701. `\r\n\r\n${normalizeLinefeeds(value)}\r\n`)
  15702. blobParts.push(chunk)
  15703. length += chunk.byteLength
  15704. } else {
  15705. const chunk = textEncoder.encode(`${prefix}; name="${escape(normalizeLinefeeds(name))}"` +
  15706. (value.name ? `; filename="${escape(value.name)}"` : '') + '\r\n' +
  15707. `Content-Type: ${
  15708. value.type || 'application/octet-stream'
  15709. }\r\n\r\n`)
  15710. blobParts.push(chunk, value, rn)
  15711. if (typeof value.size === 'number') {
  15712. length += chunk.byteLength + value.size + rn.byteLength
  15713. } else {
  15714. hasUnknownSizeValue = true
  15715. }
  15716. }
  15717. }
  15718. // CRLF is appended to the body to function with legacy servers and match other implementations.
  15719. // https://github.com/curl/curl/blob/3434c6b46e682452973972e8313613dfa58cd690/lib/mime.c#L1029-L1030
  15720. // https://github.com/form-data/form-data/issues/63
  15721. const chunk = textEncoder.encode(`--${boundary}--\r\n`)
  15722. blobParts.push(chunk)
  15723. length += chunk.byteLength
  15724. if (hasUnknownSizeValue) {
  15725. length = null
  15726. }
  15727. // Set source to object.
  15728. source = object
  15729. action = async function * () {
  15730. for (const part of blobParts) {
  15731. if (part.stream) {
  15732. yield * part.stream()
  15733. } else {
  15734. yield part
  15735. }
  15736. }
  15737. }
  15738. // Set type to `multipart/form-data; boundary=`,
  15739. // followed by the multipart/form-data boundary string generated
  15740. // by the multipart/form-data encoding algorithm.
  15741. type = `multipart/form-data; boundary=${boundary}`
  15742. } else if (isBlobLike(object)) {
  15743. // Blob
  15744. // Set source to object.
  15745. source = object
  15746. // Set length to object’s size.
  15747. length = object.size
  15748. // If object’s type attribute is not the empty byte sequence, set
  15749. // type to its value.
  15750. if (object.type) {
  15751. type = object.type
  15752. }
  15753. } else if (typeof object[Symbol.asyncIterator] === 'function') {
  15754. // If keepalive is true, then throw a TypeError.
  15755. if (keepalive) {
  15756. throw new TypeError('keepalive')
  15757. }
  15758. // If object is disturbed or locked, then throw a TypeError.
  15759. if (util.isDisturbed(object) || object.locked) {
  15760. throw new TypeError(
  15761. 'Response body object should not be disturbed or locked'
  15762. )
  15763. }
  15764. stream =
  15765. object instanceof ReadableStream ? object : ReadableStreamFrom(object)
  15766. }
  15767. // 11. If source is a byte sequence, then set action to a
  15768. // step that returns source and length to source’s length.
  15769. if (typeof source === 'string' || util.isBuffer(source)) {
  15770. length = Buffer.byteLength(source)
  15771. }
  15772. // 12. If action is non-null, then run these steps in in parallel:
  15773. if (action != null) {
  15774. // Run action.
  15775. let iterator
  15776. stream = new ReadableStream({
  15777. async start () {
  15778. iterator = action(object)[Symbol.asyncIterator]()
  15779. },
  15780. async pull (controller) {
  15781. const { value, done } = await iterator.next()
  15782. if (done) {
  15783. // When running action is done, close stream.
  15784. queueMicrotask(() => {
  15785. controller.close()
  15786. controller.byobRequest?.respond(0)
  15787. })
  15788. } else {
  15789. // Whenever one or more bytes are available and stream is not errored,
  15790. // enqueue a Uint8Array wrapping an ArrayBuffer containing the available
  15791. // bytes into stream.
  15792. if (!isErrored(stream)) {
  15793. const buffer = new Uint8Array(value)
  15794. if (buffer.byteLength) {
  15795. controller.enqueue(buffer)
  15796. }
  15797. }
  15798. }
  15799. return controller.desiredSize > 0
  15800. },
  15801. async cancel (reason) {
  15802. await iterator.return()
  15803. },
  15804. type: 'bytes'
  15805. })
  15806. }
  15807. // 13. Let body be a body whose stream is stream, source is source,
  15808. // and length is length.
  15809. const body = { stream, source, length }
  15810. // 14. Return (body, type).
  15811. return [body, type]
  15812. }
  15813. // https://fetch.spec.whatwg.org/#bodyinit-safely-extract
  15814. function safelyExtractBody (object, keepalive = false) {
  15815. // To safely extract a body and a `Content-Type` value from
  15816. // a byte sequence or BodyInit object object, run these steps:
  15817. // 1. If object is a ReadableStream object, then:
  15818. if (object instanceof ReadableStream) {
  15819. // Assert: object is neither disturbed nor locked.
  15820. // istanbul ignore next
  15821. assert(!util.isDisturbed(object), 'The body has already been consumed.')
  15822. // istanbul ignore next
  15823. assert(!object.locked, 'The stream is locked.')
  15824. }
  15825. // 2. Return the results of extracting object.
  15826. return extractBody(object, keepalive)
  15827. }
  15828. function cloneBody (instance, body) {
  15829. // To clone a body body, run these steps:
  15830. // https://fetch.spec.whatwg.org/#concept-body-clone
  15831. // 1. Let « out1, out2 » be the result of teeing body’s stream.
  15832. const [out1, out2] = body.stream.tee()
  15833. // 2. Set body’s stream to out1.
  15834. body.stream = out1
  15835. // 3. Return a body whose stream is out2 and other members are copied from body.
  15836. return {
  15837. stream: out2,
  15838. length: body.length,
  15839. source: body.source
  15840. }
  15841. }
  15842. function throwIfAborted (state) {
  15843. if (state.aborted) {
  15844. throw new DOMException('The operation was aborted.', 'AbortError')
  15845. }
  15846. }
  15847. function bodyMixinMethods (instance) {
  15848. const methods = {
  15849. blob () {
  15850. // The blob() method steps are to return the result of
  15851. // running consume body with this and the following step
  15852. // given a byte sequence bytes: return a Blob whose
  15853. // contents are bytes and whose type attribute is this’s
  15854. // MIME type.
  15855. return consumeBody(this, (bytes) => {
  15856. let mimeType = bodyMimeType(this)
  15857. if (mimeType === null) {
  15858. mimeType = ''
  15859. } else if (mimeType) {
  15860. mimeType = serializeAMimeType(mimeType)
  15861. }
  15862. // Return a Blob whose contents are bytes and type attribute
  15863. // is mimeType.
  15864. return new Blob([bytes], { type: mimeType })
  15865. }, instance)
  15866. },
  15867. arrayBuffer () {
  15868. // The arrayBuffer() method steps are to return the result
  15869. // of running consume body with this and the following step
  15870. // given a byte sequence bytes: return a new ArrayBuffer
  15871. // whose contents are bytes.
  15872. return consumeBody(this, (bytes) => {
  15873. return new Uint8Array(bytes).buffer
  15874. }, instance)
  15875. },
  15876. text () {
  15877. // The text() method steps are to return the result of running
  15878. // consume body with this and UTF-8 decode.
  15879. return consumeBody(this, utf8DecodeBytes, instance)
  15880. },
  15881. json () {
  15882. // The json() method steps are to return the result of running
  15883. // consume body with this and parse JSON from bytes.
  15884. return consumeBody(this, parseJSONFromBytes, instance)
  15885. },
  15886. formData () {
  15887. // The formData() method steps are to return the result of running
  15888. // consume body with this and the following step given a byte sequence bytes:
  15889. return consumeBody(this, (value) => {
  15890. // 1. Let mimeType be the result of get the MIME type with this.
  15891. const mimeType = bodyMimeType(this)
  15892. // 2. If mimeType is non-null, then switch on mimeType’s essence and run
  15893. // the corresponding steps:
  15894. if (mimeType !== null) {
  15895. switch (mimeType.essence) {
  15896. case 'multipart/form-data': {
  15897. // 1. ... [long step]
  15898. const parsed = multipartFormDataParser(value, mimeType)
  15899. // 2. If that fails for some reason, then throw a TypeError.
  15900. if (parsed === 'failure') {
  15901. throw new TypeError('Failed to parse body as FormData.')
  15902. }
  15903. // 3. Return a new FormData object, appending each entry,
  15904. // resulting from the parsing operation, to its entry list.
  15905. const fd = new FormData()
  15906. fd[kState] = parsed
  15907. return fd
  15908. }
  15909. case 'application/x-www-form-urlencoded': {
  15910. // 1. Let entries be the result of parsing bytes.
  15911. const entries = new URLSearchParams(value.toString())
  15912. // 2. If entries is failure, then throw a TypeError.
  15913. // 3. Return a new FormData object whose entry list is entries.
  15914. const fd = new FormData()
  15915. for (const [name, value] of entries) {
  15916. fd.append(name, value)
  15917. }
  15918. return fd
  15919. }
  15920. }
  15921. }
  15922. // 3. Throw a TypeError.
  15923. throw new TypeError(
  15924. 'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
  15925. )
  15926. }, instance)
  15927. },
  15928. bytes () {
  15929. // The bytes() method steps are to return the result of running consume body
  15930. // with this and the following step given a byte sequence bytes: return the
  15931. // result of creating a Uint8Array from bytes in this’s relevant realm.
  15932. return consumeBody(this, (bytes) => {
  15933. return new Uint8Array(bytes)
  15934. }, instance)
  15935. }
  15936. }
  15937. return methods
  15938. }
  15939. function mixinBody (prototype) {
  15940. Object.assign(prototype.prototype, bodyMixinMethods(prototype))
  15941. }
  15942. /**
  15943. * @see https://fetch.spec.whatwg.org/#concept-body-consume-body
  15944. * @param {Response|Request} object
  15945. * @param {(value: unknown) => unknown} convertBytesToJSValue
  15946. * @param {Response|Request} instance
  15947. */
  15948. async function consumeBody (object, convertBytesToJSValue, instance) {
  15949. webidl.brandCheck(object, instance)
  15950. // 1. If object is unusable, then return a promise rejected
  15951. // with a TypeError.
  15952. if (bodyUnusable(object)) {
  15953. throw new TypeError('Body is unusable: Body has already been read')
  15954. }
  15955. throwIfAborted(object[kState])
  15956. // 2. Let promise be a new promise.
  15957. const promise = createDeferredPromise()
  15958. // 3. Let errorSteps given error be to reject promise with error.
  15959. const errorSteps = (error) => promise.reject(error)
  15960. // 4. Let successSteps given a byte sequence data be to resolve
  15961. // promise with the result of running convertBytesToJSValue
  15962. // with data. If that threw an exception, then run errorSteps
  15963. // with that exception.
  15964. const successSteps = (data) => {
  15965. try {
  15966. promise.resolve(convertBytesToJSValue(data))
  15967. } catch (e) {
  15968. errorSteps(e)
  15969. }
  15970. }
  15971. // 5. If object’s body is null, then run successSteps with an
  15972. // empty byte sequence.
  15973. if (object[kState].body == null) {
  15974. successSteps(Buffer.allocUnsafe(0))
  15975. return promise.promise
  15976. }
  15977. // 6. Otherwise, fully read object’s body given successSteps,
  15978. // errorSteps, and object’s relevant global object.
  15979. await fullyReadBody(object[kState].body, successSteps, errorSteps)
  15980. // 7. Return promise.
  15981. return promise.promise
  15982. }
  15983. // https://fetch.spec.whatwg.org/#body-unusable
  15984. function bodyUnusable (object) {
  15985. const body = object[kState].body
  15986. // An object including the Body interface mixin is
  15987. // said to be unusable if its body is non-null and
  15988. // its body’s stream is disturbed or locked.
  15989. return body != null && (body.stream.locked || util.isDisturbed(body.stream))
  15990. }
  15991. /**
  15992. * @see https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value
  15993. * @param {Uint8Array} bytes
  15994. */
  15995. function parseJSONFromBytes (bytes) {
  15996. return JSON.parse(utf8DecodeBytes(bytes))
  15997. }
  15998. /**
  15999. * @see https://fetch.spec.whatwg.org/#concept-body-mime-type
  16000. * @param {import('./response').Response|import('./request').Request} requestOrResponse
  16001. */
  16002. function bodyMimeType (requestOrResponse) {
  16003. // 1. Let headers be null.
  16004. // 2. If requestOrResponse is a Request object, then set headers to requestOrResponse’s request’s header list.
  16005. // 3. Otherwise, set headers to requestOrResponse’s response’s header list.
  16006. /** @type {import('./headers').HeadersList} */
  16007. const headers = requestOrResponse[kState].headersList
  16008. // 4. Let mimeType be the result of extracting a MIME type from headers.
  16009. const mimeType = extractMimeType(headers)
  16010. // 5. If mimeType is failure, then return null.
  16011. if (mimeType === 'failure') {
  16012. return null
  16013. }
  16014. // 6. Return mimeType.
  16015. return mimeType
  16016. }
  16017. module.exports = {
  16018. extractBody,
  16019. safelyExtractBody,
  16020. cloneBody,
  16021. mixinBody,
  16022. streamRegistry,
  16023. hasFinalizationRegistry,
  16024. bodyUnusable
  16025. }
  16026. /***/ }),
  16027. /***/ 4495:
  16028. /***/ ((module) => {
  16029. const corsSafeListedMethods = /** @type {const} */ (['GET', 'HEAD', 'POST'])
  16030. const corsSafeListedMethodsSet = new Set(corsSafeListedMethods)
  16031. const nullBodyStatus = /** @type {const} */ ([101, 204, 205, 304])
  16032. const redirectStatus = /** @type {const} */ ([301, 302, 303, 307, 308])
  16033. const redirectStatusSet = new Set(redirectStatus)
  16034. /**
  16035. * @see https://fetch.spec.whatwg.org/#block-bad-port
  16036. */
  16037. const badPorts = /** @type {const} */ ([
  16038. '1', '7', '9', '11', '13', '15', '17', '19', '20', '21', '22', '23', '25', '37', '42', '43', '53', '69', '77', '79',
  16039. '87', '95', '101', '102', '103', '104', '109', '110', '111', '113', '115', '117', '119', '123', '135', '137',
  16040. '139', '143', '161', '179', '389', '427', '465', '512', '513', '514', '515', '526', '530', '531', '532',
  16041. '540', '548', '554', '556', '563', '587', '601', '636', '989', '990', '993', '995', '1719', '1720', '1723',
  16042. '2049', '3659', '4045', '4190', '5060', '5061', '6000', '6566', '6665', '6666', '6667', '6668', '6669', '6679',
  16043. '6697', '10080'
  16044. ])
  16045. const badPortsSet = new Set(badPorts)
  16046. /**
  16047. * @see https://w3c.github.io/webappsec-referrer-policy/#referrer-policies
  16048. */
  16049. const referrerPolicy = /** @type {const} */ ([
  16050. '',
  16051. 'no-referrer',
  16052. 'no-referrer-when-downgrade',
  16053. 'same-origin',
  16054. 'origin',
  16055. 'strict-origin',
  16056. 'origin-when-cross-origin',
  16057. 'strict-origin-when-cross-origin',
  16058. 'unsafe-url'
  16059. ])
  16060. const referrerPolicySet = new Set(referrerPolicy)
  16061. const requestRedirect = /** @type {const} */ (['follow', 'manual', 'error'])
  16062. const safeMethods = /** @type {const} */ (['GET', 'HEAD', 'OPTIONS', 'TRACE'])
  16063. const safeMethodsSet = new Set(safeMethods)
  16064. const requestMode = /** @type {const} */ (['navigate', 'same-origin', 'no-cors', 'cors'])
  16065. const requestCredentials = /** @type {const} */ (['omit', 'same-origin', 'include'])
  16066. const requestCache = /** @type {const} */ ([
  16067. 'default',
  16068. 'no-store',
  16069. 'reload',
  16070. 'no-cache',
  16071. 'force-cache',
  16072. 'only-if-cached'
  16073. ])
  16074. /**
  16075. * @see https://fetch.spec.whatwg.org/#request-body-header-name
  16076. */
  16077. const requestBodyHeader = /** @type {const} */ ([
  16078. 'content-encoding',
  16079. 'content-language',
  16080. 'content-location',
  16081. 'content-type',
  16082. // See https://github.com/nodejs/undici/issues/2021
  16083. // 'Content-Length' is a forbidden header name, which is typically
  16084. // removed in the Headers implementation. However, undici doesn't
  16085. // filter out headers, so we add it here.
  16086. 'content-length'
  16087. ])
  16088. /**
  16089. * @see https://fetch.spec.whatwg.org/#enumdef-requestduplex
  16090. */
  16091. const requestDuplex = /** @type {const} */ ([
  16092. 'half'
  16093. ])
  16094. /**
  16095. * @see http://fetch.spec.whatwg.org/#forbidden-method
  16096. */
  16097. const forbiddenMethods = /** @type {const} */ (['CONNECT', 'TRACE', 'TRACK'])
  16098. const forbiddenMethodsSet = new Set(forbiddenMethods)
  16099. const subresource = /** @type {const} */ ([
  16100. 'audio',
  16101. 'audioworklet',
  16102. 'font',
  16103. 'image',
  16104. 'manifest',
  16105. 'paintworklet',
  16106. 'script',
  16107. 'style',
  16108. 'track',
  16109. 'video',
  16110. 'xslt',
  16111. ''
  16112. ])
  16113. const subresourceSet = new Set(subresource)
  16114. module.exports = {
  16115. subresource,
  16116. forbiddenMethods,
  16117. requestBodyHeader,
  16118. referrerPolicy,
  16119. requestRedirect,
  16120. requestMode,
  16121. requestCredentials,
  16122. requestCache,
  16123. redirectStatus,
  16124. corsSafeListedMethods,
  16125. nullBodyStatus,
  16126. safeMethods,
  16127. badPorts,
  16128. requestDuplex,
  16129. subresourceSet,
  16130. badPortsSet,
  16131. redirectStatusSet,
  16132. corsSafeListedMethodsSet,
  16133. safeMethodsSet,
  16134. forbiddenMethodsSet,
  16135. referrerPolicySet
  16136. }
  16137. /***/ }),
  16138. /***/ 1900:
  16139. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16140. const assert = __nccwpck_require__(4589)
  16141. const encoder = new TextEncoder()
  16142. /**
  16143. * @see https://mimesniff.spec.whatwg.org/#http-token-code-point
  16144. */
  16145. const HTTP_TOKEN_CODEPOINTS = /^[!#$%&'*+\-.^_|~A-Za-z0-9]+$/
  16146. const HTTP_WHITESPACE_REGEX = /[\u000A\u000D\u0009\u0020]/ // eslint-disable-line
  16147. const ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g // eslint-disable-line
  16148. /**
  16149. * @see https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point
  16150. */
  16151. const HTTP_QUOTED_STRING_TOKENS = /^[\u0009\u0020-\u007E\u0080-\u00FF]+$/ // eslint-disable-line
  16152. // https://fetch.spec.whatwg.org/#data-url-processor
  16153. /** @param {URL} dataURL */
  16154. function dataURLProcessor (dataURL) {
  16155. // 1. Assert: dataURL’s scheme is "data".
  16156. assert(dataURL.protocol === 'data:')
  16157. // 2. Let input be the result of running the URL
  16158. // serializer on dataURL with exclude fragment
  16159. // set to true.
  16160. let input = URLSerializer(dataURL, true)
  16161. // 3. Remove the leading "data:" string from input.
  16162. input = input.slice(5)
  16163. // 4. Let position point at the start of input.
  16164. const position = { position: 0 }
  16165. // 5. Let mimeType be the result of collecting a
  16166. // sequence of code points that are not equal
  16167. // to U+002C (,), given position.
  16168. let mimeType = collectASequenceOfCodePointsFast(
  16169. ',',
  16170. input,
  16171. position
  16172. )
  16173. // 6. Strip leading and trailing ASCII whitespace
  16174. // from mimeType.
  16175. // Undici implementation note: we need to store the
  16176. // length because if the mimetype has spaces removed,
  16177. // the wrong amount will be sliced from the input in
  16178. // step #9
  16179. const mimeTypeLength = mimeType.length
  16180. mimeType = removeASCIIWhitespace(mimeType, true, true)
  16181. // 7. If position is past the end of input, then
  16182. // return failure
  16183. if (position.position >= input.length) {
  16184. return 'failure'
  16185. }
  16186. // 8. Advance position by 1.
  16187. position.position++
  16188. // 9. Let encodedBody be the remainder of input.
  16189. const encodedBody = input.slice(mimeTypeLength + 1)
  16190. // 10. Let body be the percent-decoding of encodedBody.
  16191. let body = stringPercentDecode(encodedBody)
  16192. // 11. If mimeType ends with U+003B (;), followed by
  16193. // zero or more U+0020 SPACE, followed by an ASCII
  16194. // case-insensitive match for "base64", then:
  16195. if (/;(\u0020){0,}base64$/i.test(mimeType)) {
  16196. // 1. Let stringBody be the isomorphic decode of body.
  16197. const stringBody = isomorphicDecode(body)
  16198. // 2. Set body to the forgiving-base64 decode of
  16199. // stringBody.
  16200. body = forgivingBase64(stringBody)
  16201. // 3. If body is failure, then return failure.
  16202. if (body === 'failure') {
  16203. return 'failure'
  16204. }
  16205. // 4. Remove the last 6 code points from mimeType.
  16206. mimeType = mimeType.slice(0, -6)
  16207. // 5. Remove trailing U+0020 SPACE code points from mimeType,
  16208. // if any.
  16209. mimeType = mimeType.replace(/(\u0020)+$/, '')
  16210. // 6. Remove the last U+003B (;) code point from mimeType.
  16211. mimeType = mimeType.slice(0, -1)
  16212. }
  16213. // 12. If mimeType starts with U+003B (;), then prepend
  16214. // "text/plain" to mimeType.
  16215. if (mimeType.startsWith(';')) {
  16216. mimeType = 'text/plain' + mimeType
  16217. }
  16218. // 13. Let mimeTypeRecord be the result of parsing
  16219. // mimeType.
  16220. let mimeTypeRecord = parseMIMEType(mimeType)
  16221. // 14. If mimeTypeRecord is failure, then set
  16222. // mimeTypeRecord to text/plain;charset=US-ASCII.
  16223. if (mimeTypeRecord === 'failure') {
  16224. mimeTypeRecord = parseMIMEType('text/plain;charset=US-ASCII')
  16225. }
  16226. // 15. Return a new data: URL struct whose MIME
  16227. // type is mimeTypeRecord and body is body.
  16228. // https://fetch.spec.whatwg.org/#data-url-struct
  16229. return { mimeType: mimeTypeRecord, body }
  16230. }
  16231. // https://url.spec.whatwg.org/#concept-url-serializer
  16232. /**
  16233. * @param {URL} url
  16234. * @param {boolean} excludeFragment
  16235. */
  16236. function URLSerializer (url, excludeFragment = false) {
  16237. if (!excludeFragment) {
  16238. return url.href
  16239. }
  16240. const href = url.href
  16241. const hashLength = url.hash.length
  16242. const serialized = hashLength === 0 ? href : href.substring(0, href.length - hashLength)
  16243. if (!hashLength && href.endsWith('#')) {
  16244. return serialized.slice(0, -1)
  16245. }
  16246. return serialized
  16247. }
  16248. // https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points
  16249. /**
  16250. * @param {(char: string) => boolean} condition
  16251. * @param {string} input
  16252. * @param {{ position: number }} position
  16253. */
  16254. function collectASequenceOfCodePoints (condition, input, position) {
  16255. // 1. Let result be the empty string.
  16256. let result = ''
  16257. // 2. While position doesn’t point past the end of input and the
  16258. // code point at position within input meets the condition condition:
  16259. while (position.position < input.length && condition(input[position.position])) {
  16260. // 1. Append that code point to the end of result.
  16261. result += input[position.position]
  16262. // 2. Advance position by 1.
  16263. position.position++
  16264. }
  16265. // 3. Return result.
  16266. return result
  16267. }
  16268. /**
  16269. * A faster collectASequenceOfCodePoints that only works when comparing a single character.
  16270. * @param {string} char
  16271. * @param {string} input
  16272. * @param {{ position: number }} position
  16273. */
  16274. function collectASequenceOfCodePointsFast (char, input, position) {
  16275. const idx = input.indexOf(char, position.position)
  16276. const start = position.position
  16277. if (idx === -1) {
  16278. position.position = input.length
  16279. return input.slice(start)
  16280. }
  16281. position.position = idx
  16282. return input.slice(start, position.position)
  16283. }
  16284. // https://url.spec.whatwg.org/#string-percent-decode
  16285. /** @param {string} input */
  16286. function stringPercentDecode (input) {
  16287. // 1. Let bytes be the UTF-8 encoding of input.
  16288. const bytes = encoder.encode(input)
  16289. // 2. Return the percent-decoding of bytes.
  16290. return percentDecode(bytes)
  16291. }
  16292. /**
  16293. * @param {number} byte
  16294. */
  16295. function isHexCharByte (byte) {
  16296. // 0-9 A-F a-f
  16297. return (byte >= 0x30 && byte <= 0x39) || (byte >= 0x41 && byte <= 0x46) || (byte >= 0x61 && byte <= 0x66)
  16298. }
  16299. /**
  16300. * @param {number} byte
  16301. */
  16302. function hexByteToNumber (byte) {
  16303. return (
  16304. // 0-9
  16305. byte >= 0x30 && byte <= 0x39
  16306. ? (byte - 48)
  16307. // Convert to uppercase
  16308. // ((byte & 0xDF) - 65) + 10
  16309. : ((byte & 0xDF) - 55)
  16310. )
  16311. }
  16312. // https://url.spec.whatwg.org/#percent-decode
  16313. /** @param {Uint8Array} input */
  16314. function percentDecode (input) {
  16315. const length = input.length
  16316. // 1. Let output be an empty byte sequence.
  16317. /** @type {Uint8Array} */
  16318. const output = new Uint8Array(length)
  16319. let j = 0
  16320. // 2. For each byte byte in input:
  16321. for (let i = 0; i < length; ++i) {
  16322. const byte = input[i]
  16323. // 1. If byte is not 0x25 (%), then append byte to output.
  16324. if (byte !== 0x25) {
  16325. output[j++] = byte
  16326. // 2. Otherwise, if byte is 0x25 (%) and the next two bytes
  16327. // after byte in input are not in the ranges
  16328. // 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F),
  16329. // and 0x61 (a) to 0x66 (f), all inclusive, append byte
  16330. // to output.
  16331. } else if (
  16332. byte === 0x25 &&
  16333. !(isHexCharByte(input[i + 1]) && isHexCharByte(input[i + 2]))
  16334. ) {
  16335. output[j++] = 0x25
  16336. // 3. Otherwise:
  16337. } else {
  16338. // 1. Let bytePoint be the two bytes after byte in input,
  16339. // decoded, and then interpreted as hexadecimal number.
  16340. // 2. Append a byte whose value is bytePoint to output.
  16341. output[j++] = (hexByteToNumber(input[i + 1]) << 4) | hexByteToNumber(input[i + 2])
  16342. // 3. Skip the next two bytes in input.
  16343. i += 2
  16344. }
  16345. }
  16346. // 3. Return output.
  16347. return length === j ? output : output.subarray(0, j)
  16348. }
  16349. // https://mimesniff.spec.whatwg.org/#parse-a-mime-type
  16350. /** @param {string} input */
  16351. function parseMIMEType (input) {
  16352. // 1. Remove any leading and trailing HTTP whitespace
  16353. // from input.
  16354. input = removeHTTPWhitespace(input, true, true)
  16355. // 2. Let position be a position variable for input,
  16356. // initially pointing at the start of input.
  16357. const position = { position: 0 }
  16358. // 3. Let type be the result of collecting a sequence
  16359. // of code points that are not U+002F (/) from
  16360. // input, given position.
  16361. const type = collectASequenceOfCodePointsFast(
  16362. '/',
  16363. input,
  16364. position
  16365. )
  16366. // 4. If type is the empty string or does not solely
  16367. // contain HTTP token code points, then return failure.
  16368. // https://mimesniff.spec.whatwg.org/#http-token-code-point
  16369. if (type.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type)) {
  16370. return 'failure'
  16371. }
  16372. // 5. If position is past the end of input, then return
  16373. // failure
  16374. if (position.position > input.length) {
  16375. return 'failure'
  16376. }
  16377. // 6. Advance position by 1. (This skips past U+002F (/).)
  16378. position.position++
  16379. // 7. Let subtype be the result of collecting a sequence of
  16380. // code points that are not U+003B (;) from input, given
  16381. // position.
  16382. let subtype = collectASequenceOfCodePointsFast(
  16383. ';',
  16384. input,
  16385. position
  16386. )
  16387. // 8. Remove any trailing HTTP whitespace from subtype.
  16388. subtype = removeHTTPWhitespace(subtype, false, true)
  16389. // 9. If subtype is the empty string or does not solely
  16390. // contain HTTP token code points, then return failure.
  16391. if (subtype.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(subtype)) {
  16392. return 'failure'
  16393. }
  16394. const typeLowercase = type.toLowerCase()
  16395. const subtypeLowercase = subtype.toLowerCase()
  16396. // 10. Let mimeType be a new MIME type record whose type
  16397. // is type, in ASCII lowercase, and subtype is subtype,
  16398. // in ASCII lowercase.
  16399. // https://mimesniff.spec.whatwg.org/#mime-type
  16400. const mimeType = {
  16401. type: typeLowercase,
  16402. subtype: subtypeLowercase,
  16403. /** @type {Map<string, string>} */
  16404. parameters: new Map(),
  16405. // https://mimesniff.spec.whatwg.org/#mime-type-essence
  16406. essence: `${typeLowercase}/${subtypeLowercase}`
  16407. }
  16408. // 11. While position is not past the end of input:
  16409. while (position.position < input.length) {
  16410. // 1. Advance position by 1. (This skips past U+003B (;).)
  16411. position.position++
  16412. // 2. Collect a sequence of code points that are HTTP
  16413. // whitespace from input given position.
  16414. collectASequenceOfCodePoints(
  16415. // https://fetch.spec.whatwg.org/#http-whitespace
  16416. char => HTTP_WHITESPACE_REGEX.test(char),
  16417. input,
  16418. position
  16419. )
  16420. // 3. Let parameterName be the result of collecting a
  16421. // sequence of code points that are not U+003B (;)
  16422. // or U+003D (=) from input, given position.
  16423. let parameterName = collectASequenceOfCodePoints(
  16424. (char) => char !== ';' && char !== '=',
  16425. input,
  16426. position
  16427. )
  16428. // 4. Set parameterName to parameterName, in ASCII
  16429. // lowercase.
  16430. parameterName = parameterName.toLowerCase()
  16431. // 5. If position is not past the end of input, then:
  16432. if (position.position < input.length) {
  16433. // 1. If the code point at position within input is
  16434. // U+003B (;), then continue.
  16435. if (input[position.position] === ';') {
  16436. continue
  16437. }
  16438. // 2. Advance position by 1. (This skips past U+003D (=).)
  16439. position.position++
  16440. }
  16441. // 6. If position is past the end of input, then break.
  16442. if (position.position > input.length) {
  16443. break
  16444. }
  16445. // 7. Let parameterValue be null.
  16446. let parameterValue = null
  16447. // 8. If the code point at position within input is
  16448. // U+0022 ("), then:
  16449. if (input[position.position] === '"') {
  16450. // 1. Set parameterValue to the result of collecting
  16451. // an HTTP quoted string from input, given position
  16452. // and the extract-value flag.
  16453. parameterValue = collectAnHTTPQuotedString(input, position, true)
  16454. // 2. Collect a sequence of code points that are not
  16455. // U+003B (;) from input, given position.
  16456. collectASequenceOfCodePointsFast(
  16457. ';',
  16458. input,
  16459. position
  16460. )
  16461. // 9. Otherwise:
  16462. } else {
  16463. // 1. Set parameterValue to the result of collecting
  16464. // a sequence of code points that are not U+003B (;)
  16465. // from input, given position.
  16466. parameterValue = collectASequenceOfCodePointsFast(
  16467. ';',
  16468. input,
  16469. position
  16470. )
  16471. // 2. Remove any trailing HTTP whitespace from parameterValue.
  16472. parameterValue = removeHTTPWhitespace(parameterValue, false, true)
  16473. // 3. If parameterValue is the empty string, then continue.
  16474. if (parameterValue.length === 0) {
  16475. continue
  16476. }
  16477. }
  16478. // 10. If all of the following are true
  16479. // - parameterName is not the empty string
  16480. // - parameterName solely contains HTTP token code points
  16481. // - parameterValue solely contains HTTP quoted-string token code points
  16482. // - mimeType’s parameters[parameterName] does not exist
  16483. // then set mimeType’s parameters[parameterName] to parameterValue.
  16484. if (
  16485. parameterName.length !== 0 &&
  16486. HTTP_TOKEN_CODEPOINTS.test(parameterName) &&
  16487. (parameterValue.length === 0 || HTTP_QUOTED_STRING_TOKENS.test(parameterValue)) &&
  16488. !mimeType.parameters.has(parameterName)
  16489. ) {
  16490. mimeType.parameters.set(parameterName, parameterValue)
  16491. }
  16492. }
  16493. // 12. Return mimeType.
  16494. return mimeType
  16495. }
  16496. // https://infra.spec.whatwg.org/#forgiving-base64-decode
  16497. /** @param {string} data */
  16498. function forgivingBase64 (data) {
  16499. // 1. Remove all ASCII whitespace from data.
  16500. data = data.replace(ASCII_WHITESPACE_REPLACE_REGEX, '') // eslint-disable-line
  16501. let dataLength = data.length
  16502. // 2. If data’s code point length divides by 4 leaving
  16503. // no remainder, then:
  16504. if (dataLength % 4 === 0) {
  16505. // 1. If data ends with one or two U+003D (=) code points,
  16506. // then remove them from data.
  16507. if (data.charCodeAt(dataLength - 1) === 0x003D) {
  16508. --dataLength
  16509. if (data.charCodeAt(dataLength - 1) === 0x003D) {
  16510. --dataLength
  16511. }
  16512. }
  16513. }
  16514. // 3. If data’s code point length divides by 4 leaving
  16515. // a remainder of 1, then return failure.
  16516. if (dataLength % 4 === 1) {
  16517. return 'failure'
  16518. }
  16519. // 4. If data contains a code point that is not one of
  16520. // U+002B (+)
  16521. // U+002F (/)
  16522. // ASCII alphanumeric
  16523. // then return failure.
  16524. if (/[^+/0-9A-Za-z]/.test(data.length === dataLength ? data : data.substring(0, dataLength))) {
  16525. return 'failure'
  16526. }
  16527. const buffer = Buffer.from(data, 'base64')
  16528. return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength)
  16529. }
  16530. // https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
  16531. // tests: https://fetch.spec.whatwg.org/#example-http-quoted-string
  16532. /**
  16533. * @param {string} input
  16534. * @param {{ position: number }} position
  16535. * @param {boolean?} extractValue
  16536. */
  16537. function collectAnHTTPQuotedString (input, position, extractValue) {
  16538. // 1. Let positionStart be position.
  16539. const positionStart = position.position
  16540. // 2. Let value be the empty string.
  16541. let value = ''
  16542. // 3. Assert: the code point at position within input
  16543. // is U+0022 (").
  16544. assert(input[position.position] === '"')
  16545. // 4. Advance position by 1.
  16546. position.position++
  16547. // 5. While true:
  16548. while (true) {
  16549. // 1. Append the result of collecting a sequence of code points
  16550. // that are not U+0022 (") or U+005C (\) from input, given
  16551. // position, to value.
  16552. value += collectASequenceOfCodePoints(
  16553. (char) => char !== '"' && char !== '\\',
  16554. input,
  16555. position
  16556. )
  16557. // 2. If position is past the end of input, then break.
  16558. if (position.position >= input.length) {
  16559. break
  16560. }
  16561. // 3. Let quoteOrBackslash be the code point at position within
  16562. // input.
  16563. const quoteOrBackslash = input[position.position]
  16564. // 4. Advance position by 1.
  16565. position.position++
  16566. // 5. If quoteOrBackslash is U+005C (\), then:
  16567. if (quoteOrBackslash === '\\') {
  16568. // 1. If position is past the end of input, then append
  16569. // U+005C (\) to value and break.
  16570. if (position.position >= input.length) {
  16571. value += '\\'
  16572. break
  16573. }
  16574. // 2. Append the code point at position within input to value.
  16575. value += input[position.position]
  16576. // 3. Advance position by 1.
  16577. position.position++
  16578. // 6. Otherwise:
  16579. } else {
  16580. // 1. Assert: quoteOrBackslash is U+0022 (").
  16581. assert(quoteOrBackslash === '"')
  16582. // 2. Break.
  16583. break
  16584. }
  16585. }
  16586. // 6. If the extract-value flag is set, then return value.
  16587. if (extractValue) {
  16588. return value
  16589. }
  16590. // 7. Return the code points from positionStart to position,
  16591. // inclusive, within input.
  16592. return input.slice(positionStart, position.position)
  16593. }
  16594. /**
  16595. * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type
  16596. */
  16597. function serializeAMimeType (mimeType) {
  16598. assert(mimeType !== 'failure')
  16599. const { parameters, essence } = mimeType
  16600. // 1. Let serialization be the concatenation of mimeType’s
  16601. // type, U+002F (/), and mimeType’s subtype.
  16602. let serialization = essence
  16603. // 2. For each name → value of mimeType’s parameters:
  16604. for (let [name, value] of parameters.entries()) {
  16605. // 1. Append U+003B (;) to serialization.
  16606. serialization += ';'
  16607. // 2. Append name to serialization.
  16608. serialization += name
  16609. // 3. Append U+003D (=) to serialization.
  16610. serialization += '='
  16611. // 4. If value does not solely contain HTTP token code
  16612. // points or value is the empty string, then:
  16613. if (!HTTP_TOKEN_CODEPOINTS.test(value)) {
  16614. // 1. Precede each occurrence of U+0022 (") or
  16615. // U+005C (\) in value with U+005C (\).
  16616. value = value.replace(/(\\|")/g, '\\$1')
  16617. // 2. Prepend U+0022 (") to value.
  16618. value = '"' + value
  16619. // 3. Append U+0022 (") to value.
  16620. value += '"'
  16621. }
  16622. // 5. Append value to serialization.
  16623. serialization += value
  16624. }
  16625. // 3. Return serialization.
  16626. return serialization
  16627. }
  16628. /**
  16629. * @see https://fetch.spec.whatwg.org/#http-whitespace
  16630. * @param {number} char
  16631. */
  16632. function isHTTPWhiteSpace (char) {
  16633. // "\r\n\t "
  16634. return char === 0x00d || char === 0x00a || char === 0x009 || char === 0x020
  16635. }
  16636. /**
  16637. * @see https://fetch.spec.whatwg.org/#http-whitespace
  16638. * @param {string} str
  16639. * @param {boolean} [leading=true]
  16640. * @param {boolean} [trailing=true]
  16641. */
  16642. function removeHTTPWhitespace (str, leading = true, trailing = true) {
  16643. return removeChars(str, leading, trailing, isHTTPWhiteSpace)
  16644. }
  16645. /**
  16646. * @see https://infra.spec.whatwg.org/#ascii-whitespace
  16647. * @param {number} char
  16648. */
  16649. function isASCIIWhitespace (char) {
  16650. // "\r\n\t\f "
  16651. return char === 0x00d || char === 0x00a || char === 0x009 || char === 0x00c || char === 0x020
  16652. }
  16653. /**
  16654. * @see https://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace
  16655. * @param {string} str
  16656. * @param {boolean} [leading=true]
  16657. * @param {boolean} [trailing=true]
  16658. */
  16659. function removeASCIIWhitespace (str, leading = true, trailing = true) {
  16660. return removeChars(str, leading, trailing, isASCIIWhitespace)
  16661. }
  16662. /**
  16663. * @param {string} str
  16664. * @param {boolean} leading
  16665. * @param {boolean} trailing
  16666. * @param {(charCode: number) => boolean} predicate
  16667. * @returns
  16668. */
  16669. function removeChars (str, leading, trailing, predicate) {
  16670. let lead = 0
  16671. let trail = str.length - 1
  16672. if (leading) {
  16673. while (lead < str.length && predicate(str.charCodeAt(lead))) lead++
  16674. }
  16675. if (trailing) {
  16676. while (trail > 0 && predicate(str.charCodeAt(trail))) trail--
  16677. }
  16678. return lead === 0 && trail === str.length - 1 ? str : str.slice(lead, trail + 1)
  16679. }
  16680. /**
  16681. * @see https://infra.spec.whatwg.org/#isomorphic-decode
  16682. * @param {Uint8Array} input
  16683. * @returns {string}
  16684. */
  16685. function isomorphicDecode (input) {
  16686. // 1. To isomorphic decode a byte sequence input, return a string whose code point
  16687. // length is equal to input’s length and whose code points have the same values
  16688. // as the values of input’s bytes, in the same order.
  16689. const length = input.length
  16690. if ((2 << 15) - 1 > length) {
  16691. return String.fromCharCode.apply(null, input)
  16692. }
  16693. let result = ''; let i = 0
  16694. let addition = (2 << 15) - 1
  16695. while (i < length) {
  16696. if (i + addition > length) {
  16697. addition = length - i
  16698. }
  16699. result += String.fromCharCode.apply(null, input.subarray(i, i += addition))
  16700. }
  16701. return result
  16702. }
  16703. /**
  16704. * @see https://mimesniff.spec.whatwg.org/#minimize-a-supported-mime-type
  16705. * @param {Exclude<ReturnType<typeof parseMIMEType>, 'failure'>} mimeType
  16706. */
  16707. function minimizeSupportedMimeType (mimeType) {
  16708. switch (mimeType.essence) {
  16709. case 'application/ecmascript':
  16710. case 'application/javascript':
  16711. case 'application/x-ecmascript':
  16712. case 'application/x-javascript':
  16713. case 'text/ecmascript':
  16714. case 'text/javascript':
  16715. case 'text/javascript1.0':
  16716. case 'text/javascript1.1':
  16717. case 'text/javascript1.2':
  16718. case 'text/javascript1.3':
  16719. case 'text/javascript1.4':
  16720. case 'text/javascript1.5':
  16721. case 'text/jscript':
  16722. case 'text/livescript':
  16723. case 'text/x-ecmascript':
  16724. case 'text/x-javascript':
  16725. // 1. If mimeType is a JavaScript MIME type, then return "text/javascript".
  16726. return 'text/javascript'
  16727. case 'application/json':
  16728. case 'text/json':
  16729. // 2. If mimeType is a JSON MIME type, then return "application/json".
  16730. return 'application/json'
  16731. case 'image/svg+xml':
  16732. // 3. If mimeType’s essence is "image/svg+xml", then return "image/svg+xml".
  16733. return 'image/svg+xml'
  16734. case 'text/xml':
  16735. case 'application/xml':
  16736. // 4. If mimeType is an XML MIME type, then return "application/xml".
  16737. return 'application/xml'
  16738. }
  16739. // 2. If mimeType is a JSON MIME type, then return "application/json".
  16740. if (mimeType.subtype.endsWith('+json')) {
  16741. return 'application/json'
  16742. }
  16743. // 4. If mimeType is an XML MIME type, then return "application/xml".
  16744. if (mimeType.subtype.endsWith('+xml')) {
  16745. return 'application/xml'
  16746. }
  16747. // 5. If mimeType is supported by the user agent, then return mimeType’s essence.
  16748. // Technically, node doesn't support any mimetypes.
  16749. // 6. Return the empty string.
  16750. return ''
  16751. }
  16752. module.exports = {
  16753. dataURLProcessor,
  16754. URLSerializer,
  16755. collectASequenceOfCodePoints,
  16756. collectASequenceOfCodePointsFast,
  16757. stringPercentDecode,
  16758. parseMIMEType,
  16759. collectAnHTTPQuotedString,
  16760. serializeAMimeType,
  16761. removeChars,
  16762. removeHTTPWhitespace,
  16763. minimizeSupportedMimeType,
  16764. HTTP_TOKEN_CODEPOINTS,
  16765. isomorphicDecode
  16766. }
  16767. /***/ }),
  16768. /***/ 6653:
  16769. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16770. const { kConnected, kSize } = __nccwpck_require__(6443)
  16771. class CompatWeakRef {
  16772. constructor (value) {
  16773. this.value = value
  16774. }
  16775. deref () {
  16776. return this.value[kConnected] === 0 && this.value[kSize] === 0
  16777. ? undefined
  16778. : this.value
  16779. }
  16780. }
  16781. class CompatFinalizer {
  16782. constructor (finalizer) {
  16783. this.finalizer = finalizer
  16784. }
  16785. register (dispatcher, key) {
  16786. if (dispatcher.on) {
  16787. dispatcher.on('disconnect', () => {
  16788. if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) {
  16789. this.finalizer(key)
  16790. }
  16791. })
  16792. }
  16793. }
  16794. unregister (key) {}
  16795. }
  16796. module.exports = function () {
  16797. // FIXME: remove workaround when the Node bug is backported to v18
  16798. // https://github.com/nodejs/node/issues/49344#issuecomment-1741776308
  16799. if (process.env.NODE_V8_COVERAGE && process.version.startsWith('v18')) {
  16800. process._rawDebug('Using compatibility WeakRef and FinalizationRegistry')
  16801. return {
  16802. WeakRef: CompatWeakRef,
  16803. FinalizationRegistry: CompatFinalizer
  16804. }
  16805. }
  16806. return { WeakRef, FinalizationRegistry }
  16807. }
  16808. /***/ }),
  16809. /***/ 7114:
  16810. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16811. const { Blob, File } = __nccwpck_require__(4573)
  16812. const { kState } = __nccwpck_require__(3627)
  16813. const { webidl } = __nccwpck_require__(5893)
  16814. // TODO(@KhafraDev): remove
  16815. class FileLike {
  16816. constructor (blobLike, fileName, options = {}) {
  16817. // TODO: argument idl type check
  16818. // The File constructor is invoked with two or three parameters, depending
  16819. // on whether the optional dictionary parameter is used. When the File()
  16820. // constructor is invoked, user agents must run the following steps:
  16821. // 1. Let bytes be the result of processing blob parts given fileBits and
  16822. // options.
  16823. // 2. Let n be the fileName argument to the constructor.
  16824. const n = fileName
  16825. // 3. Process FilePropertyBag dictionary argument by running the following
  16826. // substeps:
  16827. // 1. If the type member is provided and is not the empty string, let t
  16828. // be set to the type dictionary member. If t contains any characters
  16829. // outside the range U+0020 to U+007E, then set t to the empty string
  16830. // and return from these substeps.
  16831. // TODO
  16832. const t = options.type
  16833. // 2. Convert every character in t to ASCII lowercase.
  16834. // TODO
  16835. // 3. If the lastModified member is provided, let d be set to the
  16836. // lastModified dictionary member. If it is not provided, set d to the
  16837. // current date and time represented as the number of milliseconds since
  16838. // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]).
  16839. const d = options.lastModified ?? Date.now()
  16840. // 4. Return a new File object F such that:
  16841. // F refers to the bytes byte sequence.
  16842. // F.size is set to the number of total bytes in bytes.
  16843. // F.name is set to n.
  16844. // F.type is set to t.
  16845. // F.lastModified is set to d.
  16846. this[kState] = {
  16847. blobLike,
  16848. name: n,
  16849. type: t,
  16850. lastModified: d
  16851. }
  16852. }
  16853. stream (...args) {
  16854. webidl.brandCheck(this, FileLike)
  16855. return this[kState].blobLike.stream(...args)
  16856. }
  16857. arrayBuffer (...args) {
  16858. webidl.brandCheck(this, FileLike)
  16859. return this[kState].blobLike.arrayBuffer(...args)
  16860. }
  16861. slice (...args) {
  16862. webidl.brandCheck(this, FileLike)
  16863. return this[kState].blobLike.slice(...args)
  16864. }
  16865. text (...args) {
  16866. webidl.brandCheck(this, FileLike)
  16867. return this[kState].blobLike.text(...args)
  16868. }
  16869. get size () {
  16870. webidl.brandCheck(this, FileLike)
  16871. return this[kState].blobLike.size
  16872. }
  16873. get type () {
  16874. webidl.brandCheck(this, FileLike)
  16875. return this[kState].blobLike.type
  16876. }
  16877. get name () {
  16878. webidl.brandCheck(this, FileLike)
  16879. return this[kState].name
  16880. }
  16881. get lastModified () {
  16882. webidl.brandCheck(this, FileLike)
  16883. return this[kState].lastModified
  16884. }
  16885. get [Symbol.toStringTag] () {
  16886. return 'File'
  16887. }
  16888. }
  16889. webidl.converters.Blob = webidl.interfaceConverter(Blob)
  16890. // If this function is moved to ./util.js, some tools (such as
  16891. // rollup) will warn about circular dependencies. See:
  16892. // https://github.com/nodejs/undici/issues/1629
  16893. function isFileLike (object) {
  16894. return (
  16895. (object instanceof File) ||
  16896. (
  16897. object &&
  16898. (typeof object.stream === 'function' ||
  16899. typeof object.arrayBuffer === 'function') &&
  16900. object[Symbol.toStringTag] === 'File'
  16901. )
  16902. )
  16903. }
  16904. module.exports = { FileLike, isFileLike }
  16905. /***/ }),
  16906. /***/ 116:
  16907. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16908. const { isUSVString, bufferToLowerCasedHeaderName } = __nccwpck_require__(3440)
  16909. const { utf8DecodeBytes } = __nccwpck_require__(3168)
  16910. const { HTTP_TOKEN_CODEPOINTS, isomorphicDecode } = __nccwpck_require__(1900)
  16911. const { isFileLike } = __nccwpck_require__(7114)
  16912. const { makeEntry } = __nccwpck_require__(5910)
  16913. const assert = __nccwpck_require__(4589)
  16914. const { File: NodeFile } = __nccwpck_require__(4573)
  16915. const File = globalThis.File ?? NodeFile
  16916. const formDataNameBuffer = Buffer.from('form-data; name="')
  16917. const filenameBuffer = Buffer.from('; filename')
  16918. const dd = Buffer.from('--')
  16919. const ddcrlf = Buffer.from('--\r\n')
  16920. /**
  16921. * @param {string} chars
  16922. */
  16923. function isAsciiString (chars) {
  16924. for (let i = 0; i < chars.length; ++i) {
  16925. if ((chars.charCodeAt(i) & ~0x7F) !== 0) {
  16926. return false
  16927. }
  16928. }
  16929. return true
  16930. }
  16931. /**
  16932. * @see https://andreubotella.github.io/multipart-form-data/#multipart-form-data-boundary
  16933. * @param {string} boundary
  16934. */
  16935. function validateBoundary (boundary) {
  16936. const length = boundary.length
  16937. // - its length is greater or equal to 27 and lesser or equal to 70, and
  16938. if (length < 27 || length > 70) {
  16939. return false
  16940. }
  16941. // - it is composed by bytes in the ranges 0x30 to 0x39, 0x41 to 0x5A, or
  16942. // 0x61 to 0x7A, inclusive (ASCII alphanumeric), or which are 0x27 ('),
  16943. // 0x2D (-) or 0x5F (_).
  16944. for (let i = 0; i < length; ++i) {
  16945. const cp = boundary.charCodeAt(i)
  16946. if (!(
  16947. (cp >= 0x30 && cp <= 0x39) ||
  16948. (cp >= 0x41 && cp <= 0x5a) ||
  16949. (cp >= 0x61 && cp <= 0x7a) ||
  16950. cp === 0x27 ||
  16951. cp === 0x2d ||
  16952. cp === 0x5f
  16953. )) {
  16954. return false
  16955. }
  16956. }
  16957. return true
  16958. }
  16959. /**
  16960. * @see https://andreubotella.github.io/multipart-form-data/#multipart-form-data-parser
  16961. * @param {Buffer} input
  16962. * @param {ReturnType<import('./data-url')['parseMIMEType']>} mimeType
  16963. */
  16964. function multipartFormDataParser (input, mimeType) {
  16965. // 1. Assert: mimeType’s essence is "multipart/form-data".
  16966. assert(mimeType !== 'failure' && mimeType.essence === 'multipart/form-data')
  16967. const boundaryString = mimeType.parameters.get('boundary')
  16968. // 2. If mimeType’s parameters["boundary"] does not exist, return failure.
  16969. // Otherwise, let boundary be the result of UTF-8 decoding mimeType’s
  16970. // parameters["boundary"].
  16971. if (boundaryString === undefined) {
  16972. return 'failure'
  16973. }
  16974. const boundary = Buffer.from(`--${boundaryString}`, 'utf8')
  16975. // 3. Let entry list be an empty entry list.
  16976. const entryList = []
  16977. // 4. Let position be a pointer to a byte in input, initially pointing at
  16978. // the first byte.
  16979. const position = { position: 0 }
  16980. // Note: undici addition, allows leading and trailing CRLFs.
  16981. while (input[position.position] === 0x0d && input[position.position + 1] === 0x0a) {
  16982. position.position += 2
  16983. }
  16984. let trailing = input.length
  16985. while (input[trailing - 1] === 0x0a && input[trailing - 2] === 0x0d) {
  16986. trailing -= 2
  16987. }
  16988. if (trailing !== input.length) {
  16989. input = input.subarray(0, trailing)
  16990. }
  16991. // 5. While true:
  16992. while (true) {
  16993. // 5.1. If position points to a sequence of bytes starting with 0x2D 0x2D
  16994. // (`--`) followed by boundary, advance position by 2 + the length of
  16995. // boundary. Otherwise, return failure.
  16996. // Note: boundary is padded with 2 dashes already, no need to add 2.
  16997. if (input.subarray(position.position, position.position + boundary.length).equals(boundary)) {
  16998. position.position += boundary.length
  16999. } else {
  17000. return 'failure'
  17001. }
  17002. // 5.2. If position points to the sequence of bytes 0x2D 0x2D 0x0D 0x0A
  17003. // (`--` followed by CR LF) followed by the end of input, return entry list.
  17004. // Note: a body does NOT need to end with CRLF. It can end with --.
  17005. if (
  17006. (position.position === input.length - 2 && bufferStartsWith(input, dd, position)) ||
  17007. (position.position === input.length - 4 && bufferStartsWith(input, ddcrlf, position))
  17008. ) {
  17009. return entryList
  17010. }
  17011. // 5.3. If position does not point to a sequence of bytes starting with 0x0D
  17012. // 0x0A (CR LF), return failure.
  17013. if (input[position.position] !== 0x0d || input[position.position + 1] !== 0x0a) {
  17014. return 'failure'
  17015. }
  17016. // 5.4. Advance position by 2. (This skips past the newline.)
  17017. position.position += 2
  17018. // 5.5. Let name, filename and contentType be the result of parsing
  17019. // multipart/form-data headers on input and position, if the result
  17020. // is not failure. Otherwise, return failure.
  17021. const result = parseMultipartFormDataHeaders(input, position)
  17022. if (result === 'failure') {
  17023. return 'failure'
  17024. }
  17025. let { name, filename, contentType, encoding } = result
  17026. // 5.6. Advance position by 2. (This skips past the empty line that marks
  17027. // the end of the headers.)
  17028. position.position += 2
  17029. // 5.7. Let body be the empty byte sequence.
  17030. let body
  17031. // 5.8. Body loop: While position is not past the end of input:
  17032. // TODO: the steps here are completely wrong
  17033. {
  17034. const boundaryIndex = input.indexOf(boundary.subarray(2), position.position)
  17035. if (boundaryIndex === -1) {
  17036. return 'failure'
  17037. }
  17038. body = input.subarray(position.position, boundaryIndex - 4)
  17039. position.position += body.length
  17040. // Note: position must be advanced by the body's length before being
  17041. // decoded, otherwise the parsing will fail.
  17042. if (encoding === 'base64') {
  17043. body = Buffer.from(body.toString(), 'base64')
  17044. }
  17045. }
  17046. // 5.9. If position does not point to a sequence of bytes starting with
  17047. // 0x0D 0x0A (CR LF), return failure. Otherwise, advance position by 2.
  17048. if (input[position.position] !== 0x0d || input[position.position + 1] !== 0x0a) {
  17049. return 'failure'
  17050. } else {
  17051. position.position += 2
  17052. }
  17053. // 5.10. If filename is not null:
  17054. let value
  17055. if (filename !== null) {
  17056. // 5.10.1. If contentType is null, set contentType to "text/plain".
  17057. contentType ??= 'text/plain'
  17058. // 5.10.2. If contentType is not an ASCII string, set contentType to the empty string.
  17059. // Note: `buffer.isAscii` can be used at zero-cost, but converting a string to a buffer is a high overhead.
  17060. // Content-Type is a relatively small string, so it is faster to use `String#charCodeAt`.
  17061. if (!isAsciiString(contentType)) {
  17062. contentType = ''
  17063. }
  17064. // 5.10.3. Let value be a new File object with name filename, type contentType, and body body.
  17065. value = new File([body], filename, { type: contentType })
  17066. } else {
  17067. // 5.11. Otherwise:
  17068. // 5.11.1. Let value be the UTF-8 decoding without BOM of body.
  17069. value = utf8DecodeBytes(Buffer.from(body))
  17070. }
  17071. // 5.12. Assert: name is a scalar value string and value is either a scalar value string or a File object.
  17072. assert(isUSVString(name))
  17073. assert((typeof value === 'string' && isUSVString(value)) || isFileLike(value))
  17074. // 5.13. Create an entry with name and value, and append it to entry list.
  17075. entryList.push(makeEntry(name, value, filename))
  17076. }
  17077. }
  17078. /**
  17079. * @see https://andreubotella.github.io/multipart-form-data/#parse-multipart-form-data-headers
  17080. * @param {Buffer} input
  17081. * @param {{ position: number }} position
  17082. */
  17083. function parseMultipartFormDataHeaders (input, position) {
  17084. // 1. Let name, filename and contentType be null.
  17085. let name = null
  17086. let filename = null
  17087. let contentType = null
  17088. let encoding = null
  17089. // 2. While true:
  17090. while (true) {
  17091. // 2.1. If position points to a sequence of bytes starting with 0x0D 0x0A (CR LF):
  17092. if (input[position.position] === 0x0d && input[position.position + 1] === 0x0a) {
  17093. // 2.1.1. If name is null, return failure.
  17094. if (name === null) {
  17095. return 'failure'
  17096. }
  17097. // 2.1.2. Return name, filename and contentType.
  17098. return { name, filename, contentType, encoding }
  17099. }
  17100. // 2.2. Let header name be the result of collecting a sequence of bytes that are
  17101. // not 0x0A (LF), 0x0D (CR) or 0x3A (:), given position.
  17102. let headerName = collectASequenceOfBytes(
  17103. (char) => char !== 0x0a && char !== 0x0d && char !== 0x3a,
  17104. input,
  17105. position
  17106. )
  17107. // 2.3. Remove any HTTP tab or space bytes from the start or end of header name.
  17108. headerName = removeChars(headerName, true, true, (char) => char === 0x9 || char === 0x20)
  17109. // 2.4. If header name does not match the field-name token production, return failure.
  17110. if (!HTTP_TOKEN_CODEPOINTS.test(headerName.toString())) {
  17111. return 'failure'
  17112. }
  17113. // 2.5. If the byte at position is not 0x3A (:), return failure.
  17114. if (input[position.position] !== 0x3a) {
  17115. return 'failure'
  17116. }
  17117. // 2.6. Advance position by 1.
  17118. position.position++
  17119. // 2.7. Collect a sequence of bytes that are HTTP tab or space bytes given position.
  17120. // (Do nothing with those bytes.)
  17121. collectASequenceOfBytes(
  17122. (char) => char === 0x20 || char === 0x09,
  17123. input,
  17124. position
  17125. )
  17126. // 2.8. Byte-lowercase header name and switch on the result:
  17127. switch (bufferToLowerCasedHeaderName(headerName)) {
  17128. case 'content-disposition': {
  17129. // 1. Set name and filename to null.
  17130. name = filename = null
  17131. // 2. If position does not point to a sequence of bytes starting with
  17132. // `form-data; name="`, return failure.
  17133. if (!bufferStartsWith(input, formDataNameBuffer, position)) {
  17134. return 'failure'
  17135. }
  17136. // 3. Advance position so it points at the byte after the next 0x22 (")
  17137. // byte (the one in the sequence of bytes matched above).
  17138. position.position += 17
  17139. // 4. Set name to the result of parsing a multipart/form-data name given
  17140. // input and position, if the result is not failure. Otherwise, return
  17141. // failure.
  17142. name = parseMultipartFormDataName(input, position)
  17143. if (name === null) {
  17144. return 'failure'
  17145. }
  17146. // 5. If position points to a sequence of bytes starting with `; filename="`:
  17147. if (bufferStartsWith(input, filenameBuffer, position)) {
  17148. // Note: undici also handles filename*
  17149. let check = position.position + filenameBuffer.length
  17150. if (input[check] === 0x2a) {
  17151. position.position += 1
  17152. check += 1
  17153. }
  17154. if (input[check] !== 0x3d || input[check + 1] !== 0x22) { // ="
  17155. return 'failure'
  17156. }
  17157. // 1. Advance position so it points at the byte after the next 0x22 (") byte
  17158. // (the one in the sequence of bytes matched above).
  17159. position.position += 12
  17160. // 2. Set filename to the result of parsing a multipart/form-data name given
  17161. // input and position, if the result is not failure. Otherwise, return failure.
  17162. filename = parseMultipartFormDataName(input, position)
  17163. if (filename === null) {
  17164. return 'failure'
  17165. }
  17166. }
  17167. break
  17168. }
  17169. case 'content-type': {
  17170. // 1. Let header value be the result of collecting a sequence of bytes that are
  17171. // not 0x0A (LF) or 0x0D (CR), given position.
  17172. let headerValue = collectASequenceOfBytes(
  17173. (char) => char !== 0x0a && char !== 0x0d,
  17174. input,
  17175. position
  17176. )
  17177. // 2. Remove any HTTP tab or space bytes from the end of header value.
  17178. headerValue = removeChars(headerValue, false, true, (char) => char === 0x9 || char === 0x20)
  17179. // 3. Set contentType to the isomorphic decoding of header value.
  17180. contentType = isomorphicDecode(headerValue)
  17181. break
  17182. }
  17183. case 'content-transfer-encoding': {
  17184. let headerValue = collectASequenceOfBytes(
  17185. (char) => char !== 0x0a && char !== 0x0d,
  17186. input,
  17187. position
  17188. )
  17189. headerValue = removeChars(headerValue, false, true, (char) => char === 0x9 || char === 0x20)
  17190. encoding = isomorphicDecode(headerValue)
  17191. break
  17192. }
  17193. default: {
  17194. // Collect a sequence of bytes that are not 0x0A (LF) or 0x0D (CR), given position.
  17195. // (Do nothing with those bytes.)
  17196. collectASequenceOfBytes(
  17197. (char) => char !== 0x0a && char !== 0x0d,
  17198. input,
  17199. position
  17200. )
  17201. }
  17202. }
  17203. // 2.9. If position does not point to a sequence of bytes starting with 0x0D 0x0A
  17204. // (CR LF), return failure. Otherwise, advance position by 2 (past the newline).
  17205. if (input[position.position] !== 0x0d && input[position.position + 1] !== 0x0a) {
  17206. return 'failure'
  17207. } else {
  17208. position.position += 2
  17209. }
  17210. }
  17211. }
  17212. /**
  17213. * @see https://andreubotella.github.io/multipart-form-data/#parse-a-multipart-form-data-name
  17214. * @param {Buffer} input
  17215. * @param {{ position: number }} position
  17216. */
  17217. function parseMultipartFormDataName (input, position) {
  17218. // 1. Assert: The byte at (position - 1) is 0x22 (").
  17219. assert(input[position.position - 1] === 0x22)
  17220. // 2. Let name be the result of collecting a sequence of bytes that are not 0x0A (LF), 0x0D (CR) or 0x22 ("), given position.
  17221. /** @type {string | Buffer} */
  17222. let name = collectASequenceOfBytes(
  17223. (char) => char !== 0x0a && char !== 0x0d && char !== 0x22,
  17224. input,
  17225. position
  17226. )
  17227. // 3. If the byte at position is not 0x22 ("), return failure. Otherwise, advance position by 1.
  17228. if (input[position.position] !== 0x22) {
  17229. return null // name could be 'failure'
  17230. } else {
  17231. position.position++
  17232. }
  17233. // 4. Replace any occurrence of the following subsequences in name with the given byte:
  17234. // - `%0A`: 0x0A (LF)
  17235. // - `%0D`: 0x0D (CR)
  17236. // - `%22`: 0x22 (")
  17237. name = new TextDecoder().decode(name)
  17238. .replace(/%0A/ig, '\n')
  17239. .replace(/%0D/ig, '\r')
  17240. .replace(/%22/g, '"')
  17241. // 5. Return the UTF-8 decoding without BOM of name.
  17242. return name
  17243. }
  17244. /**
  17245. * @param {(char: number) => boolean} condition
  17246. * @param {Buffer} input
  17247. * @param {{ position: number }} position
  17248. */
  17249. function collectASequenceOfBytes (condition, input, position) {
  17250. let start = position.position
  17251. while (start < input.length && condition(input[start])) {
  17252. ++start
  17253. }
  17254. return input.subarray(position.position, (position.position = start))
  17255. }
  17256. /**
  17257. * @param {Buffer} buf
  17258. * @param {boolean} leading
  17259. * @param {boolean} trailing
  17260. * @param {(charCode: number) => boolean} predicate
  17261. * @returns {Buffer}
  17262. */
  17263. function removeChars (buf, leading, trailing, predicate) {
  17264. let lead = 0
  17265. let trail = buf.length - 1
  17266. if (leading) {
  17267. while (lead < buf.length && predicate(buf[lead])) lead++
  17268. }
  17269. if (trailing) {
  17270. while (trail > 0 && predicate(buf[trail])) trail--
  17271. }
  17272. return lead === 0 && trail === buf.length - 1 ? buf : buf.subarray(lead, trail + 1)
  17273. }
  17274. /**
  17275. * Checks if {@param buffer} starts with {@param start}
  17276. * @param {Buffer} buffer
  17277. * @param {Buffer} start
  17278. * @param {{ position: number }} position
  17279. */
  17280. function bufferStartsWith (buffer, start, position) {
  17281. if (buffer.length < start.length) {
  17282. return false
  17283. }
  17284. for (let i = 0; i < start.length; i++) {
  17285. if (start[i] !== buffer[position.position + i]) {
  17286. return false
  17287. }
  17288. }
  17289. return true
  17290. }
  17291. module.exports = {
  17292. multipartFormDataParser,
  17293. validateBoundary
  17294. }
  17295. /***/ }),
  17296. /***/ 5910:
  17297. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  17298. const { isBlobLike, iteratorMixin } = __nccwpck_require__(3168)
  17299. const { kState } = __nccwpck_require__(3627)
  17300. const { kEnumerableProperty } = __nccwpck_require__(3440)
  17301. const { FileLike, isFileLike } = __nccwpck_require__(7114)
  17302. const { webidl } = __nccwpck_require__(5893)
  17303. const { File: NativeFile } = __nccwpck_require__(4573)
  17304. const nodeUtil = __nccwpck_require__(7975)
  17305. /** @type {globalThis['File']} */
  17306. const File = globalThis.File ?? NativeFile
  17307. // https://xhr.spec.whatwg.org/#formdata
  17308. class FormData {
  17309. constructor (form) {
  17310. webidl.util.markAsUncloneable(this)
  17311. if (form !== undefined) {
  17312. throw webidl.errors.conversionFailed({
  17313. prefix: 'FormData constructor',
  17314. argument: 'Argument 1',
  17315. types: ['undefined']
  17316. })
  17317. }
  17318. this[kState] = []
  17319. }
  17320. append (name, value, filename = undefined) {
  17321. webidl.brandCheck(this, FormData)
  17322. const prefix = 'FormData.append'
  17323. webidl.argumentLengthCheck(arguments, 2, prefix)
  17324. if (arguments.length === 3 && !isBlobLike(value)) {
  17325. throw new TypeError(
  17326. "Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'"
  17327. )
  17328. }
  17329. // 1. Let value be value if given; otherwise blobValue.
  17330. name = webidl.converters.USVString(name, prefix, 'name')
  17331. value = isBlobLike(value)
  17332. ? webidl.converters.Blob(value, prefix, 'value', { strict: false })
  17333. : webidl.converters.USVString(value, prefix, 'value')
  17334. filename = arguments.length === 3
  17335. ? webidl.converters.USVString(filename, prefix, 'filename')
  17336. : undefined
  17337. // 2. Let entry be the result of creating an entry with
  17338. // name, value, and filename if given.
  17339. const entry = makeEntry(name, value, filename)
  17340. // 3. Append entry to this’s entry list.
  17341. this[kState].push(entry)
  17342. }
  17343. delete (name) {
  17344. webidl.brandCheck(this, FormData)
  17345. const prefix = 'FormData.delete'
  17346. webidl.argumentLengthCheck(arguments, 1, prefix)
  17347. name = webidl.converters.USVString(name, prefix, 'name')
  17348. // The delete(name) method steps are to remove all entries whose name
  17349. // is name from this’s entry list.
  17350. this[kState] = this[kState].filter(entry => entry.name !== name)
  17351. }
  17352. get (name) {
  17353. webidl.brandCheck(this, FormData)
  17354. const prefix = 'FormData.get'
  17355. webidl.argumentLengthCheck(arguments, 1, prefix)
  17356. name = webidl.converters.USVString(name, prefix, 'name')
  17357. // 1. If there is no entry whose name is name in this’s entry list,
  17358. // then return null.
  17359. const idx = this[kState].findIndex((entry) => entry.name === name)
  17360. if (idx === -1) {
  17361. return null
  17362. }
  17363. // 2. Return the value of the first entry whose name is name from
  17364. // this’s entry list.
  17365. return this[kState][idx].value
  17366. }
  17367. getAll (name) {
  17368. webidl.brandCheck(this, FormData)
  17369. const prefix = 'FormData.getAll'
  17370. webidl.argumentLengthCheck(arguments, 1, prefix)
  17371. name = webidl.converters.USVString(name, prefix, 'name')
  17372. // 1. If there is no entry whose name is name in this’s entry list,
  17373. // then return the empty list.
  17374. // 2. Return the values of all entries whose name is name, in order,
  17375. // from this’s entry list.
  17376. return this[kState]
  17377. .filter((entry) => entry.name === name)
  17378. .map((entry) => entry.value)
  17379. }
  17380. has (name) {
  17381. webidl.brandCheck(this, FormData)
  17382. const prefix = 'FormData.has'
  17383. webidl.argumentLengthCheck(arguments, 1, prefix)
  17384. name = webidl.converters.USVString(name, prefix, 'name')
  17385. // The has(name) method steps are to return true if there is an entry
  17386. // whose name is name in this’s entry list; otherwise false.
  17387. return this[kState].findIndex((entry) => entry.name === name) !== -1
  17388. }
  17389. set (name, value, filename = undefined) {
  17390. webidl.brandCheck(this, FormData)
  17391. const prefix = 'FormData.set'
  17392. webidl.argumentLengthCheck(arguments, 2, prefix)
  17393. if (arguments.length === 3 && !isBlobLike(value)) {
  17394. throw new TypeError(
  17395. "Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'"
  17396. )
  17397. }
  17398. // The set(name, value) and set(name, blobValue, filename) method steps
  17399. // are:
  17400. // 1. Let value be value if given; otherwise blobValue.
  17401. name = webidl.converters.USVString(name, prefix, 'name')
  17402. value = isBlobLike(value)
  17403. ? webidl.converters.Blob(value, prefix, 'name', { strict: false })
  17404. : webidl.converters.USVString(value, prefix, 'name')
  17405. filename = arguments.length === 3
  17406. ? webidl.converters.USVString(filename, prefix, 'name')
  17407. : undefined
  17408. // 2. Let entry be the result of creating an entry with name, value, and
  17409. // filename if given.
  17410. const entry = makeEntry(name, value, filename)
  17411. // 3. If there are entries in this’s entry list whose name is name, then
  17412. // replace the first such entry with entry and remove the others.
  17413. const idx = this[kState].findIndex((entry) => entry.name === name)
  17414. if (idx !== -1) {
  17415. this[kState] = [
  17416. ...this[kState].slice(0, idx),
  17417. entry,
  17418. ...this[kState].slice(idx + 1).filter((entry) => entry.name !== name)
  17419. ]
  17420. } else {
  17421. // 4. Otherwise, append entry to this’s entry list.
  17422. this[kState].push(entry)
  17423. }
  17424. }
  17425. [nodeUtil.inspect.custom] (depth, options) {
  17426. const state = this[kState].reduce((a, b) => {
  17427. if (a[b.name]) {
  17428. if (Array.isArray(a[b.name])) {
  17429. a[b.name].push(b.value)
  17430. } else {
  17431. a[b.name] = [a[b.name], b.value]
  17432. }
  17433. } else {
  17434. a[b.name] = b.value
  17435. }
  17436. return a
  17437. }, { __proto__: null })
  17438. options.depth ??= depth
  17439. options.colors ??= true
  17440. const output = nodeUtil.formatWithOptions(options, state)
  17441. // remove [Object null prototype]
  17442. return `FormData ${output.slice(output.indexOf(']') + 2)}`
  17443. }
  17444. }
  17445. iteratorMixin('FormData', FormData, kState, 'name', 'value')
  17446. Object.defineProperties(FormData.prototype, {
  17447. append: kEnumerableProperty,
  17448. delete: kEnumerableProperty,
  17449. get: kEnumerableProperty,
  17450. getAll: kEnumerableProperty,
  17451. has: kEnumerableProperty,
  17452. set: kEnumerableProperty,
  17453. [Symbol.toStringTag]: {
  17454. value: 'FormData',
  17455. configurable: true
  17456. }
  17457. })
  17458. /**
  17459. * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#create-an-entry
  17460. * @param {string} name
  17461. * @param {string|Blob} value
  17462. * @param {?string} filename
  17463. * @returns
  17464. */
  17465. function makeEntry (name, value, filename) {
  17466. // 1. Set name to the result of converting name into a scalar value string.
  17467. // Note: This operation was done by the webidl converter USVString.
  17468. // 2. If value is a string, then set value to the result of converting
  17469. // value into a scalar value string.
  17470. if (typeof value === 'string') {
  17471. // Note: This operation was done by the webidl converter USVString.
  17472. } else {
  17473. // 3. Otherwise:
  17474. // 1. If value is not a File object, then set value to a new File object,
  17475. // representing the same bytes, whose name attribute value is "blob"
  17476. if (!isFileLike(value)) {
  17477. value = value instanceof Blob
  17478. ? new File([value], 'blob', { type: value.type })
  17479. : new FileLike(value, 'blob', { type: value.type })
  17480. }
  17481. // 2. If filename is given, then set value to a new File object,
  17482. // representing the same bytes, whose name attribute is filename.
  17483. if (filename !== undefined) {
  17484. /** @type {FilePropertyBag} */
  17485. const options = {
  17486. type: value.type,
  17487. lastModified: value.lastModified
  17488. }
  17489. value = value instanceof NativeFile
  17490. ? new File([value], filename, options)
  17491. : new FileLike(value, filename, options)
  17492. }
  17493. }
  17494. // 4. Return an entry whose name is name and whose value is value.
  17495. return { name, value }
  17496. }
  17497. module.exports = { FormData, makeEntry }
  17498. /***/ }),
  17499. /***/ 1059:
  17500. /***/ ((module) => {
  17501. // In case of breaking changes, increase the version
  17502. // number to avoid conflicts.
  17503. const globalOrigin = Symbol.for('undici.globalOrigin.1')
  17504. function getGlobalOrigin () {
  17505. return globalThis[globalOrigin]
  17506. }
  17507. function setGlobalOrigin (newOrigin) {
  17508. if (newOrigin === undefined) {
  17509. Object.defineProperty(globalThis, globalOrigin, {
  17510. value: undefined,
  17511. writable: true,
  17512. enumerable: false,
  17513. configurable: false
  17514. })
  17515. return
  17516. }
  17517. const parsedURL = new URL(newOrigin)
  17518. if (parsedURL.protocol !== 'http:' && parsedURL.protocol !== 'https:') {
  17519. throw new TypeError(`Only http & https urls are allowed, received ${parsedURL.protocol}`)
  17520. }
  17521. Object.defineProperty(globalThis, globalOrigin, {
  17522. value: parsedURL,
  17523. writable: true,
  17524. enumerable: false,
  17525. configurable: false
  17526. })
  17527. }
  17528. module.exports = {
  17529. getGlobalOrigin,
  17530. setGlobalOrigin
  17531. }
  17532. /***/ }),
  17533. /***/ 660:
  17534. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  17535. // https://github.com/Ethan-Arrowood/undici-fetch
  17536. const { kConstruct } = __nccwpck_require__(6443)
  17537. const { kEnumerableProperty } = __nccwpck_require__(3440)
  17538. const {
  17539. iteratorMixin,
  17540. isValidHeaderName,
  17541. isValidHeaderValue
  17542. } = __nccwpck_require__(3168)
  17543. const { webidl } = __nccwpck_require__(5893)
  17544. const assert = __nccwpck_require__(4589)
  17545. const util = __nccwpck_require__(7975)
  17546. const kHeadersMap = Symbol('headers map')
  17547. const kHeadersSortedMap = Symbol('headers map sorted')
  17548. /**
  17549. * @param {number} code
  17550. */
  17551. function isHTTPWhiteSpaceCharCode (code) {
  17552. return code === 0x00a || code === 0x00d || code === 0x009 || code === 0x020
  17553. }
  17554. /**
  17555. * @see https://fetch.spec.whatwg.org/#concept-header-value-normalize
  17556. * @param {string} potentialValue
  17557. */
  17558. function headerValueNormalize (potentialValue) {
  17559. // To normalize a byte sequence potentialValue, remove
  17560. // any leading and trailing HTTP whitespace bytes from
  17561. // potentialValue.
  17562. let i = 0; let j = potentialValue.length
  17563. while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(j - 1))) --j
  17564. while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(i))) ++i
  17565. return i === 0 && j === potentialValue.length ? potentialValue : potentialValue.substring(i, j)
  17566. }
  17567. function fill (headers, object) {
  17568. // To fill a Headers object headers with a given object object, run these steps:
  17569. // 1. If object is a sequence, then for each header in object:
  17570. // Note: webidl conversion to array has already been done.
  17571. if (Array.isArray(object)) {
  17572. for (let i = 0; i < object.length; ++i) {
  17573. const header = object[i]
  17574. // 1. If header does not contain exactly two items, then throw a TypeError.
  17575. if (header.length !== 2) {
  17576. throw webidl.errors.exception({
  17577. header: 'Headers constructor',
  17578. message: `expected name/value pair to be length 2, found ${header.length}.`
  17579. })
  17580. }
  17581. // 2. Append (header’s first item, header’s second item) to headers.
  17582. appendHeader(headers, header[0], header[1])
  17583. }
  17584. } else if (typeof object === 'object' && object !== null) {
  17585. // Note: null should throw
  17586. // 2. Otherwise, object is a record, then for each key → value in object,
  17587. // append (key, value) to headers
  17588. const keys = Object.keys(object)
  17589. for (let i = 0; i < keys.length; ++i) {
  17590. appendHeader(headers, keys[i], object[keys[i]])
  17591. }
  17592. } else {
  17593. throw webidl.errors.conversionFailed({
  17594. prefix: 'Headers constructor',
  17595. argument: 'Argument 1',
  17596. types: ['sequence<sequence<ByteString>>', 'record<ByteString, ByteString>']
  17597. })
  17598. }
  17599. }
  17600. /**
  17601. * @see https://fetch.spec.whatwg.org/#concept-headers-append
  17602. */
  17603. function appendHeader (headers, name, value) {
  17604. // 1. Normalize value.
  17605. value = headerValueNormalize(value)
  17606. // 2. If name is not a header name or value is not a
  17607. // header value, then throw a TypeError.
  17608. if (!isValidHeaderName(name)) {
  17609. throw webidl.errors.invalidArgument({
  17610. prefix: 'Headers.append',
  17611. value: name,
  17612. type: 'header name'
  17613. })
  17614. } else if (!isValidHeaderValue(value)) {
  17615. throw webidl.errors.invalidArgument({
  17616. prefix: 'Headers.append',
  17617. value,
  17618. type: 'header value'
  17619. })
  17620. }
  17621. // 3. If headers’s guard is "immutable", then throw a TypeError.
  17622. // 4. Otherwise, if headers’s guard is "request" and name is a
  17623. // forbidden header name, return.
  17624. // 5. Otherwise, if headers’s guard is "request-no-cors":
  17625. // TODO
  17626. // Note: undici does not implement forbidden header names
  17627. if (getHeadersGuard(headers) === 'immutable') {
  17628. throw new TypeError('immutable')
  17629. }
  17630. // 6. Otherwise, if headers’s guard is "response" and name is a
  17631. // forbidden response-header name, return.
  17632. // 7. Append (name, value) to headers’s header list.
  17633. return getHeadersList(headers).append(name, value, false)
  17634. // 8. If headers’s guard is "request-no-cors", then remove
  17635. // privileged no-CORS request headers from headers
  17636. }
  17637. function compareHeaderName (a, b) {
  17638. return a[0] < b[0] ? -1 : 1
  17639. }
  17640. class HeadersList {
  17641. /** @type {[string, string][]|null} */
  17642. cookies = null
  17643. constructor (init) {
  17644. if (init instanceof HeadersList) {
  17645. this[kHeadersMap] = new Map(init[kHeadersMap])
  17646. this[kHeadersSortedMap] = init[kHeadersSortedMap]
  17647. this.cookies = init.cookies === null ? null : [...init.cookies]
  17648. } else {
  17649. this[kHeadersMap] = new Map(init)
  17650. this[kHeadersSortedMap] = null
  17651. }
  17652. }
  17653. /**
  17654. * @see https://fetch.spec.whatwg.org/#header-list-contains
  17655. * @param {string} name
  17656. * @param {boolean} isLowerCase
  17657. */
  17658. contains (name, isLowerCase) {
  17659. // A header list list contains a header name name if list
  17660. // contains a header whose name is a byte-case-insensitive
  17661. // match for name.
  17662. return this[kHeadersMap].has(isLowerCase ? name : name.toLowerCase())
  17663. }
  17664. clear () {
  17665. this[kHeadersMap].clear()
  17666. this[kHeadersSortedMap] = null
  17667. this.cookies = null
  17668. }
  17669. /**
  17670. * @see https://fetch.spec.whatwg.org/#concept-header-list-append
  17671. * @param {string} name
  17672. * @param {string} value
  17673. * @param {boolean} isLowerCase
  17674. */
  17675. append (name, value, isLowerCase) {
  17676. this[kHeadersSortedMap] = null
  17677. // 1. If list contains name, then set name to the first such
  17678. // header’s name.
  17679. const lowercaseName = isLowerCase ? name : name.toLowerCase()
  17680. const exists = this[kHeadersMap].get(lowercaseName)
  17681. // 2. Append (name, value) to list.
  17682. if (exists) {
  17683. const delimiter = lowercaseName === 'cookie' ? '; ' : ', '
  17684. this[kHeadersMap].set(lowercaseName, {
  17685. name: exists.name,
  17686. value: `${exists.value}${delimiter}${value}`
  17687. })
  17688. } else {
  17689. this[kHeadersMap].set(lowercaseName, { name, value })
  17690. }
  17691. if (lowercaseName === 'set-cookie') {
  17692. (this.cookies ??= []).push(value)
  17693. }
  17694. }
  17695. /**
  17696. * @see https://fetch.spec.whatwg.org/#concept-header-list-set
  17697. * @param {string} name
  17698. * @param {string} value
  17699. * @param {boolean} isLowerCase
  17700. */
  17701. set (name, value, isLowerCase) {
  17702. this[kHeadersSortedMap] = null
  17703. const lowercaseName = isLowerCase ? name : name.toLowerCase()
  17704. if (lowercaseName === 'set-cookie') {
  17705. this.cookies = [value]
  17706. }
  17707. // 1. If list contains name, then set the value of
  17708. // the first such header to value and remove the
  17709. // others.
  17710. // 2. Otherwise, append header (name, value) to list.
  17711. this[kHeadersMap].set(lowercaseName, { name, value })
  17712. }
  17713. /**
  17714. * @see https://fetch.spec.whatwg.org/#concept-header-list-delete
  17715. * @param {string} name
  17716. * @param {boolean} isLowerCase
  17717. */
  17718. delete (name, isLowerCase) {
  17719. this[kHeadersSortedMap] = null
  17720. if (!isLowerCase) name = name.toLowerCase()
  17721. if (name === 'set-cookie') {
  17722. this.cookies = null
  17723. }
  17724. this[kHeadersMap].delete(name)
  17725. }
  17726. /**
  17727. * @see https://fetch.spec.whatwg.org/#concept-header-list-get
  17728. * @param {string} name
  17729. * @param {boolean} isLowerCase
  17730. * @returns {string | null}
  17731. */
  17732. get (name, isLowerCase) {
  17733. // 1. If list does not contain name, then return null.
  17734. // 2. Return the values of all headers in list whose name
  17735. // is a byte-case-insensitive match for name,
  17736. // separated from each other by 0x2C 0x20, in order.
  17737. return this[kHeadersMap].get(isLowerCase ? name : name.toLowerCase())?.value ?? null
  17738. }
  17739. * [Symbol.iterator] () {
  17740. // use the lowercased name
  17741. for (const { 0: name, 1: { value } } of this[kHeadersMap]) {
  17742. yield [name, value]
  17743. }
  17744. }
  17745. get entries () {
  17746. const headers = {}
  17747. if (this[kHeadersMap].size !== 0) {
  17748. for (const { name, value } of this[kHeadersMap].values()) {
  17749. headers[name] = value
  17750. }
  17751. }
  17752. return headers
  17753. }
  17754. rawValues () {
  17755. return this[kHeadersMap].values()
  17756. }
  17757. get entriesList () {
  17758. const headers = []
  17759. if (this[kHeadersMap].size !== 0) {
  17760. for (const { 0: lowerName, 1: { name, value } } of this[kHeadersMap]) {
  17761. if (lowerName === 'set-cookie') {
  17762. for (const cookie of this.cookies) {
  17763. headers.push([name, cookie])
  17764. }
  17765. } else {
  17766. headers.push([name, value])
  17767. }
  17768. }
  17769. }
  17770. return headers
  17771. }
  17772. // https://fetch.spec.whatwg.org/#convert-header-names-to-a-sorted-lowercase-set
  17773. toSortedArray () {
  17774. const size = this[kHeadersMap].size
  17775. const array = new Array(size)
  17776. // In most cases, you will use the fast-path.
  17777. // fast-path: Use binary insertion sort for small arrays.
  17778. if (size <= 32) {
  17779. if (size === 0) {
  17780. // If empty, it is an empty array. To avoid the first index assignment.
  17781. return array
  17782. }
  17783. // Improve performance by unrolling loop and avoiding double-loop.
  17784. // Double-loop-less version of the binary insertion sort.
  17785. const iterator = this[kHeadersMap][Symbol.iterator]()
  17786. const firstValue = iterator.next().value
  17787. // set [name, value] to first index.
  17788. array[0] = [firstValue[0], firstValue[1].value]
  17789. // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
  17790. // 3.2.2. Assert: value is non-null.
  17791. assert(firstValue[1].value !== null)
  17792. for (
  17793. let i = 1, j = 0, right = 0, left = 0, pivot = 0, x, value;
  17794. i < size;
  17795. ++i
  17796. ) {
  17797. // get next value
  17798. value = iterator.next().value
  17799. // set [name, value] to current index.
  17800. x = array[i] = [value[0], value[1].value]
  17801. // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
  17802. // 3.2.2. Assert: value is non-null.
  17803. assert(x[1] !== null)
  17804. left = 0
  17805. right = i
  17806. // binary search
  17807. while (left < right) {
  17808. // middle index
  17809. pivot = left + ((right - left) >> 1)
  17810. // compare header name
  17811. if (array[pivot][0] <= x[0]) {
  17812. left = pivot + 1
  17813. } else {
  17814. right = pivot
  17815. }
  17816. }
  17817. if (i !== pivot) {
  17818. j = i
  17819. while (j > left) {
  17820. array[j] = array[--j]
  17821. }
  17822. array[left] = x
  17823. }
  17824. }
  17825. /* c8 ignore next 4 */
  17826. if (!iterator.next().done) {
  17827. // This is for debugging and will never be called.
  17828. throw new TypeError('Unreachable')
  17829. }
  17830. return array
  17831. } else {
  17832. // This case would be a rare occurrence.
  17833. // slow-path: fallback
  17834. let i = 0
  17835. for (const { 0: name, 1: { value } } of this[kHeadersMap]) {
  17836. array[i++] = [name, value]
  17837. // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
  17838. // 3.2.2. Assert: value is non-null.
  17839. assert(value !== null)
  17840. }
  17841. return array.sort(compareHeaderName)
  17842. }
  17843. }
  17844. }
  17845. // https://fetch.spec.whatwg.org/#headers-class
  17846. class Headers {
  17847. #guard
  17848. #headersList
  17849. constructor (init = undefined) {
  17850. webidl.util.markAsUncloneable(this)
  17851. if (init === kConstruct) {
  17852. return
  17853. }
  17854. this.#headersList = new HeadersList()
  17855. // The new Headers(init) constructor steps are:
  17856. // 1. Set this’s guard to "none".
  17857. this.#guard = 'none'
  17858. // 2. If init is given, then fill this with init.
  17859. if (init !== undefined) {
  17860. init = webidl.converters.HeadersInit(init, 'Headers contructor', 'init')
  17861. fill(this, init)
  17862. }
  17863. }
  17864. // https://fetch.spec.whatwg.org/#dom-headers-append
  17865. append (name, value) {
  17866. webidl.brandCheck(this, Headers)
  17867. webidl.argumentLengthCheck(arguments, 2, 'Headers.append')
  17868. const prefix = 'Headers.append'
  17869. name = webidl.converters.ByteString(name, prefix, 'name')
  17870. value = webidl.converters.ByteString(value, prefix, 'value')
  17871. return appendHeader(this, name, value)
  17872. }
  17873. // https://fetch.spec.whatwg.org/#dom-headers-delete
  17874. delete (name) {
  17875. webidl.brandCheck(this, Headers)
  17876. webidl.argumentLengthCheck(arguments, 1, 'Headers.delete')
  17877. const prefix = 'Headers.delete'
  17878. name = webidl.converters.ByteString(name, prefix, 'name')
  17879. // 1. If name is not a header name, then throw a TypeError.
  17880. if (!isValidHeaderName(name)) {
  17881. throw webidl.errors.invalidArgument({
  17882. prefix: 'Headers.delete',
  17883. value: name,
  17884. type: 'header name'
  17885. })
  17886. }
  17887. // 2. If this’s guard is "immutable", then throw a TypeError.
  17888. // 3. Otherwise, if this’s guard is "request" and name is a
  17889. // forbidden header name, return.
  17890. // 4. Otherwise, if this’s guard is "request-no-cors", name
  17891. // is not a no-CORS-safelisted request-header name, and
  17892. // name is not a privileged no-CORS request-header name,
  17893. // return.
  17894. // 5. Otherwise, if this’s guard is "response" and name is
  17895. // a forbidden response-header name, return.
  17896. // Note: undici does not implement forbidden header names
  17897. if (this.#guard === 'immutable') {
  17898. throw new TypeError('immutable')
  17899. }
  17900. // 6. If this’s header list does not contain name, then
  17901. // return.
  17902. if (!this.#headersList.contains(name, false)) {
  17903. return
  17904. }
  17905. // 7. Delete name from this’s header list.
  17906. // 8. If this’s guard is "request-no-cors", then remove
  17907. // privileged no-CORS request headers from this.
  17908. this.#headersList.delete(name, false)
  17909. }
  17910. // https://fetch.spec.whatwg.org/#dom-headers-get
  17911. get (name) {
  17912. webidl.brandCheck(this, Headers)
  17913. webidl.argumentLengthCheck(arguments, 1, 'Headers.get')
  17914. const prefix = 'Headers.get'
  17915. name = webidl.converters.ByteString(name, prefix, 'name')
  17916. // 1. If name is not a header name, then throw a TypeError.
  17917. if (!isValidHeaderName(name)) {
  17918. throw webidl.errors.invalidArgument({
  17919. prefix,
  17920. value: name,
  17921. type: 'header name'
  17922. })
  17923. }
  17924. // 2. Return the result of getting name from this’s header
  17925. // list.
  17926. return this.#headersList.get(name, false)
  17927. }
  17928. // https://fetch.spec.whatwg.org/#dom-headers-has
  17929. has (name) {
  17930. webidl.brandCheck(this, Headers)
  17931. webidl.argumentLengthCheck(arguments, 1, 'Headers.has')
  17932. const prefix = 'Headers.has'
  17933. name = webidl.converters.ByteString(name, prefix, 'name')
  17934. // 1. If name is not a header name, then throw a TypeError.
  17935. if (!isValidHeaderName(name)) {
  17936. throw webidl.errors.invalidArgument({
  17937. prefix,
  17938. value: name,
  17939. type: 'header name'
  17940. })
  17941. }
  17942. // 2. Return true if this’s header list contains name;
  17943. // otherwise false.
  17944. return this.#headersList.contains(name, false)
  17945. }
  17946. // https://fetch.spec.whatwg.org/#dom-headers-set
  17947. set (name, value) {
  17948. webidl.brandCheck(this, Headers)
  17949. webidl.argumentLengthCheck(arguments, 2, 'Headers.set')
  17950. const prefix = 'Headers.set'
  17951. name = webidl.converters.ByteString(name, prefix, 'name')
  17952. value = webidl.converters.ByteString(value, prefix, 'value')
  17953. // 1. Normalize value.
  17954. value = headerValueNormalize(value)
  17955. // 2. If name is not a header name or value is not a
  17956. // header value, then throw a TypeError.
  17957. if (!isValidHeaderName(name)) {
  17958. throw webidl.errors.invalidArgument({
  17959. prefix,
  17960. value: name,
  17961. type: 'header name'
  17962. })
  17963. } else if (!isValidHeaderValue(value)) {
  17964. throw webidl.errors.invalidArgument({
  17965. prefix,
  17966. value,
  17967. type: 'header value'
  17968. })
  17969. }
  17970. // 3. If this’s guard is "immutable", then throw a TypeError.
  17971. // 4. Otherwise, if this’s guard is "request" and name is a
  17972. // forbidden header name, return.
  17973. // 5. Otherwise, if this’s guard is "request-no-cors" and
  17974. // name/value is not a no-CORS-safelisted request-header,
  17975. // return.
  17976. // 6. Otherwise, if this’s guard is "response" and name is a
  17977. // forbidden response-header name, return.
  17978. // Note: undici does not implement forbidden header names
  17979. if (this.#guard === 'immutable') {
  17980. throw new TypeError('immutable')
  17981. }
  17982. // 7. Set (name, value) in this’s header list.
  17983. // 8. If this’s guard is "request-no-cors", then remove
  17984. // privileged no-CORS request headers from this
  17985. this.#headersList.set(name, value, false)
  17986. }
  17987. // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie
  17988. getSetCookie () {
  17989. webidl.brandCheck(this, Headers)
  17990. // 1. If this’s header list does not contain `Set-Cookie`, then return « ».
  17991. // 2. Return the values of all headers in this’s header list whose name is
  17992. // a byte-case-insensitive match for `Set-Cookie`, in order.
  17993. const list = this.#headersList.cookies
  17994. if (list) {
  17995. return [...list]
  17996. }
  17997. return []
  17998. }
  17999. // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
  18000. get [kHeadersSortedMap] () {
  18001. if (this.#headersList[kHeadersSortedMap]) {
  18002. return this.#headersList[kHeadersSortedMap]
  18003. }
  18004. // 1. Let headers be an empty list of headers with the key being the name
  18005. // and value the value.
  18006. const headers = []
  18007. // 2. Let names be the result of convert header names to a sorted-lowercase
  18008. // set with all the names of the headers in list.
  18009. const names = this.#headersList.toSortedArray()
  18010. const cookies = this.#headersList.cookies
  18011. // fast-path
  18012. if (cookies === null || cookies.length === 1) {
  18013. // Note: The non-null assertion of value has already been done by `HeadersList#toSortedArray`
  18014. return (this.#headersList[kHeadersSortedMap] = names)
  18015. }
  18016. // 3. For each name of names:
  18017. for (let i = 0; i < names.length; ++i) {
  18018. const { 0: name, 1: value } = names[i]
  18019. // 1. If name is `set-cookie`, then:
  18020. if (name === 'set-cookie') {
  18021. // 1. Let values be a list of all values of headers in list whose name
  18022. // is a byte-case-insensitive match for name, in order.
  18023. // 2. For each value of values:
  18024. // 1. Append (name, value) to headers.
  18025. for (let j = 0; j < cookies.length; ++j) {
  18026. headers.push([name, cookies[j]])
  18027. }
  18028. } else {
  18029. // 2. Otherwise:
  18030. // 1. Let value be the result of getting name from list.
  18031. // 2. Assert: value is non-null.
  18032. // Note: This operation was done by `HeadersList#toSortedArray`.
  18033. // 3. Append (name, value) to headers.
  18034. headers.push([name, value])
  18035. }
  18036. }
  18037. // 4. Return headers.
  18038. return (this.#headersList[kHeadersSortedMap] = headers)
  18039. }
  18040. [util.inspect.custom] (depth, options) {
  18041. options.depth ??= depth
  18042. return `Headers ${util.formatWithOptions(options, this.#headersList.entries)}`
  18043. }
  18044. static getHeadersGuard (o) {
  18045. return o.#guard
  18046. }
  18047. static setHeadersGuard (o, guard) {
  18048. o.#guard = guard
  18049. }
  18050. static getHeadersList (o) {
  18051. return o.#headersList
  18052. }
  18053. static setHeadersList (o, list) {
  18054. o.#headersList = list
  18055. }
  18056. }
  18057. const { getHeadersGuard, setHeadersGuard, getHeadersList, setHeadersList } = Headers
  18058. Reflect.deleteProperty(Headers, 'getHeadersGuard')
  18059. Reflect.deleteProperty(Headers, 'setHeadersGuard')
  18060. Reflect.deleteProperty(Headers, 'getHeadersList')
  18061. Reflect.deleteProperty(Headers, 'setHeadersList')
  18062. iteratorMixin('Headers', Headers, kHeadersSortedMap, 0, 1)
  18063. Object.defineProperties(Headers.prototype, {
  18064. append: kEnumerableProperty,
  18065. delete: kEnumerableProperty,
  18066. get: kEnumerableProperty,
  18067. has: kEnumerableProperty,
  18068. set: kEnumerableProperty,
  18069. getSetCookie: kEnumerableProperty,
  18070. [Symbol.toStringTag]: {
  18071. value: 'Headers',
  18072. configurable: true
  18073. },
  18074. [util.inspect.custom]: {
  18075. enumerable: false
  18076. }
  18077. })
  18078. webidl.converters.HeadersInit = function (V, prefix, argument) {
  18079. if (webidl.util.Type(V) === 'Object') {
  18080. const iterator = Reflect.get(V, Symbol.iterator)
  18081. // A work-around to ensure we send the properly-cased Headers when V is a Headers object.
  18082. // Read https://github.com/nodejs/undici/pull/3159#issuecomment-2075537226 before touching, please.
  18083. if (!util.types.isProxy(V) && iterator === Headers.prototype.entries) { // Headers object
  18084. try {
  18085. return getHeadersList(V).entriesList
  18086. } catch {
  18087. // fall-through
  18088. }
  18089. }
  18090. if (typeof iterator === 'function') {
  18091. return webidl.converters['sequence<sequence<ByteString>>'](V, prefix, argument, iterator.bind(V))
  18092. }
  18093. return webidl.converters['record<ByteString, ByteString>'](V, prefix, argument)
  18094. }
  18095. throw webidl.errors.conversionFailed({
  18096. prefix: 'Headers constructor',
  18097. argument: 'Argument 1',
  18098. types: ['sequence<sequence<ByteString>>', 'record<ByteString, ByteString>']
  18099. })
  18100. }
  18101. module.exports = {
  18102. fill,
  18103. // for test.
  18104. compareHeaderName,
  18105. Headers,
  18106. HeadersList,
  18107. getHeadersGuard,
  18108. setHeadersGuard,
  18109. setHeadersList,
  18110. getHeadersList
  18111. }
  18112. /***/ }),
  18113. /***/ 4398:
  18114. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  18115. // https://github.com/Ethan-Arrowood/undici-fetch
  18116. const {
  18117. makeNetworkError,
  18118. makeAppropriateNetworkError,
  18119. filterResponse,
  18120. makeResponse,
  18121. fromInnerResponse
  18122. } = __nccwpck_require__(9051)
  18123. const { HeadersList } = __nccwpck_require__(660)
  18124. const { Request, cloneRequest } = __nccwpck_require__(9967)
  18125. const zlib = __nccwpck_require__(8522)
  18126. const {
  18127. bytesMatch,
  18128. makePolicyContainer,
  18129. clonePolicyContainer,
  18130. requestBadPort,
  18131. TAOCheck,
  18132. appendRequestOriginHeader,
  18133. responseLocationURL,
  18134. requestCurrentURL,
  18135. setRequestReferrerPolicyOnRedirect,
  18136. tryUpgradeRequestToAPotentiallyTrustworthyURL,
  18137. createOpaqueTimingInfo,
  18138. appendFetchMetadata,
  18139. corsCheck,
  18140. crossOriginResourcePolicyCheck,
  18141. determineRequestsReferrer,
  18142. coarsenedSharedCurrentTime,
  18143. createDeferredPromise,
  18144. isBlobLike,
  18145. sameOrigin,
  18146. isCancelled,
  18147. isAborted,
  18148. isErrorLike,
  18149. fullyReadBody,
  18150. readableStreamClose,
  18151. isomorphicEncode,
  18152. urlIsLocal,
  18153. urlIsHttpHttpsScheme,
  18154. urlHasHttpsScheme,
  18155. clampAndCoarsenConnectionTimingInfo,
  18156. simpleRangeHeaderValue,
  18157. buildContentRange,
  18158. createInflate,
  18159. extractMimeType
  18160. } = __nccwpck_require__(3168)
  18161. const { kState, kDispatcher } = __nccwpck_require__(3627)
  18162. const assert = __nccwpck_require__(4589)
  18163. const { safelyExtractBody, extractBody } = __nccwpck_require__(4492)
  18164. const {
  18165. redirectStatusSet,
  18166. nullBodyStatus,
  18167. safeMethodsSet,
  18168. requestBodyHeader,
  18169. subresourceSet
  18170. } = __nccwpck_require__(4495)
  18171. const EE = __nccwpck_require__(8474)
  18172. const { Readable, pipeline, finished } = __nccwpck_require__(7075)
  18173. const { addAbortListener, isErrored, isReadable, bufferToLowerCasedHeaderName } = __nccwpck_require__(3440)
  18174. const { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = __nccwpck_require__(1900)
  18175. const { getGlobalDispatcher } = __nccwpck_require__(2581)
  18176. const { webidl } = __nccwpck_require__(5893)
  18177. const { STATUS_CODES } = __nccwpck_require__(7067)
  18178. const GET_OR_HEAD = ['GET', 'HEAD']
  18179. const defaultUserAgent = typeof __UNDICI_IS_NODE__ !== 'undefined' || typeof esbuildDetection !== 'undefined'
  18180. ? 'node'
  18181. : 'undici'
  18182. /** @type {import('buffer').resolveObjectURL} */
  18183. let resolveObjectURL
  18184. class Fetch extends EE {
  18185. constructor (dispatcher) {
  18186. super()
  18187. this.dispatcher = dispatcher
  18188. this.connection = null
  18189. this.dump = false
  18190. this.state = 'ongoing'
  18191. }
  18192. terminate (reason) {
  18193. if (this.state !== 'ongoing') {
  18194. return
  18195. }
  18196. this.state = 'terminated'
  18197. this.connection?.destroy(reason)
  18198. this.emit('terminated', reason)
  18199. }
  18200. // https://fetch.spec.whatwg.org/#fetch-controller-abort
  18201. abort (error) {
  18202. if (this.state !== 'ongoing') {
  18203. return
  18204. }
  18205. // 1. Set controller’s state to "aborted".
  18206. this.state = 'aborted'
  18207. // 2. Let fallbackError be an "AbortError" DOMException.
  18208. // 3. Set error to fallbackError if it is not given.
  18209. if (!error) {
  18210. error = new DOMException('The operation was aborted.', 'AbortError')
  18211. }
  18212. // 4. Let serializedError be StructuredSerialize(error).
  18213. // If that threw an exception, catch it, and let
  18214. // serializedError be StructuredSerialize(fallbackError).
  18215. // 5. Set controller’s serialized abort reason to serializedError.
  18216. this.serializedAbortReason = error
  18217. this.connection?.destroy(error)
  18218. this.emit('terminated', error)
  18219. }
  18220. }
  18221. function handleFetchDone (response) {
  18222. finalizeAndReportTiming(response, 'fetch')
  18223. }
  18224. // https://fetch.spec.whatwg.org/#fetch-method
  18225. function fetch (input, init = undefined) {
  18226. webidl.argumentLengthCheck(arguments, 1, 'globalThis.fetch')
  18227. // 1. Let p be a new promise.
  18228. let p = createDeferredPromise()
  18229. // 2. Let requestObject be the result of invoking the initial value of
  18230. // Request as constructor with input and init as arguments. If this throws
  18231. // an exception, reject p with it and return p.
  18232. let requestObject
  18233. try {
  18234. requestObject = new Request(input, init)
  18235. } catch (e) {
  18236. p.reject(e)
  18237. return p.promise
  18238. }
  18239. // 3. Let request be requestObject’s request.
  18240. const request = requestObject[kState]
  18241. // 4. If requestObject’s signal’s aborted flag is set, then:
  18242. if (requestObject.signal.aborted) {
  18243. // 1. Abort the fetch() call with p, request, null, and
  18244. // requestObject’s signal’s abort reason.
  18245. abortFetch(p, request, null, requestObject.signal.reason)
  18246. // 2. Return p.
  18247. return p.promise
  18248. }
  18249. // 5. Let globalObject be request’s client’s global object.
  18250. const globalObject = request.client.globalObject
  18251. // 6. If globalObject is a ServiceWorkerGlobalScope object, then set
  18252. // request’s service-workers mode to "none".
  18253. if (globalObject?.constructor?.name === 'ServiceWorkerGlobalScope') {
  18254. request.serviceWorkers = 'none'
  18255. }
  18256. // 7. Let responseObject be null.
  18257. let responseObject = null
  18258. // 8. Let relevantRealm be this’s relevant Realm.
  18259. // 9. Let locallyAborted be false.
  18260. let locallyAborted = false
  18261. // 10. Let controller be null.
  18262. let controller = null
  18263. // 11. Add the following abort steps to requestObject’s signal:
  18264. addAbortListener(
  18265. requestObject.signal,
  18266. () => {
  18267. // 1. Set locallyAborted to true.
  18268. locallyAborted = true
  18269. // 2. Assert: controller is non-null.
  18270. assert(controller != null)
  18271. // 3. Abort controller with requestObject’s signal’s abort reason.
  18272. controller.abort(requestObject.signal.reason)
  18273. const realResponse = responseObject?.deref()
  18274. // 4. Abort the fetch() call with p, request, responseObject,
  18275. // and requestObject’s signal’s abort reason.
  18276. abortFetch(p, request, realResponse, requestObject.signal.reason)
  18277. }
  18278. )
  18279. // 12. Let handleFetchDone given response response be to finalize and
  18280. // report timing with response, globalObject, and "fetch".
  18281. // see function handleFetchDone
  18282. // 13. Set controller to the result of calling fetch given request,
  18283. // with processResponseEndOfBody set to handleFetchDone, and processResponse
  18284. // given response being these substeps:
  18285. const processResponse = (response) => {
  18286. // 1. If locallyAborted is true, terminate these substeps.
  18287. if (locallyAborted) {
  18288. return
  18289. }
  18290. // 2. If response’s aborted flag is set, then:
  18291. if (response.aborted) {
  18292. // 1. Let deserializedError be the result of deserialize a serialized
  18293. // abort reason given controller’s serialized abort reason and
  18294. // relevantRealm.
  18295. // 2. Abort the fetch() call with p, request, responseObject, and
  18296. // deserializedError.
  18297. abortFetch(p, request, responseObject, controller.serializedAbortReason)
  18298. return
  18299. }
  18300. // 3. If response is a network error, then reject p with a TypeError
  18301. // and terminate these substeps.
  18302. if (response.type === 'error') {
  18303. p.reject(new TypeError('fetch failed', { cause: response.error }))
  18304. return
  18305. }
  18306. // 4. Set responseObject to the result of creating a Response object,
  18307. // given response, "immutable", and relevantRealm.
  18308. responseObject = new WeakRef(fromInnerResponse(response, 'immutable'))
  18309. // 5. Resolve p with responseObject.
  18310. p.resolve(responseObject.deref())
  18311. p = null
  18312. }
  18313. controller = fetching({
  18314. request,
  18315. processResponseEndOfBody: handleFetchDone,
  18316. processResponse,
  18317. dispatcher: requestObject[kDispatcher] // undici
  18318. })
  18319. // 14. Return p.
  18320. return p.promise
  18321. }
  18322. // https://fetch.spec.whatwg.org/#finalize-and-report-timing
  18323. function finalizeAndReportTiming (response, initiatorType = 'other') {
  18324. // 1. If response is an aborted network error, then return.
  18325. if (response.type === 'error' && response.aborted) {
  18326. return
  18327. }
  18328. // 2. If response’s URL list is null or empty, then return.
  18329. if (!response.urlList?.length) {
  18330. return
  18331. }
  18332. // 3. Let originalURL be response’s URL list[0].
  18333. const originalURL = response.urlList[0]
  18334. // 4. Let timingInfo be response’s timing info.
  18335. let timingInfo = response.timingInfo
  18336. // 5. Let cacheState be response’s cache state.
  18337. let cacheState = response.cacheState
  18338. // 6. If originalURL’s scheme is not an HTTP(S) scheme, then return.
  18339. if (!urlIsHttpHttpsScheme(originalURL)) {
  18340. return
  18341. }
  18342. // 7. If timingInfo is null, then return.
  18343. if (timingInfo === null) {
  18344. return
  18345. }
  18346. // 8. If response’s timing allow passed flag is not set, then:
  18347. if (!response.timingAllowPassed) {
  18348. // 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo.
  18349. timingInfo = createOpaqueTimingInfo({
  18350. startTime: timingInfo.startTime
  18351. })
  18352. // 2. Set cacheState to the empty string.
  18353. cacheState = ''
  18354. }
  18355. // 9. Set timingInfo’s end time to the coarsened shared current time
  18356. // given global’s relevant settings object’s cross-origin isolated
  18357. // capability.
  18358. // TODO: given global’s relevant settings object’s cross-origin isolated
  18359. // capability?
  18360. timingInfo.endTime = coarsenedSharedCurrentTime()
  18361. // 10. Set response’s timing info to timingInfo.
  18362. response.timingInfo = timingInfo
  18363. // 11. Mark resource timing for timingInfo, originalURL, initiatorType,
  18364. // global, and cacheState.
  18365. markResourceTiming(
  18366. timingInfo,
  18367. originalURL.href,
  18368. initiatorType,
  18369. globalThis,
  18370. cacheState
  18371. )
  18372. }
  18373. // https://w3c.github.io/resource-timing/#dfn-mark-resource-timing
  18374. const markResourceTiming = performance.markResourceTiming
  18375. // https://fetch.spec.whatwg.org/#abort-fetch
  18376. function abortFetch (p, request, responseObject, error) {
  18377. // 1. Reject promise with error.
  18378. if (p) {
  18379. // We might have already resolved the promise at this stage
  18380. p.reject(error)
  18381. }
  18382. // 2. If request’s body is not null and is readable, then cancel request’s
  18383. // body with error.
  18384. if (request.body != null && isReadable(request.body?.stream)) {
  18385. request.body.stream.cancel(error).catch((err) => {
  18386. if (err.code === 'ERR_INVALID_STATE') {
  18387. // Node bug?
  18388. return
  18389. }
  18390. throw err
  18391. })
  18392. }
  18393. // 3. If responseObject is null, then return.
  18394. if (responseObject == null) {
  18395. return
  18396. }
  18397. // 4. Let response be responseObject’s response.
  18398. const response = responseObject[kState]
  18399. // 5. If response’s body is not null and is readable, then error response’s
  18400. // body with error.
  18401. if (response.body != null && isReadable(response.body?.stream)) {
  18402. response.body.stream.cancel(error).catch((err) => {
  18403. if (err.code === 'ERR_INVALID_STATE') {
  18404. // Node bug?
  18405. return
  18406. }
  18407. throw err
  18408. })
  18409. }
  18410. }
  18411. // https://fetch.spec.whatwg.org/#fetching
  18412. function fetching ({
  18413. request,
  18414. processRequestBodyChunkLength,
  18415. processRequestEndOfBody,
  18416. processResponse,
  18417. processResponseEndOfBody,
  18418. processResponseConsumeBody,
  18419. useParallelQueue = false,
  18420. dispatcher = getGlobalDispatcher() // undici
  18421. }) {
  18422. // Ensure that the dispatcher is set accordingly
  18423. assert(dispatcher)
  18424. // 1. Let taskDestination be null.
  18425. let taskDestination = null
  18426. // 2. Let crossOriginIsolatedCapability be false.
  18427. let crossOriginIsolatedCapability = false
  18428. // 3. If request’s client is non-null, then:
  18429. if (request.client != null) {
  18430. // 1. Set taskDestination to request’s client’s global object.
  18431. taskDestination = request.client.globalObject
  18432. // 2. Set crossOriginIsolatedCapability to request’s client’s cross-origin
  18433. // isolated capability.
  18434. crossOriginIsolatedCapability =
  18435. request.client.crossOriginIsolatedCapability
  18436. }
  18437. // 4. If useParallelQueue is true, then set taskDestination to the result of
  18438. // starting a new parallel queue.
  18439. // TODO
  18440. // 5. Let timingInfo be a new fetch timing info whose start time and
  18441. // post-redirect start time are the coarsened shared current time given
  18442. // crossOriginIsolatedCapability.
  18443. const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability)
  18444. const timingInfo = createOpaqueTimingInfo({
  18445. startTime: currentTime
  18446. })
  18447. // 6. Let fetchParams be a new fetch params whose
  18448. // request is request,
  18449. // timing info is timingInfo,
  18450. // process request body chunk length is processRequestBodyChunkLength,
  18451. // process request end-of-body is processRequestEndOfBody,
  18452. // process response is processResponse,
  18453. // process response consume body is processResponseConsumeBody,
  18454. // process response end-of-body is processResponseEndOfBody,
  18455. // task destination is taskDestination,
  18456. // and cross-origin isolated capability is crossOriginIsolatedCapability.
  18457. const fetchParams = {
  18458. controller: new Fetch(dispatcher),
  18459. request,
  18460. timingInfo,
  18461. processRequestBodyChunkLength,
  18462. processRequestEndOfBody,
  18463. processResponse,
  18464. processResponseConsumeBody,
  18465. processResponseEndOfBody,
  18466. taskDestination,
  18467. crossOriginIsolatedCapability
  18468. }
  18469. // 7. If request’s body is a byte sequence, then set request’s body to
  18470. // request’s body as a body.
  18471. // NOTE: Since fetching is only called from fetch, body should already be
  18472. // extracted.
  18473. assert(!request.body || request.body.stream)
  18474. // 8. If request’s window is "client", then set request’s window to request’s
  18475. // client, if request’s client’s global object is a Window object; otherwise
  18476. // "no-window".
  18477. if (request.window === 'client') {
  18478. // TODO: What if request.client is null?
  18479. request.window =
  18480. request.client?.globalObject?.constructor?.name === 'Window'
  18481. ? request.client
  18482. : 'no-window'
  18483. }
  18484. // 9. If request’s origin is "client", then set request’s origin to request’s
  18485. // client’s origin.
  18486. if (request.origin === 'client') {
  18487. request.origin = request.client.origin
  18488. }
  18489. // 10. If all of the following conditions are true:
  18490. // TODO
  18491. // 11. If request’s policy container is "client", then:
  18492. if (request.policyContainer === 'client') {
  18493. // 1. If request’s client is non-null, then set request’s policy
  18494. // container to a clone of request’s client’s policy container. [HTML]
  18495. if (request.client != null) {
  18496. request.policyContainer = clonePolicyContainer(
  18497. request.client.policyContainer
  18498. )
  18499. } else {
  18500. // 2. Otherwise, set request’s policy container to a new policy
  18501. // container.
  18502. request.policyContainer = makePolicyContainer()
  18503. }
  18504. }
  18505. // 12. If request’s header list does not contain `Accept`, then:
  18506. if (!request.headersList.contains('accept', true)) {
  18507. // 1. Let value be `*/*`.
  18508. const value = '*/*'
  18509. // 2. A user agent should set value to the first matching statement, if
  18510. // any, switching on request’s destination:
  18511. // "document"
  18512. // "frame"
  18513. // "iframe"
  18514. // `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`
  18515. // "image"
  18516. // `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5`
  18517. // "style"
  18518. // `text/css,*/*;q=0.1`
  18519. // TODO
  18520. // 3. Append `Accept`/value to request’s header list.
  18521. request.headersList.append('accept', value, true)
  18522. }
  18523. // 13. If request’s header list does not contain `Accept-Language`, then
  18524. // user agents should append `Accept-Language`/an appropriate value to
  18525. // request’s header list.
  18526. if (!request.headersList.contains('accept-language', true)) {
  18527. request.headersList.append('accept-language', '*', true)
  18528. }
  18529. // 14. If request’s priority is null, then use request’s initiator and
  18530. // destination appropriately in setting request’s priority to a
  18531. // user-agent-defined object.
  18532. if (request.priority === null) {
  18533. // TODO
  18534. }
  18535. // 15. If request is a subresource request, then:
  18536. if (subresourceSet.has(request.destination)) {
  18537. // TODO
  18538. }
  18539. // 16. Run main fetch given fetchParams.
  18540. mainFetch(fetchParams)
  18541. .catch(err => {
  18542. fetchParams.controller.terminate(err)
  18543. })
  18544. // 17. Return fetchParam's controller
  18545. return fetchParams.controller
  18546. }
  18547. // https://fetch.spec.whatwg.org/#concept-main-fetch
  18548. async function mainFetch (fetchParams, recursive = false) {
  18549. // 1. Let request be fetchParams’s request.
  18550. const request = fetchParams.request
  18551. // 2. Let response be null.
  18552. let response = null
  18553. // 3. If request’s local-URLs-only flag is set and request’s current URL is
  18554. // not local, then set response to a network error.
  18555. if (request.localURLsOnly && !urlIsLocal(requestCurrentURL(request))) {
  18556. response = makeNetworkError('local URLs only')
  18557. }
  18558. // 4. Run report Content Security Policy violations for request.
  18559. // TODO
  18560. // 5. Upgrade request to a potentially trustworthy URL, if appropriate.
  18561. tryUpgradeRequestToAPotentiallyTrustworthyURL(request)
  18562. // 6. If should request be blocked due to a bad port, should fetching request
  18563. // be blocked as mixed content, or should request be blocked by Content
  18564. // Security Policy returns blocked, then set response to a network error.
  18565. if (requestBadPort(request) === 'blocked') {
  18566. response = makeNetworkError('bad port')
  18567. }
  18568. // TODO: should fetching request be blocked as mixed content?
  18569. // TODO: should request be blocked by Content Security Policy?
  18570. // 7. If request’s referrer policy is the empty string, then set request’s
  18571. // referrer policy to request’s policy container’s referrer policy.
  18572. if (request.referrerPolicy === '') {
  18573. request.referrerPolicy = request.policyContainer.referrerPolicy
  18574. }
  18575. // 8. If request’s referrer is not "no-referrer", then set request’s
  18576. // referrer to the result of invoking determine request’s referrer.
  18577. if (request.referrer !== 'no-referrer') {
  18578. request.referrer = determineRequestsReferrer(request)
  18579. }
  18580. // 9. Set request’s current URL’s scheme to "https" if all of the following
  18581. // conditions are true:
  18582. // - request’s current URL’s scheme is "http"
  18583. // - request’s current URL’s host is a domain
  18584. // - Matching request’s current URL’s host per Known HSTS Host Domain Name
  18585. // Matching results in either a superdomain match with an asserted
  18586. // includeSubDomains directive or a congruent match (with or without an
  18587. // asserted includeSubDomains directive). [HSTS]
  18588. // TODO
  18589. // 10. If recursive is false, then run the remaining steps in parallel.
  18590. // TODO
  18591. // 11. If response is null, then set response to the result of running
  18592. // the steps corresponding to the first matching statement:
  18593. if (response === null) {
  18594. response = await (async () => {
  18595. const currentURL = requestCurrentURL(request)
  18596. if (
  18597. // - request’s current URL’s origin is same origin with request’s origin,
  18598. // and request’s response tainting is "basic"
  18599. (sameOrigin(currentURL, request.url) && request.responseTainting === 'basic') ||
  18600. // request’s current URL’s scheme is "data"
  18601. (currentURL.protocol === 'data:') ||
  18602. // - request’s mode is "navigate" or "websocket"
  18603. (request.mode === 'navigate' || request.mode === 'websocket')
  18604. ) {
  18605. // 1. Set request’s response tainting to "basic".
  18606. request.responseTainting = 'basic'
  18607. // 2. Return the result of running scheme fetch given fetchParams.
  18608. return await schemeFetch(fetchParams)
  18609. }
  18610. // request’s mode is "same-origin"
  18611. if (request.mode === 'same-origin') {
  18612. // 1. Return a network error.
  18613. return makeNetworkError('request mode cannot be "same-origin"')
  18614. }
  18615. // request’s mode is "no-cors"
  18616. if (request.mode === 'no-cors') {
  18617. // 1. If request’s redirect mode is not "follow", then return a network
  18618. // error.
  18619. if (request.redirect !== 'follow') {
  18620. return makeNetworkError(
  18621. 'redirect mode cannot be "follow" for "no-cors" request'
  18622. )
  18623. }
  18624. // 2. Set request’s response tainting to "opaque".
  18625. request.responseTainting = 'opaque'
  18626. // 3. Return the result of running scheme fetch given fetchParams.
  18627. return await schemeFetch(fetchParams)
  18628. }
  18629. // request’s current URL’s scheme is not an HTTP(S) scheme
  18630. if (!urlIsHttpHttpsScheme(requestCurrentURL(request))) {
  18631. // Return a network error.
  18632. return makeNetworkError('URL scheme must be a HTTP(S) scheme')
  18633. }
  18634. // - request’s use-CORS-preflight flag is set
  18635. // - request’s unsafe-request flag is set and either request’s method is
  18636. // not a CORS-safelisted method or CORS-unsafe request-header names with
  18637. // request’s header list is not empty
  18638. // 1. Set request’s response tainting to "cors".
  18639. // 2. Let corsWithPreflightResponse be the result of running HTTP fetch
  18640. // given fetchParams and true.
  18641. // 3. If corsWithPreflightResponse is a network error, then clear cache
  18642. // entries using request.
  18643. // 4. Return corsWithPreflightResponse.
  18644. // TODO
  18645. // Otherwise
  18646. // 1. Set request’s response tainting to "cors".
  18647. request.responseTainting = 'cors'
  18648. // 2. Return the result of running HTTP fetch given fetchParams.
  18649. return await httpFetch(fetchParams)
  18650. })()
  18651. }
  18652. // 12. If recursive is true, then return response.
  18653. if (recursive) {
  18654. return response
  18655. }
  18656. // 13. If response is not a network error and response is not a filtered
  18657. // response, then:
  18658. if (response.status !== 0 && !response.internalResponse) {
  18659. // If request’s response tainting is "cors", then:
  18660. if (request.responseTainting === 'cors') {
  18661. // 1. Let headerNames be the result of extracting header list values
  18662. // given `Access-Control-Expose-Headers` and response’s header list.
  18663. // TODO
  18664. // 2. If request’s credentials mode is not "include" and headerNames
  18665. // contains `*`, then set response’s CORS-exposed header-name list to
  18666. // all unique header names in response’s header list.
  18667. // TODO
  18668. // 3. Otherwise, if headerNames is not null or failure, then set
  18669. // response’s CORS-exposed header-name list to headerNames.
  18670. // TODO
  18671. }
  18672. // Set response to the following filtered response with response as its
  18673. // internal response, depending on request’s response tainting:
  18674. if (request.responseTainting === 'basic') {
  18675. response = filterResponse(response, 'basic')
  18676. } else if (request.responseTainting === 'cors') {
  18677. response = filterResponse(response, 'cors')
  18678. } else if (request.responseTainting === 'opaque') {
  18679. response = filterResponse(response, 'opaque')
  18680. } else {
  18681. assert(false)
  18682. }
  18683. }
  18684. // 14. Let internalResponse be response, if response is a network error,
  18685. // and response’s internal response otherwise.
  18686. let internalResponse =
  18687. response.status === 0 ? response : response.internalResponse
  18688. // 15. If internalResponse’s URL list is empty, then set it to a clone of
  18689. // request’s URL list.
  18690. if (internalResponse.urlList.length === 0) {
  18691. internalResponse.urlList.push(...request.urlList)
  18692. }
  18693. // 16. If request’s timing allow failed flag is unset, then set
  18694. // internalResponse’s timing allow passed flag.
  18695. if (!request.timingAllowFailed) {
  18696. response.timingAllowPassed = true
  18697. }
  18698. // 17. If response is not a network error and any of the following returns
  18699. // blocked
  18700. // - should internalResponse to request be blocked as mixed content
  18701. // - should internalResponse to request be blocked by Content Security Policy
  18702. // - should internalResponse to request be blocked due to its MIME type
  18703. // - should internalResponse to request be blocked due to nosniff
  18704. // TODO
  18705. // 18. If response’s type is "opaque", internalResponse’s status is 206,
  18706. // internalResponse’s range-requested flag is set, and request’s header
  18707. // list does not contain `Range`, then set response and internalResponse
  18708. // to a network error.
  18709. if (
  18710. response.type === 'opaque' &&
  18711. internalResponse.status === 206 &&
  18712. internalResponse.rangeRequested &&
  18713. !request.headers.contains('range', true)
  18714. ) {
  18715. response = internalResponse = makeNetworkError()
  18716. }
  18717. // 19. If response is not a network error and either request’s method is
  18718. // `HEAD` or `CONNECT`, or internalResponse’s status is a null body status,
  18719. // set internalResponse’s body to null and disregard any enqueuing toward
  18720. // it (if any).
  18721. if (
  18722. response.status !== 0 &&
  18723. (request.method === 'HEAD' ||
  18724. request.method === 'CONNECT' ||
  18725. nullBodyStatus.includes(internalResponse.status))
  18726. ) {
  18727. internalResponse.body = null
  18728. fetchParams.controller.dump = true
  18729. }
  18730. // 20. If request’s integrity metadata is not the empty string, then:
  18731. if (request.integrity) {
  18732. // 1. Let processBodyError be this step: run fetch finale given fetchParams
  18733. // and a network error.
  18734. const processBodyError = (reason) =>
  18735. fetchFinale(fetchParams, makeNetworkError(reason))
  18736. // 2. If request’s response tainting is "opaque", or response’s body is null,
  18737. // then run processBodyError and abort these steps.
  18738. if (request.responseTainting === 'opaque' || response.body == null) {
  18739. processBodyError(response.error)
  18740. return
  18741. }
  18742. // 3. Let processBody given bytes be these steps:
  18743. const processBody = (bytes) => {
  18744. // 1. If bytes do not match request’s integrity metadata,
  18745. // then run processBodyError and abort these steps. [SRI]
  18746. if (!bytesMatch(bytes, request.integrity)) {
  18747. processBodyError('integrity mismatch')
  18748. return
  18749. }
  18750. // 2. Set response’s body to bytes as a body.
  18751. response.body = safelyExtractBody(bytes)[0]
  18752. // 3. Run fetch finale given fetchParams and response.
  18753. fetchFinale(fetchParams, response)
  18754. }
  18755. // 4. Fully read response’s body given processBody and processBodyError.
  18756. await fullyReadBody(response.body, processBody, processBodyError)
  18757. } else {
  18758. // 21. Otherwise, run fetch finale given fetchParams and response.
  18759. fetchFinale(fetchParams, response)
  18760. }
  18761. }
  18762. // https://fetch.spec.whatwg.org/#concept-scheme-fetch
  18763. // given a fetch params fetchParams
  18764. function schemeFetch (fetchParams) {
  18765. // Note: since the connection is destroyed on redirect, which sets fetchParams to a
  18766. // cancelled state, we do not want this condition to trigger *unless* there have been
  18767. // no redirects. See https://github.com/nodejs/undici/issues/1776
  18768. // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
  18769. if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) {
  18770. return Promise.resolve(makeAppropriateNetworkError(fetchParams))
  18771. }
  18772. // 2. Let request be fetchParams’s request.
  18773. const { request } = fetchParams
  18774. const { protocol: scheme } = requestCurrentURL(request)
  18775. // 3. Switch on request’s current URL’s scheme and run the associated steps:
  18776. switch (scheme) {
  18777. case 'about:': {
  18778. // If request’s current URL’s path is the string "blank", then return a new response
  18779. // whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) »,
  18780. // and body is the empty byte sequence as a body.
  18781. // Otherwise, return a network error.
  18782. return Promise.resolve(makeNetworkError('about scheme is not supported'))
  18783. }
  18784. case 'blob:': {
  18785. if (!resolveObjectURL) {
  18786. resolveObjectURL = (__nccwpck_require__(4573).resolveObjectURL)
  18787. }
  18788. // 1. Let blobURLEntry be request’s current URL’s blob URL entry.
  18789. const blobURLEntry = requestCurrentURL(request)
  18790. // https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56
  18791. // Buffer.resolveObjectURL does not ignore URL queries.
  18792. if (blobURLEntry.search.length !== 0) {
  18793. return Promise.resolve(makeNetworkError('NetworkError when attempting to fetch resource.'))
  18794. }
  18795. const blob = resolveObjectURL(blobURLEntry.toString())
  18796. // 2. If request’s method is not `GET`, blobURLEntry is null, or blobURLEntry’s
  18797. // object is not a Blob object, then return a network error.
  18798. if (request.method !== 'GET' || !isBlobLike(blob)) {
  18799. return Promise.resolve(makeNetworkError('invalid method'))
  18800. }
  18801. // 3. Let blob be blobURLEntry’s object.
  18802. // Note: done above
  18803. // 4. Let response be a new response.
  18804. const response = makeResponse()
  18805. // 5. Let fullLength be blob’s size.
  18806. const fullLength = blob.size
  18807. // 6. Let serializedFullLength be fullLength, serialized and isomorphic encoded.
  18808. const serializedFullLength = isomorphicEncode(`${fullLength}`)
  18809. // 7. Let type be blob’s type.
  18810. const type = blob.type
  18811. // 8. If request’s header list does not contain `Range`:
  18812. // 9. Otherwise:
  18813. if (!request.headersList.contains('range', true)) {
  18814. // 1. Let bodyWithType be the result of safely extracting blob.
  18815. // Note: in the FileAPI a blob "object" is a Blob *or* a MediaSource.
  18816. // In node, this can only ever be a Blob. Therefore we can safely
  18817. // use extractBody directly.
  18818. const bodyWithType = extractBody(blob)
  18819. // 2. Set response’s status message to `OK`.
  18820. response.statusText = 'OK'
  18821. // 3. Set response’s body to bodyWithType’s body.
  18822. response.body = bodyWithType[0]
  18823. // 4. Set response’s header list to « (`Content-Length`, serializedFullLength), (`Content-Type`, type) ».
  18824. response.headersList.set('content-length', serializedFullLength, true)
  18825. response.headersList.set('content-type', type, true)
  18826. } else {
  18827. // 1. Set response’s range-requested flag.
  18828. response.rangeRequested = true
  18829. // 2. Let rangeHeader be the result of getting `Range` from request’s header list.
  18830. const rangeHeader = request.headersList.get('range', true)
  18831. // 3. Let rangeValue be the result of parsing a single range header value given rangeHeader and true.
  18832. const rangeValue = simpleRangeHeaderValue(rangeHeader, true)
  18833. // 4. If rangeValue is failure, then return a network error.
  18834. if (rangeValue === 'failure') {
  18835. return Promise.resolve(makeNetworkError('failed to fetch the data URL'))
  18836. }
  18837. // 5. Let (rangeStart, rangeEnd) be rangeValue.
  18838. let { rangeStartValue: rangeStart, rangeEndValue: rangeEnd } = rangeValue
  18839. // 6. If rangeStart is null:
  18840. // 7. Otherwise:
  18841. if (rangeStart === null) {
  18842. // 1. Set rangeStart to fullLength − rangeEnd.
  18843. rangeStart = fullLength - rangeEnd
  18844. // 2. Set rangeEnd to rangeStart + rangeEnd − 1.
  18845. rangeEnd = rangeStart + rangeEnd - 1
  18846. } else {
  18847. // 1. If rangeStart is greater than or equal to fullLength, then return a network error.
  18848. if (rangeStart >= fullLength) {
  18849. return Promise.resolve(makeNetworkError('Range start is greater than the blob\'s size.'))
  18850. }
  18851. // 2. If rangeEnd is null or rangeEnd is greater than or equal to fullLength, then set
  18852. // rangeEnd to fullLength − 1.
  18853. if (rangeEnd === null || rangeEnd >= fullLength) {
  18854. rangeEnd = fullLength - 1
  18855. }
  18856. }
  18857. // 8. Let slicedBlob be the result of invoking slice blob given blob, rangeStart,
  18858. // rangeEnd + 1, and type.
  18859. const slicedBlob = blob.slice(rangeStart, rangeEnd, type)
  18860. // 9. Let slicedBodyWithType be the result of safely extracting slicedBlob.
  18861. // Note: same reason as mentioned above as to why we use extractBody
  18862. const slicedBodyWithType = extractBody(slicedBlob)
  18863. // 10. Set response’s body to slicedBodyWithType’s body.
  18864. response.body = slicedBodyWithType[0]
  18865. // 11. Let serializedSlicedLength be slicedBlob’s size, serialized and isomorphic encoded.
  18866. const serializedSlicedLength = isomorphicEncode(`${slicedBlob.size}`)
  18867. // 12. Let contentRange be the result of invoking build a content range given rangeStart,
  18868. // rangeEnd, and fullLength.
  18869. const contentRange = buildContentRange(rangeStart, rangeEnd, fullLength)
  18870. // 13. Set response’s status to 206.
  18871. response.status = 206
  18872. // 14. Set response’s status message to `Partial Content`.
  18873. response.statusText = 'Partial Content'
  18874. // 15. Set response’s header list to « (`Content-Length`, serializedSlicedLength),
  18875. // (`Content-Type`, type), (`Content-Range`, contentRange) ».
  18876. response.headersList.set('content-length', serializedSlicedLength, true)
  18877. response.headersList.set('content-type', type, true)
  18878. response.headersList.set('content-range', contentRange, true)
  18879. }
  18880. // 10. Return response.
  18881. return Promise.resolve(response)
  18882. }
  18883. case 'data:': {
  18884. // 1. Let dataURLStruct be the result of running the
  18885. // data: URL processor on request’s current URL.
  18886. const currentURL = requestCurrentURL(request)
  18887. const dataURLStruct = dataURLProcessor(currentURL)
  18888. // 2. If dataURLStruct is failure, then return a
  18889. // network error.
  18890. if (dataURLStruct === 'failure') {
  18891. return Promise.resolve(makeNetworkError('failed to fetch the data URL'))
  18892. }
  18893. // 3. Let mimeType be dataURLStruct’s MIME type, serialized.
  18894. const mimeType = serializeAMimeType(dataURLStruct.mimeType)
  18895. // 4. Return a response whose status message is `OK`,
  18896. // header list is « (`Content-Type`, mimeType) »,
  18897. // and body is dataURLStruct’s body as a body.
  18898. return Promise.resolve(makeResponse({
  18899. statusText: 'OK',
  18900. headersList: [
  18901. ['content-type', { name: 'Content-Type', value: mimeType }]
  18902. ],
  18903. body: safelyExtractBody(dataURLStruct.body)[0]
  18904. }))
  18905. }
  18906. case 'file:': {
  18907. // For now, unfortunate as it is, file URLs are left as an exercise for the reader.
  18908. // When in doubt, return a network error.
  18909. return Promise.resolve(makeNetworkError('not implemented... yet...'))
  18910. }
  18911. case 'http:':
  18912. case 'https:': {
  18913. // Return the result of running HTTP fetch given fetchParams.
  18914. return httpFetch(fetchParams)
  18915. .catch((err) => makeNetworkError(err))
  18916. }
  18917. default: {
  18918. return Promise.resolve(makeNetworkError('unknown scheme'))
  18919. }
  18920. }
  18921. }
  18922. // https://fetch.spec.whatwg.org/#finalize-response
  18923. function finalizeResponse (fetchParams, response) {
  18924. // 1. Set fetchParams’s request’s done flag.
  18925. fetchParams.request.done = true
  18926. // 2, If fetchParams’s process response done is not null, then queue a fetch
  18927. // task to run fetchParams’s process response done given response, with
  18928. // fetchParams’s task destination.
  18929. if (fetchParams.processResponseDone != null) {
  18930. queueMicrotask(() => fetchParams.processResponseDone(response))
  18931. }
  18932. }
  18933. // https://fetch.spec.whatwg.org/#fetch-finale
  18934. function fetchFinale (fetchParams, response) {
  18935. // 1. Let timingInfo be fetchParams’s timing info.
  18936. let timingInfo = fetchParams.timingInfo
  18937. // 2. If response is not a network error and fetchParams’s request’s client is a secure context,
  18938. // then set timingInfo’s server-timing headers to the result of getting, decoding, and splitting
  18939. // `Server-Timing` from response’s internal response’s header list.
  18940. // TODO
  18941. // 3. Let processResponseEndOfBody be the following steps:
  18942. const processResponseEndOfBody = () => {
  18943. // 1. Let unsafeEndTime be the unsafe shared current time.
  18944. const unsafeEndTime = Date.now() // ?
  18945. // 2. If fetchParams’s request’s destination is "document", then set fetchParams’s controller’s
  18946. // full timing info to fetchParams’s timing info.
  18947. if (fetchParams.request.destination === 'document') {
  18948. fetchParams.controller.fullTimingInfo = timingInfo
  18949. }
  18950. // 3. Set fetchParams’s controller’s report timing steps to the following steps given a global object global:
  18951. fetchParams.controller.reportTimingSteps = () => {
  18952. // 1. If fetchParams’s request’s URL’s scheme is not an HTTP(S) scheme, then return.
  18953. if (fetchParams.request.url.protocol !== 'https:') {
  18954. return
  18955. }
  18956. // 2. Set timingInfo’s end time to the relative high resolution time given unsafeEndTime and global.
  18957. timingInfo.endTime = unsafeEndTime
  18958. // 3. Let cacheState be response’s cache state.
  18959. let cacheState = response.cacheState
  18960. // 4. Let bodyInfo be response’s body info.
  18961. const bodyInfo = response.bodyInfo
  18962. // 5. If response’s timing allow passed flag is not set, then set timingInfo to the result of creating an
  18963. // opaque timing info for timingInfo and set cacheState to the empty string.
  18964. if (!response.timingAllowPassed) {
  18965. timingInfo = createOpaqueTimingInfo(timingInfo)
  18966. cacheState = ''
  18967. }
  18968. // 6. Let responseStatus be 0.
  18969. let responseStatus = 0
  18970. // 7. If fetchParams’s request’s mode is not "navigate" or response’s has-cross-origin-redirects is false:
  18971. if (fetchParams.request.mode !== 'navigator' || !response.hasCrossOriginRedirects) {
  18972. // 1. Set responseStatus to response’s status.
  18973. responseStatus = response.status
  18974. // 2. Let mimeType be the result of extracting a MIME type from response’s header list.
  18975. const mimeType = extractMimeType(response.headersList)
  18976. // 3. If mimeType is not failure, then set bodyInfo’s content type to the result of minimizing a supported MIME type given mimeType.
  18977. if (mimeType !== 'failure') {
  18978. bodyInfo.contentType = minimizeSupportedMimeType(mimeType)
  18979. }
  18980. }
  18981. // 8. If fetchParams’s request’s initiator type is non-null, then mark resource timing given timingInfo,
  18982. // fetchParams’s request’s URL, fetchParams’s request’s initiator type, global, cacheState, bodyInfo,
  18983. // and responseStatus.
  18984. if (fetchParams.request.initiatorType != null) {
  18985. // TODO: update markresourcetiming
  18986. markResourceTiming(timingInfo, fetchParams.request.url.href, fetchParams.request.initiatorType, globalThis, cacheState, bodyInfo, responseStatus)
  18987. }
  18988. }
  18989. // 4. Let processResponseEndOfBodyTask be the following steps:
  18990. const processResponseEndOfBodyTask = () => {
  18991. // 1. Set fetchParams’s request’s done flag.
  18992. fetchParams.request.done = true
  18993. // 2. If fetchParams’s process response end-of-body is non-null, then run fetchParams’s process
  18994. // response end-of-body given response.
  18995. if (fetchParams.processResponseEndOfBody != null) {
  18996. queueMicrotask(() => fetchParams.processResponseEndOfBody(response))
  18997. }
  18998. // 3. If fetchParams’s request’s initiator type is non-null and fetchParams’s request’s client’s
  18999. // global object is fetchParams’s task destination, then run fetchParams’s controller’s report
  19000. // timing steps given fetchParams’s request’s client’s global object.
  19001. if (fetchParams.request.initiatorType != null) {
  19002. fetchParams.controller.reportTimingSteps()
  19003. }
  19004. }
  19005. // 5. Queue a fetch task to run processResponseEndOfBodyTask with fetchParams’s task destination
  19006. queueMicrotask(() => processResponseEndOfBodyTask())
  19007. }
  19008. // 4. If fetchParams’s process response is non-null, then queue a fetch task to run fetchParams’s
  19009. // process response given response, with fetchParams’s task destination.
  19010. if (fetchParams.processResponse != null) {
  19011. queueMicrotask(() => {
  19012. fetchParams.processResponse(response)
  19013. fetchParams.processResponse = null
  19014. })
  19015. }
  19016. // 5. Let internalResponse be response, if response is a network error; otherwise response’s internal response.
  19017. const internalResponse = response.type === 'error' ? response : (response.internalResponse ?? response)
  19018. // 6. If internalResponse’s body is null, then run processResponseEndOfBody.
  19019. // 7. Otherwise:
  19020. if (internalResponse.body == null) {
  19021. processResponseEndOfBody()
  19022. } else {
  19023. // mcollina: all the following steps of the specs are skipped.
  19024. // The internal transform stream is not needed.
  19025. // See https://github.com/nodejs/undici/pull/3093#issuecomment-2050198541
  19026. // 1. Let transformStream be a new TransformStream.
  19027. // 2. Let identityTransformAlgorithm be an algorithm which, given chunk, enqueues chunk in transformStream.
  19028. // 3. Set up transformStream with transformAlgorithm set to identityTransformAlgorithm and flushAlgorithm
  19029. // set to processResponseEndOfBody.
  19030. // 4. Set internalResponse’s body’s stream to the result of internalResponse’s body’s stream piped through transformStream.
  19031. finished(internalResponse.body.stream, () => {
  19032. processResponseEndOfBody()
  19033. })
  19034. }
  19035. }
  19036. // https://fetch.spec.whatwg.org/#http-fetch
  19037. async function httpFetch (fetchParams) {
  19038. // 1. Let request be fetchParams’s request.
  19039. const request = fetchParams.request
  19040. // 2. Let response be null.
  19041. let response = null
  19042. // 3. Let actualResponse be null.
  19043. let actualResponse = null
  19044. // 4. Let timingInfo be fetchParams’s timing info.
  19045. const timingInfo = fetchParams.timingInfo
  19046. // 5. If request’s service-workers mode is "all", then:
  19047. if (request.serviceWorkers === 'all') {
  19048. // TODO
  19049. }
  19050. // 6. If response is null, then:
  19051. if (response === null) {
  19052. // 1. If makeCORSPreflight is true and one of these conditions is true:
  19053. // TODO
  19054. // 2. If request’s redirect mode is "follow", then set request’s
  19055. // service-workers mode to "none".
  19056. if (request.redirect === 'follow') {
  19057. request.serviceWorkers = 'none'
  19058. }
  19059. // 3. Set response and actualResponse to the result of running
  19060. // HTTP-network-or-cache fetch given fetchParams.
  19061. actualResponse = response = await httpNetworkOrCacheFetch(fetchParams)
  19062. // 4. If request’s response tainting is "cors" and a CORS check
  19063. // for request and response returns failure, then return a network error.
  19064. if (
  19065. request.responseTainting === 'cors' &&
  19066. corsCheck(request, response) === 'failure'
  19067. ) {
  19068. return makeNetworkError('cors failure')
  19069. }
  19070. // 5. If the TAO check for request and response returns failure, then set
  19071. // request’s timing allow failed flag.
  19072. if (TAOCheck(request, response) === 'failure') {
  19073. request.timingAllowFailed = true
  19074. }
  19075. }
  19076. // 7. If either request’s response tainting or response’s type
  19077. // is "opaque", and the cross-origin resource policy check with
  19078. // request’s origin, request’s client, request’s destination,
  19079. // and actualResponse returns blocked, then return a network error.
  19080. if (
  19081. (request.responseTainting === 'opaque' || response.type === 'opaque') &&
  19082. crossOriginResourcePolicyCheck(
  19083. request.origin,
  19084. request.client,
  19085. request.destination,
  19086. actualResponse
  19087. ) === 'blocked'
  19088. ) {
  19089. return makeNetworkError('blocked')
  19090. }
  19091. // 8. If actualResponse’s status is a redirect status, then:
  19092. if (redirectStatusSet.has(actualResponse.status)) {
  19093. // 1. If actualResponse’s status is not 303, request’s body is not null,
  19094. // and the connection uses HTTP/2, then user agents may, and are even
  19095. // encouraged to, transmit an RST_STREAM frame.
  19096. // See, https://github.com/whatwg/fetch/issues/1288
  19097. if (request.redirect !== 'manual') {
  19098. fetchParams.controller.connection.destroy(undefined, false)
  19099. }
  19100. // 2. Switch on request’s redirect mode:
  19101. if (request.redirect === 'error') {
  19102. // Set response to a network error.
  19103. response = makeNetworkError('unexpected redirect')
  19104. } else if (request.redirect === 'manual') {
  19105. // Set response to an opaque-redirect filtered response whose internal
  19106. // response is actualResponse.
  19107. // NOTE(spec): On the web this would return an `opaqueredirect` response,
  19108. // but that doesn't make sense server side.
  19109. // See https://github.com/nodejs/undici/issues/1193.
  19110. response = actualResponse
  19111. } else if (request.redirect === 'follow') {
  19112. // Set response to the result of running HTTP-redirect fetch given
  19113. // fetchParams and response.
  19114. response = await httpRedirectFetch(fetchParams, response)
  19115. } else {
  19116. assert(false)
  19117. }
  19118. }
  19119. // 9. Set response’s timing info to timingInfo.
  19120. response.timingInfo = timingInfo
  19121. // 10. Return response.
  19122. return response
  19123. }
  19124. // https://fetch.spec.whatwg.org/#http-redirect-fetch
  19125. function httpRedirectFetch (fetchParams, response) {
  19126. // 1. Let request be fetchParams’s request.
  19127. const request = fetchParams.request
  19128. // 2. Let actualResponse be response, if response is not a filtered response,
  19129. // and response’s internal response otherwise.
  19130. const actualResponse = response.internalResponse
  19131. ? response.internalResponse
  19132. : response
  19133. // 3. Let locationURL be actualResponse’s location URL given request’s current
  19134. // URL’s fragment.
  19135. let locationURL
  19136. try {
  19137. locationURL = responseLocationURL(
  19138. actualResponse,
  19139. requestCurrentURL(request).hash
  19140. )
  19141. // 4. If locationURL is null, then return response.
  19142. if (locationURL == null) {
  19143. return response
  19144. }
  19145. } catch (err) {
  19146. // 5. If locationURL is failure, then return a network error.
  19147. return Promise.resolve(makeNetworkError(err))
  19148. }
  19149. // 6. If locationURL’s scheme is not an HTTP(S) scheme, then return a network
  19150. // error.
  19151. if (!urlIsHttpHttpsScheme(locationURL)) {
  19152. return Promise.resolve(makeNetworkError('URL scheme must be a HTTP(S) scheme'))
  19153. }
  19154. // 7. If request’s redirect count is 20, then return a network error.
  19155. if (request.redirectCount === 20) {
  19156. return Promise.resolve(makeNetworkError('redirect count exceeded'))
  19157. }
  19158. // 8. Increase request’s redirect count by 1.
  19159. request.redirectCount += 1
  19160. // 9. If request’s mode is "cors", locationURL includes credentials, and
  19161. // request’s origin is not same origin with locationURL’s origin, then return
  19162. // a network error.
  19163. if (
  19164. request.mode === 'cors' &&
  19165. (locationURL.username || locationURL.password) &&
  19166. !sameOrigin(request, locationURL)
  19167. ) {
  19168. return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"'))
  19169. }
  19170. // 10. If request’s response tainting is "cors" and locationURL includes
  19171. // credentials, then return a network error.
  19172. if (
  19173. request.responseTainting === 'cors' &&
  19174. (locationURL.username || locationURL.password)
  19175. ) {
  19176. return Promise.resolve(makeNetworkError(
  19177. 'URL cannot contain credentials for request mode "cors"'
  19178. ))
  19179. }
  19180. // 11. If actualResponse’s status is not 303, request’s body is non-null,
  19181. // and request’s body’s source is null, then return a network error.
  19182. if (
  19183. actualResponse.status !== 303 &&
  19184. request.body != null &&
  19185. request.body.source == null
  19186. ) {
  19187. return Promise.resolve(makeNetworkError())
  19188. }
  19189. // 12. If one of the following is true
  19190. // - actualResponse’s status is 301 or 302 and request’s method is `POST`
  19191. // - actualResponse’s status is 303 and request’s method is not `GET` or `HEAD`
  19192. if (
  19193. ([301, 302].includes(actualResponse.status) && request.method === 'POST') ||
  19194. (actualResponse.status === 303 &&
  19195. !GET_OR_HEAD.includes(request.method))
  19196. ) {
  19197. // then:
  19198. // 1. Set request’s method to `GET` and request’s body to null.
  19199. request.method = 'GET'
  19200. request.body = null
  19201. // 2. For each headerName of request-body-header name, delete headerName from
  19202. // request’s header list.
  19203. for (const headerName of requestBodyHeader) {
  19204. request.headersList.delete(headerName)
  19205. }
  19206. }
  19207. // 13. If request’s current URL’s origin is not same origin with locationURL’s
  19208. // origin, then for each headerName of CORS non-wildcard request-header name,
  19209. // delete headerName from request’s header list.
  19210. if (!sameOrigin(requestCurrentURL(request), locationURL)) {
  19211. // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
  19212. request.headersList.delete('authorization', true)
  19213. // https://fetch.spec.whatwg.org/#authentication-entries
  19214. request.headersList.delete('proxy-authorization', true)
  19215. // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
  19216. request.headersList.delete('cookie', true)
  19217. request.headersList.delete('host', true)
  19218. }
  19219. // 14. If request’s body is non-null, then set request’s body to the first return
  19220. // value of safely extracting request’s body’s source.
  19221. if (request.body != null) {
  19222. assert(request.body.source != null)
  19223. request.body = safelyExtractBody(request.body.source)[0]
  19224. }
  19225. // 15. Let timingInfo be fetchParams’s timing info.
  19226. const timingInfo = fetchParams.timingInfo
  19227. // 16. Set timingInfo’s redirect end time and post-redirect start time to the
  19228. // coarsened shared current time given fetchParams’s cross-origin isolated
  19229. // capability.
  19230. timingInfo.redirectEndTime = timingInfo.postRedirectStartTime =
  19231. coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
  19232. // 17. If timingInfo’s redirect start time is 0, then set timingInfo’s
  19233. // redirect start time to timingInfo’s start time.
  19234. if (timingInfo.redirectStartTime === 0) {
  19235. timingInfo.redirectStartTime = timingInfo.startTime
  19236. }
  19237. // 18. Append locationURL to request’s URL list.
  19238. request.urlList.push(locationURL)
  19239. // 19. Invoke set request’s referrer policy on redirect on request and
  19240. // actualResponse.
  19241. setRequestReferrerPolicyOnRedirect(request, actualResponse)
  19242. // 20. Return the result of running main fetch given fetchParams and true.
  19243. return mainFetch(fetchParams, true)
  19244. }
  19245. // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch
  19246. async function httpNetworkOrCacheFetch (
  19247. fetchParams,
  19248. isAuthenticationFetch = false,
  19249. isNewConnectionFetch = false
  19250. ) {
  19251. // 1. Let request be fetchParams’s request.
  19252. const request = fetchParams.request
  19253. // 2. Let httpFetchParams be null.
  19254. let httpFetchParams = null
  19255. // 3. Let httpRequest be null.
  19256. let httpRequest = null
  19257. // 4. Let response be null.
  19258. let response = null
  19259. // 5. Let storedResponse be null.
  19260. // TODO: cache
  19261. // 6. Let httpCache be null.
  19262. const httpCache = null
  19263. // 7. Let the revalidatingFlag be unset.
  19264. const revalidatingFlag = false
  19265. // 8. Run these steps, but abort when the ongoing fetch is terminated:
  19266. // 1. If request’s window is "no-window" and request’s redirect mode is
  19267. // "error", then set httpFetchParams to fetchParams and httpRequest to
  19268. // request.
  19269. if (request.window === 'no-window' && request.redirect === 'error') {
  19270. httpFetchParams = fetchParams
  19271. httpRequest = request
  19272. } else {
  19273. // Otherwise:
  19274. // 1. Set httpRequest to a clone of request.
  19275. httpRequest = cloneRequest(request)
  19276. // 2. Set httpFetchParams to a copy of fetchParams.
  19277. httpFetchParams = { ...fetchParams }
  19278. // 3. Set httpFetchParams’s request to httpRequest.
  19279. httpFetchParams.request = httpRequest
  19280. }
  19281. // 3. Let includeCredentials be true if one of
  19282. const includeCredentials =
  19283. request.credentials === 'include' ||
  19284. (request.credentials === 'same-origin' &&
  19285. request.responseTainting === 'basic')
  19286. // 4. Let contentLength be httpRequest’s body’s length, if httpRequest’s
  19287. // body is non-null; otherwise null.
  19288. const contentLength = httpRequest.body ? httpRequest.body.length : null
  19289. // 5. Let contentLengthHeaderValue be null.
  19290. let contentLengthHeaderValue = null
  19291. // 6. If httpRequest’s body is null and httpRequest’s method is `POST` or
  19292. // `PUT`, then set contentLengthHeaderValue to `0`.
  19293. if (
  19294. httpRequest.body == null &&
  19295. ['POST', 'PUT'].includes(httpRequest.method)
  19296. ) {
  19297. contentLengthHeaderValue = '0'
  19298. }
  19299. // 7. If contentLength is non-null, then set contentLengthHeaderValue to
  19300. // contentLength, serialized and isomorphic encoded.
  19301. if (contentLength != null) {
  19302. contentLengthHeaderValue = isomorphicEncode(`${contentLength}`)
  19303. }
  19304. // 8. If contentLengthHeaderValue is non-null, then append
  19305. // `Content-Length`/contentLengthHeaderValue to httpRequest’s header
  19306. // list.
  19307. if (contentLengthHeaderValue != null) {
  19308. httpRequest.headersList.append('content-length', contentLengthHeaderValue, true)
  19309. }
  19310. // 9. If contentLengthHeaderValue is non-null, then append (`Content-Length`,
  19311. // contentLengthHeaderValue) to httpRequest’s header list.
  19312. // 10. If contentLength is non-null and httpRequest’s keepalive is true,
  19313. // then:
  19314. if (contentLength != null && httpRequest.keepalive) {
  19315. // NOTE: keepalive is a noop outside of browser context.
  19316. }
  19317. // 11. If httpRequest’s referrer is a URL, then append
  19318. // `Referer`/httpRequest’s referrer, serialized and isomorphic encoded,
  19319. // to httpRequest’s header list.
  19320. if (httpRequest.referrer instanceof URL) {
  19321. httpRequest.headersList.append('referer', isomorphicEncode(httpRequest.referrer.href), true)
  19322. }
  19323. // 12. Append a request `Origin` header for httpRequest.
  19324. appendRequestOriginHeader(httpRequest)
  19325. // 13. Append the Fetch metadata headers for httpRequest. [FETCH-METADATA]
  19326. appendFetchMetadata(httpRequest)
  19327. // 14. If httpRequest’s header list does not contain `User-Agent`, then
  19328. // user agents should append `User-Agent`/default `User-Agent` value to
  19329. // httpRequest’s header list.
  19330. if (!httpRequest.headersList.contains('user-agent', true)) {
  19331. httpRequest.headersList.append('user-agent', defaultUserAgent)
  19332. }
  19333. // 15. If httpRequest’s cache mode is "default" and httpRequest’s header
  19334. // list contains `If-Modified-Since`, `If-None-Match`,
  19335. // `If-Unmodified-Since`, `If-Match`, or `If-Range`, then set
  19336. // httpRequest’s cache mode to "no-store".
  19337. if (
  19338. httpRequest.cache === 'default' &&
  19339. (httpRequest.headersList.contains('if-modified-since', true) ||
  19340. httpRequest.headersList.contains('if-none-match', true) ||
  19341. httpRequest.headersList.contains('if-unmodified-since', true) ||
  19342. httpRequest.headersList.contains('if-match', true) ||
  19343. httpRequest.headersList.contains('if-range', true))
  19344. ) {
  19345. httpRequest.cache = 'no-store'
  19346. }
  19347. // 16. If httpRequest’s cache mode is "no-cache", httpRequest’s prevent
  19348. // no-cache cache-control header modification flag is unset, and
  19349. // httpRequest’s header list does not contain `Cache-Control`, then append
  19350. // `Cache-Control`/`max-age=0` to httpRequest’s header list.
  19351. if (
  19352. httpRequest.cache === 'no-cache' &&
  19353. !httpRequest.preventNoCacheCacheControlHeaderModification &&
  19354. !httpRequest.headersList.contains('cache-control', true)
  19355. ) {
  19356. httpRequest.headersList.append('cache-control', 'max-age=0', true)
  19357. }
  19358. // 17. If httpRequest’s cache mode is "no-store" or "reload", then:
  19359. if (httpRequest.cache === 'no-store' || httpRequest.cache === 'reload') {
  19360. // 1. If httpRequest’s header list does not contain `Pragma`, then append
  19361. // `Pragma`/`no-cache` to httpRequest’s header list.
  19362. if (!httpRequest.headersList.contains('pragma', true)) {
  19363. httpRequest.headersList.append('pragma', 'no-cache', true)
  19364. }
  19365. // 2. If httpRequest’s header list does not contain `Cache-Control`,
  19366. // then append `Cache-Control`/`no-cache` to httpRequest’s header list.
  19367. if (!httpRequest.headersList.contains('cache-control', true)) {
  19368. httpRequest.headersList.append('cache-control', 'no-cache', true)
  19369. }
  19370. }
  19371. // 18. If httpRequest’s header list contains `Range`, then append
  19372. // `Accept-Encoding`/`identity` to httpRequest’s header list.
  19373. if (httpRequest.headersList.contains('range', true)) {
  19374. httpRequest.headersList.append('accept-encoding', 'identity', true)
  19375. }
  19376. // 19. Modify httpRequest’s header list per HTTP. Do not append a given
  19377. // header if httpRequest’s header list contains that header’s name.
  19378. // TODO: https://github.com/whatwg/fetch/issues/1285#issuecomment-896560129
  19379. if (!httpRequest.headersList.contains('accept-encoding', true)) {
  19380. if (urlHasHttpsScheme(requestCurrentURL(httpRequest))) {
  19381. httpRequest.headersList.append('accept-encoding', 'br, gzip, deflate', true)
  19382. } else {
  19383. httpRequest.headersList.append('accept-encoding', 'gzip, deflate', true)
  19384. }
  19385. }
  19386. httpRequest.headersList.delete('host', true)
  19387. // 20. If includeCredentials is true, then:
  19388. if (includeCredentials) {
  19389. // 1. If the user agent is not configured to block cookies for httpRequest
  19390. // (see section 7 of [COOKIES]), then:
  19391. // TODO: credentials
  19392. // 2. If httpRequest’s header list does not contain `Authorization`, then:
  19393. // TODO: credentials
  19394. }
  19395. // 21. If there’s a proxy-authentication entry, use it as appropriate.
  19396. // TODO: proxy-authentication
  19397. // 22. Set httpCache to the result of determining the HTTP cache
  19398. // partition, given httpRequest.
  19399. // TODO: cache
  19400. // 23. If httpCache is null, then set httpRequest’s cache mode to
  19401. // "no-store".
  19402. if (httpCache == null) {
  19403. httpRequest.cache = 'no-store'
  19404. }
  19405. // 24. If httpRequest’s cache mode is neither "no-store" nor "reload",
  19406. // then:
  19407. if (httpRequest.cache !== 'no-store' && httpRequest.cache !== 'reload') {
  19408. // TODO: cache
  19409. }
  19410. // 9. If aborted, then return the appropriate network error for fetchParams.
  19411. // TODO
  19412. // 10. If response is null, then:
  19413. if (response == null) {
  19414. // 1. If httpRequest’s cache mode is "only-if-cached", then return a
  19415. // network error.
  19416. if (httpRequest.cache === 'only-if-cached') {
  19417. return makeNetworkError('only if cached')
  19418. }
  19419. // 2. Let forwardResponse be the result of running HTTP-network fetch
  19420. // given httpFetchParams, includeCredentials, and isNewConnectionFetch.
  19421. const forwardResponse = await httpNetworkFetch(
  19422. httpFetchParams,
  19423. includeCredentials,
  19424. isNewConnectionFetch
  19425. )
  19426. // 3. If httpRequest’s method is unsafe and forwardResponse’s status is
  19427. // in the range 200 to 399, inclusive, invalidate appropriate stored
  19428. // responses in httpCache, as per the "Invalidation" chapter of HTTP
  19429. // Caching, and set storedResponse to null. [HTTP-CACHING]
  19430. if (
  19431. !safeMethodsSet.has(httpRequest.method) &&
  19432. forwardResponse.status >= 200 &&
  19433. forwardResponse.status <= 399
  19434. ) {
  19435. // TODO: cache
  19436. }
  19437. // 4. If the revalidatingFlag is set and forwardResponse’s status is 304,
  19438. // then:
  19439. if (revalidatingFlag && forwardResponse.status === 304) {
  19440. // TODO: cache
  19441. }
  19442. // 5. If response is null, then:
  19443. if (response == null) {
  19444. // 1. Set response to forwardResponse.
  19445. response = forwardResponse
  19446. // 2. Store httpRequest and forwardResponse in httpCache, as per the
  19447. // "Storing Responses in Caches" chapter of HTTP Caching. [HTTP-CACHING]
  19448. // TODO: cache
  19449. }
  19450. }
  19451. // 11. Set response’s URL list to a clone of httpRequest’s URL list.
  19452. response.urlList = [...httpRequest.urlList]
  19453. // 12. If httpRequest’s header list contains `Range`, then set response’s
  19454. // range-requested flag.
  19455. if (httpRequest.headersList.contains('range', true)) {
  19456. response.rangeRequested = true
  19457. }
  19458. // 13. Set response’s request-includes-credentials to includeCredentials.
  19459. response.requestIncludesCredentials = includeCredentials
  19460. // 14. If response’s status is 401, httpRequest’s response tainting is not
  19461. // "cors", includeCredentials is true, and request’s window is an environment
  19462. // settings object, then:
  19463. // TODO
  19464. // 15. If response’s status is 407, then:
  19465. if (response.status === 407) {
  19466. // 1. If request’s window is "no-window", then return a network error.
  19467. if (request.window === 'no-window') {
  19468. return makeNetworkError()
  19469. }
  19470. // 2. ???
  19471. // 3. If fetchParams is canceled, then return the appropriate network error for fetchParams.
  19472. if (isCancelled(fetchParams)) {
  19473. return makeAppropriateNetworkError(fetchParams)
  19474. }
  19475. // 4. Prompt the end user as appropriate in request’s window and store
  19476. // the result as a proxy-authentication entry. [HTTP-AUTH]
  19477. // TODO: Invoke some kind of callback?
  19478. // 5. Set response to the result of running HTTP-network-or-cache fetch given
  19479. // fetchParams.
  19480. // TODO
  19481. return makeNetworkError('proxy authentication required')
  19482. }
  19483. // 16. If all of the following are true
  19484. if (
  19485. // response’s status is 421
  19486. response.status === 421 &&
  19487. // isNewConnectionFetch is false
  19488. !isNewConnectionFetch &&
  19489. // request’s body is null, or request’s body is non-null and request’s body’s source is non-null
  19490. (request.body == null || request.body.source != null)
  19491. ) {
  19492. // then:
  19493. // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
  19494. if (isCancelled(fetchParams)) {
  19495. return makeAppropriateNetworkError(fetchParams)
  19496. }
  19497. // 2. Set response to the result of running HTTP-network-or-cache
  19498. // fetch given fetchParams, isAuthenticationFetch, and true.
  19499. // TODO (spec): The spec doesn't specify this but we need to cancel
  19500. // the active response before we can start a new one.
  19501. // https://github.com/whatwg/fetch/issues/1293
  19502. fetchParams.controller.connection.destroy()
  19503. response = await httpNetworkOrCacheFetch(
  19504. fetchParams,
  19505. isAuthenticationFetch,
  19506. true
  19507. )
  19508. }
  19509. // 17. If isAuthenticationFetch is true, then create an authentication entry
  19510. if (isAuthenticationFetch) {
  19511. // TODO
  19512. }
  19513. // 18. Return response.
  19514. return response
  19515. }
  19516. // https://fetch.spec.whatwg.org/#http-network-fetch
  19517. async function httpNetworkFetch (
  19518. fetchParams,
  19519. includeCredentials = false,
  19520. forceNewConnection = false
  19521. ) {
  19522. assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed)
  19523. fetchParams.controller.connection = {
  19524. abort: null,
  19525. destroyed: false,
  19526. destroy (err, abort = true) {
  19527. if (!this.destroyed) {
  19528. this.destroyed = true
  19529. if (abort) {
  19530. this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError'))
  19531. }
  19532. }
  19533. }
  19534. }
  19535. // 1. Let request be fetchParams’s request.
  19536. const request = fetchParams.request
  19537. // 2. Let response be null.
  19538. let response = null
  19539. // 3. Let timingInfo be fetchParams’s timing info.
  19540. const timingInfo = fetchParams.timingInfo
  19541. // 4. Let httpCache be the result of determining the HTTP cache partition,
  19542. // given request.
  19543. // TODO: cache
  19544. const httpCache = null
  19545. // 5. If httpCache is null, then set request’s cache mode to "no-store".
  19546. if (httpCache == null) {
  19547. request.cache = 'no-store'
  19548. }
  19549. // 6. Let networkPartitionKey be the result of determining the network
  19550. // partition key given request.
  19551. // TODO
  19552. // 7. Let newConnection be "yes" if forceNewConnection is true; otherwise
  19553. // "no".
  19554. const newConnection = forceNewConnection ? 'yes' : 'no' // eslint-disable-line no-unused-vars
  19555. // 8. Switch on request’s mode:
  19556. if (request.mode === 'websocket') {
  19557. // Let connection be the result of obtaining a WebSocket connection,
  19558. // given request’s current URL.
  19559. // TODO
  19560. } else {
  19561. // Let connection be the result of obtaining a connection, given
  19562. // networkPartitionKey, request’s current URL’s origin,
  19563. // includeCredentials, and forceNewConnection.
  19564. // TODO
  19565. }
  19566. // 9. Run these steps, but abort when the ongoing fetch is terminated:
  19567. // 1. If connection is failure, then return a network error.
  19568. // 2. Set timingInfo’s final connection timing info to the result of
  19569. // calling clamp and coarsen connection timing info with connection’s
  19570. // timing info, timingInfo’s post-redirect start time, and fetchParams’s
  19571. // cross-origin isolated capability.
  19572. // 3. If connection is not an HTTP/2 connection, request’s body is non-null,
  19573. // and request’s body’s source is null, then append (`Transfer-Encoding`,
  19574. // `chunked`) to request’s header list.
  19575. // 4. Set timingInfo’s final network-request start time to the coarsened
  19576. // shared current time given fetchParams’s cross-origin isolated
  19577. // capability.
  19578. // 5. Set response to the result of making an HTTP request over connection
  19579. // using request with the following caveats:
  19580. // - Follow the relevant requirements from HTTP. [HTTP] [HTTP-SEMANTICS]
  19581. // [HTTP-COND] [HTTP-CACHING] [HTTP-AUTH]
  19582. // - If request’s body is non-null, and request’s body’s source is null,
  19583. // then the user agent may have a buffer of up to 64 kibibytes and store
  19584. // a part of request’s body in that buffer. If the user agent reads from
  19585. // request’s body beyond that buffer’s size and the user agent needs to
  19586. // resend request, then instead return a network error.
  19587. // - Set timingInfo’s final network-response start time to the coarsened
  19588. // shared current time given fetchParams’s cross-origin isolated capability,
  19589. // immediately after the user agent’s HTTP parser receives the first byte
  19590. // of the response (e.g., frame header bytes for HTTP/2 or response status
  19591. // line for HTTP/1.x).
  19592. // - Wait until all the headers are transmitted.
  19593. // - Any responses whose status is in the range 100 to 199, inclusive,
  19594. // and is not 101, are to be ignored, except for the purposes of setting
  19595. // timingInfo’s final network-response start time above.
  19596. // - If request’s header list contains `Transfer-Encoding`/`chunked` and
  19597. // response is transferred via HTTP/1.0 or older, then return a network
  19598. // error.
  19599. // - If the HTTP request results in a TLS client certificate dialog, then:
  19600. // 1. If request’s window is an environment settings object, make the
  19601. // dialog available in request’s window.
  19602. // 2. Otherwise, return a network error.
  19603. // To transmit request’s body body, run these steps:
  19604. let requestBody = null
  19605. // 1. If body is null and fetchParams’s process request end-of-body is
  19606. // non-null, then queue a fetch task given fetchParams’s process request
  19607. // end-of-body and fetchParams’s task destination.
  19608. if (request.body == null && fetchParams.processRequestEndOfBody) {
  19609. queueMicrotask(() => fetchParams.processRequestEndOfBody())
  19610. } else if (request.body != null) {
  19611. // 2. Otherwise, if body is non-null:
  19612. // 1. Let processBodyChunk given bytes be these steps:
  19613. const processBodyChunk = async function * (bytes) {
  19614. // 1. If the ongoing fetch is terminated, then abort these steps.
  19615. if (isCancelled(fetchParams)) {
  19616. return
  19617. }
  19618. // 2. Run this step in parallel: transmit bytes.
  19619. yield bytes
  19620. // 3. If fetchParams’s process request body is non-null, then run
  19621. // fetchParams’s process request body given bytes’s length.
  19622. fetchParams.processRequestBodyChunkLength?.(bytes.byteLength)
  19623. }
  19624. // 2. Let processEndOfBody be these steps:
  19625. const processEndOfBody = () => {
  19626. // 1. If fetchParams is canceled, then abort these steps.
  19627. if (isCancelled(fetchParams)) {
  19628. return
  19629. }
  19630. // 2. If fetchParams’s process request end-of-body is non-null,
  19631. // then run fetchParams’s process request end-of-body.
  19632. if (fetchParams.processRequestEndOfBody) {
  19633. fetchParams.processRequestEndOfBody()
  19634. }
  19635. }
  19636. // 3. Let processBodyError given e be these steps:
  19637. const processBodyError = (e) => {
  19638. // 1. If fetchParams is canceled, then abort these steps.
  19639. if (isCancelled(fetchParams)) {
  19640. return
  19641. }
  19642. // 2. If e is an "AbortError" DOMException, then abort fetchParams’s controller.
  19643. if (e.name === 'AbortError') {
  19644. fetchParams.controller.abort()
  19645. } else {
  19646. fetchParams.controller.terminate(e)
  19647. }
  19648. }
  19649. // 4. Incrementally read request’s body given processBodyChunk, processEndOfBody,
  19650. // processBodyError, and fetchParams’s task destination.
  19651. requestBody = (async function * () {
  19652. try {
  19653. for await (const bytes of request.body.stream) {
  19654. yield * processBodyChunk(bytes)
  19655. }
  19656. processEndOfBody()
  19657. } catch (err) {
  19658. processBodyError(err)
  19659. }
  19660. })()
  19661. }
  19662. try {
  19663. // socket is only provided for websockets
  19664. const { body, status, statusText, headersList, socket } = await dispatch({ body: requestBody })
  19665. if (socket) {
  19666. response = makeResponse({ status, statusText, headersList, socket })
  19667. } else {
  19668. const iterator = body[Symbol.asyncIterator]()
  19669. fetchParams.controller.next = () => iterator.next()
  19670. response = makeResponse({ status, statusText, headersList })
  19671. }
  19672. } catch (err) {
  19673. // 10. If aborted, then:
  19674. if (err.name === 'AbortError') {
  19675. // 1. If connection uses HTTP/2, then transmit an RST_STREAM frame.
  19676. fetchParams.controller.connection.destroy()
  19677. // 2. Return the appropriate network error for fetchParams.
  19678. return makeAppropriateNetworkError(fetchParams, err)
  19679. }
  19680. return makeNetworkError(err)
  19681. }
  19682. // 11. Let pullAlgorithm be an action that resumes the ongoing fetch
  19683. // if it is suspended.
  19684. const pullAlgorithm = async () => {
  19685. await fetchParams.controller.resume()
  19686. }
  19687. // 12. Let cancelAlgorithm be an algorithm that aborts fetchParams’s
  19688. // controller with reason, given reason.
  19689. const cancelAlgorithm = (reason) => {
  19690. // If the aborted fetch was already terminated, then we do not
  19691. // need to do anything.
  19692. if (!isCancelled(fetchParams)) {
  19693. fetchParams.controller.abort(reason)
  19694. }
  19695. }
  19696. // 13. Let highWaterMark be a non-negative, non-NaN number, chosen by
  19697. // the user agent.
  19698. // TODO
  19699. // 14. Let sizeAlgorithm be an algorithm that accepts a chunk object
  19700. // and returns a non-negative, non-NaN, non-infinite number, chosen by the user agent.
  19701. // TODO
  19702. // 15. Let stream be a new ReadableStream.
  19703. // 16. Set up stream with byte reading support with pullAlgorithm set to pullAlgorithm,
  19704. // cancelAlgorithm set to cancelAlgorithm.
  19705. const stream = new ReadableStream(
  19706. {
  19707. async start (controller) {
  19708. fetchParams.controller.controller = controller
  19709. },
  19710. async pull (controller) {
  19711. await pullAlgorithm(controller)
  19712. },
  19713. async cancel (reason) {
  19714. await cancelAlgorithm(reason)
  19715. },
  19716. type: 'bytes'
  19717. }
  19718. )
  19719. // 17. Run these steps, but abort when the ongoing fetch is terminated:
  19720. // 1. Set response’s body to a new body whose stream is stream.
  19721. response.body = { stream, source: null, length: null }
  19722. // 2. If response is not a network error and request’s cache mode is
  19723. // not "no-store", then update response in httpCache for request.
  19724. // TODO
  19725. // 3. If includeCredentials is true and the user agent is not configured
  19726. // to block cookies for request (see section 7 of [COOKIES]), then run the
  19727. // "set-cookie-string" parsing algorithm (see section 5.2 of [COOKIES]) on
  19728. // the value of each header whose name is a byte-case-insensitive match for
  19729. // `Set-Cookie` in response’s header list, if any, and request’s current URL.
  19730. // TODO
  19731. // 18. If aborted, then:
  19732. // TODO
  19733. // 19. Run these steps in parallel:
  19734. // 1. Run these steps, but abort when fetchParams is canceled:
  19735. fetchParams.controller.onAborted = onAborted
  19736. fetchParams.controller.on('terminated', onAborted)
  19737. fetchParams.controller.resume = async () => {
  19738. // 1. While true
  19739. while (true) {
  19740. // 1-3. See onData...
  19741. // 4. Set bytes to the result of handling content codings given
  19742. // codings and bytes.
  19743. let bytes
  19744. let isFailure
  19745. try {
  19746. const { done, value } = await fetchParams.controller.next()
  19747. if (isAborted(fetchParams)) {
  19748. break
  19749. }
  19750. bytes = done ? undefined : value
  19751. } catch (err) {
  19752. if (fetchParams.controller.ended && !timingInfo.encodedBodySize) {
  19753. // zlib doesn't like empty streams.
  19754. bytes = undefined
  19755. } else {
  19756. bytes = err
  19757. // err may be propagated from the result of calling readablestream.cancel,
  19758. // which might not be an error. https://github.com/nodejs/undici/issues/2009
  19759. isFailure = true
  19760. }
  19761. }
  19762. if (bytes === undefined) {
  19763. // 2. Otherwise, if the bytes transmission for response’s message
  19764. // body is done normally and stream is readable, then close
  19765. // stream, finalize response for fetchParams and response, and
  19766. // abort these in-parallel steps.
  19767. readableStreamClose(fetchParams.controller.controller)
  19768. finalizeResponse(fetchParams, response)
  19769. return
  19770. }
  19771. // 5. Increase timingInfo’s decoded body size by bytes’s length.
  19772. timingInfo.decodedBodySize += bytes?.byteLength ?? 0
  19773. // 6. If bytes is failure, then terminate fetchParams’s controller.
  19774. if (isFailure) {
  19775. fetchParams.controller.terminate(bytes)
  19776. return
  19777. }
  19778. // 7. Enqueue a Uint8Array wrapping an ArrayBuffer containing bytes
  19779. // into stream.
  19780. const buffer = new Uint8Array(bytes)
  19781. if (buffer.byteLength) {
  19782. fetchParams.controller.controller.enqueue(buffer)
  19783. }
  19784. // 8. If stream is errored, then terminate the ongoing fetch.
  19785. if (isErrored(stream)) {
  19786. fetchParams.controller.terminate()
  19787. return
  19788. }
  19789. // 9. If stream doesn’t need more data ask the user agent to suspend
  19790. // the ongoing fetch.
  19791. if (fetchParams.controller.controller.desiredSize <= 0) {
  19792. return
  19793. }
  19794. }
  19795. }
  19796. // 2. If aborted, then:
  19797. function onAborted (reason) {
  19798. // 2. If fetchParams is aborted, then:
  19799. if (isAborted(fetchParams)) {
  19800. // 1. Set response’s aborted flag.
  19801. response.aborted = true
  19802. // 2. If stream is readable, then error stream with the result of
  19803. // deserialize a serialized abort reason given fetchParams’s
  19804. // controller’s serialized abort reason and an
  19805. // implementation-defined realm.
  19806. if (isReadable(stream)) {
  19807. fetchParams.controller.controller.error(
  19808. fetchParams.controller.serializedAbortReason
  19809. )
  19810. }
  19811. } else {
  19812. // 3. Otherwise, if stream is readable, error stream with a TypeError.
  19813. if (isReadable(stream)) {
  19814. fetchParams.controller.controller.error(new TypeError('terminated', {
  19815. cause: isErrorLike(reason) ? reason : undefined
  19816. }))
  19817. }
  19818. }
  19819. // 4. If connection uses HTTP/2, then transmit an RST_STREAM frame.
  19820. // 5. Otherwise, the user agent should close connection unless it would be bad for performance to do so.
  19821. fetchParams.controller.connection.destroy()
  19822. }
  19823. // 20. Return response.
  19824. return response
  19825. function dispatch ({ body }) {
  19826. const url = requestCurrentURL(request)
  19827. /** @type {import('../..').Agent} */
  19828. const agent = fetchParams.controller.dispatcher
  19829. return new Promise((resolve, reject) => agent.dispatch(
  19830. {
  19831. path: url.pathname + url.search,
  19832. origin: url.origin,
  19833. method: request.method,
  19834. body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body,
  19835. headers: request.headersList.entries,
  19836. maxRedirections: 0,
  19837. upgrade: request.mode === 'websocket' ? 'websocket' : undefined
  19838. },
  19839. {
  19840. body: null,
  19841. abort: null,
  19842. onConnect (abort) {
  19843. // TODO (fix): Do we need connection here?
  19844. const { connection } = fetchParams.controller
  19845. // Set timingInfo’s final connection timing info to the result of calling clamp and coarsen
  19846. // connection timing info with connection’s timing info, timingInfo’s post-redirect start
  19847. // time, and fetchParams’s cross-origin isolated capability.
  19848. // TODO: implement connection timing
  19849. timingInfo.finalConnectionTimingInfo = clampAndCoarsenConnectionTimingInfo(undefined, timingInfo.postRedirectStartTime, fetchParams.crossOriginIsolatedCapability)
  19850. if (connection.destroyed) {
  19851. abort(new DOMException('The operation was aborted.', 'AbortError'))
  19852. } else {
  19853. fetchParams.controller.on('terminated', abort)
  19854. this.abort = connection.abort = abort
  19855. }
  19856. // Set timingInfo’s final network-request start time to the coarsened shared current time given
  19857. // fetchParams’s cross-origin isolated capability.
  19858. timingInfo.finalNetworkRequestStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
  19859. },
  19860. onResponseStarted () {
  19861. // Set timingInfo’s final network-response start time to the coarsened shared current
  19862. // time given fetchParams’s cross-origin isolated capability, immediately after the
  19863. // user agent’s HTTP parser receives the first byte of the response (e.g., frame header
  19864. // bytes for HTTP/2 or response status line for HTTP/1.x).
  19865. timingInfo.finalNetworkResponseStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
  19866. },
  19867. onHeaders (status, rawHeaders, resume, statusText) {
  19868. if (status < 200) {
  19869. return
  19870. }
  19871. let location = ''
  19872. const headersList = new HeadersList()
  19873. for (let i = 0; i < rawHeaders.length; i += 2) {
  19874. headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i]), rawHeaders[i + 1].toString('latin1'), true)
  19875. }
  19876. location = headersList.get('location', true)
  19877. this.body = new Readable({ read: resume })
  19878. const decoders = []
  19879. const willFollow = location && request.redirect === 'follow' &&
  19880. redirectStatusSet.has(status)
  19881. // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
  19882. if (request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) {
  19883. // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1
  19884. const contentEncoding = headersList.get('content-encoding', true)
  19885. // "All content-coding values are case-insensitive..."
  19886. /** @type {string[]} */
  19887. const codings = contentEncoding ? contentEncoding.toLowerCase().split(',') : []
  19888. // Limit the number of content-encodings to prevent resource exhaustion.
  19889. // CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
  19890. const maxContentEncodings = 5
  19891. if (codings.length > maxContentEncodings) {
  19892. reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
  19893. return true
  19894. }
  19895. for (let i = codings.length - 1; i >= 0; --i) {
  19896. const coding = codings[i].trim()
  19897. // https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2
  19898. if (coding === 'x-gzip' || coding === 'gzip') {
  19899. decoders.push(zlib.createGunzip({
  19900. // Be less strict when decoding compressed responses, since sometimes
  19901. // servers send slightly invalid responses that are still accepted
  19902. // by common browsers.
  19903. // Always using Z_SYNC_FLUSH is what cURL does.
  19904. flush: zlib.constants.Z_SYNC_FLUSH,
  19905. finishFlush: zlib.constants.Z_SYNC_FLUSH
  19906. }))
  19907. } else if (coding === 'deflate') {
  19908. decoders.push(createInflate({
  19909. flush: zlib.constants.Z_SYNC_FLUSH,
  19910. finishFlush: zlib.constants.Z_SYNC_FLUSH
  19911. }))
  19912. } else if (coding === 'br') {
  19913. decoders.push(zlib.createBrotliDecompress({
  19914. flush: zlib.constants.BROTLI_OPERATION_FLUSH,
  19915. finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
  19916. }))
  19917. } else {
  19918. decoders.length = 0
  19919. break
  19920. }
  19921. }
  19922. }
  19923. const onError = this.onError.bind(this)
  19924. resolve({
  19925. status,
  19926. statusText,
  19927. headersList,
  19928. body: decoders.length
  19929. ? pipeline(this.body, ...decoders, (err) => {
  19930. if (err) {
  19931. this.onError(err)
  19932. }
  19933. }).on('error', onError)
  19934. : this.body.on('error', onError)
  19935. })
  19936. return true
  19937. },
  19938. onData (chunk) {
  19939. if (fetchParams.controller.dump) {
  19940. return
  19941. }
  19942. // 1. If one or more bytes have been transmitted from response’s
  19943. // message body, then:
  19944. // 1. Let bytes be the transmitted bytes.
  19945. const bytes = chunk
  19946. // 2. Let codings be the result of extracting header list values
  19947. // given `Content-Encoding` and response’s header list.
  19948. // See pullAlgorithm.
  19949. // 3. Increase timingInfo’s encoded body size by bytes’s length.
  19950. timingInfo.encodedBodySize += bytes.byteLength
  19951. // 4. See pullAlgorithm...
  19952. return this.body.push(bytes)
  19953. },
  19954. onComplete () {
  19955. if (this.abort) {
  19956. fetchParams.controller.off('terminated', this.abort)
  19957. }
  19958. if (fetchParams.controller.onAborted) {
  19959. fetchParams.controller.off('terminated', fetchParams.controller.onAborted)
  19960. }
  19961. fetchParams.controller.ended = true
  19962. this.body.push(null)
  19963. },
  19964. onError (error) {
  19965. if (this.abort) {
  19966. fetchParams.controller.off('terminated', this.abort)
  19967. }
  19968. this.body?.destroy(error)
  19969. fetchParams.controller.terminate(error)
  19970. reject(error)
  19971. },
  19972. onUpgrade (status, rawHeaders, socket) {
  19973. if (status !== 101) {
  19974. return
  19975. }
  19976. const headersList = new HeadersList()
  19977. for (let i = 0; i < rawHeaders.length; i += 2) {
  19978. headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i]), rawHeaders[i + 1].toString('latin1'), true)
  19979. }
  19980. resolve({
  19981. status,
  19982. statusText: STATUS_CODES[status],
  19983. headersList,
  19984. socket
  19985. })
  19986. return true
  19987. }
  19988. }
  19989. ))
  19990. }
  19991. }
  19992. module.exports = {
  19993. fetch,
  19994. Fetch,
  19995. fetching,
  19996. finalizeAndReportTiming
  19997. }
  19998. /***/ }),
  19999. /***/ 9967:
  20000. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  20001. /* globals AbortController */
  20002. const { extractBody, mixinBody, cloneBody, bodyUnusable } = __nccwpck_require__(4492)
  20003. const { Headers, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = __nccwpck_require__(660)
  20004. const { FinalizationRegistry } = __nccwpck_require__(6653)()
  20005. const util = __nccwpck_require__(3440)
  20006. const nodeUtil = __nccwpck_require__(7975)
  20007. const {
  20008. isValidHTTPToken,
  20009. sameOrigin,
  20010. environmentSettingsObject
  20011. } = __nccwpck_require__(3168)
  20012. const {
  20013. forbiddenMethodsSet,
  20014. corsSafeListedMethodsSet,
  20015. referrerPolicy,
  20016. requestRedirect,
  20017. requestMode,
  20018. requestCredentials,
  20019. requestCache,
  20020. requestDuplex
  20021. } = __nccwpck_require__(4495)
  20022. const { kEnumerableProperty, normalizedMethodRecordsBase, normalizedMethodRecords } = util
  20023. const { kHeaders, kSignal, kState, kDispatcher } = __nccwpck_require__(3627)
  20024. const { webidl } = __nccwpck_require__(5893)
  20025. const { URLSerializer } = __nccwpck_require__(1900)
  20026. const { kConstruct } = __nccwpck_require__(6443)
  20027. const assert = __nccwpck_require__(4589)
  20028. const { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __nccwpck_require__(8474)
  20029. const kAbortController = Symbol('abortController')
  20030. const requestFinalizer = new FinalizationRegistry(({ signal, abort }) => {
  20031. signal.removeEventListener('abort', abort)
  20032. })
  20033. const dependentControllerMap = new WeakMap()
  20034. function buildAbort (acRef) {
  20035. return abort
  20036. function abort () {
  20037. const ac = acRef.deref()
  20038. if (ac !== undefined) {
  20039. // Currently, there is a problem with FinalizationRegistry.
  20040. // https://github.com/nodejs/node/issues/49344
  20041. // https://github.com/nodejs/node/issues/47748
  20042. // In the case of abort, the first step is to unregister from it.
  20043. // If the controller can refer to it, it is still registered.
  20044. // It will be removed in the future.
  20045. requestFinalizer.unregister(abort)
  20046. // Unsubscribe a listener.
  20047. // FinalizationRegistry will no longer be called, so this must be done.
  20048. this.removeEventListener('abort', abort)
  20049. ac.abort(this.reason)
  20050. const controllerList = dependentControllerMap.get(ac.signal)
  20051. if (controllerList !== undefined) {
  20052. if (controllerList.size !== 0) {
  20053. for (const ref of controllerList) {
  20054. const ctrl = ref.deref()
  20055. if (ctrl !== undefined) {
  20056. ctrl.abort(this.reason)
  20057. }
  20058. }
  20059. controllerList.clear()
  20060. }
  20061. dependentControllerMap.delete(ac.signal)
  20062. }
  20063. }
  20064. }
  20065. }
  20066. let patchMethodWarning = false
  20067. // https://fetch.spec.whatwg.org/#request-class
  20068. class Request {
  20069. // https://fetch.spec.whatwg.org/#dom-request
  20070. constructor (input, init = {}) {
  20071. webidl.util.markAsUncloneable(this)
  20072. if (input === kConstruct) {
  20073. return
  20074. }
  20075. const prefix = 'Request constructor'
  20076. webidl.argumentLengthCheck(arguments, 1, prefix)
  20077. input = webidl.converters.RequestInfo(input, prefix, 'input')
  20078. init = webidl.converters.RequestInit(init, prefix, 'init')
  20079. // 1. Let request be null.
  20080. let request = null
  20081. // 2. Let fallbackMode be null.
  20082. let fallbackMode = null
  20083. // 3. Let baseURL be this’s relevant settings object’s API base URL.
  20084. const baseUrl = environmentSettingsObject.settingsObject.baseUrl
  20085. // 4. Let signal be null.
  20086. let signal = null
  20087. // 5. If input is a string, then:
  20088. if (typeof input === 'string') {
  20089. this[kDispatcher] = init.dispatcher
  20090. // 1. Let parsedURL be the result of parsing input with baseURL.
  20091. // 2. If parsedURL is failure, then throw a TypeError.
  20092. let parsedURL
  20093. try {
  20094. parsedURL = new URL(input, baseUrl)
  20095. } catch (err) {
  20096. throw new TypeError('Failed to parse URL from ' + input, { cause: err })
  20097. }
  20098. // 3. If parsedURL includes credentials, then throw a TypeError.
  20099. if (parsedURL.username || parsedURL.password) {
  20100. throw new TypeError(
  20101. 'Request cannot be constructed from a URL that includes credentials: ' +
  20102. input
  20103. )
  20104. }
  20105. // 4. Set request to a new request whose URL is parsedURL.
  20106. request = makeRequest({ urlList: [parsedURL] })
  20107. // 5. Set fallbackMode to "cors".
  20108. fallbackMode = 'cors'
  20109. } else {
  20110. this[kDispatcher] = init.dispatcher || input[kDispatcher]
  20111. // 6. Otherwise:
  20112. // 7. Assert: input is a Request object.
  20113. assert(input instanceof Request)
  20114. // 8. Set request to input’s request.
  20115. request = input[kState]
  20116. // 9. Set signal to input’s signal.
  20117. signal = input[kSignal]
  20118. }
  20119. // 7. Let origin be this’s relevant settings object’s origin.
  20120. const origin = environmentSettingsObject.settingsObject.origin
  20121. // 8. Let window be "client".
  20122. let window = 'client'
  20123. // 9. If request’s window is an environment settings object and its origin
  20124. // is same origin with origin, then set window to request’s window.
  20125. if (
  20126. request.window?.constructor?.name === 'EnvironmentSettingsObject' &&
  20127. sameOrigin(request.window, origin)
  20128. ) {
  20129. window = request.window
  20130. }
  20131. // 10. If init["window"] exists and is non-null, then throw a TypeError.
  20132. if (init.window != null) {
  20133. throw new TypeError(`'window' option '${window}' must be null`)
  20134. }
  20135. // 11. If init["window"] exists, then set window to "no-window".
  20136. if ('window' in init) {
  20137. window = 'no-window'
  20138. }
  20139. // 12. Set request to a new request with the following properties:
  20140. request = makeRequest({
  20141. // URL request’s URL.
  20142. // undici implementation note: this is set as the first item in request's urlList in makeRequest
  20143. // method request’s method.
  20144. method: request.method,
  20145. // header list A copy of request’s header list.
  20146. // undici implementation note: headersList is cloned in makeRequest
  20147. headersList: request.headersList,
  20148. // unsafe-request flag Set.
  20149. unsafeRequest: request.unsafeRequest,
  20150. // client This’s relevant settings object.
  20151. client: environmentSettingsObject.settingsObject,
  20152. // window window.
  20153. window,
  20154. // priority request’s priority.
  20155. priority: request.priority,
  20156. // origin request’s origin. The propagation of the origin is only significant for navigation requests
  20157. // being handled by a service worker. In this scenario a request can have an origin that is different
  20158. // from the current client.
  20159. origin: request.origin,
  20160. // referrer request’s referrer.
  20161. referrer: request.referrer,
  20162. // referrer policy request’s referrer policy.
  20163. referrerPolicy: request.referrerPolicy,
  20164. // mode request’s mode.
  20165. mode: request.mode,
  20166. // credentials mode request’s credentials mode.
  20167. credentials: request.credentials,
  20168. // cache mode request’s cache mode.
  20169. cache: request.cache,
  20170. // redirect mode request’s redirect mode.
  20171. redirect: request.redirect,
  20172. // integrity metadata request’s integrity metadata.
  20173. integrity: request.integrity,
  20174. // keepalive request’s keepalive.
  20175. keepalive: request.keepalive,
  20176. // reload-navigation flag request’s reload-navigation flag.
  20177. reloadNavigation: request.reloadNavigation,
  20178. // history-navigation flag request’s history-navigation flag.
  20179. historyNavigation: request.historyNavigation,
  20180. // URL list A clone of request’s URL list.
  20181. urlList: [...request.urlList]
  20182. })
  20183. const initHasKey = Object.keys(init).length !== 0
  20184. // 13. If init is not empty, then:
  20185. if (initHasKey) {
  20186. // 1. If request’s mode is "navigate", then set it to "same-origin".
  20187. if (request.mode === 'navigate') {
  20188. request.mode = 'same-origin'
  20189. }
  20190. // 2. Unset request’s reload-navigation flag.
  20191. request.reloadNavigation = false
  20192. // 3. Unset request’s history-navigation flag.
  20193. request.historyNavigation = false
  20194. // 4. Set request’s origin to "client".
  20195. request.origin = 'client'
  20196. // 5. Set request’s referrer to "client"
  20197. request.referrer = 'client'
  20198. // 6. Set request’s referrer policy to the empty string.
  20199. request.referrerPolicy = ''
  20200. // 7. Set request’s URL to request’s current URL.
  20201. request.url = request.urlList[request.urlList.length - 1]
  20202. // 8. Set request’s URL list to « request’s URL ».
  20203. request.urlList = [request.url]
  20204. }
  20205. // 14. If init["referrer"] exists, then:
  20206. if (init.referrer !== undefined) {
  20207. // 1. Let referrer be init["referrer"].
  20208. const referrer = init.referrer
  20209. // 2. If referrer is the empty string, then set request’s referrer to "no-referrer".
  20210. if (referrer === '') {
  20211. request.referrer = 'no-referrer'
  20212. } else {
  20213. // 1. Let parsedReferrer be the result of parsing referrer with
  20214. // baseURL.
  20215. // 2. If parsedReferrer is failure, then throw a TypeError.
  20216. let parsedReferrer
  20217. try {
  20218. parsedReferrer = new URL(referrer, baseUrl)
  20219. } catch (err) {
  20220. throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err })
  20221. }
  20222. // 3. If one of the following is true
  20223. // - parsedReferrer’s scheme is "about" and path is the string "client"
  20224. // - parsedReferrer’s origin is not same origin with origin
  20225. // then set request’s referrer to "client".
  20226. if (
  20227. (parsedReferrer.protocol === 'about:' && parsedReferrer.hostname === 'client') ||
  20228. (origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl))
  20229. ) {
  20230. request.referrer = 'client'
  20231. } else {
  20232. // 4. Otherwise, set request’s referrer to parsedReferrer.
  20233. request.referrer = parsedReferrer
  20234. }
  20235. }
  20236. }
  20237. // 15. If init["referrerPolicy"] exists, then set request’s referrer policy
  20238. // to it.
  20239. if (init.referrerPolicy !== undefined) {
  20240. request.referrerPolicy = init.referrerPolicy
  20241. }
  20242. // 16. Let mode be init["mode"] if it exists, and fallbackMode otherwise.
  20243. let mode
  20244. if (init.mode !== undefined) {
  20245. mode = init.mode
  20246. } else {
  20247. mode = fallbackMode
  20248. }
  20249. // 17. If mode is "navigate", then throw a TypeError.
  20250. if (mode === 'navigate') {
  20251. throw webidl.errors.exception({
  20252. header: 'Request constructor',
  20253. message: 'invalid request mode navigate.'
  20254. })
  20255. }
  20256. // 18. If mode is non-null, set request’s mode to mode.
  20257. if (mode != null) {
  20258. request.mode = mode
  20259. }
  20260. // 19. If init["credentials"] exists, then set request’s credentials mode
  20261. // to it.
  20262. if (init.credentials !== undefined) {
  20263. request.credentials = init.credentials
  20264. }
  20265. // 18. If init["cache"] exists, then set request’s cache mode to it.
  20266. if (init.cache !== undefined) {
  20267. request.cache = init.cache
  20268. }
  20269. // 21. If request’s cache mode is "only-if-cached" and request’s mode is
  20270. // not "same-origin", then throw a TypeError.
  20271. if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
  20272. throw new TypeError(
  20273. "'only-if-cached' can be set only with 'same-origin' mode"
  20274. )
  20275. }
  20276. // 22. If init["redirect"] exists, then set request’s redirect mode to it.
  20277. if (init.redirect !== undefined) {
  20278. request.redirect = init.redirect
  20279. }
  20280. // 23. If init["integrity"] exists, then set request’s integrity metadata to it.
  20281. if (init.integrity != null) {
  20282. request.integrity = String(init.integrity)
  20283. }
  20284. // 24. If init["keepalive"] exists, then set request’s keepalive to it.
  20285. if (init.keepalive !== undefined) {
  20286. request.keepalive = Boolean(init.keepalive)
  20287. }
  20288. // 25. If init["method"] exists, then:
  20289. if (init.method !== undefined) {
  20290. // 1. Let method be init["method"].
  20291. let method = init.method
  20292. const mayBeNormalized = normalizedMethodRecords[method]
  20293. if (mayBeNormalized !== undefined) {
  20294. // Note: Bypass validation DELETE, GET, HEAD, OPTIONS, POST, PUT, PATCH and these lowercase ones
  20295. request.method = mayBeNormalized
  20296. } else {
  20297. // 2. If method is not a method or method is a forbidden method, then
  20298. // throw a TypeError.
  20299. if (!isValidHTTPToken(method)) {
  20300. throw new TypeError(`'${method}' is not a valid HTTP method.`)
  20301. }
  20302. const upperCase = method.toUpperCase()
  20303. if (forbiddenMethodsSet.has(upperCase)) {
  20304. throw new TypeError(`'${method}' HTTP method is unsupported.`)
  20305. }
  20306. // 3. Normalize method.
  20307. // https://fetch.spec.whatwg.org/#concept-method-normalize
  20308. // Note: must be in uppercase
  20309. method = normalizedMethodRecordsBase[upperCase] ?? method
  20310. // 4. Set request’s method to method.
  20311. request.method = method
  20312. }
  20313. if (!patchMethodWarning && request.method === 'patch') {
  20314. process.emitWarning('Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.', {
  20315. code: 'UNDICI-FETCH-patch'
  20316. })
  20317. patchMethodWarning = true
  20318. }
  20319. }
  20320. // 26. If init["signal"] exists, then set signal to it.
  20321. if (init.signal !== undefined) {
  20322. signal = init.signal
  20323. }
  20324. // 27. Set this’s request to request.
  20325. this[kState] = request
  20326. // 28. Set this’s signal to a new AbortSignal object with this’s relevant
  20327. // Realm.
  20328. // TODO: could this be simplified with AbortSignal.any
  20329. // (https://dom.spec.whatwg.org/#dom-abortsignal-any)
  20330. const ac = new AbortController()
  20331. this[kSignal] = ac.signal
  20332. // 29. If signal is not null, then make this’s signal follow signal.
  20333. if (signal != null) {
  20334. if (
  20335. !signal ||
  20336. typeof signal.aborted !== 'boolean' ||
  20337. typeof signal.addEventListener !== 'function'
  20338. ) {
  20339. throw new TypeError(
  20340. "Failed to construct 'Request': member signal is not of type AbortSignal."
  20341. )
  20342. }
  20343. if (signal.aborted) {
  20344. ac.abort(signal.reason)
  20345. } else {
  20346. // Keep a strong ref to ac while request object
  20347. // is alive. This is needed to prevent AbortController
  20348. // from being prematurely garbage collected.
  20349. // See, https://github.com/nodejs/undici/issues/1926.
  20350. this[kAbortController] = ac
  20351. const acRef = new WeakRef(ac)
  20352. const abort = buildAbort(acRef)
  20353. // Third-party AbortControllers may not work with these.
  20354. // See, https://github.com/nodejs/undici/pull/1910#issuecomment-1464495619.
  20355. try {
  20356. // If the max amount of listeners is equal to the default, increase it
  20357. // This is only available in node >= v19.9.0
  20358. if (typeof getMaxListeners === 'function' && getMaxListeners(signal) === defaultMaxListeners) {
  20359. setMaxListeners(1500, signal)
  20360. } else if (getEventListeners(signal, 'abort').length >= defaultMaxListeners) {
  20361. setMaxListeners(1500, signal)
  20362. }
  20363. } catch {}
  20364. util.addAbortListener(signal, abort)
  20365. // The third argument must be a registry key to be unregistered.
  20366. // Without it, you cannot unregister.
  20367. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
  20368. // abort is used as the unregister key. (because it is unique)
  20369. requestFinalizer.register(ac, { signal, abort }, abort)
  20370. }
  20371. }
  20372. // 30. Set this’s headers to a new Headers object with this’s relevant
  20373. // Realm, whose header list is request’s header list and guard is
  20374. // "request".
  20375. this[kHeaders] = new Headers(kConstruct)
  20376. setHeadersList(this[kHeaders], request.headersList)
  20377. setHeadersGuard(this[kHeaders], 'request')
  20378. // 31. If this’s request’s mode is "no-cors", then:
  20379. if (mode === 'no-cors') {
  20380. // 1. If this’s request’s method is not a CORS-safelisted method,
  20381. // then throw a TypeError.
  20382. if (!corsSafeListedMethodsSet.has(request.method)) {
  20383. throw new TypeError(
  20384. `'${request.method} is unsupported in no-cors mode.`
  20385. )
  20386. }
  20387. // 2. Set this’s headers’s guard to "request-no-cors".
  20388. setHeadersGuard(this[kHeaders], 'request-no-cors')
  20389. }
  20390. // 32. If init is not empty, then:
  20391. if (initHasKey) {
  20392. /** @type {HeadersList} */
  20393. const headersList = getHeadersList(this[kHeaders])
  20394. // 1. Let headers be a copy of this’s headers and its associated header
  20395. // list.
  20396. // 2. If init["headers"] exists, then set headers to init["headers"].
  20397. const headers = init.headers !== undefined ? init.headers : new HeadersList(headersList)
  20398. // 3. Empty this’s headers’s header list.
  20399. headersList.clear()
  20400. // 4. If headers is a Headers object, then for each header in its header
  20401. // list, append header’s name/header’s value to this’s headers.
  20402. if (headers instanceof HeadersList) {
  20403. for (const { name, value } of headers.rawValues()) {
  20404. headersList.append(name, value, false)
  20405. }
  20406. // Note: Copy the `set-cookie` meta-data.
  20407. headersList.cookies = headers.cookies
  20408. } else {
  20409. // 5. Otherwise, fill this’s headers with headers.
  20410. fillHeaders(this[kHeaders], headers)
  20411. }
  20412. }
  20413. // 33. Let inputBody be input’s request’s body if input is a Request
  20414. // object; otherwise null.
  20415. const inputBody = input instanceof Request ? input[kState].body : null
  20416. // 34. If either init["body"] exists and is non-null or inputBody is
  20417. // non-null, and request’s method is `GET` or `HEAD`, then throw a
  20418. // TypeError.
  20419. if (
  20420. (init.body != null || inputBody != null) &&
  20421. (request.method === 'GET' || request.method === 'HEAD')
  20422. ) {
  20423. throw new TypeError('Request with GET/HEAD method cannot have body.')
  20424. }
  20425. // 35. Let initBody be null.
  20426. let initBody = null
  20427. // 36. If init["body"] exists and is non-null, then:
  20428. if (init.body != null) {
  20429. // 1. Let Content-Type be null.
  20430. // 2. Set initBody and Content-Type to the result of extracting
  20431. // init["body"], with keepalive set to request’s keepalive.
  20432. const [extractedBody, contentType] = extractBody(
  20433. init.body,
  20434. request.keepalive
  20435. )
  20436. initBody = extractedBody
  20437. // 3, If Content-Type is non-null and this’s headers’s header list does
  20438. // not contain `Content-Type`, then append `Content-Type`/Content-Type to
  20439. // this’s headers.
  20440. if (contentType && !getHeadersList(this[kHeaders]).contains('content-type', true)) {
  20441. this[kHeaders].append('content-type', contentType)
  20442. }
  20443. }
  20444. // 37. Let inputOrInitBody be initBody if it is non-null; otherwise
  20445. // inputBody.
  20446. const inputOrInitBody = initBody ?? inputBody
  20447. // 38. If inputOrInitBody is non-null and inputOrInitBody’s source is
  20448. // null, then:
  20449. if (inputOrInitBody != null && inputOrInitBody.source == null) {
  20450. // 1. If initBody is non-null and init["duplex"] does not exist,
  20451. // then throw a TypeError.
  20452. if (initBody != null && init.duplex == null) {
  20453. throw new TypeError('RequestInit: duplex option is required when sending a body.')
  20454. }
  20455. // 2. If this’s request’s mode is neither "same-origin" nor "cors",
  20456. // then throw a TypeError.
  20457. if (request.mode !== 'same-origin' && request.mode !== 'cors') {
  20458. throw new TypeError(
  20459. 'If request is made from ReadableStream, mode should be "same-origin" or "cors"'
  20460. )
  20461. }
  20462. // 3. Set this’s request’s use-CORS-preflight flag.
  20463. request.useCORSPreflightFlag = true
  20464. }
  20465. // 39. Let finalBody be inputOrInitBody.
  20466. let finalBody = inputOrInitBody
  20467. // 40. If initBody is null and inputBody is non-null, then:
  20468. if (initBody == null && inputBody != null) {
  20469. // 1. If input is unusable, then throw a TypeError.
  20470. if (bodyUnusable(input)) {
  20471. throw new TypeError(
  20472. 'Cannot construct a Request with a Request object that has already been used.'
  20473. )
  20474. }
  20475. // 2. Set finalBody to the result of creating a proxy for inputBody.
  20476. // https://streams.spec.whatwg.org/#readablestream-create-a-proxy
  20477. const identityTransform = new TransformStream()
  20478. inputBody.stream.pipeThrough(identityTransform)
  20479. finalBody = {
  20480. source: inputBody.source,
  20481. length: inputBody.length,
  20482. stream: identityTransform.readable
  20483. }
  20484. }
  20485. // 41. Set this’s request’s body to finalBody.
  20486. this[kState].body = finalBody
  20487. }
  20488. // Returns request’s HTTP method, which is "GET" by default.
  20489. get method () {
  20490. webidl.brandCheck(this, Request)
  20491. // The method getter steps are to return this’s request’s method.
  20492. return this[kState].method
  20493. }
  20494. // Returns the URL of request as a string.
  20495. get url () {
  20496. webidl.brandCheck(this, Request)
  20497. // The url getter steps are to return this’s request’s URL, serialized.
  20498. return URLSerializer(this[kState].url)
  20499. }
  20500. // Returns a Headers object consisting of the headers associated with request.
  20501. // Note that headers added in the network layer by the user agent will not
  20502. // be accounted for in this object, e.g., the "Host" header.
  20503. get headers () {
  20504. webidl.brandCheck(this, Request)
  20505. // The headers getter steps are to return this’s headers.
  20506. return this[kHeaders]
  20507. }
  20508. // Returns the kind of resource requested by request, e.g., "document"
  20509. // or "script".
  20510. get destination () {
  20511. webidl.brandCheck(this, Request)
  20512. // The destination getter are to return this’s request’s destination.
  20513. return this[kState].destination
  20514. }
  20515. // Returns the referrer of request. Its value can be a same-origin URL if
  20516. // explicitly set in init, the empty string to indicate no referrer, and
  20517. // "about:client" when defaulting to the global’s default. This is used
  20518. // during fetching to determine the value of the `Referer` header of the
  20519. // request being made.
  20520. get referrer () {
  20521. webidl.brandCheck(this, Request)
  20522. // 1. If this’s request’s referrer is "no-referrer", then return the
  20523. // empty string.
  20524. if (this[kState].referrer === 'no-referrer') {
  20525. return ''
  20526. }
  20527. // 2. If this’s request’s referrer is "client", then return
  20528. // "about:client".
  20529. if (this[kState].referrer === 'client') {
  20530. return 'about:client'
  20531. }
  20532. // Return this’s request’s referrer, serialized.
  20533. return this[kState].referrer.toString()
  20534. }
  20535. // Returns the referrer policy associated with request.
  20536. // This is used during fetching to compute the value of the request’s
  20537. // referrer.
  20538. get referrerPolicy () {
  20539. webidl.brandCheck(this, Request)
  20540. // The referrerPolicy getter steps are to return this’s request’s referrer policy.
  20541. return this[kState].referrerPolicy
  20542. }
  20543. // Returns the mode associated with request, which is a string indicating
  20544. // whether the request will use CORS, or will be restricted to same-origin
  20545. // URLs.
  20546. get mode () {
  20547. webidl.brandCheck(this, Request)
  20548. // The mode getter steps are to return this’s request’s mode.
  20549. return this[kState].mode
  20550. }
  20551. // Returns the credentials mode associated with request,
  20552. // which is a string indicating whether credentials will be sent with the
  20553. // request always, never, or only when sent to a same-origin URL.
  20554. get credentials () {
  20555. // The credentials getter steps are to return this’s request’s credentials mode.
  20556. return this[kState].credentials
  20557. }
  20558. // Returns the cache mode associated with request,
  20559. // which is a string indicating how the request will
  20560. // interact with the browser’s cache when fetching.
  20561. get cache () {
  20562. webidl.brandCheck(this, Request)
  20563. // The cache getter steps are to return this’s request’s cache mode.
  20564. return this[kState].cache
  20565. }
  20566. // Returns the redirect mode associated with request,
  20567. // which is a string indicating how redirects for the
  20568. // request will be handled during fetching. A request
  20569. // will follow redirects by default.
  20570. get redirect () {
  20571. webidl.brandCheck(this, Request)
  20572. // The redirect getter steps are to return this’s request’s redirect mode.
  20573. return this[kState].redirect
  20574. }
  20575. // Returns request’s subresource integrity metadata, which is a
  20576. // cryptographic hash of the resource being fetched. Its value
  20577. // consists of multiple hashes separated by whitespace. [SRI]
  20578. get integrity () {
  20579. webidl.brandCheck(this, Request)
  20580. // The integrity getter steps are to return this’s request’s integrity
  20581. // metadata.
  20582. return this[kState].integrity
  20583. }
  20584. // Returns a boolean indicating whether or not request can outlive the
  20585. // global in which it was created.
  20586. get keepalive () {
  20587. webidl.brandCheck(this, Request)
  20588. // The keepalive getter steps are to return this’s request’s keepalive.
  20589. return this[kState].keepalive
  20590. }
  20591. // Returns a boolean indicating whether or not request is for a reload
  20592. // navigation.
  20593. get isReloadNavigation () {
  20594. webidl.brandCheck(this, Request)
  20595. // The isReloadNavigation getter steps are to return true if this’s
  20596. // request’s reload-navigation flag is set; otherwise false.
  20597. return this[kState].reloadNavigation
  20598. }
  20599. // Returns a boolean indicating whether or not request is for a history
  20600. // navigation (a.k.a. back-forward navigation).
  20601. get isHistoryNavigation () {
  20602. webidl.brandCheck(this, Request)
  20603. // The isHistoryNavigation getter steps are to return true if this’s request’s
  20604. // history-navigation flag is set; otherwise false.
  20605. return this[kState].historyNavigation
  20606. }
  20607. // Returns the signal associated with request, which is an AbortSignal
  20608. // object indicating whether or not request has been aborted, and its
  20609. // abort event handler.
  20610. get signal () {
  20611. webidl.brandCheck(this, Request)
  20612. // The signal getter steps are to return this’s signal.
  20613. return this[kSignal]
  20614. }
  20615. get body () {
  20616. webidl.brandCheck(this, Request)
  20617. return this[kState].body ? this[kState].body.stream : null
  20618. }
  20619. get bodyUsed () {
  20620. webidl.brandCheck(this, Request)
  20621. return !!this[kState].body && util.isDisturbed(this[kState].body.stream)
  20622. }
  20623. get duplex () {
  20624. webidl.brandCheck(this, Request)
  20625. return 'half'
  20626. }
  20627. // Returns a clone of request.
  20628. clone () {
  20629. webidl.brandCheck(this, Request)
  20630. // 1. If this is unusable, then throw a TypeError.
  20631. if (bodyUnusable(this)) {
  20632. throw new TypeError('unusable')
  20633. }
  20634. // 2. Let clonedRequest be the result of cloning this’s request.
  20635. const clonedRequest = cloneRequest(this[kState])
  20636. // 3. Let clonedRequestObject be the result of creating a Request object,
  20637. // given clonedRequest, this’s headers’s guard, and this’s relevant Realm.
  20638. // 4. Make clonedRequestObject’s signal follow this’s signal.
  20639. const ac = new AbortController()
  20640. if (this.signal.aborted) {
  20641. ac.abort(this.signal.reason)
  20642. } else {
  20643. let list = dependentControllerMap.get(this.signal)
  20644. if (list === undefined) {
  20645. list = new Set()
  20646. dependentControllerMap.set(this.signal, list)
  20647. }
  20648. const acRef = new WeakRef(ac)
  20649. list.add(acRef)
  20650. util.addAbortListener(
  20651. ac.signal,
  20652. buildAbort(acRef)
  20653. )
  20654. }
  20655. // 4. Return clonedRequestObject.
  20656. return fromInnerRequest(clonedRequest, ac.signal, getHeadersGuard(this[kHeaders]))
  20657. }
  20658. [nodeUtil.inspect.custom] (depth, options) {
  20659. if (options.depth === null) {
  20660. options.depth = 2
  20661. }
  20662. options.colors ??= true
  20663. const properties = {
  20664. method: this.method,
  20665. url: this.url,
  20666. headers: this.headers,
  20667. destination: this.destination,
  20668. referrer: this.referrer,
  20669. referrerPolicy: this.referrerPolicy,
  20670. mode: this.mode,
  20671. credentials: this.credentials,
  20672. cache: this.cache,
  20673. redirect: this.redirect,
  20674. integrity: this.integrity,
  20675. keepalive: this.keepalive,
  20676. isReloadNavigation: this.isReloadNavigation,
  20677. isHistoryNavigation: this.isHistoryNavigation,
  20678. signal: this.signal
  20679. }
  20680. return `Request ${nodeUtil.formatWithOptions(options, properties)}`
  20681. }
  20682. }
  20683. mixinBody(Request)
  20684. // https://fetch.spec.whatwg.org/#requests
  20685. function makeRequest (init) {
  20686. return {
  20687. method: init.method ?? 'GET',
  20688. localURLsOnly: init.localURLsOnly ?? false,
  20689. unsafeRequest: init.unsafeRequest ?? false,
  20690. body: init.body ?? null,
  20691. client: init.client ?? null,
  20692. reservedClient: init.reservedClient ?? null,
  20693. replacesClientId: init.replacesClientId ?? '',
  20694. window: init.window ?? 'client',
  20695. keepalive: init.keepalive ?? false,
  20696. serviceWorkers: init.serviceWorkers ?? 'all',
  20697. initiator: init.initiator ?? '',
  20698. destination: init.destination ?? '',
  20699. priority: init.priority ?? null,
  20700. origin: init.origin ?? 'client',
  20701. policyContainer: init.policyContainer ?? 'client',
  20702. referrer: init.referrer ?? 'client',
  20703. referrerPolicy: init.referrerPolicy ?? '',
  20704. mode: init.mode ?? 'no-cors',
  20705. useCORSPreflightFlag: init.useCORSPreflightFlag ?? false,
  20706. credentials: init.credentials ?? 'same-origin',
  20707. useCredentials: init.useCredentials ?? false,
  20708. cache: init.cache ?? 'default',
  20709. redirect: init.redirect ?? 'follow',
  20710. integrity: init.integrity ?? '',
  20711. cryptoGraphicsNonceMetadata: init.cryptoGraphicsNonceMetadata ?? '',
  20712. parserMetadata: init.parserMetadata ?? '',
  20713. reloadNavigation: init.reloadNavigation ?? false,
  20714. historyNavigation: init.historyNavigation ?? false,
  20715. userActivation: init.userActivation ?? false,
  20716. taintedOrigin: init.taintedOrigin ?? false,
  20717. redirectCount: init.redirectCount ?? 0,
  20718. responseTainting: init.responseTainting ?? 'basic',
  20719. preventNoCacheCacheControlHeaderModification: init.preventNoCacheCacheControlHeaderModification ?? false,
  20720. done: init.done ?? false,
  20721. timingAllowFailed: init.timingAllowFailed ?? false,
  20722. urlList: init.urlList,
  20723. url: init.urlList[0],
  20724. headersList: init.headersList
  20725. ? new HeadersList(init.headersList)
  20726. : new HeadersList()
  20727. }
  20728. }
  20729. // https://fetch.spec.whatwg.org/#concept-request-clone
  20730. function cloneRequest (request) {
  20731. // To clone a request request, run these steps:
  20732. // 1. Let newRequest be a copy of request, except for its body.
  20733. const newRequest = makeRequest({ ...request, body: null })
  20734. // 2. If request’s body is non-null, set newRequest’s body to the
  20735. // result of cloning request’s body.
  20736. if (request.body != null) {
  20737. newRequest.body = cloneBody(newRequest, request.body)
  20738. }
  20739. // 3. Return newRequest.
  20740. return newRequest
  20741. }
  20742. /**
  20743. * @see https://fetch.spec.whatwg.org/#request-create
  20744. * @param {any} innerRequest
  20745. * @param {AbortSignal} signal
  20746. * @param {'request' | 'immutable' | 'request-no-cors' | 'response' | 'none'} guard
  20747. * @returns {Request}
  20748. */
  20749. function fromInnerRequest (innerRequest, signal, guard) {
  20750. const request = new Request(kConstruct)
  20751. request[kState] = innerRequest
  20752. request[kSignal] = signal
  20753. request[kHeaders] = new Headers(kConstruct)
  20754. setHeadersList(request[kHeaders], innerRequest.headersList)
  20755. setHeadersGuard(request[kHeaders], guard)
  20756. return request
  20757. }
  20758. Object.defineProperties(Request.prototype, {
  20759. method: kEnumerableProperty,
  20760. url: kEnumerableProperty,
  20761. headers: kEnumerableProperty,
  20762. redirect: kEnumerableProperty,
  20763. clone: kEnumerableProperty,
  20764. signal: kEnumerableProperty,
  20765. duplex: kEnumerableProperty,
  20766. destination: kEnumerableProperty,
  20767. body: kEnumerableProperty,
  20768. bodyUsed: kEnumerableProperty,
  20769. isHistoryNavigation: kEnumerableProperty,
  20770. isReloadNavigation: kEnumerableProperty,
  20771. keepalive: kEnumerableProperty,
  20772. integrity: kEnumerableProperty,
  20773. cache: kEnumerableProperty,
  20774. credentials: kEnumerableProperty,
  20775. attribute: kEnumerableProperty,
  20776. referrerPolicy: kEnumerableProperty,
  20777. referrer: kEnumerableProperty,
  20778. mode: kEnumerableProperty,
  20779. [Symbol.toStringTag]: {
  20780. value: 'Request',
  20781. configurable: true
  20782. }
  20783. })
  20784. webidl.converters.Request = webidl.interfaceConverter(
  20785. Request
  20786. )
  20787. // https://fetch.spec.whatwg.org/#requestinfo
  20788. webidl.converters.RequestInfo = function (V, prefix, argument) {
  20789. if (typeof V === 'string') {
  20790. return webidl.converters.USVString(V, prefix, argument)
  20791. }
  20792. if (V instanceof Request) {
  20793. return webidl.converters.Request(V, prefix, argument)
  20794. }
  20795. return webidl.converters.USVString(V, prefix, argument)
  20796. }
  20797. webidl.converters.AbortSignal = webidl.interfaceConverter(
  20798. AbortSignal
  20799. )
  20800. // https://fetch.spec.whatwg.org/#requestinit
  20801. webidl.converters.RequestInit = webidl.dictionaryConverter([
  20802. {
  20803. key: 'method',
  20804. converter: webidl.converters.ByteString
  20805. },
  20806. {
  20807. key: 'headers',
  20808. converter: webidl.converters.HeadersInit
  20809. },
  20810. {
  20811. key: 'body',
  20812. converter: webidl.nullableConverter(
  20813. webidl.converters.BodyInit
  20814. )
  20815. },
  20816. {
  20817. key: 'referrer',
  20818. converter: webidl.converters.USVString
  20819. },
  20820. {
  20821. key: 'referrerPolicy',
  20822. converter: webidl.converters.DOMString,
  20823. // https://w3c.github.io/webappsec-referrer-policy/#referrer-policy
  20824. allowedValues: referrerPolicy
  20825. },
  20826. {
  20827. key: 'mode',
  20828. converter: webidl.converters.DOMString,
  20829. // https://fetch.spec.whatwg.org/#concept-request-mode
  20830. allowedValues: requestMode
  20831. },
  20832. {
  20833. key: 'credentials',
  20834. converter: webidl.converters.DOMString,
  20835. // https://fetch.spec.whatwg.org/#requestcredentials
  20836. allowedValues: requestCredentials
  20837. },
  20838. {
  20839. key: 'cache',
  20840. converter: webidl.converters.DOMString,
  20841. // https://fetch.spec.whatwg.org/#requestcache
  20842. allowedValues: requestCache
  20843. },
  20844. {
  20845. key: 'redirect',
  20846. converter: webidl.converters.DOMString,
  20847. // https://fetch.spec.whatwg.org/#requestredirect
  20848. allowedValues: requestRedirect
  20849. },
  20850. {
  20851. key: 'integrity',
  20852. converter: webidl.converters.DOMString
  20853. },
  20854. {
  20855. key: 'keepalive',
  20856. converter: webidl.converters.boolean
  20857. },
  20858. {
  20859. key: 'signal',
  20860. converter: webidl.nullableConverter(
  20861. (signal) => webidl.converters.AbortSignal(
  20862. signal,
  20863. 'RequestInit',
  20864. 'signal',
  20865. { strict: false }
  20866. )
  20867. )
  20868. },
  20869. {
  20870. key: 'window',
  20871. converter: webidl.converters.any
  20872. },
  20873. {
  20874. key: 'duplex',
  20875. converter: webidl.converters.DOMString,
  20876. allowedValues: requestDuplex
  20877. },
  20878. {
  20879. key: 'dispatcher', // undici specific option
  20880. converter: webidl.converters.any
  20881. }
  20882. ])
  20883. module.exports = { Request, makeRequest, fromInnerRequest, cloneRequest }
  20884. /***/ }),
  20885. /***/ 9051:
  20886. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  20887. const { Headers, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = __nccwpck_require__(660)
  20888. const { extractBody, cloneBody, mixinBody, hasFinalizationRegistry, streamRegistry, bodyUnusable } = __nccwpck_require__(4492)
  20889. const util = __nccwpck_require__(3440)
  20890. const nodeUtil = __nccwpck_require__(7975)
  20891. const { kEnumerableProperty } = util
  20892. const {
  20893. isValidReasonPhrase,
  20894. isCancelled,
  20895. isAborted,
  20896. isBlobLike,
  20897. serializeJavascriptValueToJSONString,
  20898. isErrorLike,
  20899. isomorphicEncode,
  20900. environmentSettingsObject: relevantRealm
  20901. } = __nccwpck_require__(3168)
  20902. const {
  20903. redirectStatusSet,
  20904. nullBodyStatus
  20905. } = __nccwpck_require__(4495)
  20906. const { kState, kHeaders } = __nccwpck_require__(3627)
  20907. const { webidl } = __nccwpck_require__(5893)
  20908. const { FormData } = __nccwpck_require__(5910)
  20909. const { URLSerializer } = __nccwpck_require__(1900)
  20910. const { kConstruct } = __nccwpck_require__(6443)
  20911. const assert = __nccwpck_require__(4589)
  20912. const { types } = __nccwpck_require__(7975)
  20913. const textEncoder = new TextEncoder('utf-8')
  20914. // https://fetch.spec.whatwg.org/#response-class
  20915. class Response {
  20916. // Creates network error Response.
  20917. static error () {
  20918. // The static error() method steps are to return the result of creating a
  20919. // Response object, given a new network error, "immutable", and this’s
  20920. // relevant Realm.
  20921. const responseObject = fromInnerResponse(makeNetworkError(), 'immutable')
  20922. return responseObject
  20923. }
  20924. // https://fetch.spec.whatwg.org/#dom-response-json
  20925. static json (data, init = {}) {
  20926. webidl.argumentLengthCheck(arguments, 1, 'Response.json')
  20927. if (init !== null) {
  20928. init = webidl.converters.ResponseInit(init)
  20929. }
  20930. // 1. Let bytes the result of running serialize a JavaScript value to JSON bytes on data.
  20931. const bytes = textEncoder.encode(
  20932. serializeJavascriptValueToJSONString(data)
  20933. )
  20934. // 2. Let body be the result of extracting bytes.
  20935. const body = extractBody(bytes)
  20936. // 3. Let responseObject be the result of creating a Response object, given a new response,
  20937. // "response", and this’s relevant Realm.
  20938. const responseObject = fromInnerResponse(makeResponse({}), 'response')
  20939. // 4. Perform initialize a response given responseObject, init, and (body, "application/json").
  20940. initializeResponse(responseObject, init, { body: body[0], type: 'application/json' })
  20941. // 5. Return responseObject.
  20942. return responseObject
  20943. }
  20944. // Creates a redirect Response that redirects to url with status status.
  20945. static redirect (url, status = 302) {
  20946. webidl.argumentLengthCheck(arguments, 1, 'Response.redirect')
  20947. url = webidl.converters.USVString(url)
  20948. status = webidl.converters['unsigned short'](status)
  20949. // 1. Let parsedURL be the result of parsing url with current settings
  20950. // object’s API base URL.
  20951. // 2. If parsedURL is failure, then throw a TypeError.
  20952. // TODO: base-URL?
  20953. let parsedURL
  20954. try {
  20955. parsedURL = new URL(url, relevantRealm.settingsObject.baseUrl)
  20956. } catch (err) {
  20957. throw new TypeError(`Failed to parse URL from ${url}`, { cause: err })
  20958. }
  20959. // 3. If status is not a redirect status, then throw a RangeError.
  20960. if (!redirectStatusSet.has(status)) {
  20961. throw new RangeError(`Invalid status code ${status}`)
  20962. }
  20963. // 4. Let responseObject be the result of creating a Response object,
  20964. // given a new response, "immutable", and this’s relevant Realm.
  20965. const responseObject = fromInnerResponse(makeResponse({}), 'immutable')
  20966. // 5. Set responseObject’s response’s status to status.
  20967. responseObject[kState].status = status
  20968. // 6. Let value be parsedURL, serialized and isomorphic encoded.
  20969. const value = isomorphicEncode(URLSerializer(parsedURL))
  20970. // 7. Append `Location`/value to responseObject’s response’s header list.
  20971. responseObject[kState].headersList.append('location', value, true)
  20972. // 8. Return responseObject.
  20973. return responseObject
  20974. }
  20975. // https://fetch.spec.whatwg.org/#dom-response
  20976. constructor (body = null, init = {}) {
  20977. webidl.util.markAsUncloneable(this)
  20978. if (body === kConstruct) {
  20979. return
  20980. }
  20981. if (body !== null) {
  20982. body = webidl.converters.BodyInit(body)
  20983. }
  20984. init = webidl.converters.ResponseInit(init)
  20985. // 1. Set this’s response to a new response.
  20986. this[kState] = makeResponse({})
  20987. // 2. Set this’s headers to a new Headers object with this’s relevant
  20988. // Realm, whose header list is this’s response’s header list and guard
  20989. // is "response".
  20990. this[kHeaders] = new Headers(kConstruct)
  20991. setHeadersGuard(this[kHeaders], 'response')
  20992. setHeadersList(this[kHeaders], this[kState].headersList)
  20993. // 3. Let bodyWithType be null.
  20994. let bodyWithType = null
  20995. // 4. If body is non-null, then set bodyWithType to the result of extracting body.
  20996. if (body != null) {
  20997. const [extractedBody, type] = extractBody(body)
  20998. bodyWithType = { body: extractedBody, type }
  20999. }
  21000. // 5. Perform initialize a response given this, init, and bodyWithType.
  21001. initializeResponse(this, init, bodyWithType)
  21002. }
  21003. // Returns response’s type, e.g., "cors".
  21004. get type () {
  21005. webidl.brandCheck(this, Response)
  21006. // The type getter steps are to return this’s response’s type.
  21007. return this[kState].type
  21008. }
  21009. // Returns response’s URL, if it has one; otherwise the empty string.
  21010. get url () {
  21011. webidl.brandCheck(this, Response)
  21012. const urlList = this[kState].urlList
  21013. // The url getter steps are to return the empty string if this’s
  21014. // response’s URL is null; otherwise this’s response’s URL,
  21015. // serialized with exclude fragment set to true.
  21016. const url = urlList[urlList.length - 1] ?? null
  21017. if (url === null) {
  21018. return ''
  21019. }
  21020. return URLSerializer(url, true)
  21021. }
  21022. // Returns whether response was obtained through a redirect.
  21023. get redirected () {
  21024. webidl.brandCheck(this, Response)
  21025. // The redirected getter steps are to return true if this’s response’s URL
  21026. // list has more than one item; otherwise false.
  21027. return this[kState].urlList.length > 1
  21028. }
  21029. // Returns response’s status.
  21030. get status () {
  21031. webidl.brandCheck(this, Response)
  21032. // The status getter steps are to return this’s response’s status.
  21033. return this[kState].status
  21034. }
  21035. // Returns whether response’s status is an ok status.
  21036. get ok () {
  21037. webidl.brandCheck(this, Response)
  21038. // The ok getter steps are to return true if this’s response’s status is an
  21039. // ok status; otherwise false.
  21040. return this[kState].status >= 200 && this[kState].status <= 299
  21041. }
  21042. // Returns response’s status message.
  21043. get statusText () {
  21044. webidl.brandCheck(this, Response)
  21045. // The statusText getter steps are to return this’s response’s status
  21046. // message.
  21047. return this[kState].statusText
  21048. }
  21049. // Returns response’s headers as Headers.
  21050. get headers () {
  21051. webidl.brandCheck(this, Response)
  21052. // The headers getter steps are to return this’s headers.
  21053. return this[kHeaders]
  21054. }
  21055. get body () {
  21056. webidl.brandCheck(this, Response)
  21057. return this[kState].body ? this[kState].body.stream : null
  21058. }
  21059. get bodyUsed () {
  21060. webidl.brandCheck(this, Response)
  21061. return !!this[kState].body && util.isDisturbed(this[kState].body.stream)
  21062. }
  21063. // Returns a clone of response.
  21064. clone () {
  21065. webidl.brandCheck(this, Response)
  21066. // 1. If this is unusable, then throw a TypeError.
  21067. if (bodyUnusable(this)) {
  21068. throw webidl.errors.exception({
  21069. header: 'Response.clone',
  21070. message: 'Body has already been consumed.'
  21071. })
  21072. }
  21073. // 2. Let clonedResponse be the result of cloning this’s response.
  21074. const clonedResponse = cloneResponse(this[kState])
  21075. // Note: To re-register because of a new stream.
  21076. if (hasFinalizationRegistry && this[kState].body?.stream) {
  21077. streamRegistry.register(this, new WeakRef(this[kState].body.stream))
  21078. }
  21079. // 3. Return the result of creating a Response object, given
  21080. // clonedResponse, this’s headers’s guard, and this’s relevant Realm.
  21081. return fromInnerResponse(clonedResponse, getHeadersGuard(this[kHeaders]))
  21082. }
  21083. [nodeUtil.inspect.custom] (depth, options) {
  21084. if (options.depth === null) {
  21085. options.depth = 2
  21086. }
  21087. options.colors ??= true
  21088. const properties = {
  21089. status: this.status,
  21090. statusText: this.statusText,
  21091. headers: this.headers,
  21092. body: this.body,
  21093. bodyUsed: this.bodyUsed,
  21094. ok: this.ok,
  21095. redirected: this.redirected,
  21096. type: this.type,
  21097. url: this.url
  21098. }
  21099. return `Response ${nodeUtil.formatWithOptions(options, properties)}`
  21100. }
  21101. }
  21102. mixinBody(Response)
  21103. Object.defineProperties(Response.prototype, {
  21104. type: kEnumerableProperty,
  21105. url: kEnumerableProperty,
  21106. status: kEnumerableProperty,
  21107. ok: kEnumerableProperty,
  21108. redirected: kEnumerableProperty,
  21109. statusText: kEnumerableProperty,
  21110. headers: kEnumerableProperty,
  21111. clone: kEnumerableProperty,
  21112. body: kEnumerableProperty,
  21113. bodyUsed: kEnumerableProperty,
  21114. [Symbol.toStringTag]: {
  21115. value: 'Response',
  21116. configurable: true
  21117. }
  21118. })
  21119. Object.defineProperties(Response, {
  21120. json: kEnumerableProperty,
  21121. redirect: kEnumerableProperty,
  21122. error: kEnumerableProperty
  21123. })
  21124. // https://fetch.spec.whatwg.org/#concept-response-clone
  21125. function cloneResponse (response) {
  21126. // To clone a response response, run these steps:
  21127. // 1. If response is a filtered response, then return a new identical
  21128. // filtered response whose internal response is a clone of response’s
  21129. // internal response.
  21130. if (response.internalResponse) {
  21131. return filterResponse(
  21132. cloneResponse(response.internalResponse),
  21133. response.type
  21134. )
  21135. }
  21136. // 2. Let newResponse be a copy of response, except for its body.
  21137. const newResponse = makeResponse({ ...response, body: null })
  21138. // 3. If response’s body is non-null, then set newResponse’s body to the
  21139. // result of cloning response’s body.
  21140. if (response.body != null) {
  21141. newResponse.body = cloneBody(newResponse, response.body)
  21142. }
  21143. // 4. Return newResponse.
  21144. return newResponse
  21145. }
  21146. function makeResponse (init) {
  21147. return {
  21148. aborted: false,
  21149. rangeRequested: false,
  21150. timingAllowPassed: false,
  21151. requestIncludesCredentials: false,
  21152. type: 'default',
  21153. status: 200,
  21154. timingInfo: null,
  21155. cacheState: '',
  21156. statusText: '',
  21157. ...init,
  21158. headersList: init?.headersList
  21159. ? new HeadersList(init?.headersList)
  21160. : new HeadersList(),
  21161. urlList: init?.urlList ? [...init.urlList] : []
  21162. }
  21163. }
  21164. function makeNetworkError (reason) {
  21165. const isError = isErrorLike(reason)
  21166. return makeResponse({
  21167. type: 'error',
  21168. status: 0,
  21169. error: isError
  21170. ? reason
  21171. : new Error(reason ? String(reason) : reason),
  21172. aborted: reason && reason.name === 'AbortError'
  21173. })
  21174. }
  21175. // @see https://fetch.spec.whatwg.org/#concept-network-error
  21176. function isNetworkError (response) {
  21177. return (
  21178. // A network error is a response whose type is "error",
  21179. response.type === 'error' &&
  21180. // status is 0
  21181. response.status === 0
  21182. )
  21183. }
  21184. function makeFilteredResponse (response, state) {
  21185. state = {
  21186. internalResponse: response,
  21187. ...state
  21188. }
  21189. return new Proxy(response, {
  21190. get (target, p) {
  21191. return p in state ? state[p] : target[p]
  21192. },
  21193. set (target, p, value) {
  21194. assert(!(p in state))
  21195. target[p] = value
  21196. return true
  21197. }
  21198. })
  21199. }
  21200. // https://fetch.spec.whatwg.org/#concept-filtered-response
  21201. function filterResponse (response, type) {
  21202. // Set response to the following filtered response with response as its
  21203. // internal response, depending on request’s response tainting:
  21204. if (type === 'basic') {
  21205. // A basic filtered response is a filtered response whose type is "basic"
  21206. // and header list excludes any headers in internal response’s header list
  21207. // whose name is a forbidden response-header name.
  21208. // Note: undici does not implement forbidden response-header names
  21209. return makeFilteredResponse(response, {
  21210. type: 'basic',
  21211. headersList: response.headersList
  21212. })
  21213. } else if (type === 'cors') {
  21214. // A CORS filtered response is a filtered response whose type is "cors"
  21215. // and header list excludes any headers in internal response’s header
  21216. // list whose name is not a CORS-safelisted response-header name, given
  21217. // internal response’s CORS-exposed header-name list.
  21218. // Note: undici does not implement CORS-safelisted response-header names
  21219. return makeFilteredResponse(response, {
  21220. type: 'cors',
  21221. headersList: response.headersList
  21222. })
  21223. } else if (type === 'opaque') {
  21224. // An opaque filtered response is a filtered response whose type is
  21225. // "opaque", URL list is the empty list, status is 0, status message
  21226. // is the empty byte sequence, header list is empty, and body is null.
  21227. return makeFilteredResponse(response, {
  21228. type: 'opaque',
  21229. urlList: Object.freeze([]),
  21230. status: 0,
  21231. statusText: '',
  21232. body: null
  21233. })
  21234. } else if (type === 'opaqueredirect') {
  21235. // An opaque-redirect filtered response is a filtered response whose type
  21236. // is "opaqueredirect", status is 0, status message is the empty byte
  21237. // sequence, header list is empty, and body is null.
  21238. return makeFilteredResponse(response, {
  21239. type: 'opaqueredirect',
  21240. status: 0,
  21241. statusText: '',
  21242. headersList: [],
  21243. body: null
  21244. })
  21245. } else {
  21246. assert(false)
  21247. }
  21248. }
  21249. // https://fetch.spec.whatwg.org/#appropriate-network-error
  21250. function makeAppropriateNetworkError (fetchParams, err = null) {
  21251. // 1. Assert: fetchParams is canceled.
  21252. assert(isCancelled(fetchParams))
  21253. // 2. Return an aborted network error if fetchParams is aborted;
  21254. // otherwise return a network error.
  21255. return isAborted(fetchParams)
  21256. ? makeNetworkError(Object.assign(new DOMException('The operation was aborted.', 'AbortError'), { cause: err }))
  21257. : makeNetworkError(Object.assign(new DOMException('Request was cancelled.'), { cause: err }))
  21258. }
  21259. // https://whatpr.org/fetch/1392.html#initialize-a-response
  21260. function initializeResponse (response, init, body) {
  21261. // 1. If init["status"] is not in the range 200 to 599, inclusive, then
  21262. // throw a RangeError.
  21263. if (init.status !== null && (init.status < 200 || init.status > 599)) {
  21264. throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.')
  21265. }
  21266. // 2. If init["statusText"] does not match the reason-phrase token production,
  21267. // then throw a TypeError.
  21268. if ('statusText' in init && init.statusText != null) {
  21269. // See, https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2:
  21270. // reason-phrase = *( HTAB / SP / VCHAR / obs-text )
  21271. if (!isValidReasonPhrase(String(init.statusText))) {
  21272. throw new TypeError('Invalid statusText')
  21273. }
  21274. }
  21275. // 3. Set response’s response’s status to init["status"].
  21276. if ('status' in init && init.status != null) {
  21277. response[kState].status = init.status
  21278. }
  21279. // 4. Set response’s response’s status message to init["statusText"].
  21280. if ('statusText' in init && init.statusText != null) {
  21281. response[kState].statusText = init.statusText
  21282. }
  21283. // 5. If init["headers"] exists, then fill response’s headers with init["headers"].
  21284. if ('headers' in init && init.headers != null) {
  21285. fill(response[kHeaders], init.headers)
  21286. }
  21287. // 6. If body was given, then:
  21288. if (body) {
  21289. // 1. If response's status is a null body status, then throw a TypeError.
  21290. if (nullBodyStatus.includes(response.status)) {
  21291. throw webidl.errors.exception({
  21292. header: 'Response constructor',
  21293. message: `Invalid response status code ${response.status}`
  21294. })
  21295. }
  21296. // 2. Set response's body to body's body.
  21297. response[kState].body = body.body
  21298. // 3. If body's type is non-null and response's header list does not contain
  21299. // `Content-Type`, then append (`Content-Type`, body's type) to response's header list.
  21300. if (body.type != null && !response[kState].headersList.contains('content-type', true)) {
  21301. response[kState].headersList.append('content-type', body.type, true)
  21302. }
  21303. }
  21304. }
  21305. /**
  21306. * @see https://fetch.spec.whatwg.org/#response-create
  21307. * @param {any} innerResponse
  21308. * @param {'request' | 'immutable' | 'request-no-cors' | 'response' | 'none'} guard
  21309. * @returns {Response}
  21310. */
  21311. function fromInnerResponse (innerResponse, guard) {
  21312. const response = new Response(kConstruct)
  21313. response[kState] = innerResponse
  21314. response[kHeaders] = new Headers(kConstruct)
  21315. setHeadersList(response[kHeaders], innerResponse.headersList)
  21316. setHeadersGuard(response[kHeaders], guard)
  21317. if (hasFinalizationRegistry && innerResponse.body?.stream) {
  21318. // If the target (response) is reclaimed, the cleanup callback may be called at some point with
  21319. // the held value provided for it (innerResponse.body.stream). The held value can be any value:
  21320. // a primitive or an object, even undefined. If the held value is an object, the registry keeps
  21321. // a strong reference to it (so it can pass it to the cleanup callback later). Reworded from
  21322. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
  21323. streamRegistry.register(response, new WeakRef(innerResponse.body.stream))
  21324. }
  21325. return response
  21326. }
  21327. webidl.converters.ReadableStream = webidl.interfaceConverter(
  21328. ReadableStream
  21329. )
  21330. webidl.converters.FormData = webidl.interfaceConverter(
  21331. FormData
  21332. )
  21333. webidl.converters.URLSearchParams = webidl.interfaceConverter(
  21334. URLSearchParams
  21335. )
  21336. // https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit
  21337. webidl.converters.XMLHttpRequestBodyInit = function (V, prefix, name) {
  21338. if (typeof V === 'string') {
  21339. return webidl.converters.USVString(V, prefix, name)
  21340. }
  21341. if (isBlobLike(V)) {
  21342. return webidl.converters.Blob(V, prefix, name, { strict: false })
  21343. }
  21344. if (ArrayBuffer.isView(V) || types.isArrayBuffer(V)) {
  21345. return webidl.converters.BufferSource(V, prefix, name)
  21346. }
  21347. if (util.isFormDataLike(V)) {
  21348. return webidl.converters.FormData(V, prefix, name, { strict: false })
  21349. }
  21350. if (V instanceof URLSearchParams) {
  21351. return webidl.converters.URLSearchParams(V, prefix, name)
  21352. }
  21353. return webidl.converters.DOMString(V, prefix, name)
  21354. }
  21355. // https://fetch.spec.whatwg.org/#bodyinit
  21356. webidl.converters.BodyInit = function (V, prefix, argument) {
  21357. if (V instanceof ReadableStream) {
  21358. return webidl.converters.ReadableStream(V, prefix, argument)
  21359. }
  21360. // Note: the spec doesn't include async iterables,
  21361. // this is an undici extension.
  21362. if (V?.[Symbol.asyncIterator]) {
  21363. return V
  21364. }
  21365. return webidl.converters.XMLHttpRequestBodyInit(V, prefix, argument)
  21366. }
  21367. webidl.converters.ResponseInit = webidl.dictionaryConverter([
  21368. {
  21369. key: 'status',
  21370. converter: webidl.converters['unsigned short'],
  21371. defaultValue: () => 200
  21372. },
  21373. {
  21374. key: 'statusText',
  21375. converter: webidl.converters.ByteString,
  21376. defaultValue: () => ''
  21377. },
  21378. {
  21379. key: 'headers',
  21380. converter: webidl.converters.HeadersInit
  21381. }
  21382. ])
  21383. module.exports = {
  21384. isNetworkError,
  21385. makeNetworkError,
  21386. makeResponse,
  21387. makeAppropriateNetworkError,
  21388. filterResponse,
  21389. Response,
  21390. cloneResponse,
  21391. fromInnerResponse
  21392. }
  21393. /***/ }),
  21394. /***/ 3627:
  21395. /***/ ((module) => {
  21396. module.exports = {
  21397. kUrl: Symbol('url'),
  21398. kHeaders: Symbol('headers'),
  21399. kSignal: Symbol('signal'),
  21400. kState: Symbol('state'),
  21401. kDispatcher: Symbol('dispatcher')
  21402. }
  21403. /***/ }),
  21404. /***/ 3168:
  21405. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  21406. const { Transform } = __nccwpck_require__(7075)
  21407. const zlib = __nccwpck_require__(8522)
  21408. const { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = __nccwpck_require__(4495)
  21409. const { getGlobalOrigin } = __nccwpck_require__(1059)
  21410. const { collectASequenceOfCodePoints, collectAnHTTPQuotedString, removeChars, parseMIMEType } = __nccwpck_require__(1900)
  21411. const { performance } = __nccwpck_require__(643)
  21412. const { isBlobLike, ReadableStreamFrom, isValidHTTPToken, normalizedMethodRecordsBase } = __nccwpck_require__(3440)
  21413. const assert = __nccwpck_require__(4589)
  21414. const { isUint8Array } = __nccwpck_require__(3429)
  21415. const { webidl } = __nccwpck_require__(5893)
  21416. let supportedHashes = []
  21417. // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
  21418. /** @type {import('crypto')} */
  21419. let crypto
  21420. try {
  21421. crypto = __nccwpck_require__(7598)
  21422. const possibleRelevantHashes = ['sha256', 'sha384', 'sha512']
  21423. supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash))
  21424. /* c8 ignore next 3 */
  21425. } catch {
  21426. }
  21427. function responseURL (response) {
  21428. // https://fetch.spec.whatwg.org/#responses
  21429. // A response has an associated URL. It is a pointer to the last URL
  21430. // in response’s URL list and null if response’s URL list is empty.
  21431. const urlList = response.urlList
  21432. const length = urlList.length
  21433. return length === 0 ? null : urlList[length - 1].toString()
  21434. }
  21435. // https://fetch.spec.whatwg.org/#concept-response-location-url
  21436. function responseLocationURL (response, requestFragment) {
  21437. // 1. If response’s status is not a redirect status, then return null.
  21438. if (!redirectStatusSet.has(response.status)) {
  21439. return null
  21440. }
  21441. // 2. Let location be the result of extracting header list values given
  21442. // `Location` and response’s header list.
  21443. let location = response.headersList.get('location', true)
  21444. // 3. If location is a header value, then set location to the result of
  21445. // parsing location with response’s URL.
  21446. if (location !== null && isValidHeaderValue(location)) {
  21447. if (!isValidEncodedURL(location)) {
  21448. // Some websites respond location header in UTF-8 form without encoding them as ASCII
  21449. // and major browsers redirect them to correctly UTF-8 encoded addresses.
  21450. // Here, we handle that behavior in the same way.
  21451. location = normalizeBinaryStringToUtf8(location)
  21452. }
  21453. location = new URL(location, responseURL(response))
  21454. }
  21455. // 4. If location is a URL whose fragment is null, then set location’s
  21456. // fragment to requestFragment.
  21457. if (location && !location.hash) {
  21458. location.hash = requestFragment
  21459. }
  21460. // 5. Return location.
  21461. return location
  21462. }
  21463. /**
  21464. * @see https://www.rfc-editor.org/rfc/rfc1738#section-2.2
  21465. * @param {string} url
  21466. * @returns {boolean}
  21467. */
  21468. function isValidEncodedURL (url) {
  21469. for (let i = 0; i < url.length; ++i) {
  21470. const code = url.charCodeAt(i)
  21471. if (
  21472. code > 0x7E || // Non-US-ASCII + DEL
  21473. code < 0x20 // Control characters NUL - US
  21474. ) {
  21475. return false
  21476. }
  21477. }
  21478. return true
  21479. }
  21480. /**
  21481. * If string contains non-ASCII characters, assumes it's UTF-8 encoded and decodes it.
  21482. * Since UTF-8 is a superset of ASCII, this will work for ASCII strings as well.
  21483. * @param {string} value
  21484. * @returns {string}
  21485. */
  21486. function normalizeBinaryStringToUtf8 (value) {
  21487. return Buffer.from(value, 'binary').toString('utf8')
  21488. }
  21489. /** @returns {URL} */
  21490. function requestCurrentURL (request) {
  21491. return request.urlList[request.urlList.length - 1]
  21492. }
  21493. function requestBadPort (request) {
  21494. // 1. Let url be request’s current URL.
  21495. const url = requestCurrentURL(request)
  21496. // 2. If url’s scheme is an HTTP(S) scheme and url’s port is a bad port,
  21497. // then return blocked.
  21498. if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) {
  21499. return 'blocked'
  21500. }
  21501. // 3. Return allowed.
  21502. return 'allowed'
  21503. }
  21504. function isErrorLike (object) {
  21505. return object instanceof Error || (
  21506. object?.constructor?.name === 'Error' ||
  21507. object?.constructor?.name === 'DOMException'
  21508. )
  21509. }
  21510. // Check whether |statusText| is a ByteString and
  21511. // matches the Reason-Phrase token production.
  21512. // RFC 2616: https://tools.ietf.org/html/rfc2616
  21513. // RFC 7230: https://tools.ietf.org/html/rfc7230
  21514. // "reason-phrase = *( HTAB / SP / VCHAR / obs-text )"
  21515. // https://github.com/chromium/chromium/blob/94.0.4604.1/third_party/blink/renderer/core/fetch/response.cc#L116
  21516. function isValidReasonPhrase (statusText) {
  21517. for (let i = 0; i < statusText.length; ++i) {
  21518. const c = statusText.charCodeAt(i)
  21519. if (
  21520. !(
  21521. (
  21522. c === 0x09 || // HTAB
  21523. (c >= 0x20 && c <= 0x7e) || // SP / VCHAR
  21524. (c >= 0x80 && c <= 0xff)
  21525. ) // obs-text
  21526. )
  21527. ) {
  21528. return false
  21529. }
  21530. }
  21531. return true
  21532. }
  21533. /**
  21534. * @see https://fetch.spec.whatwg.org/#header-name
  21535. * @param {string} potentialValue
  21536. */
  21537. const isValidHeaderName = isValidHTTPToken
  21538. /**
  21539. * @see https://fetch.spec.whatwg.org/#header-value
  21540. * @param {string} potentialValue
  21541. */
  21542. function isValidHeaderValue (potentialValue) {
  21543. // - Has no leading or trailing HTTP tab or space bytes.
  21544. // - Contains no 0x00 (NUL) or HTTP newline bytes.
  21545. return (
  21546. potentialValue[0] === '\t' ||
  21547. potentialValue[0] === ' ' ||
  21548. potentialValue[potentialValue.length - 1] === '\t' ||
  21549. potentialValue[potentialValue.length - 1] === ' ' ||
  21550. potentialValue.includes('\n') ||
  21551. potentialValue.includes('\r') ||
  21552. potentialValue.includes('\0')
  21553. ) === false
  21554. }
  21555. // https://w3c.github.io/webappsec-referrer-policy/#set-requests-referrer-policy-on-redirect
  21556. function setRequestReferrerPolicyOnRedirect (request, actualResponse) {
  21557. // Given a request request and a response actualResponse, this algorithm
  21558. // updates request’s referrer policy according to the Referrer-Policy
  21559. // header (if any) in actualResponse.
  21560. // 1. Let policy be the result of executing § 8.1 Parse a referrer policy
  21561. // from a Referrer-Policy header on actualResponse.
  21562. // 8.1 Parse a referrer policy from a Referrer-Policy header
  21563. // 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy` and response’s header list.
  21564. const { headersList } = actualResponse
  21565. // 2. Let policy be the empty string.
  21566. // 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty string, then set policy to token.
  21567. // 4. Return policy.
  21568. const policyHeader = (headersList.get('referrer-policy', true) ?? '').split(',')
  21569. // Note: As the referrer-policy can contain multiple policies
  21570. // separated by comma, we need to loop through all of them
  21571. // and pick the first valid one.
  21572. // Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#specify_a_fallback_policy
  21573. let policy = ''
  21574. if (policyHeader.length > 0) {
  21575. // The right-most policy takes precedence.
  21576. // The left-most policy is the fallback.
  21577. for (let i = policyHeader.length; i !== 0; i--) {
  21578. const token = policyHeader[i - 1].trim()
  21579. if (referrerPolicyTokens.has(token)) {
  21580. policy = token
  21581. break
  21582. }
  21583. }
  21584. }
  21585. // 2. If policy is not the empty string, then set request’s referrer policy to policy.
  21586. if (policy !== '') {
  21587. request.referrerPolicy = policy
  21588. }
  21589. }
  21590. // https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check
  21591. function crossOriginResourcePolicyCheck () {
  21592. // TODO
  21593. return 'allowed'
  21594. }
  21595. // https://fetch.spec.whatwg.org/#concept-cors-check
  21596. function corsCheck () {
  21597. // TODO
  21598. return 'success'
  21599. }
  21600. // https://fetch.spec.whatwg.org/#concept-tao-check
  21601. function TAOCheck () {
  21602. // TODO
  21603. return 'success'
  21604. }
  21605. function appendFetchMetadata (httpRequest) {
  21606. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-dest-header
  21607. // TODO
  21608. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-mode-header
  21609. // 1. Assert: r’s url is a potentially trustworthy URL.
  21610. // TODO
  21611. // 2. Let header be a Structured Header whose value is a token.
  21612. let header = null
  21613. // 3. Set header’s value to r’s mode.
  21614. header = httpRequest.mode
  21615. // 4. Set a structured field value `Sec-Fetch-Mode`/header in r’s header list.
  21616. httpRequest.headersList.set('sec-fetch-mode', header, true)
  21617. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-site-header
  21618. // TODO
  21619. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-user-header
  21620. // TODO
  21621. }
  21622. // https://fetch.spec.whatwg.org/#append-a-request-origin-header
  21623. function appendRequestOriginHeader (request) {
  21624. // 1. Let serializedOrigin be the result of byte-serializing a request origin
  21625. // with request.
  21626. // TODO: implement "byte-serializing a request origin"
  21627. let serializedOrigin = request.origin
  21628. // - "'client' is changed to an origin during fetching."
  21629. // This doesn't happen in undici (in most cases) because undici, by default,
  21630. // has no concept of origin.
  21631. // - request.origin can also be set to request.client.origin (client being
  21632. // an environment settings object), which is undefined without using
  21633. // setGlobalOrigin.
  21634. if (serializedOrigin === 'client' || serializedOrigin === undefined) {
  21635. return
  21636. }
  21637. // 2. If request’s response tainting is "cors" or request’s mode is "websocket",
  21638. // then append (`Origin`, serializedOrigin) to request’s header list.
  21639. // 3. Otherwise, if request’s method is neither `GET` nor `HEAD`, then:
  21640. if (request.responseTainting === 'cors' || request.mode === 'websocket') {
  21641. request.headersList.append('origin', serializedOrigin, true)
  21642. } else if (request.method !== 'GET' && request.method !== 'HEAD') {
  21643. // 1. Switch on request’s referrer policy:
  21644. switch (request.referrerPolicy) {
  21645. case 'no-referrer':
  21646. // Set serializedOrigin to `null`.
  21647. serializedOrigin = null
  21648. break
  21649. case 'no-referrer-when-downgrade':
  21650. case 'strict-origin':
  21651. case 'strict-origin-when-cross-origin':
  21652. // If request’s origin is a tuple origin, its scheme is "https", and
  21653. // request’s current URL’s scheme is not "https", then set
  21654. // serializedOrigin to `null`.
  21655. if (request.origin && urlHasHttpsScheme(request.origin) && !urlHasHttpsScheme(requestCurrentURL(request))) {
  21656. serializedOrigin = null
  21657. }
  21658. break
  21659. case 'same-origin':
  21660. // If request’s origin is not same origin with request’s current URL’s
  21661. // origin, then set serializedOrigin to `null`.
  21662. if (!sameOrigin(request, requestCurrentURL(request))) {
  21663. serializedOrigin = null
  21664. }
  21665. break
  21666. default:
  21667. // Do nothing.
  21668. }
  21669. // 2. Append (`Origin`, serializedOrigin) to request’s header list.
  21670. request.headersList.append('origin', serializedOrigin, true)
  21671. }
  21672. }
  21673. // https://w3c.github.io/hr-time/#dfn-coarsen-time
  21674. function coarsenTime (timestamp, crossOriginIsolatedCapability) {
  21675. // TODO
  21676. return timestamp
  21677. }
  21678. // https://fetch.spec.whatwg.org/#clamp-and-coarsen-connection-timing-info
  21679. function clampAndCoarsenConnectionTimingInfo (connectionTimingInfo, defaultStartTime, crossOriginIsolatedCapability) {
  21680. if (!connectionTimingInfo?.startTime || connectionTimingInfo.startTime < defaultStartTime) {
  21681. return {
  21682. domainLookupStartTime: defaultStartTime,
  21683. domainLookupEndTime: defaultStartTime,
  21684. connectionStartTime: defaultStartTime,
  21685. connectionEndTime: defaultStartTime,
  21686. secureConnectionStartTime: defaultStartTime,
  21687. ALPNNegotiatedProtocol: connectionTimingInfo?.ALPNNegotiatedProtocol
  21688. }
  21689. }
  21690. return {
  21691. domainLookupStartTime: coarsenTime(connectionTimingInfo.domainLookupStartTime, crossOriginIsolatedCapability),
  21692. domainLookupEndTime: coarsenTime(connectionTimingInfo.domainLookupEndTime, crossOriginIsolatedCapability),
  21693. connectionStartTime: coarsenTime(connectionTimingInfo.connectionStartTime, crossOriginIsolatedCapability),
  21694. connectionEndTime: coarsenTime(connectionTimingInfo.connectionEndTime, crossOriginIsolatedCapability),
  21695. secureConnectionStartTime: coarsenTime(connectionTimingInfo.secureConnectionStartTime, crossOriginIsolatedCapability),
  21696. ALPNNegotiatedProtocol: connectionTimingInfo.ALPNNegotiatedProtocol
  21697. }
  21698. }
  21699. // https://w3c.github.io/hr-time/#dfn-coarsened-shared-current-time
  21700. function coarsenedSharedCurrentTime (crossOriginIsolatedCapability) {
  21701. return coarsenTime(performance.now(), crossOriginIsolatedCapability)
  21702. }
  21703. // https://fetch.spec.whatwg.org/#create-an-opaque-timing-info
  21704. function createOpaqueTimingInfo (timingInfo) {
  21705. return {
  21706. startTime: timingInfo.startTime ?? 0,
  21707. redirectStartTime: 0,
  21708. redirectEndTime: 0,
  21709. postRedirectStartTime: timingInfo.startTime ?? 0,
  21710. finalServiceWorkerStartTime: 0,
  21711. finalNetworkResponseStartTime: 0,
  21712. finalNetworkRequestStartTime: 0,
  21713. endTime: 0,
  21714. encodedBodySize: 0,
  21715. decodedBodySize: 0,
  21716. finalConnectionTimingInfo: null
  21717. }
  21718. }
  21719. // https://html.spec.whatwg.org/multipage/origin.html#policy-container
  21720. function makePolicyContainer () {
  21721. // Note: the fetch spec doesn't make use of embedder policy or CSP list
  21722. return {
  21723. referrerPolicy: 'strict-origin-when-cross-origin'
  21724. }
  21725. }
  21726. // https://html.spec.whatwg.org/multipage/origin.html#clone-a-policy-container
  21727. function clonePolicyContainer (policyContainer) {
  21728. return {
  21729. referrerPolicy: policyContainer.referrerPolicy
  21730. }
  21731. }
  21732. // https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer
  21733. function determineRequestsReferrer (request) {
  21734. // 1. Let policy be request's referrer policy.
  21735. const policy = request.referrerPolicy
  21736. // Note: policy cannot (shouldn't) be null or an empty string.
  21737. assert(policy)
  21738. // 2. Let environment be request’s client.
  21739. let referrerSource = null
  21740. // 3. Switch on request’s referrer:
  21741. if (request.referrer === 'client') {
  21742. // Note: node isn't a browser and doesn't implement document/iframes,
  21743. // so we bypass this step and replace it with our own.
  21744. const globalOrigin = getGlobalOrigin()
  21745. if (!globalOrigin || globalOrigin.origin === 'null') {
  21746. return 'no-referrer'
  21747. }
  21748. // note: we need to clone it as it's mutated
  21749. referrerSource = new URL(globalOrigin)
  21750. } else if (request.referrer instanceof URL) {
  21751. // Let referrerSource be request’s referrer.
  21752. referrerSource = request.referrer
  21753. }
  21754. // 4. Let request’s referrerURL be the result of stripping referrerSource for
  21755. // use as a referrer.
  21756. let referrerURL = stripURLForReferrer(referrerSource)
  21757. // 5. Let referrerOrigin be the result of stripping referrerSource for use as
  21758. // a referrer, with the origin-only flag set to true.
  21759. const referrerOrigin = stripURLForReferrer(referrerSource, true)
  21760. // 6. If the result of serializing referrerURL is a string whose length is
  21761. // greater than 4096, set referrerURL to referrerOrigin.
  21762. if (referrerURL.toString().length > 4096) {
  21763. referrerURL = referrerOrigin
  21764. }
  21765. const areSameOrigin = sameOrigin(request, referrerURL)
  21766. const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) &&
  21767. !isURLPotentiallyTrustworthy(request.url)
  21768. // 8. Execute the switch statements corresponding to the value of policy:
  21769. switch (policy) {
  21770. case 'origin': return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true)
  21771. case 'unsafe-url': return referrerURL
  21772. case 'same-origin':
  21773. return areSameOrigin ? referrerOrigin : 'no-referrer'
  21774. case 'origin-when-cross-origin':
  21775. return areSameOrigin ? referrerURL : referrerOrigin
  21776. case 'strict-origin-when-cross-origin': {
  21777. const currentURL = requestCurrentURL(request)
  21778. // 1. If the origin of referrerURL and the origin of request’s current
  21779. // URL are the same, then return referrerURL.
  21780. if (sameOrigin(referrerURL, currentURL)) {
  21781. return referrerURL
  21782. }
  21783. // 2. If referrerURL is a potentially trustworthy URL and request’s
  21784. // current URL is not a potentially trustworthy URL, then return no
  21785. // referrer.
  21786. if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) {
  21787. return 'no-referrer'
  21788. }
  21789. // 3. Return referrerOrigin.
  21790. return referrerOrigin
  21791. }
  21792. case 'strict-origin': // eslint-disable-line
  21793. /**
  21794. * 1. If referrerURL is a potentially trustworthy URL and
  21795. * request’s current URL is not a potentially trustworthy URL,
  21796. * then return no referrer.
  21797. * 2. Return referrerOrigin
  21798. */
  21799. case 'no-referrer-when-downgrade': // eslint-disable-line
  21800. /**
  21801. * 1. If referrerURL is a potentially trustworthy URL and
  21802. * request’s current URL is not a potentially trustworthy URL,
  21803. * then return no referrer.
  21804. * 2. Return referrerOrigin
  21805. */
  21806. default: // eslint-disable-line
  21807. return isNonPotentiallyTrustWorthy ? 'no-referrer' : referrerOrigin
  21808. }
  21809. }
  21810. /**
  21811. * @see https://w3c.github.io/webappsec-referrer-policy/#strip-url
  21812. * @param {URL} url
  21813. * @param {boolean|undefined} originOnly
  21814. */
  21815. function stripURLForReferrer (url, originOnly) {
  21816. // 1. Assert: url is a URL.
  21817. assert(url instanceof URL)
  21818. url = new URL(url)
  21819. // 2. If url’s scheme is a local scheme, then return no referrer.
  21820. if (url.protocol === 'file:' || url.protocol === 'about:' || url.protocol === 'blank:') {
  21821. return 'no-referrer'
  21822. }
  21823. // 3. Set url’s username to the empty string.
  21824. url.username = ''
  21825. // 4. Set url’s password to the empty string.
  21826. url.password = ''
  21827. // 5. Set url’s fragment to null.
  21828. url.hash = ''
  21829. // 6. If the origin-only flag is true, then:
  21830. if (originOnly) {
  21831. // 1. Set url’s path to « the empty string ».
  21832. url.pathname = ''
  21833. // 2. Set url’s query to null.
  21834. url.search = ''
  21835. }
  21836. // 7. Return url.
  21837. return url
  21838. }
  21839. function isURLPotentiallyTrustworthy (url) {
  21840. if (!(url instanceof URL)) {
  21841. return false
  21842. }
  21843. // If child of about, return true
  21844. if (url.href === 'about:blank' || url.href === 'about:srcdoc') {
  21845. return true
  21846. }
  21847. // If scheme is data, return true
  21848. if (url.protocol === 'data:') return true
  21849. // If file, return true
  21850. if (url.protocol === 'file:') return true
  21851. return isOriginPotentiallyTrustworthy(url.origin)
  21852. function isOriginPotentiallyTrustworthy (origin) {
  21853. // If origin is explicitly null, return false
  21854. if (origin == null || origin === 'null') return false
  21855. const originAsURL = new URL(origin)
  21856. // If secure, return true
  21857. if (originAsURL.protocol === 'https:' || originAsURL.protocol === 'wss:') {
  21858. return true
  21859. }
  21860. // If localhost or variants, return true
  21861. if (/^127(?:\.[0-9]+){0,2}\.[0-9]+$|^\[(?:0*:)*?:?0*1\]$/.test(originAsURL.hostname) ||
  21862. (originAsURL.hostname === 'localhost' || originAsURL.hostname.includes('localhost.')) ||
  21863. (originAsURL.hostname.endsWith('.localhost'))) {
  21864. return true
  21865. }
  21866. // If any other, return false
  21867. return false
  21868. }
  21869. }
  21870. /**
  21871. * @see https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist
  21872. * @param {Uint8Array} bytes
  21873. * @param {string} metadataList
  21874. */
  21875. function bytesMatch (bytes, metadataList) {
  21876. // If node is not built with OpenSSL support, we cannot check
  21877. // a request's integrity, so allow it by default (the spec will
  21878. // allow requests if an invalid hash is given, as precedence).
  21879. /* istanbul ignore if: only if node is built with --without-ssl */
  21880. if (crypto === undefined) {
  21881. return true
  21882. }
  21883. // 1. Let parsedMetadata be the result of parsing metadataList.
  21884. const parsedMetadata = parseMetadata(metadataList)
  21885. // 2. If parsedMetadata is no metadata, return true.
  21886. if (parsedMetadata === 'no metadata') {
  21887. return true
  21888. }
  21889. // 3. If response is not eligible for integrity validation, return false.
  21890. // TODO
  21891. // 4. If parsedMetadata is the empty set, return true.
  21892. if (parsedMetadata.length === 0) {
  21893. return true
  21894. }
  21895. // 5. Let metadata be the result of getting the strongest
  21896. // metadata from parsedMetadata.
  21897. const strongest = getStrongestMetadata(parsedMetadata)
  21898. const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest)
  21899. // 6. For each item in metadata:
  21900. for (const item of metadata) {
  21901. // 1. Let algorithm be the alg component of item.
  21902. const algorithm = item.algo
  21903. // 2. Let expectedValue be the val component of item.
  21904. const expectedValue = item.hash
  21905. // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
  21906. // "be liberal with padding". This is annoying, and it's not even in the spec.
  21907. // 3. Let actualValue be the result of applying algorithm to bytes.
  21908. let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64')
  21909. if (actualValue[actualValue.length - 1] === '=') {
  21910. if (actualValue[actualValue.length - 2] === '=') {
  21911. actualValue = actualValue.slice(0, -2)
  21912. } else {
  21913. actualValue = actualValue.slice(0, -1)
  21914. }
  21915. }
  21916. // 4. If actualValue is a case-sensitive match for expectedValue,
  21917. // return true.
  21918. if (compareBase64Mixed(actualValue, expectedValue)) {
  21919. return true
  21920. }
  21921. }
  21922. // 7. Return false.
  21923. return false
  21924. }
  21925. // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
  21926. // https://www.w3.org/TR/CSP2/#source-list-syntax
  21927. // https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
  21928. const parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i
  21929. /**
  21930. * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
  21931. * @param {string} metadata
  21932. */
  21933. function parseMetadata (metadata) {
  21934. // 1. Let result be the empty set.
  21935. /** @type {{ algo: string, hash: string }[]} */
  21936. const result = []
  21937. // 2. Let empty be equal to true.
  21938. let empty = true
  21939. // 3. For each token returned by splitting metadata on spaces:
  21940. for (const token of metadata.split(' ')) {
  21941. // 1. Set empty to false.
  21942. empty = false
  21943. // 2. Parse token as a hash-with-options.
  21944. const parsedToken = parseHashWithOptions.exec(token)
  21945. // 3. If token does not parse, continue to the next token.
  21946. if (
  21947. parsedToken === null ||
  21948. parsedToken.groups === undefined ||
  21949. parsedToken.groups.algo === undefined
  21950. ) {
  21951. // Note: Chromium blocks the request at this point, but Firefox
  21952. // gives a warning that an invalid integrity was given. The
  21953. // correct behavior is to ignore these, and subsequently not
  21954. // check the integrity of the resource.
  21955. continue
  21956. }
  21957. // 4. Let algorithm be the hash-algo component of token.
  21958. const algorithm = parsedToken.groups.algo.toLowerCase()
  21959. // 5. If algorithm is a hash function recognized by the user
  21960. // agent, add the parsed token to result.
  21961. if (supportedHashes.includes(algorithm)) {
  21962. result.push(parsedToken.groups)
  21963. }
  21964. }
  21965. // 4. Return no metadata if empty is true, otherwise return result.
  21966. if (empty === true) {
  21967. return 'no metadata'
  21968. }
  21969. return result
  21970. }
  21971. /**
  21972. * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList
  21973. */
  21974. function getStrongestMetadata (metadataList) {
  21975. // Let algorithm be the algo component of the first item in metadataList.
  21976. // Can be sha256
  21977. let algorithm = metadataList[0].algo
  21978. // If the algorithm is sha512, then it is the strongest
  21979. // and we can return immediately
  21980. if (algorithm[3] === '5') {
  21981. return algorithm
  21982. }
  21983. for (let i = 1; i < metadataList.length; ++i) {
  21984. const metadata = metadataList[i]
  21985. // If the algorithm is sha512, then it is the strongest
  21986. // and we can break the loop immediately
  21987. if (metadata.algo[3] === '5') {
  21988. algorithm = 'sha512'
  21989. break
  21990. // If the algorithm is sha384, then a potential sha256 or sha384 is ignored
  21991. } else if (algorithm[3] === '3') {
  21992. continue
  21993. // algorithm is sha256, check if algorithm is sha384 and if so, set it as
  21994. // the strongest
  21995. } else if (metadata.algo[3] === '3') {
  21996. algorithm = 'sha384'
  21997. }
  21998. }
  21999. return algorithm
  22000. }
  22001. function filterMetadataListByAlgorithm (metadataList, algorithm) {
  22002. if (metadataList.length === 1) {
  22003. return metadataList
  22004. }
  22005. let pos = 0
  22006. for (let i = 0; i < metadataList.length; ++i) {
  22007. if (metadataList[i].algo === algorithm) {
  22008. metadataList[pos++] = metadataList[i]
  22009. }
  22010. }
  22011. metadataList.length = pos
  22012. return metadataList
  22013. }
  22014. /**
  22015. * Compares two base64 strings, allowing for base64url
  22016. * in the second string.
  22017. *
  22018. * @param {string} actualValue always base64
  22019. * @param {string} expectedValue base64 or base64url
  22020. * @returns {boolean}
  22021. */
  22022. function compareBase64Mixed (actualValue, expectedValue) {
  22023. if (actualValue.length !== expectedValue.length) {
  22024. return false
  22025. }
  22026. for (let i = 0; i < actualValue.length; ++i) {
  22027. if (actualValue[i] !== expectedValue[i]) {
  22028. if (
  22029. (actualValue[i] === '+' && expectedValue[i] === '-') ||
  22030. (actualValue[i] === '/' && expectedValue[i] === '_')
  22031. ) {
  22032. continue
  22033. }
  22034. return false
  22035. }
  22036. }
  22037. return true
  22038. }
  22039. // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
  22040. function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) {
  22041. // TODO
  22042. }
  22043. /**
  22044. * @link {https://html.spec.whatwg.org/multipage/origin.html#same-origin}
  22045. * @param {URL} A
  22046. * @param {URL} B
  22047. */
  22048. function sameOrigin (A, B) {
  22049. // 1. If A and B are the same opaque origin, then return true.
  22050. if (A.origin === B.origin && A.origin === 'null') {
  22051. return true
  22052. }
  22053. // 2. If A and B are both tuple origins and their schemes,
  22054. // hosts, and port are identical, then return true.
  22055. if (A.protocol === B.protocol && A.hostname === B.hostname && A.port === B.port) {
  22056. return true
  22057. }
  22058. // 3. Return false.
  22059. return false
  22060. }
  22061. function createDeferredPromise () {
  22062. let res
  22063. let rej
  22064. const promise = new Promise((resolve, reject) => {
  22065. res = resolve
  22066. rej = reject
  22067. })
  22068. return { promise, resolve: res, reject: rej }
  22069. }
  22070. function isAborted (fetchParams) {
  22071. return fetchParams.controller.state === 'aborted'
  22072. }
  22073. function isCancelled (fetchParams) {
  22074. return fetchParams.controller.state === 'aborted' ||
  22075. fetchParams.controller.state === 'terminated'
  22076. }
  22077. /**
  22078. * @see https://fetch.spec.whatwg.org/#concept-method-normalize
  22079. * @param {string} method
  22080. */
  22081. function normalizeMethod (method) {
  22082. return normalizedMethodRecordsBase[method.toLowerCase()] ?? method
  22083. }
  22084. // https://infra.spec.whatwg.org/#serialize-a-javascript-value-to-a-json-string
  22085. function serializeJavascriptValueToJSONString (value) {
  22086. // 1. Let result be ? Call(%JSON.stringify%, undefined, « value »).
  22087. const result = JSON.stringify(value)
  22088. // 2. If result is undefined, then throw a TypeError.
  22089. if (result === undefined) {
  22090. throw new TypeError('Value is not JSON serializable')
  22091. }
  22092. // 3. Assert: result is a string.
  22093. assert(typeof result === 'string')
  22094. // 4. Return result.
  22095. return result
  22096. }
  22097. // https://tc39.es/ecma262/#sec-%25iteratorprototype%25-object
  22098. const esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))
  22099. /**
  22100. * @see https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object
  22101. * @param {string} name name of the instance
  22102. * @param {symbol} kInternalIterator
  22103. * @param {string | number} [keyIndex]
  22104. * @param {string | number} [valueIndex]
  22105. */
  22106. function createIterator (name, kInternalIterator, keyIndex = 0, valueIndex = 1) {
  22107. class FastIterableIterator {
  22108. /** @type {any} */
  22109. #target
  22110. /** @type {'key' | 'value' | 'key+value'} */
  22111. #kind
  22112. /** @type {number} */
  22113. #index
  22114. /**
  22115. * @see https://webidl.spec.whatwg.org/#dfn-default-iterator-object
  22116. * @param {unknown} target
  22117. * @param {'key' | 'value' | 'key+value'} kind
  22118. */
  22119. constructor (target, kind) {
  22120. this.#target = target
  22121. this.#kind = kind
  22122. this.#index = 0
  22123. }
  22124. next () {
  22125. // 1. Let interface be the interface for which the iterator prototype object exists.
  22126. // 2. Let thisValue be the this value.
  22127. // 3. Let object be ? ToObject(thisValue).
  22128. // 4. If object is a platform object, then perform a security
  22129. // check, passing:
  22130. // 5. If object is not a default iterator object for interface,
  22131. // then throw a TypeError.
  22132. if (typeof this !== 'object' || this === null || !(#target in this)) {
  22133. throw new TypeError(
  22134. `'next' called on an object that does not implement interface ${name} Iterator.`
  22135. )
  22136. }
  22137. // 6. Let index be object’s index.
  22138. // 7. Let kind be object’s kind.
  22139. // 8. Let values be object’s target's value pairs to iterate over.
  22140. const index = this.#index
  22141. const values = this.#target[kInternalIterator]
  22142. // 9. Let len be the length of values.
  22143. const len = values.length
  22144. // 10. If index is greater than or equal to len, then return
  22145. // CreateIterResultObject(undefined, true).
  22146. if (index >= len) {
  22147. return {
  22148. value: undefined,
  22149. done: true
  22150. }
  22151. }
  22152. // 11. Let pair be the entry in values at index index.
  22153. const { [keyIndex]: key, [valueIndex]: value } = values[index]
  22154. // 12. Set object’s index to index + 1.
  22155. this.#index = index + 1
  22156. // 13. Return the iterator result for pair and kind.
  22157. // https://webidl.spec.whatwg.org/#iterator-result
  22158. // 1. Let result be a value determined by the value of kind:
  22159. let result
  22160. switch (this.#kind) {
  22161. case 'key':
  22162. // 1. Let idlKey be pair’s key.
  22163. // 2. Let key be the result of converting idlKey to an
  22164. // ECMAScript value.
  22165. // 3. result is key.
  22166. result = key
  22167. break
  22168. case 'value':
  22169. // 1. Let idlValue be pair’s value.
  22170. // 2. Let value be the result of converting idlValue to
  22171. // an ECMAScript value.
  22172. // 3. result is value.
  22173. result = value
  22174. break
  22175. case 'key+value':
  22176. // 1. Let idlKey be pair’s key.
  22177. // 2. Let idlValue be pair’s value.
  22178. // 3. Let key be the result of converting idlKey to an
  22179. // ECMAScript value.
  22180. // 4. Let value be the result of converting idlValue to
  22181. // an ECMAScript value.
  22182. // 5. Let array be ! ArrayCreate(2).
  22183. // 6. Call ! CreateDataProperty(array, "0", key).
  22184. // 7. Call ! CreateDataProperty(array, "1", value).
  22185. // 8. result is array.
  22186. result = [key, value]
  22187. break
  22188. }
  22189. // 2. Return CreateIterResultObject(result, false).
  22190. return {
  22191. value: result,
  22192. done: false
  22193. }
  22194. }
  22195. }
  22196. // https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object
  22197. // @ts-ignore
  22198. delete FastIterableIterator.prototype.constructor
  22199. Object.setPrototypeOf(FastIterableIterator.prototype, esIteratorPrototype)
  22200. Object.defineProperties(FastIterableIterator.prototype, {
  22201. [Symbol.toStringTag]: {
  22202. writable: false,
  22203. enumerable: false,
  22204. configurable: true,
  22205. value: `${name} Iterator`
  22206. },
  22207. next: { writable: true, enumerable: true, configurable: true }
  22208. })
  22209. /**
  22210. * @param {unknown} target
  22211. * @param {'key' | 'value' | 'key+value'} kind
  22212. * @returns {IterableIterator<any>}
  22213. */
  22214. return function (target, kind) {
  22215. return new FastIterableIterator(target, kind)
  22216. }
  22217. }
  22218. /**
  22219. * @see https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object
  22220. * @param {string} name name of the instance
  22221. * @param {any} object class
  22222. * @param {symbol} kInternalIterator
  22223. * @param {string | number} [keyIndex]
  22224. * @param {string | number} [valueIndex]
  22225. */
  22226. function iteratorMixin (name, object, kInternalIterator, keyIndex = 0, valueIndex = 1) {
  22227. const makeIterator = createIterator(name, kInternalIterator, keyIndex, valueIndex)
  22228. const properties = {
  22229. keys: {
  22230. writable: true,
  22231. enumerable: true,
  22232. configurable: true,
  22233. value: function keys () {
  22234. webidl.brandCheck(this, object)
  22235. return makeIterator(this, 'key')
  22236. }
  22237. },
  22238. values: {
  22239. writable: true,
  22240. enumerable: true,
  22241. configurable: true,
  22242. value: function values () {
  22243. webidl.brandCheck(this, object)
  22244. return makeIterator(this, 'value')
  22245. }
  22246. },
  22247. entries: {
  22248. writable: true,
  22249. enumerable: true,
  22250. configurable: true,
  22251. value: function entries () {
  22252. webidl.brandCheck(this, object)
  22253. return makeIterator(this, 'key+value')
  22254. }
  22255. },
  22256. forEach: {
  22257. writable: true,
  22258. enumerable: true,
  22259. configurable: true,
  22260. value: function forEach (callbackfn, thisArg = globalThis) {
  22261. webidl.brandCheck(this, object)
  22262. webidl.argumentLengthCheck(arguments, 1, `${name}.forEach`)
  22263. if (typeof callbackfn !== 'function') {
  22264. throw new TypeError(
  22265. `Failed to execute 'forEach' on '${name}': parameter 1 is not of type 'Function'.`
  22266. )
  22267. }
  22268. for (const { 0: key, 1: value } of makeIterator(this, 'key+value')) {
  22269. callbackfn.call(thisArg, value, key, this)
  22270. }
  22271. }
  22272. }
  22273. }
  22274. return Object.defineProperties(object.prototype, {
  22275. ...properties,
  22276. [Symbol.iterator]: {
  22277. writable: true,
  22278. enumerable: false,
  22279. configurable: true,
  22280. value: properties.entries.value
  22281. }
  22282. })
  22283. }
  22284. /**
  22285. * @see https://fetch.spec.whatwg.org/#body-fully-read
  22286. */
  22287. async function fullyReadBody (body, processBody, processBodyError) {
  22288. // 1. If taskDestination is null, then set taskDestination to
  22289. // the result of starting a new parallel queue.
  22290. // 2. Let successSteps given a byte sequence bytes be to queue a
  22291. // fetch task to run processBody given bytes, with taskDestination.
  22292. const successSteps = processBody
  22293. // 3. Let errorSteps be to queue a fetch task to run processBodyError,
  22294. // with taskDestination.
  22295. const errorSteps = processBodyError
  22296. // 4. Let reader be the result of getting a reader for body’s stream.
  22297. // If that threw an exception, then run errorSteps with that
  22298. // exception and return.
  22299. let reader
  22300. try {
  22301. reader = body.stream.getReader()
  22302. } catch (e) {
  22303. errorSteps(e)
  22304. return
  22305. }
  22306. // 5. Read all bytes from reader, given successSteps and errorSteps.
  22307. try {
  22308. successSteps(await readAllBytes(reader))
  22309. } catch (e) {
  22310. errorSteps(e)
  22311. }
  22312. }
  22313. function isReadableStreamLike (stream) {
  22314. return stream instanceof ReadableStream || (
  22315. stream[Symbol.toStringTag] === 'ReadableStream' &&
  22316. typeof stream.tee === 'function'
  22317. )
  22318. }
  22319. /**
  22320. * @param {ReadableStreamController<Uint8Array>} controller
  22321. */
  22322. function readableStreamClose (controller) {
  22323. try {
  22324. controller.close()
  22325. controller.byobRequest?.respond(0)
  22326. } catch (err) {
  22327. // TODO: add comment explaining why this error occurs.
  22328. if (!err.message.includes('Controller is already closed') && !err.message.includes('ReadableStream is already closed')) {
  22329. throw err
  22330. }
  22331. }
  22332. }
  22333. const invalidIsomorphicEncodeValueRegex = /[^\x00-\xFF]/ // eslint-disable-line
  22334. /**
  22335. * @see https://infra.spec.whatwg.org/#isomorphic-encode
  22336. * @param {string} input
  22337. */
  22338. function isomorphicEncode (input) {
  22339. // 1. Assert: input contains no code points greater than U+00FF.
  22340. assert(!invalidIsomorphicEncodeValueRegex.test(input))
  22341. // 2. Return a byte sequence whose length is equal to input’s code
  22342. // point length and whose bytes have the same values as the
  22343. // values of input’s code points, in the same order
  22344. return input
  22345. }
  22346. /**
  22347. * @see https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes
  22348. * @see https://streams.spec.whatwg.org/#read-loop
  22349. * @param {ReadableStreamDefaultReader} reader
  22350. */
  22351. async function readAllBytes (reader) {
  22352. const bytes = []
  22353. let byteLength = 0
  22354. while (true) {
  22355. const { done, value: chunk } = await reader.read()
  22356. if (done) {
  22357. // 1. Call successSteps with bytes.
  22358. return Buffer.concat(bytes, byteLength)
  22359. }
  22360. // 1. If chunk is not a Uint8Array object, call failureSteps
  22361. // with a TypeError and abort these steps.
  22362. if (!isUint8Array(chunk)) {
  22363. throw new TypeError('Received non-Uint8Array chunk')
  22364. }
  22365. // 2. Append the bytes represented by chunk to bytes.
  22366. bytes.push(chunk)
  22367. byteLength += chunk.length
  22368. // 3. Read-loop given reader, bytes, successSteps, and failureSteps.
  22369. }
  22370. }
  22371. /**
  22372. * @see https://fetch.spec.whatwg.org/#is-local
  22373. * @param {URL} url
  22374. */
  22375. function urlIsLocal (url) {
  22376. assert('protocol' in url) // ensure it's a url object
  22377. const protocol = url.protocol
  22378. return protocol === 'about:' || protocol === 'blob:' || protocol === 'data:'
  22379. }
  22380. /**
  22381. * @param {string|URL} url
  22382. * @returns {boolean}
  22383. */
  22384. function urlHasHttpsScheme (url) {
  22385. return (
  22386. (
  22387. typeof url === 'string' &&
  22388. url[5] === ':' &&
  22389. url[0] === 'h' &&
  22390. url[1] === 't' &&
  22391. url[2] === 't' &&
  22392. url[3] === 'p' &&
  22393. url[4] === 's'
  22394. ) ||
  22395. url.protocol === 'https:'
  22396. )
  22397. }
  22398. /**
  22399. * @see https://fetch.spec.whatwg.org/#http-scheme
  22400. * @param {URL} url
  22401. */
  22402. function urlIsHttpHttpsScheme (url) {
  22403. assert('protocol' in url) // ensure it's a url object
  22404. const protocol = url.protocol
  22405. return protocol === 'http:' || protocol === 'https:'
  22406. }
  22407. /**
  22408. * @see https://fetch.spec.whatwg.org/#simple-range-header-value
  22409. * @param {string} value
  22410. * @param {boolean} allowWhitespace
  22411. */
  22412. function simpleRangeHeaderValue (value, allowWhitespace) {
  22413. // 1. Let data be the isomorphic decoding of value.
  22414. // Note: isomorphic decoding takes a sequence of bytes (ie. a Uint8Array) and turns it into a string,
  22415. // nothing more. We obviously don't need to do that if value is a string already.
  22416. const data = value
  22417. // 2. If data does not start with "bytes", then return failure.
  22418. if (!data.startsWith('bytes')) {
  22419. return 'failure'
  22420. }
  22421. // 3. Let position be a position variable for data, initially pointing at the 5th code point of data.
  22422. const position = { position: 5 }
  22423. // 4. If allowWhitespace is true, collect a sequence of code points that are HTTP tab or space,
  22424. // from data given position.
  22425. if (allowWhitespace) {
  22426. collectASequenceOfCodePoints(
  22427. (char) => char === '\t' || char === ' ',
  22428. data,
  22429. position
  22430. )
  22431. }
  22432. // 5. If the code point at position within data is not U+003D (=), then return failure.
  22433. if (data.charCodeAt(position.position) !== 0x3D) {
  22434. return 'failure'
  22435. }
  22436. // 6. Advance position by 1.
  22437. position.position++
  22438. // 7. If allowWhitespace is true, collect a sequence of code points that are HTTP tab or space, from
  22439. // data given position.
  22440. if (allowWhitespace) {
  22441. collectASequenceOfCodePoints(
  22442. (char) => char === '\t' || char === ' ',
  22443. data,
  22444. position
  22445. )
  22446. }
  22447. // 8. Let rangeStart be the result of collecting a sequence of code points that are ASCII digits,
  22448. // from data given position.
  22449. const rangeStart = collectASequenceOfCodePoints(
  22450. (char) => {
  22451. const code = char.charCodeAt(0)
  22452. return code >= 0x30 && code <= 0x39
  22453. },
  22454. data,
  22455. position
  22456. )
  22457. // 9. Let rangeStartValue be rangeStart, interpreted as decimal number, if rangeStart is not the
  22458. // empty string; otherwise null.
  22459. const rangeStartValue = rangeStart.length ? Number(rangeStart) : null
  22460. // 10. If allowWhitespace is true, collect a sequence of code points that are HTTP tab or space,
  22461. // from data given position.
  22462. if (allowWhitespace) {
  22463. collectASequenceOfCodePoints(
  22464. (char) => char === '\t' || char === ' ',
  22465. data,
  22466. position
  22467. )
  22468. }
  22469. // 11. If the code point at position within data is not U+002D (-), then return failure.
  22470. if (data.charCodeAt(position.position) !== 0x2D) {
  22471. return 'failure'
  22472. }
  22473. // 12. Advance position by 1.
  22474. position.position++
  22475. // 13. If allowWhitespace is true, collect a sequence of code points that are HTTP tab
  22476. // or space, from data given position.
  22477. // Note from Khafra: its the same step as in #8 again lol
  22478. if (allowWhitespace) {
  22479. collectASequenceOfCodePoints(
  22480. (char) => char === '\t' || char === ' ',
  22481. data,
  22482. position
  22483. )
  22484. }
  22485. // 14. Let rangeEnd be the result of collecting a sequence of code points that are
  22486. // ASCII digits, from data given position.
  22487. // Note from Khafra: you wouldn't guess it, but this is also the same step as #8
  22488. const rangeEnd = collectASequenceOfCodePoints(
  22489. (char) => {
  22490. const code = char.charCodeAt(0)
  22491. return code >= 0x30 && code <= 0x39
  22492. },
  22493. data,
  22494. position
  22495. )
  22496. // 15. Let rangeEndValue be rangeEnd, interpreted as decimal number, if rangeEnd
  22497. // is not the empty string; otherwise null.
  22498. // Note from Khafra: THE SAME STEP, AGAIN!!!
  22499. // Note: why interpret as a decimal if we only collect ascii digits?
  22500. const rangeEndValue = rangeEnd.length ? Number(rangeEnd) : null
  22501. // 16. If position is not past the end of data, then return failure.
  22502. if (position.position < data.length) {
  22503. return 'failure'
  22504. }
  22505. // 17. If rangeEndValue and rangeStartValue are null, then return failure.
  22506. if (rangeEndValue === null && rangeStartValue === null) {
  22507. return 'failure'
  22508. }
  22509. // 18. If rangeStartValue and rangeEndValue are numbers, and rangeStartValue is
  22510. // greater than rangeEndValue, then return failure.
  22511. // Note: ... when can they not be numbers?
  22512. if (rangeStartValue > rangeEndValue) {
  22513. return 'failure'
  22514. }
  22515. // 19. Return (rangeStartValue, rangeEndValue).
  22516. return { rangeStartValue, rangeEndValue }
  22517. }
  22518. /**
  22519. * @see https://fetch.spec.whatwg.org/#build-a-content-range
  22520. * @param {number} rangeStart
  22521. * @param {number} rangeEnd
  22522. * @param {number} fullLength
  22523. */
  22524. function buildContentRange (rangeStart, rangeEnd, fullLength) {
  22525. // 1. Let contentRange be `bytes `.
  22526. let contentRange = 'bytes '
  22527. // 2. Append rangeStart, serialized and isomorphic encoded, to contentRange.
  22528. contentRange += isomorphicEncode(`${rangeStart}`)
  22529. // 3. Append 0x2D (-) to contentRange.
  22530. contentRange += '-'
  22531. // 4. Append rangeEnd, serialized and isomorphic encoded to contentRange.
  22532. contentRange += isomorphicEncode(`${rangeEnd}`)
  22533. // 5. Append 0x2F (/) to contentRange.
  22534. contentRange += '/'
  22535. // 6. Append fullLength, serialized and isomorphic encoded to contentRange.
  22536. contentRange += isomorphicEncode(`${fullLength}`)
  22537. // 7. Return contentRange.
  22538. return contentRange
  22539. }
  22540. // A Stream, which pipes the response to zlib.createInflate() or
  22541. // zlib.createInflateRaw() depending on the first byte of the Buffer.
  22542. // If the lower byte of the first byte is 0x08, then the stream is
  22543. // interpreted as a zlib stream, otherwise it's interpreted as a
  22544. // raw deflate stream.
  22545. class InflateStream extends Transform {
  22546. #zlibOptions
  22547. /** @param {zlib.ZlibOptions} [zlibOptions] */
  22548. constructor (zlibOptions) {
  22549. super()
  22550. this.#zlibOptions = zlibOptions
  22551. }
  22552. _transform (chunk, encoding, callback) {
  22553. if (!this._inflateStream) {
  22554. if (chunk.length === 0) {
  22555. callback()
  22556. return
  22557. }
  22558. this._inflateStream = (chunk[0] & 0x0F) === 0x08
  22559. ? zlib.createInflate(this.#zlibOptions)
  22560. : zlib.createInflateRaw(this.#zlibOptions)
  22561. this._inflateStream.on('data', this.push.bind(this))
  22562. this._inflateStream.on('end', () => this.push(null))
  22563. this._inflateStream.on('error', (err) => this.destroy(err))
  22564. }
  22565. this._inflateStream.write(chunk, encoding, callback)
  22566. }
  22567. _final (callback) {
  22568. if (this._inflateStream) {
  22569. this._inflateStream.end()
  22570. this._inflateStream = null
  22571. }
  22572. callback()
  22573. }
  22574. }
  22575. /**
  22576. * @param {zlib.ZlibOptions} [zlibOptions]
  22577. * @returns {InflateStream}
  22578. */
  22579. function createInflate (zlibOptions) {
  22580. return new InflateStream(zlibOptions)
  22581. }
  22582. /**
  22583. * @see https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
  22584. * @param {import('./headers').HeadersList} headers
  22585. */
  22586. function extractMimeType (headers) {
  22587. // 1. Let charset be null.
  22588. let charset = null
  22589. // 2. Let essence be null.
  22590. let essence = null
  22591. // 3. Let mimeType be null.
  22592. let mimeType = null
  22593. // 4. Let values be the result of getting, decoding, and splitting `Content-Type` from headers.
  22594. const values = getDecodeSplit('content-type', headers)
  22595. // 5. If values is null, then return failure.
  22596. if (values === null) {
  22597. return 'failure'
  22598. }
  22599. // 6. For each value of values:
  22600. for (const value of values) {
  22601. // 6.1. Let temporaryMimeType be the result of parsing value.
  22602. const temporaryMimeType = parseMIMEType(value)
  22603. // 6.2. If temporaryMimeType is failure or its essence is "*/*", then continue.
  22604. if (temporaryMimeType === 'failure' || temporaryMimeType.essence === '*/*') {
  22605. continue
  22606. }
  22607. // 6.3. Set mimeType to temporaryMimeType.
  22608. mimeType = temporaryMimeType
  22609. // 6.4. If mimeType’s essence is not essence, then:
  22610. if (mimeType.essence !== essence) {
  22611. // 6.4.1. Set charset to null.
  22612. charset = null
  22613. // 6.4.2. If mimeType’s parameters["charset"] exists, then set charset to
  22614. // mimeType’s parameters["charset"].
  22615. if (mimeType.parameters.has('charset')) {
  22616. charset = mimeType.parameters.get('charset')
  22617. }
  22618. // 6.4.3. Set essence to mimeType’s essence.
  22619. essence = mimeType.essence
  22620. } else if (!mimeType.parameters.has('charset') && charset !== null) {
  22621. // 6.5. Otherwise, if mimeType’s parameters["charset"] does not exist, and
  22622. // charset is non-null, set mimeType’s parameters["charset"] to charset.
  22623. mimeType.parameters.set('charset', charset)
  22624. }
  22625. }
  22626. // 7. If mimeType is null, then return failure.
  22627. if (mimeType == null) {
  22628. return 'failure'
  22629. }
  22630. // 8. Return mimeType.
  22631. return mimeType
  22632. }
  22633. /**
  22634. * @see https://fetch.spec.whatwg.org/#header-value-get-decode-and-split
  22635. * @param {string|null} value
  22636. */
  22637. function gettingDecodingSplitting (value) {
  22638. // 1. Let input be the result of isomorphic decoding value.
  22639. const input = value
  22640. // 2. Let position be a position variable for input, initially pointing at the start of input.
  22641. const position = { position: 0 }
  22642. // 3. Let values be a list of strings, initially empty.
  22643. const values = []
  22644. // 4. Let temporaryValue be the empty string.
  22645. let temporaryValue = ''
  22646. // 5. While position is not past the end of input:
  22647. while (position.position < input.length) {
  22648. // 5.1. Append the result of collecting a sequence of code points that are not U+0022 (")
  22649. // or U+002C (,) from input, given position, to temporaryValue.
  22650. temporaryValue += collectASequenceOfCodePoints(
  22651. (char) => char !== '"' && char !== ',',
  22652. input,
  22653. position
  22654. )
  22655. // 5.2. If position is not past the end of input, then:
  22656. if (position.position < input.length) {
  22657. // 5.2.1. If the code point at position within input is U+0022 ("), then:
  22658. if (input.charCodeAt(position.position) === 0x22) {
  22659. // 5.2.1.1. Append the result of collecting an HTTP quoted string from input, given position, to temporaryValue.
  22660. temporaryValue += collectAnHTTPQuotedString(
  22661. input,
  22662. position
  22663. )
  22664. // 5.2.1.2. If position is not past the end of input, then continue.
  22665. if (position.position < input.length) {
  22666. continue
  22667. }
  22668. } else {
  22669. // 5.2.2. Otherwise:
  22670. // 5.2.2.1. Assert: the code point at position within input is U+002C (,).
  22671. assert(input.charCodeAt(position.position) === 0x2C)
  22672. // 5.2.2.2. Advance position by 1.
  22673. position.position++
  22674. }
  22675. }
  22676. // 5.3. Remove all HTTP tab or space from the start and end of temporaryValue.
  22677. temporaryValue = removeChars(temporaryValue, true, true, (char) => char === 0x9 || char === 0x20)
  22678. // 5.4. Append temporaryValue to values.
  22679. values.push(temporaryValue)
  22680. // 5.6. Set temporaryValue to the empty string.
  22681. temporaryValue = ''
  22682. }
  22683. // 6. Return values.
  22684. return values
  22685. }
  22686. /**
  22687. * @see https://fetch.spec.whatwg.org/#concept-header-list-get-decode-split
  22688. * @param {string} name lowercase header name
  22689. * @param {import('./headers').HeadersList} list
  22690. */
  22691. function getDecodeSplit (name, list) {
  22692. // 1. Let value be the result of getting name from list.
  22693. const value = list.get(name, true)
  22694. // 2. If value is null, then return null.
  22695. if (value === null) {
  22696. return null
  22697. }
  22698. // 3. Return the result of getting, decoding, and splitting value.
  22699. return gettingDecodingSplitting(value)
  22700. }
  22701. const textDecoder = new TextDecoder()
  22702. /**
  22703. * @see https://encoding.spec.whatwg.org/#utf-8-decode
  22704. * @param {Buffer} buffer
  22705. */
  22706. function utf8DecodeBytes (buffer) {
  22707. if (buffer.length === 0) {
  22708. return ''
  22709. }
  22710. // 1. Let buffer be the result of peeking three bytes from
  22711. // ioQueue, converted to a byte sequence.
  22712. // 2. If buffer is 0xEF 0xBB 0xBF, then read three
  22713. // bytes from ioQueue. (Do nothing with those bytes.)
  22714. if (buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
  22715. buffer = buffer.subarray(3)
  22716. }
  22717. // 3. Process a queue with an instance of UTF-8’s
  22718. // decoder, ioQueue, output, and "replacement".
  22719. const output = textDecoder.decode(buffer)
  22720. // 4. Return output.
  22721. return output
  22722. }
  22723. class EnvironmentSettingsObjectBase {
  22724. get baseUrl () {
  22725. return getGlobalOrigin()
  22726. }
  22727. get origin () {
  22728. return this.baseUrl?.origin
  22729. }
  22730. policyContainer = makePolicyContainer()
  22731. }
  22732. class EnvironmentSettingsObject {
  22733. settingsObject = new EnvironmentSettingsObjectBase()
  22734. }
  22735. const environmentSettingsObject = new EnvironmentSettingsObject()
  22736. module.exports = {
  22737. isAborted,
  22738. isCancelled,
  22739. isValidEncodedURL,
  22740. createDeferredPromise,
  22741. ReadableStreamFrom,
  22742. tryUpgradeRequestToAPotentiallyTrustworthyURL,
  22743. clampAndCoarsenConnectionTimingInfo,
  22744. coarsenedSharedCurrentTime,
  22745. determineRequestsReferrer,
  22746. makePolicyContainer,
  22747. clonePolicyContainer,
  22748. appendFetchMetadata,
  22749. appendRequestOriginHeader,
  22750. TAOCheck,
  22751. corsCheck,
  22752. crossOriginResourcePolicyCheck,
  22753. createOpaqueTimingInfo,
  22754. setRequestReferrerPolicyOnRedirect,
  22755. isValidHTTPToken,
  22756. requestBadPort,
  22757. requestCurrentURL,
  22758. responseURL,
  22759. responseLocationURL,
  22760. isBlobLike,
  22761. isURLPotentiallyTrustworthy,
  22762. isValidReasonPhrase,
  22763. sameOrigin,
  22764. normalizeMethod,
  22765. serializeJavascriptValueToJSONString,
  22766. iteratorMixin,
  22767. createIterator,
  22768. isValidHeaderName,
  22769. isValidHeaderValue,
  22770. isErrorLike,
  22771. fullyReadBody,
  22772. bytesMatch,
  22773. isReadableStreamLike,
  22774. readableStreamClose,
  22775. isomorphicEncode,
  22776. urlIsLocal,
  22777. urlHasHttpsScheme,
  22778. urlIsHttpHttpsScheme,
  22779. readAllBytes,
  22780. simpleRangeHeaderValue,
  22781. buildContentRange,
  22782. parseMetadata,
  22783. createInflate,
  22784. extractMimeType,
  22785. getDecodeSplit,
  22786. utf8DecodeBytes,
  22787. environmentSettingsObject
  22788. }
  22789. /***/ }),
  22790. /***/ 5893:
  22791. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  22792. const { types, inspect } = __nccwpck_require__(7975)
  22793. const { markAsUncloneable } = __nccwpck_require__(5919)
  22794. const { toUSVString } = __nccwpck_require__(3440)
  22795. /** @type {import('../../../types/webidl').Webidl} */
  22796. const webidl = {}
  22797. webidl.converters = {}
  22798. webidl.util = {}
  22799. webidl.errors = {}
  22800. webidl.errors.exception = function (message) {
  22801. return new TypeError(`${message.header}: ${message.message}`)
  22802. }
  22803. webidl.errors.conversionFailed = function (context) {
  22804. const plural = context.types.length === 1 ? '' : ' one of'
  22805. const message =
  22806. `${context.argument} could not be converted to` +
  22807. `${plural}: ${context.types.join(', ')}.`
  22808. return webidl.errors.exception({
  22809. header: context.prefix,
  22810. message
  22811. })
  22812. }
  22813. webidl.errors.invalidArgument = function (context) {
  22814. return webidl.errors.exception({
  22815. header: context.prefix,
  22816. message: `"${context.value}" is an invalid ${context.type}.`
  22817. })
  22818. }
  22819. // https://webidl.spec.whatwg.org/#implements
  22820. webidl.brandCheck = function (V, I, opts) {
  22821. if (opts?.strict !== false) {
  22822. if (!(V instanceof I)) {
  22823. const err = new TypeError('Illegal invocation')
  22824. err.code = 'ERR_INVALID_THIS' // node compat.
  22825. throw err
  22826. }
  22827. } else {
  22828. if (V?.[Symbol.toStringTag] !== I.prototype[Symbol.toStringTag]) {
  22829. const err = new TypeError('Illegal invocation')
  22830. err.code = 'ERR_INVALID_THIS' // node compat.
  22831. throw err
  22832. }
  22833. }
  22834. }
  22835. webidl.argumentLengthCheck = function ({ length }, min, ctx) {
  22836. if (length < min) {
  22837. throw webidl.errors.exception({
  22838. message: `${min} argument${min !== 1 ? 's' : ''} required, ` +
  22839. `but${length ? ' only' : ''} ${length} found.`,
  22840. header: ctx
  22841. })
  22842. }
  22843. }
  22844. webidl.illegalConstructor = function () {
  22845. throw webidl.errors.exception({
  22846. header: 'TypeError',
  22847. message: 'Illegal constructor'
  22848. })
  22849. }
  22850. // https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values
  22851. webidl.util.Type = function (V) {
  22852. switch (typeof V) {
  22853. case 'undefined': return 'Undefined'
  22854. case 'boolean': return 'Boolean'
  22855. case 'string': return 'String'
  22856. case 'symbol': return 'Symbol'
  22857. case 'number': return 'Number'
  22858. case 'bigint': return 'BigInt'
  22859. case 'function':
  22860. case 'object': {
  22861. if (V === null) {
  22862. return 'Null'
  22863. }
  22864. return 'Object'
  22865. }
  22866. }
  22867. }
  22868. webidl.util.markAsUncloneable = markAsUncloneable || (() => {})
  22869. // https://webidl.spec.whatwg.org/#abstract-opdef-converttoint
  22870. webidl.util.ConvertToInt = function (V, bitLength, signedness, opts) {
  22871. let upperBound
  22872. let lowerBound
  22873. // 1. If bitLength is 64, then:
  22874. if (bitLength === 64) {
  22875. // 1. Let upperBound be 2^53 − 1.
  22876. upperBound = Math.pow(2, 53) - 1
  22877. // 2. If signedness is "unsigned", then let lowerBound be 0.
  22878. if (signedness === 'unsigned') {
  22879. lowerBound = 0
  22880. } else {
  22881. // 3. Otherwise let lowerBound be −2^53 + 1.
  22882. lowerBound = Math.pow(-2, 53) + 1
  22883. }
  22884. } else if (signedness === 'unsigned') {
  22885. // 2. Otherwise, if signedness is "unsigned", then:
  22886. // 1. Let lowerBound be 0.
  22887. lowerBound = 0
  22888. // 2. Let upperBound be 2^bitLength − 1.
  22889. upperBound = Math.pow(2, bitLength) - 1
  22890. } else {
  22891. // 3. Otherwise:
  22892. // 1. Let lowerBound be -2^bitLength − 1.
  22893. lowerBound = Math.pow(-2, bitLength) - 1
  22894. // 2. Let upperBound be 2^bitLength − 1 − 1.
  22895. upperBound = Math.pow(2, bitLength - 1) - 1
  22896. }
  22897. // 4. Let x be ? ToNumber(V).
  22898. let x = Number(V)
  22899. // 5. If x is −0, then set x to +0.
  22900. if (x === 0) {
  22901. x = 0
  22902. }
  22903. // 6. If the conversion is to an IDL type associated
  22904. // with the [EnforceRange] extended attribute, then:
  22905. if (opts?.enforceRange === true) {
  22906. // 1. If x is NaN, +∞, or −∞, then throw a TypeError.
  22907. if (
  22908. Number.isNaN(x) ||
  22909. x === Number.POSITIVE_INFINITY ||
  22910. x === Number.NEGATIVE_INFINITY
  22911. ) {
  22912. throw webidl.errors.exception({
  22913. header: 'Integer conversion',
  22914. message: `Could not convert ${webidl.util.Stringify(V)} to an integer.`
  22915. })
  22916. }
  22917. // 2. Set x to IntegerPart(x).
  22918. x = webidl.util.IntegerPart(x)
  22919. // 3. If x < lowerBound or x > upperBound, then
  22920. // throw a TypeError.
  22921. if (x < lowerBound || x > upperBound) {
  22922. throw webidl.errors.exception({
  22923. header: 'Integer conversion',
  22924. message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.`
  22925. })
  22926. }
  22927. // 4. Return x.
  22928. return x
  22929. }
  22930. // 7. If x is not NaN and the conversion is to an IDL
  22931. // type associated with the [Clamp] extended
  22932. // attribute, then:
  22933. if (!Number.isNaN(x) && opts?.clamp === true) {
  22934. // 1. Set x to min(max(x, lowerBound), upperBound).
  22935. x = Math.min(Math.max(x, lowerBound), upperBound)
  22936. // 2. Round x to the nearest integer, choosing the
  22937. // even integer if it lies halfway between two,
  22938. // and choosing +0 rather than −0.
  22939. if (Math.floor(x) % 2 === 0) {
  22940. x = Math.floor(x)
  22941. } else {
  22942. x = Math.ceil(x)
  22943. }
  22944. // 3. Return x.
  22945. return x
  22946. }
  22947. // 8. If x is NaN, +0, +∞, or −∞, then return +0.
  22948. if (
  22949. Number.isNaN(x) ||
  22950. (x === 0 && Object.is(0, x)) ||
  22951. x === Number.POSITIVE_INFINITY ||
  22952. x === Number.NEGATIVE_INFINITY
  22953. ) {
  22954. return 0
  22955. }
  22956. // 9. Set x to IntegerPart(x).
  22957. x = webidl.util.IntegerPart(x)
  22958. // 10. Set x to x modulo 2^bitLength.
  22959. x = x % Math.pow(2, bitLength)
  22960. // 11. If signedness is "signed" and x ≥ 2^bitLength − 1,
  22961. // then return x − 2^bitLength.
  22962. if (signedness === 'signed' && x >= Math.pow(2, bitLength) - 1) {
  22963. return x - Math.pow(2, bitLength)
  22964. }
  22965. // 12. Otherwise, return x.
  22966. return x
  22967. }
  22968. // https://webidl.spec.whatwg.org/#abstract-opdef-integerpart
  22969. webidl.util.IntegerPart = function (n) {
  22970. // 1. Let r be floor(abs(n)).
  22971. const r = Math.floor(Math.abs(n))
  22972. // 2. If n < 0, then return -1 × r.
  22973. if (n < 0) {
  22974. return -1 * r
  22975. }
  22976. // 3. Otherwise, return r.
  22977. return r
  22978. }
  22979. webidl.util.Stringify = function (V) {
  22980. const type = webidl.util.Type(V)
  22981. switch (type) {
  22982. case 'Symbol':
  22983. return `Symbol(${V.description})`
  22984. case 'Object':
  22985. return inspect(V)
  22986. case 'String':
  22987. return `"${V}"`
  22988. default:
  22989. return `${V}`
  22990. }
  22991. }
  22992. // https://webidl.spec.whatwg.org/#es-sequence
  22993. webidl.sequenceConverter = function (converter) {
  22994. return (V, prefix, argument, Iterable) => {
  22995. // 1. If Type(V) is not Object, throw a TypeError.
  22996. if (webidl.util.Type(V) !== 'Object') {
  22997. throw webidl.errors.exception({
  22998. header: prefix,
  22999. message: `${argument} (${webidl.util.Stringify(V)}) is not iterable.`
  23000. })
  23001. }
  23002. // 2. Let method be ? GetMethod(V, @@iterator).
  23003. /** @type {Generator} */
  23004. const method = typeof Iterable === 'function' ? Iterable() : V?.[Symbol.iterator]?.()
  23005. const seq = []
  23006. let index = 0
  23007. // 3. If method is undefined, throw a TypeError.
  23008. if (
  23009. method === undefined ||
  23010. typeof method.next !== 'function'
  23011. ) {
  23012. throw webidl.errors.exception({
  23013. header: prefix,
  23014. message: `${argument} is not iterable.`
  23015. })
  23016. }
  23017. // https://webidl.spec.whatwg.org/#create-sequence-from-iterable
  23018. while (true) {
  23019. const { done, value } = method.next()
  23020. if (done) {
  23021. break
  23022. }
  23023. seq.push(converter(value, prefix, `${argument}[${index++}]`))
  23024. }
  23025. return seq
  23026. }
  23027. }
  23028. // https://webidl.spec.whatwg.org/#es-to-record
  23029. webidl.recordConverter = function (keyConverter, valueConverter) {
  23030. return (O, prefix, argument) => {
  23031. // 1. If Type(O) is not Object, throw a TypeError.
  23032. if (webidl.util.Type(O) !== 'Object') {
  23033. throw webidl.errors.exception({
  23034. header: prefix,
  23035. message: `${argument} ("${webidl.util.Type(O)}") is not an Object.`
  23036. })
  23037. }
  23038. // 2. Let result be a new empty instance of record<K, V>.
  23039. const result = {}
  23040. if (!types.isProxy(O)) {
  23041. // 1. Let desc be ? O.[[GetOwnProperty]](key).
  23042. const keys = [...Object.getOwnPropertyNames(O), ...Object.getOwnPropertySymbols(O)]
  23043. for (const key of keys) {
  23044. // 1. Let typedKey be key converted to an IDL value of type K.
  23045. const typedKey = keyConverter(key, prefix, argument)
  23046. // 2. Let value be ? Get(O, key).
  23047. // 3. Let typedValue be value converted to an IDL value of type V.
  23048. const typedValue = valueConverter(O[key], prefix, argument)
  23049. // 4. Set result[typedKey] to typedValue.
  23050. result[typedKey] = typedValue
  23051. }
  23052. // 5. Return result.
  23053. return result
  23054. }
  23055. // 3. Let keys be ? O.[[OwnPropertyKeys]]().
  23056. const keys = Reflect.ownKeys(O)
  23057. // 4. For each key of keys.
  23058. for (const key of keys) {
  23059. // 1. Let desc be ? O.[[GetOwnProperty]](key).
  23060. const desc = Reflect.getOwnPropertyDescriptor(O, key)
  23061. // 2. If desc is not undefined and desc.[[Enumerable]] is true:
  23062. if (desc?.enumerable) {
  23063. // 1. Let typedKey be key converted to an IDL value of type K.
  23064. const typedKey = keyConverter(key, prefix, argument)
  23065. // 2. Let value be ? Get(O, key).
  23066. // 3. Let typedValue be value converted to an IDL value of type V.
  23067. const typedValue = valueConverter(O[key], prefix, argument)
  23068. // 4. Set result[typedKey] to typedValue.
  23069. result[typedKey] = typedValue
  23070. }
  23071. }
  23072. // 5. Return result.
  23073. return result
  23074. }
  23075. }
  23076. webidl.interfaceConverter = function (i) {
  23077. return (V, prefix, argument, opts) => {
  23078. if (opts?.strict !== false && !(V instanceof i)) {
  23079. throw webidl.errors.exception({
  23080. header: prefix,
  23081. message: `Expected ${argument} ("${webidl.util.Stringify(V)}") to be an instance of ${i.name}.`
  23082. })
  23083. }
  23084. return V
  23085. }
  23086. }
  23087. webidl.dictionaryConverter = function (converters) {
  23088. return (dictionary, prefix, argument) => {
  23089. const type = webidl.util.Type(dictionary)
  23090. const dict = {}
  23091. if (type === 'Null' || type === 'Undefined') {
  23092. return dict
  23093. } else if (type !== 'Object') {
  23094. throw webidl.errors.exception({
  23095. header: prefix,
  23096. message: `Expected ${dictionary} to be one of: Null, Undefined, Object.`
  23097. })
  23098. }
  23099. for (const options of converters) {
  23100. const { key, defaultValue, required, converter } = options
  23101. if (required === true) {
  23102. if (!Object.hasOwn(dictionary, key)) {
  23103. throw webidl.errors.exception({
  23104. header: prefix,
  23105. message: `Missing required key "${key}".`
  23106. })
  23107. }
  23108. }
  23109. let value = dictionary[key]
  23110. const hasDefault = Object.hasOwn(options, 'defaultValue')
  23111. // Only use defaultValue if value is undefined and
  23112. // a defaultValue options was provided.
  23113. if (hasDefault && value !== null) {
  23114. value ??= defaultValue()
  23115. }
  23116. // A key can be optional and have no default value.
  23117. // When this happens, do not perform a conversion,
  23118. // and do not assign the key a value.
  23119. if (required || hasDefault || value !== undefined) {
  23120. value = converter(value, prefix, `${argument}.${key}`)
  23121. if (
  23122. options.allowedValues &&
  23123. !options.allowedValues.includes(value)
  23124. ) {
  23125. throw webidl.errors.exception({
  23126. header: prefix,
  23127. message: `${value} is not an accepted type. Expected one of ${options.allowedValues.join(', ')}.`
  23128. })
  23129. }
  23130. dict[key] = value
  23131. }
  23132. }
  23133. return dict
  23134. }
  23135. }
  23136. webidl.nullableConverter = function (converter) {
  23137. return (V, prefix, argument) => {
  23138. if (V === null) {
  23139. return V
  23140. }
  23141. return converter(V, prefix, argument)
  23142. }
  23143. }
  23144. // https://webidl.spec.whatwg.org/#es-DOMString
  23145. webidl.converters.DOMString = function (V, prefix, argument, opts) {
  23146. // 1. If V is null and the conversion is to an IDL type
  23147. // associated with the [LegacyNullToEmptyString]
  23148. // extended attribute, then return the DOMString value
  23149. // that represents the empty string.
  23150. if (V === null && opts?.legacyNullToEmptyString) {
  23151. return ''
  23152. }
  23153. // 2. Let x be ? ToString(V).
  23154. if (typeof V === 'symbol') {
  23155. throw webidl.errors.exception({
  23156. header: prefix,
  23157. message: `${argument} is a symbol, which cannot be converted to a DOMString.`
  23158. })
  23159. }
  23160. // 3. Return the IDL DOMString value that represents the
  23161. // same sequence of code units as the one the
  23162. // ECMAScript String value x represents.
  23163. return String(V)
  23164. }
  23165. // https://webidl.spec.whatwg.org/#es-ByteString
  23166. webidl.converters.ByteString = function (V, prefix, argument) {
  23167. // 1. Let x be ? ToString(V).
  23168. // Note: DOMString converter perform ? ToString(V)
  23169. const x = webidl.converters.DOMString(V, prefix, argument)
  23170. // 2. If the value of any element of x is greater than
  23171. // 255, then throw a TypeError.
  23172. for (let index = 0; index < x.length; index++) {
  23173. if (x.charCodeAt(index) > 255) {
  23174. throw new TypeError(
  23175. 'Cannot convert argument to a ByteString because the character at ' +
  23176. `index ${index} has a value of ${x.charCodeAt(index)} which is greater than 255.`
  23177. )
  23178. }
  23179. }
  23180. // 3. Return an IDL ByteString value whose length is the
  23181. // length of x, and where the value of each element is
  23182. // the value of the corresponding element of x.
  23183. return x
  23184. }
  23185. // https://webidl.spec.whatwg.org/#es-USVString
  23186. // TODO: rewrite this so we can control the errors thrown
  23187. webidl.converters.USVString = toUSVString
  23188. // https://webidl.spec.whatwg.org/#es-boolean
  23189. webidl.converters.boolean = function (V) {
  23190. // 1. Let x be the result of computing ToBoolean(V).
  23191. const x = Boolean(V)
  23192. // 2. Return the IDL boolean value that is the one that represents
  23193. // the same truth value as the ECMAScript Boolean value x.
  23194. return x
  23195. }
  23196. // https://webidl.spec.whatwg.org/#es-any
  23197. webidl.converters.any = function (V) {
  23198. return V
  23199. }
  23200. // https://webidl.spec.whatwg.org/#es-long-long
  23201. webidl.converters['long long'] = function (V, prefix, argument) {
  23202. // 1. Let x be ? ConvertToInt(V, 64, "signed").
  23203. const x = webidl.util.ConvertToInt(V, 64, 'signed', undefined, prefix, argument)
  23204. // 2. Return the IDL long long value that represents
  23205. // the same numeric value as x.
  23206. return x
  23207. }
  23208. // https://webidl.spec.whatwg.org/#es-unsigned-long-long
  23209. webidl.converters['unsigned long long'] = function (V, prefix, argument) {
  23210. // 1. Let x be ? ConvertToInt(V, 64, "unsigned").
  23211. const x = webidl.util.ConvertToInt(V, 64, 'unsigned', undefined, prefix, argument)
  23212. // 2. Return the IDL unsigned long long value that
  23213. // represents the same numeric value as x.
  23214. return x
  23215. }
  23216. // https://webidl.spec.whatwg.org/#es-unsigned-long
  23217. webidl.converters['unsigned long'] = function (V, prefix, argument) {
  23218. // 1. Let x be ? ConvertToInt(V, 32, "unsigned").
  23219. const x = webidl.util.ConvertToInt(V, 32, 'unsigned', undefined, prefix, argument)
  23220. // 2. Return the IDL unsigned long value that
  23221. // represents the same numeric value as x.
  23222. return x
  23223. }
  23224. // https://webidl.spec.whatwg.org/#es-unsigned-short
  23225. webidl.converters['unsigned short'] = function (V, prefix, argument, opts) {
  23226. // 1. Let x be ? ConvertToInt(V, 16, "unsigned").
  23227. const x = webidl.util.ConvertToInt(V, 16, 'unsigned', opts, prefix, argument)
  23228. // 2. Return the IDL unsigned short value that represents
  23229. // the same numeric value as x.
  23230. return x
  23231. }
  23232. // https://webidl.spec.whatwg.org/#idl-ArrayBuffer
  23233. webidl.converters.ArrayBuffer = function (V, prefix, argument, opts) {
  23234. // 1. If Type(V) is not Object, or V does not have an
  23235. // [[ArrayBufferData]] internal slot, then throw a
  23236. // TypeError.
  23237. // see: https://tc39.es/ecma262/#sec-properties-of-the-arraybuffer-instances
  23238. // see: https://tc39.es/ecma262/#sec-properties-of-the-sharedarraybuffer-instances
  23239. if (
  23240. webidl.util.Type(V) !== 'Object' ||
  23241. !types.isAnyArrayBuffer(V)
  23242. ) {
  23243. throw webidl.errors.conversionFailed({
  23244. prefix,
  23245. argument: `${argument} ("${webidl.util.Stringify(V)}")`,
  23246. types: ['ArrayBuffer']
  23247. })
  23248. }
  23249. // 2. If the conversion is not to an IDL type associated
  23250. // with the [AllowShared] extended attribute, and
  23251. // IsSharedArrayBuffer(V) is true, then throw a
  23252. // TypeError.
  23253. if (opts?.allowShared === false && types.isSharedArrayBuffer(V)) {
  23254. throw webidl.errors.exception({
  23255. header: 'ArrayBuffer',
  23256. message: 'SharedArrayBuffer is not allowed.'
  23257. })
  23258. }
  23259. // 3. If the conversion is not to an IDL type associated
  23260. // with the [AllowResizable] extended attribute, and
  23261. // IsResizableArrayBuffer(V) is true, then throw a
  23262. // TypeError.
  23263. if (V.resizable || V.growable) {
  23264. throw webidl.errors.exception({
  23265. header: 'ArrayBuffer',
  23266. message: 'Received a resizable ArrayBuffer.'
  23267. })
  23268. }
  23269. // 4. Return the IDL ArrayBuffer value that is a
  23270. // reference to the same object as V.
  23271. return V
  23272. }
  23273. webidl.converters.TypedArray = function (V, T, prefix, name, opts) {
  23274. // 1. Let T be the IDL type V is being converted to.
  23275. // 2. If Type(V) is not Object, or V does not have a
  23276. // [[TypedArrayName]] internal slot with a value
  23277. // equal to T’s name, then throw a TypeError.
  23278. if (
  23279. webidl.util.Type(V) !== 'Object' ||
  23280. !types.isTypedArray(V) ||
  23281. V.constructor.name !== T.name
  23282. ) {
  23283. throw webidl.errors.conversionFailed({
  23284. prefix,
  23285. argument: `${name} ("${webidl.util.Stringify(V)}")`,
  23286. types: [T.name]
  23287. })
  23288. }
  23289. // 3. If the conversion is not to an IDL type associated
  23290. // with the [AllowShared] extended attribute, and
  23291. // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is
  23292. // true, then throw a TypeError.
  23293. if (opts?.allowShared === false && types.isSharedArrayBuffer(V.buffer)) {
  23294. throw webidl.errors.exception({
  23295. header: 'ArrayBuffer',
  23296. message: 'SharedArrayBuffer is not allowed.'
  23297. })
  23298. }
  23299. // 4. If the conversion is not to an IDL type associated
  23300. // with the [AllowResizable] extended attribute, and
  23301. // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
  23302. // true, then throw a TypeError.
  23303. if (V.buffer.resizable || V.buffer.growable) {
  23304. throw webidl.errors.exception({
  23305. header: 'ArrayBuffer',
  23306. message: 'Received a resizable ArrayBuffer.'
  23307. })
  23308. }
  23309. // 5. Return the IDL value of type T that is a reference
  23310. // to the same object as V.
  23311. return V
  23312. }
  23313. webidl.converters.DataView = function (V, prefix, name, opts) {
  23314. // 1. If Type(V) is not Object, or V does not have a
  23315. // [[DataView]] internal slot, then throw a TypeError.
  23316. if (webidl.util.Type(V) !== 'Object' || !types.isDataView(V)) {
  23317. throw webidl.errors.exception({
  23318. header: prefix,
  23319. message: `${name} is not a DataView.`
  23320. })
  23321. }
  23322. // 2. If the conversion is not to an IDL type associated
  23323. // with the [AllowShared] extended attribute, and
  23324. // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true,
  23325. // then throw a TypeError.
  23326. if (opts?.allowShared === false && types.isSharedArrayBuffer(V.buffer)) {
  23327. throw webidl.errors.exception({
  23328. header: 'ArrayBuffer',
  23329. message: 'SharedArrayBuffer is not allowed.'
  23330. })
  23331. }
  23332. // 3. If the conversion is not to an IDL type associated
  23333. // with the [AllowResizable] extended attribute, and
  23334. // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
  23335. // true, then throw a TypeError.
  23336. if (V.buffer.resizable || V.buffer.growable) {
  23337. throw webidl.errors.exception({
  23338. header: 'ArrayBuffer',
  23339. message: 'Received a resizable ArrayBuffer.'
  23340. })
  23341. }
  23342. // 4. Return the IDL DataView value that is a reference
  23343. // to the same object as V.
  23344. return V
  23345. }
  23346. // https://webidl.spec.whatwg.org/#BufferSource
  23347. webidl.converters.BufferSource = function (V, prefix, name, opts) {
  23348. if (types.isAnyArrayBuffer(V)) {
  23349. return webidl.converters.ArrayBuffer(V, prefix, name, { ...opts, allowShared: false })
  23350. }
  23351. if (types.isTypedArray(V)) {
  23352. return webidl.converters.TypedArray(V, V.constructor, prefix, name, { ...opts, allowShared: false })
  23353. }
  23354. if (types.isDataView(V)) {
  23355. return webidl.converters.DataView(V, prefix, name, { ...opts, allowShared: false })
  23356. }
  23357. throw webidl.errors.conversionFailed({
  23358. prefix,
  23359. argument: `${name} ("${webidl.util.Stringify(V)}")`,
  23360. types: ['BufferSource']
  23361. })
  23362. }
  23363. webidl.converters['sequence<ByteString>'] = webidl.sequenceConverter(
  23364. webidl.converters.ByteString
  23365. )
  23366. webidl.converters['sequence<sequence<ByteString>>'] = webidl.sequenceConverter(
  23367. webidl.converters['sequence<ByteString>']
  23368. )
  23369. webidl.converters['record<ByteString, ByteString>'] = webidl.recordConverter(
  23370. webidl.converters.ByteString,
  23371. webidl.converters.ByteString
  23372. )
  23373. module.exports = {
  23374. webidl
  23375. }
  23376. /***/ }),
  23377. /***/ 2607:
  23378. /***/ ((module) => {
  23379. /**
  23380. * @see https://encoding.spec.whatwg.org/#concept-encoding-get
  23381. * @param {string|undefined} label
  23382. */
  23383. function getEncoding (label) {
  23384. if (!label) {
  23385. return 'failure'
  23386. }
  23387. // 1. Remove any leading and trailing ASCII whitespace from label.
  23388. // 2. If label is an ASCII case-insensitive match for any of the
  23389. // labels listed in the table below, then return the
  23390. // corresponding encoding; otherwise return failure.
  23391. switch (label.trim().toLowerCase()) {
  23392. case 'unicode-1-1-utf-8':
  23393. case 'unicode11utf8':
  23394. case 'unicode20utf8':
  23395. case 'utf-8':
  23396. case 'utf8':
  23397. case 'x-unicode20utf8':
  23398. return 'UTF-8'
  23399. case '866':
  23400. case 'cp866':
  23401. case 'csibm866':
  23402. case 'ibm866':
  23403. return 'IBM866'
  23404. case 'csisolatin2':
  23405. case 'iso-8859-2':
  23406. case 'iso-ir-101':
  23407. case 'iso8859-2':
  23408. case 'iso88592':
  23409. case 'iso_8859-2':
  23410. case 'iso_8859-2:1987':
  23411. case 'l2':
  23412. case 'latin2':
  23413. return 'ISO-8859-2'
  23414. case 'csisolatin3':
  23415. case 'iso-8859-3':
  23416. case 'iso-ir-109':
  23417. case 'iso8859-3':
  23418. case 'iso88593':
  23419. case 'iso_8859-3':
  23420. case 'iso_8859-3:1988':
  23421. case 'l3':
  23422. case 'latin3':
  23423. return 'ISO-8859-3'
  23424. case 'csisolatin4':
  23425. case 'iso-8859-4':
  23426. case 'iso-ir-110':
  23427. case 'iso8859-4':
  23428. case 'iso88594':
  23429. case 'iso_8859-4':
  23430. case 'iso_8859-4:1988':
  23431. case 'l4':
  23432. case 'latin4':
  23433. return 'ISO-8859-4'
  23434. case 'csisolatincyrillic':
  23435. case 'cyrillic':
  23436. case 'iso-8859-5':
  23437. case 'iso-ir-144':
  23438. case 'iso8859-5':
  23439. case 'iso88595':
  23440. case 'iso_8859-5':
  23441. case 'iso_8859-5:1988':
  23442. return 'ISO-8859-5'
  23443. case 'arabic':
  23444. case 'asmo-708':
  23445. case 'csiso88596e':
  23446. case 'csiso88596i':
  23447. case 'csisolatinarabic':
  23448. case 'ecma-114':
  23449. case 'iso-8859-6':
  23450. case 'iso-8859-6-e':
  23451. case 'iso-8859-6-i':
  23452. case 'iso-ir-127':
  23453. case 'iso8859-6':
  23454. case 'iso88596':
  23455. case 'iso_8859-6':
  23456. case 'iso_8859-6:1987':
  23457. return 'ISO-8859-6'
  23458. case 'csisolatingreek':
  23459. case 'ecma-118':
  23460. case 'elot_928':
  23461. case 'greek':
  23462. case 'greek8':
  23463. case 'iso-8859-7':
  23464. case 'iso-ir-126':
  23465. case 'iso8859-7':
  23466. case 'iso88597':
  23467. case 'iso_8859-7':
  23468. case 'iso_8859-7:1987':
  23469. case 'sun_eu_greek':
  23470. return 'ISO-8859-7'
  23471. case 'csiso88598e':
  23472. case 'csisolatinhebrew':
  23473. case 'hebrew':
  23474. case 'iso-8859-8':
  23475. case 'iso-8859-8-e':
  23476. case 'iso-ir-138':
  23477. case 'iso8859-8':
  23478. case 'iso88598':
  23479. case 'iso_8859-8':
  23480. case 'iso_8859-8:1988':
  23481. case 'visual':
  23482. return 'ISO-8859-8'
  23483. case 'csiso88598i':
  23484. case 'iso-8859-8-i':
  23485. case 'logical':
  23486. return 'ISO-8859-8-I'
  23487. case 'csisolatin6':
  23488. case 'iso-8859-10':
  23489. case 'iso-ir-157':
  23490. case 'iso8859-10':
  23491. case 'iso885910':
  23492. case 'l6':
  23493. case 'latin6':
  23494. return 'ISO-8859-10'
  23495. case 'iso-8859-13':
  23496. case 'iso8859-13':
  23497. case 'iso885913':
  23498. return 'ISO-8859-13'
  23499. case 'iso-8859-14':
  23500. case 'iso8859-14':
  23501. case 'iso885914':
  23502. return 'ISO-8859-14'
  23503. case 'csisolatin9':
  23504. case 'iso-8859-15':
  23505. case 'iso8859-15':
  23506. case 'iso885915':
  23507. case 'iso_8859-15':
  23508. case 'l9':
  23509. return 'ISO-8859-15'
  23510. case 'iso-8859-16':
  23511. return 'ISO-8859-16'
  23512. case 'cskoi8r':
  23513. case 'koi':
  23514. case 'koi8':
  23515. case 'koi8-r':
  23516. case 'koi8_r':
  23517. return 'KOI8-R'
  23518. case 'koi8-ru':
  23519. case 'koi8-u':
  23520. return 'KOI8-U'
  23521. case 'csmacintosh':
  23522. case 'mac':
  23523. case 'macintosh':
  23524. case 'x-mac-roman':
  23525. return 'macintosh'
  23526. case 'iso-8859-11':
  23527. case 'iso8859-11':
  23528. case 'iso885911':
  23529. case 'tis-620':
  23530. case 'windows-874':
  23531. return 'windows-874'
  23532. case 'cp1250':
  23533. case 'windows-1250':
  23534. case 'x-cp1250':
  23535. return 'windows-1250'
  23536. case 'cp1251':
  23537. case 'windows-1251':
  23538. case 'x-cp1251':
  23539. return 'windows-1251'
  23540. case 'ansi_x3.4-1968':
  23541. case 'ascii':
  23542. case 'cp1252':
  23543. case 'cp819':
  23544. case 'csisolatin1':
  23545. case 'ibm819':
  23546. case 'iso-8859-1':
  23547. case 'iso-ir-100':
  23548. case 'iso8859-1':
  23549. case 'iso88591':
  23550. case 'iso_8859-1':
  23551. case 'iso_8859-1:1987':
  23552. case 'l1':
  23553. case 'latin1':
  23554. case 'us-ascii':
  23555. case 'windows-1252':
  23556. case 'x-cp1252':
  23557. return 'windows-1252'
  23558. case 'cp1253':
  23559. case 'windows-1253':
  23560. case 'x-cp1253':
  23561. return 'windows-1253'
  23562. case 'cp1254':
  23563. case 'csisolatin5':
  23564. case 'iso-8859-9':
  23565. case 'iso-ir-148':
  23566. case 'iso8859-9':
  23567. case 'iso88599':
  23568. case 'iso_8859-9':
  23569. case 'iso_8859-9:1989':
  23570. case 'l5':
  23571. case 'latin5':
  23572. case 'windows-1254':
  23573. case 'x-cp1254':
  23574. return 'windows-1254'
  23575. case 'cp1255':
  23576. case 'windows-1255':
  23577. case 'x-cp1255':
  23578. return 'windows-1255'
  23579. case 'cp1256':
  23580. case 'windows-1256':
  23581. case 'x-cp1256':
  23582. return 'windows-1256'
  23583. case 'cp1257':
  23584. case 'windows-1257':
  23585. case 'x-cp1257':
  23586. return 'windows-1257'
  23587. case 'cp1258':
  23588. case 'windows-1258':
  23589. case 'x-cp1258':
  23590. return 'windows-1258'
  23591. case 'x-mac-cyrillic':
  23592. case 'x-mac-ukrainian':
  23593. return 'x-mac-cyrillic'
  23594. case 'chinese':
  23595. case 'csgb2312':
  23596. case 'csiso58gb231280':
  23597. case 'gb2312':
  23598. case 'gb_2312':
  23599. case 'gb_2312-80':
  23600. case 'gbk':
  23601. case 'iso-ir-58':
  23602. case 'x-gbk':
  23603. return 'GBK'
  23604. case 'gb18030':
  23605. return 'gb18030'
  23606. case 'big5':
  23607. case 'big5-hkscs':
  23608. case 'cn-big5':
  23609. case 'csbig5':
  23610. case 'x-x-big5':
  23611. return 'Big5'
  23612. case 'cseucpkdfmtjapanese':
  23613. case 'euc-jp':
  23614. case 'x-euc-jp':
  23615. return 'EUC-JP'
  23616. case 'csiso2022jp':
  23617. case 'iso-2022-jp':
  23618. return 'ISO-2022-JP'
  23619. case 'csshiftjis':
  23620. case 'ms932':
  23621. case 'ms_kanji':
  23622. case 'shift-jis':
  23623. case 'shift_jis':
  23624. case 'sjis':
  23625. case 'windows-31j':
  23626. case 'x-sjis':
  23627. return 'Shift_JIS'
  23628. case 'cseuckr':
  23629. case 'csksc56011987':
  23630. case 'euc-kr':
  23631. case 'iso-ir-149':
  23632. case 'korean':
  23633. case 'ks_c_5601-1987':
  23634. case 'ks_c_5601-1989':
  23635. case 'ksc5601':
  23636. case 'ksc_5601':
  23637. case 'windows-949':
  23638. return 'EUC-KR'
  23639. case 'csiso2022kr':
  23640. case 'hz-gb-2312':
  23641. case 'iso-2022-cn':
  23642. case 'iso-2022-cn-ext':
  23643. case 'iso-2022-kr':
  23644. case 'replacement':
  23645. return 'replacement'
  23646. case 'unicodefffe':
  23647. case 'utf-16be':
  23648. return 'UTF-16BE'
  23649. case 'csunicode':
  23650. case 'iso-10646-ucs-2':
  23651. case 'ucs-2':
  23652. case 'unicode':
  23653. case 'unicodefeff':
  23654. case 'utf-16':
  23655. case 'utf-16le':
  23656. return 'UTF-16LE'
  23657. case 'x-user-defined':
  23658. return 'x-user-defined'
  23659. default: return 'failure'
  23660. }
  23661. }
  23662. module.exports = {
  23663. getEncoding
  23664. }
  23665. /***/ }),
  23666. /***/ 8355:
  23667. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  23668. const {
  23669. staticPropertyDescriptors,
  23670. readOperation,
  23671. fireAProgressEvent
  23672. } = __nccwpck_require__(3610)
  23673. const {
  23674. kState,
  23675. kError,
  23676. kResult,
  23677. kEvents,
  23678. kAborted
  23679. } = __nccwpck_require__(961)
  23680. const { webidl } = __nccwpck_require__(5893)
  23681. const { kEnumerableProperty } = __nccwpck_require__(3440)
  23682. class FileReader extends EventTarget {
  23683. constructor () {
  23684. super()
  23685. this[kState] = 'empty'
  23686. this[kResult] = null
  23687. this[kError] = null
  23688. this[kEvents] = {
  23689. loadend: null,
  23690. error: null,
  23691. abort: null,
  23692. load: null,
  23693. progress: null,
  23694. loadstart: null
  23695. }
  23696. }
  23697. /**
  23698. * @see https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer
  23699. * @param {import('buffer').Blob} blob
  23700. */
  23701. readAsArrayBuffer (blob) {
  23702. webidl.brandCheck(this, FileReader)
  23703. webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsArrayBuffer')
  23704. blob = webidl.converters.Blob(blob, { strict: false })
  23705. // The readAsArrayBuffer(blob) method, when invoked,
  23706. // must initiate a read operation for blob with ArrayBuffer.
  23707. readOperation(this, blob, 'ArrayBuffer')
  23708. }
  23709. /**
  23710. * @see https://w3c.github.io/FileAPI/#readAsBinaryString
  23711. * @param {import('buffer').Blob} blob
  23712. */
  23713. readAsBinaryString (blob) {
  23714. webidl.brandCheck(this, FileReader)
  23715. webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsBinaryString')
  23716. blob = webidl.converters.Blob(blob, { strict: false })
  23717. // The readAsBinaryString(blob) method, when invoked,
  23718. // must initiate a read operation for blob with BinaryString.
  23719. readOperation(this, blob, 'BinaryString')
  23720. }
  23721. /**
  23722. * @see https://w3c.github.io/FileAPI/#readAsDataText
  23723. * @param {import('buffer').Blob} blob
  23724. * @param {string?} encoding
  23725. */
  23726. readAsText (blob, encoding = undefined) {
  23727. webidl.brandCheck(this, FileReader)
  23728. webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsText')
  23729. blob = webidl.converters.Blob(blob, { strict: false })
  23730. if (encoding !== undefined) {
  23731. encoding = webidl.converters.DOMString(encoding, 'FileReader.readAsText', 'encoding')
  23732. }
  23733. // The readAsText(blob, encoding) method, when invoked,
  23734. // must initiate a read operation for blob with Text and encoding.
  23735. readOperation(this, blob, 'Text', encoding)
  23736. }
  23737. /**
  23738. * @see https://w3c.github.io/FileAPI/#dfn-readAsDataURL
  23739. * @param {import('buffer').Blob} blob
  23740. */
  23741. readAsDataURL (blob) {
  23742. webidl.brandCheck(this, FileReader)
  23743. webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsDataURL')
  23744. blob = webidl.converters.Blob(blob, { strict: false })
  23745. // The readAsDataURL(blob) method, when invoked, must
  23746. // initiate a read operation for blob with DataURL.
  23747. readOperation(this, blob, 'DataURL')
  23748. }
  23749. /**
  23750. * @see https://w3c.github.io/FileAPI/#dfn-abort
  23751. */
  23752. abort () {
  23753. // 1. If this's state is "empty" or if this's state is
  23754. // "done" set this's result to null and terminate
  23755. // this algorithm.
  23756. if (this[kState] === 'empty' || this[kState] === 'done') {
  23757. this[kResult] = null
  23758. return
  23759. }
  23760. // 2. If this's state is "loading" set this's state to
  23761. // "done" and set this's result to null.
  23762. if (this[kState] === 'loading') {
  23763. this[kState] = 'done'
  23764. this[kResult] = null
  23765. }
  23766. // 3. If there are any tasks from this on the file reading
  23767. // task source in an affiliated task queue, then remove
  23768. // those tasks from that task queue.
  23769. this[kAborted] = true
  23770. // 4. Terminate the algorithm for the read method being processed.
  23771. // TODO
  23772. // 5. Fire a progress event called abort at this.
  23773. fireAProgressEvent('abort', this)
  23774. // 6. If this's state is not "loading", fire a progress
  23775. // event called loadend at this.
  23776. if (this[kState] !== 'loading') {
  23777. fireAProgressEvent('loadend', this)
  23778. }
  23779. }
  23780. /**
  23781. * @see https://w3c.github.io/FileAPI/#dom-filereader-readystate
  23782. */
  23783. get readyState () {
  23784. webidl.brandCheck(this, FileReader)
  23785. switch (this[kState]) {
  23786. case 'empty': return this.EMPTY
  23787. case 'loading': return this.LOADING
  23788. case 'done': return this.DONE
  23789. }
  23790. }
  23791. /**
  23792. * @see https://w3c.github.io/FileAPI/#dom-filereader-result
  23793. */
  23794. get result () {
  23795. webidl.brandCheck(this, FileReader)
  23796. // The result attribute’s getter, when invoked, must return
  23797. // this's result.
  23798. return this[kResult]
  23799. }
  23800. /**
  23801. * @see https://w3c.github.io/FileAPI/#dom-filereader-error
  23802. */
  23803. get error () {
  23804. webidl.brandCheck(this, FileReader)
  23805. // The error attribute’s getter, when invoked, must return
  23806. // this's error.
  23807. return this[kError]
  23808. }
  23809. get onloadend () {
  23810. webidl.brandCheck(this, FileReader)
  23811. return this[kEvents].loadend
  23812. }
  23813. set onloadend (fn) {
  23814. webidl.brandCheck(this, FileReader)
  23815. if (this[kEvents].loadend) {
  23816. this.removeEventListener('loadend', this[kEvents].loadend)
  23817. }
  23818. if (typeof fn === 'function') {
  23819. this[kEvents].loadend = fn
  23820. this.addEventListener('loadend', fn)
  23821. } else {
  23822. this[kEvents].loadend = null
  23823. }
  23824. }
  23825. get onerror () {
  23826. webidl.brandCheck(this, FileReader)
  23827. return this[kEvents].error
  23828. }
  23829. set onerror (fn) {
  23830. webidl.brandCheck(this, FileReader)
  23831. if (this[kEvents].error) {
  23832. this.removeEventListener('error', this[kEvents].error)
  23833. }
  23834. if (typeof fn === 'function') {
  23835. this[kEvents].error = fn
  23836. this.addEventListener('error', fn)
  23837. } else {
  23838. this[kEvents].error = null
  23839. }
  23840. }
  23841. get onloadstart () {
  23842. webidl.brandCheck(this, FileReader)
  23843. return this[kEvents].loadstart
  23844. }
  23845. set onloadstart (fn) {
  23846. webidl.brandCheck(this, FileReader)
  23847. if (this[kEvents].loadstart) {
  23848. this.removeEventListener('loadstart', this[kEvents].loadstart)
  23849. }
  23850. if (typeof fn === 'function') {
  23851. this[kEvents].loadstart = fn
  23852. this.addEventListener('loadstart', fn)
  23853. } else {
  23854. this[kEvents].loadstart = null
  23855. }
  23856. }
  23857. get onprogress () {
  23858. webidl.brandCheck(this, FileReader)
  23859. return this[kEvents].progress
  23860. }
  23861. set onprogress (fn) {
  23862. webidl.brandCheck(this, FileReader)
  23863. if (this[kEvents].progress) {
  23864. this.removeEventListener('progress', this[kEvents].progress)
  23865. }
  23866. if (typeof fn === 'function') {
  23867. this[kEvents].progress = fn
  23868. this.addEventListener('progress', fn)
  23869. } else {
  23870. this[kEvents].progress = null
  23871. }
  23872. }
  23873. get onload () {
  23874. webidl.brandCheck(this, FileReader)
  23875. return this[kEvents].load
  23876. }
  23877. set onload (fn) {
  23878. webidl.brandCheck(this, FileReader)
  23879. if (this[kEvents].load) {
  23880. this.removeEventListener('load', this[kEvents].load)
  23881. }
  23882. if (typeof fn === 'function') {
  23883. this[kEvents].load = fn
  23884. this.addEventListener('load', fn)
  23885. } else {
  23886. this[kEvents].load = null
  23887. }
  23888. }
  23889. get onabort () {
  23890. webidl.brandCheck(this, FileReader)
  23891. return this[kEvents].abort
  23892. }
  23893. set onabort (fn) {
  23894. webidl.brandCheck(this, FileReader)
  23895. if (this[kEvents].abort) {
  23896. this.removeEventListener('abort', this[kEvents].abort)
  23897. }
  23898. if (typeof fn === 'function') {
  23899. this[kEvents].abort = fn
  23900. this.addEventListener('abort', fn)
  23901. } else {
  23902. this[kEvents].abort = null
  23903. }
  23904. }
  23905. }
  23906. // https://w3c.github.io/FileAPI/#dom-filereader-empty
  23907. FileReader.EMPTY = FileReader.prototype.EMPTY = 0
  23908. // https://w3c.github.io/FileAPI/#dom-filereader-loading
  23909. FileReader.LOADING = FileReader.prototype.LOADING = 1
  23910. // https://w3c.github.io/FileAPI/#dom-filereader-done
  23911. FileReader.DONE = FileReader.prototype.DONE = 2
  23912. Object.defineProperties(FileReader.prototype, {
  23913. EMPTY: staticPropertyDescriptors,
  23914. LOADING: staticPropertyDescriptors,
  23915. DONE: staticPropertyDescriptors,
  23916. readAsArrayBuffer: kEnumerableProperty,
  23917. readAsBinaryString: kEnumerableProperty,
  23918. readAsText: kEnumerableProperty,
  23919. readAsDataURL: kEnumerableProperty,
  23920. abort: kEnumerableProperty,
  23921. readyState: kEnumerableProperty,
  23922. result: kEnumerableProperty,
  23923. error: kEnumerableProperty,
  23924. onloadstart: kEnumerableProperty,
  23925. onprogress: kEnumerableProperty,
  23926. onload: kEnumerableProperty,
  23927. onabort: kEnumerableProperty,
  23928. onerror: kEnumerableProperty,
  23929. onloadend: kEnumerableProperty,
  23930. [Symbol.toStringTag]: {
  23931. value: 'FileReader',
  23932. writable: false,
  23933. enumerable: false,
  23934. configurable: true
  23935. }
  23936. })
  23937. Object.defineProperties(FileReader, {
  23938. EMPTY: staticPropertyDescriptors,
  23939. LOADING: staticPropertyDescriptors,
  23940. DONE: staticPropertyDescriptors
  23941. })
  23942. module.exports = {
  23943. FileReader
  23944. }
  23945. /***/ }),
  23946. /***/ 8573:
  23947. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  23948. const { webidl } = __nccwpck_require__(5893)
  23949. const kState = Symbol('ProgressEvent state')
  23950. /**
  23951. * @see https://xhr.spec.whatwg.org/#progressevent
  23952. */
  23953. class ProgressEvent extends Event {
  23954. constructor (type, eventInitDict = {}) {
  23955. type = webidl.converters.DOMString(type, 'ProgressEvent constructor', 'type')
  23956. eventInitDict = webidl.converters.ProgressEventInit(eventInitDict ?? {})
  23957. super(type, eventInitDict)
  23958. this[kState] = {
  23959. lengthComputable: eventInitDict.lengthComputable,
  23960. loaded: eventInitDict.loaded,
  23961. total: eventInitDict.total
  23962. }
  23963. }
  23964. get lengthComputable () {
  23965. webidl.brandCheck(this, ProgressEvent)
  23966. return this[kState].lengthComputable
  23967. }
  23968. get loaded () {
  23969. webidl.brandCheck(this, ProgressEvent)
  23970. return this[kState].loaded
  23971. }
  23972. get total () {
  23973. webidl.brandCheck(this, ProgressEvent)
  23974. return this[kState].total
  23975. }
  23976. }
  23977. webidl.converters.ProgressEventInit = webidl.dictionaryConverter([
  23978. {
  23979. key: 'lengthComputable',
  23980. converter: webidl.converters.boolean,
  23981. defaultValue: () => false
  23982. },
  23983. {
  23984. key: 'loaded',
  23985. converter: webidl.converters['unsigned long long'],
  23986. defaultValue: () => 0
  23987. },
  23988. {
  23989. key: 'total',
  23990. converter: webidl.converters['unsigned long long'],
  23991. defaultValue: () => 0
  23992. },
  23993. {
  23994. key: 'bubbles',
  23995. converter: webidl.converters.boolean,
  23996. defaultValue: () => false
  23997. },
  23998. {
  23999. key: 'cancelable',
  24000. converter: webidl.converters.boolean,
  24001. defaultValue: () => false
  24002. },
  24003. {
  24004. key: 'composed',
  24005. converter: webidl.converters.boolean,
  24006. defaultValue: () => false
  24007. }
  24008. ])
  24009. module.exports = {
  24010. ProgressEvent
  24011. }
  24012. /***/ }),
  24013. /***/ 961:
  24014. /***/ ((module) => {
  24015. module.exports = {
  24016. kState: Symbol('FileReader state'),
  24017. kResult: Symbol('FileReader result'),
  24018. kError: Symbol('FileReader error'),
  24019. kLastProgressEventFired: Symbol('FileReader last progress event fired timestamp'),
  24020. kEvents: Symbol('FileReader events'),
  24021. kAborted: Symbol('FileReader aborted')
  24022. }
  24023. /***/ }),
  24024. /***/ 3610:
  24025. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24026. const {
  24027. kState,
  24028. kError,
  24029. kResult,
  24030. kAborted,
  24031. kLastProgressEventFired
  24032. } = __nccwpck_require__(961)
  24033. const { ProgressEvent } = __nccwpck_require__(8573)
  24034. const { getEncoding } = __nccwpck_require__(2607)
  24035. const { serializeAMimeType, parseMIMEType } = __nccwpck_require__(1900)
  24036. const { types } = __nccwpck_require__(7975)
  24037. const { StringDecoder } = __nccwpck_require__(3193)
  24038. const { btoa } = __nccwpck_require__(4573)
  24039. /** @type {PropertyDescriptor} */
  24040. const staticPropertyDescriptors = {
  24041. enumerable: true,
  24042. writable: false,
  24043. configurable: false
  24044. }
  24045. /**
  24046. * @see https://w3c.github.io/FileAPI/#readOperation
  24047. * @param {import('./filereader').FileReader} fr
  24048. * @param {import('buffer').Blob} blob
  24049. * @param {string} type
  24050. * @param {string?} encodingName
  24051. */
  24052. function readOperation (fr, blob, type, encodingName) {
  24053. // 1. If fr’s state is "loading", throw an InvalidStateError
  24054. // DOMException.
  24055. if (fr[kState] === 'loading') {
  24056. throw new DOMException('Invalid state', 'InvalidStateError')
  24057. }
  24058. // 2. Set fr’s state to "loading".
  24059. fr[kState] = 'loading'
  24060. // 3. Set fr’s result to null.
  24061. fr[kResult] = null
  24062. // 4. Set fr’s error to null.
  24063. fr[kError] = null
  24064. // 5. Let stream be the result of calling get stream on blob.
  24065. /** @type {import('stream/web').ReadableStream} */
  24066. const stream = blob.stream()
  24067. // 6. Let reader be the result of getting a reader from stream.
  24068. const reader = stream.getReader()
  24069. // 7. Let bytes be an empty byte sequence.
  24070. /** @type {Uint8Array[]} */
  24071. const bytes = []
  24072. // 8. Let chunkPromise be the result of reading a chunk from
  24073. // stream with reader.
  24074. let chunkPromise = reader.read()
  24075. // 9. Let isFirstChunk be true.
  24076. let isFirstChunk = true
  24077. // 10. In parallel, while true:
  24078. // Note: "In parallel" just means non-blocking
  24079. // Note 2: readOperation itself cannot be async as double
  24080. // reading the body would then reject the promise, instead
  24081. // of throwing an error.
  24082. ;(async () => {
  24083. while (!fr[kAborted]) {
  24084. // 1. Wait for chunkPromise to be fulfilled or rejected.
  24085. try {
  24086. const { done, value } = await chunkPromise
  24087. // 2. If chunkPromise is fulfilled, and isFirstChunk is
  24088. // true, queue a task to fire a progress event called
  24089. // loadstart at fr.
  24090. if (isFirstChunk && !fr[kAborted]) {
  24091. queueMicrotask(() => {
  24092. fireAProgressEvent('loadstart', fr)
  24093. })
  24094. }
  24095. // 3. Set isFirstChunk to false.
  24096. isFirstChunk = false
  24097. // 4. If chunkPromise is fulfilled with an object whose
  24098. // done property is false and whose value property is
  24099. // a Uint8Array object, run these steps:
  24100. if (!done && types.isUint8Array(value)) {
  24101. // 1. Let bs be the byte sequence represented by the
  24102. // Uint8Array object.
  24103. // 2. Append bs to bytes.
  24104. bytes.push(value)
  24105. // 3. If roughly 50ms have passed since these steps
  24106. // were last invoked, queue a task to fire a
  24107. // progress event called progress at fr.
  24108. if (
  24109. (
  24110. fr[kLastProgressEventFired] === undefined ||
  24111. Date.now() - fr[kLastProgressEventFired] >= 50
  24112. ) &&
  24113. !fr[kAborted]
  24114. ) {
  24115. fr[kLastProgressEventFired] = Date.now()
  24116. queueMicrotask(() => {
  24117. fireAProgressEvent('progress', fr)
  24118. })
  24119. }
  24120. // 4. Set chunkPromise to the result of reading a
  24121. // chunk from stream with reader.
  24122. chunkPromise = reader.read()
  24123. } else if (done) {
  24124. // 5. Otherwise, if chunkPromise is fulfilled with an
  24125. // object whose done property is true, queue a task
  24126. // to run the following steps and abort this algorithm:
  24127. queueMicrotask(() => {
  24128. // 1. Set fr’s state to "done".
  24129. fr[kState] = 'done'
  24130. // 2. Let result be the result of package data given
  24131. // bytes, type, blob’s type, and encodingName.
  24132. try {
  24133. const result = packageData(bytes, type, blob.type, encodingName)
  24134. // 4. Else:
  24135. if (fr[kAborted]) {
  24136. return
  24137. }
  24138. // 1. Set fr’s result to result.
  24139. fr[kResult] = result
  24140. // 2. Fire a progress event called load at the fr.
  24141. fireAProgressEvent('load', fr)
  24142. } catch (error) {
  24143. // 3. If package data threw an exception error:
  24144. // 1. Set fr’s error to error.
  24145. fr[kError] = error
  24146. // 2. Fire a progress event called error at fr.
  24147. fireAProgressEvent('error', fr)
  24148. }
  24149. // 5. If fr’s state is not "loading", fire a progress
  24150. // event called loadend at the fr.
  24151. if (fr[kState] !== 'loading') {
  24152. fireAProgressEvent('loadend', fr)
  24153. }
  24154. })
  24155. break
  24156. }
  24157. } catch (error) {
  24158. if (fr[kAborted]) {
  24159. return
  24160. }
  24161. // 6. Otherwise, if chunkPromise is rejected with an
  24162. // error error, queue a task to run the following
  24163. // steps and abort this algorithm:
  24164. queueMicrotask(() => {
  24165. // 1. Set fr’s state to "done".
  24166. fr[kState] = 'done'
  24167. // 2. Set fr’s error to error.
  24168. fr[kError] = error
  24169. // 3. Fire a progress event called error at fr.
  24170. fireAProgressEvent('error', fr)
  24171. // 4. If fr’s state is not "loading", fire a progress
  24172. // event called loadend at fr.
  24173. if (fr[kState] !== 'loading') {
  24174. fireAProgressEvent('loadend', fr)
  24175. }
  24176. })
  24177. break
  24178. }
  24179. }
  24180. })()
  24181. }
  24182. /**
  24183. * @see https://w3c.github.io/FileAPI/#fire-a-progress-event
  24184. * @see https://dom.spec.whatwg.org/#concept-event-fire
  24185. * @param {string} e The name of the event
  24186. * @param {import('./filereader').FileReader} reader
  24187. */
  24188. function fireAProgressEvent (e, reader) {
  24189. // The progress event e does not bubble. e.bubbles must be false
  24190. // The progress event e is NOT cancelable. e.cancelable must be false
  24191. const event = new ProgressEvent(e, {
  24192. bubbles: false,
  24193. cancelable: false
  24194. })
  24195. reader.dispatchEvent(event)
  24196. }
  24197. /**
  24198. * @see https://w3c.github.io/FileAPI/#blob-package-data
  24199. * @param {Uint8Array[]} bytes
  24200. * @param {string} type
  24201. * @param {string?} mimeType
  24202. * @param {string?} encodingName
  24203. */
  24204. function packageData (bytes, type, mimeType, encodingName) {
  24205. // 1. A Blob has an associated package data algorithm, given
  24206. // bytes, a type, a optional mimeType, and a optional
  24207. // encodingName, which switches on type and runs the
  24208. // associated steps:
  24209. switch (type) {
  24210. case 'DataURL': {
  24211. // 1. Return bytes as a DataURL [RFC2397] subject to
  24212. // the considerations below:
  24213. // * Use mimeType as part of the Data URL if it is
  24214. // available in keeping with the Data URL
  24215. // specification [RFC2397].
  24216. // * If mimeType is not available return a Data URL
  24217. // without a media-type. [RFC2397].
  24218. // https://datatracker.ietf.org/doc/html/rfc2397#section-3
  24219. // dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
  24220. // mediatype := [ type "/" subtype ] *( ";" parameter )
  24221. // data := *urlchar
  24222. // parameter := attribute "=" value
  24223. let dataURL = 'data:'
  24224. const parsed = parseMIMEType(mimeType || 'application/octet-stream')
  24225. if (parsed !== 'failure') {
  24226. dataURL += serializeAMimeType(parsed)
  24227. }
  24228. dataURL += ';base64,'
  24229. const decoder = new StringDecoder('latin1')
  24230. for (const chunk of bytes) {
  24231. dataURL += btoa(decoder.write(chunk))
  24232. }
  24233. dataURL += btoa(decoder.end())
  24234. return dataURL
  24235. }
  24236. case 'Text': {
  24237. // 1. Let encoding be failure
  24238. let encoding = 'failure'
  24239. // 2. If the encodingName is present, set encoding to the
  24240. // result of getting an encoding from encodingName.
  24241. if (encodingName) {
  24242. encoding = getEncoding(encodingName)
  24243. }
  24244. // 3. If encoding is failure, and mimeType is present:
  24245. if (encoding === 'failure' && mimeType) {
  24246. // 1. Let type be the result of parse a MIME type
  24247. // given mimeType.
  24248. const type = parseMIMEType(mimeType)
  24249. // 2. If type is not failure, set encoding to the result
  24250. // of getting an encoding from type’s parameters["charset"].
  24251. if (type !== 'failure') {
  24252. encoding = getEncoding(type.parameters.get('charset'))
  24253. }
  24254. }
  24255. // 4. If encoding is failure, then set encoding to UTF-8.
  24256. if (encoding === 'failure') {
  24257. encoding = 'UTF-8'
  24258. }
  24259. // 5. Decode bytes using fallback encoding encoding, and
  24260. // return the result.
  24261. return decode(bytes, encoding)
  24262. }
  24263. case 'ArrayBuffer': {
  24264. // Return a new ArrayBuffer whose contents are bytes.
  24265. const sequence = combineByteSequences(bytes)
  24266. return sequence.buffer
  24267. }
  24268. case 'BinaryString': {
  24269. // Return bytes as a binary string, in which every byte
  24270. // is represented by a code unit of equal value [0..255].
  24271. let binaryString = ''
  24272. const decoder = new StringDecoder('latin1')
  24273. for (const chunk of bytes) {
  24274. binaryString += decoder.write(chunk)
  24275. }
  24276. binaryString += decoder.end()
  24277. return binaryString
  24278. }
  24279. }
  24280. }
  24281. /**
  24282. * @see https://encoding.spec.whatwg.org/#decode
  24283. * @param {Uint8Array[]} ioQueue
  24284. * @param {string} encoding
  24285. */
  24286. function decode (ioQueue, encoding) {
  24287. const bytes = combineByteSequences(ioQueue)
  24288. // 1. Let BOMEncoding be the result of BOM sniffing ioQueue.
  24289. const BOMEncoding = BOMSniffing(bytes)
  24290. let slice = 0
  24291. // 2. If BOMEncoding is non-null:
  24292. if (BOMEncoding !== null) {
  24293. // 1. Set encoding to BOMEncoding.
  24294. encoding = BOMEncoding
  24295. // 2. Read three bytes from ioQueue, if BOMEncoding is
  24296. // UTF-8; otherwise read two bytes.
  24297. // (Do nothing with those bytes.)
  24298. slice = BOMEncoding === 'UTF-8' ? 3 : 2
  24299. }
  24300. // 3. Process a queue with an instance of encoding’s
  24301. // decoder, ioQueue, output, and "replacement".
  24302. // 4. Return output.
  24303. const sliced = bytes.slice(slice)
  24304. return new TextDecoder(encoding).decode(sliced)
  24305. }
  24306. /**
  24307. * @see https://encoding.spec.whatwg.org/#bom-sniff
  24308. * @param {Uint8Array} ioQueue
  24309. */
  24310. function BOMSniffing (ioQueue) {
  24311. // 1. Let BOM be the result of peeking 3 bytes from ioQueue,
  24312. // converted to a byte sequence.
  24313. const [a, b, c] = ioQueue
  24314. // 2. For each of the rows in the table below, starting with
  24315. // the first one and going down, if BOM starts with the
  24316. // bytes given in the first column, then return the
  24317. // encoding given in the cell in the second column of that
  24318. // row. Otherwise, return null.
  24319. if (a === 0xEF && b === 0xBB && c === 0xBF) {
  24320. return 'UTF-8'
  24321. } else if (a === 0xFE && b === 0xFF) {
  24322. return 'UTF-16BE'
  24323. } else if (a === 0xFF && b === 0xFE) {
  24324. return 'UTF-16LE'
  24325. }
  24326. return null
  24327. }
  24328. /**
  24329. * @param {Uint8Array[]} sequences
  24330. */
  24331. function combineByteSequences (sequences) {
  24332. const size = sequences.reduce((a, b) => {
  24333. return a + b.byteLength
  24334. }, 0)
  24335. let offset = 0
  24336. return sequences.reduce((a, b) => {
  24337. a.set(b, offset)
  24338. offset += b.byteLength
  24339. return a
  24340. }, new Uint8Array(size))
  24341. }
  24342. module.exports = {
  24343. staticPropertyDescriptors,
  24344. readOperation,
  24345. fireAProgressEvent
  24346. }
  24347. /***/ }),
  24348. /***/ 6897:
  24349. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24350. const { uid, states, sentCloseFrameState, emptyBuffer, opcodes } = __nccwpck_require__(736)
  24351. const {
  24352. kReadyState,
  24353. kSentClose,
  24354. kByteParser,
  24355. kReceivedClose,
  24356. kResponse
  24357. } = __nccwpck_require__(1216)
  24358. const { fireEvent, failWebsocketConnection, isClosing, isClosed, isEstablished, parseExtensions } = __nccwpck_require__(8625)
  24359. const { channels } = __nccwpck_require__(2414)
  24360. const { CloseEvent } = __nccwpck_require__(5188)
  24361. const { makeRequest } = __nccwpck_require__(9967)
  24362. const { fetching } = __nccwpck_require__(4398)
  24363. const { Headers, getHeadersList } = __nccwpck_require__(660)
  24364. const { getDecodeSplit } = __nccwpck_require__(3168)
  24365. const { WebsocketFrameSend } = __nccwpck_require__(3264)
  24366. /** @type {import('crypto')} */
  24367. let crypto
  24368. try {
  24369. crypto = __nccwpck_require__(7598)
  24370. /* c8 ignore next 3 */
  24371. } catch {
  24372. }
  24373. /**
  24374. * @see https://websockets.spec.whatwg.org/#concept-websocket-establish
  24375. * @param {URL} url
  24376. * @param {string|string[]} protocols
  24377. * @param {import('./websocket').WebSocket} ws
  24378. * @param {(response: any, extensions: string[] | undefined) => void} onEstablish
  24379. * @param {Partial<import('../../types/websocket').WebSocketInit>} options
  24380. */
  24381. function establishWebSocketConnection (url, protocols, client, ws, onEstablish, options) {
  24382. // 1. Let requestURL be a copy of url, with its scheme set to "http", if url’s
  24383. // scheme is "ws", and to "https" otherwise.
  24384. const requestURL = url
  24385. requestURL.protocol = url.protocol === 'ws:' ? 'http:' : 'https:'
  24386. // 2. Let request be a new request, whose URL is requestURL, client is client,
  24387. // service-workers mode is "none", referrer is "no-referrer", mode is
  24388. // "websocket", credentials mode is "include", cache mode is "no-store" ,
  24389. // and redirect mode is "error".
  24390. const request = makeRequest({
  24391. urlList: [requestURL],
  24392. client,
  24393. serviceWorkers: 'none',
  24394. referrer: 'no-referrer',
  24395. mode: 'websocket',
  24396. credentials: 'include',
  24397. cache: 'no-store',
  24398. redirect: 'error'
  24399. })
  24400. // Note: undici extension, allow setting custom headers.
  24401. if (options.headers) {
  24402. const headersList = getHeadersList(new Headers(options.headers))
  24403. request.headersList = headersList
  24404. }
  24405. // 3. Append (`Upgrade`, `websocket`) to request’s header list.
  24406. // 4. Append (`Connection`, `Upgrade`) to request’s header list.
  24407. // Note: both of these are handled by undici currently.
  24408. // https://github.com/nodejs/undici/blob/68c269c4144c446f3f1220951338daef4a6b5ec4/lib/client.js#L1397
  24409. // 5. Let keyValue be a nonce consisting of a randomly selected
  24410. // 16-byte value that has been forgiving-base64-encoded and
  24411. // isomorphic encoded.
  24412. const keyValue = crypto.randomBytes(16).toString('base64')
  24413. // 6. Append (`Sec-WebSocket-Key`, keyValue) to request’s
  24414. // header list.
  24415. request.headersList.append('sec-websocket-key', keyValue)
  24416. // 7. Append (`Sec-WebSocket-Version`, `13`) to request’s
  24417. // header list.
  24418. request.headersList.append('sec-websocket-version', '13')
  24419. // 8. For each protocol in protocols, combine
  24420. // (`Sec-WebSocket-Protocol`, protocol) in request’s header
  24421. // list.
  24422. for (const protocol of protocols) {
  24423. request.headersList.append('sec-websocket-protocol', protocol)
  24424. }
  24425. // 9. Let permessageDeflate be a user-agent defined
  24426. // "permessage-deflate" extension header value.
  24427. // https://github.com/mozilla/gecko-dev/blob/ce78234f5e653a5d3916813ff990f053510227bc/netwerk/protocol/websocket/WebSocketChannel.cpp#L2673
  24428. const permessageDeflate = 'permessage-deflate; client_max_window_bits'
  24429. // 10. Append (`Sec-WebSocket-Extensions`, permessageDeflate) to
  24430. // request’s header list.
  24431. request.headersList.append('sec-websocket-extensions', permessageDeflate)
  24432. // 11. Fetch request with useParallelQueue set to true, and
  24433. // processResponse given response being these steps:
  24434. const controller = fetching({
  24435. request,
  24436. useParallelQueue: true,
  24437. dispatcher: options.dispatcher,
  24438. processResponse (response) {
  24439. // 1. If response is a network error or its status is not 101,
  24440. // fail the WebSocket connection.
  24441. if (response.type === 'error' || response.status !== 101) {
  24442. failWebsocketConnection(ws, 'Received network error or non-101 status code.')
  24443. return
  24444. }
  24445. // 2. If protocols is not the empty list and extracting header
  24446. // list values given `Sec-WebSocket-Protocol` and response’s
  24447. // header list results in null, failure, or the empty byte
  24448. // sequence, then fail the WebSocket connection.
  24449. if (protocols.length !== 0 && !response.headersList.get('Sec-WebSocket-Protocol')) {
  24450. failWebsocketConnection(ws, 'Server did not respond with sent protocols.')
  24451. return
  24452. }
  24453. // 3. Follow the requirements stated step 2 to step 6, inclusive,
  24454. // of the last set of steps in section 4.1 of The WebSocket
  24455. // Protocol to validate response. This either results in fail
  24456. // the WebSocket connection or the WebSocket connection is
  24457. // established.
  24458. // 2. If the response lacks an |Upgrade| header field or the |Upgrade|
  24459. // header field contains a value that is not an ASCII case-
  24460. // insensitive match for the value "websocket", the client MUST
  24461. // _Fail the WebSocket Connection_.
  24462. if (response.headersList.get('Upgrade')?.toLowerCase() !== 'websocket') {
  24463. failWebsocketConnection(ws, 'Server did not set Upgrade header to "websocket".')
  24464. return
  24465. }
  24466. // 3. If the response lacks a |Connection| header field or the
  24467. // |Connection| header field doesn't contain a token that is an
  24468. // ASCII case-insensitive match for the value "Upgrade", the client
  24469. // MUST _Fail the WebSocket Connection_.
  24470. if (response.headersList.get('Connection')?.toLowerCase() !== 'upgrade') {
  24471. failWebsocketConnection(ws, 'Server did not set Connection header to "upgrade".')
  24472. return
  24473. }
  24474. // 4. If the response lacks a |Sec-WebSocket-Accept| header field or
  24475. // the |Sec-WebSocket-Accept| contains a value other than the
  24476. // base64-encoded SHA-1 of the concatenation of the |Sec-WebSocket-
  24477. // Key| (as a string, not base64-decoded) with the string "258EAFA5-
  24478. // E914-47DA-95CA-C5AB0DC85B11" but ignoring any leading and
  24479. // trailing whitespace, the client MUST _Fail the WebSocket
  24480. // Connection_.
  24481. const secWSAccept = response.headersList.get('Sec-WebSocket-Accept')
  24482. const digest = crypto.createHash('sha1').update(keyValue + uid).digest('base64')
  24483. if (secWSAccept !== digest) {
  24484. failWebsocketConnection(ws, 'Incorrect hash received in Sec-WebSocket-Accept header.')
  24485. return
  24486. }
  24487. // 5. If the response includes a |Sec-WebSocket-Extensions| header
  24488. // field and this header field indicates the use of an extension
  24489. // that was not present in the client's handshake (the server has
  24490. // indicated an extension not requested by the client), the client
  24491. // MUST _Fail the WebSocket Connection_. (The parsing of this
  24492. // header field to determine which extensions are requested is
  24493. // discussed in Section 9.1.)
  24494. const secExtension = response.headersList.get('Sec-WebSocket-Extensions')
  24495. let extensions
  24496. if (secExtension !== null) {
  24497. extensions = parseExtensions(secExtension)
  24498. if (!extensions.has('permessage-deflate')) {
  24499. failWebsocketConnection(ws, 'Sec-WebSocket-Extensions header does not match.')
  24500. return
  24501. }
  24502. }
  24503. // 6. If the response includes a |Sec-WebSocket-Protocol| header field
  24504. // and this header field indicates the use of a subprotocol that was
  24505. // not present in the client's handshake (the server has indicated a
  24506. // subprotocol not requested by the client), the client MUST _Fail
  24507. // the WebSocket Connection_.
  24508. const secProtocol = response.headersList.get('Sec-WebSocket-Protocol')
  24509. if (secProtocol !== null) {
  24510. const requestProtocols = getDecodeSplit('sec-websocket-protocol', request.headersList)
  24511. // The client can request that the server use a specific subprotocol by
  24512. // including the |Sec-WebSocket-Protocol| field in its handshake. If it
  24513. // is specified, the server needs to include the same field and one of
  24514. // the selected subprotocol values in its response for the connection to
  24515. // be established.
  24516. if (requestProtocols === null || !requestProtocols.includes(secProtocol)) {
  24517. failWebsocketConnection(ws, 'Protocol was not set in the opening handshake.')
  24518. return
  24519. }
  24520. }
  24521. response.socket.on('data', onSocketData)
  24522. response.socket.on('close', onSocketClose)
  24523. response.socket.on('error', onSocketError)
  24524. if (channels.open.hasSubscribers) {
  24525. channels.open.publish({
  24526. address: response.socket.address(),
  24527. protocol: secProtocol,
  24528. extensions: secExtension
  24529. })
  24530. }
  24531. onEstablish(response, extensions)
  24532. }
  24533. })
  24534. return controller
  24535. }
  24536. function closeWebSocketConnection (ws, code, reason, reasonByteLength) {
  24537. if (isClosing(ws) || isClosed(ws)) {
  24538. // If this's ready state is CLOSING (2) or CLOSED (3)
  24539. // Do nothing.
  24540. } else if (!isEstablished(ws)) {
  24541. // If the WebSocket connection is not yet established
  24542. // Fail the WebSocket connection and set this's ready state
  24543. // to CLOSING (2).
  24544. failWebsocketConnection(ws, 'Connection was closed before it was established.')
  24545. ws[kReadyState] = states.CLOSING
  24546. } else if (ws[kSentClose] === sentCloseFrameState.NOT_SENT) {
  24547. // If the WebSocket closing handshake has not yet been started
  24548. // Start the WebSocket closing handshake and set this's ready
  24549. // state to CLOSING (2).
  24550. // - If neither code nor reason is present, the WebSocket Close
  24551. // message must not have a body.
  24552. // - If code is present, then the status code to use in the
  24553. // WebSocket Close message must be the integer given by code.
  24554. // - If reason is also present, then reasonBytes must be
  24555. // provided in the Close message after the status code.
  24556. ws[kSentClose] = sentCloseFrameState.PROCESSING
  24557. const frame = new WebsocketFrameSend()
  24558. // If neither code nor reason is present, the WebSocket Close
  24559. // message must not have a body.
  24560. // If code is present, then the status code to use in the
  24561. // WebSocket Close message must be the integer given by code.
  24562. if (code !== undefined && reason === undefined) {
  24563. frame.frameData = Buffer.allocUnsafe(2)
  24564. frame.frameData.writeUInt16BE(code, 0)
  24565. } else if (code !== undefined && reason !== undefined) {
  24566. // If reason is also present, then reasonBytes must be
  24567. // provided in the Close message after the status code.
  24568. frame.frameData = Buffer.allocUnsafe(2 + reasonByteLength)
  24569. frame.frameData.writeUInt16BE(code, 0)
  24570. // the body MAY contain UTF-8-encoded data with value /reason/
  24571. frame.frameData.write(reason, 2, 'utf-8')
  24572. } else {
  24573. frame.frameData = emptyBuffer
  24574. }
  24575. /** @type {import('stream').Duplex} */
  24576. const socket = ws[kResponse].socket
  24577. socket.write(frame.createFrame(opcodes.CLOSE))
  24578. ws[kSentClose] = sentCloseFrameState.SENT
  24579. // Upon either sending or receiving a Close control frame, it is said
  24580. // that _The WebSocket Closing Handshake is Started_ and that the
  24581. // WebSocket connection is in the CLOSING state.
  24582. ws[kReadyState] = states.CLOSING
  24583. } else {
  24584. // Otherwise
  24585. // Set this's ready state to CLOSING (2).
  24586. ws[kReadyState] = states.CLOSING
  24587. }
  24588. }
  24589. /**
  24590. * @param {Buffer} chunk
  24591. */
  24592. function onSocketData (chunk) {
  24593. if (!this.ws[kByteParser].write(chunk)) {
  24594. this.pause()
  24595. }
  24596. }
  24597. /**
  24598. * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol
  24599. * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.4
  24600. */
  24601. function onSocketClose () {
  24602. const { ws } = this
  24603. const { [kResponse]: response } = ws
  24604. response.socket.off('data', onSocketData)
  24605. response.socket.off('close', onSocketClose)
  24606. response.socket.off('error', onSocketError)
  24607. // If the TCP connection was closed after the
  24608. // WebSocket closing handshake was completed, the WebSocket connection
  24609. // is said to have been closed _cleanly_.
  24610. const wasClean = ws[kSentClose] === sentCloseFrameState.SENT && ws[kReceivedClose]
  24611. let code = 1005
  24612. let reason = ''
  24613. const result = ws[kByteParser].closingInfo
  24614. if (result && !result.error) {
  24615. code = result.code ?? 1005
  24616. reason = result.reason
  24617. } else if (!ws[kReceivedClose]) {
  24618. // If _The WebSocket
  24619. // Connection is Closed_ and no Close control frame was received by the
  24620. // endpoint (such as could occur if the underlying transport connection
  24621. // is lost), _The WebSocket Connection Close Code_ is considered to be
  24622. // 1006.
  24623. code = 1006
  24624. }
  24625. // 1. Change the ready state to CLOSED (3).
  24626. ws[kReadyState] = states.CLOSED
  24627. // 2. If the user agent was required to fail the WebSocket
  24628. // connection, or if the WebSocket connection was closed
  24629. // after being flagged as full, fire an event named error
  24630. // at the WebSocket object.
  24631. // TODO
  24632. // 3. Fire an event named close at the WebSocket object,
  24633. // using CloseEvent, with the wasClean attribute
  24634. // initialized to true if the connection closed cleanly
  24635. // and false otherwise, the code attribute initialized to
  24636. // the WebSocket connection close code, and the reason
  24637. // attribute initialized to the result of applying UTF-8
  24638. // decode without BOM to the WebSocket connection close
  24639. // reason.
  24640. // TODO: process.nextTick
  24641. fireEvent('close', ws, (type, init) => new CloseEvent(type, init), {
  24642. wasClean, code, reason
  24643. })
  24644. if (channels.close.hasSubscribers) {
  24645. channels.close.publish({
  24646. websocket: ws,
  24647. code,
  24648. reason
  24649. })
  24650. }
  24651. }
  24652. function onSocketError (error) {
  24653. const { ws } = this
  24654. ws[kReadyState] = states.CLOSING
  24655. if (channels.socketError.hasSubscribers) {
  24656. channels.socketError.publish(error)
  24657. }
  24658. this.destroy()
  24659. }
  24660. module.exports = {
  24661. establishWebSocketConnection,
  24662. closeWebSocketConnection
  24663. }
  24664. /***/ }),
  24665. /***/ 736:
  24666. /***/ ((module) => {
  24667. // This is a Globally Unique Identifier unique used
  24668. // to validate that the endpoint accepts websocket
  24669. // connections.
  24670. // See https://www.rfc-editor.org/rfc/rfc6455.html#section-1.3
  24671. const uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
  24672. /** @type {PropertyDescriptor} */
  24673. const staticPropertyDescriptors = {
  24674. enumerable: true,
  24675. writable: false,
  24676. configurable: false
  24677. }
  24678. const states = {
  24679. CONNECTING: 0,
  24680. OPEN: 1,
  24681. CLOSING: 2,
  24682. CLOSED: 3
  24683. }
  24684. const sentCloseFrameState = {
  24685. NOT_SENT: 0,
  24686. PROCESSING: 1,
  24687. SENT: 2
  24688. }
  24689. const opcodes = {
  24690. CONTINUATION: 0x0,
  24691. TEXT: 0x1,
  24692. BINARY: 0x2,
  24693. CLOSE: 0x8,
  24694. PING: 0x9,
  24695. PONG: 0xA
  24696. }
  24697. const maxUnsigned16Bit = 2 ** 16 - 1 // 65535
  24698. const parserStates = {
  24699. INFO: 0,
  24700. PAYLOADLENGTH_16: 2,
  24701. PAYLOADLENGTH_64: 3,
  24702. READ_DATA: 4
  24703. }
  24704. const emptyBuffer = Buffer.allocUnsafe(0)
  24705. const sendHints = {
  24706. string: 1,
  24707. typedArray: 2,
  24708. arrayBuffer: 3,
  24709. blob: 4
  24710. }
  24711. module.exports = {
  24712. uid,
  24713. sentCloseFrameState,
  24714. staticPropertyDescriptors,
  24715. states,
  24716. opcodes,
  24717. maxUnsigned16Bit,
  24718. parserStates,
  24719. emptyBuffer,
  24720. sendHints
  24721. }
  24722. /***/ }),
  24723. /***/ 5188:
  24724. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24725. const { webidl } = __nccwpck_require__(5893)
  24726. const { kEnumerableProperty } = __nccwpck_require__(3440)
  24727. const { kConstruct } = __nccwpck_require__(6443)
  24728. const { MessagePort } = __nccwpck_require__(5919)
  24729. /**
  24730. * @see https://html.spec.whatwg.org/multipage/comms.html#messageevent
  24731. */
  24732. class MessageEvent extends Event {
  24733. #eventInit
  24734. constructor (type, eventInitDict = {}) {
  24735. if (type === kConstruct) {
  24736. super(arguments[1], arguments[2])
  24737. webidl.util.markAsUncloneable(this)
  24738. return
  24739. }
  24740. const prefix = 'MessageEvent constructor'
  24741. webidl.argumentLengthCheck(arguments, 1, prefix)
  24742. type = webidl.converters.DOMString(type, prefix, 'type')
  24743. eventInitDict = webidl.converters.MessageEventInit(eventInitDict, prefix, 'eventInitDict')
  24744. super(type, eventInitDict)
  24745. this.#eventInit = eventInitDict
  24746. webidl.util.markAsUncloneable(this)
  24747. }
  24748. get data () {
  24749. webidl.brandCheck(this, MessageEvent)
  24750. return this.#eventInit.data
  24751. }
  24752. get origin () {
  24753. webidl.brandCheck(this, MessageEvent)
  24754. return this.#eventInit.origin
  24755. }
  24756. get lastEventId () {
  24757. webidl.brandCheck(this, MessageEvent)
  24758. return this.#eventInit.lastEventId
  24759. }
  24760. get source () {
  24761. webidl.brandCheck(this, MessageEvent)
  24762. return this.#eventInit.source
  24763. }
  24764. get ports () {
  24765. webidl.brandCheck(this, MessageEvent)
  24766. if (!Object.isFrozen(this.#eventInit.ports)) {
  24767. Object.freeze(this.#eventInit.ports)
  24768. }
  24769. return this.#eventInit.ports
  24770. }
  24771. initMessageEvent (
  24772. type,
  24773. bubbles = false,
  24774. cancelable = false,
  24775. data = null,
  24776. origin = '',
  24777. lastEventId = '',
  24778. source = null,
  24779. ports = []
  24780. ) {
  24781. webidl.brandCheck(this, MessageEvent)
  24782. webidl.argumentLengthCheck(arguments, 1, 'MessageEvent.initMessageEvent')
  24783. return new MessageEvent(type, {
  24784. bubbles, cancelable, data, origin, lastEventId, source, ports
  24785. })
  24786. }
  24787. static createFastMessageEvent (type, init) {
  24788. const messageEvent = new MessageEvent(kConstruct, type, init)
  24789. messageEvent.#eventInit = init
  24790. messageEvent.#eventInit.data ??= null
  24791. messageEvent.#eventInit.origin ??= ''
  24792. messageEvent.#eventInit.lastEventId ??= ''
  24793. messageEvent.#eventInit.source ??= null
  24794. messageEvent.#eventInit.ports ??= []
  24795. return messageEvent
  24796. }
  24797. }
  24798. const { createFastMessageEvent } = MessageEvent
  24799. delete MessageEvent.createFastMessageEvent
  24800. /**
  24801. * @see https://websockets.spec.whatwg.org/#the-closeevent-interface
  24802. */
  24803. class CloseEvent extends Event {
  24804. #eventInit
  24805. constructor (type, eventInitDict = {}) {
  24806. const prefix = 'CloseEvent constructor'
  24807. webidl.argumentLengthCheck(arguments, 1, prefix)
  24808. type = webidl.converters.DOMString(type, prefix, 'type')
  24809. eventInitDict = webidl.converters.CloseEventInit(eventInitDict)
  24810. super(type, eventInitDict)
  24811. this.#eventInit = eventInitDict
  24812. webidl.util.markAsUncloneable(this)
  24813. }
  24814. get wasClean () {
  24815. webidl.brandCheck(this, CloseEvent)
  24816. return this.#eventInit.wasClean
  24817. }
  24818. get code () {
  24819. webidl.brandCheck(this, CloseEvent)
  24820. return this.#eventInit.code
  24821. }
  24822. get reason () {
  24823. webidl.brandCheck(this, CloseEvent)
  24824. return this.#eventInit.reason
  24825. }
  24826. }
  24827. // https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface
  24828. class ErrorEvent extends Event {
  24829. #eventInit
  24830. constructor (type, eventInitDict) {
  24831. const prefix = 'ErrorEvent constructor'
  24832. webidl.argumentLengthCheck(arguments, 1, prefix)
  24833. super(type, eventInitDict)
  24834. webidl.util.markAsUncloneable(this)
  24835. type = webidl.converters.DOMString(type, prefix, 'type')
  24836. eventInitDict = webidl.converters.ErrorEventInit(eventInitDict ?? {})
  24837. this.#eventInit = eventInitDict
  24838. }
  24839. get message () {
  24840. webidl.brandCheck(this, ErrorEvent)
  24841. return this.#eventInit.message
  24842. }
  24843. get filename () {
  24844. webidl.brandCheck(this, ErrorEvent)
  24845. return this.#eventInit.filename
  24846. }
  24847. get lineno () {
  24848. webidl.brandCheck(this, ErrorEvent)
  24849. return this.#eventInit.lineno
  24850. }
  24851. get colno () {
  24852. webidl.brandCheck(this, ErrorEvent)
  24853. return this.#eventInit.colno
  24854. }
  24855. get error () {
  24856. webidl.brandCheck(this, ErrorEvent)
  24857. return this.#eventInit.error
  24858. }
  24859. }
  24860. Object.defineProperties(MessageEvent.prototype, {
  24861. [Symbol.toStringTag]: {
  24862. value: 'MessageEvent',
  24863. configurable: true
  24864. },
  24865. data: kEnumerableProperty,
  24866. origin: kEnumerableProperty,
  24867. lastEventId: kEnumerableProperty,
  24868. source: kEnumerableProperty,
  24869. ports: kEnumerableProperty,
  24870. initMessageEvent: kEnumerableProperty
  24871. })
  24872. Object.defineProperties(CloseEvent.prototype, {
  24873. [Symbol.toStringTag]: {
  24874. value: 'CloseEvent',
  24875. configurable: true
  24876. },
  24877. reason: kEnumerableProperty,
  24878. code: kEnumerableProperty,
  24879. wasClean: kEnumerableProperty
  24880. })
  24881. Object.defineProperties(ErrorEvent.prototype, {
  24882. [Symbol.toStringTag]: {
  24883. value: 'ErrorEvent',
  24884. configurable: true
  24885. },
  24886. message: kEnumerableProperty,
  24887. filename: kEnumerableProperty,
  24888. lineno: kEnumerableProperty,
  24889. colno: kEnumerableProperty,
  24890. error: kEnumerableProperty
  24891. })
  24892. webidl.converters.MessagePort = webidl.interfaceConverter(MessagePort)
  24893. webidl.converters['sequence<MessagePort>'] = webidl.sequenceConverter(
  24894. webidl.converters.MessagePort
  24895. )
  24896. const eventInit = [
  24897. {
  24898. key: 'bubbles',
  24899. converter: webidl.converters.boolean,
  24900. defaultValue: () => false
  24901. },
  24902. {
  24903. key: 'cancelable',
  24904. converter: webidl.converters.boolean,
  24905. defaultValue: () => false
  24906. },
  24907. {
  24908. key: 'composed',
  24909. converter: webidl.converters.boolean,
  24910. defaultValue: () => false
  24911. }
  24912. ]
  24913. webidl.converters.MessageEventInit = webidl.dictionaryConverter([
  24914. ...eventInit,
  24915. {
  24916. key: 'data',
  24917. converter: webidl.converters.any,
  24918. defaultValue: () => null
  24919. },
  24920. {
  24921. key: 'origin',
  24922. converter: webidl.converters.USVString,
  24923. defaultValue: () => ''
  24924. },
  24925. {
  24926. key: 'lastEventId',
  24927. converter: webidl.converters.DOMString,
  24928. defaultValue: () => ''
  24929. },
  24930. {
  24931. key: 'source',
  24932. // Node doesn't implement WindowProxy or ServiceWorker, so the only
  24933. // valid value for source is a MessagePort.
  24934. converter: webidl.nullableConverter(webidl.converters.MessagePort),
  24935. defaultValue: () => null
  24936. },
  24937. {
  24938. key: 'ports',
  24939. converter: webidl.converters['sequence<MessagePort>'],
  24940. defaultValue: () => new Array(0)
  24941. }
  24942. ])
  24943. webidl.converters.CloseEventInit = webidl.dictionaryConverter([
  24944. ...eventInit,
  24945. {
  24946. key: 'wasClean',
  24947. converter: webidl.converters.boolean,
  24948. defaultValue: () => false
  24949. },
  24950. {
  24951. key: 'code',
  24952. converter: webidl.converters['unsigned short'],
  24953. defaultValue: () => 0
  24954. },
  24955. {
  24956. key: 'reason',
  24957. converter: webidl.converters.USVString,
  24958. defaultValue: () => ''
  24959. }
  24960. ])
  24961. webidl.converters.ErrorEventInit = webidl.dictionaryConverter([
  24962. ...eventInit,
  24963. {
  24964. key: 'message',
  24965. converter: webidl.converters.DOMString,
  24966. defaultValue: () => ''
  24967. },
  24968. {
  24969. key: 'filename',
  24970. converter: webidl.converters.USVString,
  24971. defaultValue: () => ''
  24972. },
  24973. {
  24974. key: 'lineno',
  24975. converter: webidl.converters['unsigned long'],
  24976. defaultValue: () => 0
  24977. },
  24978. {
  24979. key: 'colno',
  24980. converter: webidl.converters['unsigned long'],
  24981. defaultValue: () => 0
  24982. },
  24983. {
  24984. key: 'error',
  24985. converter: webidl.converters.any
  24986. }
  24987. ])
  24988. module.exports = {
  24989. MessageEvent,
  24990. CloseEvent,
  24991. ErrorEvent,
  24992. createFastMessageEvent
  24993. }
  24994. /***/ }),
  24995. /***/ 3264:
  24996. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24997. const { maxUnsigned16Bit } = __nccwpck_require__(736)
  24998. const BUFFER_SIZE = 16386
  24999. /** @type {import('crypto')} */
  25000. let crypto
  25001. let buffer = null
  25002. let bufIdx = BUFFER_SIZE
  25003. try {
  25004. crypto = __nccwpck_require__(7598)
  25005. /* c8 ignore next 3 */
  25006. } catch {
  25007. crypto = {
  25008. // not full compatibility, but minimum.
  25009. randomFillSync: function randomFillSync (buffer, _offset, _size) {
  25010. for (let i = 0; i < buffer.length; ++i) {
  25011. buffer[i] = Math.random() * 255 | 0
  25012. }
  25013. return buffer
  25014. }
  25015. }
  25016. }
  25017. function generateMask () {
  25018. if (bufIdx === BUFFER_SIZE) {
  25019. bufIdx = 0
  25020. crypto.randomFillSync((buffer ??= Buffer.allocUnsafe(BUFFER_SIZE)), 0, BUFFER_SIZE)
  25021. }
  25022. return [buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++]]
  25023. }
  25024. class WebsocketFrameSend {
  25025. /**
  25026. * @param {Buffer|undefined} data
  25027. */
  25028. constructor (data) {
  25029. this.frameData = data
  25030. }
  25031. createFrame (opcode) {
  25032. const frameData = this.frameData
  25033. const maskKey = generateMask()
  25034. const bodyLength = frameData?.byteLength ?? 0
  25035. /** @type {number} */
  25036. let payloadLength = bodyLength // 0-125
  25037. let offset = 6
  25038. if (bodyLength > maxUnsigned16Bit) {
  25039. offset += 8 // payload length is next 8 bytes
  25040. payloadLength = 127
  25041. } else if (bodyLength > 125) {
  25042. offset += 2 // payload length is next 2 bytes
  25043. payloadLength = 126
  25044. }
  25045. const buffer = Buffer.allocUnsafe(bodyLength + offset)
  25046. // Clear first 2 bytes, everything else is overwritten
  25047. buffer[0] = buffer[1] = 0
  25048. buffer[0] |= 0x80 // FIN
  25049. buffer[0] = (buffer[0] & 0xF0) + opcode // opcode
  25050. /*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */
  25051. buffer[offset - 4] = maskKey[0]
  25052. buffer[offset - 3] = maskKey[1]
  25053. buffer[offset - 2] = maskKey[2]
  25054. buffer[offset - 1] = maskKey[3]
  25055. buffer[1] = payloadLength
  25056. if (payloadLength === 126) {
  25057. buffer.writeUInt16BE(bodyLength, 2)
  25058. } else if (payloadLength === 127) {
  25059. // Clear extended payload length
  25060. buffer[2] = buffer[3] = 0
  25061. buffer.writeUIntBE(bodyLength, 4, 6)
  25062. }
  25063. buffer[1] |= 0x80 // MASK
  25064. // mask body
  25065. for (let i = 0; i < bodyLength; ++i) {
  25066. buffer[offset + i] = frameData[i] ^ maskKey[i & 3]
  25067. }
  25068. return buffer
  25069. }
  25070. }
  25071. module.exports = {
  25072. WebsocketFrameSend
  25073. }
  25074. /***/ }),
  25075. /***/ 9469:
  25076. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25077. const { createInflateRaw, Z_DEFAULT_WINDOWBITS } = __nccwpck_require__(8522)
  25078. const { isValidClientWindowBits } = __nccwpck_require__(8625)
  25079. const { MessageSizeExceededError } = __nccwpck_require__(8707)
  25080. const tail = Buffer.from([0x00, 0x00, 0xff, 0xff])
  25081. const kBuffer = Symbol('kBuffer')
  25082. const kLength = Symbol('kLength')
  25083. class PerMessageDeflate {
  25084. /** @type {import('node:zlib').InflateRaw} */
  25085. #inflate
  25086. #options = {}
  25087. #maxPayloadSize = 0
  25088. /**
  25089. * @param {Map<string, string>} extensions
  25090. */
  25091. constructor (extensions, options) {
  25092. this.#options.serverNoContextTakeover = extensions.has('server_no_context_takeover')
  25093. this.#options.serverMaxWindowBits = extensions.get('server_max_window_bits')
  25094. this.#maxPayloadSize = options.maxPayloadSize
  25095. }
  25096. /**
  25097. * Decompress a compressed payload.
  25098. * @param {Buffer} chunk Compressed data
  25099. * @param {boolean} fin Final fragment flag
  25100. * @param {Function} callback Callback function
  25101. */
  25102. decompress (chunk, fin, callback) {
  25103. // An endpoint uses the following algorithm to decompress a message.
  25104. // 1. Append 4 octets of 0x00 0x00 0xff 0xff to the tail end of the
  25105. // payload of the message.
  25106. // 2. Decompress the resulting data using DEFLATE.
  25107. if (!this.#inflate) {
  25108. let windowBits = Z_DEFAULT_WINDOWBITS
  25109. if (this.#options.serverMaxWindowBits) { // empty values default to Z_DEFAULT_WINDOWBITS
  25110. if (!isValidClientWindowBits(this.#options.serverMaxWindowBits)) {
  25111. callback(new Error('Invalid server_max_window_bits'))
  25112. return
  25113. }
  25114. windowBits = Number.parseInt(this.#options.serverMaxWindowBits)
  25115. }
  25116. try {
  25117. this.#inflate = createInflateRaw({ windowBits })
  25118. } catch (err) {
  25119. callback(err)
  25120. return
  25121. }
  25122. this.#inflate[kBuffer] = []
  25123. this.#inflate[kLength] = 0
  25124. this.#inflate.on('data', (data) => {
  25125. this.#inflate[kLength] += data.length
  25126. if (this.#maxPayloadSize > 0 && this.#inflate[kLength] > this.#maxPayloadSize) {
  25127. callback(new MessageSizeExceededError())
  25128. // The inflater may still hold buffered input that can emit a late
  25129. // zlib error. Remove the data listener, then deterministically stop
  25130. // the stream so a subsequent 'error' cannot fire without a listener
  25131. // (which would terminate the process as an unhandled error event).
  25132. this.#inflate.removeAllListeners()
  25133. this.#inflate.destroy()
  25134. this.#inflate = null
  25135. return
  25136. }
  25137. this.#inflate[kBuffer].push(data)
  25138. })
  25139. this.#inflate.on('error', (err) => {
  25140. this.#inflate = null
  25141. callback(err)
  25142. })
  25143. }
  25144. this.#inflate.write(chunk)
  25145. if (fin) {
  25146. this.#inflate.write(tail)
  25147. }
  25148. this.#inflate.flush(() => {
  25149. if (!this.#inflate) {
  25150. return
  25151. }
  25152. const full = Buffer.concat(this.#inflate[kBuffer], this.#inflate[kLength])
  25153. this.#inflate[kBuffer].length = 0
  25154. this.#inflate[kLength] = 0
  25155. callback(null, full)
  25156. })
  25157. }
  25158. }
  25159. module.exports = { PerMessageDeflate }
  25160. /***/ }),
  25161. /***/ 1652:
  25162. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25163. const { Writable } = __nccwpck_require__(7075)
  25164. const assert = __nccwpck_require__(4589)
  25165. const { parserStates, opcodes, states, emptyBuffer, sentCloseFrameState } = __nccwpck_require__(736)
  25166. const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(1216)
  25167. const { channels } = __nccwpck_require__(2414)
  25168. const {
  25169. isValidStatusCode,
  25170. isValidOpcode,
  25171. failWebsocketConnection,
  25172. websocketMessageReceived,
  25173. utf8Decode,
  25174. isControlFrame,
  25175. isTextBinaryFrame,
  25176. isContinuationFrame
  25177. } = __nccwpck_require__(8625)
  25178. const { WebsocketFrameSend } = __nccwpck_require__(3264)
  25179. const { closeWebSocketConnection } = __nccwpck_require__(6897)
  25180. const { PerMessageDeflate } = __nccwpck_require__(9469)
  25181. const { MessageSizeExceededError } = __nccwpck_require__(8707)
  25182. function failWebsocketConnectionWithCode (ws, code, reason) {
  25183. closeWebSocketConnection(ws, code, reason, Buffer.byteLength(reason))
  25184. failWebsocketConnection(ws, reason)
  25185. }
  25186. // This code was influenced by ws released under the MIT license.
  25187. // Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  25188. // Copyright (c) 2013 Arnout Kazemier and contributors
  25189. // Copyright (c) 2016 Luigi Pinca and contributors
  25190. class ByteParser extends Writable {
  25191. #buffers = []
  25192. #fragmentsBytes = 0
  25193. #byteOffset = 0
  25194. #loop = false
  25195. #state = parserStates.INFO
  25196. #info = {}
  25197. #fragments = []
  25198. /** @type {Map<string, PerMessageDeflate>} */
  25199. #extensions
  25200. /** @type {number} */
  25201. #maxFragments
  25202. /** @type {number} */
  25203. #maxPayloadSize
  25204. /**
  25205. * @param {import('./websocket').WebSocket} ws
  25206. * @param {Map<string, string>|null} extensions
  25207. * @param {{ maxFragments?: number, maxPayloadSize?: number }} [options]
  25208. */
  25209. constructor (ws, extensions, options = {}) {
  25210. super()
  25211. this.ws = ws
  25212. this.#extensions = extensions == null ? new Map() : extensions
  25213. this.#maxFragments = options.maxFragments ?? 0
  25214. this.#maxPayloadSize = options.maxPayloadSize ?? 0
  25215. if (this.#extensions.has('permessage-deflate')) {
  25216. this.#extensions.set('permessage-deflate', new PerMessageDeflate(extensions, options))
  25217. }
  25218. }
  25219. /**
  25220. * @param {Buffer} chunk
  25221. * @param {() => void} callback
  25222. */
  25223. _write (chunk, _, callback) {
  25224. this.#buffers.push(chunk)
  25225. this.#byteOffset += chunk.length
  25226. this.#loop = true
  25227. this.run(callback)
  25228. }
  25229. #validatePayloadLength () {
  25230. if (
  25231. this.#maxPayloadSize > 0 &&
  25232. !isControlFrame(this.#info.opcode) &&
  25233. this.#info.payloadLength + this.#fragmentsBytes > this.#maxPayloadSize
  25234. ) {
  25235. failWebsocketConnectionWithCode(this.ws, 1009, 'Payload size exceeds maximum allowed size')
  25236. return false
  25237. }
  25238. return true
  25239. }
  25240. /**
  25241. * Runs whenever a new chunk is received.
  25242. * Callback is called whenever there are no more chunks buffering,
  25243. * or not enough bytes are buffered to parse.
  25244. */
  25245. run (callback) {
  25246. while (this.#loop) {
  25247. if (this.#state === parserStates.INFO) {
  25248. // If there aren't enough bytes to parse the payload length, etc.
  25249. if (this.#byteOffset < 2) {
  25250. return callback()
  25251. }
  25252. const buffer = this.consume(2)
  25253. const fin = (buffer[0] & 0x80) !== 0
  25254. const opcode = buffer[0] & 0x0F
  25255. const masked = (buffer[1] & 0x80) === 0x80
  25256. const fragmented = !fin && opcode !== opcodes.CONTINUATION
  25257. const payloadLength = buffer[1] & 0x7F
  25258. const rsv1 = buffer[0] & 0x40
  25259. const rsv2 = buffer[0] & 0x20
  25260. const rsv3 = buffer[0] & 0x10
  25261. if (!isValidOpcode(opcode)) {
  25262. failWebsocketConnection(this.ws, 'Invalid opcode received')
  25263. return callback()
  25264. }
  25265. if (masked) {
  25266. failWebsocketConnection(this.ws, 'Frame cannot be masked')
  25267. return callback()
  25268. }
  25269. // MUST be 0 unless an extension is negotiated that defines meanings
  25270. // for non-zero values. If a nonzero value is received and none of
  25271. // the negotiated extensions defines the meaning of such a nonzero
  25272. // value, the receiving endpoint MUST _Fail the WebSocket
  25273. // Connection_.
  25274. // This document allocates the RSV1 bit of the WebSocket header for
  25275. // PMCEs and calls the bit the "Per-Message Compressed" bit. On a
  25276. // WebSocket connection where a PMCE is in use, this bit indicates
  25277. // whether a message is compressed or not.
  25278. if (rsv1 !== 0 && !this.#extensions.has('permessage-deflate')) {
  25279. failWebsocketConnection(this.ws, 'Expected RSV1 to be clear.')
  25280. return
  25281. }
  25282. if (rsv2 !== 0 || rsv3 !== 0) {
  25283. failWebsocketConnection(this.ws, 'RSV1, RSV2, RSV3 must be clear')
  25284. return
  25285. }
  25286. if (fragmented && !isTextBinaryFrame(opcode)) {
  25287. // Only text and binary frames can be fragmented
  25288. failWebsocketConnection(this.ws, 'Invalid frame type was fragmented.')
  25289. return
  25290. }
  25291. // If we are already parsing a text/binary frame and do not receive either
  25292. // a continuation frame or close frame, fail the connection.
  25293. if (isTextBinaryFrame(opcode) && this.#fragments.length > 0) {
  25294. failWebsocketConnection(this.ws, 'Expected continuation frame')
  25295. return
  25296. }
  25297. if (this.#info.fragmented && fragmented) {
  25298. // A fragmented frame can't be fragmented itself
  25299. failWebsocketConnection(this.ws, 'Fragmented frame exceeded 125 bytes.')
  25300. return
  25301. }
  25302. // "All control frames MUST have a payload length of 125 bytes or less
  25303. // and MUST NOT be fragmented."
  25304. if ((payloadLength > 125 || fragmented) && isControlFrame(opcode)) {
  25305. failWebsocketConnection(this.ws, 'Control frame either too large or fragmented')
  25306. return
  25307. }
  25308. if (isContinuationFrame(opcode) && this.#fragments.length === 0 && !this.#info.compressed) {
  25309. failWebsocketConnection(this.ws, 'Unexpected continuation frame')
  25310. return
  25311. }
  25312. if (payloadLength <= 125) {
  25313. this.#info.payloadLength = payloadLength
  25314. this.#state = parserStates.READ_DATA
  25315. if (!this.#validatePayloadLength()) {
  25316. return
  25317. }
  25318. } else if (payloadLength === 126) {
  25319. this.#state = parserStates.PAYLOADLENGTH_16
  25320. } else if (payloadLength === 127) {
  25321. this.#state = parserStates.PAYLOADLENGTH_64
  25322. }
  25323. if (isTextBinaryFrame(opcode)) {
  25324. this.#info.binaryType = opcode
  25325. this.#info.compressed = rsv1 !== 0
  25326. }
  25327. this.#info.opcode = opcode
  25328. this.#info.masked = masked
  25329. this.#info.fin = fin
  25330. this.#info.fragmented = fragmented
  25331. } else if (this.#state === parserStates.PAYLOADLENGTH_16) {
  25332. if (this.#byteOffset < 2) {
  25333. return callback()
  25334. }
  25335. const buffer = this.consume(2)
  25336. this.#info.payloadLength = buffer.readUInt16BE(0)
  25337. this.#state = parserStates.READ_DATA
  25338. if (!this.#validatePayloadLength()) {
  25339. return
  25340. }
  25341. } else if (this.#state === parserStates.PAYLOADLENGTH_64) {
  25342. if (this.#byteOffset < 8) {
  25343. return callback()
  25344. }
  25345. const buffer = this.consume(8)
  25346. const upper = buffer.readUInt32BE(0)
  25347. const lower = buffer.readUInt32BE(4)
  25348. // 2^31 is the maximum bytes an arraybuffer can contain
  25349. // on 32-bit systems. Although, on 64-bit systems, this is
  25350. // 2^53-1 bytes.
  25351. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length
  25352. // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/common/globals.h;drc=1946212ac0100668f14eb9e2843bdd846e510a1e;bpv=1;bpt=1;l=1275
  25353. // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/js-array-buffer.h;l=34;drc=1946212ac0100668f14eb9e2843bdd846e510a1e
  25354. if (upper !== 0 || lower > 2 ** 31 - 1) {
  25355. failWebsocketConnection(this.ws, 'Received payload length > 2^31 bytes.')
  25356. return
  25357. }
  25358. this.#info.payloadLength = lower
  25359. this.#state = parserStates.READ_DATA
  25360. if (!this.#validatePayloadLength()) {
  25361. return
  25362. }
  25363. } else if (this.#state === parserStates.READ_DATA) {
  25364. if (this.#byteOffset < this.#info.payloadLength) {
  25365. return callback()
  25366. }
  25367. const body = this.consume(this.#info.payloadLength)
  25368. if (isControlFrame(this.#info.opcode)) {
  25369. this.#loop = this.parseControlFrame(body)
  25370. this.#state = parserStates.INFO
  25371. } else {
  25372. if (!this.#info.compressed) {
  25373. if (!this.writeFragments(body)) {
  25374. return
  25375. }
  25376. if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
  25377. failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
  25378. return
  25379. }
  25380. // If the frame is not fragmented, a message has been received.
  25381. // If the frame is fragmented, it will terminate with a fin bit set
  25382. // and an opcode of 0 (continuation), therefore we handle that when
  25383. // parsing continuation frames, not here.
  25384. if (!this.#info.fragmented && this.#info.fin) {
  25385. websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments())
  25386. }
  25387. this.#state = parserStates.INFO
  25388. } else {
  25389. this.#extensions.get('permessage-deflate').decompress(
  25390. body,
  25391. this.#info.fin,
  25392. (error, data) => {
  25393. if (error) {
  25394. const code = error instanceof MessageSizeExceededError ? 1009 : 1007
  25395. failWebsocketConnectionWithCode(this.ws, code, error.message)
  25396. return
  25397. }
  25398. if (!this.writeFragments(data)) {
  25399. return
  25400. }
  25401. if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
  25402. failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
  25403. return
  25404. }
  25405. if (!this.#info.fin) {
  25406. this.#state = parserStates.INFO
  25407. this.#loop = true
  25408. this.run(callback)
  25409. return
  25410. }
  25411. websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments())
  25412. this.#loop = true
  25413. this.#state = parserStates.INFO
  25414. this.run(callback)
  25415. }
  25416. )
  25417. this.#loop = false
  25418. break
  25419. }
  25420. }
  25421. }
  25422. }
  25423. }
  25424. /**
  25425. * Take n bytes from the buffered Buffers
  25426. * @param {number} n
  25427. * @returns {Buffer}
  25428. */
  25429. consume (n) {
  25430. if (n > this.#byteOffset) {
  25431. throw new Error('Called consume() before buffers satiated.')
  25432. } else if (n === 0) {
  25433. return emptyBuffer
  25434. }
  25435. if (this.#buffers[0].length === n) {
  25436. this.#byteOffset -= this.#buffers[0].length
  25437. return this.#buffers.shift()
  25438. }
  25439. const buffer = Buffer.allocUnsafe(n)
  25440. let offset = 0
  25441. while (offset !== n) {
  25442. const next = this.#buffers[0]
  25443. const { length } = next
  25444. if (length + offset === n) {
  25445. buffer.set(this.#buffers.shift(), offset)
  25446. break
  25447. } else if (length + offset > n) {
  25448. buffer.set(next.subarray(0, n - offset), offset)
  25449. this.#buffers[0] = next.subarray(n - offset)
  25450. break
  25451. } else {
  25452. buffer.set(this.#buffers.shift(), offset)
  25453. offset += next.length
  25454. }
  25455. }
  25456. this.#byteOffset -= n
  25457. return buffer
  25458. }
  25459. writeFragments (fragment) {
  25460. if (
  25461. this.#maxFragments > 0 &&
  25462. this.#fragments.length === this.#maxFragments
  25463. ) {
  25464. failWebsocketConnectionWithCode(this.ws, 1008, 'Too many message fragments')
  25465. return false
  25466. }
  25467. this.#fragmentsBytes += fragment.length
  25468. this.#fragments.push(fragment)
  25469. return true
  25470. }
  25471. consumeFragments () {
  25472. const fragments = this.#fragments
  25473. if (fragments.length === 1) {
  25474. this.#fragmentsBytes = 0
  25475. return fragments.shift()
  25476. }
  25477. const output = Buffer.concat(fragments, this.#fragmentsBytes)
  25478. this.#fragments = []
  25479. this.#fragmentsBytes = 0
  25480. return output
  25481. }
  25482. parseCloseBody (data) {
  25483. assert(data.length !== 1)
  25484. // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5
  25485. /** @type {number|undefined} */
  25486. let code
  25487. if (data.length >= 2) {
  25488. // _The WebSocket Connection Close Code_ is
  25489. // defined as the status code (Section 7.4) contained in the first Close
  25490. // control frame received by the application
  25491. code = data.readUInt16BE(0)
  25492. }
  25493. if (code !== undefined && !isValidStatusCode(code)) {
  25494. return { code: 1002, reason: 'Invalid status code', error: true }
  25495. }
  25496. // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6
  25497. /** @type {Buffer} */
  25498. let reason = data.subarray(2)
  25499. // Remove BOM
  25500. if (reason[0] === 0xEF && reason[1] === 0xBB && reason[2] === 0xBF) {
  25501. reason = reason.subarray(3)
  25502. }
  25503. try {
  25504. reason = utf8Decode(reason)
  25505. } catch {
  25506. return { code: 1007, reason: 'Invalid UTF-8', error: true }
  25507. }
  25508. return { code, reason, error: false }
  25509. }
  25510. /**
  25511. * Parses control frames.
  25512. * @param {Buffer} body
  25513. */
  25514. parseControlFrame (body) {
  25515. const { opcode, payloadLength } = this.#info
  25516. if (opcode === opcodes.CLOSE) {
  25517. if (payloadLength === 1) {
  25518. failWebsocketConnection(this.ws, 'Received close frame with a 1-byte body.')
  25519. return false
  25520. }
  25521. this.#info.closeInfo = this.parseCloseBody(body)
  25522. if (this.#info.closeInfo.error) {
  25523. const { code, reason } = this.#info.closeInfo
  25524. closeWebSocketConnection(this.ws, code, reason, reason.length)
  25525. failWebsocketConnection(this.ws, reason)
  25526. return false
  25527. }
  25528. if (this.ws[kSentClose] !== sentCloseFrameState.SENT) {
  25529. // If an endpoint receives a Close frame and did not previously send a
  25530. // Close frame, the endpoint MUST send a Close frame in response. (When
  25531. // sending a Close frame in response, the endpoint typically echos the
  25532. // status code it received.)
  25533. let body = emptyBuffer
  25534. if (this.#info.closeInfo.code) {
  25535. body = Buffer.allocUnsafe(2)
  25536. body.writeUInt16BE(this.#info.closeInfo.code, 0)
  25537. }
  25538. const closeFrame = new WebsocketFrameSend(body)
  25539. this.ws[kResponse].socket.write(
  25540. closeFrame.createFrame(opcodes.CLOSE),
  25541. (err) => {
  25542. if (!err) {
  25543. this.ws[kSentClose] = sentCloseFrameState.SENT
  25544. }
  25545. }
  25546. )
  25547. }
  25548. // Upon either sending or receiving a Close control frame, it is said
  25549. // that _The WebSocket Closing Handshake is Started_ and that the
  25550. // WebSocket connection is in the CLOSING state.
  25551. this.ws[kReadyState] = states.CLOSING
  25552. this.ws[kReceivedClose] = true
  25553. return false
  25554. } else if (opcode === opcodes.PING) {
  25555. // Upon receipt of a Ping frame, an endpoint MUST send a Pong frame in
  25556. // response, unless it already received a Close frame.
  25557. // A Pong frame sent in response to a Ping frame must have identical
  25558. // "Application data"
  25559. if (!this.ws[kReceivedClose]) {
  25560. const frame = new WebsocketFrameSend(body)
  25561. this.ws[kResponse].socket.write(frame.createFrame(opcodes.PONG))
  25562. if (channels.ping.hasSubscribers) {
  25563. channels.ping.publish({
  25564. payload: body
  25565. })
  25566. }
  25567. }
  25568. } else if (opcode === opcodes.PONG) {
  25569. // A Pong frame MAY be sent unsolicited. This serves as a
  25570. // unidirectional heartbeat. A response to an unsolicited Pong frame is
  25571. // not expected.
  25572. if (channels.pong.hasSubscribers) {
  25573. channels.pong.publish({
  25574. payload: body
  25575. })
  25576. }
  25577. }
  25578. return true
  25579. }
  25580. get closingInfo () {
  25581. return this.#info.closeInfo
  25582. }
  25583. }
  25584. module.exports = {
  25585. ByteParser
  25586. }
  25587. /***/ }),
  25588. /***/ 3900:
  25589. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25590. const { WebsocketFrameSend } = __nccwpck_require__(3264)
  25591. const { opcodes, sendHints } = __nccwpck_require__(736)
  25592. const FixedQueue = __nccwpck_require__(4660)
  25593. /** @type {typeof Uint8Array} */
  25594. const FastBuffer = Buffer[Symbol.species]
  25595. /**
  25596. * @typedef {object} SendQueueNode
  25597. * @property {Promise<void> | null} promise
  25598. * @property {((...args: any[]) => any)} callback
  25599. * @property {Buffer | null} frame
  25600. */
  25601. class SendQueue {
  25602. /**
  25603. * @type {FixedQueue}
  25604. */
  25605. #queue = new FixedQueue()
  25606. /**
  25607. * @type {boolean}
  25608. */
  25609. #running = false
  25610. /** @type {import('node:net').Socket} */
  25611. #socket
  25612. constructor (socket) {
  25613. this.#socket = socket
  25614. }
  25615. add (item, cb, hint) {
  25616. if (hint !== sendHints.blob) {
  25617. const frame = createFrame(item, hint)
  25618. if (!this.#running) {
  25619. // fast-path
  25620. this.#socket.write(frame, cb)
  25621. } else {
  25622. /** @type {SendQueueNode} */
  25623. const node = {
  25624. promise: null,
  25625. callback: cb,
  25626. frame
  25627. }
  25628. this.#queue.push(node)
  25629. }
  25630. return
  25631. }
  25632. /** @type {SendQueueNode} */
  25633. const node = {
  25634. promise: item.arrayBuffer().then((ab) => {
  25635. node.promise = null
  25636. node.frame = createFrame(ab, hint)
  25637. }),
  25638. callback: cb,
  25639. frame: null
  25640. }
  25641. this.#queue.push(node)
  25642. if (!this.#running) {
  25643. this.#run()
  25644. }
  25645. }
  25646. async #run () {
  25647. this.#running = true
  25648. const queue = this.#queue
  25649. while (!queue.isEmpty()) {
  25650. const node = queue.shift()
  25651. // wait pending promise
  25652. if (node.promise !== null) {
  25653. await node.promise
  25654. }
  25655. // write
  25656. this.#socket.write(node.frame, node.callback)
  25657. // cleanup
  25658. node.callback = node.frame = null
  25659. }
  25660. this.#running = false
  25661. }
  25662. }
  25663. function createFrame (data, hint) {
  25664. return new WebsocketFrameSend(toBuffer(data, hint)).createFrame(hint === sendHints.string ? opcodes.TEXT : opcodes.BINARY)
  25665. }
  25666. function toBuffer (data, hint) {
  25667. switch (hint) {
  25668. case sendHints.string:
  25669. return Buffer.from(data)
  25670. case sendHints.arrayBuffer:
  25671. case sendHints.blob:
  25672. return new FastBuffer(data)
  25673. case sendHints.typedArray:
  25674. return new FastBuffer(data.buffer, data.byteOffset, data.byteLength)
  25675. }
  25676. }
  25677. module.exports = { SendQueue }
  25678. /***/ }),
  25679. /***/ 1216:
  25680. /***/ ((module) => {
  25681. module.exports = {
  25682. kWebSocketURL: Symbol('url'),
  25683. kReadyState: Symbol('ready state'),
  25684. kController: Symbol('controller'),
  25685. kResponse: Symbol('response'),
  25686. kBinaryType: Symbol('binary type'),
  25687. kSentClose: Symbol('sent close'),
  25688. kReceivedClose: Symbol('received close'),
  25689. kByteParser: Symbol('byte parser')
  25690. }
  25691. /***/ }),
  25692. /***/ 8625:
  25693. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25694. const { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = __nccwpck_require__(1216)
  25695. const { states, opcodes } = __nccwpck_require__(736)
  25696. const { ErrorEvent, createFastMessageEvent } = __nccwpck_require__(5188)
  25697. const { isUtf8 } = __nccwpck_require__(4573)
  25698. const { collectASequenceOfCodePointsFast, removeHTTPWhitespace } = __nccwpck_require__(1900)
  25699. /* globals Blob */
  25700. /**
  25701. * @param {import('./websocket').WebSocket} ws
  25702. * @returns {boolean}
  25703. */
  25704. function isConnecting (ws) {
  25705. // If the WebSocket connection is not yet established, and the connection
  25706. // is not yet closed, then the WebSocket connection is in the CONNECTING state.
  25707. return ws[kReadyState] === states.CONNECTING
  25708. }
  25709. /**
  25710. * @param {import('./websocket').WebSocket} ws
  25711. * @returns {boolean}
  25712. */
  25713. function isEstablished (ws) {
  25714. // If the server's response is validated as provided for above, it is
  25715. // said that _The WebSocket Connection is Established_ and that the
  25716. // WebSocket Connection is in the OPEN state.
  25717. return ws[kReadyState] === states.OPEN
  25718. }
  25719. /**
  25720. * @param {import('./websocket').WebSocket} ws
  25721. * @returns {boolean}
  25722. */
  25723. function isClosing (ws) {
  25724. // Upon either sending or receiving a Close control frame, it is said
  25725. // that _The WebSocket Closing Handshake is Started_ and that the
  25726. // WebSocket connection is in the CLOSING state.
  25727. return ws[kReadyState] === states.CLOSING
  25728. }
  25729. /**
  25730. * @param {import('./websocket').WebSocket} ws
  25731. * @returns {boolean}
  25732. */
  25733. function isClosed (ws) {
  25734. return ws[kReadyState] === states.CLOSED
  25735. }
  25736. /**
  25737. * @see https://dom.spec.whatwg.org/#concept-event-fire
  25738. * @param {string} e
  25739. * @param {EventTarget} target
  25740. * @param {(...args: ConstructorParameters<typeof Event>) => Event} eventFactory
  25741. * @param {EventInit | undefined} eventInitDict
  25742. */
  25743. function fireEvent (e, target, eventFactory = (type, init) => new Event(type, init), eventInitDict = {}) {
  25744. // 1. If eventConstructor is not given, then let eventConstructor be Event.
  25745. // 2. Let event be the result of creating an event given eventConstructor,
  25746. // in the relevant realm of target.
  25747. // 3. Initialize event’s type attribute to e.
  25748. const event = eventFactory(e, eventInitDict)
  25749. // 4. Initialize any other IDL attributes of event as described in the
  25750. // invocation of this algorithm.
  25751. // 5. Return the result of dispatching event at target, with legacy target
  25752. // override flag set if set.
  25753. target.dispatchEvent(event)
  25754. }
  25755. /**
  25756. * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol
  25757. * @param {import('./websocket').WebSocket} ws
  25758. * @param {number} type Opcode
  25759. * @param {Buffer} data application data
  25760. */
  25761. function websocketMessageReceived (ws, type, data) {
  25762. // 1. If ready state is not OPEN (1), then return.
  25763. if (ws[kReadyState] !== states.OPEN) {
  25764. return
  25765. }
  25766. // 2. Let dataForEvent be determined by switching on type and binary type:
  25767. let dataForEvent
  25768. if (type === opcodes.TEXT) {
  25769. // -> type indicates that the data is Text
  25770. // a new DOMString containing data
  25771. try {
  25772. dataForEvent = utf8Decode(data)
  25773. } catch {
  25774. failWebsocketConnection(ws, 'Received invalid UTF-8 in text frame.')
  25775. return
  25776. }
  25777. } else if (type === opcodes.BINARY) {
  25778. if (ws[kBinaryType] === 'blob') {
  25779. // -> type indicates that the data is Binary and binary type is "blob"
  25780. // a new Blob object, created in the relevant Realm of the WebSocket
  25781. // object, that represents data as its raw data
  25782. dataForEvent = new Blob([data])
  25783. } else {
  25784. // -> type indicates that the data is Binary and binary type is "arraybuffer"
  25785. // a new ArrayBuffer object, created in the relevant Realm of the
  25786. // WebSocket object, whose contents are data
  25787. dataForEvent = toArrayBuffer(data)
  25788. }
  25789. }
  25790. // 3. Fire an event named message at the WebSocket object, using MessageEvent,
  25791. // with the origin attribute initialized to the serialization of the WebSocket
  25792. // object’s url's origin, and the data attribute initialized to dataForEvent.
  25793. fireEvent('message', ws, createFastMessageEvent, {
  25794. origin: ws[kWebSocketURL].origin,
  25795. data: dataForEvent
  25796. })
  25797. }
  25798. function toArrayBuffer (buffer) {
  25799. if (buffer.byteLength === buffer.buffer.byteLength) {
  25800. return buffer.buffer
  25801. }
  25802. return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)
  25803. }
  25804. /**
  25805. * @see https://datatracker.ietf.org/doc/html/rfc6455
  25806. * @see https://datatracker.ietf.org/doc/html/rfc2616
  25807. * @see https://bugs.chromium.org/p/chromium/issues/detail?id=398407
  25808. * @param {string} protocol
  25809. */
  25810. function isValidSubprotocol (protocol) {
  25811. // If present, this value indicates one
  25812. // or more comma-separated subprotocol the client wishes to speak,
  25813. // ordered by preference. The elements that comprise this value
  25814. // MUST be non-empty strings with characters in the range U+0021 to
  25815. // U+007E not including separator characters as defined in
  25816. // [RFC2616] and MUST all be unique strings.
  25817. if (protocol.length === 0) {
  25818. return false
  25819. }
  25820. for (let i = 0; i < protocol.length; ++i) {
  25821. const code = protocol.charCodeAt(i)
  25822. if (
  25823. code < 0x21 || // CTL, contains SP (0x20) and HT (0x09)
  25824. code > 0x7E ||
  25825. code === 0x22 || // "
  25826. code === 0x28 || // (
  25827. code === 0x29 || // )
  25828. code === 0x2C || // ,
  25829. code === 0x2F || // /
  25830. code === 0x3A || // :
  25831. code === 0x3B || // ;
  25832. code === 0x3C || // <
  25833. code === 0x3D || // =
  25834. code === 0x3E || // >
  25835. code === 0x3F || // ?
  25836. code === 0x40 || // @
  25837. code === 0x5B || // [
  25838. code === 0x5C || // \
  25839. code === 0x5D || // ]
  25840. code === 0x7B || // {
  25841. code === 0x7D // }
  25842. ) {
  25843. return false
  25844. }
  25845. }
  25846. return true
  25847. }
  25848. /**
  25849. * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7-4
  25850. * @param {number} code
  25851. */
  25852. function isValidStatusCode (code) {
  25853. if (code >= 1000 && code < 1015) {
  25854. return (
  25855. code !== 1004 && // reserved
  25856. code !== 1005 && // "MUST NOT be set as a status code"
  25857. code !== 1006 // "MUST NOT be set as a status code"
  25858. )
  25859. }
  25860. return code >= 3000 && code <= 4999
  25861. }
  25862. /**
  25863. * @param {import('./websocket').WebSocket} ws
  25864. * @param {string|undefined} reason
  25865. */
  25866. function failWebsocketConnection (ws, reason) {
  25867. const { [kController]: controller, [kResponse]: response } = ws
  25868. controller.abort()
  25869. if (response?.socket && !response.socket.destroyed) {
  25870. response.socket.destroy()
  25871. }
  25872. if (reason) {
  25873. // TODO: process.nextTick
  25874. fireEvent('error', ws, (type, init) => new ErrorEvent(type, init), {
  25875. error: new Error(reason),
  25876. message: reason
  25877. })
  25878. }
  25879. }
  25880. /**
  25881. * @see https://datatracker.ietf.org/doc/html/rfc6455#section-5.5
  25882. * @param {number} opcode
  25883. */
  25884. function isControlFrame (opcode) {
  25885. return (
  25886. opcode === opcodes.CLOSE ||
  25887. opcode === opcodes.PING ||
  25888. opcode === opcodes.PONG
  25889. )
  25890. }
  25891. function isContinuationFrame (opcode) {
  25892. return opcode === opcodes.CONTINUATION
  25893. }
  25894. function isTextBinaryFrame (opcode) {
  25895. return opcode === opcodes.TEXT || opcode === opcodes.BINARY
  25896. }
  25897. function isValidOpcode (opcode) {
  25898. return isTextBinaryFrame(opcode) || isContinuationFrame(opcode) || isControlFrame(opcode)
  25899. }
  25900. /**
  25901. * Parses a Sec-WebSocket-Extensions header value.
  25902. * @param {string} extensions
  25903. * @returns {Map<string, string>}
  25904. */
  25905. // TODO(@Uzlopak, @KhafraDev): make compliant https://datatracker.ietf.org/doc/html/rfc6455#section-9.1
  25906. function parseExtensions (extensions) {
  25907. const position = { position: 0 }
  25908. const extensionList = new Map()
  25909. while (position.position < extensions.length) {
  25910. const pair = collectASequenceOfCodePointsFast(';', extensions, position)
  25911. const [name, value = ''] = pair.split('=')
  25912. extensionList.set(
  25913. removeHTTPWhitespace(name, true, false),
  25914. removeHTTPWhitespace(value, false, true)
  25915. )
  25916. position.position++
  25917. }
  25918. return extensionList
  25919. }
  25920. /**
  25921. * @see https://www.rfc-editor.org/rfc/rfc7692#section-7.1.2.2
  25922. * @description "client-max-window-bits = 1*DIGIT"
  25923. * @param {string} value
  25924. */
  25925. function isValidClientWindowBits (value) {
  25926. // Must have at least one character
  25927. if (value.length === 0) {
  25928. return false
  25929. }
  25930. // Check all characters are ASCII digits
  25931. for (let i = 0; i < value.length; i++) {
  25932. const byte = value.charCodeAt(i)
  25933. if (byte < 0x30 || byte > 0x39) {
  25934. return false
  25935. }
  25936. }
  25937. // Check numeric range: zlib requires windowBits in range 8-15
  25938. const num = Number.parseInt(value, 10)
  25939. return num >= 8 && num <= 15
  25940. }
  25941. // https://nodejs.org/api/intl.html#detecting-internationalization-support
  25942. const hasIntl = typeof process.versions.icu === 'string'
  25943. const fatalDecoder = hasIntl ? new TextDecoder('utf-8', { fatal: true }) : undefined
  25944. /**
  25945. * Converts a Buffer to utf-8, even on platforms without icu.
  25946. * @param {Buffer} buffer
  25947. */
  25948. const utf8Decode = hasIntl
  25949. ? fatalDecoder.decode.bind(fatalDecoder)
  25950. : function (buffer) {
  25951. if (isUtf8(buffer)) {
  25952. return buffer.toString('utf-8')
  25953. }
  25954. throw new TypeError('Invalid utf-8 received.')
  25955. }
  25956. module.exports = {
  25957. isConnecting,
  25958. isEstablished,
  25959. isClosing,
  25960. isClosed,
  25961. fireEvent,
  25962. isValidSubprotocol,
  25963. isValidStatusCode,
  25964. failWebsocketConnection,
  25965. websocketMessageReceived,
  25966. utf8Decode,
  25967. isControlFrame,
  25968. isContinuationFrame,
  25969. isTextBinaryFrame,
  25970. isValidOpcode,
  25971. parseExtensions,
  25972. isValidClientWindowBits
  25973. }
  25974. /***/ }),
  25975. /***/ 3726:
  25976. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25977. const { webidl } = __nccwpck_require__(5893)
  25978. const { URLSerializer } = __nccwpck_require__(1900)
  25979. const { environmentSettingsObject } = __nccwpck_require__(3168)
  25980. const { staticPropertyDescriptors, states, sentCloseFrameState, sendHints } = __nccwpck_require__(736)
  25981. const {
  25982. kWebSocketURL,
  25983. kReadyState,
  25984. kController,
  25985. kBinaryType,
  25986. kResponse,
  25987. kSentClose,
  25988. kByteParser
  25989. } = __nccwpck_require__(1216)
  25990. const {
  25991. isConnecting,
  25992. isEstablished,
  25993. isClosing,
  25994. isValidSubprotocol,
  25995. fireEvent
  25996. } = __nccwpck_require__(8625)
  25997. const { establishWebSocketConnection, closeWebSocketConnection } = __nccwpck_require__(6897)
  25998. const { ByteParser } = __nccwpck_require__(1652)
  25999. const { kEnumerableProperty, isBlobLike } = __nccwpck_require__(3440)
  26000. const { getGlobalDispatcher } = __nccwpck_require__(2581)
  26001. const { types } = __nccwpck_require__(7975)
  26002. const { ErrorEvent, CloseEvent } = __nccwpck_require__(5188)
  26003. const { SendQueue } = __nccwpck_require__(3900)
  26004. // https://websockets.spec.whatwg.org/#interface-definition
  26005. class WebSocket extends EventTarget {
  26006. #events = {
  26007. open: null,
  26008. error: null,
  26009. close: null,
  26010. message: null
  26011. }
  26012. #bufferedAmount = 0
  26013. #protocol = ''
  26014. #extensions = ''
  26015. /** @type {SendQueue} */
  26016. #sendQueue
  26017. /**
  26018. * @param {string} url
  26019. * @param {string|string[]} protocols
  26020. */
  26021. constructor (url, protocols = []) {
  26022. super()
  26023. webidl.util.markAsUncloneable(this)
  26024. const prefix = 'WebSocket constructor'
  26025. webidl.argumentLengthCheck(arguments, 1, prefix)
  26026. const options = webidl.converters['DOMString or sequence<DOMString> or WebSocketInit'](protocols, prefix, 'options')
  26027. url = webidl.converters.USVString(url, prefix, 'url')
  26028. protocols = options.protocols
  26029. // 1. Let baseURL be this's relevant settings object's API base URL.
  26030. const baseURL = environmentSettingsObject.settingsObject.baseUrl
  26031. // 1. Let urlRecord be the result of applying the URL parser to url with baseURL.
  26032. let urlRecord
  26033. try {
  26034. urlRecord = new URL(url, baseURL)
  26035. } catch (e) {
  26036. // 3. If urlRecord is failure, then throw a "SyntaxError" DOMException.
  26037. throw new DOMException(e, 'SyntaxError')
  26038. }
  26039. // 4. If urlRecord’s scheme is "http", then set urlRecord’s scheme to "ws".
  26040. if (urlRecord.protocol === 'http:') {
  26041. urlRecord.protocol = 'ws:'
  26042. } else if (urlRecord.protocol === 'https:') {
  26043. // 5. Otherwise, if urlRecord’s scheme is "https", set urlRecord’s scheme to "wss".
  26044. urlRecord.protocol = 'wss:'
  26045. }
  26046. // 6. If urlRecord’s scheme is not "ws" or "wss", then throw a "SyntaxError" DOMException.
  26047. if (urlRecord.protocol !== 'ws:' && urlRecord.protocol !== 'wss:') {
  26048. throw new DOMException(
  26049. `Expected a ws: or wss: protocol, got ${urlRecord.protocol}`,
  26050. 'SyntaxError'
  26051. )
  26052. }
  26053. // 7. If urlRecord’s fragment is non-null, then throw a "SyntaxError"
  26054. // DOMException.
  26055. if (urlRecord.hash || urlRecord.href.endsWith('#')) {
  26056. throw new DOMException('Got fragment', 'SyntaxError')
  26057. }
  26058. // 8. If protocols is a string, set protocols to a sequence consisting
  26059. // of just that string.
  26060. if (typeof protocols === 'string') {
  26061. protocols = [protocols]
  26062. }
  26063. // 9. If any of the values in protocols occur more than once or otherwise
  26064. // fail to match the requirements for elements that comprise the value
  26065. // of `Sec-WebSocket-Protocol` fields as defined by The WebSocket
  26066. // protocol, then throw a "SyntaxError" DOMException.
  26067. if (protocols.length !== new Set(protocols.map(p => p.toLowerCase())).size) {
  26068. throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError')
  26069. }
  26070. if (protocols.length > 0 && !protocols.every(p => isValidSubprotocol(p))) {
  26071. throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError')
  26072. }
  26073. // 10. Set this's url to urlRecord.
  26074. this[kWebSocketURL] = new URL(urlRecord.href)
  26075. // 11. Let client be this's relevant settings object.
  26076. const client = environmentSettingsObject.settingsObject
  26077. // 12. Run this step in parallel:
  26078. // 1. Establish a WebSocket connection given urlRecord, protocols,
  26079. // and client.
  26080. this[kController] = establishWebSocketConnection(
  26081. urlRecord,
  26082. protocols,
  26083. client,
  26084. this,
  26085. (response, extensions) => this.#onConnectionEstablished(response, extensions),
  26086. options
  26087. )
  26088. // Each WebSocket object has an associated ready state, which is a
  26089. // number representing the state of the connection. Initially it must
  26090. // be CONNECTING (0).
  26091. this[kReadyState] = WebSocket.CONNECTING
  26092. this[kSentClose] = sentCloseFrameState.NOT_SENT
  26093. // The extensions attribute must initially return the empty string.
  26094. // The protocol attribute must initially return the empty string.
  26095. // Each WebSocket object has an associated binary type, which is a
  26096. // BinaryType. Initially it must be "blob".
  26097. this[kBinaryType] = 'blob'
  26098. }
  26099. /**
  26100. * @see https://websockets.spec.whatwg.org/#dom-websocket-close
  26101. * @param {number|undefined} code
  26102. * @param {string|undefined} reason
  26103. */
  26104. close (code = undefined, reason = undefined) {
  26105. webidl.brandCheck(this, WebSocket)
  26106. const prefix = 'WebSocket.close'
  26107. if (code !== undefined) {
  26108. code = webidl.converters['unsigned short'](code, prefix, 'code', { clamp: true })
  26109. }
  26110. if (reason !== undefined) {
  26111. reason = webidl.converters.USVString(reason, prefix, 'reason')
  26112. }
  26113. // 1. If code is present, but is neither an integer equal to 1000 nor an
  26114. // integer in the range 3000 to 4999, inclusive, throw an
  26115. // "InvalidAccessError" DOMException.
  26116. if (code !== undefined) {
  26117. if (code !== 1000 && (code < 3000 || code > 4999)) {
  26118. throw new DOMException('invalid code', 'InvalidAccessError')
  26119. }
  26120. }
  26121. let reasonByteLength = 0
  26122. // 2. If reason is present, then run these substeps:
  26123. if (reason !== undefined) {
  26124. // 1. Let reasonBytes be the result of encoding reason.
  26125. // 2. If reasonBytes is longer than 123 bytes, then throw a
  26126. // "SyntaxError" DOMException.
  26127. reasonByteLength = Buffer.byteLength(reason)
  26128. if (reasonByteLength > 123) {
  26129. throw new DOMException(
  26130. `Reason must be less than 123 bytes; received ${reasonByteLength}`,
  26131. 'SyntaxError'
  26132. )
  26133. }
  26134. }
  26135. // 3. Run the first matching steps from the following list:
  26136. closeWebSocketConnection(this, code, reason, reasonByteLength)
  26137. }
  26138. /**
  26139. * @see https://websockets.spec.whatwg.org/#dom-websocket-send
  26140. * @param {NodeJS.TypedArray|ArrayBuffer|Blob|string} data
  26141. */
  26142. send (data) {
  26143. webidl.brandCheck(this, WebSocket)
  26144. const prefix = 'WebSocket.send'
  26145. webidl.argumentLengthCheck(arguments, 1, prefix)
  26146. data = webidl.converters.WebSocketSendData(data, prefix, 'data')
  26147. // 1. If this's ready state is CONNECTING, then throw an
  26148. // "InvalidStateError" DOMException.
  26149. if (isConnecting(this)) {
  26150. throw new DOMException('Sent before connected.', 'InvalidStateError')
  26151. }
  26152. // 2. Run the appropriate set of steps from the following list:
  26153. // https://datatracker.ietf.org/doc/html/rfc6455#section-6.1
  26154. // https://datatracker.ietf.org/doc/html/rfc6455#section-5.2
  26155. if (!isEstablished(this) || isClosing(this)) {
  26156. return
  26157. }
  26158. // If data is a string
  26159. if (typeof data === 'string') {
  26160. // If the WebSocket connection is established and the WebSocket
  26161. // closing handshake has not yet started, then the user agent
  26162. // must send a WebSocket Message comprised of the data argument
  26163. // using a text frame opcode; if the data cannot be sent, e.g.
  26164. // because it would need to be buffered but the buffer is full,
  26165. // the user agent must flag the WebSocket as full and then close
  26166. // the WebSocket connection. Any invocation of this method with a
  26167. // string argument that does not throw an exception must increase
  26168. // the bufferedAmount attribute by the number of bytes needed to
  26169. // express the argument as UTF-8.
  26170. const length = Buffer.byteLength(data)
  26171. this.#bufferedAmount += length
  26172. this.#sendQueue.add(data, () => {
  26173. this.#bufferedAmount -= length
  26174. }, sendHints.string)
  26175. } else if (types.isArrayBuffer(data)) {
  26176. // If the WebSocket connection is established, and the WebSocket
  26177. // closing handshake has not yet started, then the user agent must
  26178. // send a WebSocket Message comprised of data using a binary frame
  26179. // opcode; if the data cannot be sent, e.g. because it would need
  26180. // to be buffered but the buffer is full, the user agent must flag
  26181. // the WebSocket as full and then close the WebSocket connection.
  26182. // The data to be sent is the data stored in the buffer described
  26183. // by the ArrayBuffer object. Any invocation of this method with an
  26184. // ArrayBuffer argument that does not throw an exception must
  26185. // increase the bufferedAmount attribute by the length of the
  26186. // ArrayBuffer in bytes.
  26187. this.#bufferedAmount += data.byteLength
  26188. this.#sendQueue.add(data, () => {
  26189. this.#bufferedAmount -= data.byteLength
  26190. }, sendHints.arrayBuffer)
  26191. } else if (ArrayBuffer.isView(data)) {
  26192. // If the WebSocket connection is established, and the WebSocket
  26193. // closing handshake has not yet started, then the user agent must
  26194. // send a WebSocket Message comprised of data using a binary frame
  26195. // opcode; if the data cannot be sent, e.g. because it would need to
  26196. // be buffered but the buffer is full, the user agent must flag the
  26197. // WebSocket as full and then close the WebSocket connection. The
  26198. // data to be sent is the data stored in the section of the buffer
  26199. // described by the ArrayBuffer object that data references. Any
  26200. // invocation of this method with this kind of argument that does
  26201. // not throw an exception must increase the bufferedAmount attribute
  26202. // by the length of data’s buffer in bytes.
  26203. this.#bufferedAmount += data.byteLength
  26204. this.#sendQueue.add(data, () => {
  26205. this.#bufferedAmount -= data.byteLength
  26206. }, sendHints.typedArray)
  26207. } else if (isBlobLike(data)) {
  26208. // If the WebSocket connection is established, and the WebSocket
  26209. // closing handshake has not yet started, then the user agent must
  26210. // send a WebSocket Message comprised of data using a binary frame
  26211. // opcode; if the data cannot be sent, e.g. because it would need to
  26212. // be buffered but the buffer is full, the user agent must flag the
  26213. // WebSocket as full and then close the WebSocket connection. The data
  26214. // to be sent is the raw data represented by the Blob object. Any
  26215. // invocation of this method with a Blob argument that does not throw
  26216. // an exception must increase the bufferedAmount attribute by the size
  26217. // of the Blob object’s raw data, in bytes.
  26218. this.#bufferedAmount += data.size
  26219. this.#sendQueue.add(data, () => {
  26220. this.#bufferedAmount -= data.size
  26221. }, sendHints.blob)
  26222. }
  26223. }
  26224. get readyState () {
  26225. webidl.brandCheck(this, WebSocket)
  26226. // The readyState getter steps are to return this's ready state.
  26227. return this[kReadyState]
  26228. }
  26229. get bufferedAmount () {
  26230. webidl.brandCheck(this, WebSocket)
  26231. return this.#bufferedAmount
  26232. }
  26233. get url () {
  26234. webidl.brandCheck(this, WebSocket)
  26235. // The url getter steps are to return this's url, serialized.
  26236. return URLSerializer(this[kWebSocketURL])
  26237. }
  26238. get extensions () {
  26239. webidl.brandCheck(this, WebSocket)
  26240. return this.#extensions
  26241. }
  26242. get protocol () {
  26243. webidl.brandCheck(this, WebSocket)
  26244. return this.#protocol
  26245. }
  26246. get onopen () {
  26247. webidl.brandCheck(this, WebSocket)
  26248. return this.#events.open
  26249. }
  26250. set onopen (fn) {
  26251. webidl.brandCheck(this, WebSocket)
  26252. if (this.#events.open) {
  26253. this.removeEventListener('open', this.#events.open)
  26254. }
  26255. if (typeof fn === 'function') {
  26256. this.#events.open = fn
  26257. this.addEventListener('open', fn)
  26258. } else {
  26259. this.#events.open = null
  26260. }
  26261. }
  26262. get onerror () {
  26263. webidl.brandCheck(this, WebSocket)
  26264. return this.#events.error
  26265. }
  26266. set onerror (fn) {
  26267. webidl.brandCheck(this, WebSocket)
  26268. if (this.#events.error) {
  26269. this.removeEventListener('error', this.#events.error)
  26270. }
  26271. if (typeof fn === 'function') {
  26272. this.#events.error = fn
  26273. this.addEventListener('error', fn)
  26274. } else {
  26275. this.#events.error = null
  26276. }
  26277. }
  26278. get onclose () {
  26279. webidl.brandCheck(this, WebSocket)
  26280. return this.#events.close
  26281. }
  26282. set onclose (fn) {
  26283. webidl.brandCheck(this, WebSocket)
  26284. if (this.#events.close) {
  26285. this.removeEventListener('close', this.#events.close)
  26286. }
  26287. if (typeof fn === 'function') {
  26288. this.#events.close = fn
  26289. this.addEventListener('close', fn)
  26290. } else {
  26291. this.#events.close = null
  26292. }
  26293. }
  26294. get onmessage () {
  26295. webidl.brandCheck(this, WebSocket)
  26296. return this.#events.message
  26297. }
  26298. set onmessage (fn) {
  26299. webidl.brandCheck(this, WebSocket)
  26300. if (this.#events.message) {
  26301. this.removeEventListener('message', this.#events.message)
  26302. }
  26303. if (typeof fn === 'function') {
  26304. this.#events.message = fn
  26305. this.addEventListener('message', fn)
  26306. } else {
  26307. this.#events.message = null
  26308. }
  26309. }
  26310. get binaryType () {
  26311. webidl.brandCheck(this, WebSocket)
  26312. return this[kBinaryType]
  26313. }
  26314. set binaryType (type) {
  26315. webidl.brandCheck(this, WebSocket)
  26316. if (type !== 'blob' && type !== 'arraybuffer') {
  26317. this[kBinaryType] = 'blob'
  26318. } else {
  26319. this[kBinaryType] = type
  26320. }
  26321. }
  26322. /**
  26323. * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol
  26324. */
  26325. #onConnectionEstablished (response, parsedExtensions) {
  26326. // processResponse is called when the "response's header list has been received and initialized."
  26327. // once this happens, the connection is open
  26328. this[kResponse] = response
  26329. const webSocketOptions = this[kController]?.dispatcher?.webSocketOptions
  26330. const maxFragments = webSocketOptions?.maxFragments
  26331. const maxPayloadSize = webSocketOptions?.maxPayloadSize
  26332. const parser = new ByteParser(this, parsedExtensions, {
  26333. maxFragments,
  26334. maxPayloadSize
  26335. })
  26336. parser.on('drain', onParserDrain)
  26337. parser.on('error', onParserError.bind(this))
  26338. response.socket.ws = this
  26339. this[kByteParser] = parser
  26340. this.#sendQueue = new SendQueue(response.socket)
  26341. // 1. Change the ready state to OPEN (1).
  26342. this[kReadyState] = states.OPEN
  26343. // 2. Change the extensions attribute’s value to the extensions in use, if
  26344. // it is not the null value.
  26345. // https://datatracker.ietf.org/doc/html/rfc6455#section-9.1
  26346. const extensions = response.headersList.get('sec-websocket-extensions')
  26347. if (extensions !== null) {
  26348. this.#extensions = extensions
  26349. }
  26350. // 3. Change the protocol attribute’s value to the subprotocol in use, if
  26351. // it is not the null value.
  26352. // https://datatracker.ietf.org/doc/html/rfc6455#section-1.9
  26353. const protocol = response.headersList.get('sec-websocket-protocol')
  26354. if (protocol !== null) {
  26355. this.#protocol = protocol
  26356. }
  26357. // 4. Fire an event named open at the WebSocket object.
  26358. fireEvent('open', this)
  26359. }
  26360. }
  26361. // https://websockets.spec.whatwg.org/#dom-websocket-connecting
  26362. WebSocket.CONNECTING = WebSocket.prototype.CONNECTING = states.CONNECTING
  26363. // https://websockets.spec.whatwg.org/#dom-websocket-open
  26364. WebSocket.OPEN = WebSocket.prototype.OPEN = states.OPEN
  26365. // https://websockets.spec.whatwg.org/#dom-websocket-closing
  26366. WebSocket.CLOSING = WebSocket.prototype.CLOSING = states.CLOSING
  26367. // https://websockets.spec.whatwg.org/#dom-websocket-closed
  26368. WebSocket.CLOSED = WebSocket.prototype.CLOSED = states.CLOSED
  26369. Object.defineProperties(WebSocket.prototype, {
  26370. CONNECTING: staticPropertyDescriptors,
  26371. OPEN: staticPropertyDescriptors,
  26372. CLOSING: staticPropertyDescriptors,
  26373. CLOSED: staticPropertyDescriptors,
  26374. url: kEnumerableProperty,
  26375. readyState: kEnumerableProperty,
  26376. bufferedAmount: kEnumerableProperty,
  26377. onopen: kEnumerableProperty,
  26378. onerror: kEnumerableProperty,
  26379. onclose: kEnumerableProperty,
  26380. close: kEnumerableProperty,
  26381. onmessage: kEnumerableProperty,
  26382. binaryType: kEnumerableProperty,
  26383. send: kEnumerableProperty,
  26384. extensions: kEnumerableProperty,
  26385. protocol: kEnumerableProperty,
  26386. [Symbol.toStringTag]: {
  26387. value: 'WebSocket',
  26388. writable: false,
  26389. enumerable: false,
  26390. configurable: true
  26391. }
  26392. })
  26393. Object.defineProperties(WebSocket, {
  26394. CONNECTING: staticPropertyDescriptors,
  26395. OPEN: staticPropertyDescriptors,
  26396. CLOSING: staticPropertyDescriptors,
  26397. CLOSED: staticPropertyDescriptors
  26398. })
  26399. webidl.converters['sequence<DOMString>'] = webidl.sequenceConverter(
  26400. webidl.converters.DOMString
  26401. )
  26402. webidl.converters['DOMString or sequence<DOMString>'] = function (V, prefix, argument) {
  26403. if (webidl.util.Type(V) === 'Object' && Symbol.iterator in V) {
  26404. return webidl.converters['sequence<DOMString>'](V)
  26405. }
  26406. return webidl.converters.DOMString(V, prefix, argument)
  26407. }
  26408. // This implements the proposal made in https://github.com/whatwg/websockets/issues/42
  26409. webidl.converters.WebSocketInit = webidl.dictionaryConverter([
  26410. {
  26411. key: 'protocols',
  26412. converter: webidl.converters['DOMString or sequence<DOMString>'],
  26413. defaultValue: () => new Array(0)
  26414. },
  26415. {
  26416. key: 'dispatcher',
  26417. converter: webidl.converters.any,
  26418. defaultValue: () => getGlobalDispatcher()
  26419. },
  26420. {
  26421. key: 'headers',
  26422. converter: webidl.nullableConverter(webidl.converters.HeadersInit)
  26423. }
  26424. ])
  26425. webidl.converters['DOMString or sequence<DOMString> or WebSocketInit'] = function (V) {
  26426. if (webidl.util.Type(V) === 'Object' && !(Symbol.iterator in V)) {
  26427. return webidl.converters.WebSocketInit(V)
  26428. }
  26429. return { protocols: webidl.converters['DOMString or sequence<DOMString>'](V) }
  26430. }
  26431. webidl.converters.WebSocketSendData = function (V) {
  26432. if (webidl.util.Type(V) === 'Object') {
  26433. if (isBlobLike(V)) {
  26434. return webidl.converters.Blob(V, { strict: false })
  26435. }
  26436. if (ArrayBuffer.isView(V) || types.isArrayBuffer(V)) {
  26437. return webidl.converters.BufferSource(V)
  26438. }
  26439. }
  26440. return webidl.converters.USVString(V)
  26441. }
  26442. function onParserDrain () {
  26443. this.ws[kResponse].socket.resume()
  26444. }
  26445. function onParserError (err) {
  26446. let message
  26447. let code
  26448. if (err instanceof CloseEvent) {
  26449. message = err.reason
  26450. code = err.code
  26451. } else {
  26452. message = err.message
  26453. }
  26454. fireEvent('error', this, () => new ErrorEvent('error', { error: err, message }))
  26455. closeWebSocketConnection(this, code)
  26456. }
  26457. module.exports = {
  26458. WebSocket
  26459. }
  26460. /***/ }),
  26461. /***/ 2613:
  26462. /***/ ((module) => {
  26463. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("assert");
  26464. /***/ }),
  26465. /***/ 4434:
  26466. /***/ ((module) => {
  26467. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("events");
  26468. /***/ }),
  26469. /***/ 8611:
  26470. /***/ ((module) => {
  26471. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("http");
  26472. /***/ }),
  26473. /***/ 5692:
  26474. /***/ ((module) => {
  26475. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("https");
  26476. /***/ }),
  26477. /***/ 9278:
  26478. /***/ ((module) => {
  26479. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("net");
  26480. /***/ }),
  26481. /***/ 4589:
  26482. /***/ ((module) => {
  26483. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:assert");
  26484. /***/ }),
  26485. /***/ 6698:
  26486. /***/ ((module) => {
  26487. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:async_hooks");
  26488. /***/ }),
  26489. /***/ 4573:
  26490. /***/ ((module) => {
  26491. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:buffer");
  26492. /***/ }),
  26493. /***/ 7540:
  26494. /***/ ((module) => {
  26495. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:console");
  26496. /***/ }),
  26497. /***/ 7598:
  26498. /***/ ((module) => {
  26499. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:crypto");
  26500. /***/ }),
  26501. /***/ 3053:
  26502. /***/ ((module) => {
  26503. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:diagnostics_channel");
  26504. /***/ }),
  26505. /***/ 610:
  26506. /***/ ((module) => {
  26507. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:dns");
  26508. /***/ }),
  26509. /***/ 8474:
  26510. /***/ ((module) => {
  26511. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:events");
  26512. /***/ }),
  26513. /***/ 7067:
  26514. /***/ ((module) => {
  26515. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http");
  26516. /***/ }),
  26517. /***/ 2467:
  26518. /***/ ((module) => {
  26519. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http2");
  26520. /***/ }),
  26521. /***/ 7030:
  26522. /***/ ((module) => {
  26523. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:net");
  26524. /***/ }),
  26525. /***/ 643:
  26526. /***/ ((module) => {
  26527. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:perf_hooks");
  26528. /***/ }),
  26529. /***/ 1792:
  26530. /***/ ((module) => {
  26531. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:querystring");
  26532. /***/ }),
  26533. /***/ 7075:
  26534. /***/ ((module) => {
  26535. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream");
  26536. /***/ }),
  26537. /***/ 1692:
  26538. /***/ ((module) => {
  26539. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:tls");
  26540. /***/ }),
  26541. /***/ 3136:
  26542. /***/ ((module) => {
  26543. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:url");
  26544. /***/ }),
  26545. /***/ 7975:
  26546. /***/ ((module) => {
  26547. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:util");
  26548. /***/ }),
  26549. /***/ 3429:
  26550. /***/ ((module) => {
  26551. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:util/types");
  26552. /***/ }),
  26553. /***/ 5919:
  26554. /***/ ((module) => {
  26555. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:worker_threads");
  26556. /***/ }),
  26557. /***/ 8522:
  26558. /***/ ((module) => {
  26559. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:zlib");
  26560. /***/ }),
  26561. /***/ 3193:
  26562. /***/ ((module) => {
  26563. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("string_decoder");
  26564. /***/ }),
  26565. /***/ 4756:
  26566. /***/ ((module) => {
  26567. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("tls");
  26568. /***/ }),
  26569. /***/ 9023:
  26570. /***/ ((module) => {
  26571. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util");
  26572. /***/ }),
  26573. /***/ 4649:
  26574. /***/ ((__unused_webpack_module, exports) => {
  26575. var __webpack_unused_export__;
  26576. /*!
  26577. * content-type
  26578. * Copyright(c) 2015 Douglas Christopher Wilson
  26579. * MIT Licensed
  26580. */
  26581. __webpack_unused_export__ = ({ value: true });
  26582. __webpack_unused_export__ = format;
  26583. exports.qg = parse;
  26584. const TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
  26585. const TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
  26586. /**
  26587. * RegExp to match chars that must be quoted-pair in RFC 9110 sec 5.6.4
  26588. */
  26589. const QUOTE_REGEXP = /[\\"]/g;
  26590. /**
  26591. * RegExp to match type in RFC 9110 sec 8.3.1
  26592. *
  26593. * media-type = type "/" subtype
  26594. * type = token
  26595. * subtype = token
  26596. */
  26597. const TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
  26598. /**
  26599. * Null object perf optimization. Faster than `Object.create(null)` and `{ __proto__: null }`.
  26600. */
  26601. const NullObject = /* @__PURE__ */ (() => {
  26602. const C = function () { };
  26603. C.prototype = Object.create(null);
  26604. return C;
  26605. })();
  26606. /**
  26607. * Format an object into a `Content-Type` header.
  26608. */
  26609. function format(obj) {
  26610. const { type, parameters } = obj;
  26611. if (!type || !TYPE_REGEXP.test(type)) {
  26612. throw new TypeError(`Invalid type: ${type}`);
  26613. }
  26614. let result = type;
  26615. if (parameters) {
  26616. for (const param of Object.keys(parameters)) {
  26617. if (!TOKEN_REGEXP.test(param)) {
  26618. throw new TypeError(`Invalid parameter name: ${param}`);
  26619. }
  26620. result += `; ${param}=${qstring(parameters[param])}`;
  26621. }
  26622. }
  26623. return result;
  26624. }
  26625. /**
  26626. * Parse a `Content-Type` header.
  26627. */
  26628. function parse(header, options) {
  26629. const len = header.length;
  26630. let index = skipOWS(header, 0, len);
  26631. const valueStart = index;
  26632. index = skipValue(header, index, len);
  26633. const valueEnd = trailingOWS(header, valueStart, index);
  26634. const type = header.slice(valueStart, valueEnd).toLowerCase();
  26635. const parameters = options?.parameters === false
  26636. ? new NullObject()
  26637. : parseParameters(header, index, len);
  26638. return { type, parameters };
  26639. }
  26640. const SP = 32; // " "
  26641. const HTAB = 9; // "\t"
  26642. const SEMI = 59; // ";"
  26643. const EQ = 61; // "="
  26644. const DQUOTE = 34; // '"'
  26645. const BSLASH = 92; // "\\"
  26646. /**
  26647. * Parses the parameters of a `Content-Type` header starting at the given index.
  26648. */
  26649. function parseParameters(header, index, len) {
  26650. const parameters = new NullObject();
  26651. parameter: while (index < len) {
  26652. index = skipOWS(header, index + 1 /* Skip over ; */, len);
  26653. const keyStart = index;
  26654. while (index < len) {
  26655. const code = header.charCodeAt(index);
  26656. if (code === SEMI)
  26657. continue parameter;
  26658. if (code === EQ) {
  26659. const keyEnd = trailingOWS(header, keyStart, index);
  26660. const key = header.slice(keyStart, keyEnd).toLowerCase();
  26661. index = skipOWS(header, index + 1, len);
  26662. if (index < len && header.charCodeAt(index) === DQUOTE) {
  26663. index++;
  26664. let value = "";
  26665. while (index < len) {
  26666. const code = header.charCodeAt(index++);
  26667. if (code === DQUOTE) {
  26668. index = skipValue(header, index, len);
  26669. if (parameters[key] === undefined)
  26670. parameters[key] = value;
  26671. break;
  26672. }
  26673. if (code === BSLASH && index < len) {
  26674. value += header[index++];
  26675. continue;
  26676. }
  26677. value += String.fromCharCode(code);
  26678. }
  26679. continue parameter;
  26680. }
  26681. const valueStart = index;
  26682. index = skipValue(header, index, len);
  26683. if (parameters[key] === undefined) {
  26684. const valueEnd = trailingOWS(header, valueStart, index);
  26685. parameters[key] = header.slice(valueStart, valueEnd);
  26686. }
  26687. continue parameter;
  26688. }
  26689. index++;
  26690. }
  26691. }
  26692. return parameters;
  26693. }
  26694. /**
  26695. * Skip over characters until a semicolon.
  26696. */
  26697. function skipValue(str, index, len) {
  26698. while (index < len) {
  26699. const char = str.charCodeAt(index);
  26700. if (char === SEMI)
  26701. break;
  26702. index++;
  26703. }
  26704. return index;
  26705. }
  26706. /**
  26707. * Skip optional whitespace (OWS) in an HTTP header value.
  26708. *
  26709. * OWS is defined in RFC 9110 sec 5.6.3 as SP (" ") or HTAB ("\t").
  26710. */
  26711. function skipOWS(header, index, len) {
  26712. while (index < len) {
  26713. const char = header.charCodeAt(index);
  26714. if (char !== SP && char !== HTAB)
  26715. break;
  26716. index++;
  26717. }
  26718. return index;
  26719. }
  26720. /**
  26721. * Trim optional whitespace (OWS) from the end of a substring.
  26722. *
  26723. * OWS is defined in RFC 9110 sec 5.6.3 as SP (" ") or HTAB ("\t").
  26724. */
  26725. function trailingOWS(header, start, end) {
  26726. while (end > start) {
  26727. const char = header.charCodeAt(end - 1);
  26728. if (char !== SP && char !== HTAB)
  26729. break;
  26730. end--;
  26731. }
  26732. return end;
  26733. }
  26734. /**
  26735. * Serialize a parameter value.
  26736. */
  26737. function qstring(str) {
  26738. if (TOKEN_REGEXP.test(str))
  26739. return str;
  26740. if (TEXT_REGEXP.test(str))
  26741. return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
  26742. throw new TypeError(`Invalid parameter value: ${str}`);
  26743. }
  26744. //# sourceMappingURL=index.js.map
  26745. /***/ })
  26746. /******/ });
  26747. /************************************************************************/
  26748. /******/ // The module cache
  26749. /******/ var __webpack_module_cache__ = {};
  26750. /******/
  26751. /******/ // The require function
  26752. /******/ function __nccwpck_require__(moduleId) {
  26753. /******/ // Check if module is in cache
  26754. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  26755. /******/ if (cachedModule !== undefined) {
  26756. /******/ return cachedModule.exports;
  26757. /******/ }
  26758. /******/ // Create a new module (and put it into the cache)
  26759. /******/ var module = __webpack_module_cache__[moduleId] = {
  26760. /******/ // no module.id needed
  26761. /******/ // no module.loaded needed
  26762. /******/ exports: {}
  26763. /******/ };
  26764. /******/
  26765. /******/ // Execute the module function
  26766. /******/ var threw = true;
  26767. /******/ try {
  26768. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
  26769. /******/ threw = false;
  26770. /******/ } finally {
  26771. /******/ if(threw) delete __webpack_module_cache__[moduleId];
  26772. /******/ }
  26773. /******/
  26774. /******/ // Return the exports of the module
  26775. /******/ return module.exports;
  26776. /******/ }
  26777. /******/
  26778. /************************************************************************/
  26779. /******/ /* webpack/runtime/compat */
  26780. /******/
  26781. /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/";
  26782. /******/
  26783. /************************************************************************/
  26784. var __webpack_exports__ = {};
  26785. ;// CONCATENATED MODULE: external "os"
  26786. const external_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("os");
  26787. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/utils.js
  26788. // We use any as a valid input type
  26789. /* eslint-disable @typescript-eslint/no-explicit-any */
  26790. /**
  26791. * Sanitizes an input into a string so it can be passed into issueCommand safely
  26792. * @param input input to sanitize into a string
  26793. */
  26794. function utils_toCommandValue(input) {
  26795. if (input === null || input === undefined) {
  26796. return '';
  26797. }
  26798. else if (typeof input === 'string' || input instanceof String) {
  26799. return input;
  26800. }
  26801. return JSON.stringify(input);
  26802. }
  26803. /**
  26804. *
  26805. * @param annotationProperties
  26806. * @returns The command properties to send with the actual annotation command
  26807. * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
  26808. */
  26809. function utils_toCommandProperties(annotationProperties) {
  26810. if (!Object.keys(annotationProperties).length) {
  26811. return {};
  26812. }
  26813. return {
  26814. title: annotationProperties.title,
  26815. file: annotationProperties.file,
  26816. line: annotationProperties.startLine,
  26817. endLine: annotationProperties.endLine,
  26818. col: annotationProperties.startColumn,
  26819. endColumn: annotationProperties.endColumn
  26820. };
  26821. }
  26822. //# sourceMappingURL=utils.js.map
  26823. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/command.js
  26824. /**
  26825. * Issues a command to the GitHub Actions runner
  26826. *
  26827. * @param command - The command name to issue
  26828. * @param properties - Additional properties for the command (key-value pairs)
  26829. * @param message - The message to include with the command
  26830. * @remarks
  26831. * This function outputs a specially formatted string to stdout that the Actions
  26832. * runner interprets as a command. These commands can control workflow behavior,
  26833. * set outputs, create annotations, mask values, and more.
  26834. *
  26835. * Command Format:
  26836. * ::name key=value,key=value::message
  26837. *
  26838. * @example
  26839. * ```typescript
  26840. * // Issue a warning annotation
  26841. * issueCommand('warning', {}, 'This is a warning message');
  26842. * // Output: ::warning::This is a warning message
  26843. *
  26844. * // Set an environment variable
  26845. * issueCommand('set-env', { name: 'MY_VAR' }, 'some value');
  26846. * // Output: ::set-env name=MY_VAR::some value
  26847. *
  26848. * // Add a secret mask
  26849. * issueCommand('add-mask', {}, 'secretValue123');
  26850. * // Output: ::add-mask::secretValue123
  26851. * ```
  26852. *
  26853. * @internal
  26854. * This is an internal utility function that powers the public API functions
  26855. * such as setSecret, warning, error, and exportVariable.
  26856. */
  26857. function command_issueCommand(command, properties, message) {
  26858. const cmd = new Command(command, properties, message);
  26859. process.stdout.write(cmd.toString() + external_os_namespaceObject.EOL);
  26860. }
  26861. function command_issue(name, message = '') {
  26862. command_issueCommand(name, {}, message);
  26863. }
  26864. const CMD_STRING = '::';
  26865. class Command {
  26866. constructor(command, properties, message) {
  26867. if (!command) {
  26868. command = 'missing.command';
  26869. }
  26870. this.command = command;
  26871. this.properties = properties;
  26872. this.message = message;
  26873. }
  26874. toString() {
  26875. let cmdStr = CMD_STRING + this.command;
  26876. if (this.properties && Object.keys(this.properties).length > 0) {
  26877. cmdStr += ' ';
  26878. let first = true;
  26879. for (const key in this.properties) {
  26880. if (this.properties.hasOwnProperty(key)) {
  26881. const val = this.properties[key];
  26882. if (val) {
  26883. if (first) {
  26884. first = false;
  26885. }
  26886. else {
  26887. cmdStr += ',';
  26888. }
  26889. cmdStr += `${key}=${escapeProperty(val)}`;
  26890. }
  26891. }
  26892. }
  26893. }
  26894. cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
  26895. return cmdStr;
  26896. }
  26897. }
  26898. function escapeData(s) {
  26899. return utils_toCommandValue(s)
  26900. .replace(/%/g, '%25')
  26901. .replace(/\r/g, '%0D')
  26902. .replace(/\n/g, '%0A');
  26903. }
  26904. function escapeProperty(s) {
  26905. return utils_toCommandValue(s)
  26906. .replace(/%/g, '%25')
  26907. .replace(/\r/g, '%0D')
  26908. .replace(/\n/g, '%0A')
  26909. .replace(/:/g, '%3A')
  26910. .replace(/,/g, '%2C');
  26911. }
  26912. //# sourceMappingURL=command.js.map
  26913. ;// CONCATENATED MODULE: external "crypto"
  26914. const external_crypto_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("crypto");
  26915. ;// CONCATENATED MODULE: external "fs"
  26916. const external_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs");
  26917. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/file-command.js
  26918. // For internal use, subject to change.
  26919. // We use any as a valid input type
  26920. /* eslint-disable @typescript-eslint/no-explicit-any */
  26921. function file_command_issueFileCommand(command, message) {
  26922. const filePath = process.env[`GITHUB_${command}`];
  26923. if (!filePath) {
  26924. throw new Error(`Unable to find environment variable for file command ${command}`);
  26925. }
  26926. if (!external_fs_namespaceObject.existsSync(filePath)) {
  26927. throw new Error(`Missing file at path: ${filePath}`);
  26928. }
  26929. external_fs_namespaceObject.appendFileSync(filePath, `${utils_toCommandValue(message)}${external_os_namespaceObject.EOL}`, {
  26930. encoding: 'utf8'
  26931. });
  26932. }
  26933. function file_command_prepareKeyValueMessage(key, value) {
  26934. const delimiter = `ghadelimiter_${external_crypto_namespaceObject.randomUUID()}`;
  26935. const convertedValue = utils_toCommandValue(value);
  26936. // These should realistically never happen, but just in case someone finds a
  26937. // way to exploit uuid generation let's not allow keys or values that contain
  26938. // the delimiter.
  26939. if (key.includes(delimiter)) {
  26940. throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
  26941. }
  26942. if (convertedValue.includes(delimiter)) {
  26943. throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
  26944. }
  26945. return `${key}<<${delimiter}${external_os_namespaceObject.EOL}${convertedValue}${external_os_namespaceObject.EOL}${delimiter}`;
  26946. }
  26947. //# sourceMappingURL=file-command.js.map
  26948. ;// CONCATENATED MODULE: external "path"
  26949. const external_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("path");
  26950. // EXTERNAL MODULE: external "http"
  26951. var external_http_ = __nccwpck_require__(8611);
  26952. // EXTERNAL MODULE: external "https"
  26953. var external_https_ = __nccwpck_require__(5692);
  26954. ;// CONCATENATED MODULE: ./node_modules/@actions/http-client/lib/proxy.js
  26955. function getProxyUrl(reqUrl) {
  26956. const usingSsl = reqUrl.protocol === 'https:';
  26957. if (checkBypass(reqUrl)) {
  26958. return undefined;
  26959. }
  26960. const proxyVar = (() => {
  26961. if (usingSsl) {
  26962. return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
  26963. }
  26964. else {
  26965. return process.env['http_proxy'] || process.env['HTTP_PROXY'];
  26966. }
  26967. })();
  26968. if (proxyVar) {
  26969. try {
  26970. return new DecodedURL(proxyVar);
  26971. }
  26972. catch (_a) {
  26973. if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
  26974. return new DecodedURL(`http://${proxyVar}`);
  26975. }
  26976. }
  26977. else {
  26978. return undefined;
  26979. }
  26980. }
  26981. function checkBypass(reqUrl) {
  26982. if (!reqUrl.hostname) {
  26983. return false;
  26984. }
  26985. const reqHost = reqUrl.hostname;
  26986. if (isLoopbackAddress(reqHost)) {
  26987. return true;
  26988. }
  26989. const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
  26990. if (!noProxy) {
  26991. return false;
  26992. }
  26993. // Determine the request port
  26994. let reqPort;
  26995. if (reqUrl.port) {
  26996. reqPort = Number(reqUrl.port);
  26997. }
  26998. else if (reqUrl.protocol === 'http:') {
  26999. reqPort = 80;
  27000. }
  27001. else if (reqUrl.protocol === 'https:') {
  27002. reqPort = 443;
  27003. }
  27004. // Format the request hostname and hostname with port
  27005. const upperReqHosts = [reqUrl.hostname.toUpperCase()];
  27006. if (typeof reqPort === 'number') {
  27007. upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
  27008. }
  27009. // Compare request host against noproxy
  27010. for (const upperNoProxyItem of noProxy
  27011. .split(',')
  27012. .map(x => x.trim().toUpperCase())
  27013. .filter(x => x)) {
  27014. if (upperNoProxyItem === '*' ||
  27015. upperReqHosts.some(x => x === upperNoProxyItem ||
  27016. x.endsWith(`.${upperNoProxyItem}`) ||
  27017. (upperNoProxyItem.startsWith('.') &&
  27018. x.endsWith(`${upperNoProxyItem}`)))) {
  27019. return true;
  27020. }
  27021. }
  27022. return false;
  27023. }
  27024. function isLoopbackAddress(host) {
  27025. const hostLower = host.toLowerCase();
  27026. return (hostLower === 'localhost' ||
  27027. hostLower.startsWith('127.') ||
  27028. hostLower.startsWith('[::1]') ||
  27029. hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
  27030. }
  27031. class DecodedURL extends URL {
  27032. constructor(url, base) {
  27033. super(url, base);
  27034. this._decodedUsername = decodeURIComponent(super.username);
  27035. this._decodedPassword = decodeURIComponent(super.password);
  27036. }
  27037. get username() {
  27038. return this._decodedUsername;
  27039. }
  27040. get password() {
  27041. return this._decodedPassword;
  27042. }
  27043. }
  27044. //# sourceMappingURL=proxy.js.map
  27045. // EXTERNAL MODULE: ./node_modules/tunnel/index.js
  27046. var node_modules_tunnel = __nccwpck_require__(770);
  27047. // EXTERNAL MODULE: ./node_modules/undici/index.js
  27048. var undici = __nccwpck_require__(6752);
  27049. ;// CONCATENATED MODULE: ./node_modules/@actions/http-client/lib/index.js
  27050. /* eslint-disable @typescript-eslint/no-explicit-any */
  27051. var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  27052. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  27053. return new (P || (P = Promise))(function (resolve, reject) {
  27054. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  27055. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  27056. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  27057. step((generator = generator.apply(thisArg, _arguments || [])).next());
  27058. });
  27059. };
  27060. var HttpCodes;
  27061. (function (HttpCodes) {
  27062. HttpCodes[HttpCodes["OK"] = 200] = "OK";
  27063. HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
  27064. HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
  27065. HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
  27066. HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
  27067. HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
  27068. HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
  27069. HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
  27070. HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
  27071. HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
  27072. HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
  27073. HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
  27074. HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
  27075. HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
  27076. HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
  27077. HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
  27078. HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
  27079. HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
  27080. HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
  27081. HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
  27082. HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
  27083. HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
  27084. HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
  27085. HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
  27086. HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
  27087. HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
  27088. HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
  27089. })(HttpCodes || (HttpCodes = {}));
  27090. var Headers;
  27091. (function (Headers) {
  27092. Headers["Accept"] = "accept";
  27093. Headers["ContentType"] = "content-type";
  27094. })(Headers || (Headers = {}));
  27095. var MediaTypes;
  27096. (function (MediaTypes) {
  27097. MediaTypes["ApplicationJson"] = "application/json";
  27098. })(MediaTypes || (MediaTypes = {}));
  27099. /**
  27100. * Returns the proxy URL, depending upon the supplied url and proxy environment variables.
  27101. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
  27102. */
  27103. function lib_getProxyUrl(serverUrl) {
  27104. const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
  27105. return proxyUrl ? proxyUrl.href : '';
  27106. }
  27107. const HttpRedirectCodes = [
  27108. HttpCodes.MovedPermanently,
  27109. HttpCodes.ResourceMoved,
  27110. HttpCodes.SeeOther,
  27111. HttpCodes.TemporaryRedirect,
  27112. HttpCodes.PermanentRedirect
  27113. ];
  27114. const HttpResponseRetryCodes = [
  27115. HttpCodes.BadGateway,
  27116. HttpCodes.ServiceUnavailable,
  27117. HttpCodes.GatewayTimeout
  27118. ];
  27119. const RetryableHttpVerbs = (/* unused pure expression or super */ null && (['OPTIONS', 'GET', 'DELETE', 'HEAD']));
  27120. const ExponentialBackoffCeiling = 10;
  27121. const ExponentialBackoffTimeSlice = 5;
  27122. class HttpClientError extends Error {
  27123. constructor(message, statusCode) {
  27124. super(message);
  27125. this.name = 'HttpClientError';
  27126. this.statusCode = statusCode;
  27127. Object.setPrototypeOf(this, HttpClientError.prototype);
  27128. }
  27129. }
  27130. class HttpClientResponse {
  27131. constructor(message) {
  27132. this.message = message;
  27133. }
  27134. readBody() {
  27135. return __awaiter(this, void 0, void 0, function* () {
  27136. return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
  27137. let output = Buffer.alloc(0);
  27138. this.message.on('data', (chunk) => {
  27139. output = Buffer.concat([output, chunk]);
  27140. });
  27141. this.message.on('end', () => {
  27142. resolve(output.toString());
  27143. });
  27144. }));
  27145. });
  27146. }
  27147. readBodyBuffer() {
  27148. return __awaiter(this, void 0, void 0, function* () {
  27149. return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
  27150. const chunks = [];
  27151. this.message.on('data', (chunk) => {
  27152. chunks.push(chunk);
  27153. });
  27154. this.message.on('end', () => {
  27155. resolve(Buffer.concat(chunks));
  27156. });
  27157. }));
  27158. });
  27159. }
  27160. }
  27161. function isHttps(requestUrl) {
  27162. const parsedUrl = new URL(requestUrl);
  27163. return parsedUrl.protocol === 'https:';
  27164. }
  27165. class lib_HttpClient {
  27166. constructor(userAgent, handlers, requestOptions) {
  27167. this._ignoreSslError = false;
  27168. this._allowRedirects = true;
  27169. this._allowRedirectDowngrade = false;
  27170. this._maxRedirects = 50;
  27171. this._allowRetries = false;
  27172. this._maxRetries = 1;
  27173. this._keepAlive = false;
  27174. this._disposed = false;
  27175. this.userAgent = this._getUserAgentWithOrchestrationId(userAgent);
  27176. this.handlers = handlers || [];
  27177. this.requestOptions = requestOptions;
  27178. if (requestOptions) {
  27179. if (requestOptions.ignoreSslError != null) {
  27180. this._ignoreSslError = requestOptions.ignoreSslError;
  27181. }
  27182. this._socketTimeout = requestOptions.socketTimeout;
  27183. if (requestOptions.allowRedirects != null) {
  27184. this._allowRedirects = requestOptions.allowRedirects;
  27185. }
  27186. if (requestOptions.allowRedirectDowngrade != null) {
  27187. this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
  27188. }
  27189. if (requestOptions.maxRedirects != null) {
  27190. this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
  27191. }
  27192. if (requestOptions.keepAlive != null) {
  27193. this._keepAlive = requestOptions.keepAlive;
  27194. }
  27195. if (requestOptions.allowRetries != null) {
  27196. this._allowRetries = requestOptions.allowRetries;
  27197. }
  27198. if (requestOptions.maxRetries != null) {
  27199. this._maxRetries = requestOptions.maxRetries;
  27200. }
  27201. }
  27202. }
  27203. options(requestUrl, additionalHeaders) {
  27204. return __awaiter(this, void 0, void 0, function* () {
  27205. return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
  27206. });
  27207. }
  27208. get(requestUrl, additionalHeaders) {
  27209. return __awaiter(this, void 0, void 0, function* () {
  27210. return this.request('GET', requestUrl, null, additionalHeaders || {});
  27211. });
  27212. }
  27213. del(requestUrl, additionalHeaders) {
  27214. return __awaiter(this, void 0, void 0, function* () {
  27215. return this.request('DELETE', requestUrl, null, additionalHeaders || {});
  27216. });
  27217. }
  27218. post(requestUrl, data, additionalHeaders) {
  27219. return __awaiter(this, void 0, void 0, function* () {
  27220. return this.request('POST', requestUrl, data, additionalHeaders || {});
  27221. });
  27222. }
  27223. patch(requestUrl, data, additionalHeaders) {
  27224. return __awaiter(this, void 0, void 0, function* () {
  27225. return this.request('PATCH', requestUrl, data, additionalHeaders || {});
  27226. });
  27227. }
  27228. put(requestUrl, data, additionalHeaders) {
  27229. return __awaiter(this, void 0, void 0, function* () {
  27230. return this.request('PUT', requestUrl, data, additionalHeaders || {});
  27231. });
  27232. }
  27233. head(requestUrl, additionalHeaders) {
  27234. return __awaiter(this, void 0, void 0, function* () {
  27235. return this.request('HEAD', requestUrl, null, additionalHeaders || {});
  27236. });
  27237. }
  27238. sendStream(verb, requestUrl, stream, additionalHeaders) {
  27239. return __awaiter(this, void 0, void 0, function* () {
  27240. return this.request(verb, requestUrl, stream, additionalHeaders);
  27241. });
  27242. }
  27243. /**
  27244. * Gets a typed object from an endpoint
  27245. * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
  27246. */
  27247. getJson(requestUrl_1) {
  27248. return __awaiter(this, arguments, void 0, function* (requestUrl, additionalHeaders = {}) {
  27249. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  27250. const res = yield this.get(requestUrl, additionalHeaders);
  27251. return this._processResponse(res, this.requestOptions);
  27252. });
  27253. }
  27254. postJson(requestUrl_1, obj_1) {
  27255. return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
  27256. const data = JSON.stringify(obj, null, 2);
  27257. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  27258. additionalHeaders[Headers.ContentType] =
  27259. this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
  27260. const res = yield this.post(requestUrl, data, additionalHeaders);
  27261. return this._processResponse(res, this.requestOptions);
  27262. });
  27263. }
  27264. putJson(requestUrl_1, obj_1) {
  27265. return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
  27266. const data = JSON.stringify(obj, null, 2);
  27267. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  27268. additionalHeaders[Headers.ContentType] =
  27269. this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
  27270. const res = yield this.put(requestUrl, data, additionalHeaders);
  27271. return this._processResponse(res, this.requestOptions);
  27272. });
  27273. }
  27274. patchJson(requestUrl_1, obj_1) {
  27275. return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
  27276. const data = JSON.stringify(obj, null, 2);
  27277. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  27278. additionalHeaders[Headers.ContentType] =
  27279. this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
  27280. const res = yield this.patch(requestUrl, data, additionalHeaders);
  27281. return this._processResponse(res, this.requestOptions);
  27282. });
  27283. }
  27284. /**
  27285. * Makes a raw http request.
  27286. * All other methods such as get, post, patch, and request ultimately call this.
  27287. * Prefer get, del, post and patch
  27288. */
  27289. request(verb, requestUrl, data, headers) {
  27290. return __awaiter(this, void 0, void 0, function* () {
  27291. if (this._disposed) {
  27292. throw new Error('Client has already been disposed.');
  27293. }
  27294. const parsedUrl = new URL(requestUrl);
  27295. let info = this._prepareRequest(verb, parsedUrl, headers);
  27296. // Only perform retries on reads since writes may not be idempotent.
  27297. const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
  27298. ? this._maxRetries + 1
  27299. : 1;
  27300. let numTries = 0;
  27301. let response;
  27302. do {
  27303. response = yield this.requestRaw(info, data);
  27304. // Check if it's an authentication challenge
  27305. if (response &&
  27306. response.message &&
  27307. response.message.statusCode === HttpCodes.Unauthorized) {
  27308. let authenticationHandler;
  27309. for (const handler of this.handlers) {
  27310. if (handler.canHandleAuthentication(response)) {
  27311. authenticationHandler = handler;
  27312. break;
  27313. }
  27314. }
  27315. if (authenticationHandler) {
  27316. return authenticationHandler.handleAuthentication(this, info, data);
  27317. }
  27318. else {
  27319. // We have received an unauthorized response but have no handlers to handle it.
  27320. // Let the response return to the caller.
  27321. return response;
  27322. }
  27323. }
  27324. let redirectsRemaining = this._maxRedirects;
  27325. while (response.message.statusCode &&
  27326. HttpRedirectCodes.includes(response.message.statusCode) &&
  27327. this._allowRedirects &&
  27328. redirectsRemaining > 0) {
  27329. const redirectUrl = response.message.headers['location'];
  27330. if (!redirectUrl) {
  27331. // if there's no location to redirect to, we won't
  27332. break;
  27333. }
  27334. const parsedRedirectUrl = new URL(redirectUrl);
  27335. if (parsedUrl.protocol === 'https:' &&
  27336. parsedUrl.protocol !== parsedRedirectUrl.protocol &&
  27337. !this._allowRedirectDowngrade) {
  27338. throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
  27339. }
  27340. // we need to finish reading the response before reassigning response
  27341. // which will leak the open socket.
  27342. yield response.readBody();
  27343. // strip authorization header if redirected to a different hostname
  27344. if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
  27345. for (const header in headers) {
  27346. // header names are case insensitive
  27347. if (header.toLowerCase() === 'authorization') {
  27348. delete headers[header];
  27349. }
  27350. }
  27351. }
  27352. // let's make the request with the new redirectUrl
  27353. info = this._prepareRequest(verb, parsedRedirectUrl, headers);
  27354. response = yield this.requestRaw(info, data);
  27355. redirectsRemaining--;
  27356. }
  27357. if (!response.message.statusCode ||
  27358. !HttpResponseRetryCodes.includes(response.message.statusCode)) {
  27359. // If not a retry code, return immediately instead of retrying
  27360. return response;
  27361. }
  27362. numTries += 1;
  27363. if (numTries < maxTries) {
  27364. yield response.readBody();
  27365. yield this._performExponentialBackoff(numTries);
  27366. }
  27367. } while (numTries < maxTries);
  27368. return response;
  27369. });
  27370. }
  27371. /**
  27372. * Needs to be called if keepAlive is set to true in request options.
  27373. */
  27374. dispose() {
  27375. if (this._agent) {
  27376. this._agent.destroy();
  27377. }
  27378. this._disposed = true;
  27379. }
  27380. /**
  27381. * Raw request.
  27382. * @param info
  27383. * @param data
  27384. */
  27385. requestRaw(info, data) {
  27386. return __awaiter(this, void 0, void 0, function* () {
  27387. return new Promise((resolve, reject) => {
  27388. function callbackForResult(err, res) {
  27389. if (err) {
  27390. reject(err);
  27391. }
  27392. else if (!res) {
  27393. // If `err` is not passed, then `res` must be passed.
  27394. reject(new Error('Unknown error'));
  27395. }
  27396. else {
  27397. resolve(res);
  27398. }
  27399. }
  27400. this.requestRawWithCallback(info, data, callbackForResult);
  27401. });
  27402. });
  27403. }
  27404. /**
  27405. * Raw request with callback.
  27406. * @param info
  27407. * @param data
  27408. * @param onResult
  27409. */
  27410. requestRawWithCallback(info, data, onResult) {
  27411. if (typeof data === 'string') {
  27412. if (!info.options.headers) {
  27413. info.options.headers = {};
  27414. }
  27415. info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
  27416. }
  27417. let callbackCalled = false;
  27418. function handleResult(err, res) {
  27419. if (!callbackCalled) {
  27420. callbackCalled = true;
  27421. onResult(err, res);
  27422. }
  27423. }
  27424. const req = info.httpModule.request(info.options, (msg) => {
  27425. const res = new HttpClientResponse(msg);
  27426. handleResult(undefined, res);
  27427. });
  27428. let socket;
  27429. req.on('socket', sock => {
  27430. socket = sock;
  27431. });
  27432. // If we ever get disconnected, we want the socket to timeout eventually
  27433. req.setTimeout(this._socketTimeout || 3 * 60000, () => {
  27434. if (socket) {
  27435. socket.end();
  27436. }
  27437. handleResult(new Error(`Request timeout: ${info.options.path}`));
  27438. });
  27439. req.on('error', function (err) {
  27440. // err has statusCode property
  27441. // res should have headers
  27442. handleResult(err);
  27443. });
  27444. if (data && typeof data === 'string') {
  27445. req.write(data, 'utf8');
  27446. }
  27447. if (data && typeof data !== 'string') {
  27448. data.on('close', function () {
  27449. req.end();
  27450. });
  27451. data.pipe(req);
  27452. }
  27453. else {
  27454. req.end();
  27455. }
  27456. }
  27457. /**
  27458. * Gets an http agent. This function is useful when you need an http agent that handles
  27459. * routing through a proxy server - depending upon the url and proxy environment variables.
  27460. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
  27461. */
  27462. getAgent(serverUrl) {
  27463. const parsedUrl = new URL(serverUrl);
  27464. return this._getAgent(parsedUrl);
  27465. }
  27466. getAgentDispatcher(serverUrl) {
  27467. const parsedUrl = new URL(serverUrl);
  27468. const proxyUrl = pm.getProxyUrl(parsedUrl);
  27469. const useProxy = proxyUrl && proxyUrl.hostname;
  27470. if (!useProxy) {
  27471. return;
  27472. }
  27473. return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
  27474. }
  27475. _prepareRequest(method, requestUrl, headers) {
  27476. const info = {};
  27477. info.parsedUrl = requestUrl;
  27478. const usingSsl = info.parsedUrl.protocol === 'https:';
  27479. info.httpModule = usingSsl ? https : http;
  27480. const defaultPort = usingSsl ? 443 : 80;
  27481. info.options = {};
  27482. info.options.host = info.parsedUrl.hostname;
  27483. info.options.port = info.parsedUrl.port
  27484. ? parseInt(info.parsedUrl.port)
  27485. : defaultPort;
  27486. info.options.path =
  27487. (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
  27488. info.options.method = method;
  27489. info.options.headers = this._mergeHeaders(headers);
  27490. if (this.userAgent != null) {
  27491. info.options.headers['user-agent'] = this.userAgent;
  27492. }
  27493. info.options.agent = this._getAgent(info.parsedUrl);
  27494. // gives handlers an opportunity to participate
  27495. if (this.handlers) {
  27496. for (const handler of this.handlers) {
  27497. handler.prepareRequest(info.options);
  27498. }
  27499. }
  27500. return info;
  27501. }
  27502. _mergeHeaders(headers) {
  27503. if (this.requestOptions && this.requestOptions.headers) {
  27504. return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
  27505. }
  27506. return lowercaseKeys(headers || {});
  27507. }
  27508. /**
  27509. * Gets an existing header value or returns a default.
  27510. * Handles converting number header values to strings since HTTP headers must be strings.
  27511. * Note: This returns string | string[] since some headers can have multiple values.
  27512. * For headers that must always be a single string (like Content-Type), use the
  27513. * specialized _getExistingOrDefaultContentTypeHeader method instead.
  27514. */
  27515. _getExistingOrDefaultHeader(additionalHeaders, header, _default) {
  27516. let clientHeader;
  27517. if (this.requestOptions && this.requestOptions.headers) {
  27518. const headerValue = lowercaseKeys(this.requestOptions.headers)[header];
  27519. if (headerValue) {
  27520. clientHeader =
  27521. typeof headerValue === 'number' ? headerValue.toString() : headerValue;
  27522. }
  27523. }
  27524. const additionalValue = additionalHeaders[header];
  27525. if (additionalValue !== undefined) {
  27526. return typeof additionalValue === 'number'
  27527. ? additionalValue.toString()
  27528. : additionalValue;
  27529. }
  27530. if (clientHeader !== undefined) {
  27531. return clientHeader;
  27532. }
  27533. return _default;
  27534. }
  27535. /**
  27536. * Specialized version of _getExistingOrDefaultHeader for Content-Type header.
  27537. * Always returns a single string (not an array) since Content-Type should be a single value.
  27538. * Converts arrays to comma-separated strings and numbers to strings to ensure type safety.
  27539. * This was split from _getExistingOrDefaultHeader to provide stricter typing for callers
  27540. * that assign the result to places expecting a string (e.g., additionalHeaders[Headers.ContentType]).
  27541. */
  27542. _getExistingOrDefaultContentTypeHeader(additionalHeaders, _default) {
  27543. let clientHeader;
  27544. if (this.requestOptions && this.requestOptions.headers) {
  27545. const headerValue = lowercaseKeys(this.requestOptions.headers)[Headers.ContentType];
  27546. if (headerValue) {
  27547. if (typeof headerValue === 'number') {
  27548. clientHeader = String(headerValue);
  27549. }
  27550. else if (Array.isArray(headerValue)) {
  27551. clientHeader = headerValue.join(', ');
  27552. }
  27553. else {
  27554. clientHeader = headerValue;
  27555. }
  27556. }
  27557. }
  27558. const additionalValue = additionalHeaders[Headers.ContentType];
  27559. // Return the first non-undefined value, converting numbers or arrays to strings if necessary
  27560. if (additionalValue !== undefined) {
  27561. if (typeof additionalValue === 'number') {
  27562. return String(additionalValue);
  27563. }
  27564. else if (Array.isArray(additionalValue)) {
  27565. return additionalValue.join(', ');
  27566. }
  27567. else {
  27568. return additionalValue;
  27569. }
  27570. }
  27571. if (clientHeader !== undefined) {
  27572. return clientHeader;
  27573. }
  27574. return _default;
  27575. }
  27576. _getAgent(parsedUrl) {
  27577. let agent;
  27578. const proxyUrl = pm.getProxyUrl(parsedUrl);
  27579. const useProxy = proxyUrl && proxyUrl.hostname;
  27580. if (this._keepAlive && useProxy) {
  27581. agent = this._proxyAgent;
  27582. }
  27583. if (!useProxy) {
  27584. agent = this._agent;
  27585. }
  27586. // if agent is already assigned use that agent.
  27587. if (agent) {
  27588. return agent;
  27589. }
  27590. const usingSsl = parsedUrl.protocol === 'https:';
  27591. let maxSockets = 100;
  27592. if (this.requestOptions) {
  27593. maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
  27594. }
  27595. // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
  27596. if (proxyUrl && proxyUrl.hostname) {
  27597. const agentOptions = {
  27598. maxSockets,
  27599. keepAlive: this._keepAlive,
  27600. proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
  27601. proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
  27602. })), { host: proxyUrl.hostname, port: proxyUrl.port })
  27603. };
  27604. let tunnelAgent;
  27605. const overHttps = proxyUrl.protocol === 'https:';
  27606. if (usingSsl) {
  27607. tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
  27608. }
  27609. else {
  27610. tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
  27611. }
  27612. agent = tunnelAgent(agentOptions);
  27613. this._proxyAgent = agent;
  27614. }
  27615. // if tunneling agent isn't assigned create a new agent
  27616. if (!agent) {
  27617. const options = { keepAlive: this._keepAlive, maxSockets };
  27618. agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
  27619. this._agent = agent;
  27620. }
  27621. if (usingSsl && this._ignoreSslError) {
  27622. // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
  27623. // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
  27624. // we have to cast it to any and change it directly
  27625. agent.options = Object.assign(agent.options || {}, {
  27626. rejectUnauthorized: false
  27627. });
  27628. }
  27629. return agent;
  27630. }
  27631. _getProxyAgentDispatcher(parsedUrl, proxyUrl) {
  27632. let proxyAgent;
  27633. if (this._keepAlive) {
  27634. proxyAgent = this._proxyAgentDispatcher;
  27635. }
  27636. // if agent is already assigned use that agent.
  27637. if (proxyAgent) {
  27638. return proxyAgent;
  27639. }
  27640. const usingSsl = parsedUrl.protocol === 'https:';
  27641. proxyAgent = new ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
  27642. token: `Basic ${Buffer.from(`${proxyUrl.username}:${proxyUrl.password}`).toString('base64')}`
  27643. })));
  27644. this._proxyAgentDispatcher = proxyAgent;
  27645. if (usingSsl && this._ignoreSslError) {
  27646. // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
  27647. // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
  27648. // we have to cast it to any and change it directly
  27649. proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, {
  27650. rejectUnauthorized: false
  27651. });
  27652. }
  27653. return proxyAgent;
  27654. }
  27655. _getUserAgentWithOrchestrationId(userAgent) {
  27656. const baseUserAgent = userAgent || 'actions/http-client';
  27657. const orchId = process.env['ACTIONS_ORCHESTRATION_ID'];
  27658. if (orchId) {
  27659. // Sanitize the orchestration ID to ensure it contains only valid characters
  27660. // Valid characters: 0-9, a-z, _, -, .
  27661. const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
  27662. return `${baseUserAgent} actions_orchestration_id/${sanitizedId}`;
  27663. }
  27664. return baseUserAgent;
  27665. }
  27666. _performExponentialBackoff(retryNumber) {
  27667. return __awaiter(this, void 0, void 0, function* () {
  27668. retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
  27669. const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
  27670. return new Promise(resolve => setTimeout(() => resolve(), ms));
  27671. });
  27672. }
  27673. _processResponse(res, options) {
  27674. return __awaiter(this, void 0, void 0, function* () {
  27675. return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
  27676. const statusCode = res.message.statusCode || 0;
  27677. const response = {
  27678. statusCode,
  27679. result: null,
  27680. headers: {}
  27681. };
  27682. // not found leads to null obj returned
  27683. if (statusCode === HttpCodes.NotFound) {
  27684. resolve(response);
  27685. }
  27686. // get the result from the body
  27687. function dateTimeDeserializer(key, value) {
  27688. if (typeof value === 'string') {
  27689. const a = new Date(value);
  27690. if (!isNaN(a.valueOf())) {
  27691. return a;
  27692. }
  27693. }
  27694. return value;
  27695. }
  27696. let obj;
  27697. let contents;
  27698. try {
  27699. contents = yield res.readBody();
  27700. if (contents && contents.length > 0) {
  27701. if (options && options.deserializeDates) {
  27702. obj = JSON.parse(contents, dateTimeDeserializer);
  27703. }
  27704. else {
  27705. obj = JSON.parse(contents);
  27706. }
  27707. response.result = obj;
  27708. }
  27709. response.headers = res.message.headers;
  27710. }
  27711. catch (err) {
  27712. // Invalid resource (contents not json); leaving result obj null
  27713. }
  27714. // note that 3xx redirects are handled by the http layer.
  27715. if (statusCode > 299) {
  27716. let msg;
  27717. // if exception/error in body, attempt to get better error
  27718. if (obj && obj.message) {
  27719. msg = obj.message;
  27720. }
  27721. else if (contents && contents.length > 0) {
  27722. // it may be the case that the exception is in the body message as string
  27723. msg = contents;
  27724. }
  27725. else {
  27726. msg = `Failed request: (${statusCode})`;
  27727. }
  27728. const err = new HttpClientError(msg, statusCode);
  27729. err.result = response.result;
  27730. reject(err);
  27731. }
  27732. else {
  27733. resolve(response);
  27734. }
  27735. }));
  27736. });
  27737. }
  27738. }
  27739. const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
  27740. //# sourceMappingURL=index.js.map
  27741. ;// CONCATENATED MODULE: ./node_modules/@actions/http-client/lib/auth.js
  27742. var auth_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  27743. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  27744. return new (P || (P = Promise))(function (resolve, reject) {
  27745. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  27746. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  27747. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  27748. step((generator = generator.apply(thisArg, _arguments || [])).next());
  27749. });
  27750. };
  27751. class BasicCredentialHandler {
  27752. constructor(username, password) {
  27753. this.username = username;
  27754. this.password = password;
  27755. }
  27756. prepareRequest(options) {
  27757. if (!options.headers) {
  27758. throw Error('The request has no headers');
  27759. }
  27760. options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;
  27761. }
  27762. // This handler cannot handle 401
  27763. canHandleAuthentication() {
  27764. return false;
  27765. }
  27766. handleAuthentication() {
  27767. return auth_awaiter(this, void 0, void 0, function* () {
  27768. throw new Error('not implemented');
  27769. });
  27770. }
  27771. }
  27772. class auth_BearerCredentialHandler {
  27773. constructor(token) {
  27774. this.token = token;
  27775. }
  27776. // currently implements pre-authorization
  27777. // TODO: support preAuth = false where it hooks on 401
  27778. prepareRequest(options) {
  27779. if (!options.headers) {
  27780. throw Error('The request has no headers');
  27781. }
  27782. options.headers['Authorization'] = `Bearer ${this.token}`;
  27783. }
  27784. // This handler cannot handle 401
  27785. canHandleAuthentication() {
  27786. return false;
  27787. }
  27788. handleAuthentication() {
  27789. return auth_awaiter(this, void 0, void 0, function* () {
  27790. throw new Error('not implemented');
  27791. });
  27792. }
  27793. }
  27794. class PersonalAccessTokenCredentialHandler {
  27795. constructor(token) {
  27796. this.token = token;
  27797. }
  27798. // currently implements pre-authorization
  27799. // TODO: support preAuth = false where it hooks on 401
  27800. prepareRequest(options) {
  27801. if (!options.headers) {
  27802. throw Error('The request has no headers');
  27803. }
  27804. options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;
  27805. }
  27806. // This handler cannot handle 401
  27807. canHandleAuthentication() {
  27808. return false;
  27809. }
  27810. handleAuthentication() {
  27811. return auth_awaiter(this, void 0, void 0, function* () {
  27812. throw new Error('not implemented');
  27813. });
  27814. }
  27815. }
  27816. //# sourceMappingURL=auth.js.map
  27817. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/oidc-utils.js
  27818. var oidc_utils_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  27819. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  27820. return new (P || (P = Promise))(function (resolve, reject) {
  27821. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  27822. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  27823. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  27824. step((generator = generator.apply(thisArg, _arguments || [])).next());
  27825. });
  27826. };
  27827. class oidc_utils_OidcClient {
  27828. static createHttpClient(allowRetry = true, maxRetry = 10) {
  27829. const requestOptions = {
  27830. allowRetries: allowRetry,
  27831. maxRetries: maxRetry
  27832. };
  27833. return new HttpClient('actions/oidc-client', [new BearerCredentialHandler(oidc_utils_OidcClient.getRequestToken())], requestOptions);
  27834. }
  27835. static getRequestToken() {
  27836. const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
  27837. if (!token) {
  27838. throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
  27839. }
  27840. return token;
  27841. }
  27842. static getIDTokenUrl() {
  27843. const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
  27844. if (!runtimeUrl) {
  27845. throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
  27846. }
  27847. return runtimeUrl;
  27848. }
  27849. static getCall(id_token_url) {
  27850. return oidc_utils_awaiter(this, void 0, void 0, function* () {
  27851. var _a;
  27852. const httpclient = oidc_utils_OidcClient.createHttpClient();
  27853. const res = yield httpclient
  27854. .getJson(id_token_url)
  27855. .catch(error => {
  27856. throw new Error(`Failed to get ID Token. \n
  27857. Error Code : ${error.statusCode}\n
  27858. Error Message: ${error.message}`);
  27859. });
  27860. const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
  27861. if (!id_token) {
  27862. throw new Error('Response json body do not have ID Token field');
  27863. }
  27864. return id_token;
  27865. });
  27866. }
  27867. static getIDToken(audience) {
  27868. return oidc_utils_awaiter(this, void 0, void 0, function* () {
  27869. try {
  27870. // New ID Token is requested from action service
  27871. let id_token_url = oidc_utils_OidcClient.getIDTokenUrl();
  27872. if (audience) {
  27873. const encodedAudience = encodeURIComponent(audience);
  27874. id_token_url = `${id_token_url}&audience=${encodedAudience}`;
  27875. }
  27876. debug(`ID token url is ${id_token_url}`);
  27877. const id_token = yield oidc_utils_OidcClient.getCall(id_token_url);
  27878. setSecret(id_token);
  27879. return id_token;
  27880. }
  27881. catch (error) {
  27882. throw new Error(`Error message: ${error.message}`);
  27883. }
  27884. });
  27885. }
  27886. }
  27887. //# sourceMappingURL=oidc-utils.js.map
  27888. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/summary.js
  27889. var summary_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  27890. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  27891. return new (P || (P = Promise))(function (resolve, reject) {
  27892. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  27893. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  27894. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  27895. step((generator = generator.apply(thisArg, _arguments || [])).next());
  27896. });
  27897. };
  27898. const { access, appendFile, writeFile } = external_fs_namespaceObject.promises;
  27899. const SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
  27900. const SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
  27901. class Summary {
  27902. constructor() {
  27903. this._buffer = '';
  27904. }
  27905. /**
  27906. * Finds the summary file path from the environment, rejects if env var is not found or file does not exist
  27907. * Also checks r/w permissions.
  27908. *
  27909. * @returns step summary file path
  27910. */
  27911. filePath() {
  27912. return summary_awaiter(this, void 0, void 0, function* () {
  27913. if (this._filePath) {
  27914. return this._filePath;
  27915. }
  27916. const pathFromEnv = process.env[SUMMARY_ENV_VAR];
  27917. if (!pathFromEnv) {
  27918. throw new Error(`Unable to find environment variable for $${SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
  27919. }
  27920. try {
  27921. yield access(pathFromEnv, external_fs_namespaceObject.constants.R_OK | external_fs_namespaceObject.constants.W_OK);
  27922. }
  27923. catch (_a) {
  27924. throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
  27925. }
  27926. this._filePath = pathFromEnv;
  27927. return this._filePath;
  27928. });
  27929. }
  27930. /**
  27931. * Wraps content in an HTML tag, adding any HTML attributes
  27932. *
  27933. * @param {string} tag HTML tag to wrap
  27934. * @param {string | null} content content within the tag
  27935. * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
  27936. *
  27937. * @returns {string} content wrapped in HTML element
  27938. */
  27939. wrap(tag, content, attrs = {}) {
  27940. const htmlAttrs = Object.entries(attrs)
  27941. .map(([key, value]) => ` ${key}="${value}"`)
  27942. .join('');
  27943. if (!content) {
  27944. return `<${tag}${htmlAttrs}>`;
  27945. }
  27946. return `<${tag}${htmlAttrs}>${content}</${tag}>`;
  27947. }
  27948. /**
  27949. * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
  27950. *
  27951. * @param {SummaryWriteOptions} [options] (optional) options for write operation
  27952. *
  27953. * @returns {Promise<Summary>} summary instance
  27954. */
  27955. write(options) {
  27956. return summary_awaiter(this, void 0, void 0, function* () {
  27957. const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
  27958. const filePath = yield this.filePath();
  27959. const writeFunc = overwrite ? writeFile : appendFile;
  27960. yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
  27961. return this.emptyBuffer();
  27962. });
  27963. }
  27964. /**
  27965. * Clears the summary buffer and wipes the summary file
  27966. *
  27967. * @returns {Summary} summary instance
  27968. */
  27969. clear() {
  27970. return summary_awaiter(this, void 0, void 0, function* () {
  27971. return this.emptyBuffer().write({ overwrite: true });
  27972. });
  27973. }
  27974. /**
  27975. * Returns the current summary buffer as a string
  27976. *
  27977. * @returns {string} string of summary buffer
  27978. */
  27979. stringify() {
  27980. return this._buffer;
  27981. }
  27982. /**
  27983. * If the summary buffer is empty
  27984. *
  27985. * @returns {boolen} true if the buffer is empty
  27986. */
  27987. isEmptyBuffer() {
  27988. return this._buffer.length === 0;
  27989. }
  27990. /**
  27991. * Resets the summary buffer without writing to summary file
  27992. *
  27993. * @returns {Summary} summary instance
  27994. */
  27995. emptyBuffer() {
  27996. this._buffer = '';
  27997. return this;
  27998. }
  27999. /**
  28000. * Adds raw text to the summary buffer
  28001. *
  28002. * @param {string} text content to add
  28003. * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
  28004. *
  28005. * @returns {Summary} summary instance
  28006. */
  28007. addRaw(text, addEOL = false) {
  28008. this._buffer += text;
  28009. return addEOL ? this.addEOL() : this;
  28010. }
  28011. /**
  28012. * Adds the operating system-specific end-of-line marker to the buffer
  28013. *
  28014. * @returns {Summary} summary instance
  28015. */
  28016. addEOL() {
  28017. return this.addRaw(external_os_namespaceObject.EOL);
  28018. }
  28019. /**
  28020. * Adds an HTML codeblock to the summary buffer
  28021. *
  28022. * @param {string} code content to render within fenced code block
  28023. * @param {string} lang (optional) language to syntax highlight code
  28024. *
  28025. * @returns {Summary} summary instance
  28026. */
  28027. addCodeBlock(code, lang) {
  28028. const attrs = Object.assign({}, (lang && { lang }));
  28029. const element = this.wrap('pre', this.wrap('code', code), attrs);
  28030. return this.addRaw(element).addEOL();
  28031. }
  28032. /**
  28033. * Adds an HTML list to the summary buffer
  28034. *
  28035. * @param {string[]} items list of items to render
  28036. * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
  28037. *
  28038. * @returns {Summary} summary instance
  28039. */
  28040. addList(items, ordered = false) {
  28041. const tag = ordered ? 'ol' : 'ul';
  28042. const listItems = items.map(item => this.wrap('li', item)).join('');
  28043. const element = this.wrap(tag, listItems);
  28044. return this.addRaw(element).addEOL();
  28045. }
  28046. /**
  28047. * Adds an HTML table to the summary buffer
  28048. *
  28049. * @param {SummaryTableCell[]} rows table rows
  28050. *
  28051. * @returns {Summary} summary instance
  28052. */
  28053. addTable(rows) {
  28054. const tableBody = rows
  28055. .map(row => {
  28056. const cells = row
  28057. .map(cell => {
  28058. if (typeof cell === 'string') {
  28059. return this.wrap('td', cell);
  28060. }
  28061. const { header, data, colspan, rowspan } = cell;
  28062. const tag = header ? 'th' : 'td';
  28063. const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
  28064. return this.wrap(tag, data, attrs);
  28065. })
  28066. .join('');
  28067. return this.wrap('tr', cells);
  28068. })
  28069. .join('');
  28070. const element = this.wrap('table', tableBody);
  28071. return this.addRaw(element).addEOL();
  28072. }
  28073. /**
  28074. * Adds a collapsable HTML details element to the summary buffer
  28075. *
  28076. * @param {string} label text for the closed state
  28077. * @param {string} content collapsable content
  28078. *
  28079. * @returns {Summary} summary instance
  28080. */
  28081. addDetails(label, content) {
  28082. const element = this.wrap('details', this.wrap('summary', label) + content);
  28083. return this.addRaw(element).addEOL();
  28084. }
  28085. /**
  28086. * Adds an HTML image tag to the summary buffer
  28087. *
  28088. * @param {string} src path to the image you to embed
  28089. * @param {string} alt text description of the image
  28090. * @param {SummaryImageOptions} options (optional) addition image attributes
  28091. *
  28092. * @returns {Summary} summary instance
  28093. */
  28094. addImage(src, alt, options) {
  28095. const { width, height } = options || {};
  28096. const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
  28097. const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
  28098. return this.addRaw(element).addEOL();
  28099. }
  28100. /**
  28101. * Adds an HTML section heading element
  28102. *
  28103. * @param {string} text heading text
  28104. * @param {number | string} [level=1] (optional) the heading level, default: 1
  28105. *
  28106. * @returns {Summary} summary instance
  28107. */
  28108. addHeading(text, level) {
  28109. const tag = `h${level}`;
  28110. const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
  28111. ? tag
  28112. : 'h1';
  28113. const element = this.wrap(allowedTag, text);
  28114. return this.addRaw(element).addEOL();
  28115. }
  28116. /**
  28117. * Adds an HTML thematic break (<hr>) to the summary buffer
  28118. *
  28119. * @returns {Summary} summary instance
  28120. */
  28121. addSeparator() {
  28122. const element = this.wrap('hr', null);
  28123. return this.addRaw(element).addEOL();
  28124. }
  28125. /**
  28126. * Adds an HTML line break (<br>) to the summary buffer
  28127. *
  28128. * @returns {Summary} summary instance
  28129. */
  28130. addBreak() {
  28131. const element = this.wrap('br', null);
  28132. return this.addRaw(element).addEOL();
  28133. }
  28134. /**
  28135. * Adds an HTML blockquote to the summary buffer
  28136. *
  28137. * @param {string} text quote text
  28138. * @param {string} cite (optional) citation url
  28139. *
  28140. * @returns {Summary} summary instance
  28141. */
  28142. addQuote(text, cite) {
  28143. const attrs = Object.assign({}, (cite && { cite }));
  28144. const element = this.wrap('blockquote', text, attrs);
  28145. return this.addRaw(element).addEOL();
  28146. }
  28147. /**
  28148. * Adds an HTML anchor tag to the summary buffer
  28149. *
  28150. * @param {string} text link text/content
  28151. * @param {string} href hyperlink
  28152. *
  28153. * @returns {Summary} summary instance
  28154. */
  28155. addLink(text, href) {
  28156. const element = this.wrap('a', text, { href });
  28157. return this.addRaw(element).addEOL();
  28158. }
  28159. }
  28160. const _summary = new Summary();
  28161. /**
  28162. * @deprecated use `core.summary`
  28163. */
  28164. const markdownSummary = (/* unused pure expression or super */ null && (_summary));
  28165. const summary = (/* unused pure expression or super */ null && (_summary));
  28166. //# sourceMappingURL=summary.js.map
  28167. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/path-utils.js
  28168. /**
  28169. * toPosixPath converts the given path to the posix form. On Windows, \\ will be
  28170. * replaced with /.
  28171. *
  28172. * @param pth. Path to transform.
  28173. * @return string Posix path.
  28174. */
  28175. function toPosixPath(pth) {
  28176. return pth.replace(/[\\]/g, '/');
  28177. }
  28178. /**
  28179. * toWin32Path converts the given path to the win32 form. On Linux, / will be
  28180. * replaced with \\.
  28181. *
  28182. * @param pth. Path to transform.
  28183. * @return string Win32 path.
  28184. */
  28185. function toWin32Path(pth) {
  28186. return pth.replace(/[/]/g, '\\');
  28187. }
  28188. /**
  28189. * toPlatformPath converts the given path to a platform-specific path. It does
  28190. * this by replacing instances of / and \ with the platform-specific path
  28191. * separator.
  28192. *
  28193. * @param pth The path to platformize.
  28194. * @return string The platform-specific path.
  28195. */
  28196. function toPlatformPath(pth) {
  28197. return pth.replace(/[/\\]/g, path.sep);
  28198. }
  28199. //# sourceMappingURL=path-utils.js.map
  28200. // EXTERNAL MODULE: external "string_decoder"
  28201. var external_string_decoder_ = __nccwpck_require__(3193);
  28202. // EXTERNAL MODULE: external "events"
  28203. var external_events_ = __nccwpck_require__(4434);
  28204. ;// CONCATENATED MODULE: external "child_process"
  28205. const external_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("child_process");
  28206. // EXTERNAL MODULE: external "assert"
  28207. var external_assert_ = __nccwpck_require__(2613);
  28208. ;// CONCATENATED MODULE: ./node_modules/@actions/io/lib/io-util.js
  28209. var io_util_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  28210. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  28211. return new (P || (P = Promise))(function (resolve, reject) {
  28212. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  28213. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  28214. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  28215. step((generator = generator.apply(thisArg, _arguments || [])).next());
  28216. });
  28217. };
  28218. const { chmod, copyFile, lstat, mkdir, open: io_util_open, readdir, rename, rm, rmdir, stat, symlink, unlink } = external_fs_namespaceObject.promises;
  28219. // export const {open} = 'fs'
  28220. const IS_WINDOWS = process.platform === 'win32';
  28221. /**
  28222. * Custom implementation of readlink to ensure Windows junctions
  28223. * maintain trailing backslash for backward compatibility with Node.js < 24
  28224. *
  28225. * In Node.js 20, Windows junctions (directory symlinks) always returned paths
  28226. * with trailing backslashes. Node.js 24 removed this behavior, which breaks
  28227. * code that relied on this format for path operations.
  28228. *
  28229. * This implementation restores the Node 20 behavior by adding a trailing
  28230. * backslash to all junction results on Windows.
  28231. */
  28232. function readlink(fsPath) {
  28233. return io_util_awaiter(this, void 0, void 0, function* () {
  28234. const result = yield external_fs_namespaceObject.promises.readlink(fsPath);
  28235. // On Windows, restore Node 20 behavior: add trailing backslash to all results
  28236. // since junctions on Windows are always directory links
  28237. if (IS_WINDOWS && !result.endsWith('\\')) {
  28238. return `${result}\\`;
  28239. }
  28240. return result;
  28241. });
  28242. }
  28243. // See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
  28244. const UV_FS_O_EXLOCK = 0x10000000;
  28245. const READONLY = external_fs_namespaceObject.constants.O_RDONLY;
  28246. function exists(fsPath) {
  28247. return io_util_awaiter(this, void 0, void 0, function* () {
  28248. try {
  28249. yield stat(fsPath);
  28250. }
  28251. catch (err) {
  28252. if (err.code === 'ENOENT') {
  28253. return false;
  28254. }
  28255. throw err;
  28256. }
  28257. return true;
  28258. });
  28259. }
  28260. function isDirectory(fsPath_1) {
  28261. return io_util_awaiter(this, arguments, void 0, function* (fsPath, useStat = false) {
  28262. const stats = useStat ? yield stat(fsPath) : yield lstat(fsPath);
  28263. return stats.isDirectory();
  28264. });
  28265. }
  28266. /**
  28267. * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
  28268. * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
  28269. */
  28270. function isRooted(p) {
  28271. p = normalizeSeparators(p);
  28272. if (!p) {
  28273. throw new Error('isRooted() parameter "p" cannot be empty');
  28274. }
  28275. if (IS_WINDOWS) {
  28276. return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
  28277. ); // e.g. C: or C:\hello
  28278. }
  28279. return p.startsWith('/');
  28280. }
  28281. /**
  28282. * Best effort attempt to determine whether a file exists and is executable.
  28283. * @param filePath file path to check
  28284. * @param extensions additional file extensions to try
  28285. * @return if file exists and is executable, returns the file path. otherwise empty string.
  28286. */
  28287. function tryGetExecutablePath(filePath, extensions) {
  28288. return io_util_awaiter(this, void 0, void 0, function* () {
  28289. let stats = undefined;
  28290. try {
  28291. // test file exists
  28292. stats = yield stat(filePath);
  28293. }
  28294. catch (err) {
  28295. if (err.code !== 'ENOENT') {
  28296. // eslint-disable-next-line no-console
  28297. console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
  28298. }
  28299. }
  28300. if (stats && stats.isFile()) {
  28301. if (IS_WINDOWS) {
  28302. // on Windows, test for valid extension
  28303. const upperExt = external_path_namespaceObject.extname(filePath).toUpperCase();
  28304. if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
  28305. return filePath;
  28306. }
  28307. }
  28308. else {
  28309. if (isUnixExecutable(stats)) {
  28310. return filePath;
  28311. }
  28312. }
  28313. }
  28314. // try each extension
  28315. const originalFilePath = filePath;
  28316. for (const extension of extensions) {
  28317. filePath = originalFilePath + extension;
  28318. stats = undefined;
  28319. try {
  28320. stats = yield stat(filePath);
  28321. }
  28322. catch (err) {
  28323. if (err.code !== 'ENOENT') {
  28324. // eslint-disable-next-line no-console
  28325. console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
  28326. }
  28327. }
  28328. if (stats && stats.isFile()) {
  28329. if (IS_WINDOWS) {
  28330. // preserve the case of the actual file (since an extension was appended)
  28331. try {
  28332. const directory = external_path_namespaceObject.dirname(filePath);
  28333. const upperName = external_path_namespaceObject.basename(filePath).toUpperCase();
  28334. for (const actualName of yield readdir(directory)) {
  28335. if (upperName === actualName.toUpperCase()) {
  28336. filePath = external_path_namespaceObject.join(directory, actualName);
  28337. break;
  28338. }
  28339. }
  28340. }
  28341. catch (err) {
  28342. // eslint-disable-next-line no-console
  28343. console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
  28344. }
  28345. return filePath;
  28346. }
  28347. else {
  28348. if (isUnixExecutable(stats)) {
  28349. return filePath;
  28350. }
  28351. }
  28352. }
  28353. }
  28354. return '';
  28355. });
  28356. }
  28357. function normalizeSeparators(p) {
  28358. p = p || '';
  28359. if (IS_WINDOWS) {
  28360. // convert slashes on Windows
  28361. p = p.replace(/\//g, '\\');
  28362. // remove redundant slashes
  28363. return p.replace(/\\\\+/g, '\\');
  28364. }
  28365. // remove redundant slashes
  28366. return p.replace(/\/\/+/g, '/');
  28367. }
  28368. // on Mac/Linux, test the execute bit
  28369. // R W X R W X R W X
  28370. // 256 128 64 32 16 8 4 2 1
  28371. function isUnixExecutable(stats) {
  28372. return ((stats.mode & 1) > 0 ||
  28373. ((stats.mode & 8) > 0 &&
  28374. process.getgid !== undefined &&
  28375. stats.gid === process.getgid()) ||
  28376. ((stats.mode & 64) > 0 &&
  28377. process.getuid !== undefined &&
  28378. stats.uid === process.getuid()));
  28379. }
  28380. // Get the path of cmd.exe in windows
  28381. function getCmdPath() {
  28382. var _a;
  28383. return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
  28384. }
  28385. //# sourceMappingURL=io-util.js.map
  28386. ;// CONCATENATED MODULE: ./node_modules/@actions/io/lib/io.js
  28387. var io_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  28388. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  28389. return new (P || (P = Promise))(function (resolve, reject) {
  28390. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  28391. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  28392. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  28393. step((generator = generator.apply(thisArg, _arguments || [])).next());
  28394. });
  28395. };
  28396. /**
  28397. * Copies a file or folder.
  28398. * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
  28399. *
  28400. * @param source source path
  28401. * @param dest destination path
  28402. * @param options optional. See CopyOptions.
  28403. */
  28404. function io_cp(source_1, dest_1) {
  28405. return io_awaiter(this, arguments, void 0, function* (source, dest, options = {}) {
  28406. const { force, recursive, copySourceDirectory } = readCopyOptions(options);
  28407. const destStat = (yield exists(dest)) ? yield stat(dest) : null;
  28408. // Dest is an existing file, but not forcing
  28409. if (destStat && destStat.isFile() && !force) {
  28410. return;
  28411. }
  28412. // If dest is an existing directory, should copy inside.
  28413. const newDest = destStat && destStat.isDirectory() && copySourceDirectory
  28414. ? external_path_namespaceObject.join(dest, external_path_namespaceObject.basename(source))
  28415. : dest;
  28416. if (!(yield exists(source))) {
  28417. throw new Error(`no such file or directory: ${source}`);
  28418. }
  28419. const sourceStat = yield stat(source);
  28420. if (sourceStat.isDirectory()) {
  28421. if (!recursive) {
  28422. throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
  28423. }
  28424. else {
  28425. yield cpDirRecursive(source, newDest, 0, force);
  28426. }
  28427. }
  28428. else {
  28429. if (external_path_namespaceObject.relative(source, newDest) === '') {
  28430. // a file cannot be copied to itself
  28431. throw new Error(`'${newDest}' and '${source}' are the same file`);
  28432. }
  28433. yield io_copyFile(source, newDest, force);
  28434. }
  28435. });
  28436. }
  28437. /**
  28438. * Moves a path.
  28439. *
  28440. * @param source source path
  28441. * @param dest destination path
  28442. * @param options optional. See MoveOptions.
  28443. */
  28444. function mv(source_1, dest_1) {
  28445. return io_awaiter(this, arguments, void 0, function* (source, dest, options = {}) {
  28446. if (yield exists(dest)) {
  28447. let destExists = true;
  28448. if (yield isDirectory(dest)) {
  28449. // If dest is directory copy src into dest
  28450. dest = external_path_namespaceObject.join(dest, external_path_namespaceObject.basename(source));
  28451. destExists = yield exists(dest);
  28452. }
  28453. if (destExists) {
  28454. if (options.force == null || options.force) {
  28455. yield rmRF(dest);
  28456. }
  28457. else {
  28458. throw new Error('Destination already exists');
  28459. }
  28460. }
  28461. }
  28462. yield mkdirP(external_path_namespaceObject.dirname(dest));
  28463. yield rename(source, dest);
  28464. });
  28465. }
  28466. /**
  28467. * Remove a path recursively with force
  28468. *
  28469. * @param inputPath path to remove
  28470. */
  28471. function rmRF(inputPath) {
  28472. return io_awaiter(this, void 0, void 0, function* () {
  28473. if (IS_WINDOWS) {
  28474. // Check for invalid characters
  28475. // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
  28476. if (/[*"<>|]/.test(inputPath)) {
  28477. throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
  28478. }
  28479. }
  28480. try {
  28481. // note if path does not exist, error is silent
  28482. yield rm(inputPath, {
  28483. force: true,
  28484. maxRetries: 3,
  28485. recursive: true,
  28486. retryDelay: 300
  28487. });
  28488. }
  28489. catch (err) {
  28490. throw new Error(`File was unable to be removed ${err}`);
  28491. }
  28492. });
  28493. }
  28494. /**
  28495. * Make a directory. Creates the full path with folders in between
  28496. * Will throw if it fails
  28497. *
  28498. * @param fsPath path to create
  28499. * @returns Promise<void>
  28500. */
  28501. function mkdirP(fsPath) {
  28502. return io_awaiter(this, void 0, void 0, function* () {
  28503. (0,external_assert_.ok)(fsPath, 'a path argument must be provided');
  28504. yield mkdir(fsPath, { recursive: true });
  28505. });
  28506. }
  28507. /**
  28508. * Returns path of a tool had the tool actually been invoked. Resolves via paths.
  28509. * If you check and the tool does not exist, it will throw.
  28510. *
  28511. * @param tool name of the tool
  28512. * @param check whether to check if tool exists
  28513. * @returns Promise<string> path to tool
  28514. */
  28515. function which(tool, check) {
  28516. return io_awaiter(this, void 0, void 0, function* () {
  28517. if (!tool) {
  28518. throw new Error("parameter 'tool' is required");
  28519. }
  28520. // recursive when check=true
  28521. if (check) {
  28522. const result = yield which(tool, false);
  28523. if (!result) {
  28524. if (IS_WINDOWS) {
  28525. throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
  28526. }
  28527. else {
  28528. throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
  28529. }
  28530. }
  28531. return result;
  28532. }
  28533. const matches = yield findInPath(tool);
  28534. if (matches && matches.length > 0) {
  28535. return matches[0];
  28536. }
  28537. return '';
  28538. });
  28539. }
  28540. /**
  28541. * Returns a list of all occurrences of the given tool on the system path.
  28542. *
  28543. * @returns Promise<string[]> the paths of the tool
  28544. */
  28545. function findInPath(tool) {
  28546. return io_awaiter(this, void 0, void 0, function* () {
  28547. if (!tool) {
  28548. throw new Error("parameter 'tool' is required");
  28549. }
  28550. // build the list of extensions to try
  28551. const extensions = [];
  28552. if (IS_WINDOWS && process.env['PATHEXT']) {
  28553. for (const extension of process.env['PATHEXT'].split(external_path_namespaceObject.delimiter)) {
  28554. if (extension) {
  28555. extensions.push(extension);
  28556. }
  28557. }
  28558. }
  28559. // if it's rooted, return it if exists. otherwise return empty.
  28560. if (isRooted(tool)) {
  28561. const filePath = yield tryGetExecutablePath(tool, extensions);
  28562. if (filePath) {
  28563. return [filePath];
  28564. }
  28565. return [];
  28566. }
  28567. // if any path separators, return empty
  28568. if (tool.includes(external_path_namespaceObject.sep)) {
  28569. return [];
  28570. }
  28571. // build the list of directories
  28572. //
  28573. // Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
  28574. // it feels like we should not do this. Checking the current directory seems like more of a use
  28575. // case of a shell, and the which() function exposed by the toolkit should strive for consistency
  28576. // across platforms.
  28577. const directories = [];
  28578. if (process.env.PATH) {
  28579. for (const p of process.env.PATH.split(external_path_namespaceObject.delimiter)) {
  28580. if (p) {
  28581. directories.push(p);
  28582. }
  28583. }
  28584. }
  28585. // find all matches
  28586. const matches = [];
  28587. for (const directory of directories) {
  28588. const filePath = yield tryGetExecutablePath(external_path_namespaceObject.join(directory, tool), extensions);
  28589. if (filePath) {
  28590. matches.push(filePath);
  28591. }
  28592. }
  28593. return matches;
  28594. });
  28595. }
  28596. function readCopyOptions(options) {
  28597. const force = options.force == null ? true : options.force;
  28598. const recursive = Boolean(options.recursive);
  28599. const copySourceDirectory = options.copySourceDirectory == null
  28600. ? true
  28601. : Boolean(options.copySourceDirectory);
  28602. return { force, recursive, copySourceDirectory };
  28603. }
  28604. function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
  28605. return io_awaiter(this, void 0, void 0, function* () {
  28606. // Ensure there is not a run away recursive copy
  28607. if (currentDepth >= 255)
  28608. return;
  28609. currentDepth++;
  28610. yield mkdirP(destDir);
  28611. const files = yield readdir(sourceDir);
  28612. for (const fileName of files) {
  28613. const srcFile = `${sourceDir}/${fileName}`;
  28614. const destFile = `${destDir}/${fileName}`;
  28615. const srcFileStat = yield lstat(srcFile);
  28616. if (srcFileStat.isDirectory()) {
  28617. // Recurse
  28618. yield cpDirRecursive(srcFile, destFile, currentDepth, force);
  28619. }
  28620. else {
  28621. yield io_copyFile(srcFile, destFile, force);
  28622. }
  28623. }
  28624. // Change the mode for the newly created directory
  28625. yield chmod(destDir, (yield stat(sourceDir)).mode);
  28626. });
  28627. }
  28628. // Buffered file copy
  28629. function io_copyFile(srcFile, destFile, force) {
  28630. return io_awaiter(this, void 0, void 0, function* () {
  28631. if ((yield lstat(srcFile)).isSymbolicLink()) {
  28632. // unlink/re-link it
  28633. try {
  28634. yield lstat(destFile);
  28635. yield unlink(destFile);
  28636. }
  28637. catch (e) {
  28638. // Try to override file permission
  28639. if (e.code === 'EPERM') {
  28640. yield chmod(destFile, '0666');
  28641. yield unlink(destFile);
  28642. }
  28643. // other errors = it doesn't exist, no work to do
  28644. }
  28645. // Copy over symlink
  28646. const symlinkFull = yield readlink(srcFile);
  28647. yield symlink(symlinkFull, destFile, IS_WINDOWS ? 'junction' : null);
  28648. }
  28649. else if (!(yield exists(destFile)) || force) {
  28650. yield copyFile(srcFile, destFile);
  28651. }
  28652. });
  28653. }
  28654. //# sourceMappingURL=io.js.map
  28655. ;// CONCATENATED MODULE: external "timers"
  28656. const external_timers_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("timers");
  28657. ;// CONCATENATED MODULE: ./node_modules/@actions/exec/lib/toolrunner.js
  28658. var toolrunner_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  28659. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  28660. return new (P || (P = Promise))(function (resolve, reject) {
  28661. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  28662. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  28663. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  28664. step((generator = generator.apply(thisArg, _arguments || [])).next());
  28665. });
  28666. };
  28667. /* eslint-disable @typescript-eslint/unbound-method */
  28668. const toolrunner_IS_WINDOWS = process.platform === 'win32';
  28669. /*
  28670. * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
  28671. */
  28672. class ToolRunner extends external_events_.EventEmitter {
  28673. constructor(toolPath, args, options) {
  28674. super();
  28675. if (!toolPath) {
  28676. throw new Error("Parameter 'toolPath' cannot be null or empty.");
  28677. }
  28678. this.toolPath = toolPath;
  28679. this.args = args || [];
  28680. this.options = options || {};
  28681. }
  28682. _debug(message) {
  28683. if (this.options.listeners && this.options.listeners.debug) {
  28684. this.options.listeners.debug(message);
  28685. }
  28686. }
  28687. _getCommandString(options, noPrefix) {
  28688. const toolPath = this._getSpawnFileName();
  28689. const args = this._getSpawnArgs(options);
  28690. let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
  28691. if (toolrunner_IS_WINDOWS) {
  28692. // Windows + cmd file
  28693. if (this._isCmdFile()) {
  28694. cmd += toolPath;
  28695. for (const a of args) {
  28696. cmd += ` ${a}`;
  28697. }
  28698. }
  28699. // Windows + verbatim
  28700. else if (options.windowsVerbatimArguments) {
  28701. cmd += `"${toolPath}"`;
  28702. for (const a of args) {
  28703. cmd += ` ${a}`;
  28704. }
  28705. }
  28706. // Windows (regular)
  28707. else {
  28708. cmd += this._windowsQuoteCmdArg(toolPath);
  28709. for (const a of args) {
  28710. cmd += ` ${this._windowsQuoteCmdArg(a)}`;
  28711. }
  28712. }
  28713. }
  28714. else {
  28715. // OSX/Linux - this can likely be improved with some form of quoting.
  28716. // creating processes on Unix is fundamentally different than Windows.
  28717. // on Unix, execvp() takes an arg array.
  28718. cmd += toolPath;
  28719. for (const a of args) {
  28720. cmd += ` ${a}`;
  28721. }
  28722. }
  28723. return cmd;
  28724. }
  28725. _processLineBuffer(data, strBuffer, onLine) {
  28726. try {
  28727. let s = strBuffer + data.toString();
  28728. let n = s.indexOf(external_os_namespaceObject.EOL);
  28729. while (n > -1) {
  28730. const line = s.substring(0, n);
  28731. onLine(line);
  28732. // the rest of the string ...
  28733. s = s.substring(n + external_os_namespaceObject.EOL.length);
  28734. n = s.indexOf(external_os_namespaceObject.EOL);
  28735. }
  28736. return s;
  28737. }
  28738. catch (err) {
  28739. // streaming lines to console is best effort. Don't fail a build.
  28740. this._debug(`error processing line. Failed with error ${err}`);
  28741. return '';
  28742. }
  28743. }
  28744. _getSpawnFileName() {
  28745. if (toolrunner_IS_WINDOWS) {
  28746. if (this._isCmdFile()) {
  28747. return process.env['COMSPEC'] || 'cmd.exe';
  28748. }
  28749. }
  28750. return this.toolPath;
  28751. }
  28752. _getSpawnArgs(options) {
  28753. if (toolrunner_IS_WINDOWS) {
  28754. if (this._isCmdFile()) {
  28755. let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
  28756. for (const a of this.args) {
  28757. argline += ' ';
  28758. argline += options.windowsVerbatimArguments
  28759. ? a
  28760. : this._windowsQuoteCmdArg(a);
  28761. }
  28762. argline += '"';
  28763. return [argline];
  28764. }
  28765. }
  28766. return this.args;
  28767. }
  28768. _endsWith(str, end) {
  28769. return str.endsWith(end);
  28770. }
  28771. _isCmdFile() {
  28772. const upperToolPath = this.toolPath.toUpperCase();
  28773. return (this._endsWith(upperToolPath, '.CMD') ||
  28774. this._endsWith(upperToolPath, '.BAT'));
  28775. }
  28776. _windowsQuoteCmdArg(arg) {
  28777. // for .exe, apply the normal quoting rules that libuv applies
  28778. if (!this._isCmdFile()) {
  28779. return this._uvQuoteCmdArg(arg);
  28780. }
  28781. // otherwise apply quoting rules specific to the cmd.exe command line parser.
  28782. // the libuv rules are generic and are not designed specifically for cmd.exe
  28783. // command line parser.
  28784. //
  28785. // for a detailed description of the cmd.exe command line parser, refer to
  28786. // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
  28787. // need quotes for empty arg
  28788. if (!arg) {
  28789. return '""';
  28790. }
  28791. // determine whether the arg needs to be quoted
  28792. const cmdSpecialChars = [
  28793. ' ',
  28794. '\t',
  28795. '&',
  28796. '(',
  28797. ')',
  28798. '[',
  28799. ']',
  28800. '{',
  28801. '}',
  28802. '^',
  28803. '=',
  28804. ';',
  28805. '!',
  28806. "'",
  28807. '+',
  28808. ',',
  28809. '`',
  28810. '~',
  28811. '|',
  28812. '<',
  28813. '>',
  28814. '"'
  28815. ];
  28816. let needsQuotes = false;
  28817. for (const char of arg) {
  28818. if (cmdSpecialChars.some(x => x === char)) {
  28819. needsQuotes = true;
  28820. break;
  28821. }
  28822. }
  28823. // short-circuit if quotes not needed
  28824. if (!needsQuotes) {
  28825. return arg;
  28826. }
  28827. // the following quoting rules are very similar to the rules that by libuv applies.
  28828. //
  28829. // 1) wrap the string in quotes
  28830. //
  28831. // 2) double-up quotes - i.e. " => ""
  28832. //
  28833. // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
  28834. // doesn't work well with a cmd.exe command line.
  28835. //
  28836. // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
  28837. // for example, the command line:
  28838. // foo.exe "myarg:""my val"""
  28839. // is parsed by a .NET console app into an arg array:
  28840. // [ "myarg:\"my val\"" ]
  28841. // which is the same end result when applying libuv quoting rules. although the actual
  28842. // command line from libuv quoting rules would look like:
  28843. // foo.exe "myarg:\"my val\""
  28844. //
  28845. // 3) double-up slashes that precede a quote,
  28846. // e.g. hello \world => "hello \world"
  28847. // hello\"world => "hello\\""world"
  28848. // hello\\"world => "hello\\\\""world"
  28849. // hello world\ => "hello world\\"
  28850. //
  28851. // technically this is not required for a cmd.exe command line, or the batch argument parser.
  28852. // the reasons for including this as a .cmd quoting rule are:
  28853. //
  28854. // a) this is optimized for the scenario where the argument is passed from the .cmd file to an
  28855. // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
  28856. //
  28857. // b) it's what we've been doing previously (by deferring to node default behavior) and we
  28858. // haven't heard any complaints about that aspect.
  28859. //
  28860. // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
  28861. // escaped when used on the command line directly - even though within a .cmd file % can be escaped
  28862. // by using %%.
  28863. //
  28864. // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
  28865. // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
  28866. //
  28867. // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
  28868. // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
  28869. // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
  28870. // to an external program.
  28871. //
  28872. // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
  28873. // % can be escaped within a .cmd file.
  28874. let reverse = '"';
  28875. let quoteHit = true;
  28876. for (let i = arg.length; i > 0; i--) {
  28877. // walk the string in reverse
  28878. reverse += arg[i - 1];
  28879. if (quoteHit && arg[i - 1] === '\\') {
  28880. reverse += '\\'; // double the slash
  28881. }
  28882. else if (arg[i - 1] === '"') {
  28883. quoteHit = true;
  28884. reverse += '"'; // double the quote
  28885. }
  28886. else {
  28887. quoteHit = false;
  28888. }
  28889. }
  28890. reverse += '"';
  28891. return reverse.split('').reverse().join('');
  28892. }
  28893. _uvQuoteCmdArg(arg) {
  28894. // Tool runner wraps child_process.spawn() and needs to apply the same quoting as
  28895. // Node in certain cases where the undocumented spawn option windowsVerbatimArguments
  28896. // is used.
  28897. //
  28898. // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
  28899. // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
  28900. // pasting copyright notice from Node within this function:
  28901. //
  28902. // Copyright Joyent, Inc. and other Node contributors. All rights reserved.
  28903. //
  28904. // Permission is hereby granted, free of charge, to any person obtaining a copy
  28905. // of this software and associated documentation files (the "Software"), to
  28906. // deal in the Software without restriction, including without limitation the
  28907. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  28908. // sell copies of the Software, and to permit persons to whom the Software is
  28909. // furnished to do so, subject to the following conditions:
  28910. //
  28911. // The above copyright notice and this permission notice shall be included in
  28912. // all copies or substantial portions of the Software.
  28913. //
  28914. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28915. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  28916. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  28917. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  28918. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  28919. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  28920. // IN THE SOFTWARE.
  28921. if (!arg) {
  28922. // Need double quotation for empty argument
  28923. return '""';
  28924. }
  28925. if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
  28926. // No quotation needed
  28927. return arg;
  28928. }
  28929. if (!arg.includes('"') && !arg.includes('\\')) {
  28930. // No embedded double quotes or backslashes, so I can just wrap
  28931. // quote marks around the whole thing.
  28932. return `"${arg}"`;
  28933. }
  28934. // Expected input/output:
  28935. // input : hello"world
  28936. // output: "hello\"world"
  28937. // input : hello""world
  28938. // output: "hello\"\"world"
  28939. // input : hello\world
  28940. // output: hello\world
  28941. // input : hello\\world
  28942. // output: hello\\world
  28943. // input : hello\"world
  28944. // output: "hello\\\"world"
  28945. // input : hello\\"world
  28946. // output: "hello\\\\\"world"
  28947. // input : hello world\
  28948. // output: "hello world\\" - note the comment in libuv actually reads "hello world\"
  28949. // but it appears the comment is wrong, it should be "hello world\\"
  28950. let reverse = '"';
  28951. let quoteHit = true;
  28952. for (let i = arg.length; i > 0; i--) {
  28953. // walk the string in reverse
  28954. reverse += arg[i - 1];
  28955. if (quoteHit && arg[i - 1] === '\\') {
  28956. reverse += '\\';
  28957. }
  28958. else if (arg[i - 1] === '"') {
  28959. quoteHit = true;
  28960. reverse += '\\';
  28961. }
  28962. else {
  28963. quoteHit = false;
  28964. }
  28965. }
  28966. reverse += '"';
  28967. return reverse.split('').reverse().join('');
  28968. }
  28969. _cloneExecOptions(options) {
  28970. options = options || {};
  28971. const result = {
  28972. cwd: options.cwd || process.cwd(),
  28973. env: options.env || process.env,
  28974. silent: options.silent || false,
  28975. windowsVerbatimArguments: options.windowsVerbatimArguments || false,
  28976. failOnStdErr: options.failOnStdErr || false,
  28977. ignoreReturnCode: options.ignoreReturnCode || false,
  28978. delay: options.delay || 10000
  28979. };
  28980. result.outStream = options.outStream || process.stdout;
  28981. result.errStream = options.errStream || process.stderr;
  28982. return result;
  28983. }
  28984. _getSpawnOptions(options, toolPath) {
  28985. options = options || {};
  28986. const result = {};
  28987. result.cwd = options.cwd;
  28988. result.env = options.env;
  28989. result['windowsVerbatimArguments'] =
  28990. options.windowsVerbatimArguments || this._isCmdFile();
  28991. if (options.windowsVerbatimArguments) {
  28992. result.argv0 = `"${toolPath}"`;
  28993. }
  28994. return result;
  28995. }
  28996. /**
  28997. * Exec a tool.
  28998. * Output will be streamed to the live console.
  28999. * Returns promise with return code
  29000. *
  29001. * @param tool path to tool to exec
  29002. * @param options optional exec options. See ExecOptions
  29003. * @returns number
  29004. */
  29005. exec() {
  29006. return toolrunner_awaiter(this, void 0, void 0, function* () {
  29007. // root the tool path if it is unrooted and contains relative pathing
  29008. if (!isRooted(this.toolPath) &&
  29009. (this.toolPath.includes('/') ||
  29010. (toolrunner_IS_WINDOWS && this.toolPath.includes('\\')))) {
  29011. // prefer options.cwd if it is specified, however options.cwd may also need to be rooted
  29012. this.toolPath = external_path_namespaceObject.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath);
  29013. }
  29014. // if the tool is only a file name, then resolve it from the PATH
  29015. // otherwise verify it exists (add extension on Windows if necessary)
  29016. this.toolPath = yield which(this.toolPath, true);
  29017. return new Promise((resolve, reject) => toolrunner_awaiter(this, void 0, void 0, function* () {
  29018. this._debug(`exec tool: ${this.toolPath}`);
  29019. this._debug('arguments:');
  29020. for (const arg of this.args) {
  29021. this._debug(` ${arg}`);
  29022. }
  29023. const optionsNonNull = this._cloneExecOptions(this.options);
  29024. if (!optionsNonNull.silent && optionsNonNull.outStream) {
  29025. optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + external_os_namespaceObject.EOL);
  29026. }
  29027. const state = new ExecState(optionsNonNull, this.toolPath);
  29028. state.on('debug', (message) => {
  29029. this._debug(message);
  29030. });
  29031. if (this.options.cwd && !(yield exists(this.options.cwd))) {
  29032. return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
  29033. }
  29034. const fileName = this._getSpawnFileName();
  29035. const cp = external_child_process_namespaceObject.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
  29036. let stdbuffer = '';
  29037. if (cp.stdout) {
  29038. cp.stdout.on('data', (data) => {
  29039. if (this.options.listeners && this.options.listeners.stdout) {
  29040. this.options.listeners.stdout(data);
  29041. }
  29042. if (!optionsNonNull.silent && optionsNonNull.outStream) {
  29043. optionsNonNull.outStream.write(data);
  29044. }
  29045. stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
  29046. if (this.options.listeners && this.options.listeners.stdline) {
  29047. this.options.listeners.stdline(line);
  29048. }
  29049. });
  29050. });
  29051. }
  29052. let errbuffer = '';
  29053. if (cp.stderr) {
  29054. cp.stderr.on('data', (data) => {
  29055. state.processStderr = true;
  29056. if (this.options.listeners && this.options.listeners.stderr) {
  29057. this.options.listeners.stderr(data);
  29058. }
  29059. if (!optionsNonNull.silent &&
  29060. optionsNonNull.errStream &&
  29061. optionsNonNull.outStream) {
  29062. const s = optionsNonNull.failOnStdErr
  29063. ? optionsNonNull.errStream
  29064. : optionsNonNull.outStream;
  29065. s.write(data);
  29066. }
  29067. errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
  29068. if (this.options.listeners && this.options.listeners.errline) {
  29069. this.options.listeners.errline(line);
  29070. }
  29071. });
  29072. });
  29073. }
  29074. cp.on('error', (err) => {
  29075. state.processError = err.message;
  29076. state.processExited = true;
  29077. state.processClosed = true;
  29078. state.CheckComplete();
  29079. });
  29080. cp.on('exit', (code) => {
  29081. state.processExitCode = code;
  29082. state.processExited = true;
  29083. this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
  29084. state.CheckComplete();
  29085. });
  29086. cp.on('close', (code) => {
  29087. state.processExitCode = code;
  29088. state.processExited = true;
  29089. state.processClosed = true;
  29090. this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
  29091. state.CheckComplete();
  29092. });
  29093. state.on('done', (error, exitCode) => {
  29094. if (stdbuffer.length > 0) {
  29095. this.emit('stdline', stdbuffer);
  29096. }
  29097. if (errbuffer.length > 0) {
  29098. this.emit('errline', errbuffer);
  29099. }
  29100. cp.removeAllListeners();
  29101. if (error) {
  29102. reject(error);
  29103. }
  29104. else {
  29105. resolve(exitCode);
  29106. }
  29107. });
  29108. if (this.options.input) {
  29109. if (!cp.stdin) {
  29110. throw new Error('child process missing stdin');
  29111. }
  29112. cp.stdin.end(this.options.input);
  29113. }
  29114. }));
  29115. });
  29116. }
  29117. }
  29118. /**
  29119. * Convert an arg string to an array of args. Handles escaping
  29120. *
  29121. * @param argString string of arguments
  29122. * @returns string[] array of arguments
  29123. */
  29124. function argStringToArray(argString) {
  29125. const args = [];
  29126. let inQuotes = false;
  29127. let escaped = false;
  29128. let arg = '';
  29129. function append(c) {
  29130. // we only escape double quotes.
  29131. if (escaped && c !== '"') {
  29132. arg += '\\';
  29133. }
  29134. arg += c;
  29135. escaped = false;
  29136. }
  29137. for (let i = 0; i < argString.length; i++) {
  29138. const c = argString.charAt(i);
  29139. if (c === '"') {
  29140. if (!escaped) {
  29141. inQuotes = !inQuotes;
  29142. }
  29143. else {
  29144. append(c);
  29145. }
  29146. continue;
  29147. }
  29148. if (c === '\\' && escaped) {
  29149. append(c);
  29150. continue;
  29151. }
  29152. if (c === '\\' && inQuotes) {
  29153. escaped = true;
  29154. continue;
  29155. }
  29156. if (c === ' ' && !inQuotes) {
  29157. if (arg.length > 0) {
  29158. args.push(arg);
  29159. arg = '';
  29160. }
  29161. continue;
  29162. }
  29163. append(c);
  29164. }
  29165. if (arg.length > 0) {
  29166. args.push(arg.trim());
  29167. }
  29168. return args;
  29169. }
  29170. class ExecState extends external_events_.EventEmitter {
  29171. constructor(options, toolPath) {
  29172. super();
  29173. this.processClosed = false; // tracks whether the process has exited and stdio is closed
  29174. this.processError = '';
  29175. this.processExitCode = 0;
  29176. this.processExited = false; // tracks whether the process has exited
  29177. this.processStderr = false; // tracks whether stderr was written to
  29178. this.delay = 10000; // 10 seconds
  29179. this.done = false;
  29180. this.timeout = null;
  29181. if (!toolPath) {
  29182. throw new Error('toolPath must not be empty');
  29183. }
  29184. this.options = options;
  29185. this.toolPath = toolPath;
  29186. if (options.delay) {
  29187. this.delay = options.delay;
  29188. }
  29189. }
  29190. CheckComplete() {
  29191. if (this.done) {
  29192. return;
  29193. }
  29194. if (this.processClosed) {
  29195. this._setResult();
  29196. }
  29197. else if (this.processExited) {
  29198. this.timeout = (0,external_timers_namespaceObject.setTimeout)(ExecState.HandleTimeout, this.delay, this);
  29199. }
  29200. }
  29201. _debug(message) {
  29202. this.emit('debug', message);
  29203. }
  29204. _setResult() {
  29205. // determine whether there is an error
  29206. let error;
  29207. if (this.processExited) {
  29208. if (this.processError) {
  29209. error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
  29210. }
  29211. else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
  29212. error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
  29213. }
  29214. else if (this.processStderr && this.options.failOnStdErr) {
  29215. error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
  29216. }
  29217. }
  29218. // clear the timeout
  29219. if (this.timeout) {
  29220. clearTimeout(this.timeout);
  29221. this.timeout = null;
  29222. }
  29223. this.done = true;
  29224. this.emit('done', error, this.processExitCode);
  29225. }
  29226. static HandleTimeout(state) {
  29227. if (state.done) {
  29228. return;
  29229. }
  29230. if (!state.processClosed && state.processExited) {
  29231. const message = `The STDIO streams did not close within ${state.delay / 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
  29232. state._debug(message);
  29233. }
  29234. state._setResult();
  29235. }
  29236. }
  29237. //# sourceMappingURL=toolrunner.js.map
  29238. ;// CONCATENATED MODULE: ./node_modules/@actions/exec/lib/exec.js
  29239. var exec_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  29240. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  29241. return new (P || (P = Promise))(function (resolve, reject) {
  29242. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  29243. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  29244. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  29245. step((generator = generator.apply(thisArg, _arguments || [])).next());
  29246. });
  29247. };
  29248. /**
  29249. * Exec a command.
  29250. * Output will be streamed to the live console.
  29251. * Returns promise with return code
  29252. *
  29253. * @param commandLine command to execute (can include additional args). Must be correctly escaped.
  29254. * @param args optional arguments for tool. Escaping is handled by the lib.
  29255. * @param options optional exec options. See ExecOptions
  29256. * @returns Promise<number> exit code
  29257. */
  29258. function exec_exec(commandLine, args, options) {
  29259. return exec_awaiter(this, void 0, void 0, function* () {
  29260. const commandArgs = argStringToArray(commandLine);
  29261. if (commandArgs.length === 0) {
  29262. throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
  29263. }
  29264. // Path to tool to execute should be first arg
  29265. const toolPath = commandArgs[0];
  29266. args = commandArgs.slice(1).concat(args || []);
  29267. const runner = new ToolRunner(toolPath, args, options);
  29268. return runner.exec();
  29269. });
  29270. }
  29271. /**
  29272. * Exec a command and get the output.
  29273. * Output will be streamed to the live console.
  29274. * Returns promise with the exit code and collected stdout and stderr
  29275. *
  29276. * @param commandLine command to execute (can include additional args). Must be correctly escaped.
  29277. * @param args optional arguments for tool. Escaping is handled by the lib.
  29278. * @param options optional exec options. See ExecOptions
  29279. * @returns Promise<ExecOutput> exit code, stdout, and stderr
  29280. */
  29281. function getExecOutput(commandLine, args, options) {
  29282. return exec_awaiter(this, void 0, void 0, function* () {
  29283. var _a, _b;
  29284. let stdout = '';
  29285. let stderr = '';
  29286. //Using string decoder covers the case where a mult-byte character is split
  29287. const stdoutDecoder = new StringDecoder('utf8');
  29288. const stderrDecoder = new StringDecoder('utf8');
  29289. const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
  29290. const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
  29291. const stdErrListener = (data) => {
  29292. stderr += stderrDecoder.write(data);
  29293. if (originalStdErrListener) {
  29294. originalStdErrListener(data);
  29295. }
  29296. };
  29297. const stdOutListener = (data) => {
  29298. stdout += stdoutDecoder.write(data);
  29299. if (originalStdoutListener) {
  29300. originalStdoutListener(data);
  29301. }
  29302. };
  29303. const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
  29304. const exitCode = yield exec_exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
  29305. //flush any remaining characters
  29306. stdout += stdoutDecoder.end();
  29307. stderr += stderrDecoder.end();
  29308. return {
  29309. exitCode,
  29310. stdout,
  29311. stderr
  29312. };
  29313. });
  29314. }
  29315. //# sourceMappingURL=exec.js.map
  29316. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/platform.js
  29317. var platform_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  29318. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  29319. return new (P || (P = Promise))(function (resolve, reject) {
  29320. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  29321. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  29322. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  29323. step((generator = generator.apply(thisArg, _arguments || [])).next());
  29324. });
  29325. };
  29326. const getWindowsInfo = () => platform_awaiter(void 0, void 0, void 0, function* () {
  29327. const { stdout: version } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"', undefined, {
  29328. silent: true
  29329. });
  29330. const { stdout: name } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"', undefined, {
  29331. silent: true
  29332. });
  29333. return {
  29334. name: name.trim(),
  29335. version: version.trim()
  29336. };
  29337. });
  29338. const getMacOsInfo = () => platform_awaiter(void 0, void 0, void 0, function* () {
  29339. var _a, _b, _c, _d;
  29340. const { stdout } = yield exec.getExecOutput('sw_vers', undefined, {
  29341. silent: true
  29342. });
  29343. const version = (_b = (_a = stdout.match(/ProductVersion:\s*(.+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
  29344. const name = (_d = (_c = stdout.match(/ProductName:\s*(.+)/)) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '';
  29345. return {
  29346. name,
  29347. version
  29348. };
  29349. });
  29350. const getLinuxInfo = () => platform_awaiter(void 0, void 0, void 0, function* () {
  29351. const { stdout } = yield exec.getExecOutput('lsb_release', ['-i', '-r', '-s'], {
  29352. silent: true
  29353. });
  29354. const [name, version] = stdout.trim().split('\n');
  29355. return {
  29356. name,
  29357. version
  29358. };
  29359. });
  29360. const platform = external_os_namespaceObject.platform();
  29361. const arch = external_os_namespaceObject.arch();
  29362. const isWindows = platform === 'win32';
  29363. const isMacOS = platform === 'darwin';
  29364. const isLinux = platform === 'linux';
  29365. function getDetails() {
  29366. return platform_awaiter(this, void 0, void 0, function* () {
  29367. return Object.assign(Object.assign({}, (yield (isWindows
  29368. ? getWindowsInfo()
  29369. : isMacOS
  29370. ? getMacOsInfo()
  29371. : getLinuxInfo()))), { platform,
  29372. arch,
  29373. isWindows,
  29374. isMacOS,
  29375. isLinux });
  29376. });
  29377. }
  29378. //# sourceMappingURL=platform.js.map
  29379. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/core.js
  29380. var core_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  29381. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  29382. return new (P || (P = Promise))(function (resolve, reject) {
  29383. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  29384. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  29385. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  29386. step((generator = generator.apply(thisArg, _arguments || [])).next());
  29387. });
  29388. };
  29389. /**
  29390. * The code to exit an action
  29391. */
  29392. var ExitCode;
  29393. (function (ExitCode) {
  29394. /**
  29395. * A code indicating that the action was successful
  29396. */
  29397. ExitCode[ExitCode["Success"] = 0] = "Success";
  29398. /**
  29399. * A code indicating that the action was a failure
  29400. */
  29401. ExitCode[ExitCode["Failure"] = 1] = "Failure";
  29402. })(ExitCode || (ExitCode = {}));
  29403. //-----------------------------------------------------------------------
  29404. // Variables
  29405. //-----------------------------------------------------------------------
  29406. /**
  29407. * Sets env variable for this action and future actions in the job
  29408. * @param name the name of the variable to set
  29409. * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
  29410. */
  29411. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  29412. function exportVariable(name, val) {
  29413. const convertedVal = toCommandValue(val);
  29414. process.env[name] = convertedVal;
  29415. const filePath = process.env['GITHUB_ENV'] || '';
  29416. if (filePath) {
  29417. return issueFileCommand('ENV', prepareKeyValueMessage(name, val));
  29418. }
  29419. issueCommand('set-env', { name }, convertedVal);
  29420. }
  29421. /**
  29422. * Registers a secret which will get masked from logs
  29423. *
  29424. * @param secret - Value of the secret to be masked
  29425. * @remarks
  29426. * This function instructs the Actions runner to mask the specified value in any
  29427. * logs produced during the workflow run. Once registered, the secret value will
  29428. * be replaced with asterisks (***) whenever it appears in console output, logs,
  29429. * or error messages.
  29430. *
  29431. * This is useful for protecting sensitive information such as:
  29432. * - API keys
  29433. * - Access tokens
  29434. * - Authentication credentials
  29435. * - URL parameters containing signatures (SAS tokens)
  29436. *
  29437. * Note that masking only affects future logs; any previous appearances of the
  29438. * secret in logs before calling this function will remain unmasked.
  29439. *
  29440. * @example
  29441. * ```typescript
  29442. * // Register an API token as a secret
  29443. * const apiToken = "abc123xyz456";
  29444. * setSecret(apiToken);
  29445. *
  29446. * // Now any logs containing this value will show *** instead
  29447. * console.log(`Using token: ${apiToken}`); // Outputs: "Using token: ***"
  29448. * ```
  29449. */
  29450. function core_setSecret(secret) {
  29451. command_issueCommand('add-mask', {}, secret);
  29452. }
  29453. /**
  29454. * Prepends inputPath to the PATH (for this action and future actions)
  29455. * @param inputPath
  29456. */
  29457. function addPath(inputPath) {
  29458. const filePath = process.env['GITHUB_PATH'] || '';
  29459. if (filePath) {
  29460. issueFileCommand('PATH', inputPath);
  29461. }
  29462. else {
  29463. issueCommand('add-path', {}, inputPath);
  29464. }
  29465. process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
  29466. }
  29467. /**
  29468. * Gets the value of an input.
  29469. * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
  29470. * Returns an empty string if the value is not defined.
  29471. *
  29472. * @param name name of the input to get
  29473. * @param options optional. See InputOptions.
  29474. * @returns string
  29475. */
  29476. function getInput(name, options) {
  29477. const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
  29478. if (options && options.required && !val) {
  29479. throw new Error(`Input required and not supplied: ${name}`);
  29480. }
  29481. if (options && options.trimWhitespace === false) {
  29482. return val;
  29483. }
  29484. return val.trim();
  29485. }
  29486. /**
  29487. * Gets the values of an multiline input. Each value is also trimmed.
  29488. *
  29489. * @param name name of the input to get
  29490. * @param options optional. See InputOptions.
  29491. * @returns string[]
  29492. *
  29493. */
  29494. function getMultilineInput(name, options) {
  29495. const inputs = getInput(name, options)
  29496. .split('\n')
  29497. .filter(x => x !== '');
  29498. if (options && options.trimWhitespace === false) {
  29499. return inputs;
  29500. }
  29501. return inputs.map(input => input.trim());
  29502. }
  29503. /**
  29504. * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
  29505. * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
  29506. * The return value is also in boolean type.
  29507. * ref: https://yaml.org/spec/1.2/spec.html#id2804923
  29508. *
  29509. * @param name name of the input to get
  29510. * @param options optional. See InputOptions.
  29511. * @returns boolean
  29512. */
  29513. function getBooleanInput(name, options) {
  29514. const trueValue = ['true', 'True', 'TRUE'];
  29515. const falseValue = ['false', 'False', 'FALSE'];
  29516. const val = getInput(name, options);
  29517. if (trueValue.includes(val))
  29518. return true;
  29519. if (falseValue.includes(val))
  29520. return false;
  29521. throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
  29522. `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
  29523. }
  29524. /**
  29525. * Sets the value of an output.
  29526. *
  29527. * @param name name of the output to set
  29528. * @param value value to store. Non-string values will be converted to a string via JSON.stringify
  29529. */
  29530. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  29531. function setOutput(name, value) {
  29532. const filePath = process.env['GITHUB_OUTPUT'] || '';
  29533. if (filePath) {
  29534. return file_command_issueFileCommand('OUTPUT', file_command_prepareKeyValueMessage(name, value));
  29535. }
  29536. process.stdout.write(external_os_namespaceObject.EOL);
  29537. command_issueCommand('set-output', { name }, utils_toCommandValue(value));
  29538. }
  29539. /**
  29540. * Enables or disables the echoing of commands into stdout for the rest of the step.
  29541. * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
  29542. *
  29543. */
  29544. function setCommandEcho(enabled) {
  29545. issue('echo', enabled ? 'on' : 'off');
  29546. }
  29547. //-----------------------------------------------------------------------
  29548. // Results
  29549. //-----------------------------------------------------------------------
  29550. /**
  29551. * Sets the action status to failed.
  29552. * When the action exits it will be with an exit code of 1
  29553. * @param message add error issue message
  29554. */
  29555. function setFailed(message) {
  29556. process.exitCode = ExitCode.Failure;
  29557. error(message);
  29558. }
  29559. //-----------------------------------------------------------------------
  29560. // Logging Commands
  29561. //-----------------------------------------------------------------------
  29562. /**
  29563. * Gets whether Actions Step Debug is on or not
  29564. */
  29565. function isDebug() {
  29566. return process.env['RUNNER_DEBUG'] === '1';
  29567. }
  29568. /**
  29569. * Writes debug message to user log
  29570. * @param message debug message
  29571. */
  29572. function core_debug(message) {
  29573. command_issueCommand('debug', {}, message);
  29574. }
  29575. /**
  29576. * Adds an error issue
  29577. * @param message error issue message. Errors will be converted to string via toString()
  29578. * @param properties optional properties to add to the annotation.
  29579. */
  29580. function error(message, properties = {}) {
  29581. command_issueCommand('error', utils_toCommandProperties(properties), message instanceof Error ? message.toString() : message);
  29582. }
  29583. /**
  29584. * Adds a warning issue
  29585. * @param message warning issue message. Errors will be converted to string via toString()
  29586. * @param properties optional properties to add to the annotation.
  29587. */
  29588. function warning(message, properties = {}) {
  29589. command_issueCommand('warning', utils_toCommandProperties(properties), message instanceof Error ? message.toString() : message);
  29590. }
  29591. /**
  29592. * Adds a notice issue
  29593. * @param message notice issue message. Errors will be converted to string via toString()
  29594. * @param properties optional properties to add to the annotation.
  29595. */
  29596. function notice(message, properties = {}) {
  29597. issueCommand('notice', toCommandProperties(properties), message instanceof Error ? message.toString() : message);
  29598. }
  29599. /**
  29600. * Writes info to log with console.log.
  29601. * @param message info message
  29602. */
  29603. function info(message) {
  29604. process.stdout.write(message + external_os_namespaceObject.EOL);
  29605. }
  29606. /**
  29607. * Begin an output group.
  29608. *
  29609. * Output until the next `groupEnd` will be foldable in this group
  29610. *
  29611. * @param name The name of the output group
  29612. */
  29613. function startGroup(name) {
  29614. command_issue('group', name);
  29615. }
  29616. /**
  29617. * End an output group.
  29618. */
  29619. function endGroup() {
  29620. command_issue('endgroup');
  29621. }
  29622. /**
  29623. * Wrap an asynchronous function call in a group.
  29624. *
  29625. * Returns the same type as the function itself.
  29626. *
  29627. * @param name The name of the group
  29628. * @param fn The function to wrap in the group
  29629. */
  29630. function group(name, fn) {
  29631. return core_awaiter(this, void 0, void 0, function* () {
  29632. startGroup(name);
  29633. let result;
  29634. try {
  29635. result = yield fn();
  29636. }
  29637. finally {
  29638. endGroup();
  29639. }
  29640. return result;
  29641. });
  29642. }
  29643. //-----------------------------------------------------------------------
  29644. // Wrapper action state
  29645. //-----------------------------------------------------------------------
  29646. /**
  29647. * Saves state for current action, the state can only be retrieved by this action's post job execution.
  29648. *
  29649. * @param name name of the state to store
  29650. * @param value value to store. Non-string values will be converted to a string via JSON.stringify
  29651. */
  29652. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  29653. function saveState(name, value) {
  29654. const filePath = process.env['GITHUB_STATE'] || '';
  29655. if (filePath) {
  29656. return file_command_issueFileCommand('STATE', file_command_prepareKeyValueMessage(name, value));
  29657. }
  29658. command_issueCommand('save-state', { name }, utils_toCommandValue(value));
  29659. }
  29660. /**
  29661. * Gets the value of an state set by this action's main execution.
  29662. *
  29663. * @param name name of the state to get
  29664. * @returns string
  29665. */
  29666. function getState(name) {
  29667. return process.env[`STATE_${name}`] || '';
  29668. }
  29669. function getIDToken(aud) {
  29670. return core_awaiter(this, void 0, void 0, function* () {
  29671. return yield OidcClient.getIDToken(aud);
  29672. });
  29673. }
  29674. /**
  29675. * Summary exports
  29676. */
  29677. /**
  29678. * @deprecated use core.summary
  29679. */
  29680. /**
  29681. * Path exports
  29682. */
  29683. /**
  29684. * Platform utilities exports
  29685. */
  29686. //# sourceMappingURL=core.js.map
  29687. ;// CONCATENATED MODULE: ./src/fs-helper.ts
  29688. function directoryExistsSync(path, required) {
  29689. if (!path) {
  29690. throw new Error("Arg 'path' must not be empty");
  29691. }
  29692. let stats;
  29693. try {
  29694. stats = external_fs_namespaceObject.statSync(path);
  29695. }
  29696. catch (error) {
  29697. if (error?.code === 'ENOENT') {
  29698. if (!required) {
  29699. return false;
  29700. }
  29701. throw new Error(`Directory '${path}' does not exist`);
  29702. }
  29703. throw new Error(`Encountered an error when checking whether path '${path}' exists: ${error?.message ?? error}`);
  29704. }
  29705. if (stats.isDirectory()) {
  29706. return true;
  29707. }
  29708. else if (!required) {
  29709. return false;
  29710. }
  29711. throw new Error(`Directory '${path}' does not exist`);
  29712. }
  29713. function existsSync(path) {
  29714. if (!path) {
  29715. throw new Error("Arg 'path' must not be empty");
  29716. }
  29717. try {
  29718. fs.statSync(path);
  29719. }
  29720. catch (error) {
  29721. if (error?.code === 'ENOENT') {
  29722. return false;
  29723. }
  29724. throw new Error(`Encountered an error when checking whether path '${path}' exists: ${error?.message ?? error}`);
  29725. }
  29726. return true;
  29727. }
  29728. function fileExistsSync(path) {
  29729. if (!path) {
  29730. throw new Error("Arg 'path' must not be empty");
  29731. }
  29732. let stats;
  29733. try {
  29734. stats = external_fs_namespaceObject.statSync(path);
  29735. }
  29736. catch (error) {
  29737. if (error?.code === 'ENOENT') {
  29738. return false;
  29739. }
  29740. throw new Error(`Encountered an error when checking whether path '${path}' exists: ${error?.message ?? error}`);
  29741. }
  29742. if (!stats.isDirectory()) {
  29743. return true;
  29744. }
  29745. return false;
  29746. }
  29747. ;// CONCATENATED MODULE: ./src/regexp-helper.ts
  29748. function regexp_helper_escape(value) {
  29749. return value.replace(/[^a-zA-Z0-9_]/g, x => {
  29750. return `\\${x}`;
  29751. });
  29752. }
  29753. ;// CONCATENATED MODULE: ./src/state-helper.ts
  29754. /**
  29755. * Indicates whether the POST action is running
  29756. */
  29757. const IsPost = !!getState('isPost');
  29758. /**
  29759. * The repository path for the POST action. The value is empty during the MAIN action.
  29760. */
  29761. const RepositoryPath = getState('repositoryPath');
  29762. /**
  29763. * The set-safe-directory for the POST action. The value is set if input: 'safe-directory' is set during the MAIN action.
  29764. */
  29765. const PostSetSafeDirectory = getState('setSafeDirectory') === 'true';
  29766. /**
  29767. * The SSH key path for the POST action. The value is empty during the MAIN action.
  29768. */
  29769. const SshKeyPath = getState('sshKeyPath');
  29770. /**
  29771. * The SSH known hosts path for the POST action. The value is empty during the MAIN action.
  29772. */
  29773. const SshKnownHostsPath = getState('sshKnownHostsPath');
  29774. /**
  29775. * Save the repository path so the POST action can retrieve the value.
  29776. */
  29777. function setRepositoryPath(repositoryPath) {
  29778. saveState('repositoryPath', repositoryPath);
  29779. }
  29780. /**
  29781. * Save the SSH key path so the POST action can retrieve the value.
  29782. */
  29783. function setSshKeyPath(sshKeyPath) {
  29784. saveState('sshKeyPath', sshKeyPath);
  29785. }
  29786. /**
  29787. * Save the SSH known hosts path so the POST action can retrieve the value.
  29788. */
  29789. function setSshKnownHostsPath(sshKnownHostsPath) {
  29790. saveState('sshKnownHostsPath', sshKnownHostsPath);
  29791. }
  29792. /**
  29793. * Save the set-safe-directory input so the POST action can retrieve the value.
  29794. */
  29795. function setSafeDirectory() {
  29796. saveState('setSafeDirectory', 'true');
  29797. }
  29798. // Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic.
  29799. // This is necessary since we don't have a separate entry point.
  29800. if (!IsPost) {
  29801. saveState('isPost', 'true');
  29802. }
  29803. ;// CONCATENATED MODULE: external "url"
  29804. const external_url_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("url");
  29805. ;// CONCATENATED MODULE: ./src/url-helper.ts
  29806. function getFetchUrl(settings) {
  29807. external_assert_.ok(settings.repositoryOwner, 'settings.repositoryOwner must be defined');
  29808. external_assert_.ok(settings.repositoryName, 'settings.repositoryName must be defined');
  29809. const serviceUrl = getServerUrl(settings.githubServerUrl);
  29810. const encodedOwner = encodeURIComponent(settings.repositoryOwner);
  29811. const encodedName = encodeURIComponent(settings.repositoryName);
  29812. if (settings.sshKey) {
  29813. const user = settings.sshUser.length > 0 ? settings.sshUser : 'git';
  29814. return `${user}@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
  29815. }
  29816. // "origin" is SCHEME://HOSTNAME[:PORT]
  29817. return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
  29818. }
  29819. function getServerUrl(url) {
  29820. let resolvedUrl = process.env['GITHUB_SERVER_URL'] || 'https://github.com';
  29821. if (hasContent(url, WhitespaceMode.Trim)) {
  29822. resolvedUrl = url;
  29823. }
  29824. return new external_url_namespaceObject.URL(resolvedUrl);
  29825. }
  29826. function getServerApiUrl(url) {
  29827. if (hasContent(url, WhitespaceMode.Trim)) {
  29828. let serverUrl = getServerUrl(url);
  29829. if (isGhes(url)) {
  29830. serverUrl.pathname = 'api/v3';
  29831. }
  29832. else {
  29833. serverUrl.hostname = 'api.' + serverUrl.hostname;
  29834. }
  29835. return pruneSuffix(serverUrl.toString(), '/');
  29836. }
  29837. return process.env['GITHUB_API_URL'] || 'https://api.github.com';
  29838. }
  29839. function isGhes(url) {
  29840. const ghUrl = new external_url_namespaceObject.URL(url || process.env['GITHUB_SERVER_URL'] || 'https://github.com');
  29841. const hostname = ghUrl.hostname.trimEnd().toUpperCase();
  29842. const isGitHubHost = hostname === 'GITHUB.COM';
  29843. const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
  29844. const isLocalHost = hostname.endsWith('.LOCALHOST');
  29845. return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
  29846. }
  29847. function pruneSuffix(text, suffix) {
  29848. if (hasContent(suffix, WhitespaceMode.Preserve) && text?.endsWith(suffix)) {
  29849. return text.substring(0, text.length - suffix.length);
  29850. }
  29851. return text;
  29852. }
  29853. var WhitespaceMode;
  29854. (function (WhitespaceMode) {
  29855. WhitespaceMode[WhitespaceMode["Trim"] = 0] = "Trim";
  29856. WhitespaceMode[WhitespaceMode["Preserve"] = 1] = "Preserve";
  29857. })(WhitespaceMode || (WhitespaceMode = {}));
  29858. function hasContent(text, whitespaceMode) {
  29859. let refinedText = text ?? '';
  29860. if (whitespaceMode == WhitespaceMode.Trim) {
  29861. refinedText = refinedText.trim();
  29862. }
  29863. return refinedText.length > 0;
  29864. }
  29865. ;// CONCATENATED MODULE: ./src/git-auth-helper.ts
  29866. const git_auth_helper_IS_WINDOWS = process.platform === 'win32';
  29867. const SSH_COMMAND_KEY = 'core.sshCommand';
  29868. function createAuthHelper(git, settings) {
  29869. return new GitAuthHelper(git, settings);
  29870. }
  29871. class GitAuthHelper {
  29872. git;
  29873. settings;
  29874. tokenConfigKey;
  29875. tokenConfigValue;
  29876. tokenPlaceholderConfigValue;
  29877. insteadOfKey;
  29878. insteadOfValues = [];
  29879. sshCommand = '';
  29880. sshKeyPath = '';
  29881. sshKnownHostsPath = '';
  29882. temporaryHomePath = '';
  29883. credentialsConfigPath = ''; // Path to separate credentials config file in RUNNER_TEMP
  29884. constructor(gitCommandManager, gitSourceSettings) {
  29885. this.git = gitCommandManager;
  29886. this.settings = gitSourceSettings || {};
  29887. // Token auth header
  29888. const serverUrl = getServerUrl(this.settings.githubServerUrl);
  29889. this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
  29890. const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
  29891. core_setSecret(basicCredential);
  29892. this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`;
  29893. this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`;
  29894. // Instead of SSH URL
  29895. this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf`; // "origin" is SCHEME://HOSTNAME[:PORT]
  29896. this.insteadOfValues.push(`git@${serverUrl.hostname}:`);
  29897. if (this.settings.workflowOrganizationId) {
  29898. this.insteadOfValues.push(`org-${this.settings.workflowOrganizationId}@github.com:`);
  29899. }
  29900. }
  29901. async configureAuth() {
  29902. // Remove possible previous values
  29903. await this.removeAuth();
  29904. // Configure new values
  29905. await this.configureSsh();
  29906. await this.configureToken();
  29907. }
  29908. async configureTempGlobalConfig() {
  29909. // Already setup global config
  29910. if (this.temporaryHomePath?.length > 0) {
  29911. return external_path_namespaceObject.join(this.temporaryHomePath, '.gitconfig');
  29912. }
  29913. // Create a temp home directory
  29914. const runnerTemp = process.env['RUNNER_TEMP'] || '';
  29915. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  29916. const uniqueId = (0,external_crypto_namespaceObject.randomUUID)();
  29917. this.temporaryHomePath = external_path_namespaceObject.join(runnerTemp, uniqueId);
  29918. await external_fs_namespaceObject.promises.mkdir(this.temporaryHomePath, { recursive: true });
  29919. // Copy the global git config
  29920. const gitConfigPath = external_path_namespaceObject.join(process.env['HOME'] || external_os_namespaceObject.homedir(), '.gitconfig');
  29921. const newGitConfigPath = external_path_namespaceObject.join(this.temporaryHomePath, '.gitconfig');
  29922. let configExists = false;
  29923. try {
  29924. await external_fs_namespaceObject.promises.stat(gitConfigPath);
  29925. configExists = true;
  29926. }
  29927. catch (err) {
  29928. if (err?.code !== 'ENOENT') {
  29929. throw err;
  29930. }
  29931. }
  29932. if (configExists) {
  29933. info(`Copying '${gitConfigPath}' to '${newGitConfigPath}'`);
  29934. await io_cp(gitConfigPath, newGitConfigPath);
  29935. }
  29936. else {
  29937. await external_fs_namespaceObject.promises.writeFile(newGitConfigPath, '');
  29938. }
  29939. // Override HOME
  29940. info(`Temporarily overriding HOME='${this.temporaryHomePath}' before making global git config changes`);
  29941. this.git.setEnvironmentVariable('HOME', this.temporaryHomePath);
  29942. return newGitConfigPath;
  29943. }
  29944. async configureGlobalAuth() {
  29945. // 'configureTempGlobalConfig' noops if already set, just returns the path
  29946. await this.configureTempGlobalConfig();
  29947. try {
  29948. // Configure the token
  29949. await this.configureToken(true);
  29950. // Configure HTTPS instead of SSH
  29951. await this.git.tryConfigUnset(this.insteadOfKey, true);
  29952. if (!this.settings.sshKey) {
  29953. for (const insteadOfValue of this.insteadOfValues) {
  29954. await this.git.config(this.insteadOfKey, insteadOfValue, true, // globalConfig?
  29955. true // add?
  29956. );
  29957. }
  29958. }
  29959. }
  29960. catch (err) {
  29961. // Unset in case somehow written to the real global config
  29962. info('Encountered an error when attempting to configure token. Attempting unconfigure.');
  29963. await this.git.tryConfigUnset(this.tokenConfigKey, true);
  29964. throw err;
  29965. }
  29966. }
  29967. async configureSubmoduleAuth() {
  29968. // Remove possible previous HTTPS instead of SSH
  29969. await this.removeSubmoduleGitConfig(this.insteadOfKey);
  29970. if (this.settings.persistCredentials) {
  29971. // Get the credentials config file path in RUNNER_TEMP
  29972. const credentialsConfigPath = this.getCredentialsConfigPath();
  29973. // Container credentials config path
  29974. const containerCredentialsPath = external_path_namespaceObject.posix.join('/github/runner_temp', external_path_namespaceObject.basename(credentialsConfigPath));
  29975. // Get submodule config file paths.
  29976. const configPaths = await this.git.getSubmoduleConfigPaths(this.settings.nestedSubmodules);
  29977. // For each submodule, configure includeIf entries pointing to the shared credentials file.
  29978. // Configure both host and container paths to support Docker container actions.
  29979. for (const configPath of configPaths) {
  29980. // Submodule Git directory
  29981. let submoduleGitDir = external_path_namespaceObject.dirname(configPath); // The config file is at .git/modules/submodule-name/config
  29982. submoduleGitDir = submoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  29983. // Configure host includeIf
  29984. await this.git.config(`includeIf.gitdir:${submoduleGitDir}.path`, credentialsConfigPath, false, // globalConfig?
  29985. false, // add?
  29986. configPath);
  29987. // Container submodule git directory
  29988. const githubWorkspace = process.env['GITHUB_WORKSPACE'];
  29989. external_assert_.ok(githubWorkspace, 'GITHUB_WORKSPACE is not defined');
  29990. let relativeSubmoduleGitDir = external_path_namespaceObject.relative(githubWorkspace, submoduleGitDir);
  29991. relativeSubmoduleGitDir = relativeSubmoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  29992. const containerSubmoduleGitDir = external_path_namespaceObject.posix.join('/github/workspace', relativeSubmoduleGitDir);
  29993. // Configure container includeIf
  29994. await this.git.config(`includeIf.gitdir:${containerSubmoduleGitDir}.path`, containerCredentialsPath, false, // globalConfig?
  29995. false, // add?
  29996. configPath);
  29997. }
  29998. if (this.settings.sshKey) {
  29999. // Configure core.sshCommand
  30000. await this.git.submoduleForeach(`git config --local '${SSH_COMMAND_KEY}' '${this.sshCommand}'`, this.settings.nestedSubmodules);
  30001. }
  30002. else {
  30003. // Configure HTTPS instead of SSH
  30004. for (const insteadOfValue of this.insteadOfValues) {
  30005. await this.git.submoduleForeach(`git config --local --add '${this.insteadOfKey}' '${insteadOfValue}'`, this.settings.nestedSubmodules);
  30006. }
  30007. }
  30008. }
  30009. }
  30010. async removeAuth() {
  30011. await this.removeSsh();
  30012. await this.removeToken();
  30013. }
  30014. async removeGlobalConfig() {
  30015. if (this.temporaryHomePath?.length > 0) {
  30016. core_debug(`Unsetting HOME override`);
  30017. this.git.removeEnvironmentVariable('HOME');
  30018. await rmRF(this.temporaryHomePath);
  30019. }
  30020. }
  30021. /**
  30022. * Configures SSH authentication by writing the SSH key and known hosts,
  30023. * and setting up the GIT_SSH_COMMAND environment variable.
  30024. */
  30025. async configureSsh() {
  30026. if (!this.settings.sshKey) {
  30027. return;
  30028. }
  30029. // Write key
  30030. const runnerTemp = process.env['RUNNER_TEMP'] || '';
  30031. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  30032. const uniqueId = (0,external_crypto_namespaceObject.randomUUID)();
  30033. this.sshKeyPath = external_path_namespaceObject.join(runnerTemp, uniqueId);
  30034. setSshKeyPath(this.sshKeyPath);
  30035. await external_fs_namespaceObject.promises.mkdir(runnerTemp, { recursive: true });
  30036. await external_fs_namespaceObject.promises.writeFile(this.sshKeyPath, this.settings.sshKey.trim() + '\n', { mode: 0o600 });
  30037. // Remove inherited permissions on Windows
  30038. if (git_auth_helper_IS_WINDOWS) {
  30039. const icacls = await which('icacls.exe');
  30040. await exec_exec(`"${icacls}" "${this.sshKeyPath}" /grant:r "${process.env['USERDOMAIN']}\\${process.env['USERNAME']}:F"`);
  30041. await exec_exec(`"${icacls}" "${this.sshKeyPath}" /inheritance:r`);
  30042. }
  30043. // Write known hosts
  30044. const userKnownHostsPath = external_path_namespaceObject.join(external_os_namespaceObject.homedir(), '.ssh', 'known_hosts');
  30045. let userKnownHosts = '';
  30046. try {
  30047. userKnownHosts = (await external_fs_namespaceObject.promises.readFile(userKnownHostsPath)).toString();
  30048. }
  30049. catch (err) {
  30050. if (err?.code !== 'ENOENT') {
  30051. throw err;
  30052. }
  30053. }
  30054. let knownHosts = '';
  30055. if (userKnownHosts) {
  30056. knownHosts += `# Begin from ${userKnownHostsPath}\n${userKnownHosts}\n# End from ${userKnownHostsPath}\n`;
  30057. }
  30058. if (this.settings.sshKnownHosts) {
  30059. knownHosts += `# Begin from input known hosts\n${this.settings.sshKnownHosts}\n# end from input known hosts\n`;
  30060. }
  30061. knownHosts += `# Begin implicitly added github.com\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=\n# End implicitly added github.com\n`;
  30062. this.sshKnownHostsPath = external_path_namespaceObject.join(runnerTemp, `${uniqueId}_known_hosts`);
  30063. setSshKnownHostsPath(this.sshKnownHostsPath);
  30064. await external_fs_namespaceObject.promises.writeFile(this.sshKnownHostsPath, knownHosts);
  30065. // Configure GIT_SSH_COMMAND
  30066. const sshPath = await which('ssh', true);
  30067. this.sshCommand = `"${sshPath}" -i "$RUNNER_TEMP/${external_path_namespaceObject.basename(this.sshKeyPath)}"`;
  30068. if (this.settings.sshStrict) {
  30069. this.sshCommand += ' -o StrictHostKeyChecking=yes -o CheckHostIP=no';
  30070. }
  30071. this.sshCommand += ` -o "UserKnownHostsFile=$RUNNER_TEMP/${external_path_namespaceObject.basename(this.sshKnownHostsPath)}"`;
  30072. info(`Temporarily overriding GIT_SSH_COMMAND=${this.sshCommand}`);
  30073. this.git.setEnvironmentVariable('GIT_SSH_COMMAND', this.sshCommand);
  30074. // Configure core.sshCommand
  30075. if (this.settings.persistCredentials) {
  30076. await this.git.config(SSH_COMMAND_KEY, this.sshCommand);
  30077. }
  30078. }
  30079. /**
  30080. * Configures token-based authentication by creating a credentials config file
  30081. * and setting up includeIf entries to reference it.
  30082. * @param globalConfig Whether to configure global config instead of local
  30083. */
  30084. async configureToken(globalConfig) {
  30085. // Get the credentials config file path in RUNNER_TEMP
  30086. const credentialsConfigPath = this.getCredentialsConfigPath();
  30087. // Write placeholder to the separate credentials config file using git config.
  30088. // This approach avoids the credential being captured by process creation audit events,
  30089. // which are commonly logged. For more information, refer to
  30090. // https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
  30091. await this.git.config(this.tokenConfigKey, this.tokenPlaceholderConfigValue, false, // globalConfig?
  30092. false, // add?
  30093. credentialsConfigPath);
  30094. // Replace the placeholder in the credentials config file
  30095. let content = (await external_fs_namespaceObject.promises.readFile(credentialsConfigPath)).toString();
  30096. const placeholderIndex = content.indexOf(this.tokenPlaceholderConfigValue);
  30097. if (placeholderIndex < 0 ||
  30098. placeholderIndex != content.lastIndexOf(this.tokenPlaceholderConfigValue)) {
  30099. throw new Error(`Unable to replace auth placeholder in ${credentialsConfigPath}`);
  30100. }
  30101. external_assert_.ok(this.tokenConfigValue, 'tokenConfigValue is not defined');
  30102. content = content.replace(this.tokenPlaceholderConfigValue, this.tokenConfigValue);
  30103. await external_fs_namespaceObject.promises.writeFile(credentialsConfigPath, content);
  30104. // Add include or includeIf to reference the credentials config
  30105. if (globalConfig) {
  30106. // Global config file is temporary
  30107. await this.git.config('include.path', credentialsConfigPath, true // globalConfig?
  30108. );
  30109. }
  30110. else {
  30111. // Host git directory
  30112. let gitDir = external_path_namespaceObject.join(this.git.getWorkingDirectory(), '.git');
  30113. gitDir = gitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  30114. // Configure host includeIf
  30115. const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`;
  30116. await this.git.config(hostIncludeKey, credentialsConfigPath);
  30117. // Configure host includeIf for worktrees
  30118. const hostWorktreeIncludeKey = `includeIf.gitdir:${gitDir}/worktrees/*.path`;
  30119. await this.git.config(hostWorktreeIncludeKey, credentialsConfigPath);
  30120. // Container git directory
  30121. const workingDirectory = this.git.getWorkingDirectory();
  30122. const githubWorkspace = process.env['GITHUB_WORKSPACE'];
  30123. external_assert_.ok(githubWorkspace, 'GITHUB_WORKSPACE is not defined');
  30124. let relativePath = external_path_namespaceObject.relative(githubWorkspace, workingDirectory);
  30125. relativePath = relativePath.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  30126. const containerGitDir = external_path_namespaceObject.posix.join('/github/workspace', relativePath, '.git');
  30127. // Container credentials config path
  30128. const containerCredentialsPath = external_path_namespaceObject.posix.join('/github/runner_temp', external_path_namespaceObject.basename(credentialsConfigPath));
  30129. // Configure container includeIf
  30130. const containerIncludeKey = `includeIf.gitdir:${containerGitDir}.path`;
  30131. await this.git.config(containerIncludeKey, containerCredentialsPath);
  30132. // Configure container includeIf for worktrees
  30133. const containerWorktreeIncludeKey = `includeIf.gitdir:${containerGitDir}/worktrees/*.path`;
  30134. await this.git.config(containerWorktreeIncludeKey, containerCredentialsPath);
  30135. }
  30136. }
  30137. /**
  30138. * Gets or creates the path to the credentials config file in RUNNER_TEMP.
  30139. * @returns The absolute path to the credentials config file
  30140. */
  30141. getCredentialsConfigPath() {
  30142. if (this.credentialsConfigPath) {
  30143. return this.credentialsConfigPath;
  30144. }
  30145. const runnerTemp = process.env['RUNNER_TEMP'] || '';
  30146. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  30147. // Create a unique filename for this checkout instance
  30148. const configFileName = `git-credentials-${(0,external_crypto_namespaceObject.randomUUID)()}.config`;
  30149. this.credentialsConfigPath = external_path_namespaceObject.join(runnerTemp, configFileName);
  30150. core_debug(`Credentials config path: ${this.credentialsConfigPath}`);
  30151. return this.credentialsConfigPath;
  30152. }
  30153. /**
  30154. * Removes SSH authentication configuration by cleaning up SSH keys,
  30155. * known hosts files, and SSH command configurations.
  30156. */
  30157. async removeSsh() {
  30158. // SSH key
  30159. const keyPath = this.sshKeyPath || SshKeyPath;
  30160. if (keyPath) {
  30161. try {
  30162. info(`Removing SSH key '${keyPath}'`);
  30163. await rmRF(keyPath);
  30164. }
  30165. catch (err) {
  30166. core_debug(`${err?.message ?? err}`);
  30167. warning(`Failed to remove SSH key '${keyPath}'`);
  30168. }
  30169. }
  30170. // SSH known hosts
  30171. const knownHostsPath = this.sshKnownHostsPath || SshKnownHostsPath;
  30172. if (knownHostsPath) {
  30173. try {
  30174. info(`Removing SSH known hosts '${knownHostsPath}'`);
  30175. await rmRF(knownHostsPath);
  30176. }
  30177. catch (err) {
  30178. core_debug(`${err?.message ?? err}`);
  30179. warning(`Failed to remove SSH known hosts '${knownHostsPath}'`);
  30180. }
  30181. }
  30182. // SSH command
  30183. info('Removing SSH command configuration');
  30184. await this.removeGitConfig(SSH_COMMAND_KEY);
  30185. await this.removeSubmoduleGitConfig(SSH_COMMAND_KEY);
  30186. }
  30187. /**
  30188. * Removes token-based authentication by cleaning up HTTP headers,
  30189. * includeIf entries, and credentials config files.
  30190. */
  30191. async removeToken() {
  30192. // Remove HTTP extra header
  30193. info('Removing HTTP extra header');
  30194. await this.removeGitConfig(this.tokenConfigKey);
  30195. await this.removeSubmoduleGitConfig(this.tokenConfigKey);
  30196. // Collect credentials config paths that need to be removed
  30197. const credentialsPaths = new Set();
  30198. // Remove includeIf entries that point to git-credentials-*.config files
  30199. info('Removing includeIf entries pointing to credentials config files');
  30200. const mainCredentialsPaths = await this.removeIncludeIfCredentials();
  30201. mainCredentialsPaths.forEach(path => credentialsPaths.add(path));
  30202. // Remove submodule includeIf entries that point to git-credentials-*.config files
  30203. const submoduleConfigPaths = await this.git.getSubmoduleConfigPaths(true);
  30204. for (const configPath of submoduleConfigPaths) {
  30205. const submoduleCredentialsPaths = await this.removeIncludeIfCredentials(configPath);
  30206. submoduleCredentialsPaths.forEach(path => credentialsPaths.add(path));
  30207. }
  30208. // Remove credentials config files
  30209. for (const credentialsPath of credentialsPaths) {
  30210. // Only remove credentials config files if they are under RUNNER_TEMP
  30211. const runnerTemp = process.env['RUNNER_TEMP'];
  30212. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  30213. if (credentialsPath.startsWith(runnerTemp)) {
  30214. try {
  30215. info(`Removing credentials config '${credentialsPath}'`);
  30216. await rmRF(credentialsPath);
  30217. }
  30218. catch (err) {
  30219. core_debug(`${err?.message ?? err}`);
  30220. warning(`Failed to remove credentials config '${credentialsPath}'`);
  30221. }
  30222. }
  30223. else {
  30224. core_debug(`Skipping removal of credentials config '${credentialsPath}' - not under RUNNER_TEMP`);
  30225. }
  30226. }
  30227. }
  30228. /**
  30229. * Removes a git config key from the local repository config.
  30230. * @param configKey The git config key to remove
  30231. */
  30232. async removeGitConfig(configKey) {
  30233. if ((await this.git.configExists(configKey)) &&
  30234. !(await this.git.tryConfigUnset(configKey))) {
  30235. // Load the config contents
  30236. warning(`Failed to remove '${configKey}' from the git config`);
  30237. }
  30238. }
  30239. /**
  30240. * Removes a git config key from all submodule configs.
  30241. * @param configKey The git config key to remove
  30242. */
  30243. async removeSubmoduleGitConfig(configKey) {
  30244. const pattern = regexp_helper_escape(configKey);
  30245. await this.git.submoduleForeach(
  30246. // Wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline.
  30247. `sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, true);
  30248. }
  30249. /**
  30250. * Removes includeIf entries that point to git-credentials-*.config files.
  30251. * @param configPath Optional path to a specific git config file to operate on
  30252. * @returns Array of unique credentials config file paths that were found and removed
  30253. */
  30254. async removeIncludeIfCredentials(configPath) {
  30255. const credentialsPaths = new Set();
  30256. try {
  30257. // Get all includeIf.gitdir keys
  30258. const keys = await this.git.tryGetConfigKeys('^includeIf\\.gitdir:', false, // globalConfig?
  30259. configPath);
  30260. for (const key of keys) {
  30261. // Get all values for this key
  30262. const values = await this.git.tryGetConfigValues(key, false, // globalConfig?
  30263. configPath);
  30264. if (values.length > 0) {
  30265. // Remove only values that match git-credentials-<uuid>.config pattern
  30266. for (const value of values) {
  30267. if (this.testCredentialsConfigPath(value)) {
  30268. credentialsPaths.add(value);
  30269. await this.git.tryConfigUnsetValue(key, value, false, configPath);
  30270. }
  30271. }
  30272. }
  30273. }
  30274. }
  30275. catch (err) {
  30276. // Ignore errors - this is cleanup code
  30277. if (configPath) {
  30278. core_debug(`Error during includeIf cleanup for ${configPath}: ${err}`);
  30279. }
  30280. else {
  30281. core_debug(`Error during includeIf cleanup: ${err}`);
  30282. }
  30283. }
  30284. return Array.from(credentialsPaths);
  30285. }
  30286. /**
  30287. * Tests if a path matches the git-credentials-*.config pattern.
  30288. * @param path The path to test
  30289. * @returns True if the path matches the credentials config pattern
  30290. */
  30291. testCredentialsConfigPath(path) {
  30292. return /git-credentials-[0-9a-f-]+\.config$/i.test(path);
  30293. }
  30294. }
  30295. ;// CONCATENATED MODULE: ./src/retry-helper.ts
  30296. const defaultMaxAttempts = 3;
  30297. const defaultMinSeconds = 10;
  30298. const defaultMaxSeconds = 20;
  30299. class retry_helper_RetryHelper {
  30300. maxAttempts;
  30301. minSeconds;
  30302. maxSeconds;
  30303. constructor(maxAttempts = defaultMaxAttempts, minSeconds = defaultMinSeconds, maxSeconds = defaultMaxSeconds) {
  30304. this.maxAttempts = maxAttempts;
  30305. this.minSeconds = Math.floor(minSeconds);
  30306. this.maxSeconds = Math.floor(maxSeconds);
  30307. if (this.minSeconds > this.maxSeconds) {
  30308. throw new Error('min seconds should be less than or equal to max seconds');
  30309. }
  30310. }
  30311. async execute(action) {
  30312. let attempt = 1;
  30313. while (attempt < this.maxAttempts) {
  30314. // Try
  30315. try {
  30316. return await action();
  30317. }
  30318. catch (err) {
  30319. info(err?.message);
  30320. }
  30321. // Sleep
  30322. const seconds = this.getSleepAmount();
  30323. info(`Waiting ${seconds} seconds before trying again`);
  30324. await this.sleep(seconds);
  30325. attempt++;
  30326. }
  30327. // Last attempt
  30328. return await action();
  30329. }
  30330. getSleepAmount() {
  30331. return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
  30332. this.minSeconds);
  30333. }
  30334. async sleep(seconds) {
  30335. return new Promise(resolve => setTimeout(resolve, seconds * 1000));
  30336. }
  30337. }
  30338. async function execute(action) {
  30339. const retryHelper = new retry_helper_RetryHelper();
  30340. return await retryHelper.execute(action);
  30341. }
  30342. ;// CONCATENATED MODULE: ./src/git-version.ts
  30343. class GitVersion {
  30344. major = NaN;
  30345. minor = NaN;
  30346. patch = NaN;
  30347. /**
  30348. * Used for comparing the version of git and git-lfs against the minimum required version
  30349. * @param version the version string, e.g. 1.2 or 1.2.3
  30350. */
  30351. constructor(version) {
  30352. if (version) {
  30353. const match = version.match(/^(\d+)\.(\d+)(\.(\d+))?$/);
  30354. if (match) {
  30355. this.major = Number(match[1]);
  30356. this.minor = Number(match[2]);
  30357. if (match[4]) {
  30358. this.patch = Number(match[4]);
  30359. }
  30360. }
  30361. }
  30362. }
  30363. /**
  30364. * Compares the instance against a minimum required version
  30365. * @param minimum Minimum version
  30366. */
  30367. checkMinimum(minimum) {
  30368. if (!minimum.isValid()) {
  30369. throw new Error('Arg minimum is not a valid version');
  30370. }
  30371. // Major is insufficient
  30372. if (this.major < minimum.major) {
  30373. return false;
  30374. }
  30375. // Major is equal
  30376. if (this.major === minimum.major) {
  30377. // Minor is insufficient
  30378. if (this.minor < minimum.minor) {
  30379. return false;
  30380. }
  30381. // Minor is equal
  30382. if (this.minor === minimum.minor) {
  30383. // Patch is insufficient
  30384. if (this.patch && this.patch < (minimum.patch || 0)) {
  30385. return false;
  30386. }
  30387. }
  30388. }
  30389. return true;
  30390. }
  30391. /**
  30392. * Indicates whether the instance was constructed from a valid version string
  30393. */
  30394. isValid() {
  30395. return !isNaN(this.major);
  30396. }
  30397. /**
  30398. * Returns the version as a string, e.g. 1.2 or 1.2.3
  30399. */
  30400. toString() {
  30401. let result = '';
  30402. if (this.isValid()) {
  30403. result = `${this.major}.${this.minor}`;
  30404. if (!isNaN(this.patch)) {
  30405. result += `.${this.patch}`;
  30406. }
  30407. }
  30408. return result;
  30409. }
  30410. }
  30411. ;// CONCATENATED MODULE: ./src/git-command-manager.ts
  30412. // Auth header not supported before 2.9
  30413. // Wire protocol v2 not supported before 2.18
  30414. // sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
  30415. const MinimumGitVersion = new GitVersion('2.18');
  30416. const MinimumGitSparseCheckoutVersion = new GitVersion('2.28');
  30417. async function createCommandManager(workingDirectory, lfs, doSparseCheckout) {
  30418. return await GitCommandManager.createCommandManager(workingDirectory, lfs, doSparseCheckout);
  30419. }
  30420. class GitCommandManager {
  30421. gitEnv = {
  30422. GIT_TERMINAL_PROMPT: '0', // Disable git prompt
  30423. GCM_INTERACTIVE: 'Never' // Disable prompting for git credential manager
  30424. };
  30425. gitPath = '';
  30426. lfs = false;
  30427. doSparseCheckout = false;
  30428. workingDirectory = '';
  30429. gitVersion = new GitVersion();
  30430. // Private constructor; use createCommandManager()
  30431. constructor() { }
  30432. async branchDelete(remote, branch) {
  30433. const args = ['branch', '--delete', '--force'];
  30434. if (remote) {
  30435. args.push('--remote');
  30436. }
  30437. args.push(branch);
  30438. await this.execGit(args);
  30439. }
  30440. async branchExists(remote, pattern) {
  30441. const args = ['branch', '--list'];
  30442. if (remote) {
  30443. args.push('--remote');
  30444. }
  30445. args.push(pattern);
  30446. const output = await this.execGit(args);
  30447. return !!output.stdout.trim();
  30448. }
  30449. async branchList(remote) {
  30450. const result = [];
  30451. // Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
  30452. // "branch --list" is more difficult when in a detached HEAD state.
  30453. // TODO(https://github.com/actions/checkout/issues/786): this implementation uses
  30454. // "rev-parse --symbolic-full-name" because there is a bug
  30455. // in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names. When
  30456. // 2.18 is no longer supported, we can switch back to --symbolic.
  30457. const args = ['rev-parse', '--symbolic-full-name'];
  30458. if (remote) {
  30459. args.push('--remotes=origin');
  30460. }
  30461. else {
  30462. args.push('--branches');
  30463. }
  30464. const stderr = [];
  30465. const errline = [];
  30466. const stdout = [];
  30467. const stdline = [];
  30468. const listeners = {
  30469. stderr: (data) => {
  30470. stderr.push(data.toString());
  30471. },
  30472. errline: (data) => {
  30473. errline.push(data.toString());
  30474. },
  30475. stdout: (data) => {
  30476. stdout.push(data.toString());
  30477. },
  30478. stdline: (data) => {
  30479. stdline.push(data.toString());
  30480. }
  30481. };
  30482. // Suppress the output in order to avoid flooding annotations with innocuous errors.
  30483. await this.execGit(args, false, true, listeners);
  30484. core_debug(`stderr callback is: ${stderr}`);
  30485. core_debug(`errline callback is: ${errline}`);
  30486. core_debug(`stdout callback is: ${stdout}`);
  30487. core_debug(`stdline callback is: ${stdline}`);
  30488. for (let branch of stdline) {
  30489. branch = branch.trim();
  30490. if (!branch) {
  30491. continue;
  30492. }
  30493. if (branch.startsWith('refs/heads/')) {
  30494. branch = branch.substring('refs/heads/'.length);
  30495. }
  30496. else if (branch.startsWith('refs/remotes/')) {
  30497. branch = branch.substring('refs/remotes/'.length);
  30498. }
  30499. result.push(branch);
  30500. }
  30501. return result;
  30502. }
  30503. async disableSparseCheckout() {
  30504. await this.execGit(['sparse-checkout', 'disable']);
  30505. // Disabling 'sparse-checkout` leaves behind an undesirable side-effect in config (even in a pristine environment).
  30506. await this.tryConfigUnset('extensions.worktreeConfig', false);
  30507. }
  30508. async sparseCheckout(sparseCheckout) {
  30509. await this.execGit(['sparse-checkout', 'set', ...sparseCheckout]);
  30510. }
  30511. async sparseCheckoutNonConeMode(sparseCheckout) {
  30512. await this.execGit(['config', 'core.sparseCheckout', 'true']);
  30513. const output = await this.execGit([
  30514. 'rev-parse',
  30515. '--git-path',
  30516. 'info/sparse-checkout'
  30517. ]);
  30518. const sparseCheckoutPath = external_path_namespaceObject.join(this.workingDirectory, output.stdout.trimRight());
  30519. await external_fs_namespaceObject.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
  30520. }
  30521. async checkout(ref, startPoint) {
  30522. const args = ['checkout', '--progress', '--force'];
  30523. if (startPoint) {
  30524. args.push('-B', ref, startPoint);
  30525. }
  30526. else {
  30527. args.push(ref);
  30528. }
  30529. await this.execGit(args);
  30530. }
  30531. async checkoutDetach() {
  30532. const args = ['checkout', '--detach'];
  30533. await this.execGit(args);
  30534. }
  30535. async config(configKey, configValue, globalConfig, add, configFile) {
  30536. const args = ['config'];
  30537. if (configFile) {
  30538. args.push('--file', configFile);
  30539. }
  30540. else {
  30541. args.push(globalConfig ? '--global' : '--local');
  30542. }
  30543. if (add) {
  30544. args.push('--add');
  30545. }
  30546. args.push(...[configKey, configValue]);
  30547. await this.execGit(args);
  30548. }
  30549. async configExists(configKey, globalConfig) {
  30550. const pattern = regexp_helper_escape(configKey);
  30551. const output = await this.execGit([
  30552. 'config',
  30553. globalConfig ? '--global' : '--local',
  30554. '--name-only',
  30555. '--get-regexp',
  30556. pattern
  30557. ], true);
  30558. return output.exitCode === 0;
  30559. }
  30560. async fetch(refSpec, options) {
  30561. const args = ['-c', 'protocol.version=2', 'fetch'];
  30562. // Always use --no-tags for explicit control over tag fetching
  30563. // Tags are fetched explicitly via refspec when needed
  30564. args.push('--no-tags');
  30565. args.push('--prune', '--no-recurse-submodules');
  30566. if (options.showProgress) {
  30567. args.push('--progress');
  30568. }
  30569. if (options.filter) {
  30570. args.push(`--filter=${options.filter}`);
  30571. }
  30572. if (options.fetchDepth && options.fetchDepth > 0) {
  30573. args.push(`--depth=${options.fetchDepth}`);
  30574. }
  30575. else if (fileExistsSync(external_path_namespaceObject.join(this.workingDirectory, '.git', 'shallow'))) {
  30576. args.push('--unshallow');
  30577. }
  30578. args.push('origin');
  30579. for (const arg of refSpec) {
  30580. args.push(arg);
  30581. }
  30582. const that = this;
  30583. await execute(async () => {
  30584. await that.execGit(args);
  30585. });
  30586. }
  30587. async getDefaultBranch(repositoryUrl) {
  30588. let output;
  30589. await execute(async () => {
  30590. output = await this.execGit([
  30591. 'ls-remote',
  30592. '--quiet',
  30593. '--exit-code',
  30594. '--symref',
  30595. repositoryUrl,
  30596. 'HEAD'
  30597. ]);
  30598. });
  30599. if (output) {
  30600. // Satisfy compiler, will always be set
  30601. for (let line of output.stdout.trim().split('\n')) {
  30602. line = line.trim();
  30603. if (line.startsWith('ref:') || line.endsWith('HEAD')) {
  30604. return line
  30605. .substr('ref:'.length, line.length - 'ref:'.length - 'HEAD'.length)
  30606. .trim();
  30607. }
  30608. }
  30609. }
  30610. throw new Error('Unexpected output when retrieving default branch');
  30611. }
  30612. async getSubmoduleConfigPaths(recursive) {
  30613. // Get submodule config file paths.
  30614. // Use `--show-origin` to get the config file path for each submodule.
  30615. const output = await this.submoduleForeach(`git config --local --show-origin --name-only --get-regexp remote.origin.url`, recursive);
  30616. // Extract config file paths from the output (lines starting with "file:").
  30617. const configPaths = output.match(/(?<=(^|\n)file:)[^\t]+(?=\tremote\.origin\.url)/g) || [];
  30618. return configPaths;
  30619. }
  30620. getWorkingDirectory() {
  30621. return this.workingDirectory;
  30622. }
  30623. async init(objectFormat) {
  30624. const args = ['init'];
  30625. if (objectFormat === 'sha256') {
  30626. args.push('--object-format=sha256');
  30627. }
  30628. args.push(this.workingDirectory);
  30629. await this.execGit(args);
  30630. }
  30631. async isDetached() {
  30632. // Note, "branch --show-current" would be simpler but isn't available until Git 2.22
  30633. const output = await this.execGit(['rev-parse', '--symbolic-full-name', '--verify', '--quiet', 'HEAD'], true);
  30634. return !output.stdout.trim().startsWith('refs/heads/');
  30635. }
  30636. async lfsFetch(ref) {
  30637. const args = ['lfs', 'fetch', 'origin', ref];
  30638. const that = this;
  30639. await execute(async () => {
  30640. await that.execGit(args);
  30641. });
  30642. }
  30643. async lfsInstall() {
  30644. await this.execGit(['lfs', 'install', '--local']);
  30645. }
  30646. async log1(format) {
  30647. const args = format ? ['log', '-1', format] : ['log', '-1'];
  30648. const silent = format ? false : true;
  30649. const output = await this.execGit(args, false, silent);
  30650. return output.stdout;
  30651. }
  30652. async remoteAdd(remoteName, remoteUrl) {
  30653. await this.execGit(['remote', 'add', remoteName, remoteUrl]);
  30654. }
  30655. removeEnvironmentVariable(name) {
  30656. delete this.gitEnv[name];
  30657. }
  30658. /**
  30659. * Resolves a ref to a SHA. For a branch or lightweight tag, the commit SHA is returned.
  30660. * For an annotated tag, the tag SHA is returned.
  30661. * @param {string} ref For example: 'refs/heads/main' or '/refs/tags/v1'
  30662. * @returns {Promise<string>}
  30663. */
  30664. async revParse(ref) {
  30665. const output = await this.execGit(['rev-parse', ref]);
  30666. return output.stdout.trim();
  30667. }
  30668. setEnvironmentVariable(name, value) {
  30669. this.gitEnv[name] = value;
  30670. }
  30671. async shaExists(sha) {
  30672. const args = ['rev-parse', '--verify', '--quiet', `${sha}^{object}`];
  30673. const output = await this.execGit(args, true);
  30674. return output.exitCode === 0;
  30675. }
  30676. async submoduleForeach(command, recursive) {
  30677. const args = ['submodule', 'foreach'];
  30678. if (recursive) {
  30679. args.push('--recursive');
  30680. }
  30681. args.push(command);
  30682. const output = await this.execGit(args);
  30683. return output.stdout;
  30684. }
  30685. async submoduleSync(recursive) {
  30686. const args = ['submodule', 'sync'];
  30687. if (recursive) {
  30688. args.push('--recursive');
  30689. }
  30690. await this.execGit(args);
  30691. }
  30692. async submoduleUpdate(fetchDepth, recursive) {
  30693. const args = ['-c', 'protocol.version=2'];
  30694. args.push('submodule', 'update', '--init', '--force');
  30695. if (fetchDepth > 0) {
  30696. args.push(`--depth=${fetchDepth}`);
  30697. }
  30698. if (recursive) {
  30699. args.push('--recursive');
  30700. }
  30701. await this.execGit(args);
  30702. }
  30703. async submoduleStatus() {
  30704. const output = await this.execGit(['submodule', 'status'], true);
  30705. core_debug(output.stdout);
  30706. return output.exitCode === 0;
  30707. }
  30708. async tagExists(pattern) {
  30709. const output = await this.execGit(['tag', '--list', pattern]);
  30710. return !!output.stdout.trim();
  30711. }
  30712. async tryClean() {
  30713. const output = await this.execGit(['clean', '-ffdx'], true);
  30714. return output.exitCode === 0;
  30715. }
  30716. async tryConfigUnset(configKey, globalConfig) {
  30717. const output = await this.execGit([
  30718. 'config',
  30719. globalConfig ? '--global' : '--local',
  30720. '--unset-all',
  30721. configKey
  30722. ], true);
  30723. return output.exitCode === 0;
  30724. }
  30725. async tryConfigUnsetValue(configKey, configValue, globalConfig, configFile) {
  30726. const args = ['config'];
  30727. if (configFile) {
  30728. args.push('--file', configFile);
  30729. }
  30730. else {
  30731. args.push(globalConfig ? '--global' : '--local');
  30732. }
  30733. args.push('--unset', configKey, regexp_helper_escape(configValue));
  30734. const output = await this.execGit(args, true);
  30735. return output.exitCode === 0;
  30736. }
  30737. async tryDisableAutomaticGarbageCollection() {
  30738. const output = await this.execGit(['config', '--local', 'gc.auto', '0'], true);
  30739. return output.exitCode === 0;
  30740. }
  30741. async tryGetFetchUrl() {
  30742. const output = await this.execGit(['config', '--local', '--get', 'remote.origin.url'], true);
  30743. if (output.exitCode !== 0) {
  30744. return '';
  30745. }
  30746. const stdout = output.stdout.trim();
  30747. if (stdout.includes('\n')) {
  30748. return '';
  30749. }
  30750. return stdout;
  30751. }
  30752. async tryGetConfigValues(configKey, globalConfig, configFile) {
  30753. const args = ['config'];
  30754. if (configFile) {
  30755. args.push('--file', configFile);
  30756. }
  30757. else {
  30758. args.push(globalConfig ? '--global' : '--local');
  30759. }
  30760. args.push('--get-all', configKey);
  30761. const output = await this.execGit(args, true);
  30762. if (output.exitCode !== 0) {
  30763. return [];
  30764. }
  30765. return output.stdout
  30766. .trim()
  30767. .split('\n')
  30768. .filter(value => value.trim());
  30769. }
  30770. async tryGetConfigKeys(pattern, globalConfig, configFile) {
  30771. const args = ['config'];
  30772. if (configFile) {
  30773. args.push('--file', configFile);
  30774. }
  30775. else {
  30776. args.push(globalConfig ? '--global' : '--local');
  30777. }
  30778. args.push('--name-only', '--get-regexp', pattern);
  30779. const output = await this.execGit(args, true);
  30780. if (output.exitCode !== 0) {
  30781. return [];
  30782. }
  30783. return output.stdout
  30784. .trim()
  30785. .split('\n')
  30786. .filter(key => key.trim());
  30787. }
  30788. async tryReset() {
  30789. const output = await this.execGit(['reset', '--hard', 'HEAD'], true);
  30790. return output.exitCode === 0;
  30791. }
  30792. async version() {
  30793. return this.gitVersion;
  30794. }
  30795. static async createCommandManager(workingDirectory, lfs, doSparseCheckout) {
  30796. const result = new GitCommandManager();
  30797. await result.initializeCommandManager(workingDirectory, lfs, doSparseCheckout);
  30798. return result;
  30799. }
  30800. async execGit(args, allowAllExitCodes = false, silent = false, customListeners = {}) {
  30801. directoryExistsSync(this.workingDirectory, true);
  30802. const result = new GitOutput();
  30803. const env = {};
  30804. for (const key of Object.keys(process.env)) {
  30805. env[key] = process.env[key];
  30806. }
  30807. for (const key of Object.keys(this.gitEnv)) {
  30808. env[key] = this.gitEnv[key];
  30809. }
  30810. const defaultListener = {
  30811. stdout: (data) => {
  30812. stdout.push(data.toString());
  30813. }
  30814. };
  30815. const mergedListeners = { ...defaultListener, ...customListeners };
  30816. const stdout = [];
  30817. const options = {
  30818. cwd: this.workingDirectory,
  30819. env,
  30820. silent,
  30821. ignoreReturnCode: allowAllExitCodes,
  30822. listeners: mergedListeners
  30823. };
  30824. result.exitCode = await exec_exec(`"${this.gitPath}"`, args, options);
  30825. result.stdout = stdout.join('');
  30826. core_debug(result.exitCode.toString());
  30827. core_debug(result.stdout);
  30828. return result;
  30829. }
  30830. async initializeCommandManager(workingDirectory, lfs, doSparseCheckout) {
  30831. this.workingDirectory = workingDirectory;
  30832. // Git-lfs will try to pull down assets if any of the local/user/system setting exist.
  30833. // If the user didn't enable `LFS` in their pipeline definition, disable LFS fetch/checkout.
  30834. this.lfs = lfs;
  30835. if (!this.lfs) {
  30836. this.gitEnv['GIT_LFS_SKIP_SMUDGE'] = '1';
  30837. }
  30838. this.gitPath = await which('git', true);
  30839. // Git version
  30840. core_debug('Getting git version');
  30841. this.gitVersion = new GitVersion();
  30842. let gitOutput = await this.execGit(['version']);
  30843. let stdout = gitOutput.stdout.trim();
  30844. if (!stdout.includes('\n')) {
  30845. const match = stdout.match(/\d+\.\d+(\.\d+)?/);
  30846. if (match) {
  30847. this.gitVersion = new GitVersion(match[0]);
  30848. }
  30849. }
  30850. if (!this.gitVersion.isValid()) {
  30851. throw new Error('Unable to determine git version');
  30852. }
  30853. // Minimum git version
  30854. if (!this.gitVersion.checkMinimum(MinimumGitVersion)) {
  30855. throw new Error(`Minimum required git version is ${MinimumGitVersion}. Your git ('${this.gitPath}') is ${this.gitVersion}`);
  30856. }
  30857. if (this.lfs) {
  30858. // Git-lfs version
  30859. core_debug('Getting git-lfs version');
  30860. let gitLfsVersion = new GitVersion();
  30861. const gitLfsPath = await which('git-lfs', true);
  30862. gitOutput = await this.execGit(['lfs', 'version']);
  30863. stdout = gitOutput.stdout.trim();
  30864. if (!stdout.includes('\n')) {
  30865. const match = stdout.match(/\d+\.\d+(\.\d+)?/);
  30866. if (match) {
  30867. gitLfsVersion = new GitVersion(match[0]);
  30868. }
  30869. }
  30870. if (!gitLfsVersion.isValid()) {
  30871. throw new Error('Unable to determine git-lfs version');
  30872. }
  30873. // Minimum git-lfs version
  30874. // Note:
  30875. // - Auth header not supported before 2.1
  30876. const minimumGitLfsVersion = new GitVersion('2.1');
  30877. if (!gitLfsVersion.checkMinimum(minimumGitLfsVersion)) {
  30878. throw new Error(`Minimum required git-lfs version is ${minimumGitLfsVersion}. Your git-lfs ('${gitLfsPath}') is ${gitLfsVersion}`);
  30879. }
  30880. }
  30881. this.doSparseCheckout = doSparseCheckout;
  30882. if (this.doSparseCheckout) {
  30883. if (!this.gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
  30884. throw new Error(`Minimum Git version required for sparse checkout is ${MinimumGitSparseCheckoutVersion}. Your git ('${this.gitPath}') is ${this.gitVersion}`);
  30885. }
  30886. }
  30887. // Set the user agent
  30888. let gitHttpUserAgent = `git/${this.gitVersion} (github-actions-checkout)`;
  30889. // Append orchestration ID if set
  30890. const orchId = process.env['ACTIONS_ORCHESTRATION_ID'];
  30891. if (orchId) {
  30892. // Sanitize the orchestration ID to ensure it contains only valid characters
  30893. // Valid characters: 0-9, a-z, _, -, .
  30894. const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
  30895. if (sanitizedId) {
  30896. gitHttpUserAgent = `${gitHttpUserAgent} actions_orchestration_id/${sanitizedId}`;
  30897. }
  30898. }
  30899. core_debug(`Set git useragent to: ${gitHttpUserAgent}`);
  30900. this.gitEnv['GIT_HTTP_USER_AGENT'] = gitHttpUserAgent;
  30901. }
  30902. }
  30903. class GitOutput {
  30904. stdout = '';
  30905. exitCode = 0;
  30906. }
  30907. ;// CONCATENATED MODULE: ./src/git-directory-helper.ts
  30908. async function prepareExistingDirectory(git, repositoryPath, repositoryUrl, clean, ref) {
  30909. external_assert_.ok(repositoryPath, 'Expected repositoryPath to be defined');
  30910. external_assert_.ok(repositoryUrl, 'Expected repositoryUrl to be defined');
  30911. // Indicates whether to delete the directory contents
  30912. let remove = false;
  30913. // Check whether using git or REST API
  30914. if (!git) {
  30915. remove = true;
  30916. }
  30917. // Fetch URL does not match
  30918. else if (!directoryExistsSync(external_path_namespaceObject.join(repositoryPath, '.git')) ||
  30919. repositoryUrl !== (await git.tryGetFetchUrl())) {
  30920. remove = true;
  30921. }
  30922. else {
  30923. // Delete any index.lock and shallow.lock left by a previously canceled run or crashed git process
  30924. const lockPaths = [
  30925. external_path_namespaceObject.join(repositoryPath, '.git', 'index.lock'),
  30926. external_path_namespaceObject.join(repositoryPath, '.git', 'shallow.lock')
  30927. ];
  30928. for (const lockPath of lockPaths) {
  30929. try {
  30930. await rmRF(lockPath);
  30931. }
  30932. catch (error) {
  30933. core_debug(`Unable to delete '${lockPath}'. ${error?.message ?? error}`);
  30934. }
  30935. }
  30936. try {
  30937. startGroup('Removing previously created refs, to avoid conflicts');
  30938. // Checkout detached HEAD
  30939. if (!(await git.isDetached())) {
  30940. await git.checkoutDetach();
  30941. }
  30942. // Remove all refs/heads/*
  30943. let branches = await git.branchList(false);
  30944. for (const branch of branches) {
  30945. await git.branchDelete(false, branch);
  30946. }
  30947. // Remove any conflicting refs/remotes/origin/*
  30948. // Example 1: Consider ref is refs/heads/foo and previously fetched refs/remotes/origin/foo/bar
  30949. // Example 2: Consider ref is refs/heads/foo/bar and previously fetched refs/remotes/origin/foo
  30950. if (ref) {
  30951. ref = ref.startsWith('refs/') ? ref : `refs/heads/${ref}`;
  30952. if (ref.startsWith('refs/heads/')) {
  30953. const upperName1 = ref.toUpperCase().substr('REFS/HEADS/'.length);
  30954. const upperName1Slash = `${upperName1}/`;
  30955. branches = await git.branchList(true);
  30956. for (const branch of branches) {
  30957. const upperName2 = branch.substr('origin/'.length).toUpperCase();
  30958. const upperName2Slash = `${upperName2}/`;
  30959. if (upperName1.startsWith(upperName2Slash) ||
  30960. upperName2.startsWith(upperName1Slash)) {
  30961. await git.branchDelete(true, branch);
  30962. }
  30963. }
  30964. }
  30965. }
  30966. endGroup();
  30967. // Check for submodules and delete any existing files if submodules are present
  30968. if (!(await git.submoduleStatus())) {
  30969. remove = true;
  30970. info('Bad Submodules found, removing existing files');
  30971. }
  30972. // Clean
  30973. if (clean) {
  30974. startGroup('Cleaning the repository');
  30975. if (!(await git.tryClean())) {
  30976. core_debug(`The clean command failed. This might be caused by: 1) path too long, 2) permission issue, or 3) file in use. For further investigation, manually run 'git clean -ffdx' on the directory '${repositoryPath}'.`);
  30977. remove = true;
  30978. }
  30979. else if (!(await git.tryReset())) {
  30980. remove = true;
  30981. }
  30982. endGroup();
  30983. if (remove) {
  30984. warning(`Unable to clean or reset the repository. The repository will be recreated instead.`);
  30985. }
  30986. }
  30987. }
  30988. catch (error) {
  30989. warning(`Unable to prepare the existing repository. The repository will be recreated instead.`);
  30990. remove = true;
  30991. }
  30992. }
  30993. if (remove) {
  30994. // Delete the contents of the directory. Don't delete the directory itself
  30995. // since it might be the current working directory.
  30996. info(`Deleting the contents of '${repositoryPath}'`);
  30997. for (const file of await external_fs_namespaceObject.promises.readdir(repositoryPath)) {
  30998. await rmRF(external_path_namespaceObject.join(repositoryPath, file));
  30999. }
  31000. }
  31001. }
  31002. ;// CONCATENATED MODULE: ./node_modules/@actions/github/lib/context.js
  31003. class Context {
  31004. /**
  31005. * Hydrate the context from the environment
  31006. */
  31007. constructor() {
  31008. var _a, _b, _c;
  31009. this.payload = {};
  31010. if (process.env.GITHUB_EVENT_PATH) {
  31011. if ((0,external_fs_namespaceObject.existsSync)(process.env.GITHUB_EVENT_PATH)) {
  31012. this.payload = JSON.parse((0,external_fs_namespaceObject.readFileSync)(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
  31013. }
  31014. else {
  31015. const path = process.env.GITHUB_EVENT_PATH;
  31016. process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${external_os_namespaceObject.EOL}`);
  31017. }
  31018. }
  31019. this.eventName = process.env.GITHUB_EVENT_NAME;
  31020. this.sha = process.env.GITHUB_SHA;
  31021. this.ref = process.env.GITHUB_REF;
  31022. this.workflow = process.env.GITHUB_WORKFLOW;
  31023. this.action = process.env.GITHUB_ACTION;
  31024. this.actor = process.env.GITHUB_ACTOR;
  31025. this.job = process.env.GITHUB_JOB;
  31026. this.runAttempt = parseInt(process.env.GITHUB_RUN_ATTEMPT, 10);
  31027. this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
  31028. this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
  31029. this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
  31030. this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`;
  31031. this.graphqlUrl =
  31032. (_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`;
  31033. }
  31034. get issue() {
  31035. const payload = this.payload;
  31036. return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number });
  31037. }
  31038. get repo() {
  31039. if (process.env.GITHUB_REPOSITORY) {
  31040. const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
  31041. return { owner, repo };
  31042. }
  31043. if (this.payload.repository) {
  31044. return {
  31045. owner: this.payload.repository.owner.login,
  31046. repo: this.payload.repository.name
  31047. };
  31048. }
  31049. throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
  31050. }
  31051. }
  31052. //# sourceMappingURL=context.js.map
  31053. // EXTERNAL MODULE: ./node_modules/@actions/github/node_modules/@actions/http-client/lib/index.js
  31054. var lib = __nccwpck_require__(9659);
  31055. ;// CONCATENATED MODULE: ./node_modules/@actions/github/lib/internal/utils.js
  31056. var utils_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  31057. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  31058. return new (P || (P = Promise))(function (resolve, reject) {
  31059. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  31060. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  31061. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  31062. step((generator = generator.apply(thisArg, _arguments || [])).next());
  31063. });
  31064. };
  31065. function getAuthString(token, options) {
  31066. if (!token && !options.auth) {
  31067. throw new Error('Parameter token or opts.auth is required');
  31068. }
  31069. else if (token && options.auth) {
  31070. throw new Error('Parameters token and opts.auth may not both be specified');
  31071. }
  31072. return typeof options.auth === 'string' ? options.auth : `token ${token}`;
  31073. }
  31074. function getProxyAgent(destinationUrl) {
  31075. const hc = new lib.HttpClient();
  31076. return hc.getAgent(destinationUrl);
  31077. }
  31078. function getProxyAgentDispatcher(destinationUrl) {
  31079. const hc = new lib.HttpClient();
  31080. return hc.getAgentDispatcher(destinationUrl);
  31081. }
  31082. function getProxyFetch(destinationUrl) {
  31083. const httpDispatcher = getProxyAgentDispatcher(destinationUrl);
  31084. const proxyFetch = (url, opts) => utils_awaiter(this, void 0, void 0, function* () {
  31085. return (0,undici.fetch)(url, Object.assign(Object.assign({}, opts), { dispatcher: httpDispatcher }));
  31086. });
  31087. return proxyFetch;
  31088. }
  31089. function getApiBaseUrl() {
  31090. return process.env['GITHUB_API_URL'] || 'https://api.github.com';
  31091. }
  31092. function getUserAgentWithOrchestrationId(baseUserAgent) {
  31093. var _a;
  31094. const orchId = (_a = process.env['ACTIONS_ORCHESTRATION_ID']) === null || _a === void 0 ? void 0 : _a.trim();
  31095. if (orchId) {
  31096. const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
  31097. const tag = `actions_orchestration_id/${sanitizedId}`;
  31098. if (baseUserAgent === null || baseUserAgent === void 0 ? void 0 : baseUserAgent.includes(tag))
  31099. return baseUserAgent;
  31100. const ua = baseUserAgent ? `${baseUserAgent} ` : '';
  31101. return `${ua}${tag}`;
  31102. }
  31103. return baseUserAgent;
  31104. }
  31105. //# sourceMappingURL=utils.js.map
  31106. ;// CONCATENATED MODULE: ./node_modules/universal-user-agent/index.js
  31107. function getUserAgent() {
  31108. if (typeof navigator === "object" && "userAgent" in navigator) {
  31109. return navigator.userAgent;
  31110. }
  31111. if (typeof process === "object" && process.version !== undefined) {
  31112. return `Node.js/${process.version.substr(1)} (${process.platform}; ${
  31113. process.arch
  31114. })`;
  31115. }
  31116. return "<environment undetectable>";
  31117. }
  31118. ;// CONCATENATED MODULE: ./node_modules/before-after-hook/lib/register.js
  31119. // @ts-check
  31120. function register(state, name, method, options) {
  31121. if (typeof method !== "function") {
  31122. throw new Error("method for before hook must be a function");
  31123. }
  31124. if (!options) {
  31125. options = {};
  31126. }
  31127. if (Array.isArray(name)) {
  31128. return name.reverse().reduce((callback, name) => {
  31129. return register.bind(null, state, name, callback, options);
  31130. }, method)();
  31131. }
  31132. return Promise.resolve().then(() => {
  31133. if (!state.registry[name]) {
  31134. return method(options);
  31135. }
  31136. return state.registry[name].reduce((method, registered) => {
  31137. return registered.hook.bind(null, method, options);
  31138. }, method)();
  31139. });
  31140. }
  31141. ;// CONCATENATED MODULE: ./node_modules/before-after-hook/lib/add.js
  31142. // @ts-check
  31143. function addHook(state, kind, name, hook) {
  31144. const orig = hook;
  31145. if (!state.registry[name]) {
  31146. state.registry[name] = [];
  31147. }
  31148. if (kind === "before") {
  31149. hook = (method, options) => {
  31150. return Promise.resolve()
  31151. .then(orig.bind(null, options))
  31152. .then(method.bind(null, options));
  31153. };
  31154. }
  31155. if (kind === "after") {
  31156. hook = (method, options) => {
  31157. let result;
  31158. return Promise.resolve()
  31159. .then(method.bind(null, options))
  31160. .then((result_) => {
  31161. result = result_;
  31162. return orig(result, options);
  31163. })
  31164. .then(() => {
  31165. return result;
  31166. });
  31167. };
  31168. }
  31169. if (kind === "error") {
  31170. hook = (method, options) => {
  31171. return Promise.resolve()
  31172. .then(method.bind(null, options))
  31173. .catch((error) => {
  31174. return orig(error, options);
  31175. });
  31176. };
  31177. }
  31178. state.registry[name].push({
  31179. hook: hook,
  31180. orig: orig,
  31181. });
  31182. }
  31183. ;// CONCATENATED MODULE: ./node_modules/before-after-hook/lib/remove.js
  31184. // @ts-check
  31185. function removeHook(state, name, method) {
  31186. if (!state.registry[name]) {
  31187. return;
  31188. }
  31189. const index = state.registry[name]
  31190. .map((registered) => {
  31191. return registered.orig;
  31192. })
  31193. .indexOf(method);
  31194. if (index === -1) {
  31195. return;
  31196. }
  31197. state.registry[name].splice(index, 1);
  31198. }
  31199. ;// CONCATENATED MODULE: ./node_modules/before-after-hook/index.js
  31200. // @ts-check
  31201. // bind with array of arguments: https://stackoverflow.com/a/21792913
  31202. const bind = Function.bind;
  31203. const bindable = bind.bind(bind);
  31204. function bindApi(hook, state, name) {
  31205. const removeHookRef = bindable(removeHook, null).apply(
  31206. null,
  31207. name ? [state, name] : [state]
  31208. );
  31209. hook.api = { remove: removeHookRef };
  31210. hook.remove = removeHookRef;
  31211. ["before", "error", "after", "wrap"].forEach((kind) => {
  31212. const args = name ? [state, kind, name] : [state, kind];
  31213. hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args);
  31214. });
  31215. }
  31216. function Singular() {
  31217. const singularHookName = Symbol("Singular");
  31218. const singularHookState = {
  31219. registry: {},
  31220. };
  31221. const singularHook = register.bind(null, singularHookState, singularHookName);
  31222. bindApi(singularHook, singularHookState, singularHookName);
  31223. return singularHook;
  31224. }
  31225. function Collection() {
  31226. const state = {
  31227. registry: {},
  31228. };
  31229. const hook = register.bind(null, state);
  31230. bindApi(hook, state);
  31231. return hook;
  31232. }
  31233. /* harmony default export */ const before_after_hook = ({ Singular, Collection });
  31234. ;// CONCATENATED MODULE: ./node_modules/@octokit/endpoint/dist-bundle/index.js
  31235. // pkg/dist-src/defaults.js
  31236. // pkg/dist-src/version.js
  31237. var VERSION = "0.0.0-development";
  31238. // pkg/dist-src/defaults.js
  31239. var userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
  31240. var DEFAULTS = {
  31241. method: "GET",
  31242. baseUrl: "https://api.github.com",
  31243. headers: {
  31244. accept: "application/vnd.github.v3+json",
  31245. "user-agent": userAgent
  31246. },
  31247. mediaType: {
  31248. format: ""
  31249. }
  31250. };
  31251. // pkg/dist-src/util/lowercase-keys.js
  31252. function dist_bundle_lowercaseKeys(object) {
  31253. if (!object) {
  31254. return {};
  31255. }
  31256. return Object.keys(object).reduce((newObj, key) => {
  31257. newObj[key.toLowerCase()] = object[key];
  31258. return newObj;
  31259. }, {});
  31260. }
  31261. // pkg/dist-src/util/is-plain-object.js
  31262. function isPlainObject(value) {
  31263. if (typeof value !== "object" || value === null) return false;
  31264. if (Object.prototype.toString.call(value) !== "[object Object]") return false;
  31265. const proto = Object.getPrototypeOf(value);
  31266. if (proto === null) return true;
  31267. const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
  31268. return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
  31269. }
  31270. // pkg/dist-src/util/merge-deep.js
  31271. function mergeDeep(defaults, options) {
  31272. const result = Object.assign({}, defaults);
  31273. Object.keys(options).forEach((key) => {
  31274. if (isPlainObject(options[key])) {
  31275. if (!(key in defaults)) Object.assign(result, { [key]: options[key] });
  31276. else result[key] = mergeDeep(defaults[key], options[key]);
  31277. } else {
  31278. Object.assign(result, { [key]: options[key] });
  31279. }
  31280. });
  31281. return result;
  31282. }
  31283. // pkg/dist-src/util/remove-undefined-properties.js
  31284. function removeUndefinedProperties(obj) {
  31285. for (const key in obj) {
  31286. if (obj[key] === void 0) {
  31287. delete obj[key];
  31288. }
  31289. }
  31290. return obj;
  31291. }
  31292. // pkg/dist-src/merge.js
  31293. function merge(defaults, route, options) {
  31294. if (typeof route === "string") {
  31295. let [method, url] = route.split(" ");
  31296. options = Object.assign(url ? { method, url } : { url: method }, options);
  31297. } else {
  31298. options = Object.assign({}, route);
  31299. }
  31300. options.headers = dist_bundle_lowercaseKeys(options.headers);
  31301. removeUndefinedProperties(options);
  31302. removeUndefinedProperties(options.headers);
  31303. const mergedOptions = mergeDeep(defaults || {}, options);
  31304. if (options.url === "/graphql") {
  31305. if (defaults && defaults.mediaType.previews?.length) {
  31306. mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
  31307. (preview) => !mergedOptions.mediaType.previews.includes(preview)
  31308. ).concat(mergedOptions.mediaType.previews);
  31309. }
  31310. mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
  31311. }
  31312. return mergedOptions;
  31313. }
  31314. // pkg/dist-src/util/add-query-parameters.js
  31315. function addQueryParameters(url, parameters) {
  31316. const separator = /\?/.test(url) ? "&" : "?";
  31317. const names = Object.keys(parameters);
  31318. if (names.length === 0) {
  31319. return url;
  31320. }
  31321. return url + separator + names.map((name) => {
  31322. if (name === "q") {
  31323. return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
  31324. }
  31325. return `${name}=${encodeURIComponent(parameters[name])}`;
  31326. }).join("&");
  31327. }
  31328. // pkg/dist-src/util/extract-url-variable-names.js
  31329. var urlVariableRegex = /\{[^{}}]+\}/g;
  31330. function removeNonChars(variableName) {
  31331. return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
  31332. }
  31333. function extractUrlVariableNames(url) {
  31334. const matches = url.match(urlVariableRegex);
  31335. if (!matches) {
  31336. return [];
  31337. }
  31338. return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
  31339. }
  31340. // pkg/dist-src/util/omit.js
  31341. function omit(object, keysToOmit) {
  31342. const result = { __proto__: null };
  31343. for (const key of Object.keys(object)) {
  31344. if (keysToOmit.indexOf(key) === -1) {
  31345. result[key] = object[key];
  31346. }
  31347. }
  31348. return result;
  31349. }
  31350. // pkg/dist-src/util/url-template.js
  31351. function encodeReserved(str) {
  31352. return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
  31353. if (!/%[0-9A-Fa-f]/.test(part)) {
  31354. part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
  31355. }
  31356. return part;
  31357. }).join("");
  31358. }
  31359. function encodeUnreserved(str) {
  31360. return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
  31361. return "%" + c.charCodeAt(0).toString(16).toUpperCase();
  31362. });
  31363. }
  31364. function encodeValue(operator, value, key) {
  31365. value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
  31366. if (key) {
  31367. return encodeUnreserved(key) + "=" + value;
  31368. } else {
  31369. return value;
  31370. }
  31371. }
  31372. function isDefined(value) {
  31373. return value !== void 0 && value !== null;
  31374. }
  31375. function isKeyOperator(operator) {
  31376. return operator === ";" || operator === "&" || operator === "?";
  31377. }
  31378. function getValues(context, operator, key, modifier) {
  31379. var value = context[key], result = [];
  31380. if (isDefined(value) && value !== "") {
  31381. if (typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") {
  31382. value = value.toString();
  31383. if (modifier && modifier !== "*") {
  31384. value = value.substring(0, parseInt(modifier, 10));
  31385. }
  31386. result.push(
  31387. encodeValue(operator, value, isKeyOperator(operator) ? key : "")
  31388. );
  31389. } else {
  31390. if (modifier === "*") {
  31391. if (Array.isArray(value)) {
  31392. value.filter(isDefined).forEach(function(value2) {
  31393. result.push(
  31394. encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
  31395. );
  31396. });
  31397. } else {
  31398. Object.keys(value).forEach(function(k) {
  31399. if (isDefined(value[k])) {
  31400. result.push(encodeValue(operator, value[k], k));
  31401. }
  31402. });
  31403. }
  31404. } else {
  31405. const tmp = [];
  31406. if (Array.isArray(value)) {
  31407. value.filter(isDefined).forEach(function(value2) {
  31408. tmp.push(encodeValue(operator, value2));
  31409. });
  31410. } else {
  31411. Object.keys(value).forEach(function(k) {
  31412. if (isDefined(value[k])) {
  31413. tmp.push(encodeUnreserved(k));
  31414. tmp.push(encodeValue(operator, value[k].toString()));
  31415. }
  31416. });
  31417. }
  31418. if (isKeyOperator(operator)) {
  31419. result.push(encodeUnreserved(key) + "=" + tmp.join(","));
  31420. } else if (tmp.length !== 0) {
  31421. result.push(tmp.join(","));
  31422. }
  31423. }
  31424. }
  31425. } else {
  31426. if (operator === ";") {
  31427. if (isDefined(value)) {
  31428. result.push(encodeUnreserved(key));
  31429. }
  31430. } else if (value === "" && (operator === "&" || operator === "?")) {
  31431. result.push(encodeUnreserved(key) + "=");
  31432. } else if (value === "") {
  31433. result.push("");
  31434. }
  31435. }
  31436. return result;
  31437. }
  31438. function parseUrl(template) {
  31439. return {
  31440. expand: expand.bind(null, template)
  31441. };
  31442. }
  31443. function expand(template, context) {
  31444. var operators = ["+", "#", ".", "/", ";", "?", "&"];
  31445. template = template.replace(
  31446. /\{([^\{\}]+)\}|([^\{\}]+)/g,
  31447. function(_, expression, literal) {
  31448. if (expression) {
  31449. let operator = "";
  31450. const values = [];
  31451. if (operators.indexOf(expression.charAt(0)) !== -1) {
  31452. operator = expression.charAt(0);
  31453. expression = expression.substr(1);
  31454. }
  31455. expression.split(/,/g).forEach(function(variable) {
  31456. var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
  31457. values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
  31458. });
  31459. if (operator && operator !== "+") {
  31460. var separator = ",";
  31461. if (operator === "?") {
  31462. separator = "&";
  31463. } else if (operator !== "#") {
  31464. separator = operator;
  31465. }
  31466. return (values.length !== 0 ? operator : "") + values.join(separator);
  31467. } else {
  31468. return values.join(",");
  31469. }
  31470. } else {
  31471. return encodeReserved(literal);
  31472. }
  31473. }
  31474. );
  31475. if (template === "/") {
  31476. return template;
  31477. } else {
  31478. return template.replace(/\/$/, "");
  31479. }
  31480. }
  31481. // pkg/dist-src/parse.js
  31482. function parse(options) {
  31483. let method = options.method.toUpperCase();
  31484. let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
  31485. let headers = Object.assign({}, options.headers);
  31486. let body;
  31487. let parameters = omit(options, [
  31488. "method",
  31489. "baseUrl",
  31490. "url",
  31491. "headers",
  31492. "request",
  31493. "mediaType"
  31494. ]);
  31495. const urlVariableNames = extractUrlVariableNames(url);
  31496. url = parseUrl(url).expand(parameters);
  31497. if (!/^http/.test(url)) {
  31498. url = options.baseUrl + url;
  31499. }
  31500. const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
  31501. const remainingParameters = omit(parameters, omittedParameters);
  31502. const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
  31503. if (!isBinaryRequest) {
  31504. if (options.mediaType.format) {
  31505. headers.accept = headers.accept.split(/,/).map(
  31506. (format) => format.replace(
  31507. /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
  31508. `application/vnd$1$2.${options.mediaType.format}`
  31509. )
  31510. ).join(",");
  31511. }
  31512. if (url.endsWith("/graphql")) {
  31513. if (options.mediaType.previews?.length) {
  31514. const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
  31515. headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
  31516. const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
  31517. return `application/vnd.github.${preview}-preview${format}`;
  31518. }).join(",");
  31519. }
  31520. }
  31521. }
  31522. if (["GET", "HEAD"].includes(method)) {
  31523. url = addQueryParameters(url, remainingParameters);
  31524. } else {
  31525. if ("data" in remainingParameters) {
  31526. body = remainingParameters.data;
  31527. } else {
  31528. if (Object.keys(remainingParameters).length) {
  31529. body = remainingParameters;
  31530. }
  31531. }
  31532. }
  31533. if (!headers["content-type"] && typeof body !== "undefined") {
  31534. headers["content-type"] = "application/json; charset=utf-8";
  31535. }
  31536. if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
  31537. body = "";
  31538. }
  31539. return Object.assign(
  31540. { method, url, headers },
  31541. typeof body !== "undefined" ? { body } : null,
  31542. options.request ? { request: options.request } : null
  31543. );
  31544. }
  31545. // pkg/dist-src/endpoint-with-defaults.js
  31546. function endpointWithDefaults(defaults, route, options) {
  31547. return parse(merge(defaults, route, options));
  31548. }
  31549. // pkg/dist-src/with-defaults.js
  31550. function withDefaults(oldDefaults, newDefaults) {
  31551. const DEFAULTS2 = merge(oldDefaults, newDefaults);
  31552. const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2);
  31553. return Object.assign(endpoint2, {
  31554. DEFAULTS: DEFAULTS2,
  31555. defaults: withDefaults.bind(null, DEFAULTS2),
  31556. merge: merge.bind(null, DEFAULTS2),
  31557. parse
  31558. });
  31559. }
  31560. // pkg/dist-src/index.js
  31561. var endpoint = withDefaults(null, DEFAULTS);
  31562. // EXTERNAL MODULE: ./node_modules/content-type/dist/index.js
  31563. var dist = __nccwpck_require__(4649);
  31564. ;// CONCATENATED MODULE: ./node_modules/json-with-bigint/json-with-bigint.js
  31565. const intRegex = /^-?\d+$/;
  31566. const noiseValue = /^-?\d+n+$/; // Noise - strings that match the custom format before being converted to it
  31567. const originalStringify = JSON.stringify;
  31568. const originalParse = JSON.parse;
  31569. const customFormat = /^-?\d+n$/;
  31570. const bigIntsStringify = /([\[:])?"(-?\d+)n"($|([\\n]|\s)*(\s|[\\n])*[,\}\]])/g;
  31571. const noiseStringify =
  31572. /([\[:])?("-?\d+n+)n("$|"([\\n]|\s)*(\s|[\\n])*[,\}\]])/g;
  31573. /**
  31574. * @typedef {(this: any, key: string | number | undefined, value: any) => any} Replacer
  31575. * @typedef {(key: string | number | undefined, value: any, context?: { source: string }) => any} Reviver
  31576. */
  31577. /**
  31578. * Converts a JavaScript value to a JSON string.
  31579. *
  31580. * Supports serialization of BigInt values using two strategies:
  31581. * 1. Custom format "123n" → "123" (universal fallback)
  31582. * 2. Native JSON.rawJSON() (Node.js 22+, fastest) when available
  31583. *
  31584. * All other values are serialized exactly like native JSON.stringify().
  31585. *
  31586. * @param {*} value The value to convert to a JSON string.
  31587. * @param {Replacer | Array<string | number> | null} [replacer]
  31588. * A function that alters the behavior of the stringification process,
  31589. * or an array of strings/numbers to indicate properties to exclude.
  31590. * @param {string | number} [space]
  31591. * A string or number to specify indentation or pretty-printing.
  31592. * @returns {string} The JSON string representation.
  31593. */
  31594. const JSONStringify = (value, replacer, space) => {
  31595. if ("rawJSON" in JSON) {
  31596. return originalStringify(
  31597. value,
  31598. (key, value) => {
  31599. if (typeof value === "bigint") return JSON.rawJSON(value.toString());
  31600. if (typeof replacer === "function") return replacer(key, value);
  31601. if (Array.isArray(replacer) && replacer.includes(key)) return value;
  31602. return value;
  31603. },
  31604. space,
  31605. );
  31606. }
  31607. if (!value) return originalStringify(value, replacer, space);
  31608. const convertedToCustomJSON = originalStringify(
  31609. value,
  31610. (key, value) => {
  31611. const isNoise = typeof value === "string" && noiseValue.test(value);
  31612. if (isNoise) return value.toString() + "n"; // Mark noise values with additional "n" to offset the deletion of one "n" during the processing
  31613. if (typeof value === "bigint") return value.toString() + "n";
  31614. if (typeof replacer === "function") return replacer(key, value);
  31615. if (Array.isArray(replacer) && replacer.includes(key)) return value;
  31616. return value;
  31617. },
  31618. space,
  31619. );
  31620. const processedJSON = convertedToCustomJSON.replace(
  31621. bigIntsStringify,
  31622. "$1$2$3",
  31623. ); // Delete one "n" off the end of every BigInt value
  31624. const denoisedJSON = processedJSON.replace(noiseStringify, "$1$2$3"); // Remove one "n" off the end of every noisy string
  31625. return denoisedJSON;
  31626. };
  31627. const featureCache = new Map();
  31628. /**
  31629. * Detects if the current JSON.parse implementation supports the context.source feature.
  31630. *
  31631. * Uses toString() fingerprinting to cache results and automatically detect runtime
  31632. * replacements of JSON.parse (polyfills, mocks, etc.).
  31633. *
  31634. * @returns {boolean} true if context.source is supported, false otherwise.
  31635. */
  31636. const isContextSourceSupported = () => {
  31637. const parseFingerprint = JSON.parse.toString();
  31638. if (featureCache.has(parseFingerprint)) {
  31639. return featureCache.get(parseFingerprint);
  31640. }
  31641. try {
  31642. const result = JSON.parse(
  31643. "1",
  31644. (_, __, context) => !!context?.source && context.source === "1",
  31645. );
  31646. featureCache.set(parseFingerprint, result);
  31647. return result;
  31648. } catch {
  31649. featureCache.set(parseFingerprint, false);
  31650. return false;
  31651. }
  31652. };
  31653. /**
  31654. * Reviver function that converts custom-format BigInt strings back to BigInt values.
  31655. * Also handles "noise" strings that accidentally match the BigInt format.
  31656. *
  31657. * @param {string | number | undefined} key The object key.
  31658. * @param {*} value The value being parsed.
  31659. * @param {object} [context] Parse context (if supported by JSON.parse).
  31660. * @param {Reviver} [userReviver] User's custom reviver function.
  31661. * @returns {any} The transformed value.
  31662. */
  31663. const convertMarkedBigIntsReviver = (key, value, context, userReviver) => {
  31664. const isCustomFormatBigInt =
  31665. typeof value === "string" && customFormat.test(value);
  31666. if (isCustomFormatBigInt) return BigInt(value.slice(0, -1));
  31667. const isNoiseValue = typeof value === "string" && noiseValue.test(value);
  31668. if (isNoiseValue) return value.slice(0, -1);
  31669. if (typeof userReviver !== "function") return value;
  31670. return userReviver(key, value, context);
  31671. };
  31672. /**
  31673. * Fast JSON.parse implementation (~2x faster than classic fallback).
  31674. * Uses JSON.parse's context.source feature to detect integers and convert
  31675. * large numbers directly to BigInt without string manipulation.
  31676. *
  31677. * Does not support legacy custom format from v1 of this library.
  31678. *
  31679. * @param {string} text JSON string to parse.
  31680. * @param {Reviver} [reviver] Transform function to apply to each value.
  31681. * @returns {any} Parsed JavaScript value.
  31682. */
  31683. const JSONParseV2 = (text, reviver) => {
  31684. return JSON.parse(text, (key, value, context) => {
  31685. const isBigNumber =
  31686. typeof value === "number" &&
  31687. (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER);
  31688. const isInt = context && intRegex.test(context.source);
  31689. const isBigInt = isBigNumber && isInt;
  31690. if (isBigInt) return BigInt(context.source);
  31691. if (typeof reviver !== "function") return value;
  31692. return reviver(key, value, context);
  31693. });
  31694. };
  31695. const MAX_INT = Number.MAX_SAFE_INTEGER.toString();
  31696. const MAX_DIGITS = MAX_INT.length;
  31697. const stringsOrLargeNumbers =
  31698. /"(?:\\.|[^"])*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g;
  31699. const noiseValueWithQuotes = /^"-?\d+n+"$/; // Noise - strings that match the custom format before being converted to it
  31700. /**
  31701. * Converts a JSON string into a JavaScript value.
  31702. *
  31703. * Supports parsing of large integers using two strategies:
  31704. * 1. Classic fallback: Marks large numbers with "123n" format, then converts to BigInt
  31705. * 2. Fast path (JSONParseV2): Uses context.source feature (~2x faster) when available
  31706. *
  31707. * All other JSON values are parsed exactly like native JSON.parse().
  31708. *
  31709. * @param {string} text A valid JSON string.
  31710. * @param {Reviver} [reviver]
  31711. * A function that transforms the results. This function is called for each member
  31712. * of the object. If a member contains nested objects, the nested objects are
  31713. * transformed before the parent object is.
  31714. * @returns {any} The parsed JavaScript value.
  31715. * @throws {SyntaxError} If text is not valid JSON.
  31716. */
  31717. const JSONParse = (text, reviver) => {
  31718. if (!text) return originalParse(text, reviver);
  31719. if (isContextSourceSupported()) return JSONParseV2(text, reviver); // Shortcut to a faster (2x) and simpler version
  31720. // Find and mark big numbers with "n"
  31721. const serializedData = text.replace(
  31722. stringsOrLargeNumbers,
  31723. (text, digits, fractional, exponential) => {
  31724. const isString = text[0] === '"';
  31725. const isNoise = isString && noiseValueWithQuotes.test(text);
  31726. if (isNoise) return text.substring(0, text.length - 1) + 'n"'; // Mark noise values with additional "n" to offset the deletion of one "n" during the processing
  31727. const isFractionalOrExponential = fractional || exponential;
  31728. const isLessThanMaxSafeInt =
  31729. digits &&
  31730. (digits.length < MAX_DIGITS ||
  31731. (digits.length === MAX_DIGITS && digits <= MAX_INT)); // With a fixed number of digits, we can correctly use lexicographical comparison to do a numeric comparison
  31732. if (isString || isFractionalOrExponential || isLessThanMaxSafeInt)
  31733. return text;
  31734. return '"' + text + 'n"';
  31735. },
  31736. );
  31737. return originalParse(serializedData, (key, value, context) =>
  31738. convertMarkedBigIntsReviver(key, value, context, reviver),
  31739. );
  31740. };
  31741. ;// CONCATENATED MODULE: ./node_modules/@octokit/request-error/dist-src/index.js
  31742. class RequestError extends Error {
  31743. name;
  31744. /**
  31745. * http status code
  31746. */
  31747. status;
  31748. /**
  31749. * Request options that lead to the error.
  31750. */
  31751. request;
  31752. /**
  31753. * Response object if a response was received
  31754. */
  31755. response;
  31756. constructor(message, statusCode, options) {
  31757. super(message, { cause: options.cause });
  31758. this.name = "HttpError";
  31759. this.status = Number.parseInt(statusCode);
  31760. if (Number.isNaN(this.status)) {
  31761. this.status = 0;
  31762. }
  31763. /* v8 ignore else -- @preserve -- Bug with vitest coverage where it sees an else branch that doesn't exist */
  31764. if ("response" in options) {
  31765. this.response = options.response;
  31766. }
  31767. const requestCopy = Object.assign({}, options.request);
  31768. if (options.request.headers.authorization) {
  31769. requestCopy.headers = Object.assign({}, options.request.headers, {
  31770. authorization: options.request.headers.authorization.replace(
  31771. /(?<! ) .*$/,
  31772. " [REDACTED]"
  31773. )
  31774. });
  31775. }
  31776. requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
  31777. this.request = requestCopy;
  31778. }
  31779. }
  31780. ;// CONCATENATED MODULE: ./node_modules/@octokit/request/dist-bundle/index.js
  31781. // pkg/dist-src/index.js
  31782. // pkg/dist-src/defaults.js
  31783. // pkg/dist-src/version.js
  31784. var dist_bundle_VERSION = "10.0.10";
  31785. // pkg/dist-src/defaults.js
  31786. var defaults_default = {
  31787. headers: {
  31788. "user-agent": `octokit-request.js/${dist_bundle_VERSION} ${getUserAgent()}`
  31789. }
  31790. };
  31791. // pkg/dist-src/fetch-wrapper.js
  31792. // pkg/dist-src/is-plain-object.js
  31793. function dist_bundle_isPlainObject(value) {
  31794. if (typeof value !== "object" || value === null) return false;
  31795. if (Object.prototype.toString.call(value) !== "[object Object]") return false;
  31796. const proto = Object.getPrototypeOf(value);
  31797. if (proto === null) return true;
  31798. const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
  31799. return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
  31800. }
  31801. // pkg/dist-src/fetch-wrapper.js
  31802. var noop = () => "";
  31803. async function fetchWrapper(requestOptions) {
  31804. const fetch = requestOptions.request?.fetch || globalThis.fetch;
  31805. if (!fetch) {
  31806. throw new Error(
  31807. "fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
  31808. );
  31809. }
  31810. const log = requestOptions.request?.log || console;
  31811. const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
  31812. const body = dist_bundle_isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body) ? JSONStringify(requestOptions.body) : requestOptions.body;
  31813. const requestHeaders = Object.fromEntries(
  31814. Object.entries(requestOptions.headers).map(([name, value]) => [
  31815. name,
  31816. String(value)
  31817. ])
  31818. );
  31819. let fetchResponse;
  31820. try {
  31821. fetchResponse = await fetch(requestOptions.url, {
  31822. method: requestOptions.method,
  31823. body,
  31824. redirect: requestOptions.request?.redirect,
  31825. headers: requestHeaders,
  31826. signal: requestOptions.request?.signal,
  31827. // duplex must be set if request.body is ReadableStream or Async Iterables.
  31828. // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
  31829. ...requestOptions.body && { duplex: "half" }
  31830. });
  31831. } catch (error) {
  31832. let message = "Unknown Error";
  31833. if (error instanceof Error) {
  31834. if (error.name === "AbortError") {
  31835. error.status = 500;
  31836. throw error;
  31837. }
  31838. message = error.message;
  31839. if (error.name === "TypeError" && "cause" in error) {
  31840. if (error.cause instanceof Error) {
  31841. message = error.cause.message;
  31842. } else if (typeof error.cause === "string") {
  31843. message = error.cause;
  31844. }
  31845. }
  31846. }
  31847. const requestError = new RequestError(message, 500, {
  31848. request: requestOptions
  31849. });
  31850. requestError.cause = error;
  31851. throw requestError;
  31852. }
  31853. const status = fetchResponse.status;
  31854. const url = fetchResponse.url;
  31855. const responseHeaders = {};
  31856. for (const [key, value] of fetchResponse.headers) {
  31857. responseHeaders[key] = value;
  31858. }
  31859. const octokitResponse = {
  31860. url,
  31861. status,
  31862. headers: responseHeaders,
  31863. data: ""
  31864. };
  31865. if ("deprecation" in responseHeaders) {
  31866. const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
  31867. const deprecationLink = matches && matches.pop();
  31868. log.warn(
  31869. `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
  31870. );
  31871. }
  31872. if (status === 204 || status === 205) {
  31873. return octokitResponse;
  31874. }
  31875. if (requestOptions.method === "HEAD") {
  31876. if (status < 400) {
  31877. return octokitResponse;
  31878. }
  31879. throw new RequestError(fetchResponse.statusText, status, {
  31880. response: octokitResponse,
  31881. request: requestOptions
  31882. });
  31883. }
  31884. if (status === 304) {
  31885. octokitResponse.data = await getResponseData(fetchResponse);
  31886. throw new RequestError("Not modified", status, {
  31887. response: octokitResponse,
  31888. request: requestOptions
  31889. });
  31890. }
  31891. if (status >= 400) {
  31892. octokitResponse.data = await getResponseData(fetchResponse);
  31893. throw new RequestError(toErrorMessage(octokitResponse.data), status, {
  31894. response: octokitResponse,
  31895. request: requestOptions
  31896. });
  31897. }
  31898. octokitResponse.data = parseSuccessResponseBody ? await getResponseData(fetchResponse) : fetchResponse.body;
  31899. return octokitResponse;
  31900. }
  31901. async function getResponseData(response) {
  31902. const contentType = response.headers.get("content-type");
  31903. if (!contentType) {
  31904. return response.text().catch(noop);
  31905. }
  31906. const mimetype = (0,dist/* parse */.qg)(contentType);
  31907. if (isJSONResponse(mimetype)) {
  31908. let text = "";
  31909. try {
  31910. text = await response.text();
  31911. return JSONParse(text);
  31912. } catch (err) {
  31913. return text;
  31914. }
  31915. } else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") {
  31916. return response.text().catch(noop);
  31917. } else {
  31918. return response.arrayBuffer().catch(
  31919. /* v8 ignore next -- @preserve */
  31920. () => new ArrayBuffer(0)
  31921. );
  31922. }
  31923. }
  31924. function isJSONResponse(mimetype) {
  31925. return mimetype.type === "application/json" || mimetype.type === "application/scim+json";
  31926. }
  31927. function toErrorMessage(data) {
  31928. if (typeof data === "string") {
  31929. return data;
  31930. }
  31931. if (data instanceof ArrayBuffer) {
  31932. return "Unknown error";
  31933. }
  31934. if ("message" in data) {
  31935. const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
  31936. return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`;
  31937. }
  31938. return `Unknown error: ${JSON.stringify(data)}`;
  31939. }
  31940. // pkg/dist-src/with-defaults.js
  31941. function dist_bundle_withDefaults(oldEndpoint, newDefaults) {
  31942. const endpoint2 = oldEndpoint.defaults(newDefaults);
  31943. const newApi = function(route, parameters) {
  31944. const endpointOptions = endpoint2.merge(route, parameters);
  31945. if (!endpointOptions.request || !endpointOptions.request.hook) {
  31946. return fetchWrapper(endpoint2.parse(endpointOptions));
  31947. }
  31948. const request2 = (route2, parameters2) => {
  31949. return fetchWrapper(
  31950. endpoint2.parse(endpoint2.merge(route2, parameters2))
  31951. );
  31952. };
  31953. Object.assign(request2, {
  31954. endpoint: endpoint2,
  31955. defaults: dist_bundle_withDefaults.bind(null, endpoint2)
  31956. });
  31957. return endpointOptions.request.hook(request2, endpointOptions);
  31958. };
  31959. return Object.assign(newApi, {
  31960. endpoint: endpoint2,
  31961. defaults: dist_bundle_withDefaults.bind(null, endpoint2)
  31962. });
  31963. }
  31964. // pkg/dist-src/index.js
  31965. var request = dist_bundle_withDefaults(endpoint, defaults_default);
  31966. /* v8 ignore next -- @preserve */
  31967. /* v8 ignore else -- @preserve */
  31968. ;// CONCATENATED MODULE: ./node_modules/@octokit/graphql/dist-bundle/index.js
  31969. // pkg/dist-src/index.js
  31970. // pkg/dist-src/version.js
  31971. var graphql_dist_bundle_VERSION = "0.0.0-development";
  31972. // pkg/dist-src/with-defaults.js
  31973. // pkg/dist-src/graphql.js
  31974. // pkg/dist-src/error.js
  31975. function _buildMessageForResponseErrors(data) {
  31976. return `Request failed due to following response errors:
  31977. ` + data.errors.map((e) => ` - ${e.message}`).join("\n");
  31978. }
  31979. var GraphqlResponseError = class extends Error {
  31980. constructor(request2, headers, response) {
  31981. super(_buildMessageForResponseErrors(response));
  31982. this.request = request2;
  31983. this.headers = headers;
  31984. this.response = response;
  31985. this.errors = response.errors;
  31986. this.data = response.data;
  31987. if (Error.captureStackTrace) {
  31988. Error.captureStackTrace(this, this.constructor);
  31989. }
  31990. }
  31991. name = "GraphqlResponseError";
  31992. errors;
  31993. data;
  31994. };
  31995. // pkg/dist-src/graphql.js
  31996. var NON_VARIABLE_OPTIONS = [
  31997. "method",
  31998. "baseUrl",
  31999. "url",
  32000. "headers",
  32001. "request",
  32002. "query",
  32003. "mediaType",
  32004. "operationName"
  32005. ];
  32006. var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
  32007. var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
  32008. function graphql(request2, query, options) {
  32009. if (options) {
  32010. if (typeof query === "string" && "query" in options) {
  32011. return Promise.reject(
  32012. new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
  32013. );
  32014. }
  32015. for (const key in options) {
  32016. if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue;
  32017. return Promise.reject(
  32018. new Error(
  32019. `[@octokit/graphql] "${key}" cannot be used as variable name`
  32020. )
  32021. );
  32022. }
  32023. }
  32024. const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
  32025. const requestOptions = Object.keys(
  32026. parsedOptions
  32027. ).reduce((result, key) => {
  32028. if (NON_VARIABLE_OPTIONS.includes(key)) {
  32029. result[key] = parsedOptions[key];
  32030. return result;
  32031. }
  32032. if (!result.variables) {
  32033. result.variables = {};
  32034. }
  32035. result.variables[key] = parsedOptions[key];
  32036. return result;
  32037. }, {});
  32038. const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl;
  32039. if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
  32040. requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
  32041. }
  32042. return request2(requestOptions).then((response) => {
  32043. if (response.data.errors) {
  32044. const headers = {};
  32045. for (const key of Object.keys(response.headers)) {
  32046. headers[key] = response.headers[key];
  32047. }
  32048. throw new GraphqlResponseError(
  32049. requestOptions,
  32050. headers,
  32051. response.data
  32052. );
  32053. }
  32054. return response.data.data;
  32055. });
  32056. }
  32057. // pkg/dist-src/with-defaults.js
  32058. function graphql_dist_bundle_withDefaults(request2, newDefaults) {
  32059. const newRequest = request2.defaults(newDefaults);
  32060. const newApi = (query, options) => {
  32061. return graphql(newRequest, query, options);
  32062. };
  32063. return Object.assign(newApi, {
  32064. defaults: graphql_dist_bundle_withDefaults.bind(null, newRequest),
  32065. endpoint: newRequest.endpoint
  32066. });
  32067. }
  32068. // pkg/dist-src/index.js
  32069. var graphql2 = graphql_dist_bundle_withDefaults(request, {
  32070. headers: {
  32071. "user-agent": `octokit-graphql.js/${graphql_dist_bundle_VERSION} ${getUserAgent()}`
  32072. },
  32073. method: "POST",
  32074. url: "/graphql"
  32075. });
  32076. function withCustomRequest(customRequest) {
  32077. return graphql_dist_bundle_withDefaults(customRequest, {
  32078. method: "POST",
  32079. url: "/graphql"
  32080. });
  32081. }
  32082. ;// CONCATENATED MODULE: ./node_modules/@octokit/auth-token/dist-bundle/index.js
  32083. // pkg/dist-src/is-jwt.js
  32084. var b64url = "(?:[a-zA-Z0-9_-]+)";
  32085. var sep = "\\.";
  32086. var jwtRE = new RegExp(`^${b64url}${sep}${b64url}${sep}${b64url}$`);
  32087. var isJWT = jwtRE.test.bind(jwtRE);
  32088. // pkg/dist-src/auth.js
  32089. async function auth(token) {
  32090. const isApp = isJWT(token);
  32091. const isInstallation = token.startsWith("v1.") || token.startsWith("ghs_");
  32092. const isUserToServer = token.startsWith("ghu_");
  32093. const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
  32094. return {
  32095. type: "token",
  32096. token,
  32097. tokenType
  32098. };
  32099. }
  32100. // pkg/dist-src/with-authorization-prefix.js
  32101. function withAuthorizationPrefix(token) {
  32102. if (token.split(/\./).length === 3) {
  32103. return `bearer ${token}`;
  32104. }
  32105. return `token ${token}`;
  32106. }
  32107. // pkg/dist-src/hook.js
  32108. async function hook(token, request, route, parameters) {
  32109. const endpoint = request.endpoint.merge(
  32110. route,
  32111. parameters
  32112. );
  32113. endpoint.headers.authorization = withAuthorizationPrefix(token);
  32114. return request(endpoint);
  32115. }
  32116. // pkg/dist-src/index.js
  32117. var createTokenAuth = function createTokenAuth2(token) {
  32118. if (!token) {
  32119. throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
  32120. }
  32121. if (typeof token !== "string") {
  32122. throw new Error(
  32123. "[@octokit/auth-token] Token passed to createTokenAuth is not a string"
  32124. );
  32125. }
  32126. token = token.replace(/^(token|bearer) +/i, "");
  32127. return Object.assign(auth.bind(null, token), {
  32128. hook: hook.bind(null, token)
  32129. });
  32130. };
  32131. ;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/version.js
  32132. const version_VERSION = "7.0.6";
  32133. ;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/index.js
  32134. const dist_src_noop = () => {
  32135. };
  32136. const consoleWarn = console.warn.bind(console);
  32137. const consoleError = console.error.bind(console);
  32138. function createLogger(logger = {}) {
  32139. if (typeof logger.debug !== "function") {
  32140. logger.debug = dist_src_noop;
  32141. }
  32142. if (typeof logger.info !== "function") {
  32143. logger.info = dist_src_noop;
  32144. }
  32145. if (typeof logger.warn !== "function") {
  32146. logger.warn = consoleWarn;
  32147. }
  32148. if (typeof logger.error !== "function") {
  32149. logger.error = consoleError;
  32150. }
  32151. return logger;
  32152. }
  32153. const userAgentTrail = `octokit-core.js/${version_VERSION} ${getUserAgent()}`;
  32154. class Octokit {
  32155. static VERSION = version_VERSION;
  32156. static defaults(defaults) {
  32157. const OctokitWithDefaults = class extends this {
  32158. constructor(...args) {
  32159. const options = args[0] || {};
  32160. if (typeof defaults === "function") {
  32161. super(defaults(options));
  32162. return;
  32163. }
  32164. super(
  32165. Object.assign(
  32166. {},
  32167. defaults,
  32168. options,
  32169. options.userAgent && defaults.userAgent ? {
  32170. userAgent: `${options.userAgent} ${defaults.userAgent}`
  32171. } : null
  32172. )
  32173. );
  32174. }
  32175. };
  32176. return OctokitWithDefaults;
  32177. }
  32178. static plugins = [];
  32179. /**
  32180. * Attach a plugin (or many) to your Octokit instance.
  32181. *
  32182. * @example
  32183. * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
  32184. */
  32185. static plugin(...newPlugins) {
  32186. const currentPlugins = this.plugins;
  32187. const NewOctokit = class extends this {
  32188. static plugins = currentPlugins.concat(
  32189. newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
  32190. );
  32191. };
  32192. return NewOctokit;
  32193. }
  32194. constructor(options = {}) {
  32195. const hook = new before_after_hook.Collection();
  32196. const requestDefaults = {
  32197. baseUrl: request.endpoint.DEFAULTS.baseUrl,
  32198. headers: {},
  32199. request: Object.assign({}, options.request, {
  32200. // @ts-ignore internal usage only, no need to type
  32201. hook: hook.bind(null, "request")
  32202. }),
  32203. mediaType: {
  32204. previews: [],
  32205. format: ""
  32206. }
  32207. };
  32208. requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;
  32209. if (options.baseUrl) {
  32210. requestDefaults.baseUrl = options.baseUrl;
  32211. }
  32212. if (options.previews) {
  32213. requestDefaults.mediaType.previews = options.previews;
  32214. }
  32215. if (options.timeZone) {
  32216. requestDefaults.headers["time-zone"] = options.timeZone;
  32217. }
  32218. this.request = request.defaults(requestDefaults);
  32219. this.graphql = withCustomRequest(this.request).defaults(requestDefaults);
  32220. this.log = createLogger(options.log);
  32221. this.hook = hook;
  32222. if (!options.authStrategy) {
  32223. if (!options.auth) {
  32224. this.auth = async () => ({
  32225. type: "unauthenticated"
  32226. });
  32227. } else {
  32228. const auth = createTokenAuth(options.auth);
  32229. hook.wrap("request", auth.hook);
  32230. this.auth = auth;
  32231. }
  32232. } else {
  32233. const { authStrategy, ...otherOptions } = options;
  32234. const auth = authStrategy(
  32235. Object.assign(
  32236. {
  32237. request: this.request,
  32238. log: this.log,
  32239. // we pass the current octokit instance as well as its constructor options
  32240. // to allow for authentication strategies that return a new octokit instance
  32241. // that shares the same internal state as the current one. The original
  32242. // requirement for this was the "event-octokit" authentication strategy
  32243. // of https://github.com/probot/octokit-auth-probot.
  32244. octokit: this,
  32245. octokitOptions: otherOptions
  32246. },
  32247. options.auth
  32248. )
  32249. );
  32250. hook.wrap("request", auth.hook);
  32251. this.auth = auth;
  32252. }
  32253. const classConstructor = this.constructor;
  32254. for (let i = 0; i < classConstructor.plugins.length; ++i) {
  32255. Object.assign(this, classConstructor.plugins[i](this, options));
  32256. }
  32257. }
  32258. // assigned during constructor
  32259. request;
  32260. graphql;
  32261. log;
  32262. hook;
  32263. // TODO: type `octokit.auth` based on passed options.authStrategy
  32264. auth;
  32265. }
  32266. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js
  32267. const dist_src_version_VERSION = "17.0.0";
  32268. //# sourceMappingURL=version.js.map
  32269. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js
  32270. const Endpoints = {
  32271. actions: {
  32272. addCustomLabelsToSelfHostedRunnerForOrg: [
  32273. "POST /orgs/{org}/actions/runners/{runner_id}/labels"
  32274. ],
  32275. addCustomLabelsToSelfHostedRunnerForRepo: [
  32276. "POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  32277. ],
  32278. addRepoAccessToSelfHostedRunnerGroupInOrg: [
  32279. "PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id}"
  32280. ],
  32281. addSelectedRepoToOrgSecret: [
  32282. "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"
  32283. ],
  32284. addSelectedRepoToOrgVariable: [
  32285. "PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id}"
  32286. ],
  32287. approveWorkflowRun: [
  32288. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve"
  32289. ],
  32290. cancelWorkflowRun: [
  32291. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"
  32292. ],
  32293. createEnvironmentVariable: [
  32294. "POST /repos/{owner}/{repo}/environments/{environment_name}/variables"
  32295. ],
  32296. createHostedRunnerForOrg: ["POST /orgs/{org}/actions/hosted-runners"],
  32297. createOrUpdateEnvironmentSecret: [
  32298. "PUT /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
  32299. ],
  32300. createOrUpdateOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}"],
  32301. createOrUpdateRepoSecret: [
  32302. "PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}"
  32303. ],
  32304. createOrgVariable: ["POST /orgs/{org}/actions/variables"],
  32305. createRegistrationTokenForOrg: [
  32306. "POST /orgs/{org}/actions/runners/registration-token"
  32307. ],
  32308. createRegistrationTokenForRepo: [
  32309. "POST /repos/{owner}/{repo}/actions/runners/registration-token"
  32310. ],
  32311. createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"],
  32312. createRemoveTokenForRepo: [
  32313. "POST /repos/{owner}/{repo}/actions/runners/remove-token"
  32314. ],
  32315. createRepoVariable: ["POST /repos/{owner}/{repo}/actions/variables"],
  32316. createWorkflowDispatch: [
  32317. "POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"
  32318. ],
  32319. deleteActionsCacheById: [
  32320. "DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}"
  32321. ],
  32322. deleteActionsCacheByKey: [
  32323. "DELETE /repos/{owner}/{repo}/actions/caches{?key,ref}"
  32324. ],
  32325. deleteArtifact: [
  32326. "DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"
  32327. ],
  32328. deleteCustomImageFromOrg: [
  32329. "DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}"
  32330. ],
  32331. deleteCustomImageVersionFromOrg: [
  32332. "DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version}"
  32333. ],
  32334. deleteEnvironmentSecret: [
  32335. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
  32336. ],
  32337. deleteEnvironmentVariable: [
  32338. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
  32339. ],
  32340. deleteHostedRunnerForOrg: [
  32341. "DELETE /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
  32342. ],
  32343. deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"],
  32344. deleteOrgVariable: ["DELETE /orgs/{org}/actions/variables/{name}"],
  32345. deleteRepoSecret: [
  32346. "DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}"
  32347. ],
  32348. deleteRepoVariable: [
  32349. "DELETE /repos/{owner}/{repo}/actions/variables/{name}"
  32350. ],
  32351. deleteSelfHostedRunnerFromOrg: [
  32352. "DELETE /orgs/{org}/actions/runners/{runner_id}"
  32353. ],
  32354. deleteSelfHostedRunnerFromRepo: [
  32355. "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"
  32356. ],
  32357. deleteWorkflowRun: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}"],
  32358. deleteWorkflowRunLogs: [
  32359. "DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs"
  32360. ],
  32361. disableSelectedRepositoryGithubActionsOrganization: [
  32362. "DELETE /orgs/{org}/actions/permissions/repositories/{repository_id}"
  32363. ],
  32364. disableWorkflow: [
  32365. "PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable"
  32366. ],
  32367. downloadArtifact: [
  32368. "GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"
  32369. ],
  32370. downloadJobLogsForWorkflowRun: [
  32371. "GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"
  32372. ],
  32373. downloadWorkflowRunAttemptLogs: [
  32374. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs"
  32375. ],
  32376. downloadWorkflowRunLogs: [
  32377. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"
  32378. ],
  32379. enableSelectedRepositoryGithubActionsOrganization: [
  32380. "PUT /orgs/{org}/actions/permissions/repositories/{repository_id}"
  32381. ],
  32382. enableWorkflow: [
  32383. "PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable"
  32384. ],
  32385. forceCancelWorkflowRun: [
  32386. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel"
  32387. ],
  32388. generateRunnerJitconfigForOrg: [
  32389. "POST /orgs/{org}/actions/runners/generate-jitconfig"
  32390. ],
  32391. generateRunnerJitconfigForRepo: [
  32392. "POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig"
  32393. ],
  32394. getActionsCacheList: ["GET /repos/{owner}/{repo}/actions/caches"],
  32395. getActionsCacheUsage: ["GET /repos/{owner}/{repo}/actions/cache/usage"],
  32396. getActionsCacheUsageByRepoForOrg: [
  32397. "GET /orgs/{org}/actions/cache/usage-by-repository"
  32398. ],
  32399. getActionsCacheUsageForOrg: ["GET /orgs/{org}/actions/cache/usage"],
  32400. getAllowedActionsOrganization: [
  32401. "GET /orgs/{org}/actions/permissions/selected-actions"
  32402. ],
  32403. getAllowedActionsRepository: [
  32404. "GET /repos/{owner}/{repo}/actions/permissions/selected-actions"
  32405. ],
  32406. getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"],
  32407. getCustomImageForOrg: [
  32408. "GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}"
  32409. ],
  32410. getCustomImageVersionForOrg: [
  32411. "GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version}"
  32412. ],
  32413. getCustomOidcSubClaimForRepo: [
  32414. "GET /repos/{owner}/{repo}/actions/oidc/customization/sub"
  32415. ],
  32416. getEnvironmentPublicKey: [
  32417. "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/public-key"
  32418. ],
  32419. getEnvironmentSecret: [
  32420. "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
  32421. ],
  32422. getEnvironmentVariable: [
  32423. "GET /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
  32424. ],
  32425. getGithubActionsDefaultWorkflowPermissionsOrganization: [
  32426. "GET /orgs/{org}/actions/permissions/workflow"
  32427. ],
  32428. getGithubActionsDefaultWorkflowPermissionsRepository: [
  32429. "GET /repos/{owner}/{repo}/actions/permissions/workflow"
  32430. ],
  32431. getGithubActionsPermissionsOrganization: [
  32432. "GET /orgs/{org}/actions/permissions"
  32433. ],
  32434. getGithubActionsPermissionsRepository: [
  32435. "GET /repos/{owner}/{repo}/actions/permissions"
  32436. ],
  32437. getHostedRunnerForOrg: [
  32438. "GET /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
  32439. ],
  32440. getHostedRunnersGithubOwnedImagesForOrg: [
  32441. "GET /orgs/{org}/actions/hosted-runners/images/github-owned"
  32442. ],
  32443. getHostedRunnersLimitsForOrg: [
  32444. "GET /orgs/{org}/actions/hosted-runners/limits"
  32445. ],
  32446. getHostedRunnersMachineSpecsForOrg: [
  32447. "GET /orgs/{org}/actions/hosted-runners/machine-sizes"
  32448. ],
  32449. getHostedRunnersPartnerImagesForOrg: [
  32450. "GET /orgs/{org}/actions/hosted-runners/images/partner"
  32451. ],
  32452. getHostedRunnersPlatformsForOrg: [
  32453. "GET /orgs/{org}/actions/hosted-runners/platforms"
  32454. ],
  32455. getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"],
  32456. getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"],
  32457. getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"],
  32458. getOrgVariable: ["GET /orgs/{org}/actions/variables/{name}"],
  32459. getPendingDeploymentsForRun: [
  32460. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"
  32461. ],
  32462. getRepoPermissions: [
  32463. "GET /repos/{owner}/{repo}/actions/permissions",
  32464. {},
  32465. { renamed: ["actions", "getGithubActionsPermissionsRepository"] }
  32466. ],
  32467. getRepoPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"],
  32468. getRepoSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{secret_name}"],
  32469. getRepoVariable: ["GET /repos/{owner}/{repo}/actions/variables/{name}"],
  32470. getReviewsForRun: [
  32471. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals"
  32472. ],
  32473. getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"],
  32474. getSelfHostedRunnerForRepo: [
  32475. "GET /repos/{owner}/{repo}/actions/runners/{runner_id}"
  32476. ],
  32477. getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"],
  32478. getWorkflowAccessToRepository: [
  32479. "GET /repos/{owner}/{repo}/actions/permissions/access"
  32480. ],
  32481. getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"],
  32482. getWorkflowRunAttempt: [
  32483. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}"
  32484. ],
  32485. getWorkflowRunUsage: [
  32486. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"
  32487. ],
  32488. getWorkflowUsage: [
  32489. "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing"
  32490. ],
  32491. listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"],
  32492. listCustomImageVersionsForOrg: [
  32493. "GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions"
  32494. ],
  32495. listCustomImagesForOrg: [
  32496. "GET /orgs/{org}/actions/hosted-runners/images/custom"
  32497. ],
  32498. listEnvironmentSecrets: [
  32499. "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets"
  32500. ],
  32501. listEnvironmentVariables: [
  32502. "GET /repos/{owner}/{repo}/environments/{environment_name}/variables"
  32503. ],
  32504. listGithubHostedRunnersInGroupForOrg: [
  32505. "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/hosted-runners"
  32506. ],
  32507. listHostedRunnersForOrg: ["GET /orgs/{org}/actions/hosted-runners"],
  32508. listJobsForWorkflowRun: [
  32509. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"
  32510. ],
  32511. listJobsForWorkflowRunAttempt: [
  32512. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs"
  32513. ],
  32514. listLabelsForSelfHostedRunnerForOrg: [
  32515. "GET /orgs/{org}/actions/runners/{runner_id}/labels"
  32516. ],
  32517. listLabelsForSelfHostedRunnerForRepo: [
  32518. "GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  32519. ],
  32520. listOrgSecrets: ["GET /orgs/{org}/actions/secrets"],
  32521. listOrgVariables: ["GET /orgs/{org}/actions/variables"],
  32522. listRepoOrganizationSecrets: [
  32523. "GET /repos/{owner}/{repo}/actions/organization-secrets"
  32524. ],
  32525. listRepoOrganizationVariables: [
  32526. "GET /repos/{owner}/{repo}/actions/organization-variables"
  32527. ],
  32528. listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"],
  32529. listRepoVariables: ["GET /repos/{owner}/{repo}/actions/variables"],
  32530. listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"],
  32531. listRunnerApplicationsForOrg: ["GET /orgs/{org}/actions/runners/downloads"],
  32532. listRunnerApplicationsForRepo: [
  32533. "GET /repos/{owner}/{repo}/actions/runners/downloads"
  32534. ],
  32535. listSelectedReposForOrgSecret: [
  32536. "GET /orgs/{org}/actions/secrets/{secret_name}/repositories"
  32537. ],
  32538. listSelectedReposForOrgVariable: [
  32539. "GET /orgs/{org}/actions/variables/{name}/repositories"
  32540. ],
  32541. listSelectedRepositoriesEnabledGithubActionsOrganization: [
  32542. "GET /orgs/{org}/actions/permissions/repositories"
  32543. ],
  32544. listSelfHostedRunnersForOrg: ["GET /orgs/{org}/actions/runners"],
  32545. listSelfHostedRunnersForRepo: ["GET /repos/{owner}/{repo}/actions/runners"],
  32546. listWorkflowRunArtifacts: [
  32547. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"
  32548. ],
  32549. listWorkflowRuns: [
  32550. "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"
  32551. ],
  32552. listWorkflowRunsForRepo: ["GET /repos/{owner}/{repo}/actions/runs"],
  32553. reRunJobForWorkflowRun: [
  32554. "POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun"
  32555. ],
  32556. reRunWorkflow: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun"],
  32557. reRunWorkflowFailedJobs: [
  32558. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs"
  32559. ],
  32560. removeAllCustomLabelsFromSelfHostedRunnerForOrg: [
  32561. "DELETE /orgs/{org}/actions/runners/{runner_id}/labels"
  32562. ],
  32563. removeAllCustomLabelsFromSelfHostedRunnerForRepo: [
  32564. "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  32565. ],
  32566. removeCustomLabelFromSelfHostedRunnerForOrg: [
  32567. "DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name}"
  32568. ],
  32569. removeCustomLabelFromSelfHostedRunnerForRepo: [
  32570. "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name}"
  32571. ],
  32572. removeSelectedRepoFromOrgSecret: [
  32573. "DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"
  32574. ],
  32575. removeSelectedRepoFromOrgVariable: [
  32576. "DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id}"
  32577. ],
  32578. reviewCustomGatesForRun: [
  32579. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule"
  32580. ],
  32581. reviewPendingDeploymentsForRun: [
  32582. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"
  32583. ],
  32584. setAllowedActionsOrganization: [
  32585. "PUT /orgs/{org}/actions/permissions/selected-actions"
  32586. ],
  32587. setAllowedActionsRepository: [
  32588. "PUT /repos/{owner}/{repo}/actions/permissions/selected-actions"
  32589. ],
  32590. setCustomLabelsForSelfHostedRunnerForOrg: [
  32591. "PUT /orgs/{org}/actions/runners/{runner_id}/labels"
  32592. ],
  32593. setCustomLabelsForSelfHostedRunnerForRepo: [
  32594. "PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  32595. ],
  32596. setCustomOidcSubClaimForRepo: [
  32597. "PUT /repos/{owner}/{repo}/actions/oidc/customization/sub"
  32598. ],
  32599. setGithubActionsDefaultWorkflowPermissionsOrganization: [
  32600. "PUT /orgs/{org}/actions/permissions/workflow"
  32601. ],
  32602. setGithubActionsDefaultWorkflowPermissionsRepository: [
  32603. "PUT /repos/{owner}/{repo}/actions/permissions/workflow"
  32604. ],
  32605. setGithubActionsPermissionsOrganization: [
  32606. "PUT /orgs/{org}/actions/permissions"
  32607. ],
  32608. setGithubActionsPermissionsRepository: [
  32609. "PUT /repos/{owner}/{repo}/actions/permissions"
  32610. ],
  32611. setSelectedReposForOrgSecret: [
  32612. "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories"
  32613. ],
  32614. setSelectedReposForOrgVariable: [
  32615. "PUT /orgs/{org}/actions/variables/{name}/repositories"
  32616. ],
  32617. setSelectedRepositoriesEnabledGithubActionsOrganization: [
  32618. "PUT /orgs/{org}/actions/permissions/repositories"
  32619. ],
  32620. setWorkflowAccessToRepository: [
  32621. "PUT /repos/{owner}/{repo}/actions/permissions/access"
  32622. ],
  32623. updateEnvironmentVariable: [
  32624. "PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
  32625. ],
  32626. updateHostedRunnerForOrg: [
  32627. "PATCH /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
  32628. ],
  32629. updateOrgVariable: ["PATCH /orgs/{org}/actions/variables/{name}"],
  32630. updateRepoVariable: [
  32631. "PATCH /repos/{owner}/{repo}/actions/variables/{name}"
  32632. ]
  32633. },
  32634. activity: {
  32635. checkRepoIsStarredByAuthenticatedUser: ["GET /user/starred/{owner}/{repo}"],
  32636. deleteRepoSubscription: ["DELETE /repos/{owner}/{repo}/subscription"],
  32637. deleteThreadSubscription: [
  32638. "DELETE /notifications/threads/{thread_id}/subscription"
  32639. ],
  32640. getFeeds: ["GET /feeds"],
  32641. getRepoSubscription: ["GET /repos/{owner}/{repo}/subscription"],
  32642. getThread: ["GET /notifications/threads/{thread_id}"],
  32643. getThreadSubscriptionForAuthenticatedUser: [
  32644. "GET /notifications/threads/{thread_id}/subscription"
  32645. ],
  32646. listEventsForAuthenticatedUser: ["GET /users/{username}/events"],
  32647. listNotificationsForAuthenticatedUser: ["GET /notifications"],
  32648. listOrgEventsForAuthenticatedUser: [
  32649. "GET /users/{username}/events/orgs/{org}"
  32650. ],
  32651. listPublicEvents: ["GET /events"],
  32652. listPublicEventsForRepoNetwork: ["GET /networks/{owner}/{repo}/events"],
  32653. listPublicEventsForUser: ["GET /users/{username}/events/public"],
  32654. listPublicOrgEvents: ["GET /orgs/{org}/events"],
  32655. listReceivedEventsForUser: ["GET /users/{username}/received_events"],
  32656. listReceivedPublicEventsForUser: [
  32657. "GET /users/{username}/received_events/public"
  32658. ],
  32659. listRepoEvents: ["GET /repos/{owner}/{repo}/events"],
  32660. listRepoNotificationsForAuthenticatedUser: [
  32661. "GET /repos/{owner}/{repo}/notifications"
  32662. ],
  32663. listReposStarredByAuthenticatedUser: ["GET /user/starred"],
  32664. listReposStarredByUser: ["GET /users/{username}/starred"],
  32665. listReposWatchedByUser: ["GET /users/{username}/subscriptions"],
  32666. listStargazersForRepo: ["GET /repos/{owner}/{repo}/stargazers"],
  32667. listWatchedReposForAuthenticatedUser: ["GET /user/subscriptions"],
  32668. listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"],
  32669. markNotificationsAsRead: ["PUT /notifications"],
  32670. markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"],
  32671. markThreadAsDone: ["DELETE /notifications/threads/{thread_id}"],
  32672. markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"],
  32673. setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"],
  32674. setThreadSubscription: [
  32675. "PUT /notifications/threads/{thread_id}/subscription"
  32676. ],
  32677. starRepoForAuthenticatedUser: ["PUT /user/starred/{owner}/{repo}"],
  32678. unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
  32679. },
  32680. apps: {
  32681. addRepoToInstallation: [
  32682. "PUT /user/installations/{installation_id}/repositories/{repository_id}",
  32683. {},
  32684. { renamed: ["apps", "addRepoToInstallationForAuthenticatedUser"] }
  32685. ],
  32686. addRepoToInstallationForAuthenticatedUser: [
  32687. "PUT /user/installations/{installation_id}/repositories/{repository_id}"
  32688. ],
  32689. checkToken: ["POST /applications/{client_id}/token"],
  32690. createFromManifest: ["POST /app-manifests/{code}/conversions"],
  32691. createInstallationAccessToken: [
  32692. "POST /app/installations/{installation_id}/access_tokens"
  32693. ],
  32694. deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
  32695. deleteInstallation: ["DELETE /app/installations/{installation_id}"],
  32696. deleteToken: ["DELETE /applications/{client_id}/token"],
  32697. getAuthenticated: ["GET /app"],
  32698. getBySlug: ["GET /apps/{app_slug}"],
  32699. getInstallation: ["GET /app/installations/{installation_id}"],
  32700. getOrgInstallation: ["GET /orgs/{org}/installation"],
  32701. getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"],
  32702. getSubscriptionPlanForAccount: [
  32703. "GET /marketplace_listing/accounts/{account_id}"
  32704. ],
  32705. getSubscriptionPlanForAccountStubbed: [
  32706. "GET /marketplace_listing/stubbed/accounts/{account_id}"
  32707. ],
  32708. getUserInstallation: ["GET /users/{username}/installation"],
  32709. getWebhookConfigForApp: ["GET /app/hook/config"],
  32710. getWebhookDelivery: ["GET /app/hook/deliveries/{delivery_id}"],
  32711. listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
  32712. listAccountsForPlanStubbed: [
  32713. "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"
  32714. ],
  32715. listInstallationReposForAuthenticatedUser: [
  32716. "GET /user/installations/{installation_id}/repositories"
  32717. ],
  32718. listInstallationRequestsForAuthenticatedApp: [
  32719. "GET /app/installation-requests"
  32720. ],
  32721. listInstallations: ["GET /app/installations"],
  32722. listInstallationsForAuthenticatedUser: ["GET /user/installations"],
  32723. listPlans: ["GET /marketplace_listing/plans"],
  32724. listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
  32725. listReposAccessibleToInstallation: ["GET /installation/repositories"],
  32726. listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
  32727. listSubscriptionsForAuthenticatedUserStubbed: [
  32728. "GET /user/marketplace_purchases/stubbed"
  32729. ],
  32730. listWebhookDeliveries: ["GET /app/hook/deliveries"],
  32731. redeliverWebhookDelivery: [
  32732. "POST /app/hook/deliveries/{delivery_id}/attempts"
  32733. ],
  32734. removeRepoFromInstallation: [
  32735. "DELETE /user/installations/{installation_id}/repositories/{repository_id}",
  32736. {},
  32737. { renamed: ["apps", "removeRepoFromInstallationForAuthenticatedUser"] }
  32738. ],
  32739. removeRepoFromInstallationForAuthenticatedUser: [
  32740. "DELETE /user/installations/{installation_id}/repositories/{repository_id}"
  32741. ],
  32742. resetToken: ["PATCH /applications/{client_id}/token"],
  32743. revokeInstallationAccessToken: ["DELETE /installation/token"],
  32744. scopeToken: ["POST /applications/{client_id}/token/scoped"],
  32745. suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
  32746. unsuspendInstallation: [
  32747. "DELETE /app/installations/{installation_id}/suspended"
  32748. ],
  32749. updateWebhookConfigForApp: ["PATCH /app/hook/config"]
  32750. },
  32751. billing: {
  32752. getGithubActionsBillingOrg: ["GET /orgs/{org}/settings/billing/actions"],
  32753. getGithubActionsBillingUser: [
  32754. "GET /users/{username}/settings/billing/actions"
  32755. ],
  32756. getGithubBillingPremiumRequestUsageReportOrg: [
  32757. "GET /organizations/{org}/settings/billing/premium_request/usage"
  32758. ],
  32759. getGithubBillingPremiumRequestUsageReportUser: [
  32760. "GET /users/{username}/settings/billing/premium_request/usage"
  32761. ],
  32762. getGithubBillingUsageReportOrg: [
  32763. "GET /organizations/{org}/settings/billing/usage"
  32764. ],
  32765. getGithubBillingUsageReportUser: [
  32766. "GET /users/{username}/settings/billing/usage"
  32767. ],
  32768. getGithubPackagesBillingOrg: ["GET /orgs/{org}/settings/billing/packages"],
  32769. getGithubPackagesBillingUser: [
  32770. "GET /users/{username}/settings/billing/packages"
  32771. ],
  32772. getSharedStorageBillingOrg: [
  32773. "GET /orgs/{org}/settings/billing/shared-storage"
  32774. ],
  32775. getSharedStorageBillingUser: [
  32776. "GET /users/{username}/settings/billing/shared-storage"
  32777. ]
  32778. },
  32779. campaigns: {
  32780. createCampaign: ["POST /orgs/{org}/campaigns"],
  32781. deleteCampaign: ["DELETE /orgs/{org}/campaigns/{campaign_number}"],
  32782. getCampaignSummary: ["GET /orgs/{org}/campaigns/{campaign_number}"],
  32783. listOrgCampaigns: ["GET /orgs/{org}/campaigns"],
  32784. updateCampaign: ["PATCH /orgs/{org}/campaigns/{campaign_number}"]
  32785. },
  32786. checks: {
  32787. create: ["POST /repos/{owner}/{repo}/check-runs"],
  32788. createSuite: ["POST /repos/{owner}/{repo}/check-suites"],
  32789. get: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}"],
  32790. getSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}"],
  32791. listAnnotations: [
  32792. "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations"
  32793. ],
  32794. listForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-runs"],
  32795. listForSuite: [
  32796. "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs"
  32797. ],
  32798. listSuitesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-suites"],
  32799. rerequestRun: [
  32800. "POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest"
  32801. ],
  32802. rerequestSuite: [
  32803. "POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest"
  32804. ],
  32805. setSuitesPreferences: [
  32806. "PATCH /repos/{owner}/{repo}/check-suites/preferences"
  32807. ],
  32808. update: ["PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}"]
  32809. },
  32810. codeScanning: {
  32811. commitAutofix: [
  32812. "POST /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix/commits"
  32813. ],
  32814. createAutofix: [
  32815. "POST /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix"
  32816. ],
  32817. createVariantAnalysis: [
  32818. "POST /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses"
  32819. ],
  32820. deleteAnalysis: [
  32821. "DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}{?confirm_delete}"
  32822. ],
  32823. deleteCodeqlDatabase: [
  32824. "DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}"
  32825. ],
  32826. getAlert: [
  32827. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}",
  32828. {},
  32829. { renamedParameters: { alert_id: "alert_number" } }
  32830. ],
  32831. getAnalysis: [
  32832. "GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}"
  32833. ],
  32834. getAutofix: [
  32835. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix"
  32836. ],
  32837. getCodeqlDatabase: [
  32838. "GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}"
  32839. ],
  32840. getDefaultSetup: ["GET /repos/{owner}/{repo}/code-scanning/default-setup"],
  32841. getSarif: ["GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}"],
  32842. getVariantAnalysis: [
  32843. "GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}"
  32844. ],
  32845. getVariantAnalysisRepoTask: [
  32846. "GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}/repos/{repo_owner}/{repo_name}"
  32847. ],
  32848. listAlertInstances: [
  32849. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances"
  32850. ],
  32851. listAlertsForOrg: ["GET /orgs/{org}/code-scanning/alerts"],
  32852. listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
  32853. listAlertsInstances: [
  32854. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
  32855. {},
  32856. { renamed: ["codeScanning", "listAlertInstances"] }
  32857. ],
  32858. listCodeqlDatabases: [
  32859. "GET /repos/{owner}/{repo}/code-scanning/codeql/databases"
  32860. ],
  32861. listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"],
  32862. updateAlert: [
  32863. "PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"
  32864. ],
  32865. updateDefaultSetup: [
  32866. "PATCH /repos/{owner}/{repo}/code-scanning/default-setup"
  32867. ],
  32868. uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"]
  32869. },
  32870. codeSecurity: {
  32871. attachConfiguration: [
  32872. "POST /orgs/{org}/code-security/configurations/{configuration_id}/attach"
  32873. ],
  32874. attachEnterpriseConfiguration: [
  32875. "POST /enterprises/{enterprise}/code-security/configurations/{configuration_id}/attach"
  32876. ],
  32877. createConfiguration: ["POST /orgs/{org}/code-security/configurations"],
  32878. createConfigurationForEnterprise: [
  32879. "POST /enterprises/{enterprise}/code-security/configurations"
  32880. ],
  32881. deleteConfiguration: [
  32882. "DELETE /orgs/{org}/code-security/configurations/{configuration_id}"
  32883. ],
  32884. deleteConfigurationForEnterprise: [
  32885. "DELETE /enterprises/{enterprise}/code-security/configurations/{configuration_id}"
  32886. ],
  32887. detachConfiguration: [
  32888. "DELETE /orgs/{org}/code-security/configurations/detach"
  32889. ],
  32890. getConfiguration: [
  32891. "GET /orgs/{org}/code-security/configurations/{configuration_id}"
  32892. ],
  32893. getConfigurationForRepository: [
  32894. "GET /repos/{owner}/{repo}/code-security-configuration"
  32895. ],
  32896. getConfigurationsForEnterprise: [
  32897. "GET /enterprises/{enterprise}/code-security/configurations"
  32898. ],
  32899. getConfigurationsForOrg: ["GET /orgs/{org}/code-security/configurations"],
  32900. getDefaultConfigurations: [
  32901. "GET /orgs/{org}/code-security/configurations/defaults"
  32902. ],
  32903. getDefaultConfigurationsForEnterprise: [
  32904. "GET /enterprises/{enterprise}/code-security/configurations/defaults"
  32905. ],
  32906. getRepositoriesForConfiguration: [
  32907. "GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories"
  32908. ],
  32909. getRepositoriesForEnterpriseConfiguration: [
  32910. "GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories"
  32911. ],
  32912. getSingleConfigurationForEnterprise: [
  32913. "GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}"
  32914. ],
  32915. setConfigurationAsDefault: [
  32916. "PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults"
  32917. ],
  32918. setConfigurationAsDefaultForEnterprise: [
  32919. "PUT /enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults"
  32920. ],
  32921. updateConfiguration: [
  32922. "PATCH /orgs/{org}/code-security/configurations/{configuration_id}"
  32923. ],
  32924. updateEnterpriseConfiguration: [
  32925. "PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id}"
  32926. ]
  32927. },
  32928. codesOfConduct: {
  32929. getAllCodesOfConduct: ["GET /codes_of_conduct"],
  32930. getConductCode: ["GET /codes_of_conduct/{key}"]
  32931. },
  32932. codespaces: {
  32933. addRepositoryForSecretForAuthenticatedUser: [
  32934. "PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  32935. ],
  32936. addSelectedRepoToOrgSecret: [
  32937. "PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  32938. ],
  32939. checkPermissionsForDevcontainer: [
  32940. "GET /repos/{owner}/{repo}/codespaces/permissions_check"
  32941. ],
  32942. codespaceMachinesForAuthenticatedUser: [
  32943. "GET /user/codespaces/{codespace_name}/machines"
  32944. ],
  32945. createForAuthenticatedUser: ["POST /user/codespaces"],
  32946. createOrUpdateOrgSecret: [
  32947. "PUT /orgs/{org}/codespaces/secrets/{secret_name}"
  32948. ],
  32949. createOrUpdateRepoSecret: [
  32950. "PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
  32951. ],
  32952. createOrUpdateSecretForAuthenticatedUser: [
  32953. "PUT /user/codespaces/secrets/{secret_name}"
  32954. ],
  32955. createWithPrForAuthenticatedUser: [
  32956. "POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces"
  32957. ],
  32958. createWithRepoForAuthenticatedUser: [
  32959. "POST /repos/{owner}/{repo}/codespaces"
  32960. ],
  32961. deleteForAuthenticatedUser: ["DELETE /user/codespaces/{codespace_name}"],
  32962. deleteFromOrganization: [
  32963. "DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name}"
  32964. ],
  32965. deleteOrgSecret: ["DELETE /orgs/{org}/codespaces/secrets/{secret_name}"],
  32966. deleteRepoSecret: [
  32967. "DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
  32968. ],
  32969. deleteSecretForAuthenticatedUser: [
  32970. "DELETE /user/codespaces/secrets/{secret_name}"
  32971. ],
  32972. exportForAuthenticatedUser: [
  32973. "POST /user/codespaces/{codespace_name}/exports"
  32974. ],
  32975. getCodespacesForUserInOrg: [
  32976. "GET /orgs/{org}/members/{username}/codespaces"
  32977. ],
  32978. getExportDetailsForAuthenticatedUser: [
  32979. "GET /user/codespaces/{codespace_name}/exports/{export_id}"
  32980. ],
  32981. getForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}"],
  32982. getOrgPublicKey: ["GET /orgs/{org}/codespaces/secrets/public-key"],
  32983. getOrgSecret: ["GET /orgs/{org}/codespaces/secrets/{secret_name}"],
  32984. getPublicKeyForAuthenticatedUser: [
  32985. "GET /user/codespaces/secrets/public-key"
  32986. ],
  32987. getRepoPublicKey: [
  32988. "GET /repos/{owner}/{repo}/codespaces/secrets/public-key"
  32989. ],
  32990. getRepoSecret: [
  32991. "GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
  32992. ],
  32993. getSecretForAuthenticatedUser: [
  32994. "GET /user/codespaces/secrets/{secret_name}"
  32995. ],
  32996. listDevcontainersInRepositoryForAuthenticatedUser: [
  32997. "GET /repos/{owner}/{repo}/codespaces/devcontainers"
  32998. ],
  32999. listForAuthenticatedUser: ["GET /user/codespaces"],
  33000. listInOrganization: [
  33001. "GET /orgs/{org}/codespaces",
  33002. {},
  33003. { renamedParameters: { org_id: "org" } }
  33004. ],
  33005. listInRepositoryForAuthenticatedUser: [
  33006. "GET /repos/{owner}/{repo}/codespaces"
  33007. ],
  33008. listOrgSecrets: ["GET /orgs/{org}/codespaces/secrets"],
  33009. listRepoSecrets: ["GET /repos/{owner}/{repo}/codespaces/secrets"],
  33010. listRepositoriesForSecretForAuthenticatedUser: [
  33011. "GET /user/codespaces/secrets/{secret_name}/repositories"
  33012. ],
  33013. listSecretsForAuthenticatedUser: ["GET /user/codespaces/secrets"],
  33014. listSelectedReposForOrgSecret: [
  33015. "GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories"
  33016. ],
  33017. preFlightWithRepoForAuthenticatedUser: [
  33018. "GET /repos/{owner}/{repo}/codespaces/new"
  33019. ],
  33020. publishForAuthenticatedUser: [
  33021. "POST /user/codespaces/{codespace_name}/publish"
  33022. ],
  33023. removeRepositoryForSecretForAuthenticatedUser: [
  33024. "DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  33025. ],
  33026. removeSelectedRepoFromOrgSecret: [
  33027. "DELETE /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  33028. ],
  33029. repoMachinesForAuthenticatedUser: [
  33030. "GET /repos/{owner}/{repo}/codespaces/machines"
  33031. ],
  33032. setRepositoriesForSecretForAuthenticatedUser: [
  33033. "PUT /user/codespaces/secrets/{secret_name}/repositories"
  33034. ],
  33035. setSelectedReposForOrgSecret: [
  33036. "PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories"
  33037. ],
  33038. startForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/start"],
  33039. stopForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/stop"],
  33040. stopInOrganization: [
  33041. "POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop"
  33042. ],
  33043. updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"]
  33044. },
  33045. copilot: {
  33046. addCopilotSeatsForTeams: [
  33047. "POST /orgs/{org}/copilot/billing/selected_teams"
  33048. ],
  33049. addCopilotSeatsForUsers: [
  33050. "POST /orgs/{org}/copilot/billing/selected_users"
  33051. ],
  33052. cancelCopilotSeatAssignmentForTeams: [
  33053. "DELETE /orgs/{org}/copilot/billing/selected_teams"
  33054. ],
  33055. cancelCopilotSeatAssignmentForUsers: [
  33056. "DELETE /orgs/{org}/copilot/billing/selected_users"
  33057. ],
  33058. copilotMetricsForOrganization: ["GET /orgs/{org}/copilot/metrics"],
  33059. copilotMetricsForTeam: ["GET /orgs/{org}/team/{team_slug}/copilot/metrics"],
  33060. getCopilotOrganizationDetails: ["GET /orgs/{org}/copilot/billing"],
  33061. getCopilotSeatDetailsForUser: [
  33062. "GET /orgs/{org}/members/{username}/copilot"
  33063. ],
  33064. listCopilotSeats: ["GET /orgs/{org}/copilot/billing/seats"]
  33065. },
  33066. credentials: { revoke: ["POST /credentials/revoke"] },
  33067. dependabot: {
  33068. addSelectedRepoToOrgSecret: [
  33069. "PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"
  33070. ],
  33071. createOrUpdateOrgSecret: [
  33072. "PUT /orgs/{org}/dependabot/secrets/{secret_name}"
  33073. ],
  33074. createOrUpdateRepoSecret: [
  33075. "PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
  33076. ],
  33077. deleteOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}"],
  33078. deleteRepoSecret: [
  33079. "DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
  33080. ],
  33081. getAlert: ["GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number}"],
  33082. getOrgPublicKey: ["GET /orgs/{org}/dependabot/secrets/public-key"],
  33083. getOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}"],
  33084. getRepoPublicKey: [
  33085. "GET /repos/{owner}/{repo}/dependabot/secrets/public-key"
  33086. ],
  33087. getRepoSecret: [
  33088. "GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
  33089. ],
  33090. listAlertsForEnterprise: [
  33091. "GET /enterprises/{enterprise}/dependabot/alerts"
  33092. ],
  33093. listAlertsForOrg: ["GET /orgs/{org}/dependabot/alerts"],
  33094. listAlertsForRepo: ["GET /repos/{owner}/{repo}/dependabot/alerts"],
  33095. listOrgSecrets: ["GET /orgs/{org}/dependabot/secrets"],
  33096. listRepoSecrets: ["GET /repos/{owner}/{repo}/dependabot/secrets"],
  33097. listSelectedReposForOrgSecret: [
  33098. "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories"
  33099. ],
  33100. removeSelectedRepoFromOrgSecret: [
  33101. "DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"
  33102. ],
  33103. repositoryAccessForOrg: [
  33104. "GET /organizations/{org}/dependabot/repository-access"
  33105. ],
  33106. setRepositoryAccessDefaultLevel: [
  33107. "PUT /organizations/{org}/dependabot/repository-access/default-level"
  33108. ],
  33109. setSelectedReposForOrgSecret: [
  33110. "PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories"
  33111. ],
  33112. updateAlert: [
  33113. "PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number}"
  33114. ],
  33115. updateRepositoryAccessForOrg: [
  33116. "PATCH /organizations/{org}/dependabot/repository-access"
  33117. ]
  33118. },
  33119. dependencyGraph: {
  33120. createRepositorySnapshot: [
  33121. "POST /repos/{owner}/{repo}/dependency-graph/snapshots"
  33122. ],
  33123. diffRange: [
  33124. "GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}"
  33125. ],
  33126. exportSbom: ["GET /repos/{owner}/{repo}/dependency-graph/sbom"]
  33127. },
  33128. emojis: { get: ["GET /emojis"] },
  33129. enterpriseTeamMemberships: {
  33130. add: [
  33131. "PUT /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}"
  33132. ],
  33133. bulkAdd: [
  33134. "POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/add"
  33135. ],
  33136. bulkRemove: [
  33137. "POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/remove"
  33138. ],
  33139. get: [
  33140. "GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}"
  33141. ],
  33142. list: ["GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships"],
  33143. remove: [
  33144. "DELETE /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}"
  33145. ]
  33146. },
  33147. enterpriseTeamOrganizations: {
  33148. add: [
  33149. "PUT /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org}"
  33150. ],
  33151. bulkAdd: [
  33152. "POST /enterprises/{enterprise}/teams/{enterprise-team}/organizations/add"
  33153. ],
  33154. bulkRemove: [
  33155. "POST /enterprises/{enterprise}/teams/{enterprise-team}/organizations/remove"
  33156. ],
  33157. delete: [
  33158. "DELETE /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org}"
  33159. ],
  33160. getAssignment: [
  33161. "GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org}"
  33162. ],
  33163. getAssignments: [
  33164. "GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations"
  33165. ]
  33166. },
  33167. enterpriseTeams: {
  33168. create: ["POST /enterprises/{enterprise}/teams"],
  33169. delete: ["DELETE /enterprises/{enterprise}/teams/{team_slug}"],
  33170. get: ["GET /enterprises/{enterprise}/teams/{team_slug}"],
  33171. list: ["GET /enterprises/{enterprise}/teams"],
  33172. update: ["PATCH /enterprises/{enterprise}/teams/{team_slug}"]
  33173. },
  33174. gists: {
  33175. checkIsStarred: ["GET /gists/{gist_id}/star"],
  33176. create: ["POST /gists"],
  33177. createComment: ["POST /gists/{gist_id}/comments"],
  33178. delete: ["DELETE /gists/{gist_id}"],
  33179. deleteComment: ["DELETE /gists/{gist_id}/comments/{comment_id}"],
  33180. fork: ["POST /gists/{gist_id}/forks"],
  33181. get: ["GET /gists/{gist_id}"],
  33182. getComment: ["GET /gists/{gist_id}/comments/{comment_id}"],
  33183. getRevision: ["GET /gists/{gist_id}/{sha}"],
  33184. list: ["GET /gists"],
  33185. listComments: ["GET /gists/{gist_id}/comments"],
  33186. listCommits: ["GET /gists/{gist_id}/commits"],
  33187. listForUser: ["GET /users/{username}/gists"],
  33188. listForks: ["GET /gists/{gist_id}/forks"],
  33189. listPublic: ["GET /gists/public"],
  33190. listStarred: ["GET /gists/starred"],
  33191. star: ["PUT /gists/{gist_id}/star"],
  33192. unstar: ["DELETE /gists/{gist_id}/star"],
  33193. update: ["PATCH /gists/{gist_id}"],
  33194. updateComment: ["PATCH /gists/{gist_id}/comments/{comment_id}"]
  33195. },
  33196. git: {
  33197. createBlob: ["POST /repos/{owner}/{repo}/git/blobs"],
  33198. createCommit: ["POST /repos/{owner}/{repo}/git/commits"],
  33199. createRef: ["POST /repos/{owner}/{repo}/git/refs"],
  33200. createTag: ["POST /repos/{owner}/{repo}/git/tags"],
  33201. createTree: ["POST /repos/{owner}/{repo}/git/trees"],
  33202. deleteRef: ["DELETE /repos/{owner}/{repo}/git/refs/{ref}"],
  33203. getBlob: ["GET /repos/{owner}/{repo}/git/blobs/{file_sha}"],
  33204. getCommit: ["GET /repos/{owner}/{repo}/git/commits/{commit_sha}"],
  33205. getRef: ["GET /repos/{owner}/{repo}/git/ref/{ref}"],
  33206. getTag: ["GET /repos/{owner}/{repo}/git/tags/{tag_sha}"],
  33207. getTree: ["GET /repos/{owner}/{repo}/git/trees/{tree_sha}"],
  33208. listMatchingRefs: ["GET /repos/{owner}/{repo}/git/matching-refs/{ref}"],
  33209. updateRef: ["PATCH /repos/{owner}/{repo}/git/refs/{ref}"]
  33210. },
  33211. gitignore: {
  33212. getAllTemplates: ["GET /gitignore/templates"],
  33213. getTemplate: ["GET /gitignore/templates/{name}"]
  33214. },
  33215. hostedCompute: {
  33216. createNetworkConfigurationForOrg: [
  33217. "POST /orgs/{org}/settings/network-configurations"
  33218. ],
  33219. deleteNetworkConfigurationFromOrg: [
  33220. "DELETE /orgs/{org}/settings/network-configurations/{network_configuration_id}"
  33221. ],
  33222. getNetworkConfigurationForOrg: [
  33223. "GET /orgs/{org}/settings/network-configurations/{network_configuration_id}"
  33224. ],
  33225. getNetworkSettingsForOrg: [
  33226. "GET /orgs/{org}/settings/network-settings/{network_settings_id}"
  33227. ],
  33228. listNetworkConfigurationsForOrg: [
  33229. "GET /orgs/{org}/settings/network-configurations"
  33230. ],
  33231. updateNetworkConfigurationForOrg: [
  33232. "PATCH /orgs/{org}/settings/network-configurations/{network_configuration_id}"
  33233. ]
  33234. },
  33235. interactions: {
  33236. getRestrictionsForAuthenticatedUser: ["GET /user/interaction-limits"],
  33237. getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits"],
  33238. getRestrictionsForRepo: ["GET /repos/{owner}/{repo}/interaction-limits"],
  33239. getRestrictionsForYourPublicRepos: [
  33240. "GET /user/interaction-limits",
  33241. {},
  33242. { renamed: ["interactions", "getRestrictionsForAuthenticatedUser"] }
  33243. ],
  33244. removeRestrictionsForAuthenticatedUser: ["DELETE /user/interaction-limits"],
  33245. removeRestrictionsForOrg: ["DELETE /orgs/{org}/interaction-limits"],
  33246. removeRestrictionsForRepo: [
  33247. "DELETE /repos/{owner}/{repo}/interaction-limits"
  33248. ],
  33249. removeRestrictionsForYourPublicRepos: [
  33250. "DELETE /user/interaction-limits",
  33251. {},
  33252. { renamed: ["interactions", "removeRestrictionsForAuthenticatedUser"] }
  33253. ],
  33254. setRestrictionsForAuthenticatedUser: ["PUT /user/interaction-limits"],
  33255. setRestrictionsForOrg: ["PUT /orgs/{org}/interaction-limits"],
  33256. setRestrictionsForRepo: ["PUT /repos/{owner}/{repo}/interaction-limits"],
  33257. setRestrictionsForYourPublicRepos: [
  33258. "PUT /user/interaction-limits",
  33259. {},
  33260. { renamed: ["interactions", "setRestrictionsForAuthenticatedUser"] }
  33261. ]
  33262. },
  33263. issues: {
  33264. addAssignees: [
  33265. "POST /repos/{owner}/{repo}/issues/{issue_number}/assignees"
  33266. ],
  33267. addBlockedByDependency: [
  33268. "POST /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by"
  33269. ],
  33270. addLabels: ["POST /repos/{owner}/{repo}/issues/{issue_number}/labels"],
  33271. addSubIssue: [
  33272. "POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues"
  33273. ],
  33274. checkUserCanBeAssigned: ["GET /repos/{owner}/{repo}/assignees/{assignee}"],
  33275. checkUserCanBeAssignedToIssue: [
  33276. "GET /repos/{owner}/{repo}/issues/{issue_number}/assignees/{assignee}"
  33277. ],
  33278. create: ["POST /repos/{owner}/{repo}/issues"],
  33279. createComment: [
  33280. "POST /repos/{owner}/{repo}/issues/{issue_number}/comments"
  33281. ],
  33282. createLabel: ["POST /repos/{owner}/{repo}/labels"],
  33283. createMilestone: ["POST /repos/{owner}/{repo}/milestones"],
  33284. deleteComment: [
  33285. "DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}"
  33286. ],
  33287. deleteLabel: ["DELETE /repos/{owner}/{repo}/labels/{name}"],
  33288. deleteMilestone: [
  33289. "DELETE /repos/{owner}/{repo}/milestones/{milestone_number}"
  33290. ],
  33291. get: ["GET /repos/{owner}/{repo}/issues/{issue_number}"],
  33292. getComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}"],
  33293. getEvent: ["GET /repos/{owner}/{repo}/issues/events/{event_id}"],
  33294. getLabel: ["GET /repos/{owner}/{repo}/labels/{name}"],
  33295. getMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}"],
  33296. getParent: ["GET /repos/{owner}/{repo}/issues/{issue_number}/parent"],
  33297. list: ["GET /issues"],
  33298. listAssignees: ["GET /repos/{owner}/{repo}/assignees"],
  33299. listComments: ["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"],
  33300. listCommentsForRepo: ["GET /repos/{owner}/{repo}/issues/comments"],
  33301. listDependenciesBlockedBy: [
  33302. "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by"
  33303. ],
  33304. listDependenciesBlocking: [
  33305. "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking"
  33306. ],
  33307. listEvents: ["GET /repos/{owner}/{repo}/issues/{issue_number}/events"],
  33308. listEventsForRepo: ["GET /repos/{owner}/{repo}/issues/events"],
  33309. listEventsForTimeline: [
  33310. "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline"
  33311. ],
  33312. listForAuthenticatedUser: ["GET /user/issues"],
  33313. listForOrg: ["GET /orgs/{org}/issues"],
  33314. listForRepo: ["GET /repos/{owner}/{repo}/issues"],
  33315. listLabelsForMilestone: [
  33316. "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels"
  33317. ],
  33318. listLabelsForRepo: ["GET /repos/{owner}/{repo}/labels"],
  33319. listLabelsOnIssue: [
  33320. "GET /repos/{owner}/{repo}/issues/{issue_number}/labels"
  33321. ],
  33322. listMilestones: ["GET /repos/{owner}/{repo}/milestones"],
  33323. listSubIssues: [
  33324. "GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues"
  33325. ],
  33326. lock: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/lock"],
  33327. removeAllLabels: [
  33328. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels"
  33329. ],
  33330. removeAssignees: [
  33331. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees"
  33332. ],
  33333. removeDependencyBlockedBy: [
  33334. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by/{issue_id}"
  33335. ],
  33336. removeLabel: [
  33337. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}"
  33338. ],
  33339. removeSubIssue: [
  33340. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/sub_issue"
  33341. ],
  33342. reprioritizeSubIssue: [
  33343. "PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority"
  33344. ],
  33345. setLabels: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/labels"],
  33346. unlock: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock"],
  33347. update: ["PATCH /repos/{owner}/{repo}/issues/{issue_number}"],
  33348. updateComment: ["PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}"],
  33349. updateLabel: ["PATCH /repos/{owner}/{repo}/labels/{name}"],
  33350. updateMilestone: [
  33351. "PATCH /repos/{owner}/{repo}/milestones/{milestone_number}"
  33352. ]
  33353. },
  33354. licenses: {
  33355. get: ["GET /licenses/{license}"],
  33356. getAllCommonlyUsed: ["GET /licenses"],
  33357. getForRepo: ["GET /repos/{owner}/{repo}/license"]
  33358. },
  33359. markdown: {
  33360. render: ["POST /markdown"],
  33361. renderRaw: [
  33362. "POST /markdown/raw",
  33363. { headers: { "content-type": "text/plain; charset=utf-8" } }
  33364. ]
  33365. },
  33366. meta: {
  33367. get: ["GET /meta"],
  33368. getAllVersions: ["GET /versions"],
  33369. getOctocat: ["GET /octocat"],
  33370. getZen: ["GET /zen"],
  33371. root: ["GET /"]
  33372. },
  33373. migrations: {
  33374. deleteArchiveForAuthenticatedUser: [
  33375. "DELETE /user/migrations/{migration_id}/archive"
  33376. ],
  33377. deleteArchiveForOrg: [
  33378. "DELETE /orgs/{org}/migrations/{migration_id}/archive"
  33379. ],
  33380. downloadArchiveForOrg: [
  33381. "GET /orgs/{org}/migrations/{migration_id}/archive"
  33382. ],
  33383. getArchiveForAuthenticatedUser: [
  33384. "GET /user/migrations/{migration_id}/archive"
  33385. ],
  33386. getStatusForAuthenticatedUser: ["GET /user/migrations/{migration_id}"],
  33387. getStatusForOrg: ["GET /orgs/{org}/migrations/{migration_id}"],
  33388. listForAuthenticatedUser: ["GET /user/migrations"],
  33389. listForOrg: ["GET /orgs/{org}/migrations"],
  33390. listReposForAuthenticatedUser: [
  33391. "GET /user/migrations/{migration_id}/repositories"
  33392. ],
  33393. listReposForOrg: ["GET /orgs/{org}/migrations/{migration_id}/repositories"],
  33394. listReposForUser: [
  33395. "GET /user/migrations/{migration_id}/repositories",
  33396. {},
  33397. { renamed: ["migrations", "listReposForAuthenticatedUser"] }
  33398. ],
  33399. startForAuthenticatedUser: ["POST /user/migrations"],
  33400. startForOrg: ["POST /orgs/{org}/migrations"],
  33401. unlockRepoForAuthenticatedUser: [
  33402. "DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock"
  33403. ],
  33404. unlockRepoForOrg: [
  33405. "DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock"
  33406. ]
  33407. },
  33408. oidc: {
  33409. getOidcCustomSubTemplateForOrg: [
  33410. "GET /orgs/{org}/actions/oidc/customization/sub"
  33411. ],
  33412. updateOidcCustomSubTemplateForOrg: [
  33413. "PUT /orgs/{org}/actions/oidc/customization/sub"
  33414. ]
  33415. },
  33416. orgs: {
  33417. addSecurityManagerTeam: [
  33418. "PUT /orgs/{org}/security-managers/teams/{team_slug}",
  33419. {},
  33420. {
  33421. deprecated: "octokit.rest.orgs.addSecurityManagerTeam() is deprecated, see https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team"
  33422. }
  33423. ],
  33424. assignTeamToOrgRole: [
  33425. "PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
  33426. ],
  33427. assignUserToOrgRole: [
  33428. "PUT /orgs/{org}/organization-roles/users/{username}/{role_id}"
  33429. ],
  33430. blockUser: ["PUT /orgs/{org}/blocks/{username}"],
  33431. cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"],
  33432. checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"],
  33433. checkMembershipForUser: ["GET /orgs/{org}/members/{username}"],
  33434. checkPublicMembershipForUser: ["GET /orgs/{org}/public_members/{username}"],
  33435. convertMemberToOutsideCollaborator: [
  33436. "PUT /orgs/{org}/outside_collaborators/{username}"
  33437. ],
  33438. createArtifactStorageRecord: [
  33439. "POST /orgs/{org}/artifacts/metadata/storage-record"
  33440. ],
  33441. createInvitation: ["POST /orgs/{org}/invitations"],
  33442. createIssueType: ["POST /orgs/{org}/issue-types"],
  33443. createWebhook: ["POST /orgs/{org}/hooks"],
  33444. customPropertiesForOrgsCreateOrUpdateOrganizationValues: [
  33445. "PATCH /organizations/{org}/org-properties/values"
  33446. ],
  33447. customPropertiesForOrgsGetOrganizationValues: [
  33448. "GET /organizations/{org}/org-properties/values"
  33449. ],
  33450. customPropertiesForReposCreateOrUpdateOrganizationDefinition: [
  33451. "PUT /orgs/{org}/properties/schema/{custom_property_name}"
  33452. ],
  33453. customPropertiesForReposCreateOrUpdateOrganizationDefinitions: [
  33454. "PATCH /orgs/{org}/properties/schema"
  33455. ],
  33456. customPropertiesForReposCreateOrUpdateOrganizationValues: [
  33457. "PATCH /orgs/{org}/properties/values"
  33458. ],
  33459. customPropertiesForReposDeleteOrganizationDefinition: [
  33460. "DELETE /orgs/{org}/properties/schema/{custom_property_name}"
  33461. ],
  33462. customPropertiesForReposGetOrganizationDefinition: [
  33463. "GET /orgs/{org}/properties/schema/{custom_property_name}"
  33464. ],
  33465. customPropertiesForReposGetOrganizationDefinitions: [
  33466. "GET /orgs/{org}/properties/schema"
  33467. ],
  33468. customPropertiesForReposGetOrganizationValues: [
  33469. "GET /orgs/{org}/properties/values"
  33470. ],
  33471. delete: ["DELETE /orgs/{org}"],
  33472. deleteAttestationsBulk: ["POST /orgs/{org}/attestations/delete-request"],
  33473. deleteAttestationsById: [
  33474. "DELETE /orgs/{org}/attestations/{attestation_id}"
  33475. ],
  33476. deleteAttestationsBySubjectDigest: [
  33477. "DELETE /orgs/{org}/attestations/digest/{subject_digest}"
  33478. ],
  33479. deleteIssueType: ["DELETE /orgs/{org}/issue-types/{issue_type_id}"],
  33480. deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"],
  33481. disableSelectedRepositoryImmutableReleasesOrganization: [
  33482. "DELETE /orgs/{org}/settings/immutable-releases/repositories/{repository_id}"
  33483. ],
  33484. enableSelectedRepositoryImmutableReleasesOrganization: [
  33485. "PUT /orgs/{org}/settings/immutable-releases/repositories/{repository_id}"
  33486. ],
  33487. get: ["GET /orgs/{org}"],
  33488. getImmutableReleasesSettings: [
  33489. "GET /orgs/{org}/settings/immutable-releases"
  33490. ],
  33491. getImmutableReleasesSettingsRepositories: [
  33492. "GET /orgs/{org}/settings/immutable-releases/repositories"
  33493. ],
  33494. getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"],
  33495. getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
  33496. getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"],
  33497. getOrgRulesetHistory: ["GET /orgs/{org}/rulesets/{ruleset_id}/history"],
  33498. getOrgRulesetVersion: [
  33499. "GET /orgs/{org}/rulesets/{ruleset_id}/history/{version_id}"
  33500. ],
  33501. getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
  33502. getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"],
  33503. getWebhookDelivery: [
  33504. "GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}"
  33505. ],
  33506. list: ["GET /organizations"],
  33507. listAppInstallations: ["GET /orgs/{org}/installations"],
  33508. listArtifactStorageRecords: [
  33509. "GET /orgs/{org}/artifacts/{subject_digest}/metadata/storage-records"
  33510. ],
  33511. listAttestationRepositories: ["GET /orgs/{org}/attestations/repositories"],
  33512. listAttestations: ["GET /orgs/{org}/attestations/{subject_digest}"],
  33513. listAttestationsBulk: [
  33514. "POST /orgs/{org}/attestations/bulk-list{?per_page,before,after}"
  33515. ],
  33516. listBlockedUsers: ["GET /orgs/{org}/blocks"],
  33517. listFailedInvitations: ["GET /orgs/{org}/failed_invitations"],
  33518. listForAuthenticatedUser: ["GET /user/orgs"],
  33519. listForUser: ["GET /users/{username}/orgs"],
  33520. listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"],
  33521. listIssueTypes: ["GET /orgs/{org}/issue-types"],
  33522. listMembers: ["GET /orgs/{org}/members"],
  33523. listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"],
  33524. listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"],
  33525. listOrgRoleUsers: ["GET /orgs/{org}/organization-roles/{role_id}/users"],
  33526. listOrgRoles: ["GET /orgs/{org}/organization-roles"],
  33527. listOrganizationFineGrainedPermissions: [
  33528. "GET /orgs/{org}/organization-fine-grained-permissions"
  33529. ],
  33530. listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"],
  33531. listPatGrantRepositories: [
  33532. "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories"
  33533. ],
  33534. listPatGrantRequestRepositories: [
  33535. "GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories"
  33536. ],
  33537. listPatGrantRequests: ["GET /orgs/{org}/personal-access-token-requests"],
  33538. listPatGrants: ["GET /orgs/{org}/personal-access-tokens"],
  33539. listPendingInvitations: ["GET /orgs/{org}/invitations"],
  33540. listPublicMembers: ["GET /orgs/{org}/public_members"],
  33541. listSecurityManagerTeams: [
  33542. "GET /orgs/{org}/security-managers",
  33543. {},
  33544. {
  33545. deprecated: "octokit.rest.orgs.listSecurityManagerTeams() is deprecated, see https://docs.github.com/rest/orgs/security-managers#list-security-manager-teams"
  33546. }
  33547. ],
  33548. listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"],
  33549. listWebhooks: ["GET /orgs/{org}/hooks"],
  33550. pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"],
  33551. redeliverWebhookDelivery: [
  33552. "POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"
  33553. ],
  33554. removeMember: ["DELETE /orgs/{org}/members/{username}"],
  33555. removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"],
  33556. removeOutsideCollaborator: [
  33557. "DELETE /orgs/{org}/outside_collaborators/{username}"
  33558. ],
  33559. removePublicMembershipForAuthenticatedUser: [
  33560. "DELETE /orgs/{org}/public_members/{username}"
  33561. ],
  33562. removeSecurityManagerTeam: [
  33563. "DELETE /orgs/{org}/security-managers/teams/{team_slug}",
  33564. {},
  33565. {
  33566. deprecated: "octokit.rest.orgs.removeSecurityManagerTeam() is deprecated, see https://docs.github.com/rest/orgs/security-managers#remove-a-security-manager-team"
  33567. }
  33568. ],
  33569. reviewPatGrantRequest: [
  33570. "POST /orgs/{org}/personal-access-token-requests/{pat_request_id}"
  33571. ],
  33572. reviewPatGrantRequestsInBulk: [
  33573. "POST /orgs/{org}/personal-access-token-requests"
  33574. ],
  33575. revokeAllOrgRolesTeam: [
  33576. "DELETE /orgs/{org}/organization-roles/teams/{team_slug}"
  33577. ],
  33578. revokeAllOrgRolesUser: [
  33579. "DELETE /orgs/{org}/organization-roles/users/{username}"
  33580. ],
  33581. revokeOrgRoleTeam: [
  33582. "DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
  33583. ],
  33584. revokeOrgRoleUser: [
  33585. "DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}"
  33586. ],
  33587. setImmutableReleasesSettings: [
  33588. "PUT /orgs/{org}/settings/immutable-releases"
  33589. ],
  33590. setImmutableReleasesSettingsRepositories: [
  33591. "PUT /orgs/{org}/settings/immutable-releases/repositories"
  33592. ],
  33593. setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"],
  33594. setPublicMembershipForAuthenticatedUser: [
  33595. "PUT /orgs/{org}/public_members/{username}"
  33596. ],
  33597. unblockUser: ["DELETE /orgs/{org}/blocks/{username}"],
  33598. update: ["PATCH /orgs/{org}"],
  33599. updateIssueType: ["PUT /orgs/{org}/issue-types/{issue_type_id}"],
  33600. updateMembershipForAuthenticatedUser: [
  33601. "PATCH /user/memberships/orgs/{org}"
  33602. ],
  33603. updatePatAccess: ["POST /orgs/{org}/personal-access-tokens/{pat_id}"],
  33604. updatePatAccesses: ["POST /orgs/{org}/personal-access-tokens"],
  33605. updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"],
  33606. updateWebhookConfigForOrg: ["PATCH /orgs/{org}/hooks/{hook_id}/config"]
  33607. },
  33608. packages: {
  33609. deletePackageForAuthenticatedUser: [
  33610. "DELETE /user/packages/{package_type}/{package_name}"
  33611. ],
  33612. deletePackageForOrg: [
  33613. "DELETE /orgs/{org}/packages/{package_type}/{package_name}"
  33614. ],
  33615. deletePackageForUser: [
  33616. "DELETE /users/{username}/packages/{package_type}/{package_name}"
  33617. ],
  33618. deletePackageVersionForAuthenticatedUser: [
  33619. "DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33620. ],
  33621. deletePackageVersionForOrg: [
  33622. "DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33623. ],
  33624. deletePackageVersionForUser: [
  33625. "DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33626. ],
  33627. getAllPackageVersionsForAPackageOwnedByAnOrg: [
  33628. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
  33629. {},
  33630. { renamed: ["packages", "getAllPackageVersionsForPackageOwnedByOrg"] }
  33631. ],
  33632. getAllPackageVersionsForAPackageOwnedByTheAuthenticatedUser: [
  33633. "GET /user/packages/{package_type}/{package_name}/versions",
  33634. {},
  33635. {
  33636. renamed: [
  33637. "packages",
  33638. "getAllPackageVersionsForPackageOwnedByAuthenticatedUser"
  33639. ]
  33640. }
  33641. ],
  33642. getAllPackageVersionsForPackageOwnedByAuthenticatedUser: [
  33643. "GET /user/packages/{package_type}/{package_name}/versions"
  33644. ],
  33645. getAllPackageVersionsForPackageOwnedByOrg: [
  33646. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions"
  33647. ],
  33648. getAllPackageVersionsForPackageOwnedByUser: [
  33649. "GET /users/{username}/packages/{package_type}/{package_name}/versions"
  33650. ],
  33651. getPackageForAuthenticatedUser: [
  33652. "GET /user/packages/{package_type}/{package_name}"
  33653. ],
  33654. getPackageForOrganization: [
  33655. "GET /orgs/{org}/packages/{package_type}/{package_name}"
  33656. ],
  33657. getPackageForUser: [
  33658. "GET /users/{username}/packages/{package_type}/{package_name}"
  33659. ],
  33660. getPackageVersionForAuthenticatedUser: [
  33661. "GET /user/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33662. ],
  33663. getPackageVersionForOrganization: [
  33664. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33665. ],
  33666. getPackageVersionForUser: [
  33667. "GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33668. ],
  33669. listDockerMigrationConflictingPackagesForAuthenticatedUser: [
  33670. "GET /user/docker/conflicts"
  33671. ],
  33672. listDockerMigrationConflictingPackagesForOrganization: [
  33673. "GET /orgs/{org}/docker/conflicts"
  33674. ],
  33675. listDockerMigrationConflictingPackagesForUser: [
  33676. "GET /users/{username}/docker/conflicts"
  33677. ],
  33678. listPackagesForAuthenticatedUser: ["GET /user/packages"],
  33679. listPackagesForOrganization: ["GET /orgs/{org}/packages"],
  33680. listPackagesForUser: ["GET /users/{username}/packages"],
  33681. restorePackageForAuthenticatedUser: [
  33682. "POST /user/packages/{package_type}/{package_name}/restore{?token}"
  33683. ],
  33684. restorePackageForOrg: [
  33685. "POST /orgs/{org}/packages/{package_type}/{package_name}/restore{?token}"
  33686. ],
  33687. restorePackageForUser: [
  33688. "POST /users/{username}/packages/{package_type}/{package_name}/restore{?token}"
  33689. ],
  33690. restorePackageVersionForAuthenticatedUser: [
  33691. "POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
  33692. ],
  33693. restorePackageVersionForOrg: [
  33694. "POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
  33695. ],
  33696. restorePackageVersionForUser: [
  33697. "POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
  33698. ]
  33699. },
  33700. privateRegistries: {
  33701. createOrgPrivateRegistry: ["POST /orgs/{org}/private-registries"],
  33702. deleteOrgPrivateRegistry: [
  33703. "DELETE /orgs/{org}/private-registries/{secret_name}"
  33704. ],
  33705. getOrgPrivateRegistry: ["GET /orgs/{org}/private-registries/{secret_name}"],
  33706. getOrgPublicKey: ["GET /orgs/{org}/private-registries/public-key"],
  33707. listOrgPrivateRegistries: ["GET /orgs/{org}/private-registries"],
  33708. updateOrgPrivateRegistry: [
  33709. "PATCH /orgs/{org}/private-registries/{secret_name}"
  33710. ]
  33711. },
  33712. projects: {
  33713. addItemForOrg: ["POST /orgs/{org}/projectsV2/{project_number}/items"],
  33714. addItemForUser: [
  33715. "POST /users/{username}/projectsV2/{project_number}/items"
  33716. ],
  33717. deleteItemForOrg: [
  33718. "DELETE /orgs/{org}/projectsV2/{project_number}/items/{item_id}"
  33719. ],
  33720. deleteItemForUser: [
  33721. "DELETE /users/{username}/projectsV2/{project_number}/items/{item_id}"
  33722. ],
  33723. getFieldForOrg: [
  33724. "GET /orgs/{org}/projectsV2/{project_number}/fields/{field_id}"
  33725. ],
  33726. getFieldForUser: [
  33727. "GET /users/{username}/projectsV2/{project_number}/fields/{field_id}"
  33728. ],
  33729. getForOrg: ["GET /orgs/{org}/projectsV2/{project_number}"],
  33730. getForUser: ["GET /users/{username}/projectsV2/{project_number}"],
  33731. getOrgItem: ["GET /orgs/{org}/projectsV2/{project_number}/items/{item_id}"],
  33732. getUserItem: [
  33733. "GET /users/{username}/projectsV2/{project_number}/items/{item_id}"
  33734. ],
  33735. listFieldsForOrg: ["GET /orgs/{org}/projectsV2/{project_number}/fields"],
  33736. listFieldsForUser: [
  33737. "GET /users/{username}/projectsV2/{project_number}/fields"
  33738. ],
  33739. listForOrg: ["GET /orgs/{org}/projectsV2"],
  33740. listForUser: ["GET /users/{username}/projectsV2"],
  33741. listItemsForOrg: ["GET /orgs/{org}/projectsV2/{project_number}/items"],
  33742. listItemsForUser: [
  33743. "GET /users/{username}/projectsV2/{project_number}/items"
  33744. ],
  33745. updateItemForOrg: [
  33746. "PATCH /orgs/{org}/projectsV2/{project_number}/items/{item_id}"
  33747. ],
  33748. updateItemForUser: [
  33749. "PATCH /users/{username}/projectsV2/{project_number}/items/{item_id}"
  33750. ]
  33751. },
  33752. pulls: {
  33753. checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"],
  33754. create: ["POST /repos/{owner}/{repo}/pulls"],
  33755. createReplyForReviewComment: [
  33756. "POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies"
  33757. ],
  33758. createReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews"],
  33759. createReviewComment: [
  33760. "POST /repos/{owner}/{repo}/pulls/{pull_number}/comments"
  33761. ],
  33762. deletePendingReview: [
  33763. "DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
  33764. ],
  33765. deleteReviewComment: [
  33766. "DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}"
  33767. ],
  33768. dismissReview: [
  33769. "PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals"
  33770. ],
  33771. get: ["GET /repos/{owner}/{repo}/pulls/{pull_number}"],
  33772. getReview: [
  33773. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
  33774. ],
  33775. getReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}"],
  33776. list: ["GET /repos/{owner}/{repo}/pulls"],
  33777. listCommentsForReview: [
  33778. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments"
  33779. ],
  33780. listCommits: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/commits"],
  33781. listFiles: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/files"],
  33782. listRequestedReviewers: [
  33783. "GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
  33784. ],
  33785. listReviewComments: [
  33786. "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments"
  33787. ],
  33788. listReviewCommentsForRepo: ["GET /repos/{owner}/{repo}/pulls/comments"],
  33789. listReviews: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews"],
  33790. merge: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge"],
  33791. removeRequestedReviewers: [
  33792. "DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
  33793. ],
  33794. requestReviewers: [
  33795. "POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
  33796. ],
  33797. submitReview: [
  33798. "POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events"
  33799. ],
  33800. update: ["PATCH /repos/{owner}/{repo}/pulls/{pull_number}"],
  33801. updateBranch: [
  33802. "PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch"
  33803. ],
  33804. updateReview: [
  33805. "PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
  33806. ],
  33807. updateReviewComment: [
  33808. "PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}"
  33809. ]
  33810. },
  33811. rateLimit: { get: ["GET /rate_limit"] },
  33812. reactions: {
  33813. createForCommitComment: [
  33814. "POST /repos/{owner}/{repo}/comments/{comment_id}/reactions"
  33815. ],
  33816. createForIssue: [
  33817. "POST /repos/{owner}/{repo}/issues/{issue_number}/reactions"
  33818. ],
  33819. createForIssueComment: [
  33820. "POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"
  33821. ],
  33822. createForPullRequestReviewComment: [
  33823. "POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"
  33824. ],
  33825. createForRelease: [
  33826. "POST /repos/{owner}/{repo}/releases/{release_id}/reactions"
  33827. ],
  33828. createForTeamDiscussionCommentInOrg: [
  33829. "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"
  33830. ],
  33831. createForTeamDiscussionInOrg: [
  33832. "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"
  33833. ],
  33834. deleteForCommitComment: [
  33835. "DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}"
  33836. ],
  33837. deleteForIssue: [
  33838. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}"
  33839. ],
  33840. deleteForIssueComment: [
  33841. "DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}"
  33842. ],
  33843. deleteForPullRequestComment: [
  33844. "DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}"
  33845. ],
  33846. deleteForRelease: [
  33847. "DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id}"
  33848. ],
  33849. deleteForTeamDiscussion: [
  33850. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}"
  33851. ],
  33852. deleteForTeamDiscussionComment: [
  33853. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}"
  33854. ],
  33855. listForCommitComment: [
  33856. "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions"
  33857. ],
  33858. listForIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/reactions"],
  33859. listForIssueComment: [
  33860. "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"
  33861. ],
  33862. listForPullRequestReviewComment: [
  33863. "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"
  33864. ],
  33865. listForRelease: [
  33866. "GET /repos/{owner}/{repo}/releases/{release_id}/reactions"
  33867. ],
  33868. listForTeamDiscussionCommentInOrg: [
  33869. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"
  33870. ],
  33871. listForTeamDiscussionInOrg: [
  33872. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"
  33873. ]
  33874. },
  33875. repos: {
  33876. acceptInvitation: [
  33877. "PATCH /user/repository_invitations/{invitation_id}",
  33878. {},
  33879. { renamed: ["repos", "acceptInvitationForAuthenticatedUser"] }
  33880. ],
  33881. acceptInvitationForAuthenticatedUser: [
  33882. "PATCH /user/repository_invitations/{invitation_id}"
  33883. ],
  33884. addAppAccessRestrictions: [
  33885. "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
  33886. {},
  33887. { mapToData: "apps" }
  33888. ],
  33889. addCollaborator: ["PUT /repos/{owner}/{repo}/collaborators/{username}"],
  33890. addStatusCheckContexts: [
  33891. "POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
  33892. {},
  33893. { mapToData: "contexts" }
  33894. ],
  33895. addTeamAccessRestrictions: [
  33896. "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
  33897. {},
  33898. { mapToData: "teams" }
  33899. ],
  33900. addUserAccessRestrictions: [
  33901. "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
  33902. {},
  33903. { mapToData: "users" }
  33904. ],
  33905. cancelPagesDeployment: [
  33906. "POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel"
  33907. ],
  33908. checkAutomatedSecurityFixes: [
  33909. "GET /repos/{owner}/{repo}/automated-security-fixes"
  33910. ],
  33911. checkCollaborator: ["GET /repos/{owner}/{repo}/collaborators/{username}"],
  33912. checkImmutableReleases: ["GET /repos/{owner}/{repo}/immutable-releases"],
  33913. checkPrivateVulnerabilityReporting: [
  33914. "GET /repos/{owner}/{repo}/private-vulnerability-reporting"
  33915. ],
  33916. checkVulnerabilityAlerts: [
  33917. "GET /repos/{owner}/{repo}/vulnerability-alerts"
  33918. ],
  33919. codeownersErrors: ["GET /repos/{owner}/{repo}/codeowners/errors"],
  33920. compareCommits: ["GET /repos/{owner}/{repo}/compare/{base}...{head}"],
  33921. compareCommitsWithBasehead: [
  33922. "GET /repos/{owner}/{repo}/compare/{basehead}"
  33923. ],
  33924. createAttestation: ["POST /repos/{owner}/{repo}/attestations"],
  33925. createAutolink: ["POST /repos/{owner}/{repo}/autolinks"],
  33926. createCommitComment: [
  33927. "POST /repos/{owner}/{repo}/commits/{commit_sha}/comments"
  33928. ],
  33929. createCommitSignatureProtection: [
  33930. "POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
  33931. ],
  33932. createCommitStatus: ["POST /repos/{owner}/{repo}/statuses/{sha}"],
  33933. createDeployKey: ["POST /repos/{owner}/{repo}/keys"],
  33934. createDeployment: ["POST /repos/{owner}/{repo}/deployments"],
  33935. createDeploymentBranchPolicy: [
  33936. "POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"
  33937. ],
  33938. createDeploymentProtectionRule: [
  33939. "POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"
  33940. ],
  33941. createDeploymentStatus: [
  33942. "POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"
  33943. ],
  33944. createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"],
  33945. createForAuthenticatedUser: ["POST /user/repos"],
  33946. createFork: ["POST /repos/{owner}/{repo}/forks"],
  33947. createInOrg: ["POST /orgs/{org}/repos"],
  33948. createOrUpdateEnvironment: [
  33949. "PUT /repos/{owner}/{repo}/environments/{environment_name}"
  33950. ],
  33951. createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"],
  33952. createOrgRuleset: ["POST /orgs/{org}/rulesets"],
  33953. createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployments"],
  33954. createPagesSite: ["POST /repos/{owner}/{repo}/pages"],
  33955. createRelease: ["POST /repos/{owner}/{repo}/releases"],
  33956. createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"],
  33957. createUsingTemplate: [
  33958. "POST /repos/{template_owner}/{template_repo}/generate"
  33959. ],
  33960. createWebhook: ["POST /repos/{owner}/{repo}/hooks"],
  33961. customPropertiesForReposCreateOrUpdateRepositoryValues: [
  33962. "PATCH /repos/{owner}/{repo}/properties/values"
  33963. ],
  33964. customPropertiesForReposGetRepositoryValues: [
  33965. "GET /repos/{owner}/{repo}/properties/values"
  33966. ],
  33967. declineInvitation: [
  33968. "DELETE /user/repository_invitations/{invitation_id}",
  33969. {},
  33970. { renamed: ["repos", "declineInvitationForAuthenticatedUser"] }
  33971. ],
  33972. declineInvitationForAuthenticatedUser: [
  33973. "DELETE /user/repository_invitations/{invitation_id}"
  33974. ],
  33975. delete: ["DELETE /repos/{owner}/{repo}"],
  33976. deleteAccessRestrictions: [
  33977. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"
  33978. ],
  33979. deleteAdminBranchProtection: [
  33980. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
  33981. ],
  33982. deleteAnEnvironment: [
  33983. "DELETE /repos/{owner}/{repo}/environments/{environment_name}"
  33984. ],
  33985. deleteAutolink: ["DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}"],
  33986. deleteBranchProtection: [
  33987. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection"
  33988. ],
  33989. deleteCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}"],
  33990. deleteCommitSignatureProtection: [
  33991. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
  33992. ],
  33993. deleteDeployKey: ["DELETE /repos/{owner}/{repo}/keys/{key_id}"],
  33994. deleteDeployment: [
  33995. "DELETE /repos/{owner}/{repo}/deployments/{deployment_id}"
  33996. ],
  33997. deleteDeploymentBranchPolicy: [
  33998. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
  33999. ],
  34000. deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"],
  34001. deleteInvitation: [
  34002. "DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"
  34003. ],
  34004. deleteOrgRuleset: ["DELETE /orgs/{org}/rulesets/{ruleset_id}"],
  34005. deletePagesSite: ["DELETE /repos/{owner}/{repo}/pages"],
  34006. deletePullRequestReviewProtection: [
  34007. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
  34008. ],
  34009. deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"],
  34010. deleteReleaseAsset: [
  34011. "DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"
  34012. ],
  34013. deleteRepoRuleset: ["DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
  34014. deleteWebhook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"],
  34015. disableAutomatedSecurityFixes: [
  34016. "DELETE /repos/{owner}/{repo}/automated-security-fixes"
  34017. ],
  34018. disableDeploymentProtectionRule: [
  34019. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"
  34020. ],
  34021. disableImmutableReleases: [
  34022. "DELETE /repos/{owner}/{repo}/immutable-releases"
  34023. ],
  34024. disablePrivateVulnerabilityReporting: [
  34025. "DELETE /repos/{owner}/{repo}/private-vulnerability-reporting"
  34026. ],
  34027. disableVulnerabilityAlerts: [
  34028. "DELETE /repos/{owner}/{repo}/vulnerability-alerts"
  34029. ],
  34030. downloadArchive: [
  34031. "GET /repos/{owner}/{repo}/zipball/{ref}",
  34032. {},
  34033. { renamed: ["repos", "downloadZipballArchive"] }
  34034. ],
  34035. downloadTarballArchive: ["GET /repos/{owner}/{repo}/tarball/{ref}"],
  34036. downloadZipballArchive: ["GET /repos/{owner}/{repo}/zipball/{ref}"],
  34037. enableAutomatedSecurityFixes: [
  34038. "PUT /repos/{owner}/{repo}/automated-security-fixes"
  34039. ],
  34040. enableImmutableReleases: ["PUT /repos/{owner}/{repo}/immutable-releases"],
  34041. enablePrivateVulnerabilityReporting: [
  34042. "PUT /repos/{owner}/{repo}/private-vulnerability-reporting"
  34043. ],
  34044. enableVulnerabilityAlerts: [
  34045. "PUT /repos/{owner}/{repo}/vulnerability-alerts"
  34046. ],
  34047. generateReleaseNotes: [
  34048. "POST /repos/{owner}/{repo}/releases/generate-notes"
  34049. ],
  34050. get: ["GET /repos/{owner}/{repo}"],
  34051. getAccessRestrictions: [
  34052. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"
  34053. ],
  34054. getAdminBranchProtection: [
  34055. "GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
  34056. ],
  34057. getAllDeploymentProtectionRules: [
  34058. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"
  34059. ],
  34060. getAllEnvironments: ["GET /repos/{owner}/{repo}/environments"],
  34061. getAllStatusCheckContexts: [
  34062. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"
  34063. ],
  34064. getAllTopics: ["GET /repos/{owner}/{repo}/topics"],
  34065. getAppsWithAccessToProtectedBranch: [
  34066. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"
  34067. ],
  34068. getAutolink: ["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"],
  34069. getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"],
  34070. getBranchProtection: [
  34071. "GET /repos/{owner}/{repo}/branches/{branch}/protection"
  34072. ],
  34073. getBranchRules: ["GET /repos/{owner}/{repo}/rules/branches/{branch}"],
  34074. getClones: ["GET /repos/{owner}/{repo}/traffic/clones"],
  34075. getCodeFrequencyStats: ["GET /repos/{owner}/{repo}/stats/code_frequency"],
  34076. getCollaboratorPermissionLevel: [
  34077. "GET /repos/{owner}/{repo}/collaborators/{username}/permission"
  34078. ],
  34079. getCombinedStatusForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/status"],
  34080. getCommit: ["GET /repos/{owner}/{repo}/commits/{ref}"],
  34081. getCommitActivityStats: ["GET /repos/{owner}/{repo}/stats/commit_activity"],
  34082. getCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}"],
  34083. getCommitSignatureProtection: [
  34084. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
  34085. ],
  34086. getCommunityProfileMetrics: ["GET /repos/{owner}/{repo}/community/profile"],
  34087. getContent: ["GET /repos/{owner}/{repo}/contents/{path}"],
  34088. getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"],
  34089. getCustomDeploymentProtectionRule: [
  34090. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"
  34091. ],
  34092. getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"],
  34093. getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"],
  34094. getDeploymentBranchPolicy: [
  34095. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
  34096. ],
  34097. getDeploymentStatus: [
  34098. "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}"
  34099. ],
  34100. getEnvironment: [
  34101. "GET /repos/{owner}/{repo}/environments/{environment_name}"
  34102. ],
  34103. getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"],
  34104. getLatestRelease: ["GET /repos/{owner}/{repo}/releases/latest"],
  34105. getOrgRuleSuite: ["GET /orgs/{org}/rulesets/rule-suites/{rule_suite_id}"],
  34106. getOrgRuleSuites: ["GET /orgs/{org}/rulesets/rule-suites"],
  34107. getOrgRuleset: ["GET /orgs/{org}/rulesets/{ruleset_id}"],
  34108. getOrgRulesets: ["GET /orgs/{org}/rulesets"],
  34109. getPages: ["GET /repos/{owner}/{repo}/pages"],
  34110. getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"],
  34111. getPagesDeployment: [
  34112. "GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}"
  34113. ],
  34114. getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"],
  34115. getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"],
  34116. getPullRequestReviewProtection: [
  34117. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
  34118. ],
  34119. getPunchCardStats: ["GET /repos/{owner}/{repo}/stats/punch_card"],
  34120. getReadme: ["GET /repos/{owner}/{repo}/readme"],
  34121. getReadmeInDirectory: ["GET /repos/{owner}/{repo}/readme/{dir}"],
  34122. getRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}"],
  34123. getReleaseAsset: ["GET /repos/{owner}/{repo}/releases/assets/{asset_id}"],
  34124. getReleaseByTag: ["GET /repos/{owner}/{repo}/releases/tags/{tag}"],
  34125. getRepoRuleSuite: [
  34126. "GET /repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id}"
  34127. ],
  34128. getRepoRuleSuites: ["GET /repos/{owner}/{repo}/rulesets/rule-suites"],
  34129. getRepoRuleset: ["GET /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
  34130. getRepoRulesetHistory: [
  34131. "GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history"
  34132. ],
  34133. getRepoRulesetVersion: [
  34134. "GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history/{version_id}"
  34135. ],
  34136. getRepoRulesets: ["GET /repos/{owner}/{repo}/rulesets"],
  34137. getStatusChecksProtection: [
  34138. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
  34139. ],
  34140. getTeamsWithAccessToProtectedBranch: [
  34141. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"
  34142. ],
  34143. getTopPaths: ["GET /repos/{owner}/{repo}/traffic/popular/paths"],
  34144. getTopReferrers: ["GET /repos/{owner}/{repo}/traffic/popular/referrers"],
  34145. getUsersWithAccessToProtectedBranch: [
  34146. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users"
  34147. ],
  34148. getViews: ["GET /repos/{owner}/{repo}/traffic/views"],
  34149. getWebhook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"],
  34150. getWebhookConfigForRepo: [
  34151. "GET /repos/{owner}/{repo}/hooks/{hook_id}/config"
  34152. ],
  34153. getWebhookDelivery: [
  34154. "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}"
  34155. ],
  34156. listActivities: ["GET /repos/{owner}/{repo}/activity"],
  34157. listAttestations: [
  34158. "GET /repos/{owner}/{repo}/attestations/{subject_digest}"
  34159. ],
  34160. listAutolinks: ["GET /repos/{owner}/{repo}/autolinks"],
  34161. listBranches: ["GET /repos/{owner}/{repo}/branches"],
  34162. listBranchesForHeadCommit: [
  34163. "GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head"
  34164. ],
  34165. listCollaborators: ["GET /repos/{owner}/{repo}/collaborators"],
  34166. listCommentsForCommit: [
  34167. "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments"
  34168. ],
  34169. listCommitCommentsForRepo: ["GET /repos/{owner}/{repo}/comments"],
  34170. listCommitStatusesForRef: [
  34171. "GET /repos/{owner}/{repo}/commits/{ref}/statuses"
  34172. ],
  34173. listCommits: ["GET /repos/{owner}/{repo}/commits"],
  34174. listContributors: ["GET /repos/{owner}/{repo}/contributors"],
  34175. listCustomDeploymentRuleIntegrations: [
  34176. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps"
  34177. ],
  34178. listDeployKeys: ["GET /repos/{owner}/{repo}/keys"],
  34179. listDeploymentBranchPolicies: [
  34180. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"
  34181. ],
  34182. listDeploymentStatuses: [
  34183. "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"
  34184. ],
  34185. listDeployments: ["GET /repos/{owner}/{repo}/deployments"],
  34186. listForAuthenticatedUser: ["GET /user/repos"],
  34187. listForOrg: ["GET /orgs/{org}/repos"],
  34188. listForUser: ["GET /users/{username}/repos"],
  34189. listForks: ["GET /repos/{owner}/{repo}/forks"],
  34190. listInvitations: ["GET /repos/{owner}/{repo}/invitations"],
  34191. listInvitationsForAuthenticatedUser: ["GET /user/repository_invitations"],
  34192. listLanguages: ["GET /repos/{owner}/{repo}/languages"],
  34193. listPagesBuilds: ["GET /repos/{owner}/{repo}/pages/builds"],
  34194. listPublic: ["GET /repositories"],
  34195. listPullRequestsAssociatedWithCommit: [
  34196. "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"
  34197. ],
  34198. listReleaseAssets: [
  34199. "GET /repos/{owner}/{repo}/releases/{release_id}/assets"
  34200. ],
  34201. listReleases: ["GET /repos/{owner}/{repo}/releases"],
  34202. listTags: ["GET /repos/{owner}/{repo}/tags"],
  34203. listTeams: ["GET /repos/{owner}/{repo}/teams"],
  34204. listWebhookDeliveries: [
  34205. "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries"
  34206. ],
  34207. listWebhooks: ["GET /repos/{owner}/{repo}/hooks"],
  34208. merge: ["POST /repos/{owner}/{repo}/merges"],
  34209. mergeUpstream: ["POST /repos/{owner}/{repo}/merge-upstream"],
  34210. pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"],
  34211. redeliverWebhookDelivery: [
  34212. "POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"
  34213. ],
  34214. removeAppAccessRestrictions: [
  34215. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
  34216. {},
  34217. { mapToData: "apps" }
  34218. ],
  34219. removeCollaborator: [
  34220. "DELETE /repos/{owner}/{repo}/collaborators/{username}"
  34221. ],
  34222. removeStatusCheckContexts: [
  34223. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
  34224. {},
  34225. { mapToData: "contexts" }
  34226. ],
  34227. removeStatusCheckProtection: [
  34228. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
  34229. ],
  34230. removeTeamAccessRestrictions: [
  34231. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
  34232. {},
  34233. { mapToData: "teams" }
  34234. ],
  34235. removeUserAccessRestrictions: [
  34236. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
  34237. {},
  34238. { mapToData: "users" }
  34239. ],
  34240. renameBranch: ["POST /repos/{owner}/{repo}/branches/{branch}/rename"],
  34241. replaceAllTopics: ["PUT /repos/{owner}/{repo}/topics"],
  34242. requestPagesBuild: ["POST /repos/{owner}/{repo}/pages/builds"],
  34243. setAdminBranchProtection: [
  34244. "POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
  34245. ],
  34246. setAppAccessRestrictions: [
  34247. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
  34248. {},
  34249. { mapToData: "apps" }
  34250. ],
  34251. setStatusCheckContexts: [
  34252. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
  34253. {},
  34254. { mapToData: "contexts" }
  34255. ],
  34256. setTeamAccessRestrictions: [
  34257. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
  34258. {},
  34259. { mapToData: "teams" }
  34260. ],
  34261. setUserAccessRestrictions: [
  34262. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
  34263. {},
  34264. { mapToData: "users" }
  34265. ],
  34266. testPushWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/tests"],
  34267. transfer: ["POST /repos/{owner}/{repo}/transfer"],
  34268. update: ["PATCH /repos/{owner}/{repo}"],
  34269. updateBranchProtection: [
  34270. "PUT /repos/{owner}/{repo}/branches/{branch}/protection"
  34271. ],
  34272. updateCommitComment: ["PATCH /repos/{owner}/{repo}/comments/{comment_id}"],
  34273. updateDeploymentBranchPolicy: [
  34274. "PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
  34275. ],
  34276. updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"],
  34277. updateInvitation: [
  34278. "PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"
  34279. ],
  34280. updateOrgRuleset: ["PUT /orgs/{org}/rulesets/{ruleset_id}"],
  34281. updatePullRequestReviewProtection: [
  34282. "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
  34283. ],
  34284. updateRelease: ["PATCH /repos/{owner}/{repo}/releases/{release_id}"],
  34285. updateReleaseAsset: [
  34286. "PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}"
  34287. ],
  34288. updateRepoRuleset: ["PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
  34289. updateStatusCheckPotection: [
  34290. "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks",
  34291. {},
  34292. { renamed: ["repos", "updateStatusCheckProtection"] }
  34293. ],
  34294. updateStatusCheckProtection: [
  34295. "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
  34296. ],
  34297. updateWebhook: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}"],
  34298. updateWebhookConfigForRepo: [
  34299. "PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config"
  34300. ],
  34301. uploadReleaseAsset: [
  34302. "POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}",
  34303. { baseUrl: "https://uploads.github.com" }
  34304. ]
  34305. },
  34306. search: {
  34307. code: ["GET /search/code"],
  34308. commits: ["GET /search/commits"],
  34309. issuesAndPullRequests: ["GET /search/issues"],
  34310. labels: ["GET /search/labels"],
  34311. repos: ["GET /search/repositories"],
  34312. topics: ["GET /search/topics"],
  34313. users: ["GET /search/users"]
  34314. },
  34315. secretScanning: {
  34316. createPushProtectionBypass: [
  34317. "POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses"
  34318. ],
  34319. getAlert: [
  34320. "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"
  34321. ],
  34322. getScanHistory: ["GET /repos/{owner}/{repo}/secret-scanning/scan-history"],
  34323. listAlertsForOrg: ["GET /orgs/{org}/secret-scanning/alerts"],
  34324. listAlertsForRepo: ["GET /repos/{owner}/{repo}/secret-scanning/alerts"],
  34325. listLocationsForAlert: [
  34326. "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations"
  34327. ],
  34328. listOrgPatternConfigs: [
  34329. "GET /orgs/{org}/secret-scanning/pattern-configurations"
  34330. ],
  34331. updateAlert: [
  34332. "PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"
  34333. ],
  34334. updateOrgPatternConfigs: [
  34335. "PATCH /orgs/{org}/secret-scanning/pattern-configurations"
  34336. ]
  34337. },
  34338. securityAdvisories: {
  34339. createFork: [
  34340. "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks"
  34341. ],
  34342. createPrivateVulnerabilityReport: [
  34343. "POST /repos/{owner}/{repo}/security-advisories/reports"
  34344. ],
  34345. createRepositoryAdvisory: [
  34346. "POST /repos/{owner}/{repo}/security-advisories"
  34347. ],
  34348. createRepositoryAdvisoryCveRequest: [
  34349. "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve"
  34350. ],
  34351. getGlobalAdvisory: ["GET /advisories/{ghsa_id}"],
  34352. getRepositoryAdvisory: [
  34353. "GET /repos/{owner}/{repo}/security-advisories/{ghsa_id}"
  34354. ],
  34355. listGlobalAdvisories: ["GET /advisories"],
  34356. listOrgRepositoryAdvisories: ["GET /orgs/{org}/security-advisories"],
  34357. listRepositoryAdvisories: ["GET /repos/{owner}/{repo}/security-advisories"],
  34358. updateRepositoryAdvisory: [
  34359. "PATCH /repos/{owner}/{repo}/security-advisories/{ghsa_id}"
  34360. ]
  34361. },
  34362. teams: {
  34363. addOrUpdateMembershipForUserInOrg: [
  34364. "PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"
  34365. ],
  34366. addOrUpdateRepoPermissionsInOrg: [
  34367. "PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
  34368. ],
  34369. checkPermissionsForRepoInOrg: [
  34370. "GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
  34371. ],
  34372. create: ["POST /orgs/{org}/teams"],
  34373. createDiscussionCommentInOrg: [
  34374. "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"
  34375. ],
  34376. createDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions"],
  34377. deleteDiscussionCommentInOrg: [
  34378. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
  34379. ],
  34380. deleteDiscussionInOrg: [
  34381. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
  34382. ],
  34383. deleteInOrg: ["DELETE /orgs/{org}/teams/{team_slug}"],
  34384. getByName: ["GET /orgs/{org}/teams/{team_slug}"],
  34385. getDiscussionCommentInOrg: [
  34386. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
  34387. ],
  34388. getDiscussionInOrg: [
  34389. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
  34390. ],
  34391. getMembershipForUserInOrg: [
  34392. "GET /orgs/{org}/teams/{team_slug}/memberships/{username}"
  34393. ],
  34394. list: ["GET /orgs/{org}/teams"],
  34395. listChildInOrg: ["GET /orgs/{org}/teams/{team_slug}/teams"],
  34396. listDiscussionCommentsInOrg: [
  34397. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"
  34398. ],
  34399. listDiscussionsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions"],
  34400. listForAuthenticatedUser: ["GET /user/teams"],
  34401. listMembersInOrg: ["GET /orgs/{org}/teams/{team_slug}/members"],
  34402. listPendingInvitationsInOrg: [
  34403. "GET /orgs/{org}/teams/{team_slug}/invitations"
  34404. ],
  34405. listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"],
  34406. removeMembershipForUserInOrg: [
  34407. "DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}"
  34408. ],
  34409. removeRepoInOrg: [
  34410. "DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
  34411. ],
  34412. updateDiscussionCommentInOrg: [
  34413. "PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
  34414. ],
  34415. updateDiscussionInOrg: [
  34416. "PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
  34417. ],
  34418. updateInOrg: ["PATCH /orgs/{org}/teams/{team_slug}"]
  34419. },
  34420. users: {
  34421. addEmailForAuthenticated: [
  34422. "POST /user/emails",
  34423. {},
  34424. { renamed: ["users", "addEmailForAuthenticatedUser"] }
  34425. ],
  34426. addEmailForAuthenticatedUser: ["POST /user/emails"],
  34427. addSocialAccountForAuthenticatedUser: ["POST /user/social_accounts"],
  34428. block: ["PUT /user/blocks/{username}"],
  34429. checkBlocked: ["GET /user/blocks/{username}"],
  34430. checkFollowingForUser: ["GET /users/{username}/following/{target_user}"],
  34431. checkPersonIsFollowedByAuthenticated: ["GET /user/following/{username}"],
  34432. createGpgKeyForAuthenticated: [
  34433. "POST /user/gpg_keys",
  34434. {},
  34435. { renamed: ["users", "createGpgKeyForAuthenticatedUser"] }
  34436. ],
  34437. createGpgKeyForAuthenticatedUser: ["POST /user/gpg_keys"],
  34438. createPublicSshKeyForAuthenticated: [
  34439. "POST /user/keys",
  34440. {},
  34441. { renamed: ["users", "createPublicSshKeyForAuthenticatedUser"] }
  34442. ],
  34443. createPublicSshKeyForAuthenticatedUser: ["POST /user/keys"],
  34444. createSshSigningKeyForAuthenticatedUser: ["POST /user/ssh_signing_keys"],
  34445. deleteAttestationsBulk: [
  34446. "POST /users/{username}/attestations/delete-request"
  34447. ],
  34448. deleteAttestationsById: [
  34449. "DELETE /users/{username}/attestations/{attestation_id}"
  34450. ],
  34451. deleteAttestationsBySubjectDigest: [
  34452. "DELETE /users/{username}/attestations/digest/{subject_digest}"
  34453. ],
  34454. deleteEmailForAuthenticated: [
  34455. "DELETE /user/emails",
  34456. {},
  34457. { renamed: ["users", "deleteEmailForAuthenticatedUser"] }
  34458. ],
  34459. deleteEmailForAuthenticatedUser: ["DELETE /user/emails"],
  34460. deleteGpgKeyForAuthenticated: [
  34461. "DELETE /user/gpg_keys/{gpg_key_id}",
  34462. {},
  34463. { renamed: ["users", "deleteGpgKeyForAuthenticatedUser"] }
  34464. ],
  34465. deleteGpgKeyForAuthenticatedUser: ["DELETE /user/gpg_keys/{gpg_key_id}"],
  34466. deletePublicSshKeyForAuthenticated: [
  34467. "DELETE /user/keys/{key_id}",
  34468. {},
  34469. { renamed: ["users", "deletePublicSshKeyForAuthenticatedUser"] }
  34470. ],
  34471. deletePublicSshKeyForAuthenticatedUser: ["DELETE /user/keys/{key_id}"],
  34472. deleteSocialAccountForAuthenticatedUser: ["DELETE /user/social_accounts"],
  34473. deleteSshSigningKeyForAuthenticatedUser: [
  34474. "DELETE /user/ssh_signing_keys/{ssh_signing_key_id}"
  34475. ],
  34476. follow: ["PUT /user/following/{username}"],
  34477. getAuthenticated: ["GET /user"],
  34478. getById: ["GET /user/{account_id}"],
  34479. getByUsername: ["GET /users/{username}"],
  34480. getContextForUser: ["GET /users/{username}/hovercard"],
  34481. getGpgKeyForAuthenticated: [
  34482. "GET /user/gpg_keys/{gpg_key_id}",
  34483. {},
  34484. { renamed: ["users", "getGpgKeyForAuthenticatedUser"] }
  34485. ],
  34486. getGpgKeyForAuthenticatedUser: ["GET /user/gpg_keys/{gpg_key_id}"],
  34487. getPublicSshKeyForAuthenticated: [
  34488. "GET /user/keys/{key_id}",
  34489. {},
  34490. { renamed: ["users", "getPublicSshKeyForAuthenticatedUser"] }
  34491. ],
  34492. getPublicSshKeyForAuthenticatedUser: ["GET /user/keys/{key_id}"],
  34493. getSshSigningKeyForAuthenticatedUser: [
  34494. "GET /user/ssh_signing_keys/{ssh_signing_key_id}"
  34495. ],
  34496. list: ["GET /users"],
  34497. listAttestations: ["GET /users/{username}/attestations/{subject_digest}"],
  34498. listAttestationsBulk: [
  34499. "POST /users/{username}/attestations/bulk-list{?per_page,before,after}"
  34500. ],
  34501. listBlockedByAuthenticated: [
  34502. "GET /user/blocks",
  34503. {},
  34504. { renamed: ["users", "listBlockedByAuthenticatedUser"] }
  34505. ],
  34506. listBlockedByAuthenticatedUser: ["GET /user/blocks"],
  34507. listEmailsForAuthenticated: [
  34508. "GET /user/emails",
  34509. {},
  34510. { renamed: ["users", "listEmailsForAuthenticatedUser"] }
  34511. ],
  34512. listEmailsForAuthenticatedUser: ["GET /user/emails"],
  34513. listFollowedByAuthenticated: [
  34514. "GET /user/following",
  34515. {},
  34516. { renamed: ["users", "listFollowedByAuthenticatedUser"] }
  34517. ],
  34518. listFollowedByAuthenticatedUser: ["GET /user/following"],
  34519. listFollowersForAuthenticatedUser: ["GET /user/followers"],
  34520. listFollowersForUser: ["GET /users/{username}/followers"],
  34521. listFollowingForUser: ["GET /users/{username}/following"],
  34522. listGpgKeysForAuthenticated: [
  34523. "GET /user/gpg_keys",
  34524. {},
  34525. { renamed: ["users", "listGpgKeysForAuthenticatedUser"] }
  34526. ],
  34527. listGpgKeysForAuthenticatedUser: ["GET /user/gpg_keys"],
  34528. listGpgKeysForUser: ["GET /users/{username}/gpg_keys"],
  34529. listPublicEmailsForAuthenticated: [
  34530. "GET /user/public_emails",
  34531. {},
  34532. { renamed: ["users", "listPublicEmailsForAuthenticatedUser"] }
  34533. ],
  34534. listPublicEmailsForAuthenticatedUser: ["GET /user/public_emails"],
  34535. listPublicKeysForUser: ["GET /users/{username}/keys"],
  34536. listPublicSshKeysForAuthenticated: [
  34537. "GET /user/keys",
  34538. {},
  34539. { renamed: ["users", "listPublicSshKeysForAuthenticatedUser"] }
  34540. ],
  34541. listPublicSshKeysForAuthenticatedUser: ["GET /user/keys"],
  34542. listSocialAccountsForAuthenticatedUser: ["GET /user/social_accounts"],
  34543. listSocialAccountsForUser: ["GET /users/{username}/social_accounts"],
  34544. listSshSigningKeysForAuthenticatedUser: ["GET /user/ssh_signing_keys"],
  34545. listSshSigningKeysForUser: ["GET /users/{username}/ssh_signing_keys"],
  34546. setPrimaryEmailVisibilityForAuthenticated: [
  34547. "PATCH /user/email/visibility",
  34548. {},
  34549. { renamed: ["users", "setPrimaryEmailVisibilityForAuthenticatedUser"] }
  34550. ],
  34551. setPrimaryEmailVisibilityForAuthenticatedUser: [
  34552. "PATCH /user/email/visibility"
  34553. ],
  34554. unblock: ["DELETE /user/blocks/{username}"],
  34555. unfollow: ["DELETE /user/following/{username}"],
  34556. updateAuthenticated: ["PATCH /user"]
  34557. }
  34558. };
  34559. var endpoints_default = Endpoints;
  34560. //# sourceMappingURL=endpoints.js.map
  34561. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js
  34562. const endpointMethodsMap = /* @__PURE__ */ new Map();
  34563. for (const [scope, endpoints] of Object.entries(endpoints_default)) {
  34564. for (const [methodName, endpoint] of Object.entries(endpoints)) {
  34565. const [route, defaults, decorations] = endpoint;
  34566. const [method, url] = route.split(/ /);
  34567. const endpointDefaults = Object.assign(
  34568. {
  34569. method,
  34570. url
  34571. },
  34572. defaults
  34573. );
  34574. if (!endpointMethodsMap.has(scope)) {
  34575. endpointMethodsMap.set(scope, /* @__PURE__ */ new Map());
  34576. }
  34577. endpointMethodsMap.get(scope).set(methodName, {
  34578. scope,
  34579. methodName,
  34580. endpointDefaults,
  34581. decorations
  34582. });
  34583. }
  34584. }
  34585. const handler = {
  34586. has({ scope }, methodName) {
  34587. return endpointMethodsMap.get(scope).has(methodName);
  34588. },
  34589. getOwnPropertyDescriptor(target, methodName) {
  34590. return {
  34591. value: this.get(target, methodName),
  34592. // ensures method is in the cache
  34593. configurable: true,
  34594. writable: true,
  34595. enumerable: true
  34596. };
  34597. },
  34598. defineProperty(target, methodName, descriptor) {
  34599. Object.defineProperty(target.cache, methodName, descriptor);
  34600. return true;
  34601. },
  34602. deleteProperty(target, methodName) {
  34603. delete target.cache[methodName];
  34604. return true;
  34605. },
  34606. ownKeys({ scope }) {
  34607. return [...endpointMethodsMap.get(scope).keys()];
  34608. },
  34609. set(target, methodName, value) {
  34610. return target.cache[methodName] = value;
  34611. },
  34612. get({ octokit, scope, cache }, methodName) {
  34613. if (cache[methodName]) {
  34614. return cache[methodName];
  34615. }
  34616. const method = endpointMethodsMap.get(scope).get(methodName);
  34617. if (!method) {
  34618. return void 0;
  34619. }
  34620. const { endpointDefaults, decorations } = method;
  34621. if (decorations) {
  34622. cache[methodName] = decorate(
  34623. octokit,
  34624. scope,
  34625. methodName,
  34626. endpointDefaults,
  34627. decorations
  34628. );
  34629. } else {
  34630. cache[methodName] = octokit.request.defaults(endpointDefaults);
  34631. }
  34632. return cache[methodName];
  34633. }
  34634. };
  34635. function endpointsToMethods(octokit) {
  34636. const newMethods = {};
  34637. for (const scope of endpointMethodsMap.keys()) {
  34638. newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler);
  34639. }
  34640. return newMethods;
  34641. }
  34642. function decorate(octokit, scope, methodName, defaults, decorations) {
  34643. const requestWithDefaults = octokit.request.defaults(defaults);
  34644. function withDecorations(...args) {
  34645. let options = requestWithDefaults.endpoint.merge(...args);
  34646. if (decorations.mapToData) {
  34647. options = Object.assign({}, options, {
  34648. data: options[decorations.mapToData],
  34649. [decorations.mapToData]: void 0
  34650. });
  34651. return requestWithDefaults(options);
  34652. }
  34653. if (decorations.renamed) {
  34654. const [newScope, newMethodName] = decorations.renamed;
  34655. octokit.log.warn(
  34656. `octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`
  34657. );
  34658. }
  34659. if (decorations.deprecated) {
  34660. octokit.log.warn(decorations.deprecated);
  34661. }
  34662. if (decorations.renamedParameters) {
  34663. const options2 = requestWithDefaults.endpoint.merge(...args);
  34664. for (const [name, alias] of Object.entries(
  34665. decorations.renamedParameters
  34666. )) {
  34667. if (name in options2) {
  34668. octokit.log.warn(
  34669. `"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`
  34670. );
  34671. if (!(alias in options2)) {
  34672. options2[alias] = options2[name];
  34673. }
  34674. delete options2[name];
  34675. }
  34676. }
  34677. return requestWithDefaults(options2);
  34678. }
  34679. return requestWithDefaults(...args);
  34680. }
  34681. return Object.assign(withDecorations, requestWithDefaults);
  34682. }
  34683. //# sourceMappingURL=endpoints-to-methods.js.map
  34684. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js
  34685. function restEndpointMethods(octokit) {
  34686. const api = endpointsToMethods(octokit);
  34687. return {
  34688. rest: api
  34689. };
  34690. }
  34691. restEndpointMethods.VERSION = dist_src_version_VERSION;
  34692. function legacyRestEndpointMethods(octokit) {
  34693. const api = endpointsToMethods(octokit);
  34694. return {
  34695. ...api,
  34696. rest: api
  34697. };
  34698. }
  34699. legacyRestEndpointMethods.VERSION = dist_src_version_VERSION;
  34700. //# sourceMappingURL=index.js.map
  34701. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-paginate-rest/dist-bundle/index.js
  34702. // pkg/dist-src/version.js
  34703. var plugin_paginate_rest_dist_bundle_VERSION = "0.0.0-development";
  34704. // pkg/dist-src/normalize-paginated-list-response.js
  34705. function normalizePaginatedListResponse(response) {
  34706. if (!response.data) {
  34707. return {
  34708. ...response,
  34709. data: []
  34710. };
  34711. }
  34712. const responseNeedsNormalization = ("total_count" in response.data || "total_commits" in response.data) && !("url" in response.data);
  34713. if (!responseNeedsNormalization) return response;
  34714. const incompleteResults = response.data.incomplete_results;
  34715. const repositorySelection = response.data.repository_selection;
  34716. const totalCount = response.data.total_count;
  34717. const totalCommits = response.data.total_commits;
  34718. delete response.data.incomplete_results;
  34719. delete response.data.repository_selection;
  34720. delete response.data.total_count;
  34721. delete response.data.total_commits;
  34722. const namespaceKey = Object.keys(response.data)[0];
  34723. const data = response.data[namespaceKey];
  34724. response.data = data;
  34725. if (typeof incompleteResults !== "undefined") {
  34726. response.data.incomplete_results = incompleteResults;
  34727. }
  34728. if (typeof repositorySelection !== "undefined") {
  34729. response.data.repository_selection = repositorySelection;
  34730. }
  34731. response.data.total_count = totalCount;
  34732. response.data.total_commits = totalCommits;
  34733. return response;
  34734. }
  34735. // pkg/dist-src/iterator.js
  34736. function iterator(octokit, route, parameters) {
  34737. const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters);
  34738. const requestMethod = typeof route === "function" ? route : octokit.request;
  34739. const method = options.method;
  34740. const headers = options.headers;
  34741. let url = options.url;
  34742. return {
  34743. [Symbol.asyncIterator]: () => ({
  34744. async next() {
  34745. if (!url) return { done: true };
  34746. try {
  34747. const response = await requestMethod({ method, url, headers });
  34748. const normalizedResponse = normalizePaginatedListResponse(response);
  34749. url = ((normalizedResponse.headers.link || "").match(
  34750. /<([^<>]+)>;\s*rel="next"/
  34751. ) || [])[1];
  34752. if (!url && "total_commits" in normalizedResponse.data) {
  34753. const parsedUrl = new URL(normalizedResponse.url);
  34754. const params = parsedUrl.searchParams;
  34755. const page = parseInt(params.get("page") || "1", 10);
  34756. const per_page = parseInt(params.get("per_page") || "250", 10);
  34757. if (page * per_page < normalizedResponse.data.total_commits) {
  34758. params.set("page", String(page + 1));
  34759. url = parsedUrl.toString();
  34760. }
  34761. }
  34762. return { value: normalizedResponse };
  34763. } catch (error) {
  34764. if (error.status !== 409) throw error;
  34765. url = "";
  34766. return {
  34767. value: {
  34768. status: 200,
  34769. headers: {},
  34770. data: []
  34771. }
  34772. };
  34773. }
  34774. }
  34775. })
  34776. };
  34777. }
  34778. // pkg/dist-src/paginate.js
  34779. function paginate(octokit, route, parameters, mapFn) {
  34780. if (typeof parameters === "function") {
  34781. mapFn = parameters;
  34782. parameters = void 0;
  34783. }
  34784. return gather(
  34785. octokit,
  34786. [],
  34787. iterator(octokit, route, parameters)[Symbol.asyncIterator](),
  34788. mapFn
  34789. );
  34790. }
  34791. function gather(octokit, results, iterator2, mapFn) {
  34792. return iterator2.next().then((result) => {
  34793. if (result.done) {
  34794. return results;
  34795. }
  34796. let earlyExit = false;
  34797. function done() {
  34798. earlyExit = true;
  34799. }
  34800. results = results.concat(
  34801. mapFn ? mapFn(result.value, done) : result.value.data
  34802. );
  34803. if (earlyExit) {
  34804. return results;
  34805. }
  34806. return gather(octokit, results, iterator2, mapFn);
  34807. });
  34808. }
  34809. // pkg/dist-src/compose-paginate.js
  34810. var composePaginateRest = Object.assign(paginate, {
  34811. iterator
  34812. });
  34813. // pkg/dist-src/generated/paginating-endpoints.js
  34814. var paginatingEndpoints = (/* unused pure expression or super */ null && ([
  34815. "GET /advisories",
  34816. "GET /app/hook/deliveries",
  34817. "GET /app/installation-requests",
  34818. "GET /app/installations",
  34819. "GET /assignments/{assignment_id}/accepted_assignments",
  34820. "GET /classrooms",
  34821. "GET /classrooms/{classroom_id}/assignments",
  34822. "GET /enterprises/{enterprise}/code-security/configurations",
  34823. "GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories",
  34824. "GET /enterprises/{enterprise}/dependabot/alerts",
  34825. "GET /enterprises/{enterprise}/teams",
  34826. "GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships",
  34827. "GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations",
  34828. "GET /events",
  34829. "GET /gists",
  34830. "GET /gists/public",
  34831. "GET /gists/starred",
  34832. "GET /gists/{gist_id}/comments",
  34833. "GET /gists/{gist_id}/commits",
  34834. "GET /gists/{gist_id}/forks",
  34835. "GET /installation/repositories",
  34836. "GET /issues",
  34837. "GET /licenses",
  34838. "GET /marketplace_listing/plans",
  34839. "GET /marketplace_listing/plans/{plan_id}/accounts",
  34840. "GET /marketplace_listing/stubbed/plans",
  34841. "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts",
  34842. "GET /networks/{owner}/{repo}/events",
  34843. "GET /notifications",
  34844. "GET /organizations",
  34845. "GET /organizations/{org}/dependabot/repository-access",
  34846. "GET /orgs/{org}/actions/cache/usage-by-repository",
  34847. "GET /orgs/{org}/actions/hosted-runners",
  34848. "GET /orgs/{org}/actions/permissions/repositories",
  34849. "GET /orgs/{org}/actions/permissions/self-hosted-runners/repositories",
  34850. "GET /orgs/{org}/actions/runner-groups",
  34851. "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/hosted-runners",
  34852. "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories",
  34853. "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners",
  34854. "GET /orgs/{org}/actions/runners",
  34855. "GET /orgs/{org}/actions/secrets",
  34856. "GET /orgs/{org}/actions/secrets/{secret_name}/repositories",
  34857. "GET /orgs/{org}/actions/variables",
  34858. "GET /orgs/{org}/actions/variables/{name}/repositories",
  34859. "GET /orgs/{org}/attestations/repositories",
  34860. "GET /orgs/{org}/attestations/{subject_digest}",
  34861. "GET /orgs/{org}/blocks",
  34862. "GET /orgs/{org}/campaigns",
  34863. "GET /orgs/{org}/code-scanning/alerts",
  34864. "GET /orgs/{org}/code-security/configurations",
  34865. "GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories",
  34866. "GET /orgs/{org}/codespaces",
  34867. "GET /orgs/{org}/codespaces/secrets",
  34868. "GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories",
  34869. "GET /orgs/{org}/copilot/billing/seats",
  34870. "GET /orgs/{org}/copilot/metrics",
  34871. "GET /orgs/{org}/dependabot/alerts",
  34872. "GET /orgs/{org}/dependabot/secrets",
  34873. "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories",
  34874. "GET /orgs/{org}/events",
  34875. "GET /orgs/{org}/failed_invitations",
  34876. "GET /orgs/{org}/hooks",
  34877. "GET /orgs/{org}/hooks/{hook_id}/deliveries",
  34878. "GET /orgs/{org}/insights/api/route-stats/{actor_type}/{actor_id}",
  34879. "GET /orgs/{org}/insights/api/subject-stats",
  34880. "GET /orgs/{org}/insights/api/user-stats/{user_id}",
  34881. "GET /orgs/{org}/installations",
  34882. "GET /orgs/{org}/invitations",
  34883. "GET /orgs/{org}/invitations/{invitation_id}/teams",
  34884. "GET /orgs/{org}/issues",
  34885. "GET /orgs/{org}/members",
  34886. "GET /orgs/{org}/members/{username}/codespaces",
  34887. "GET /orgs/{org}/migrations",
  34888. "GET /orgs/{org}/migrations/{migration_id}/repositories",
  34889. "GET /orgs/{org}/organization-roles/{role_id}/teams",
  34890. "GET /orgs/{org}/organization-roles/{role_id}/users",
  34891. "GET /orgs/{org}/outside_collaborators",
  34892. "GET /orgs/{org}/packages",
  34893. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
  34894. "GET /orgs/{org}/personal-access-token-requests",
  34895. "GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories",
  34896. "GET /orgs/{org}/personal-access-tokens",
  34897. "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories",
  34898. "GET /orgs/{org}/private-registries",
  34899. "GET /orgs/{org}/projects",
  34900. "GET /orgs/{org}/projectsV2",
  34901. "GET /orgs/{org}/projectsV2/{project_number}/fields",
  34902. "GET /orgs/{org}/projectsV2/{project_number}/items",
  34903. "GET /orgs/{org}/properties/values",
  34904. "GET /orgs/{org}/public_members",
  34905. "GET /orgs/{org}/repos",
  34906. "GET /orgs/{org}/rulesets",
  34907. "GET /orgs/{org}/rulesets/rule-suites",
  34908. "GET /orgs/{org}/rulesets/{ruleset_id}/history",
  34909. "GET /orgs/{org}/secret-scanning/alerts",
  34910. "GET /orgs/{org}/security-advisories",
  34911. "GET /orgs/{org}/settings/immutable-releases/repositories",
  34912. "GET /orgs/{org}/settings/network-configurations",
  34913. "GET /orgs/{org}/team/{team_slug}/copilot/metrics",
  34914. "GET /orgs/{org}/teams",
  34915. "GET /orgs/{org}/teams/{team_slug}/discussions",
  34916. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments",
  34917. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions",
  34918. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions",
  34919. "GET /orgs/{org}/teams/{team_slug}/invitations",
  34920. "GET /orgs/{org}/teams/{team_slug}/members",
  34921. "GET /orgs/{org}/teams/{team_slug}/projects",
  34922. "GET /orgs/{org}/teams/{team_slug}/repos",
  34923. "GET /orgs/{org}/teams/{team_slug}/teams",
  34924. "GET /projects/{project_id}/collaborators",
  34925. "GET /repos/{owner}/{repo}/actions/artifacts",
  34926. "GET /repos/{owner}/{repo}/actions/caches",
  34927. "GET /repos/{owner}/{repo}/actions/organization-secrets",
  34928. "GET /repos/{owner}/{repo}/actions/organization-variables",
  34929. "GET /repos/{owner}/{repo}/actions/runners",
  34930. "GET /repos/{owner}/{repo}/actions/runs",
  34931. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts",
  34932. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs",
  34933. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs",
  34934. "GET /repos/{owner}/{repo}/actions/secrets",
  34935. "GET /repos/{owner}/{repo}/actions/variables",
  34936. "GET /repos/{owner}/{repo}/actions/workflows",
  34937. "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs",
  34938. "GET /repos/{owner}/{repo}/activity",
  34939. "GET /repos/{owner}/{repo}/assignees",
  34940. "GET /repos/{owner}/{repo}/attestations/{subject_digest}",
  34941. "GET /repos/{owner}/{repo}/branches",
  34942. "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations",
  34943. "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs",
  34944. "GET /repos/{owner}/{repo}/code-scanning/alerts",
  34945. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
  34946. "GET /repos/{owner}/{repo}/code-scanning/analyses",
  34947. "GET /repos/{owner}/{repo}/codespaces",
  34948. "GET /repos/{owner}/{repo}/codespaces/devcontainers",
  34949. "GET /repos/{owner}/{repo}/codespaces/secrets",
  34950. "GET /repos/{owner}/{repo}/collaborators",
  34951. "GET /repos/{owner}/{repo}/comments",
  34952. "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions",
  34953. "GET /repos/{owner}/{repo}/commits",
  34954. "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments",
  34955. "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls",
  34956. "GET /repos/{owner}/{repo}/commits/{ref}/check-runs",
  34957. "GET /repos/{owner}/{repo}/commits/{ref}/check-suites",
  34958. "GET /repos/{owner}/{repo}/commits/{ref}/status",
  34959. "GET /repos/{owner}/{repo}/commits/{ref}/statuses",
  34960. "GET /repos/{owner}/{repo}/compare/{basehead}",
  34961. "GET /repos/{owner}/{repo}/compare/{base}...{head}",
  34962. "GET /repos/{owner}/{repo}/contributors",
  34963. "GET /repos/{owner}/{repo}/dependabot/alerts",
  34964. "GET /repos/{owner}/{repo}/dependabot/secrets",
  34965. "GET /repos/{owner}/{repo}/deployments",
  34966. "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses",
  34967. "GET /repos/{owner}/{repo}/environments",
  34968. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies",
  34969. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps",
  34970. "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets",
  34971. "GET /repos/{owner}/{repo}/environments/{environment_name}/variables",
  34972. "GET /repos/{owner}/{repo}/events",
  34973. "GET /repos/{owner}/{repo}/forks",
  34974. "GET /repos/{owner}/{repo}/hooks",
  34975. "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries",
  34976. "GET /repos/{owner}/{repo}/invitations",
  34977. "GET /repos/{owner}/{repo}/issues",
  34978. "GET /repos/{owner}/{repo}/issues/comments",
  34979. "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions",
  34980. "GET /repos/{owner}/{repo}/issues/events",
  34981. "GET /repos/{owner}/{repo}/issues/{issue_number}/comments",
  34982. "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by",
  34983. "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking",
  34984. "GET /repos/{owner}/{repo}/issues/{issue_number}/events",
  34985. "GET /repos/{owner}/{repo}/issues/{issue_number}/labels",
  34986. "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions",
  34987. "GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues",
  34988. "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline",
  34989. "GET /repos/{owner}/{repo}/keys",
  34990. "GET /repos/{owner}/{repo}/labels",
  34991. "GET /repos/{owner}/{repo}/milestones",
  34992. "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels",
  34993. "GET /repos/{owner}/{repo}/notifications",
  34994. "GET /repos/{owner}/{repo}/pages/builds",
  34995. "GET /repos/{owner}/{repo}/projects",
  34996. "GET /repos/{owner}/{repo}/pulls",
  34997. "GET /repos/{owner}/{repo}/pulls/comments",
  34998. "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions",
  34999. "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments",
  35000. "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
  35001. "GET /repos/{owner}/{repo}/pulls/{pull_number}/files",
  35002. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews",
  35003. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments",
  35004. "GET /repos/{owner}/{repo}/releases",
  35005. "GET /repos/{owner}/{repo}/releases/{release_id}/assets",
  35006. "GET /repos/{owner}/{repo}/releases/{release_id}/reactions",
  35007. "GET /repos/{owner}/{repo}/rules/branches/{branch}",
  35008. "GET /repos/{owner}/{repo}/rulesets",
  35009. "GET /repos/{owner}/{repo}/rulesets/rule-suites",
  35010. "GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history",
  35011. "GET /repos/{owner}/{repo}/secret-scanning/alerts",
  35012. "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations",
  35013. "GET /repos/{owner}/{repo}/security-advisories",
  35014. "GET /repos/{owner}/{repo}/stargazers",
  35015. "GET /repos/{owner}/{repo}/subscribers",
  35016. "GET /repos/{owner}/{repo}/tags",
  35017. "GET /repos/{owner}/{repo}/teams",
  35018. "GET /repos/{owner}/{repo}/topics",
  35019. "GET /repositories",
  35020. "GET /search/code",
  35021. "GET /search/commits",
  35022. "GET /search/issues",
  35023. "GET /search/labels",
  35024. "GET /search/repositories",
  35025. "GET /search/topics",
  35026. "GET /search/users",
  35027. "GET /teams/{team_id}/discussions",
  35028. "GET /teams/{team_id}/discussions/{discussion_number}/comments",
  35029. "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions",
  35030. "GET /teams/{team_id}/discussions/{discussion_number}/reactions",
  35031. "GET /teams/{team_id}/invitations",
  35032. "GET /teams/{team_id}/members",
  35033. "GET /teams/{team_id}/projects",
  35034. "GET /teams/{team_id}/repos",
  35035. "GET /teams/{team_id}/teams",
  35036. "GET /user/blocks",
  35037. "GET /user/codespaces",
  35038. "GET /user/codespaces/secrets",
  35039. "GET /user/emails",
  35040. "GET /user/followers",
  35041. "GET /user/following",
  35042. "GET /user/gpg_keys",
  35043. "GET /user/installations",
  35044. "GET /user/installations/{installation_id}/repositories",
  35045. "GET /user/issues",
  35046. "GET /user/keys",
  35047. "GET /user/marketplace_purchases",
  35048. "GET /user/marketplace_purchases/stubbed",
  35049. "GET /user/memberships/orgs",
  35050. "GET /user/migrations",
  35051. "GET /user/migrations/{migration_id}/repositories",
  35052. "GET /user/orgs",
  35053. "GET /user/packages",
  35054. "GET /user/packages/{package_type}/{package_name}/versions",
  35055. "GET /user/public_emails",
  35056. "GET /user/repos",
  35057. "GET /user/repository_invitations",
  35058. "GET /user/social_accounts",
  35059. "GET /user/ssh_signing_keys",
  35060. "GET /user/starred",
  35061. "GET /user/subscriptions",
  35062. "GET /user/teams",
  35063. "GET /users",
  35064. "GET /users/{username}/attestations/{subject_digest}",
  35065. "GET /users/{username}/events",
  35066. "GET /users/{username}/events/orgs/{org}",
  35067. "GET /users/{username}/events/public",
  35068. "GET /users/{username}/followers",
  35069. "GET /users/{username}/following",
  35070. "GET /users/{username}/gists",
  35071. "GET /users/{username}/gpg_keys",
  35072. "GET /users/{username}/keys",
  35073. "GET /users/{username}/orgs",
  35074. "GET /users/{username}/packages",
  35075. "GET /users/{username}/projects",
  35076. "GET /users/{username}/projectsV2",
  35077. "GET /users/{username}/projectsV2/{project_number}/fields",
  35078. "GET /users/{username}/projectsV2/{project_number}/items",
  35079. "GET /users/{username}/received_events",
  35080. "GET /users/{username}/received_events/public",
  35081. "GET /users/{username}/repos",
  35082. "GET /users/{username}/social_accounts",
  35083. "GET /users/{username}/ssh_signing_keys",
  35084. "GET /users/{username}/starred",
  35085. "GET /users/{username}/subscriptions"
  35086. ]));
  35087. // pkg/dist-src/paginating-endpoints.js
  35088. function isPaginatingEndpoint(arg) {
  35089. if (typeof arg === "string") {
  35090. return paginatingEndpoints.includes(arg);
  35091. } else {
  35092. return false;
  35093. }
  35094. }
  35095. // pkg/dist-src/index.js
  35096. function paginateRest(octokit) {
  35097. return {
  35098. paginate: Object.assign(paginate.bind(null, octokit), {
  35099. iterator: iterator.bind(null, octokit)
  35100. })
  35101. };
  35102. }
  35103. paginateRest.VERSION = plugin_paginate_rest_dist_bundle_VERSION;
  35104. ;// CONCATENATED MODULE: ./node_modules/@actions/github/lib/utils.js
  35105. // octokit + plugins
  35106. const context = new Context();
  35107. const baseUrl = getApiBaseUrl();
  35108. const defaults = {
  35109. baseUrl,
  35110. request: {
  35111. agent: getProxyAgent(baseUrl),
  35112. fetch: getProxyFetch(baseUrl)
  35113. }
  35114. };
  35115. const GitHub = Octokit.plugin(restEndpointMethods, paginateRest).defaults(defaults);
  35116. /**
  35117. * Convience function to correctly format Octokit Options to pass into the constructor.
  35118. *
  35119. * @param token the repo PAT or GITHUB_TOKEN
  35120. * @param options other options to set
  35121. */
  35122. function getOctokitOptions(token, options) {
  35123. const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller
  35124. // Auth
  35125. const auth = getAuthString(token, opts);
  35126. if (auth) {
  35127. opts.auth = auth;
  35128. }
  35129. // Orchestration ID
  35130. const userAgent = getUserAgentWithOrchestrationId(opts.userAgent);
  35131. if (userAgent) {
  35132. opts.userAgent = userAgent;
  35133. }
  35134. return opts;
  35135. }
  35136. //# sourceMappingURL=utils.js.map
  35137. ;// CONCATENATED MODULE: ./node_modules/@actions/github/lib/github.js
  35138. const github_context = new Context();
  35139. /**
  35140. * Returns a hydrated octokit ready to use for GitHub Actions
  35141. *
  35142. * @param token the repo PAT or GITHUB_TOKEN
  35143. * @param options other options to set
  35144. */
  35145. function getOctokit(token, options, ...additionalPlugins) {
  35146. const GitHubWithPlugins = GitHub.plugin(...additionalPlugins);
  35147. return new GitHubWithPlugins(getOctokitOptions(token, options));
  35148. }
  35149. //# sourceMappingURL=github.js.map
  35150. // EXTERNAL MODULE: ./node_modules/@actions/tool-cache/node_modules/semver/index.js
  35151. var node_modules_semver = __nccwpck_require__(885);
  35152. ;// CONCATENATED MODULE: ./node_modules/@actions/tool-cache/lib/manifest.js
  35153. var manifest_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  35154. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  35155. return new (P || (P = Promise))(function (resolve, reject) {
  35156. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  35157. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  35158. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  35159. step((generator = generator.apply(thisArg, _arguments || [])).next());
  35160. });
  35161. };
  35162. // Internal object for testability (allows mocking in ESM)
  35163. const _internal = {
  35164. readLinuxVersionFile() {
  35165. const lsbReleaseFile = '/etc/lsb-release';
  35166. const osReleaseFile = '/etc/os-release';
  35167. let contents = '';
  35168. if (external_fs_namespaceObject.existsSync(lsbReleaseFile)) {
  35169. contents = external_fs_namespaceObject.readFileSync(lsbReleaseFile).toString();
  35170. }
  35171. else if (external_fs_namespaceObject.existsSync(osReleaseFile)) {
  35172. contents = external_fs_namespaceObject.readFileSync(osReleaseFile).toString();
  35173. }
  35174. return contents;
  35175. }
  35176. };
  35177. function _findMatch(versionSpec, stable, candidates, archFilter) {
  35178. return manifest_awaiter(this, void 0, void 0, function* () {
  35179. const platFilter = os.platform();
  35180. let result;
  35181. let match;
  35182. let file;
  35183. for (const candidate of candidates) {
  35184. const version = candidate.version;
  35185. debug(`check ${version} satisfies ${versionSpec}`);
  35186. if (semver.satisfies(version, versionSpec) &&
  35187. (!stable || candidate.stable === stable)) {
  35188. file = candidate.files.find(item => {
  35189. debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
  35190. let chk = item.arch === archFilter && item.platform === platFilter;
  35191. if (chk && item.platform_version) {
  35192. const osVersion = _getOsVersion();
  35193. if (osVersion === item.platform_version) {
  35194. chk = true;
  35195. }
  35196. else {
  35197. chk = semver.satisfies(osVersion, item.platform_version);
  35198. }
  35199. }
  35200. return chk;
  35201. });
  35202. if (file) {
  35203. debug(`matched ${candidate.version}`);
  35204. match = candidate;
  35205. break;
  35206. }
  35207. }
  35208. }
  35209. if (match && file) {
  35210. // clone since we're mutating the file list to be only the file that matches
  35211. result = Object.assign({}, match);
  35212. result.files = [file];
  35213. }
  35214. return result;
  35215. });
  35216. }
  35217. function _getOsVersion() {
  35218. // TODO: add windows and other linux, arm variants
  35219. // right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python)
  35220. const plat = os.platform();
  35221. let version = '';
  35222. if (plat === 'darwin') {
  35223. version = cp.execSync('sw_vers -productVersion').toString();
  35224. }
  35225. else if (plat === 'linux') {
  35226. // lsb_release process not in some containers, readfile
  35227. // Run cat /etc/lsb-release
  35228. // DISTRIB_ID=Ubuntu
  35229. // DISTRIB_RELEASE=18.04
  35230. // DISTRIB_CODENAME=bionic
  35231. // DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
  35232. const lsbContents = _internal.readLinuxVersionFile();
  35233. if (lsbContents) {
  35234. const lines = lsbContents.split('\n');
  35235. for (const line of lines) {
  35236. const parts = line.split('=');
  35237. if (parts.length === 2 &&
  35238. (parts[0].trim() === 'VERSION_ID' ||
  35239. parts[0].trim() === 'DISTRIB_RELEASE')) {
  35240. version = parts[1].trim().replace(/^"/, '').replace(/"$/, '');
  35241. break;
  35242. }
  35243. }
  35244. }
  35245. }
  35246. return version;
  35247. }
  35248. // Alias for backwards compatibility
  35249. function _readLinuxVersionFile() {
  35250. return _internal.readLinuxVersionFile();
  35251. }
  35252. //# sourceMappingURL=manifest.js.map
  35253. ;// CONCATENATED MODULE: external "stream"
  35254. const external_stream_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("stream");
  35255. // EXTERNAL MODULE: external "util"
  35256. var external_util_ = __nccwpck_require__(9023);
  35257. ;// CONCATENATED MODULE: ./node_modules/@actions/tool-cache/lib/retry-helper.js
  35258. var retry_helper_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  35259. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  35260. return new (P || (P = Promise))(function (resolve, reject) {
  35261. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  35262. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  35263. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  35264. step((generator = generator.apply(thisArg, _arguments || [])).next());
  35265. });
  35266. };
  35267. /**
  35268. * Internal class for retries
  35269. */
  35270. class lib_retry_helper_RetryHelper {
  35271. constructor(maxAttempts, minSeconds, maxSeconds) {
  35272. if (maxAttempts < 1) {
  35273. throw new Error('max attempts should be greater than or equal to 1');
  35274. }
  35275. this.maxAttempts = maxAttempts;
  35276. this.minSeconds = Math.floor(minSeconds);
  35277. this.maxSeconds = Math.floor(maxSeconds);
  35278. if (this.minSeconds > this.maxSeconds) {
  35279. throw new Error('min seconds should be less than or equal to max seconds');
  35280. }
  35281. }
  35282. execute(action, isRetryable) {
  35283. return retry_helper_awaiter(this, void 0, void 0, function* () {
  35284. let attempt = 1;
  35285. while (attempt < this.maxAttempts) {
  35286. // Try
  35287. try {
  35288. return yield action();
  35289. }
  35290. catch (err) {
  35291. if (isRetryable && !isRetryable(err)) {
  35292. throw err;
  35293. }
  35294. core.info(err.message);
  35295. }
  35296. // Sleep
  35297. const seconds = this.getSleepAmount();
  35298. core.info(`Waiting ${seconds} seconds before trying again`);
  35299. yield this.sleep(seconds);
  35300. attempt++;
  35301. }
  35302. // Last attempt
  35303. return yield action();
  35304. });
  35305. }
  35306. getSleepAmount() {
  35307. return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
  35308. this.minSeconds);
  35309. }
  35310. sleep(seconds) {
  35311. return retry_helper_awaiter(this, void 0, void 0, function* () {
  35312. return new Promise(resolve => setTimeout(resolve, seconds * 1000));
  35313. });
  35314. }
  35315. }
  35316. //# sourceMappingURL=retry-helper.js.map
  35317. ;// CONCATENATED MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js
  35318. var tool_cache_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  35319. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  35320. return new (P || (P = Promise))(function (resolve, reject) {
  35321. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  35322. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  35323. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  35324. step((generator = generator.apply(thisArg, _arguments || [])).next());
  35325. });
  35326. };
  35327. class HTTPError extends Error {
  35328. constructor(httpStatusCode) {
  35329. super(`Unexpected HTTP response: ${httpStatusCode}`);
  35330. this.httpStatusCode = httpStatusCode;
  35331. Object.setPrototypeOf(this, new.target.prototype);
  35332. }
  35333. }
  35334. const tool_cache_IS_WINDOWS = process.platform === 'win32';
  35335. const IS_MAC = process.platform === 'darwin';
  35336. const tool_cache_userAgent = 'actions/tool-cache';
  35337. /**
  35338. * Download a tool from an url and stream it into a file
  35339. *
  35340. * @param url url of tool to download
  35341. * @param dest path to download tool
  35342. * @param auth authorization header
  35343. * @param headers other headers
  35344. * @returns path to downloaded tool
  35345. */
  35346. function downloadTool(url, dest, auth, headers) {
  35347. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35348. dest = dest || path.join(_getTempDirectory(), crypto.randomUUID());
  35349. yield io.mkdirP(path.dirname(dest));
  35350. core.debug(`Downloading ${url}`);
  35351. core.debug(`Destination ${dest}`);
  35352. const maxAttempts = 3;
  35353. const minSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 10);
  35354. const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
  35355. const retryHelper = new RetryHelper(maxAttempts, minSeconds, maxSeconds);
  35356. return yield retryHelper.execute(() => tool_cache_awaiter(this, void 0, void 0, function* () {
  35357. return yield downloadToolAttempt(url, dest || '', auth, headers);
  35358. }), (err) => {
  35359. if (err instanceof HTTPError && err.httpStatusCode) {
  35360. // Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
  35361. if (err.httpStatusCode < 500 &&
  35362. err.httpStatusCode !== 408 &&
  35363. err.httpStatusCode !== 429) {
  35364. return false;
  35365. }
  35366. }
  35367. // Otherwise retry
  35368. return true;
  35369. });
  35370. });
  35371. }
  35372. function downloadToolAttempt(url, dest, auth, headers) {
  35373. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35374. if (fs.existsSync(dest)) {
  35375. throw new Error(`Destination file path ${dest} already exists`);
  35376. }
  35377. // Get the response headers
  35378. const http = new httpm.HttpClient(tool_cache_userAgent, [], {
  35379. allowRetries: false
  35380. });
  35381. if (auth) {
  35382. core.debug('set auth');
  35383. if (headers === undefined) {
  35384. headers = {};
  35385. }
  35386. headers.authorization = auth;
  35387. }
  35388. const response = yield http.get(url, headers);
  35389. if (response.message.statusCode !== 200) {
  35390. const err = new HTTPError(response.message.statusCode);
  35391. core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
  35392. throw err;
  35393. }
  35394. // Download the response body
  35395. const pipeline = util.promisify(stream.pipeline);
  35396. const responseMessageFactory = _getGlobal('TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY', () => response.message);
  35397. const readStream = responseMessageFactory();
  35398. let succeeded = false;
  35399. try {
  35400. yield pipeline(readStream, fs.createWriteStream(dest));
  35401. core.debug('download complete');
  35402. succeeded = true;
  35403. return dest;
  35404. }
  35405. finally {
  35406. // Error, delete dest before retry
  35407. if (!succeeded) {
  35408. core.debug('download failed');
  35409. try {
  35410. yield io.rmRF(dest);
  35411. }
  35412. catch (err) {
  35413. core.debug(`Failed to delete '${dest}'. ${err.message}`);
  35414. }
  35415. }
  35416. }
  35417. });
  35418. }
  35419. /**
  35420. * Extract a .7z file
  35421. *
  35422. * @param file path to the .7z file
  35423. * @param dest destination directory. Optional.
  35424. * @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
  35425. * problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
  35426. * gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
  35427. * bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
  35428. * interface, it is smaller than the full command line interface, and it does support long paths. At the
  35429. * time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
  35430. * Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
  35431. * to 7zr.exe can be pass to this function.
  35432. * @returns path to the destination directory
  35433. */
  35434. function extract7z(file, dest, _7zPath) {
  35435. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35436. ok(tool_cache_IS_WINDOWS, 'extract7z() not supported on current OS');
  35437. ok(file, 'parameter "file" is required');
  35438. dest = yield _createExtractFolder(dest);
  35439. const originalCwd = process.cwd();
  35440. process.chdir(dest);
  35441. if (_7zPath) {
  35442. try {
  35443. const logLevel = core.isDebug() ? '-bb1' : '-bb0';
  35444. const args = [
  35445. 'x', // eXtract files with full paths
  35446. logLevel, // -bb[0-3] : set output log level
  35447. '-bd', // disable progress indicator
  35448. '-sccUTF-8', // set charset for for console input/output
  35449. file
  35450. ];
  35451. const options = {
  35452. silent: true
  35453. };
  35454. yield exec(`"${_7zPath}"`, args, options);
  35455. }
  35456. finally {
  35457. process.chdir(originalCwd);
  35458. }
  35459. }
  35460. else {
  35461. const escapedScript = path
  35462. .join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
  35463. .replace(/'/g, "''")
  35464. .replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
  35465. const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
  35466. const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
  35467. const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
  35468. const args = [
  35469. '-NoLogo',
  35470. '-Sta',
  35471. '-NoProfile',
  35472. '-NonInteractive',
  35473. '-ExecutionPolicy',
  35474. 'Unrestricted',
  35475. '-Command',
  35476. command
  35477. ];
  35478. const options = {
  35479. silent: true
  35480. };
  35481. try {
  35482. const powershellPath = yield io.which('powershell', true);
  35483. yield exec(`"${powershellPath}"`, args, options);
  35484. }
  35485. finally {
  35486. process.chdir(originalCwd);
  35487. }
  35488. }
  35489. return dest;
  35490. });
  35491. }
  35492. /**
  35493. * Extract a compressed tar archive
  35494. *
  35495. * @param file path to the tar
  35496. * @param dest destination directory. Optional.
  35497. * @param flags flags for the tar command to use for extraction. Defaults to 'xz' (extracting gzipped tars). Optional.
  35498. * @returns path to the destination directory
  35499. */
  35500. function extractTar(file_1, dest_1) {
  35501. return tool_cache_awaiter(this, arguments, void 0, function* (file, dest, flags = 'xz') {
  35502. if (!file) {
  35503. throw new Error("parameter 'file' is required");
  35504. }
  35505. // Create dest
  35506. dest = yield _createExtractFolder(dest);
  35507. // Determine whether GNU tar
  35508. core_debug('Checking tar --version');
  35509. let versionOutput = '';
  35510. yield exec_exec('tar --version', [], {
  35511. ignoreReturnCode: true,
  35512. silent: true,
  35513. listeners: {
  35514. stdout: (data) => (versionOutput += data.toString()),
  35515. stderr: (data) => (versionOutput += data.toString())
  35516. }
  35517. });
  35518. core_debug(versionOutput.trim());
  35519. const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR');
  35520. // Initialize args
  35521. let args;
  35522. if (flags instanceof Array) {
  35523. args = flags;
  35524. }
  35525. else {
  35526. args = [flags];
  35527. }
  35528. if (isDebug() && !flags.includes('v')) {
  35529. args.push('-v');
  35530. }
  35531. let destArg = dest;
  35532. let fileArg = file;
  35533. if (tool_cache_IS_WINDOWS && isGnuTar) {
  35534. args.push('--force-local');
  35535. destArg = dest.replace(/\\/g, '/');
  35536. // Technically only the dest needs to have `/` but for aesthetic consistency
  35537. // convert slashes in the file arg too.
  35538. fileArg = file.replace(/\\/g, '/');
  35539. }
  35540. if (isGnuTar) {
  35541. // Suppress warnings when using GNU tar to extract archives created by BSD tar
  35542. args.push('--warning=no-unknown-keyword');
  35543. args.push('--overwrite');
  35544. }
  35545. args.push('-C', destArg, '-f', fileArg);
  35546. yield exec_exec(`tar`, args);
  35547. return dest;
  35548. });
  35549. }
  35550. /**
  35551. * Extract a xar compatible archive
  35552. *
  35553. * @param file path to the archive
  35554. * @param dest destination directory. Optional.
  35555. * @param flags flags for the xar. Optional.
  35556. * @returns path to the destination directory
  35557. */
  35558. function extractXar(file_1, dest_1) {
  35559. return tool_cache_awaiter(this, arguments, void 0, function* (file, dest, flags = []) {
  35560. ok(IS_MAC, 'extractXar() not supported on current OS');
  35561. ok(file, 'parameter "file" is required');
  35562. dest = yield _createExtractFolder(dest);
  35563. let args;
  35564. if (flags instanceof Array) {
  35565. args = flags;
  35566. }
  35567. else {
  35568. args = [flags];
  35569. }
  35570. args.push('-x', '-C', dest, '-f', file);
  35571. if (core.isDebug()) {
  35572. args.push('-v');
  35573. }
  35574. const xarPath = yield io.which('xar', true);
  35575. yield exec(`"${xarPath}"`, _unique(args));
  35576. return dest;
  35577. });
  35578. }
  35579. /**
  35580. * Extract a zip
  35581. *
  35582. * @param file path to the zip
  35583. * @param dest destination directory. Optional.
  35584. * @returns path to the destination directory
  35585. */
  35586. function extractZip(file, dest) {
  35587. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35588. if (!file) {
  35589. throw new Error("parameter 'file' is required");
  35590. }
  35591. dest = yield _createExtractFolder(dest);
  35592. if (tool_cache_IS_WINDOWS) {
  35593. yield extractZipWin(file, dest);
  35594. }
  35595. else {
  35596. yield extractZipNix(file, dest);
  35597. }
  35598. return dest;
  35599. });
  35600. }
  35601. function extractZipWin(file, dest) {
  35602. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35603. // build the powershell command
  35604. const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
  35605. const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
  35606. const pwshPath = yield which('pwsh', false);
  35607. //To match the file overwrite behavior on nix systems, we use the overwrite = true flag for ExtractToDirectory
  35608. //and the -Force flag for Expand-Archive as a fallback
  35609. if (pwshPath) {
  35610. //attempt to use pwsh with ExtractToDirectory, if this fails attempt Expand-Archive
  35611. const pwshCommand = [
  35612. `$ErrorActionPreference = 'Stop' ;`,
  35613. `try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,
  35614. `try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`,
  35615. `catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;`
  35616. ].join(' ');
  35617. const args = [
  35618. '-NoLogo',
  35619. '-NoProfile',
  35620. '-NonInteractive',
  35621. '-ExecutionPolicy',
  35622. 'Unrestricted',
  35623. '-Command',
  35624. pwshCommand
  35625. ];
  35626. core_debug(`Using pwsh at path: ${pwshPath}`);
  35627. yield exec_exec(`"${pwshPath}"`, args);
  35628. }
  35629. else {
  35630. const powershellCommand = [
  35631. `$ErrorActionPreference = 'Stop' ;`,
  35632. `try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,
  35633. `if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`,
  35634. `else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`
  35635. ].join(' ');
  35636. const args = [
  35637. '-NoLogo',
  35638. '-Sta',
  35639. '-NoProfile',
  35640. '-NonInteractive',
  35641. '-ExecutionPolicy',
  35642. 'Unrestricted',
  35643. '-Command',
  35644. powershellCommand
  35645. ];
  35646. const powershellPath = yield which('powershell', true);
  35647. core_debug(`Using powershell at path: ${powershellPath}`);
  35648. yield exec_exec(`"${powershellPath}"`, args);
  35649. }
  35650. });
  35651. }
  35652. function extractZipNix(file, dest) {
  35653. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35654. const unzipPath = yield which('unzip', true);
  35655. const args = [file];
  35656. if (!isDebug()) {
  35657. args.unshift('-q');
  35658. }
  35659. args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
  35660. yield exec_exec(`"${unzipPath}"`, args, { cwd: dest });
  35661. });
  35662. }
  35663. /**
  35664. * Caches a directory and installs it into the tool cacheDir
  35665. *
  35666. * @param sourceDir the directory to cache into tools
  35667. * @param tool tool name
  35668. * @param version version of the tool. semver format
  35669. * @param arch architecture of the tool. Optional. Defaults to machine architecture
  35670. */
  35671. function cacheDir(sourceDir, tool, version, arch) {
  35672. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35673. version = semver.clean(version) || version;
  35674. arch = arch || os.arch();
  35675. core.debug(`Caching tool ${tool} ${version} ${arch}`);
  35676. core.debug(`source dir: ${sourceDir}`);
  35677. if (!fs.statSync(sourceDir).isDirectory()) {
  35678. throw new Error('sourceDir is not a directory');
  35679. }
  35680. // Create the tool dir
  35681. const destPath = yield _createToolPath(tool, version, arch);
  35682. // copy each child item. do not move. move can fail on Windows
  35683. // due to anti-virus software having an open handle on a file.
  35684. for (const itemName of fs.readdirSync(sourceDir)) {
  35685. const s = path.join(sourceDir, itemName);
  35686. yield io.cp(s, destPath, { recursive: true });
  35687. }
  35688. // write .complete
  35689. _completeToolPath(tool, version, arch);
  35690. return destPath;
  35691. });
  35692. }
  35693. /**
  35694. * Caches a downloaded file (GUID) and installs it
  35695. * into the tool cache with a given targetName
  35696. *
  35697. * @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
  35698. * @param targetFile the name of the file name in the tools directory
  35699. * @param tool tool name
  35700. * @param version version of the tool. semver format
  35701. * @param arch architecture of the tool. Optional. Defaults to machine architecture
  35702. */
  35703. function cacheFile(sourceFile, targetFile, tool, version, arch) {
  35704. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35705. version = semver.clean(version) || version;
  35706. arch = arch || os.arch();
  35707. core.debug(`Caching tool ${tool} ${version} ${arch}`);
  35708. core.debug(`source file: ${sourceFile}`);
  35709. if (!fs.statSync(sourceFile).isFile()) {
  35710. throw new Error('sourceFile is not a file');
  35711. }
  35712. // create the tool dir
  35713. const destFolder = yield _createToolPath(tool, version, arch);
  35714. // copy instead of move. move can fail on Windows due to
  35715. // anti-virus software having an open handle on a file.
  35716. const destPath = path.join(destFolder, targetFile);
  35717. core.debug(`destination file ${destPath}`);
  35718. yield io.cp(sourceFile, destPath);
  35719. // write .complete
  35720. _completeToolPath(tool, version, arch);
  35721. return destFolder;
  35722. });
  35723. }
  35724. /**
  35725. * Finds the path to a tool version in the local installed tool cache
  35726. *
  35727. * @param toolName name of the tool
  35728. * @param versionSpec version of the tool
  35729. * @param arch optional arch. defaults to arch of computer
  35730. */
  35731. function find(toolName, versionSpec, arch) {
  35732. if (!toolName) {
  35733. throw new Error('toolName parameter is required');
  35734. }
  35735. if (!versionSpec) {
  35736. throw new Error('versionSpec parameter is required');
  35737. }
  35738. arch = arch || os.arch();
  35739. // attempt to resolve an explicit version
  35740. if (!isExplicitVersion(versionSpec)) {
  35741. const localVersions = findAllVersions(toolName, arch);
  35742. const match = evaluateVersions(localVersions, versionSpec);
  35743. versionSpec = match;
  35744. }
  35745. // check for the explicit version in the cache
  35746. let toolPath = '';
  35747. if (versionSpec) {
  35748. versionSpec = semver.clean(versionSpec) || '';
  35749. const cachePath = path.join(_getCacheDirectory(), toolName, versionSpec, arch);
  35750. core.debug(`checking cache: ${cachePath}`);
  35751. if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
  35752. core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
  35753. toolPath = cachePath;
  35754. }
  35755. else {
  35756. core.debug('not found');
  35757. }
  35758. }
  35759. return toolPath;
  35760. }
  35761. /**
  35762. * Finds the paths to all versions of a tool that are installed in the local tool cache
  35763. *
  35764. * @param toolName name of the tool
  35765. * @param arch optional arch. defaults to arch of computer
  35766. */
  35767. function findAllVersions(toolName, arch) {
  35768. const versions = [];
  35769. arch = arch || os.arch();
  35770. const toolPath = path.join(_getCacheDirectory(), toolName);
  35771. if (fs.existsSync(toolPath)) {
  35772. const children = fs.readdirSync(toolPath);
  35773. for (const child of children) {
  35774. if (isExplicitVersion(child)) {
  35775. const fullPath = path.join(toolPath, child, arch || '');
  35776. if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
  35777. versions.push(child);
  35778. }
  35779. }
  35780. }
  35781. }
  35782. return versions;
  35783. }
  35784. function getManifestFromRepo(owner_1, repo_1, auth_1) {
  35785. return tool_cache_awaiter(this, arguments, void 0, function* (owner, repo, auth, branch = 'master') {
  35786. let releases = [];
  35787. const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`;
  35788. const http = new httpm.HttpClient('tool-cache');
  35789. const headers = {};
  35790. if (auth) {
  35791. core.debug('set auth');
  35792. headers.authorization = auth;
  35793. }
  35794. const response = yield http.getJson(treeUrl, headers);
  35795. if (!response.result) {
  35796. return releases;
  35797. }
  35798. let manifestUrl = '';
  35799. for (const item of response.result.tree) {
  35800. if (item.path === 'versions-manifest.json') {
  35801. manifestUrl = item.url;
  35802. break;
  35803. }
  35804. }
  35805. headers['accept'] = 'application/vnd.github.VERSION.raw';
  35806. let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody();
  35807. if (versionsRaw) {
  35808. // shouldn't be needed but protects against invalid json saved with BOM
  35809. versionsRaw = versionsRaw.replace(/^\uFEFF/, '');
  35810. try {
  35811. releases = JSON.parse(versionsRaw);
  35812. }
  35813. catch (_a) {
  35814. core.debug('Invalid json');
  35815. }
  35816. }
  35817. return releases;
  35818. });
  35819. }
  35820. function findFromManifest(versionSpec_1, stable_1, manifest_1) {
  35821. return tool_cache_awaiter(this, arguments, void 0, function* (versionSpec, stable, manifest, archFilter = os.arch()) {
  35822. // wrap the internal impl
  35823. const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter);
  35824. return match;
  35825. });
  35826. }
  35827. function _createExtractFolder(dest) {
  35828. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35829. if (!dest) {
  35830. // create a temp dir
  35831. dest = external_path_namespaceObject.join(_getTempDirectory(), external_crypto_namespaceObject.randomUUID());
  35832. }
  35833. yield mkdirP(dest);
  35834. return dest;
  35835. });
  35836. }
  35837. function _createToolPath(tool, version, arch) {
  35838. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35839. const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
  35840. core.debug(`destination ${folderPath}`);
  35841. const markerPath = `${folderPath}.complete`;
  35842. yield io.rmRF(folderPath);
  35843. yield io.rmRF(markerPath);
  35844. yield io.mkdirP(folderPath);
  35845. return folderPath;
  35846. });
  35847. }
  35848. function _completeToolPath(tool, version, arch) {
  35849. const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
  35850. const markerPath = `${folderPath}.complete`;
  35851. fs.writeFileSync(markerPath, '');
  35852. core.debug('finished caching tool');
  35853. }
  35854. /**
  35855. * Check if version string is explicit
  35856. *
  35857. * @param versionSpec version string to check
  35858. */
  35859. function isExplicitVersion(versionSpec) {
  35860. const c = semver.clean(versionSpec) || '';
  35861. core.debug(`isExplicit: ${c}`);
  35862. const valid = semver.valid(c) != null;
  35863. core.debug(`explicit? ${valid}`);
  35864. return valid;
  35865. }
  35866. /**
  35867. * Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec`
  35868. *
  35869. * @param versions array of versions to evaluate
  35870. * @param versionSpec semantic version spec to satisfy
  35871. */
  35872. function evaluateVersions(versions, versionSpec) {
  35873. let version = '';
  35874. core.debug(`evaluating ${versions.length} versions`);
  35875. versions = versions.sort((a, b) => {
  35876. if (semver.gt(a, b)) {
  35877. return 1;
  35878. }
  35879. return -1;
  35880. });
  35881. for (let i = versions.length - 1; i >= 0; i--) {
  35882. const potential = versions[i];
  35883. const satisfied = semver.satisfies(potential, versionSpec);
  35884. if (satisfied) {
  35885. version = potential;
  35886. break;
  35887. }
  35888. }
  35889. if (version) {
  35890. core.debug(`matched: ${version}`);
  35891. }
  35892. else {
  35893. core.debug('match not found');
  35894. }
  35895. return version;
  35896. }
  35897. /**
  35898. * Gets RUNNER_TOOL_CACHE
  35899. */
  35900. function _getCacheDirectory() {
  35901. const cacheDirectory = process.env['RUNNER_TOOL_CACHE'] || '';
  35902. ok(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
  35903. return cacheDirectory;
  35904. }
  35905. /**
  35906. * Gets RUNNER_TEMP
  35907. */
  35908. function _getTempDirectory() {
  35909. const tempDirectory = process.env['RUNNER_TEMP'] || '';
  35910. (0,external_assert_.ok)(tempDirectory, 'Expected RUNNER_TEMP to be defined');
  35911. return tempDirectory;
  35912. }
  35913. /**
  35914. * Gets a global variable
  35915. */
  35916. function _getGlobal(key, defaultValue) {
  35917. /* eslint-disable @typescript-eslint/no-explicit-any */
  35918. const value = global[key];
  35919. /* eslint-enable @typescript-eslint/no-explicit-any */
  35920. return value !== undefined ? value : defaultValue;
  35921. }
  35922. /**
  35923. * Returns an array of unique values.
  35924. * @param values Values to make unique.
  35925. */
  35926. function _unique(values) {
  35927. return Array.from(new Set(values));
  35928. }
  35929. //# sourceMappingURL=tool-cache.js.map
  35930. ;// CONCATENATED MODULE: ./src/github-api-helper.ts
  35931. const github_api_helper_IS_WINDOWS = process.platform === 'win32';
  35932. async function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath, baseUrl) {
  35933. // Determine the default branch
  35934. if (!ref && !commit) {
  35935. info('Determining the default branch');
  35936. ref = await getDefaultBranch(authToken, owner, repo, baseUrl);
  35937. }
  35938. // Download the archive
  35939. let archiveData = await execute(async () => {
  35940. info('Downloading the archive');
  35941. return await downloadArchive(authToken, owner, repo, ref, commit, baseUrl);
  35942. });
  35943. // Write archive to disk
  35944. info('Writing archive to disk');
  35945. const uniqueId = (0,external_crypto_namespaceObject.randomUUID)();
  35946. const archivePath = github_api_helper_IS_WINDOWS
  35947. ? external_path_namespaceObject.join(repositoryPath, `${uniqueId}.zip`)
  35948. : external_path_namespaceObject.join(repositoryPath, `${uniqueId}.tar.gz`);
  35949. await external_fs_namespaceObject.promises.writeFile(archivePath, archiveData);
  35950. archiveData = Buffer.from(''); // Free memory
  35951. // Extract archive
  35952. info('Extracting the archive');
  35953. const extractPath = external_path_namespaceObject.join(repositoryPath, uniqueId);
  35954. await mkdirP(extractPath);
  35955. if (github_api_helper_IS_WINDOWS) {
  35956. await extractZip(archivePath, extractPath);
  35957. }
  35958. else {
  35959. await extractTar(archivePath, extractPath);
  35960. }
  35961. await rmRF(archivePath);
  35962. // Determine the path of the repository content. The archive contains
  35963. // a top-level folder and the repository content is inside.
  35964. const archiveFileNames = await external_fs_namespaceObject.promises.readdir(extractPath);
  35965. external_assert_.ok(archiveFileNames.length == 1, 'Expected exactly one directory inside archive');
  35966. const archiveVersion = archiveFileNames[0]; // The top-level folder name includes the short SHA
  35967. info(`Resolved version ${archiveVersion}`);
  35968. const tempRepositoryPath = external_path_namespaceObject.join(extractPath, archiveVersion);
  35969. // Move the files
  35970. for (const fileName of await external_fs_namespaceObject.promises.readdir(tempRepositoryPath)) {
  35971. const sourcePath = external_path_namespaceObject.join(tempRepositoryPath, fileName);
  35972. const targetPath = external_path_namespaceObject.join(repositoryPath, fileName);
  35973. if (github_api_helper_IS_WINDOWS) {
  35974. await io_cp(sourcePath, targetPath, { recursive: true }); // Copy on Windows (Windows Defender may have a lock)
  35975. }
  35976. else {
  35977. await mv(sourcePath, targetPath);
  35978. }
  35979. }
  35980. await rmRF(extractPath);
  35981. }
  35982. /**
  35983. * Looks up the default branch name
  35984. */
  35985. async function getDefaultBranch(authToken, owner, repo, baseUrl) {
  35986. return await execute(async () => {
  35987. info('Retrieving the default branch name');
  35988. const octokit = getOctokit(authToken, {
  35989. baseUrl: getServerApiUrl(baseUrl)
  35990. });
  35991. let result;
  35992. try {
  35993. // Get the default branch from the repo info
  35994. const response = await octokit.rest.repos.get({ owner, repo });
  35995. result = response.data.default_branch;
  35996. external_assert_.ok(result, 'default_branch cannot be empty');
  35997. }
  35998. catch (err) {
  35999. // Handle .wiki repo
  36000. if (err?.status === 404 &&
  36001. repo.toUpperCase().endsWith('.WIKI')) {
  36002. result = 'master';
  36003. }
  36004. // Otherwise error
  36005. else {
  36006. throw err;
  36007. }
  36008. }
  36009. // Print the default branch
  36010. info(`Default branch '${result}'`);
  36011. // Prefix with 'refs/heads'
  36012. if (!result.startsWith('refs/')) {
  36013. result = `refs/heads/${result}`;
  36014. }
  36015. return result;
  36016. });
  36017. }
  36018. async function tryGetRepositoryObjectFormat(authToken, owner, repo, baseUrl, commit) {
  36019. const commitFormat = getObjectFormat(commit);
  36020. if (commitFormat) {
  36021. return { format: commitFormat, succeeded: true };
  36022. }
  36023. try {
  36024. const octokit = getOctokit(authToken, {
  36025. baseUrl: getServerApiUrl(baseUrl)
  36026. });
  36027. const response = await octokit.request('GET /repos/{owner}/{repo}/hash-algorithm', { owner, repo });
  36028. const hashAlgorithm = response.data.hash_algorithm;
  36029. if (hashAlgorithm === 'sha256' || hashAlgorithm === 'sha1') {
  36030. return { format: hashAlgorithm, succeeded: true };
  36031. }
  36032. core_debug('Unable to determine repository object format from hash-algorithm endpoint');
  36033. return { format: '', succeeded: false };
  36034. }
  36035. catch (err) {
  36036. core_debug(`Unable to determine repository object format from hash-algorithm endpoint: ${err?.message ?? err}`);
  36037. return { format: '', succeeded: false };
  36038. }
  36039. }
  36040. function getObjectFormat(sha) {
  36041. if (/^[0-9a-fA-F]{64}$/.test(sha || '')) {
  36042. return 'sha256';
  36043. }
  36044. if (/^[0-9a-fA-F]{40}$/.test(sha || '')) {
  36045. return 'sha1';
  36046. }
  36047. return '';
  36048. }
  36049. async function downloadArchive(authToken, owner, repo, ref, commit, baseUrl) {
  36050. const octokit = getOctokit(authToken, {
  36051. baseUrl: getServerApiUrl(baseUrl)
  36052. });
  36053. const download = github_api_helper_IS_WINDOWS
  36054. ? octokit.rest.repos.downloadZipballArchive
  36055. : octokit.rest.repos.downloadTarballArchive;
  36056. const response = await download({
  36057. owner: owner,
  36058. repo: repo,
  36059. ref: commit || ref
  36060. });
  36061. return Buffer.from(response.data); // response.data is ArrayBuffer
  36062. }
  36063. ;// CONCATENATED MODULE: ./src/ref-helper.ts
  36064. const tagsRefSpec = '+refs/tags/*:refs/tags/*';
  36065. async function getCheckoutInfo(git, ref, commit) {
  36066. if (!git) {
  36067. throw new Error('Arg git cannot be empty');
  36068. }
  36069. if (!ref && !commit) {
  36070. throw new Error('Args ref and commit cannot both be empty');
  36071. }
  36072. const result = {};
  36073. const upperRef = (ref || '').toUpperCase();
  36074. // SHA only
  36075. if (!ref) {
  36076. result.ref = commit;
  36077. }
  36078. // refs/heads/
  36079. else if (upperRef.startsWith('REFS/HEADS/')) {
  36080. const branch = ref.substring('refs/heads/'.length);
  36081. result.ref = branch;
  36082. result.startPoint = `refs/remotes/origin/${branch}`;
  36083. }
  36084. // refs/pull/
  36085. else if (upperRef.startsWith('REFS/PULL/')) {
  36086. const branch = ref.substring('refs/pull/'.length);
  36087. result.ref = `refs/remotes/pull/${branch}`;
  36088. }
  36089. // refs/tags/
  36090. else if (upperRef.startsWith('REFS/TAGS/')) {
  36091. result.ref = ref;
  36092. }
  36093. // refs/
  36094. else if (upperRef.startsWith('REFS/')) {
  36095. result.ref = commit ? commit : ref;
  36096. }
  36097. // Unqualified ref, check for a matching branch or tag
  36098. else {
  36099. if (await git.branchExists(true, `origin/${ref}`)) {
  36100. result.ref = ref;
  36101. result.startPoint = `refs/remotes/origin/${ref}`;
  36102. }
  36103. else if (await git.tagExists(`${ref}`)) {
  36104. result.ref = `refs/tags/${ref}`;
  36105. }
  36106. else {
  36107. throw new Error(`A branch or tag with the name '${ref}' could not be found`);
  36108. }
  36109. }
  36110. return result;
  36111. }
  36112. function getRefSpecForAllHistory(ref, commit) {
  36113. const result = ['+refs/heads/*:refs/remotes/origin/*', tagsRefSpec];
  36114. if (ref && ref.toUpperCase().startsWith('REFS/PULL/')) {
  36115. const branch = ref.substring('refs/pull/'.length);
  36116. result.push(`+${commit || ref}:refs/remotes/pull/${branch}`);
  36117. }
  36118. return result;
  36119. }
  36120. function getRefSpec(ref, commit, fetchTags) {
  36121. if (!ref && !commit) {
  36122. throw new Error('Args ref and commit cannot both be empty');
  36123. }
  36124. const upperRef = (ref || '').toUpperCase();
  36125. const result = [];
  36126. // When fetchTags is true, always include the tags refspec
  36127. if (fetchTags) {
  36128. result.push(tagsRefSpec);
  36129. }
  36130. // SHA
  36131. if (commit) {
  36132. // refs/heads
  36133. if (upperRef.startsWith('REFS/HEADS/')) {
  36134. const branch = ref.substring('refs/heads/'.length);
  36135. result.push(`+${commit}:refs/remotes/origin/${branch}`);
  36136. }
  36137. // refs/pull/
  36138. else if (upperRef.startsWith('REFS/PULL/')) {
  36139. const branch = ref.substring('refs/pull/'.length);
  36140. result.push(`+${commit}:refs/remotes/pull/${branch}`);
  36141. }
  36142. // refs/tags/
  36143. else if (upperRef.startsWith('REFS/TAGS/')) {
  36144. if (!fetchTags) {
  36145. result.push(`+${ref}:${ref}`);
  36146. }
  36147. }
  36148. // Otherwise no destination ref
  36149. else {
  36150. result.push(commit);
  36151. }
  36152. }
  36153. // Unqualified ref, check for a matching branch or tag
  36154. else if (!upperRef.startsWith('REFS/')) {
  36155. result.push(`+refs/heads/${ref}*:refs/remotes/origin/${ref}*`);
  36156. if (!fetchTags) {
  36157. result.push(`+refs/tags/${ref}*:refs/tags/${ref}*`);
  36158. }
  36159. }
  36160. // refs/heads/
  36161. else if (upperRef.startsWith('REFS/HEADS/')) {
  36162. const branch = ref.substring('refs/heads/'.length);
  36163. result.push(`+${ref}:refs/remotes/origin/${branch}`);
  36164. }
  36165. // refs/pull/
  36166. else if (upperRef.startsWith('REFS/PULL/')) {
  36167. const branch = ref.substring('refs/pull/'.length);
  36168. result.push(`+${ref}:refs/remotes/pull/${branch}`);
  36169. }
  36170. // refs/tags/
  36171. else if (upperRef.startsWith('REFS/TAGS/')) {
  36172. if (!fetchTags) {
  36173. result.push(`+${ref}:${ref}`);
  36174. }
  36175. }
  36176. // Other refs
  36177. else {
  36178. result.push(`+${ref}:${ref}`);
  36179. }
  36180. return result;
  36181. }
  36182. /**
  36183. * Tests whether the initial fetch created the ref at the expected commit
  36184. */
  36185. async function testRef(git, ref, commit) {
  36186. if (!git) {
  36187. throw new Error('Arg git cannot be empty');
  36188. }
  36189. if (!ref && !commit) {
  36190. throw new Error('Args ref and commit cannot both be empty');
  36191. }
  36192. // No SHA? Nothing to test
  36193. if (!commit) {
  36194. return true;
  36195. }
  36196. // SHA only?
  36197. else if (!ref) {
  36198. return await git.shaExists(commit);
  36199. }
  36200. const upperRef = ref.toUpperCase();
  36201. // refs/heads/
  36202. if (upperRef.startsWith('REFS/HEADS/')) {
  36203. const branch = ref.substring('refs/heads/'.length);
  36204. return ((await git.branchExists(true, `origin/${branch}`)) &&
  36205. commit === (await git.revParse(`refs/remotes/origin/${branch}`)));
  36206. }
  36207. // refs/pull/
  36208. else if (upperRef.startsWith('REFS/PULL/')) {
  36209. // Assume matches because fetched using the commit
  36210. return true;
  36211. }
  36212. // refs/tags/
  36213. else if (upperRef.startsWith('REFS/TAGS/')) {
  36214. const tagName = ref.substring('refs/tags/'.length);
  36215. // Use ^{commit} to dereference annotated tags to their underlying commit
  36216. return ((await git.tagExists(tagName)) &&
  36217. commit === (await git.revParse(`${ref}^{commit}`)));
  36218. }
  36219. // Unexpected
  36220. else {
  36221. core_debug(`Unexpected ref format '${ref}' when testing ref info`);
  36222. return true;
  36223. }
  36224. }
  36225. async function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref, commit, baseUrl) {
  36226. try {
  36227. // GHES?
  36228. if (isGhes(baseUrl)) {
  36229. return;
  36230. }
  36231. // Auth token?
  36232. if (!token) {
  36233. return;
  36234. }
  36235. // Public PR synchronize, for workflow repo?
  36236. if (fromPayload('repository.private') !== false ||
  36237. github_context.eventName !== 'pull_request' ||
  36238. fromPayload('action') !== 'synchronize' ||
  36239. repositoryOwner !== github_context.repo.owner ||
  36240. repositoryName !== github_context.repo.repo ||
  36241. ref !== github_context.ref ||
  36242. !ref.startsWith('refs/pull/') ||
  36243. commit !== github_context.sha) {
  36244. return;
  36245. }
  36246. // Head SHA
  36247. const expectedHeadSha = fromPayload('after');
  36248. if (!expectedHeadSha) {
  36249. core_debug('Unable to determine head sha');
  36250. return;
  36251. }
  36252. // Base SHA
  36253. const expectedBaseSha = fromPayload('pull_request.base.sha');
  36254. if (!expectedBaseSha) {
  36255. core_debug('Unable to determine base sha');
  36256. return;
  36257. }
  36258. // Expected message?
  36259. const expectedMessage = `Merge ${expectedHeadSha} into ${expectedBaseSha}`;
  36260. if (commitInfo.indexOf(expectedMessage) >= 0) {
  36261. return;
  36262. }
  36263. // Extract details from message
  36264. const match = commitInfo.match(/Merge ([0-9a-f]{40}|[0-9a-f]{64}) into ([0-9a-f]{40}|[0-9a-f]{64})/);
  36265. if (!match) {
  36266. core_debug('Unexpected message format');
  36267. return;
  36268. }
  36269. // Post telemetry
  36270. const actualHeadSha = match[1];
  36271. if (actualHeadSha !== expectedHeadSha) {
  36272. core_debug(`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`);
  36273. const octokit = getOctokit(token, {
  36274. baseUrl: getServerApiUrl(baseUrl),
  36275. userAgent: `actions-checkout-tracepoint/1.0 (code=STALE_MERGE;owner=${repositoryOwner};repo=${repositoryName};pr=${fromPayload('number')};run_id=${process.env['GITHUB_RUN_ID']};expected_head_sha=${expectedHeadSha};actual_head_sha=${actualHeadSha})`
  36276. });
  36277. await octokit.rest.repos.get({
  36278. owner: repositoryOwner,
  36279. repo: repositoryName
  36280. });
  36281. }
  36282. }
  36283. catch (err) {
  36284. core_debug(`Error when validating commit info: ${err?.stack ?? err}`);
  36285. }
  36286. }
  36287. function fromPayload(path) {
  36288. return ref_helper_select(github_context.payload, path);
  36289. }
  36290. function ref_helper_select(obj, path) {
  36291. if (!obj) {
  36292. return undefined;
  36293. }
  36294. const i = path.indexOf('.');
  36295. if (i < 0) {
  36296. return obj[path];
  36297. }
  36298. const key = path.substr(0, i);
  36299. return ref_helper_select(obj[key], path.substr(i + 1));
  36300. }
  36301. ;// CONCATENATED MODULE: ./src/git-source-provider.ts
  36302. async function getSource(settings) {
  36303. // Repository URL
  36304. info(`Syncing repository: ${settings.repositoryOwner}/${settings.repositoryName}`);
  36305. const repositoryUrl = getFetchUrl(settings);
  36306. // Remove conflicting file path
  36307. if (fileExistsSync(settings.repositoryPath)) {
  36308. await rmRF(settings.repositoryPath);
  36309. }
  36310. // Create directory
  36311. let isExisting = true;
  36312. if (!directoryExistsSync(settings.repositoryPath)) {
  36313. isExisting = false;
  36314. await mkdirP(settings.repositoryPath);
  36315. }
  36316. // Git command manager
  36317. startGroup('Getting Git version info');
  36318. const git = await getGitCommandManager(settings);
  36319. endGroup();
  36320. let authHelper = null;
  36321. try {
  36322. if (git) {
  36323. authHelper = createAuthHelper(git, settings);
  36324. if (settings.setSafeDirectory) {
  36325. // Setup the repository path as a safe directory, so if we pass this into a container job with a different user it doesn't fail
  36326. // Otherwise all git commands we run in a container fail
  36327. await authHelper.configureTempGlobalConfig();
  36328. info(`Adding repository directory to the temporary git global config as a safe directory`);
  36329. await git
  36330. .config('safe.directory', settings.repositoryPath, true, true)
  36331. .catch(error => {
  36332. info(`Failed to initialize safe directory with error: ${error}`);
  36333. });
  36334. setSafeDirectory();
  36335. }
  36336. }
  36337. // Prepare existing directory, otherwise recreate
  36338. if (isExisting) {
  36339. await prepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean, settings.ref);
  36340. }
  36341. if (!git) {
  36342. // Downloading using REST API
  36343. info(`The repository will be downloaded using the GitHub REST API`);
  36344. info(`To create a local Git repository instead, add Git ${MinimumGitVersion} or higher to the PATH`);
  36345. if (settings.submodules) {
  36346. throw new Error(`Input 'submodules' not supported when falling back to download using the GitHub REST API. To create a local Git repository instead, add Git ${MinimumGitVersion} or higher to the PATH.`);
  36347. }
  36348. else if (settings.sshKey) {
  36349. throw new Error(`Input 'ssh-key' not supported when falling back to download using the GitHub REST API. To create a local Git repository instead, add Git ${MinimumGitVersion} or higher to the PATH.`);
  36350. }
  36351. await downloadRepository(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.repositoryPath, settings.githubServerUrl);
  36352. return;
  36353. }
  36354. // Save state for POST action
  36355. setRepositoryPath(settings.repositoryPath);
  36356. // Initialize the repository
  36357. if (!directoryExistsSync(external_path_namespaceObject.join(settings.repositoryPath, '.git'))) {
  36358. startGroup('Determining repository object format');
  36359. const objectFormatResult = await tryGetRepositoryObjectFormat(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.githubServerUrl, settings.commit);
  36360. const objectFormat = objectFormatResult.succeeded
  36361. ? objectFormatResult.format
  36362. : '';
  36363. if (objectFormat === 'sha256') {
  36364. info('Detected SHA-256 repository object format');
  36365. }
  36366. endGroup();
  36367. startGroup('Initializing the repository');
  36368. await git.init(objectFormat);
  36369. await git.remoteAdd('origin', repositoryUrl);
  36370. endGroup();
  36371. }
  36372. // Disable automatic garbage collection
  36373. startGroup('Disabling automatic garbage collection');
  36374. if (!(await git.tryDisableAutomaticGarbageCollection())) {
  36375. warning(`Unable to turn off git automatic garbage collection. The git fetch operation may trigger garbage collection and cause a delay.`);
  36376. }
  36377. endGroup();
  36378. // If we didn't initialize it above, do it now
  36379. if (!authHelper) {
  36380. authHelper = createAuthHelper(git, settings);
  36381. }
  36382. // Configure auth
  36383. startGroup('Setting up auth');
  36384. await authHelper.configureAuth();
  36385. endGroup();
  36386. // Determine the default branch
  36387. if (!settings.ref && !settings.commit) {
  36388. startGroup('Determining the default branch');
  36389. if (settings.sshKey) {
  36390. settings.ref = await git.getDefaultBranch(repositoryUrl);
  36391. }
  36392. else {
  36393. settings.ref = await getDefaultBranch(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.githubServerUrl);
  36394. }
  36395. endGroup();
  36396. }
  36397. // LFS install
  36398. if (settings.lfs) {
  36399. await git.lfsInstall();
  36400. }
  36401. // Fetch
  36402. startGroup('Fetching the repository');
  36403. const fetchOptions = {};
  36404. if (settings.filter) {
  36405. fetchOptions.filter = settings.filter;
  36406. }
  36407. else if (settings.sparseCheckout) {
  36408. fetchOptions.filter = 'blob:none';
  36409. }
  36410. if (settings.fetchDepth <= 0) {
  36411. // Fetch all branches and tags
  36412. let refSpec = getRefSpecForAllHistory(settings.ref, settings.commit);
  36413. await git.fetch(refSpec, fetchOptions);
  36414. // When all history is fetched, the ref we're interested in may have moved to a different
  36415. // commit (push or force push). If so, fetch again with a targeted refspec.
  36416. if (!(await testRef(git, settings.ref, settings.commit))) {
  36417. refSpec = getRefSpec(settings.ref, settings.commit);
  36418. await git.fetch(refSpec, fetchOptions);
  36419. // Verify the ref now matches. For branches, the targeted fetch above brings
  36420. // in the specific commit. For tags (fetched by ref), this will fail if
  36421. // the tag was moved after the workflow was triggered.
  36422. if (!(await testRef(git, settings.ref, settings.commit))) {
  36423. throw new Error(`The ref '${settings.ref}' does not point to the expected commit '${settings.commit}'. ` +
  36424. `The ref may have been updated after the workflow was triggered.`);
  36425. }
  36426. }
  36427. }
  36428. else {
  36429. fetchOptions.fetchDepth = settings.fetchDepth;
  36430. const refSpec = getRefSpec(settings.ref, settings.commit, settings.fetchTags);
  36431. await git.fetch(refSpec, fetchOptions);
  36432. // For tags, verify the ref still points to the expected commit.
  36433. // Tags are fetched by ref (not commit), so if a tag was moved after the
  36434. // workflow was triggered, we would silently check out the wrong commit.
  36435. if (!(await testRef(git, settings.ref, settings.commit))) {
  36436. throw new Error(`The ref '${settings.ref}' does not point to the expected commit '${settings.commit}'. ` +
  36437. `The ref may have been updated after the workflow was triggered.`);
  36438. }
  36439. }
  36440. endGroup();
  36441. // Checkout info
  36442. startGroup('Determining the checkout info');
  36443. const checkoutInfo = await getCheckoutInfo(git, settings.ref, settings.commit);
  36444. endGroup();
  36445. // LFS fetch
  36446. // Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time).
  36447. // Explicit lfs fetch will fetch lfs objects in parallel.
  36448. // For sparse checkouts, let `checkout` fetch the needed objects lazily.
  36449. if (settings.lfs && !settings.sparseCheckout) {
  36450. startGroup('Fetching LFS objects');
  36451. await git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref);
  36452. endGroup();
  36453. }
  36454. // Sparse checkout
  36455. if (!settings.sparseCheckout) {
  36456. let gitVersion = await git.version();
  36457. // no need to disable sparse-checkout if the installed git runtime doesn't even support it.
  36458. if (gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
  36459. await git.disableSparseCheckout();
  36460. }
  36461. }
  36462. else {
  36463. startGroup('Setting up sparse checkout');
  36464. if (settings.sparseCheckoutConeMode) {
  36465. await git.sparseCheckout(settings.sparseCheckout);
  36466. }
  36467. else {
  36468. await git.sparseCheckoutNonConeMode(settings.sparseCheckout);
  36469. }
  36470. endGroup();
  36471. }
  36472. // Checkout
  36473. startGroup('Checking out the ref');
  36474. await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint);
  36475. endGroup();
  36476. // Submodules
  36477. if (settings.submodules) {
  36478. // Temporarily override global config
  36479. startGroup('Setting up auth for fetching submodules');
  36480. await authHelper.configureGlobalAuth();
  36481. endGroup();
  36482. // Checkout submodules
  36483. startGroup('Fetching submodules');
  36484. await git.submoduleSync(settings.nestedSubmodules);
  36485. await git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules);
  36486. await git.submoduleForeach('git config --local gc.auto 0', settings.nestedSubmodules);
  36487. endGroup();
  36488. // Persist credentials
  36489. if (settings.persistCredentials) {
  36490. startGroup('Persisting credentials for submodules');
  36491. await authHelper.configureSubmoduleAuth();
  36492. endGroup();
  36493. }
  36494. }
  36495. // Get commit information
  36496. const commitInfo = await git.log1();
  36497. // Log commit sha
  36498. const commitSHA = await git.log1('--format=%H');
  36499. setOutput('commit', commitSHA.trim());
  36500. // Check for incorrect pull request merge commit
  36501. await checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.githubServerUrl);
  36502. }
  36503. finally {
  36504. // Remove auth
  36505. if (authHelper) {
  36506. if (!settings.persistCredentials) {
  36507. startGroup('Removing auth');
  36508. await authHelper.removeAuth();
  36509. endGroup();
  36510. }
  36511. authHelper.removeGlobalConfig();
  36512. }
  36513. }
  36514. }
  36515. async function cleanup(repositoryPath) {
  36516. // Repo exists?
  36517. if (!repositoryPath ||
  36518. !fileExistsSync(external_path_namespaceObject.join(repositoryPath, '.git', 'config'))) {
  36519. return;
  36520. }
  36521. let git;
  36522. try {
  36523. git = await createCommandManager(repositoryPath, false, false);
  36524. }
  36525. catch {
  36526. return;
  36527. }
  36528. // Remove auth
  36529. const authHelper = createAuthHelper(git);
  36530. try {
  36531. if (PostSetSafeDirectory) {
  36532. // Setup the repository path as a safe directory, so if we pass this into a container job with a different user it doesn't fail
  36533. // Otherwise all git commands we run in a container fail
  36534. await authHelper.configureTempGlobalConfig();
  36535. info(`Adding repository directory to the temporary git global config as a safe directory`);
  36536. await git
  36537. .config('safe.directory', repositoryPath, true, true)
  36538. .catch(error => {
  36539. info(`Failed to initialize safe directory with error: ${error}`);
  36540. });
  36541. }
  36542. await authHelper.removeAuth();
  36543. }
  36544. finally {
  36545. await authHelper.removeGlobalConfig();
  36546. }
  36547. }
  36548. async function getGitCommandManager(settings) {
  36549. info(`Working directory is '${settings.repositoryPath}'`);
  36550. try {
  36551. return await createCommandManager(settings.repositoryPath, settings.lfs, settings.sparseCheckout != null);
  36552. }
  36553. catch (err) {
  36554. // Git is required for LFS
  36555. if (settings.lfs) {
  36556. throw err;
  36557. }
  36558. // Otherwise fallback to REST API
  36559. return undefined;
  36560. }
  36561. }
  36562. ;// CONCATENATED MODULE: ./src/unsafe-pr-checkout-helper.ts
  36563. const PR_REF_PATTERN = /^refs\/pull\/[0-9]+\/(?:head|merge)$/;
  36564. function assertSafePrCheckout(input) {
  36565. if (input.allowUnsafePrCheckout) {
  36566. return;
  36567. }
  36568. const eventName = github_context.eventName;
  36569. if (eventName !== 'pull_request_target' && eventName !== 'workflow_run') {
  36570. return;
  36571. }
  36572. const baseRepoId = fromPayload('repository.id');
  36573. if (typeof baseRepoId !== 'number') {
  36574. return;
  36575. }
  36576. let prHeadRepoId;
  36577. let prHeadRepoFullName;
  36578. const prShas = [];
  36579. if (eventName === 'pull_request_target') {
  36580. prHeadRepoId = fromPayload('pull_request.head.repo.id');
  36581. prHeadRepoFullName = fromPayload('pull_request.head.repo.full_name');
  36582. pushIfSha(prShas, fromPayload('pull_request.head.sha'));
  36583. pushIfSha(prShas, fromPayload('pull_request.merge_commit_sha'));
  36584. }
  36585. else {
  36586. const wrEvent = fromPayload('workflow_run.event');
  36587. if (typeof wrEvent !== 'string' || !wrEvent.startsWith('pull_request')) {
  36588. return;
  36589. }
  36590. prHeadRepoId = fromPayload('workflow_run.head_repository.id');
  36591. prHeadRepoFullName = fromPayload('workflow_run.head_repository.full_name');
  36592. pushIfSha(prShas, fromPayload('workflow_run.head_commit.id'));
  36593. // For `pull_request_target`-triggered workflow_run, `head_sha` is the base
  36594. // default branch SHA (not the PR head)
  36595. if (wrEvent !== 'pull_request_target') {
  36596. pushIfSha(prShas, fromPayload('workflow_run.head_sha'));
  36597. }
  36598. }
  36599. // (A) Fork PR?
  36600. if (typeof prHeadRepoId !== 'number' || prHeadRepoId === baseRepoId) {
  36601. return;
  36602. }
  36603. // (B) We cannot check for all fork PR refs so check to see
  36604. // if the resolved input points to the fork PR sha we have in the payload
  36605. const repositoryMatchesPrHead = typeof prHeadRepoFullName === 'string' &&
  36606. input.qualifiedRepository.toLowerCase() === prHeadRepoFullName.toLowerCase();
  36607. const refMatchesPullPattern = PR_REF_PATTERN.test(input.ref);
  36608. const commitMatchesPrHeadSha = !!input.commit && prShas.includes(input.commit.toLowerCase());
  36609. if (!repositoryMatchesPrHead &&
  36610. !refMatchesPullPattern &&
  36611. !commitMatchesPrHeadSha) {
  36612. return;
  36613. }
  36614. throw new Error(`Refusing to check out fork pull request code from a '${eventName}' workflow. ` +
  36615. `This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch ` +
  36616. `cache scope, and runner access. Fetching and executing a fork's code in that trusted ` +
  36617. `context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks ` +
  36618. `at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' ` +
  36619. `on the actions/checkout step.`);
  36620. }
  36621. function pushIfSha(target, value) {
  36622. if (typeof value === 'string' && value.length > 0) {
  36623. target.push(value.toLowerCase());
  36624. }
  36625. }
  36626. ;// CONCATENATED MODULE: ./src/workflow-context-helper.ts
  36627. /**
  36628. * Gets the organization ID of the running workflow or undefined if the value cannot be loaded from the GITHUB_EVENT_PATH
  36629. */
  36630. async function getOrganizationId() {
  36631. try {
  36632. const eventPath = process.env.GITHUB_EVENT_PATH;
  36633. if (!eventPath) {
  36634. core_debug(`GITHUB_EVENT_PATH is not defined`);
  36635. return;
  36636. }
  36637. const content = await external_fs_namespaceObject.promises.readFile(eventPath, { encoding: 'utf8' });
  36638. const event = JSON.parse(content);
  36639. const id = event?.repository?.owner?.id;
  36640. if (typeof id !== 'number') {
  36641. core_debug('Repository owner ID not found within GITHUB event info');
  36642. return;
  36643. }
  36644. return id;
  36645. }
  36646. catch (err) {
  36647. core_debug(`Unable to load organization ID from GITHUB_EVENT_PATH: ${err.message || err}`);
  36648. }
  36649. }
  36650. ;// CONCATENATED MODULE: ./src/input-helper.ts
  36651. async function getInputs() {
  36652. const result = {};
  36653. // GitHub workspace
  36654. let githubWorkspacePath = process.env['GITHUB_WORKSPACE'];
  36655. if (!githubWorkspacePath) {
  36656. throw new Error('GITHUB_WORKSPACE not defined');
  36657. }
  36658. githubWorkspacePath = external_path_namespaceObject.resolve(githubWorkspacePath);
  36659. core_debug(`GITHUB_WORKSPACE = '${githubWorkspacePath}'`);
  36660. directoryExistsSync(githubWorkspacePath, true);
  36661. // Qualified repository
  36662. const qualifiedRepository = getInput('repository') ||
  36663. `${github_context.repo.owner}/${github_context.repo.repo}`;
  36664. core_debug(`qualified repository = '${qualifiedRepository}'`);
  36665. const splitRepository = qualifiedRepository.split('/');
  36666. if (splitRepository.length !== 2 ||
  36667. !splitRepository[0] ||
  36668. !splitRepository[1]) {
  36669. throw new Error(`Invalid repository '${qualifiedRepository}'. Expected format {owner}/{repo}.`);
  36670. }
  36671. result.repositoryOwner = splitRepository[0];
  36672. result.repositoryName = splitRepository[1];
  36673. // Repository path
  36674. result.repositoryPath = getInput('path') || '.';
  36675. result.repositoryPath = external_path_namespaceObject.resolve(githubWorkspacePath, result.repositoryPath);
  36676. if (!(result.repositoryPath + external_path_namespaceObject.sep).startsWith(githubWorkspacePath + external_path_namespaceObject.sep)) {
  36677. throw new Error(`Repository path '${result.repositoryPath}' is not under '${githubWorkspacePath}'`);
  36678. }
  36679. // Workflow repository?
  36680. const isWorkflowRepository = qualifiedRepository.toUpperCase() ===
  36681. `${github_context.repo.owner}/${github_context.repo.repo}`.toUpperCase();
  36682. // Source branch, source version
  36683. result.ref = getInput('ref');
  36684. // core.getInput()'s default trim strips a range of Unicode characters such as a
  36685. // leading BOM (U+FEFF) or NBSP (U+00A0). Those are valid in a git ref name, so
  36686. // a fork branch named "<BOM>" + 40 hex chars would trim down to a bare SHA and
  36687. // be silently reclassified as a commit, bypassing the unsafe fork PR checkout
  36688. // guard.
  36689. //
  36690. // The trim below strips only the ASCII whitespace characters which are all forbidden
  36691. // in a git branch name.
  36692. // \t U+0009 horizontal tab - ASCII control, forbidden in ref names
  36693. // \n U+000A line feed - ASCII control, forbidden in ref names
  36694. // \v U+000B vertical tab - ASCII control, forbidden in ref names
  36695. // \f U+000C form feed - ASCII control, forbidden in ref names
  36696. // \r U+000D carriage return - ASCII control, forbidden in ref names
  36697. // ' ' U+0020 space - forbidden in ref names
  36698. const asciiTrimmedRef = getInput('ref', { trimWhitespace: false })
  36699. .replace(/^[\t\n\v\f\r ]+|[\t\n\v\f\r ]+$/g, '');
  36700. if (!result.ref) {
  36701. if (isWorkflowRepository) {
  36702. result.ref = github_context.ref;
  36703. result.commit = github_context.sha;
  36704. // Some events have an unqualifed ref. For example when a PR is merged (pull_request closed event),
  36705. // the ref is unqualifed like "main" instead of "refs/heads/main".
  36706. if (result.commit && result.ref && !result.ref.startsWith('refs/')) {
  36707. result.ref = `refs/heads/${result.ref}`;
  36708. }
  36709. }
  36710. }
  36711. // SHA?
  36712. else if (asciiTrimmedRef.match(/^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/)) {
  36713. result.commit = asciiTrimmedRef;
  36714. result.ref = '';
  36715. }
  36716. core_debug(`ref = '${result.ref}'`);
  36717. core_debug(`commit = '${result.commit}'`);
  36718. // Clean
  36719. result.clean = (getInput('clean') || 'true').toUpperCase() === 'TRUE';
  36720. core_debug(`clean = ${result.clean}`);
  36721. // Filter
  36722. const filter = getInput('filter');
  36723. if (filter) {
  36724. result.filter = filter;
  36725. }
  36726. core_debug(`filter = ${result.filter}`);
  36727. // Sparse checkout
  36728. const sparseCheckout = getMultilineInput('sparse-checkout');
  36729. if (sparseCheckout.length) {
  36730. result.sparseCheckout = sparseCheckout;
  36731. core_debug(`sparse checkout = ${result.sparseCheckout}`);
  36732. }
  36733. result.sparseCheckoutConeMode =
  36734. (getInput('sparse-checkout-cone-mode') || 'true').toUpperCase() ===
  36735. 'TRUE';
  36736. // Fetch depth
  36737. result.fetchDepth = Math.floor(Number(getInput('fetch-depth') || '1'));
  36738. if (isNaN(result.fetchDepth) || result.fetchDepth < 0) {
  36739. result.fetchDepth = 0;
  36740. }
  36741. core_debug(`fetch depth = ${result.fetchDepth}`);
  36742. // Fetch tags
  36743. result.fetchTags =
  36744. (getInput('fetch-tags') || 'false').toUpperCase() === 'TRUE';
  36745. core_debug(`fetch tags = ${result.fetchTags}`);
  36746. // Show fetch progress
  36747. result.showProgress =
  36748. (getInput('show-progress') || 'true').toUpperCase() === 'TRUE';
  36749. core_debug(`show progress = ${result.showProgress}`);
  36750. // LFS
  36751. result.lfs = (getInput('lfs') || 'false').toUpperCase() === 'TRUE';
  36752. core_debug(`lfs = ${result.lfs}`);
  36753. // Submodules
  36754. result.submodules = false;
  36755. result.nestedSubmodules = false;
  36756. const submodulesString = (getInput('submodules') || '').toUpperCase();
  36757. if (submodulesString == 'RECURSIVE') {
  36758. result.submodules = true;
  36759. result.nestedSubmodules = true;
  36760. }
  36761. else if (submodulesString == 'TRUE') {
  36762. result.submodules = true;
  36763. }
  36764. core_debug(`submodules = ${result.submodules}`);
  36765. core_debug(`recursive submodules = ${result.nestedSubmodules}`);
  36766. // Auth token
  36767. result.authToken = getInput('token', { required: true });
  36768. // SSH
  36769. result.sshKey = getInput('ssh-key');
  36770. result.sshKnownHosts = getInput('ssh-known-hosts');
  36771. result.sshStrict =
  36772. (getInput('ssh-strict') || 'true').toUpperCase() === 'TRUE';
  36773. result.sshUser = getInput('ssh-user');
  36774. // Persist credentials
  36775. result.persistCredentials =
  36776. (getInput('persist-credentials') || 'false').toUpperCase() === 'TRUE';
  36777. // Workflow organization ID
  36778. result.workflowOrganizationId =
  36779. await getOrganizationId();
  36780. // Set safe.directory in git global config.
  36781. result.setSafeDirectory =
  36782. (getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE';
  36783. // Determine the GitHub URL that the repository is being hosted from
  36784. result.githubServerUrl = getInput('github-server-url');
  36785. core_debug(`GitHub Host URL = ${result.githubServerUrl}`);
  36786. // Allow unsafe PR checkout (opt-in for pull_request_target / workflow_run fork PRs)
  36787. result.allowUnsafePrCheckout =
  36788. (getInput('allow-unsafe-pr-checkout') || 'false').toUpperCase() ===
  36789. 'TRUE';
  36790. core_debug(`allow unsafe PR checkout = ${result.allowUnsafePrCheckout}`);
  36791. // The default self-checkout (this repository with no explicit ref) always
  36792. // resolves to the trusted ref/commit GitHub set for the triggering event, so
  36793. // the fork-checkout guard only needs to run when the caller customized the
  36794. // repository or ref.
  36795. const isDefaultCheckout = isWorkflowRepository && !getInput('ref');
  36796. if (!isDefaultCheckout) {
  36797. assertSafePrCheckout({
  36798. qualifiedRepository,
  36799. ref: result.ref,
  36800. commit: result.commit,
  36801. allowUnsafePrCheckout: result.allowUnsafePrCheckout
  36802. });
  36803. }
  36804. return result;
  36805. }
  36806. ;// CONCATENATED MODULE: ./src/main.ts
  36807. const main_dirname = external_path_namespaceObject.dirname((0,external_url_namespaceObject.fileURLToPath)(import.meta.url));
  36808. async function run() {
  36809. try {
  36810. const sourceSettings = await getInputs();
  36811. try {
  36812. // Register problem matcher
  36813. info(`::add-matcher::${external_path_namespaceObject.join(main_dirname, 'problem-matcher.json')}`);
  36814. // Get sources
  36815. await getSource(sourceSettings);
  36816. setOutput('ref', sourceSettings.ref);
  36817. }
  36818. finally {
  36819. // Unregister problem matcher
  36820. info('::remove-matcher owner=checkout-git::');
  36821. }
  36822. }
  36823. catch (error) {
  36824. setFailed(`${error?.message ?? error}`);
  36825. }
  36826. }
  36827. async function main_cleanup() {
  36828. try {
  36829. await cleanup(RepositoryPath);
  36830. }
  36831. catch (error) {
  36832. warning(`${error?.message ?? error}`);
  36833. }
  36834. }
  36835. // Main
  36836. if (!IsPost) {
  36837. run();
  36838. }
  36839. // Post
  36840. else {
  36841. main_cleanup();
  36842. }