2
0

index.js 1.4 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246
  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. onUpgrade (statusCode, headers, socket) {
  5703. assert(!this.aborted)
  5704. assert(!this.completed)
  5705. return this[kHandler].onUpgrade(statusCode, headers, socket)
  5706. }
  5707. onComplete (trailers) {
  5708. this.onFinally()
  5709. assert(!this.aborted)
  5710. this.completed = true
  5711. if (channels.trailers.hasSubscribers) {
  5712. channels.trailers.publish({ request: this, trailers })
  5713. }
  5714. try {
  5715. return this[kHandler].onComplete(trailers)
  5716. } catch (err) {
  5717. // TODO (fix): This might be a bad idea?
  5718. this.onError(err)
  5719. }
  5720. }
  5721. onError (error) {
  5722. this.onFinally()
  5723. if (channels.error.hasSubscribers) {
  5724. channels.error.publish({ request: this, error })
  5725. }
  5726. if (this.aborted) {
  5727. return
  5728. }
  5729. this.aborted = true
  5730. return this[kHandler].onError(error)
  5731. }
  5732. onFinally () {
  5733. if (this.errorHandler) {
  5734. this.body.off('error', this.errorHandler)
  5735. this.errorHandler = null
  5736. }
  5737. if (this.endHandler) {
  5738. this.body.off('end', this.endHandler)
  5739. this.endHandler = null
  5740. }
  5741. }
  5742. addHeader (key, value) {
  5743. processHeader(this, key, value)
  5744. return this
  5745. }
  5746. }
  5747. function processHeader (request, key, val) {
  5748. if (val && (typeof val === 'object' && !Array.isArray(val))) {
  5749. throw new InvalidArgumentError(`invalid ${key} header`)
  5750. } else if (val === undefined) {
  5751. return
  5752. }
  5753. let headerName = headerNameLowerCasedRecord[key]
  5754. if (headerName === undefined) {
  5755. headerName = key.toLowerCase()
  5756. if (headerNameLowerCasedRecord[headerName] === undefined && !isValidHTTPToken(headerName)) {
  5757. throw new InvalidArgumentError('invalid header key')
  5758. }
  5759. }
  5760. if (Array.isArray(val)) {
  5761. const arr = []
  5762. for (let i = 0; i < val.length; i++) {
  5763. if (typeof val[i] === 'string') {
  5764. if (!isValidHeaderValue(val[i])) {
  5765. throw new InvalidArgumentError(`invalid ${key} header`)
  5766. }
  5767. arr.push(val[i])
  5768. } else if (val[i] === null) {
  5769. arr.push('')
  5770. } else if (typeof val[i] === 'object') {
  5771. throw new InvalidArgumentError(`invalid ${key} header`)
  5772. } else {
  5773. arr.push(`${val[i]}`)
  5774. }
  5775. }
  5776. val = arr
  5777. } else if (typeof val === 'string') {
  5778. if (!isValidHeaderValue(val)) {
  5779. throw new InvalidArgumentError(`invalid ${key} header`)
  5780. }
  5781. } else if (val === null) {
  5782. val = ''
  5783. } else {
  5784. val = `${val}`
  5785. }
  5786. if (headerName === 'host') {
  5787. if (request.host !== null) {
  5788. throw new InvalidArgumentError('duplicate host header')
  5789. }
  5790. if (typeof val !== 'string') {
  5791. throw new InvalidArgumentError('invalid host header')
  5792. }
  5793. // Consumed by Client
  5794. request.host = val
  5795. } else if (headerName === 'content-length') {
  5796. if (request.contentLength !== null) {
  5797. throw new InvalidArgumentError('duplicate content-length header')
  5798. }
  5799. request.contentLength = parseInt(val, 10)
  5800. if (!Number.isFinite(request.contentLength)) {
  5801. throw new InvalidArgumentError('invalid content-length header')
  5802. }
  5803. } else if (request.contentType === null && headerName === 'content-type') {
  5804. request.contentType = val
  5805. request.headers.push(key, val)
  5806. } else if (headerName === 'transfer-encoding' || headerName === 'keep-alive' || headerName === 'upgrade') {
  5807. throw new InvalidArgumentError(`invalid ${headerName} header`)
  5808. } else if (headerName === 'connection') {
  5809. const value = typeof val === 'string' ? val.toLowerCase() : null
  5810. if (value !== 'close' && value !== 'keep-alive') {
  5811. throw new InvalidArgumentError('invalid connection header')
  5812. }
  5813. if (value === 'close') {
  5814. request.reset = true
  5815. }
  5816. } else if (headerName === 'expect') {
  5817. throw new NotSupportedError('expect header not supported')
  5818. } else {
  5819. request.headers.push(key, val)
  5820. }
  5821. }
  5822. module.exports = Request
  5823. /***/ }),
  5824. /***/ 6443:
  5825. /***/ ((module) => {
  5826. module.exports = {
  5827. kClose: Symbol('close'),
  5828. kDestroy: Symbol('destroy'),
  5829. kDispatch: Symbol('dispatch'),
  5830. kUrl: Symbol('url'),
  5831. kWriting: Symbol('writing'),
  5832. kResuming: Symbol('resuming'),
  5833. kQueue: Symbol('queue'),
  5834. kConnect: Symbol('connect'),
  5835. kConnecting: Symbol('connecting'),
  5836. kKeepAliveDefaultTimeout: Symbol('default keep alive timeout'),
  5837. kKeepAliveMaxTimeout: Symbol('max keep alive timeout'),
  5838. kKeepAliveTimeoutThreshold: Symbol('keep alive timeout threshold'),
  5839. kKeepAliveTimeoutValue: Symbol('keep alive timeout'),
  5840. kKeepAlive: Symbol('keep alive'),
  5841. kHeadersTimeout: Symbol('headers timeout'),
  5842. kBodyTimeout: Symbol('body timeout'),
  5843. kServerName: Symbol('server name'),
  5844. kLocalAddress: Symbol('local address'),
  5845. kHost: Symbol('host'),
  5846. kNoRef: Symbol('no ref'),
  5847. kBodyUsed: Symbol('used'),
  5848. kBody: Symbol('abstracted request body'),
  5849. kRunning: Symbol('running'),
  5850. kBlocking: Symbol('blocking'),
  5851. kPending: Symbol('pending'),
  5852. kSize: Symbol('size'),
  5853. kBusy: Symbol('busy'),
  5854. kQueued: Symbol('queued'),
  5855. kFree: Symbol('free'),
  5856. kConnected: Symbol('connected'),
  5857. kClosed: Symbol('closed'),
  5858. kNeedDrain: Symbol('need drain'),
  5859. kReset: Symbol('reset'),
  5860. kDestroyed: Symbol.for('nodejs.stream.destroyed'),
  5861. kResume: Symbol('resume'),
  5862. kOnError: Symbol('on error'),
  5863. kMaxHeadersSize: Symbol('max headers size'),
  5864. kRunningIdx: Symbol('running index'),
  5865. kPendingIdx: Symbol('pending index'),
  5866. kError: Symbol('error'),
  5867. kClients: Symbol('clients'),
  5868. kClient: Symbol('client'),
  5869. kParser: Symbol('parser'),
  5870. kOnDestroyed: Symbol('destroy callbacks'),
  5871. kPipelining: Symbol('pipelining'),
  5872. kSocket: Symbol('socket'),
  5873. kHostHeader: Symbol('host header'),
  5874. kConnector: Symbol('connector'),
  5875. kStrictContentLength: Symbol('strict content length'),
  5876. kMaxRedirections: Symbol('maxRedirections'),
  5877. kMaxRequests: Symbol('maxRequestsPerClient'),
  5878. kProxy: Symbol('proxy agent options'),
  5879. kCounter: Symbol('socket request counter'),
  5880. kInterceptors: Symbol('dispatch interceptors'),
  5881. kMaxResponseSize: Symbol('max response size'),
  5882. kHTTP2Session: Symbol('http2Session'),
  5883. kHTTP2SessionState: Symbol('http2Session state'),
  5884. kRetryHandlerDefaultRetry: Symbol('retry agent default retry'),
  5885. kConstruct: Symbol('constructable'),
  5886. kListeners: Symbol('listeners'),
  5887. kHTTPContext: Symbol('http context'),
  5888. kMaxConcurrentStreams: Symbol('max concurrent streams'),
  5889. kNoProxyAgent: Symbol('no proxy agent'),
  5890. kHttpProxyAgent: Symbol('http proxy agent'),
  5891. kHttpsProxyAgent: Symbol('https proxy agent')
  5892. }
  5893. /***/ }),
  5894. /***/ 7752:
  5895. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  5896. const {
  5897. wellknownHeaderNames,
  5898. headerNameLowerCasedRecord
  5899. } = __nccwpck_require__(735)
  5900. class TstNode {
  5901. /** @type {any} */
  5902. value = null
  5903. /** @type {null | TstNode} */
  5904. left = null
  5905. /** @type {null | TstNode} */
  5906. middle = null
  5907. /** @type {null | TstNode} */
  5908. right = null
  5909. /** @type {number} */
  5910. code
  5911. /**
  5912. * @param {string} key
  5913. * @param {any} value
  5914. * @param {number} index
  5915. */
  5916. constructor (key, value, index) {
  5917. if (index === undefined || index >= key.length) {
  5918. throw new TypeError('Unreachable')
  5919. }
  5920. const code = this.code = key.charCodeAt(index)
  5921. // check code is ascii string
  5922. if (code > 0x7F) {
  5923. throw new TypeError('key must be ascii string')
  5924. }
  5925. if (key.length !== ++index) {
  5926. this.middle = new TstNode(key, value, index)
  5927. } else {
  5928. this.value = value
  5929. }
  5930. }
  5931. /**
  5932. * @param {string} key
  5933. * @param {any} value
  5934. */
  5935. add (key, value) {
  5936. const length = key.length
  5937. if (length === 0) {
  5938. throw new TypeError('Unreachable')
  5939. }
  5940. let index = 0
  5941. let node = this
  5942. while (true) {
  5943. const code = key.charCodeAt(index)
  5944. // check code is ascii string
  5945. if (code > 0x7F) {
  5946. throw new TypeError('key must be ascii string')
  5947. }
  5948. if (node.code === code) {
  5949. if (length === ++index) {
  5950. node.value = value
  5951. break
  5952. } else if (node.middle !== null) {
  5953. node = node.middle
  5954. } else {
  5955. node.middle = new TstNode(key, value, index)
  5956. break
  5957. }
  5958. } else if (node.code < code) {
  5959. if (node.left !== null) {
  5960. node = node.left
  5961. } else {
  5962. node.left = new TstNode(key, value, index)
  5963. break
  5964. }
  5965. } else if (node.right !== null) {
  5966. node = node.right
  5967. } else {
  5968. node.right = new TstNode(key, value, index)
  5969. break
  5970. }
  5971. }
  5972. }
  5973. /**
  5974. * @param {Uint8Array} key
  5975. * @return {TstNode | null}
  5976. */
  5977. search (key) {
  5978. const keylength = key.length
  5979. let index = 0
  5980. let node = this
  5981. while (node !== null && index < keylength) {
  5982. let code = key[index]
  5983. // A-Z
  5984. // First check if it is bigger than 0x5a.
  5985. // Lowercase letters have higher char codes than uppercase ones.
  5986. // Also we assume that headers will mostly contain lowercase characters.
  5987. if (code <= 0x5a && code >= 0x41) {
  5988. // Lowercase for uppercase.
  5989. code |= 32
  5990. }
  5991. while (node !== null) {
  5992. if (code === node.code) {
  5993. if (keylength === ++index) {
  5994. // Returns Node since it is the last key.
  5995. return node
  5996. }
  5997. node = node.middle
  5998. break
  5999. }
  6000. node = node.code < code ? node.left : node.right
  6001. }
  6002. }
  6003. return null
  6004. }
  6005. }
  6006. class TernarySearchTree {
  6007. /** @type {TstNode | null} */
  6008. node = null
  6009. /**
  6010. * @param {string} key
  6011. * @param {any} value
  6012. * */
  6013. insert (key, value) {
  6014. if (this.node === null) {
  6015. this.node = new TstNode(key, value, 0)
  6016. } else {
  6017. this.node.add(key, value)
  6018. }
  6019. }
  6020. /**
  6021. * @param {Uint8Array} key
  6022. * @return {any}
  6023. */
  6024. lookup (key) {
  6025. return this.node?.search(key)?.value ?? null
  6026. }
  6027. }
  6028. const tree = new TernarySearchTree()
  6029. for (let i = 0; i < wellknownHeaderNames.length; ++i) {
  6030. const key = headerNameLowerCasedRecord[wellknownHeaderNames[i]]
  6031. tree.insert(key, key)
  6032. }
  6033. module.exports = {
  6034. TernarySearchTree,
  6035. tree
  6036. }
  6037. /***/ }),
  6038. /***/ 3440:
  6039. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  6040. const assert = __nccwpck_require__(4589)
  6041. const { kDestroyed, kBodyUsed, kListeners, kBody } = __nccwpck_require__(6443)
  6042. const { IncomingMessage } = __nccwpck_require__(7067)
  6043. const stream = __nccwpck_require__(7075)
  6044. const net = __nccwpck_require__(7030)
  6045. const { Blob } = __nccwpck_require__(4573)
  6046. const nodeUtil = __nccwpck_require__(7975)
  6047. const { stringify } = __nccwpck_require__(1792)
  6048. const { EventEmitter: EE } = __nccwpck_require__(8474)
  6049. const { InvalidArgumentError } = __nccwpck_require__(8707)
  6050. const { headerNameLowerCasedRecord } = __nccwpck_require__(735)
  6051. const { tree } = __nccwpck_require__(7752)
  6052. const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
  6053. class BodyAsyncIterable {
  6054. constructor (body) {
  6055. this[kBody] = body
  6056. this[kBodyUsed] = false
  6057. }
  6058. async * [Symbol.asyncIterator] () {
  6059. assert(!this[kBodyUsed], 'disturbed')
  6060. this[kBodyUsed] = true
  6061. yield * this[kBody]
  6062. }
  6063. }
  6064. function wrapRequestBody (body) {
  6065. if (isStream(body)) {
  6066. // TODO (fix): Provide some way for the user to cache the file to e.g. /tmp
  6067. // so that it can be dispatched again?
  6068. // TODO (fix): Do we need 100-expect support to provide a way to do this properly?
  6069. if (bodyLength(body) === 0) {
  6070. body
  6071. .on('data', function () {
  6072. assert(false)
  6073. })
  6074. }
  6075. if (typeof body.readableDidRead !== 'boolean') {
  6076. body[kBodyUsed] = false
  6077. EE.prototype.on.call(body, 'data', function () {
  6078. this[kBodyUsed] = true
  6079. })
  6080. }
  6081. return body
  6082. } else if (body && typeof body.pipeTo === 'function') {
  6083. // TODO (fix): We can't access ReadableStream internal state
  6084. // to determine whether or not it has been disturbed. This is just
  6085. // a workaround.
  6086. return new BodyAsyncIterable(body)
  6087. } else if (
  6088. body &&
  6089. typeof body !== 'string' &&
  6090. !ArrayBuffer.isView(body) &&
  6091. isIterable(body)
  6092. ) {
  6093. // TODO: Should we allow re-using iterable if !this.opts.idempotent
  6094. // or through some other flag?
  6095. return new BodyAsyncIterable(body)
  6096. } else {
  6097. return body
  6098. }
  6099. }
  6100. function nop () {}
  6101. function isStream (obj) {
  6102. return obj && typeof obj === 'object' && typeof obj.pipe === 'function' && typeof obj.on === 'function'
  6103. }
  6104. // based on https://github.com/node-fetch/fetch-blob/blob/8ab587d34080de94140b54f07168451e7d0b655e/index.js#L229-L241 (MIT License)
  6105. function isBlobLike (object) {
  6106. if (object === null) {
  6107. return false
  6108. } else if (object instanceof Blob) {
  6109. return true
  6110. } else if (typeof object !== 'object') {
  6111. return false
  6112. } else {
  6113. const sTag = object[Symbol.toStringTag]
  6114. return (sTag === 'Blob' || sTag === 'File') && (
  6115. ('stream' in object && typeof object.stream === 'function') ||
  6116. ('arrayBuffer' in object && typeof object.arrayBuffer === 'function')
  6117. )
  6118. }
  6119. }
  6120. function buildURL (url, queryParams) {
  6121. if (url.includes('?') || url.includes('#')) {
  6122. throw new Error('Query params cannot be passed when url already contains "?" or "#".')
  6123. }
  6124. const stringified = stringify(queryParams)
  6125. if (stringified) {
  6126. url += '?' + stringified
  6127. }
  6128. return url
  6129. }
  6130. function isValidPort (port) {
  6131. const value = parseInt(port, 10)
  6132. return (
  6133. value === Number(port) &&
  6134. value >= 0 &&
  6135. value <= 65535
  6136. )
  6137. }
  6138. function isHttpOrHttpsPrefixed (value) {
  6139. return (
  6140. value != null &&
  6141. value[0] === 'h' &&
  6142. value[1] === 't' &&
  6143. value[2] === 't' &&
  6144. value[3] === 'p' &&
  6145. (
  6146. value[4] === ':' ||
  6147. (
  6148. value[4] === 's' &&
  6149. value[5] === ':'
  6150. )
  6151. )
  6152. )
  6153. }
  6154. function parseURL (url) {
  6155. if (typeof url === 'string') {
  6156. url = new URL(url)
  6157. if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
  6158. throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
  6159. }
  6160. return url
  6161. }
  6162. if (!url || typeof url !== 'object') {
  6163. throw new InvalidArgumentError('Invalid URL: The URL argument must be a non-null object.')
  6164. }
  6165. if (!(url instanceof URL)) {
  6166. if (url.port != null && url.port !== '' && isValidPort(url.port) === false) {
  6167. throw new InvalidArgumentError('Invalid URL: port must be a valid integer or a string representation of an integer.')
  6168. }
  6169. if (url.path != null && typeof url.path !== 'string') {
  6170. throw new InvalidArgumentError('Invalid URL path: the path must be a string or null/undefined.')
  6171. }
  6172. if (url.pathname != null && typeof url.pathname !== 'string') {
  6173. throw new InvalidArgumentError('Invalid URL pathname: the pathname must be a string or null/undefined.')
  6174. }
  6175. if (url.hostname != null && typeof url.hostname !== 'string') {
  6176. throw new InvalidArgumentError('Invalid URL hostname: the hostname must be a string or null/undefined.')
  6177. }
  6178. if (url.origin != null && typeof url.origin !== 'string') {
  6179. throw new InvalidArgumentError('Invalid URL origin: the origin must be a string or null/undefined.')
  6180. }
  6181. if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
  6182. throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
  6183. }
  6184. const port = url.port != null
  6185. ? url.port
  6186. : (url.protocol === 'https:' ? 443 : 80)
  6187. let origin = url.origin != null
  6188. ? url.origin
  6189. : `${url.protocol || ''}//${url.hostname || ''}:${port}`
  6190. let path = url.path != null
  6191. ? url.path
  6192. : `${url.pathname || ''}${url.search || ''}`
  6193. if (origin[origin.length - 1] === '/') {
  6194. origin = origin.slice(0, origin.length - 1)
  6195. }
  6196. if (path && path[0] !== '/') {
  6197. path = `/${path}`
  6198. }
  6199. // new URL(path, origin) is unsafe when `path` contains an absolute URL
  6200. // From https://developer.mozilla.org/en-US/docs/Web/API/URL/URL:
  6201. // If first parameter is a relative URL, second param is required, and will be used as the base URL.
  6202. // If first parameter is an absolute URL, a given second param will be ignored.
  6203. return new URL(`${origin}${path}`)
  6204. }
  6205. if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
  6206. throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
  6207. }
  6208. return url
  6209. }
  6210. function parseOrigin (url) {
  6211. url = parseURL(url)
  6212. if (url.pathname !== '/' || url.search || url.hash) {
  6213. throw new InvalidArgumentError('invalid url')
  6214. }
  6215. return url
  6216. }
  6217. function getHostname (host) {
  6218. if (host[0] === '[') {
  6219. const idx = host.indexOf(']')
  6220. assert(idx !== -1)
  6221. return host.substring(1, idx)
  6222. }
  6223. const idx = host.indexOf(':')
  6224. if (idx === -1) return host
  6225. return host.substring(0, idx)
  6226. }
  6227. // IP addresses are not valid server names per RFC6066
  6228. // > Currently, the only server names supported are DNS hostnames
  6229. function getServerName (host) {
  6230. if (!host) {
  6231. return null
  6232. }
  6233. assert(typeof host === 'string')
  6234. const servername = getHostname(host)
  6235. if (net.isIP(servername)) {
  6236. return ''
  6237. }
  6238. return servername
  6239. }
  6240. function deepClone (obj) {
  6241. return JSON.parse(JSON.stringify(obj))
  6242. }
  6243. function isAsyncIterable (obj) {
  6244. return !!(obj != null && typeof obj[Symbol.asyncIterator] === 'function')
  6245. }
  6246. function isIterable (obj) {
  6247. return !!(obj != null && (typeof obj[Symbol.iterator] === 'function' || typeof obj[Symbol.asyncIterator] === 'function'))
  6248. }
  6249. function bodyLength (body) {
  6250. if (body == null) {
  6251. return 0
  6252. } else if (isStream(body)) {
  6253. const state = body._readableState
  6254. return state && state.objectMode === false && state.ended === true && Number.isFinite(state.length)
  6255. ? state.length
  6256. : null
  6257. } else if (isBlobLike(body)) {
  6258. return body.size != null ? body.size : null
  6259. } else if (isBuffer(body)) {
  6260. return body.byteLength
  6261. }
  6262. return null
  6263. }
  6264. function isDestroyed (body) {
  6265. return body && !!(body.destroyed || body[kDestroyed] || (stream.isDestroyed?.(body)))
  6266. }
  6267. function destroy (stream, err) {
  6268. if (stream == null || !isStream(stream) || isDestroyed(stream)) {
  6269. return
  6270. }
  6271. if (typeof stream.destroy === 'function') {
  6272. if (Object.getPrototypeOf(stream).constructor === IncomingMessage) {
  6273. // See: https://github.com/nodejs/node/pull/38505/files
  6274. stream.socket = null
  6275. }
  6276. stream.destroy(err)
  6277. } else if (err) {
  6278. queueMicrotask(() => {
  6279. stream.emit('error', err)
  6280. })
  6281. }
  6282. if (stream.destroyed !== true) {
  6283. stream[kDestroyed] = true
  6284. }
  6285. }
  6286. const KEEPALIVE_TIMEOUT_EXPR = /timeout=(\d+)/
  6287. function parseKeepAliveTimeout (val) {
  6288. const m = val.toString().match(KEEPALIVE_TIMEOUT_EXPR)
  6289. return m ? parseInt(m[1], 10) * 1000 : null
  6290. }
  6291. /**
  6292. * Retrieves a header name and returns its lowercase value.
  6293. * @param {string | Buffer} value Header name
  6294. * @returns {string}
  6295. */
  6296. function headerNameToString (value) {
  6297. return typeof value === 'string'
  6298. ? headerNameLowerCasedRecord[value] ?? value.toLowerCase()
  6299. : tree.lookup(value) ?? value.toString('latin1').toLowerCase()
  6300. }
  6301. /**
  6302. * Receive the buffer as a string and return its lowercase value.
  6303. * @param {Buffer} value Header name
  6304. * @returns {string}
  6305. */
  6306. function bufferToLowerCasedHeaderName (value) {
  6307. return tree.lookup(value) ?? value.toString('latin1').toLowerCase()
  6308. }
  6309. /**
  6310. * @param {Record<string, string | string[]> | (Buffer | string | (Buffer | string)[])[]} headers
  6311. * @param {Record<string, string | string[]>} [obj]
  6312. * @returns {Record<string, string | string[]>}
  6313. */
  6314. function parseHeaders (headers, obj) {
  6315. if (obj === undefined) obj = {}
  6316. for (let i = 0; i < headers.length; i += 2) {
  6317. const key = headerNameToString(headers[i])
  6318. let val = obj[key]
  6319. if (val) {
  6320. if (typeof val === 'string') {
  6321. val = [val]
  6322. obj[key] = val
  6323. }
  6324. val.push(headers[i + 1].toString('utf8'))
  6325. } else {
  6326. const headersValue = headers[i + 1]
  6327. if (typeof headersValue === 'string') {
  6328. obj[key] = headersValue
  6329. } else {
  6330. obj[key] = Array.isArray(headersValue) ? headersValue.map(x => x.toString('utf8')) : headersValue.toString('utf8')
  6331. }
  6332. }
  6333. }
  6334. // See https://github.com/nodejs/node/pull/46528
  6335. if ('content-length' in obj && 'content-disposition' in obj) {
  6336. obj['content-disposition'] = Buffer.from(obj['content-disposition']).toString('latin1')
  6337. }
  6338. return obj
  6339. }
  6340. function parseRawHeaders (headers) {
  6341. const len = headers.length
  6342. const ret = new Array(len)
  6343. let hasContentLength = false
  6344. let contentDispositionIdx = -1
  6345. let key
  6346. let val
  6347. let kLen = 0
  6348. for (let n = 0; n < headers.length; n += 2) {
  6349. key = headers[n]
  6350. val = headers[n + 1]
  6351. typeof key !== 'string' && (key = key.toString())
  6352. typeof val !== 'string' && (val = val.toString('utf8'))
  6353. kLen = key.length
  6354. if (kLen === 14 && key[7] === '-' && (key === 'content-length' || key.toLowerCase() === 'content-length')) {
  6355. hasContentLength = true
  6356. } else if (kLen === 19 && key[7] === '-' && (key === 'content-disposition' || key.toLowerCase() === 'content-disposition')) {
  6357. contentDispositionIdx = n + 1
  6358. }
  6359. ret[n] = key
  6360. ret[n + 1] = val
  6361. }
  6362. // See https://github.com/nodejs/node/pull/46528
  6363. if (hasContentLength && contentDispositionIdx !== -1) {
  6364. ret[contentDispositionIdx] = Buffer.from(ret[contentDispositionIdx]).toString('latin1')
  6365. }
  6366. return ret
  6367. }
  6368. function isBuffer (buffer) {
  6369. // See, https://github.com/mcollina/undici/pull/319
  6370. return buffer instanceof Uint8Array || Buffer.isBuffer(buffer)
  6371. }
  6372. function validateHandler (handler, method, upgrade) {
  6373. if (!handler || typeof handler !== 'object') {
  6374. throw new InvalidArgumentError('handler must be an object')
  6375. }
  6376. if (typeof handler.onConnect !== 'function') {
  6377. throw new InvalidArgumentError('invalid onConnect method')
  6378. }
  6379. if (typeof handler.onError !== 'function') {
  6380. throw new InvalidArgumentError('invalid onError method')
  6381. }
  6382. if (typeof handler.onBodySent !== 'function' && handler.onBodySent !== undefined) {
  6383. throw new InvalidArgumentError('invalid onBodySent method')
  6384. }
  6385. if (upgrade || method === 'CONNECT') {
  6386. if (typeof handler.onUpgrade !== 'function') {
  6387. throw new InvalidArgumentError('invalid onUpgrade method')
  6388. }
  6389. } else {
  6390. if (typeof handler.onHeaders !== 'function') {
  6391. throw new InvalidArgumentError('invalid onHeaders method')
  6392. }
  6393. if (typeof handler.onData !== 'function') {
  6394. throw new InvalidArgumentError('invalid onData method')
  6395. }
  6396. if (typeof handler.onComplete !== 'function') {
  6397. throw new InvalidArgumentError('invalid onComplete method')
  6398. }
  6399. }
  6400. }
  6401. // A body is disturbed if it has been read from and it cannot
  6402. // be re-used without losing state or data.
  6403. function isDisturbed (body) {
  6404. // TODO (fix): Why is body[kBodyUsed] needed?
  6405. return !!(body && (stream.isDisturbed(body) || body[kBodyUsed]))
  6406. }
  6407. function isErrored (body) {
  6408. return !!(body && stream.isErrored(body))
  6409. }
  6410. function isReadable (body) {
  6411. return !!(body && stream.isReadable(body))
  6412. }
  6413. function getSocketInfo (socket) {
  6414. return {
  6415. localAddress: socket.localAddress,
  6416. localPort: socket.localPort,
  6417. remoteAddress: socket.remoteAddress,
  6418. remotePort: socket.remotePort,
  6419. remoteFamily: socket.remoteFamily,
  6420. timeout: socket.timeout,
  6421. bytesWritten: socket.bytesWritten,
  6422. bytesRead: socket.bytesRead
  6423. }
  6424. }
  6425. /** @type {globalThis['ReadableStream']} */
  6426. function ReadableStreamFrom (iterable) {
  6427. // We cannot use ReadableStream.from here because it does not return a byte stream.
  6428. let iterator
  6429. return new ReadableStream(
  6430. {
  6431. async start () {
  6432. iterator = iterable[Symbol.asyncIterator]()
  6433. },
  6434. async pull (controller) {
  6435. const { done, value } = await iterator.next()
  6436. if (done) {
  6437. queueMicrotask(() => {
  6438. controller.close()
  6439. controller.byobRequest?.respond(0)
  6440. })
  6441. } else {
  6442. const buf = Buffer.isBuffer(value) ? value : Buffer.from(value)
  6443. if (buf.byteLength) {
  6444. controller.enqueue(new Uint8Array(buf))
  6445. }
  6446. }
  6447. return controller.desiredSize > 0
  6448. },
  6449. async cancel (reason) {
  6450. await iterator.return()
  6451. },
  6452. type: 'bytes'
  6453. }
  6454. )
  6455. }
  6456. // The chunk should be a FormData instance and contains
  6457. // all the required methods.
  6458. function isFormDataLike (object) {
  6459. return (
  6460. object &&
  6461. typeof object === 'object' &&
  6462. typeof object.append === 'function' &&
  6463. typeof object.delete === 'function' &&
  6464. typeof object.get === 'function' &&
  6465. typeof object.getAll === 'function' &&
  6466. typeof object.has === 'function' &&
  6467. typeof object.set === 'function' &&
  6468. object[Symbol.toStringTag] === 'FormData'
  6469. )
  6470. }
  6471. function addAbortListener (signal, listener) {
  6472. if ('addEventListener' in signal) {
  6473. signal.addEventListener('abort', listener, { once: true })
  6474. return () => signal.removeEventListener('abort', listener)
  6475. }
  6476. signal.addListener('abort', listener)
  6477. return () => signal.removeListener('abort', listener)
  6478. }
  6479. const hasToWellFormed = typeof String.prototype.toWellFormed === 'function'
  6480. const hasIsWellFormed = typeof String.prototype.isWellFormed === 'function'
  6481. /**
  6482. * @param {string} val
  6483. */
  6484. function toUSVString (val) {
  6485. return hasToWellFormed ? `${val}`.toWellFormed() : nodeUtil.toUSVString(val)
  6486. }
  6487. /**
  6488. * @param {string} val
  6489. */
  6490. // TODO: move this to webidl
  6491. function isUSVString (val) {
  6492. return hasIsWellFormed ? `${val}`.isWellFormed() : toUSVString(val) === `${val}`
  6493. }
  6494. /**
  6495. * @see https://tools.ietf.org/html/rfc7230#section-3.2.6
  6496. * @param {number} c
  6497. */
  6498. function isTokenCharCode (c) {
  6499. switch (c) {
  6500. case 0x22:
  6501. case 0x28:
  6502. case 0x29:
  6503. case 0x2c:
  6504. case 0x2f:
  6505. case 0x3a:
  6506. case 0x3b:
  6507. case 0x3c:
  6508. case 0x3d:
  6509. case 0x3e:
  6510. case 0x3f:
  6511. case 0x40:
  6512. case 0x5b:
  6513. case 0x5c:
  6514. case 0x5d:
  6515. case 0x7b:
  6516. case 0x7d:
  6517. // DQUOTE and "(),/:;<=>?@[\]{}"
  6518. return false
  6519. default:
  6520. // VCHAR %x21-7E
  6521. return c >= 0x21 && c <= 0x7e
  6522. }
  6523. }
  6524. /**
  6525. * @param {string} characters
  6526. */
  6527. function isValidHTTPToken (characters) {
  6528. if (characters.length === 0) {
  6529. return false
  6530. }
  6531. for (let i = 0; i < characters.length; ++i) {
  6532. if (!isTokenCharCode(characters.charCodeAt(i))) {
  6533. return false
  6534. }
  6535. }
  6536. return true
  6537. }
  6538. // headerCharRegex have been lifted from
  6539. // https://github.com/nodejs/node/blob/main/lib/_http_common.js
  6540. /**
  6541. * Matches if val contains an invalid field-vchar
  6542. * field-value = *( field-content / obs-fold )
  6543. * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
  6544. * field-vchar = VCHAR / obs-text
  6545. */
  6546. const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/
  6547. /**
  6548. * @param {string} characters
  6549. */
  6550. function isValidHeaderValue (characters) {
  6551. return !headerCharRegex.test(characters)
  6552. }
  6553. // Parsed accordingly to RFC 9110
  6554. // https://www.rfc-editor.org/rfc/rfc9110#field.content-range
  6555. function parseRangeHeader (range) {
  6556. if (range == null || range === '') return { start: 0, end: null, size: null }
  6557. const m = range ? range.match(/^bytes (\d+)-(\d+)\/(\d+)?$/) : null
  6558. return m
  6559. ? {
  6560. start: parseInt(m[1]),
  6561. end: m[2] ? parseInt(m[2]) : null,
  6562. size: m[3] ? parseInt(m[3]) : null
  6563. }
  6564. : null
  6565. }
  6566. function addListener (obj, name, listener) {
  6567. const listeners = (obj[kListeners] ??= [])
  6568. listeners.push([name, listener])
  6569. obj.on(name, listener)
  6570. return obj
  6571. }
  6572. function removeAllListeners (obj) {
  6573. for (const [name, listener] of obj[kListeners] ?? []) {
  6574. obj.removeListener(name, listener)
  6575. }
  6576. obj[kListeners] = null
  6577. }
  6578. function errorRequest (client, request, err) {
  6579. try {
  6580. request.onError(err)
  6581. assert(request.aborted)
  6582. } catch (err) {
  6583. client.emit('error', err)
  6584. }
  6585. }
  6586. const kEnumerableProperty = Object.create(null)
  6587. kEnumerableProperty.enumerable = true
  6588. const normalizedMethodRecordsBase = {
  6589. delete: 'DELETE',
  6590. DELETE: 'DELETE',
  6591. get: 'GET',
  6592. GET: 'GET',
  6593. head: 'HEAD',
  6594. HEAD: 'HEAD',
  6595. options: 'OPTIONS',
  6596. OPTIONS: 'OPTIONS',
  6597. post: 'POST',
  6598. POST: 'POST',
  6599. put: 'PUT',
  6600. PUT: 'PUT'
  6601. }
  6602. const normalizedMethodRecords = {
  6603. ...normalizedMethodRecordsBase,
  6604. patch: 'patch',
  6605. PATCH: 'PATCH'
  6606. }
  6607. // Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
  6608. Object.setPrototypeOf(normalizedMethodRecordsBase, null)
  6609. Object.setPrototypeOf(normalizedMethodRecords, null)
  6610. module.exports = {
  6611. kEnumerableProperty,
  6612. nop,
  6613. isDisturbed,
  6614. isErrored,
  6615. isReadable,
  6616. toUSVString,
  6617. isUSVString,
  6618. isBlobLike,
  6619. parseOrigin,
  6620. parseURL,
  6621. getServerName,
  6622. isStream,
  6623. isIterable,
  6624. isAsyncIterable,
  6625. isDestroyed,
  6626. headerNameToString,
  6627. bufferToLowerCasedHeaderName,
  6628. addListener,
  6629. removeAllListeners,
  6630. errorRequest,
  6631. parseRawHeaders,
  6632. parseHeaders,
  6633. parseKeepAliveTimeout,
  6634. destroy,
  6635. bodyLength,
  6636. deepClone,
  6637. ReadableStreamFrom,
  6638. isBuffer,
  6639. validateHandler,
  6640. getSocketInfo,
  6641. isFormDataLike,
  6642. buildURL,
  6643. addAbortListener,
  6644. isValidHTTPToken,
  6645. isValidHeaderValue,
  6646. isTokenCharCode,
  6647. parseRangeHeader,
  6648. normalizedMethodRecordsBase,
  6649. normalizedMethodRecords,
  6650. isValidPort,
  6651. isHttpOrHttpsPrefixed,
  6652. nodeMajor,
  6653. nodeMinor,
  6654. safeHTTPMethods: ['GET', 'HEAD', 'OPTIONS', 'TRACE'],
  6655. wrapRequestBody
  6656. }
  6657. /***/ }),
  6658. /***/ 7405:
  6659. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  6660. const { InvalidArgumentError } = __nccwpck_require__(8707)
  6661. const { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(6443)
  6662. const DispatcherBase = __nccwpck_require__(1841)
  6663. const Pool = __nccwpck_require__(628)
  6664. const Client = __nccwpck_require__(3701)
  6665. const util = __nccwpck_require__(3440)
  6666. const createRedirectInterceptor = __nccwpck_require__(5092)
  6667. const kOnConnect = Symbol('onConnect')
  6668. const kOnDisconnect = Symbol('onDisconnect')
  6669. const kOnConnectionError = Symbol('onConnectionError')
  6670. const kMaxRedirections = Symbol('maxRedirections')
  6671. const kOnDrain = Symbol('onDrain')
  6672. const kFactory = Symbol('factory')
  6673. const kOptions = Symbol('options')
  6674. function defaultFactory (origin, opts) {
  6675. return opts && opts.connections === 1
  6676. ? new Client(origin, opts)
  6677. : new Pool(origin, opts)
  6678. }
  6679. class Agent extends DispatcherBase {
  6680. constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
  6681. if (typeof factory !== 'function') {
  6682. throw new InvalidArgumentError('factory must be a function.')
  6683. }
  6684. if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
  6685. throw new InvalidArgumentError('connect must be a function or an object')
  6686. }
  6687. if (!Number.isInteger(maxRedirections) || maxRedirections < 0) {
  6688. throw new InvalidArgumentError('maxRedirections must be a positive number')
  6689. }
  6690. super(options)
  6691. if (connect && typeof connect !== 'function') {
  6692. connect = { ...connect }
  6693. }
  6694. this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent)
  6695. ? options.interceptors.Agent
  6696. : [createRedirectInterceptor({ maxRedirections })]
  6697. this[kOptions] = { ...util.deepClone(options), connect }
  6698. this[kOptions].interceptors = options.interceptors
  6699. ? { ...options.interceptors }
  6700. : undefined
  6701. this[kMaxRedirections] = maxRedirections
  6702. this[kFactory] = factory
  6703. this[kClients] = new Map()
  6704. this[kOnDrain] = (origin, targets) => {
  6705. this.emit('drain', origin, [this, ...targets])
  6706. }
  6707. this[kOnConnect] = (origin, targets) => {
  6708. this.emit('connect', origin, [this, ...targets])
  6709. }
  6710. this[kOnDisconnect] = (origin, targets, err) => {
  6711. this.emit('disconnect', origin, [this, ...targets], err)
  6712. }
  6713. this[kOnConnectionError] = (origin, targets, err) => {
  6714. this.emit('connectionError', origin, [this, ...targets], err)
  6715. }
  6716. }
  6717. get [kRunning] () {
  6718. let ret = 0
  6719. for (const client of this[kClients].values()) {
  6720. ret += client[kRunning]
  6721. }
  6722. return ret
  6723. }
  6724. [kDispatch] (opts, handler) {
  6725. let key
  6726. if (opts.origin && (typeof opts.origin === 'string' || opts.origin instanceof URL)) {
  6727. key = String(opts.origin)
  6728. } else {
  6729. throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.')
  6730. }
  6731. let dispatcher = this[kClients].get(key)
  6732. if (!dispatcher) {
  6733. dispatcher = this[kFactory](opts.origin, this[kOptions])
  6734. .on('drain', this[kOnDrain])
  6735. .on('connect', this[kOnConnect])
  6736. .on('disconnect', this[kOnDisconnect])
  6737. .on('connectionError', this[kOnConnectionError])
  6738. // This introduces a tiny memory leak, as dispatchers are never removed from the map.
  6739. // TODO(mcollina): remove te timer when the client/pool do not have any more
  6740. // active connections.
  6741. this[kClients].set(key, dispatcher)
  6742. }
  6743. return dispatcher.dispatch(opts, handler)
  6744. }
  6745. async [kClose] () {
  6746. const closePromises = []
  6747. for (const client of this[kClients].values()) {
  6748. closePromises.push(client.close())
  6749. }
  6750. this[kClients].clear()
  6751. await Promise.all(closePromises)
  6752. }
  6753. async [kDestroy] (err) {
  6754. const destroyPromises = []
  6755. for (const client of this[kClients].values()) {
  6756. destroyPromises.push(client.destroy(err))
  6757. }
  6758. this[kClients].clear()
  6759. await Promise.all(destroyPromises)
  6760. }
  6761. }
  6762. module.exports = Agent
  6763. /***/ }),
  6764. /***/ 837:
  6765. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  6766. const {
  6767. BalancedPoolMissingUpstreamError,
  6768. InvalidArgumentError
  6769. } = __nccwpck_require__(8707)
  6770. const {
  6771. PoolBase,
  6772. kClients,
  6773. kNeedDrain,
  6774. kAddClient,
  6775. kRemoveClient,
  6776. kGetDispatcher
  6777. } = __nccwpck_require__(2128)
  6778. const Pool = __nccwpck_require__(628)
  6779. const { kUrl, kInterceptors } = __nccwpck_require__(6443)
  6780. const { parseOrigin } = __nccwpck_require__(3440)
  6781. const kFactory = Symbol('factory')
  6782. const kOptions = Symbol('options')
  6783. const kGreatestCommonDivisor = Symbol('kGreatestCommonDivisor')
  6784. const kCurrentWeight = Symbol('kCurrentWeight')
  6785. const kIndex = Symbol('kIndex')
  6786. const kWeight = Symbol('kWeight')
  6787. const kMaxWeightPerServer = Symbol('kMaxWeightPerServer')
  6788. const kErrorPenalty = Symbol('kErrorPenalty')
  6789. /**
  6790. * Calculate the greatest common divisor of two numbers by
  6791. * using the Euclidean algorithm.
  6792. *
  6793. * @param {number} a
  6794. * @param {number} b
  6795. * @returns {number}
  6796. */
  6797. function getGreatestCommonDivisor (a, b) {
  6798. if (a === 0) return b
  6799. while (b !== 0) {
  6800. const t = b
  6801. b = a % b
  6802. a = t
  6803. }
  6804. return a
  6805. }
  6806. function defaultFactory (origin, opts) {
  6807. return new Pool(origin, opts)
  6808. }
  6809. class BalancedPool extends PoolBase {
  6810. constructor (upstreams = [], { factory = defaultFactory, ...opts } = {}) {
  6811. super()
  6812. this[kOptions] = opts
  6813. this[kIndex] = -1
  6814. this[kCurrentWeight] = 0
  6815. this[kMaxWeightPerServer] = this[kOptions].maxWeightPerServer || 100
  6816. this[kErrorPenalty] = this[kOptions].errorPenalty || 15
  6817. if (!Array.isArray(upstreams)) {
  6818. upstreams = [upstreams]
  6819. }
  6820. if (typeof factory !== 'function') {
  6821. throw new InvalidArgumentError('factory must be a function.')
  6822. }
  6823. this[kInterceptors] = opts.interceptors?.BalancedPool && Array.isArray(opts.interceptors.BalancedPool)
  6824. ? opts.interceptors.BalancedPool
  6825. : []
  6826. this[kFactory] = factory
  6827. for (const upstream of upstreams) {
  6828. this.addUpstream(upstream)
  6829. }
  6830. this._updateBalancedPoolStats()
  6831. }
  6832. addUpstream (upstream) {
  6833. const upstreamOrigin = parseOrigin(upstream).origin
  6834. if (this[kClients].find((pool) => (
  6835. pool[kUrl].origin === upstreamOrigin &&
  6836. pool.closed !== true &&
  6837. pool.destroyed !== true
  6838. ))) {
  6839. return this
  6840. }
  6841. const pool = this[kFactory](upstreamOrigin, Object.assign({}, this[kOptions]))
  6842. this[kAddClient](pool)
  6843. pool.on('connect', () => {
  6844. pool[kWeight] = Math.min(this[kMaxWeightPerServer], pool[kWeight] + this[kErrorPenalty])
  6845. })
  6846. pool.on('connectionError', () => {
  6847. pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty])
  6848. this._updateBalancedPoolStats()
  6849. })
  6850. pool.on('disconnect', (...args) => {
  6851. const err = args[2]
  6852. if (err && err.code === 'UND_ERR_SOCKET') {
  6853. // decrease the weight of the pool.
  6854. pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty])
  6855. this._updateBalancedPoolStats()
  6856. }
  6857. })
  6858. for (const client of this[kClients]) {
  6859. client[kWeight] = this[kMaxWeightPerServer]
  6860. }
  6861. this._updateBalancedPoolStats()
  6862. return this
  6863. }
  6864. _updateBalancedPoolStats () {
  6865. let result = 0
  6866. for (let i = 0; i < this[kClients].length; i++) {
  6867. result = getGreatestCommonDivisor(this[kClients][i][kWeight], result)
  6868. }
  6869. this[kGreatestCommonDivisor] = result
  6870. }
  6871. removeUpstream (upstream) {
  6872. const upstreamOrigin = parseOrigin(upstream).origin
  6873. const pool = this[kClients].find((pool) => (
  6874. pool[kUrl].origin === upstreamOrigin &&
  6875. pool.closed !== true &&
  6876. pool.destroyed !== true
  6877. ))
  6878. if (pool) {
  6879. this[kRemoveClient](pool)
  6880. }
  6881. return this
  6882. }
  6883. get upstreams () {
  6884. return this[kClients]
  6885. .filter(dispatcher => dispatcher.closed !== true && dispatcher.destroyed !== true)
  6886. .map((p) => p[kUrl].origin)
  6887. }
  6888. [kGetDispatcher] () {
  6889. // We validate that pools is greater than 0,
  6890. // otherwise we would have to wait until an upstream
  6891. // is added, which might never happen.
  6892. if (this[kClients].length === 0) {
  6893. throw new BalancedPoolMissingUpstreamError()
  6894. }
  6895. const dispatcher = this[kClients].find(dispatcher => (
  6896. !dispatcher[kNeedDrain] &&
  6897. dispatcher.closed !== true &&
  6898. dispatcher.destroyed !== true
  6899. ))
  6900. if (!dispatcher) {
  6901. return
  6902. }
  6903. const allClientsBusy = this[kClients].map(pool => pool[kNeedDrain]).reduce((a, b) => a && b, true)
  6904. if (allClientsBusy) {
  6905. return
  6906. }
  6907. let counter = 0
  6908. let maxWeightIndex = this[kClients].findIndex(pool => !pool[kNeedDrain])
  6909. while (counter++ < this[kClients].length) {
  6910. this[kIndex] = (this[kIndex] + 1) % this[kClients].length
  6911. const pool = this[kClients][this[kIndex]]
  6912. // find pool index with the largest weight
  6913. if (pool[kWeight] > this[kClients][maxWeightIndex][kWeight] && !pool[kNeedDrain]) {
  6914. maxWeightIndex = this[kIndex]
  6915. }
  6916. // decrease the current weight every `this[kClients].length`.
  6917. if (this[kIndex] === 0) {
  6918. // Set the current weight to the next lower weight.
  6919. this[kCurrentWeight] = this[kCurrentWeight] - this[kGreatestCommonDivisor]
  6920. if (this[kCurrentWeight] <= 0) {
  6921. this[kCurrentWeight] = this[kMaxWeightPerServer]
  6922. }
  6923. }
  6924. if (pool[kWeight] >= this[kCurrentWeight] && (!pool[kNeedDrain])) {
  6925. return pool
  6926. }
  6927. }
  6928. this[kCurrentWeight] = this[kClients][maxWeightIndex][kWeight]
  6929. this[kIndex] = maxWeightIndex
  6930. return this[kClients][maxWeightIndex]
  6931. }
  6932. }
  6933. module.exports = BalancedPool
  6934. /***/ }),
  6935. /***/ 637:
  6936. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  6937. /* global WebAssembly */
  6938. const assert = __nccwpck_require__(4589)
  6939. const util = __nccwpck_require__(3440)
  6940. const { channels } = __nccwpck_require__(2414)
  6941. const timers = __nccwpck_require__(6603)
  6942. const {
  6943. RequestContentLengthMismatchError,
  6944. ResponseContentLengthMismatchError,
  6945. RequestAbortedError,
  6946. HeadersTimeoutError,
  6947. HeadersOverflowError,
  6948. SocketError,
  6949. InformationalError,
  6950. BodyTimeoutError,
  6951. HTTPParserError,
  6952. ResponseExceededMaxSizeError
  6953. } = __nccwpck_require__(8707)
  6954. const {
  6955. kUrl,
  6956. kReset,
  6957. kClient,
  6958. kParser,
  6959. kBlocking,
  6960. kRunning,
  6961. kPending,
  6962. kSize,
  6963. kWriting,
  6964. kQueue,
  6965. kNoRef,
  6966. kKeepAliveDefaultTimeout,
  6967. kHostHeader,
  6968. kPendingIdx,
  6969. kRunningIdx,
  6970. kError,
  6971. kPipelining,
  6972. kSocket,
  6973. kKeepAliveTimeoutValue,
  6974. kMaxHeadersSize,
  6975. kKeepAliveMaxTimeout,
  6976. kKeepAliveTimeoutThreshold,
  6977. kHeadersTimeout,
  6978. kBodyTimeout,
  6979. kStrictContentLength,
  6980. kMaxRequests,
  6981. kCounter,
  6982. kMaxResponseSize,
  6983. kOnError,
  6984. kResume,
  6985. kHTTPContext
  6986. } = __nccwpck_require__(6443)
  6987. const constants = __nccwpck_require__(2824)
  6988. const EMPTY_BUF = Buffer.alloc(0)
  6989. const FastBuffer = Buffer[Symbol.species]
  6990. const addListener = util.addListener
  6991. const removeAllListeners = util.removeAllListeners
  6992. const kIdleSocketValidation = Symbol('kIdleSocketValidation')
  6993. const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout')
  6994. const kSocketUsed = Symbol('kSocketUsed')
  6995. let extractBody
  6996. async function lazyllhttp () {
  6997. const llhttpWasmData = process.env.JEST_WORKER_ID ? __nccwpck_require__(3870) : undefined
  6998. let mod
  6999. try {
  7000. mod = await WebAssembly.compile(__nccwpck_require__(3434))
  7001. } catch (e) {
  7002. /* istanbul ignore next */
  7003. // We could check if the error was caused by the simd option not
  7004. // being enabled, but the occurring of this other error
  7005. // * https://github.com/emscripten-core/emscripten/issues/11495
  7006. // got me to remove that check to avoid breaking Node 12.
  7007. mod = await WebAssembly.compile(llhttpWasmData || __nccwpck_require__(3870))
  7008. }
  7009. return await WebAssembly.instantiate(mod, {
  7010. env: {
  7011. /* eslint-disable camelcase */
  7012. wasm_on_url: (p, at, len) => {
  7013. /* istanbul ignore next */
  7014. return 0
  7015. },
  7016. wasm_on_status: (p, at, len) => {
  7017. assert(currentParser.ptr === p)
  7018. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  7019. return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  7020. },
  7021. wasm_on_message_begin: (p) => {
  7022. assert(currentParser.ptr === p)
  7023. return currentParser.onMessageBegin() || 0
  7024. },
  7025. wasm_on_header_field: (p, at, len) => {
  7026. assert(currentParser.ptr === p)
  7027. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  7028. return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  7029. },
  7030. wasm_on_header_value: (p, at, len) => {
  7031. assert(currentParser.ptr === p)
  7032. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  7033. return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  7034. },
  7035. wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => {
  7036. assert(currentParser.ptr === p)
  7037. return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0
  7038. },
  7039. wasm_on_body: (p, at, len) => {
  7040. assert(currentParser.ptr === p)
  7041. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  7042. return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  7043. },
  7044. wasm_on_message_complete: (p) => {
  7045. assert(currentParser.ptr === p)
  7046. return currentParser.onMessageComplete() || 0
  7047. }
  7048. /* eslint-enable camelcase */
  7049. }
  7050. })
  7051. }
  7052. let llhttpInstance = null
  7053. let llhttpPromise = lazyllhttp()
  7054. llhttpPromise.catch()
  7055. let currentParser = null
  7056. let currentBufferRef = null
  7057. let currentBufferSize = 0
  7058. let currentBufferPtr = null
  7059. const USE_NATIVE_TIMER = 0
  7060. const USE_FAST_TIMER = 1
  7061. // Use fast timers for headers and body to take eventual event loop
  7062. // latency into account.
  7063. const TIMEOUT_HEADERS = 2 | USE_FAST_TIMER
  7064. const TIMEOUT_BODY = 4 | USE_FAST_TIMER
  7065. // Use native timers to ignore event loop latency for keep-alive
  7066. // handling.
  7067. const TIMEOUT_KEEP_ALIVE = 8 | USE_NATIVE_TIMER
  7068. class Parser {
  7069. constructor (client, socket, { exports }) {
  7070. assert(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0)
  7071. this.llhttp = exports
  7072. this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE)
  7073. this.client = client
  7074. this.socket = socket
  7075. this.timeout = null
  7076. this.timeoutValue = null
  7077. this.timeoutType = null
  7078. this.statusCode = null
  7079. this.statusText = ''
  7080. this.upgrade = false
  7081. this.headers = []
  7082. this.headersSize = 0
  7083. this.headersMaxSize = client[kMaxHeadersSize]
  7084. this.shouldKeepAlive = false
  7085. this.paused = false
  7086. this.resume = this.resume.bind(this)
  7087. this.bytesRead = 0
  7088. this.keepAlive = ''
  7089. this.contentLength = ''
  7090. this.connection = ''
  7091. this.maxResponseSize = client[kMaxResponseSize]
  7092. }
  7093. setTimeout (delay, type) {
  7094. // If the existing timer and the new timer are of different timer type
  7095. // (fast or native) or have different delay, we need to clear the existing
  7096. // timer and set a new one.
  7097. if (
  7098. delay !== this.timeoutValue ||
  7099. (type & USE_FAST_TIMER) ^ (this.timeoutType & USE_FAST_TIMER)
  7100. ) {
  7101. // If a timeout is already set, clear it with clearTimeout of the fast
  7102. // timer implementation, as it can clear fast and native timers.
  7103. if (this.timeout) {
  7104. timers.clearTimeout(this.timeout)
  7105. this.timeout = null
  7106. }
  7107. if (delay) {
  7108. if (type & USE_FAST_TIMER) {
  7109. this.timeout = timers.setFastTimeout(onParserTimeout, delay, new WeakRef(this))
  7110. } else {
  7111. this.timeout = setTimeout(onParserTimeout, delay, new WeakRef(this))
  7112. this.timeout.unref()
  7113. }
  7114. }
  7115. this.timeoutValue = delay
  7116. } else if (this.timeout) {
  7117. // istanbul ignore else: only for jest
  7118. if (this.timeout.refresh) {
  7119. this.timeout.refresh()
  7120. }
  7121. }
  7122. this.timeoutType = type
  7123. }
  7124. resume () {
  7125. if (this.socket.destroyed || !this.paused) {
  7126. return
  7127. }
  7128. assert(this.ptr != null)
  7129. assert(currentParser == null)
  7130. this.llhttp.llhttp_resume(this.ptr)
  7131. assert(this.timeoutType === TIMEOUT_BODY)
  7132. if (this.timeout) {
  7133. // istanbul ignore else: only for jest
  7134. if (this.timeout.refresh) {
  7135. this.timeout.refresh()
  7136. }
  7137. }
  7138. this.paused = false
  7139. this.execute(this.socket.read() || EMPTY_BUF) // Flush parser.
  7140. this.readMore()
  7141. }
  7142. readMore () {
  7143. while (!this.paused && this.ptr) {
  7144. const chunk = this.socket.read()
  7145. if (chunk === null) {
  7146. break
  7147. }
  7148. this.execute(chunk)
  7149. }
  7150. }
  7151. execute (data) {
  7152. assert(this.ptr != null)
  7153. assert(currentParser == null)
  7154. assert(!this.paused)
  7155. const { socket, llhttp } = this
  7156. if (data.length > currentBufferSize) {
  7157. if (currentBufferPtr) {
  7158. llhttp.free(currentBufferPtr)
  7159. }
  7160. currentBufferSize = Math.ceil(data.length / 4096) * 4096
  7161. currentBufferPtr = llhttp.malloc(currentBufferSize)
  7162. }
  7163. new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(data)
  7164. // Call `execute` on the wasm parser.
  7165. // We pass the `llhttp_parser` pointer address, the pointer address of buffer view data,
  7166. // and finally the length of bytes to parse.
  7167. // The return value is an error code or `constants.ERROR.OK`.
  7168. try {
  7169. let ret
  7170. try {
  7171. currentBufferRef = data
  7172. currentParser = this
  7173. ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, data.length)
  7174. /* eslint-disable-next-line no-useless-catch */
  7175. } catch (err) {
  7176. /* istanbul ignore next: difficult to make a test case for */
  7177. throw err
  7178. } finally {
  7179. currentParser = null
  7180. currentBufferRef = null
  7181. }
  7182. const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr
  7183. if (ret !== constants.ERROR.OK) {
  7184. const body = data.subarray(offset)
  7185. if (ret === constants.ERROR.PAUSED_UPGRADE) {
  7186. this.onUpgrade(body)
  7187. } else if (ret === constants.ERROR.PAUSED) {
  7188. this.paused = true
  7189. socket.unshift(body)
  7190. } else {
  7191. throw this.createError(ret, body)
  7192. }
  7193. }
  7194. } catch (err) {
  7195. util.destroy(socket, err)
  7196. }
  7197. }
  7198. finish () {
  7199. assert(currentParser === null)
  7200. assert(this.ptr != null)
  7201. assert(!this.paused)
  7202. const { llhttp } = this
  7203. let ret
  7204. try {
  7205. currentParser = this
  7206. ret = llhttp.llhttp_finish(this.ptr)
  7207. } finally {
  7208. currentParser = null
  7209. }
  7210. if (ret === constants.ERROR.OK) {
  7211. return null
  7212. }
  7213. if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) {
  7214. this.paused = true
  7215. return null
  7216. }
  7217. return this.createError(ret, EMPTY_BUF)
  7218. }
  7219. createError (ret, data) {
  7220. const { llhttp, contentLength, bytesRead } = this
  7221. if (contentLength && bytesRead !== parseInt(contentLength, 10)) {
  7222. return new ResponseContentLengthMismatchError()
  7223. }
  7224. const ptr = llhttp.llhttp_get_error_reason(this.ptr)
  7225. let message = ''
  7226. if (ptr) {
  7227. const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
  7228. message =
  7229. 'Response does not match the HTTP/1.1 protocol (' +
  7230. Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
  7231. ')'
  7232. }
  7233. return new HTTPParserError(message, constants.ERROR[ret], data)
  7234. }
  7235. destroy () {
  7236. assert(this.ptr != null)
  7237. assert(currentParser == null)
  7238. this.llhttp.llhttp_free(this.ptr)
  7239. this.ptr = null
  7240. this.timeout && timers.clearTimeout(this.timeout)
  7241. this.timeout = null
  7242. this.timeoutValue = null
  7243. this.timeoutType = null
  7244. this.paused = false
  7245. }
  7246. onStatus (buf) {
  7247. this.statusText = buf.toString()
  7248. }
  7249. onMessageBegin () {
  7250. const { socket, client } = this
  7251. /* istanbul ignore next: difficult to make a test case for */
  7252. if (socket.destroyed) {
  7253. return -1
  7254. }
  7255. if (client[kRunning] === 0) {
  7256. util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
  7257. return -1
  7258. }
  7259. const request = client[kQueue][client[kRunningIdx]]
  7260. if (!request) {
  7261. return -1
  7262. }
  7263. request.onResponseStarted()
  7264. }
  7265. onHeaderField (buf) {
  7266. const len = this.headers.length
  7267. if ((len & 1) === 0) {
  7268. this.headers.push(buf)
  7269. } else {
  7270. this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf])
  7271. }
  7272. this.trackHeader(buf.length)
  7273. }
  7274. onHeaderValue (buf) {
  7275. let len = this.headers.length
  7276. if ((len & 1) === 1) {
  7277. this.headers.push(buf)
  7278. len += 1
  7279. } else {
  7280. this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf])
  7281. }
  7282. const key = this.headers[len - 2]
  7283. if (key.length === 10) {
  7284. const headerName = util.bufferToLowerCasedHeaderName(key)
  7285. if (headerName === 'keep-alive') {
  7286. this.keepAlive += buf.toString()
  7287. } else if (headerName === 'connection') {
  7288. this.connection += buf.toString()
  7289. }
  7290. } else if (key.length === 14 && util.bufferToLowerCasedHeaderName(key) === 'content-length') {
  7291. this.contentLength += buf.toString()
  7292. }
  7293. this.trackHeader(buf.length)
  7294. }
  7295. trackHeader (len) {
  7296. this.headersSize += len
  7297. if (this.headersSize >= this.headersMaxSize) {
  7298. util.destroy(this.socket, new HeadersOverflowError())
  7299. }
  7300. }
  7301. onUpgrade (head) {
  7302. const { upgrade, client, socket, headers, statusCode } = this
  7303. assert(upgrade)
  7304. assert(client[kSocket] === socket)
  7305. assert(!socket.destroyed)
  7306. assert(!this.paused)
  7307. assert((headers.length & 1) === 0)
  7308. const request = client[kQueue][client[kRunningIdx]]
  7309. assert(request)
  7310. assert(request.upgrade || request.method === 'CONNECT')
  7311. this.statusCode = null
  7312. this.statusText = ''
  7313. this.shouldKeepAlive = null
  7314. this.headers = []
  7315. this.headersSize = 0
  7316. socket.unshift(head)
  7317. socket[kParser].destroy()
  7318. socket[kParser] = null
  7319. socket[kClient] = null
  7320. socket[kError] = null
  7321. removeAllListeners(socket)
  7322. client[kSocket] = null
  7323. client[kHTTPContext] = null // TODO (fix): This is hacky...
  7324. client[kQueue][client[kRunningIdx]++] = null
  7325. client.emit('disconnect', client[kUrl], [client], new InformationalError('upgrade'))
  7326. try {
  7327. request.onUpgrade(statusCode, headers, socket)
  7328. } catch (err) {
  7329. util.destroy(socket, err)
  7330. }
  7331. client[kResume]()
  7332. }
  7333. onHeadersComplete (statusCode, upgrade, shouldKeepAlive) {
  7334. const { client, socket, headers, statusText } = this
  7335. /* istanbul ignore next: difficult to make a test case for */
  7336. if (socket.destroyed) {
  7337. return -1
  7338. }
  7339. if (client[kRunning] === 0) {
  7340. util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
  7341. return -1
  7342. }
  7343. const request = client[kQueue][client[kRunningIdx]]
  7344. /* istanbul ignore next: difficult to make a test case for */
  7345. if (!request) {
  7346. return -1
  7347. }
  7348. assert(!this.upgrade)
  7349. assert(this.statusCode < 200)
  7350. if (statusCode === 100) {
  7351. util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
  7352. return -1
  7353. }
  7354. /* this can only happen if server is misbehaving */
  7355. if (upgrade && !request.upgrade) {
  7356. util.destroy(socket, new SocketError('bad upgrade', util.getSocketInfo(socket)))
  7357. return -1
  7358. }
  7359. assert(this.timeoutType === TIMEOUT_HEADERS)
  7360. this.statusCode = statusCode
  7361. this.shouldKeepAlive = (
  7362. shouldKeepAlive ||
  7363. // Override llhttp value which does not allow keepAlive for HEAD.
  7364. (request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive')
  7365. )
  7366. if (this.statusCode >= 200) {
  7367. const bodyTimeout = request.bodyTimeout != null
  7368. ? request.bodyTimeout
  7369. : client[kBodyTimeout]
  7370. this.setTimeout(bodyTimeout, TIMEOUT_BODY)
  7371. } else if (this.timeout) {
  7372. // istanbul ignore else: only for jest
  7373. if (this.timeout.refresh) {
  7374. this.timeout.refresh()
  7375. }
  7376. }
  7377. if (request.method === 'CONNECT') {
  7378. assert(client[kRunning] === 1)
  7379. this.upgrade = true
  7380. return 2
  7381. }
  7382. if (upgrade) {
  7383. assert(client[kRunning] === 1)
  7384. this.upgrade = true
  7385. return 2
  7386. }
  7387. assert((this.headers.length & 1) === 0)
  7388. this.headers = []
  7389. this.headersSize = 0
  7390. if (this.shouldKeepAlive && client[kPipelining]) {
  7391. const keepAliveTimeout = this.keepAlive ? util.parseKeepAliveTimeout(this.keepAlive) : null
  7392. if (keepAliveTimeout != null) {
  7393. const timeout = Math.min(
  7394. keepAliveTimeout - client[kKeepAliveTimeoutThreshold],
  7395. client[kKeepAliveMaxTimeout]
  7396. )
  7397. if (timeout <= 0) {
  7398. socket[kReset] = true
  7399. } else {
  7400. client[kKeepAliveTimeoutValue] = timeout
  7401. }
  7402. } else {
  7403. client[kKeepAliveTimeoutValue] = client[kKeepAliveDefaultTimeout]
  7404. }
  7405. } else {
  7406. // Stop more requests from being dispatched.
  7407. socket[kReset] = true
  7408. }
  7409. const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false
  7410. if (request.aborted) {
  7411. return -1
  7412. }
  7413. if (request.method === 'HEAD') {
  7414. return 1
  7415. }
  7416. if (statusCode < 200) {
  7417. return 1
  7418. }
  7419. if (socket[kBlocking]) {
  7420. socket[kBlocking] = false
  7421. client[kResume]()
  7422. }
  7423. return pause ? constants.ERROR.PAUSED : 0
  7424. }
  7425. onBody (buf) {
  7426. const { client, socket, statusCode, maxResponseSize } = this
  7427. if (socket.destroyed) {
  7428. return -1
  7429. }
  7430. const request = client[kQueue][client[kRunningIdx]]
  7431. assert(request)
  7432. assert(this.timeoutType === TIMEOUT_BODY)
  7433. if (this.timeout) {
  7434. // istanbul ignore else: only for jest
  7435. if (this.timeout.refresh) {
  7436. this.timeout.refresh()
  7437. }
  7438. }
  7439. assert(statusCode >= 200)
  7440. if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) {
  7441. util.destroy(socket, new ResponseExceededMaxSizeError())
  7442. return -1
  7443. }
  7444. this.bytesRead += buf.length
  7445. if (request.onData(buf) === false) {
  7446. return constants.ERROR.PAUSED
  7447. }
  7448. }
  7449. onMessageComplete () {
  7450. const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this
  7451. if (socket.destroyed && (!statusCode || shouldKeepAlive)) {
  7452. return -1
  7453. }
  7454. if (upgrade) {
  7455. return
  7456. }
  7457. assert(statusCode >= 100)
  7458. assert((this.headers.length & 1) === 0)
  7459. const request = client[kQueue][client[kRunningIdx]]
  7460. assert(request)
  7461. this.statusCode = null
  7462. this.statusText = ''
  7463. this.bytesRead = 0
  7464. this.contentLength = ''
  7465. this.keepAlive = ''
  7466. this.connection = ''
  7467. this.headers = []
  7468. this.headersSize = 0
  7469. if (statusCode < 200) {
  7470. return
  7471. }
  7472. /* istanbul ignore next: should be handled by llhttp? */
  7473. if (request.method !== 'HEAD' && contentLength && bytesRead !== parseInt(contentLength, 10)) {
  7474. util.destroy(socket, new ResponseContentLengthMismatchError())
  7475. return -1
  7476. }
  7477. request.onComplete(headers)
  7478. client[kQueue][client[kRunningIdx]++] = null
  7479. socket[kSocketUsed] = true
  7480. if (socket[kWriting]) {
  7481. assert(client[kRunning] === 0)
  7482. // Response completed before request.
  7483. util.destroy(socket, new InformationalError('reset'))
  7484. return constants.ERROR.PAUSED
  7485. } else if (!shouldKeepAlive) {
  7486. util.destroy(socket, new InformationalError('reset'))
  7487. return constants.ERROR.PAUSED
  7488. } else if (socket[kReset] && client[kRunning] === 0) {
  7489. // Destroy socket once all requests have completed.
  7490. // The request at the tail of the pipeline is the one
  7491. // that requested reset and no further requests should
  7492. // have been queued since then.
  7493. util.destroy(socket, new InformationalError('reset'))
  7494. return constants.ERROR.PAUSED
  7495. } else if (client[kPipelining] == null || client[kPipelining] === 1) {
  7496. // We must wait a full event loop cycle to reuse this socket to make sure
  7497. // that non-spec compliant servers are not closing the connection even if they
  7498. // said they won't.
  7499. setImmediate(() => client[kResume]())
  7500. } else {
  7501. client[kResume]()
  7502. }
  7503. }
  7504. }
  7505. function onParserTimeout (parser) {
  7506. const { socket, timeoutType, client, paused } = parser.deref()
  7507. /* istanbul ignore else */
  7508. if (timeoutType === TIMEOUT_HEADERS) {
  7509. if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) {
  7510. assert(!paused, 'cannot be paused while waiting for headers')
  7511. util.destroy(socket, new HeadersTimeoutError())
  7512. }
  7513. } else if (timeoutType === TIMEOUT_BODY) {
  7514. if (!paused) {
  7515. util.destroy(socket, new BodyTimeoutError())
  7516. }
  7517. } else if (timeoutType === TIMEOUT_KEEP_ALIVE) {
  7518. assert(client[kRunning] === 0 && client[kKeepAliveTimeoutValue])
  7519. util.destroy(socket, new InformationalError('socket idle timeout'))
  7520. }
  7521. }
  7522. async function connectH1 (client, socket) {
  7523. client[kSocket] = socket
  7524. if (!llhttpInstance) {
  7525. llhttpInstance = await llhttpPromise
  7526. llhttpPromise = null
  7527. }
  7528. socket[kNoRef] = false
  7529. socket[kWriting] = false
  7530. socket[kReset] = false
  7531. socket[kBlocking] = false
  7532. socket[kIdleSocketValidation] = 0
  7533. socket[kIdleSocketValidationTimeout] = null
  7534. socket[kSocketUsed] = false
  7535. socket[kParser] = new Parser(client, socket, llhttpInstance)
  7536. addListener(socket, 'error', function (err) {
  7537. assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
  7538. const parser = this[kParser]
  7539. // On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
  7540. // to the user.
  7541. if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
  7542. const parserErr = parser.finish()
  7543. if (parserErr) {
  7544. this[kError] = parserErr
  7545. this[kClient][kOnError](parserErr)
  7546. }
  7547. return
  7548. }
  7549. this[kError] = err
  7550. this[kClient][kOnError](err)
  7551. })
  7552. addListener(socket, 'readable', function () {
  7553. const parser = this[kParser]
  7554. if (parser) {
  7555. parser.readMore()
  7556. }
  7557. })
  7558. addListener(socket, 'end', function () {
  7559. const parser = this[kParser]
  7560. if (parser.statusCode && !parser.shouldKeepAlive) {
  7561. const parserErr = parser.finish()
  7562. if (parserErr) {
  7563. util.destroy(this, parserErr)
  7564. }
  7565. return
  7566. }
  7567. util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this)))
  7568. })
  7569. addListener(socket, 'close', function () {
  7570. const client = this[kClient]
  7571. const parser = this[kParser]
  7572. clearIdleSocketValidation(this)
  7573. if (parser) {
  7574. if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
  7575. this[kError] = parser.finish() || this[kError]
  7576. }
  7577. this[kParser].destroy()
  7578. this[kParser] = null
  7579. }
  7580. const err = this[kError] || new SocketError('closed', util.getSocketInfo(this))
  7581. client[kSocket] = null
  7582. client[kHTTPContext] = null // TODO (fix): This is hacky...
  7583. if (client.destroyed) {
  7584. assert(client[kPending] === 0)
  7585. // Fail entire queue.
  7586. const requests = client[kQueue].splice(client[kRunningIdx])
  7587. for (let i = 0; i < requests.length; i++) {
  7588. const request = requests[i]
  7589. util.errorRequest(client, request, err)
  7590. }
  7591. } else if (client[kRunning] > 0 && err.code !== 'UND_ERR_INFO') {
  7592. // Fail head of pipeline.
  7593. const request = client[kQueue][client[kRunningIdx]]
  7594. client[kQueue][client[kRunningIdx]++] = null
  7595. util.errorRequest(client, request, err)
  7596. }
  7597. client[kPendingIdx] = client[kRunningIdx]
  7598. assert(client[kRunning] === 0)
  7599. client.emit('disconnect', client[kUrl], [client], err)
  7600. client[kResume]()
  7601. })
  7602. let closed = false
  7603. socket.on('close', () => {
  7604. closed = true
  7605. })
  7606. return {
  7607. version: 'h1',
  7608. defaultPipelining: 1,
  7609. write (...args) {
  7610. return writeH1(client, ...args)
  7611. },
  7612. resume () {
  7613. resumeH1(client)
  7614. },
  7615. destroy (err, callback) {
  7616. if (closed) {
  7617. queueMicrotask(callback)
  7618. } else {
  7619. socket.destroy(err).on('close', callback)
  7620. }
  7621. },
  7622. get destroyed () {
  7623. return socket.destroyed
  7624. },
  7625. busy (request) {
  7626. if (socket[kWriting] || socket[kReset] || socket[kBlocking] || socket[kIdleSocketValidation] === 1) {
  7627. return true
  7628. }
  7629. if (request) {
  7630. if (client[kRunning] > 0 && !request.idempotent) {
  7631. // Non-idempotent request cannot be retried.
  7632. // Ensure that no other requests are inflight and
  7633. // could cause failure.
  7634. return true
  7635. }
  7636. if (client[kRunning] > 0 && (request.upgrade || request.method === 'CONNECT')) {
  7637. // Don't dispatch an upgrade until all preceding requests have completed.
  7638. // A misbehaving server might upgrade the connection before all pipelined
  7639. // request has completed.
  7640. return true
  7641. }
  7642. if (client[kRunning] > 0 && util.bodyLength(request.body) !== 0 &&
  7643. (util.isStream(request.body) || util.isAsyncIterable(request.body) || util.isFormDataLike(request.body))) {
  7644. // Request with stream or iterator body can error while other requests
  7645. // are inflight and indirectly error those as well.
  7646. // Ensure this doesn't happen by waiting for inflight
  7647. // to complete before dispatching.
  7648. // Request with stream or iterator body cannot be retried.
  7649. // Ensure that no other requests are inflight and
  7650. // could cause failure.
  7651. return true
  7652. }
  7653. }
  7654. return false
  7655. }
  7656. }
  7657. }
  7658. function clearIdleSocketValidation (socket) {
  7659. if (socket[kIdleSocketValidationTimeout]) {
  7660. clearTimeout(socket[kIdleSocketValidationTimeout])
  7661. socket[kIdleSocketValidationTimeout] = null
  7662. }
  7663. socket[kIdleSocketValidation] = 0
  7664. }
  7665. function scheduleIdleSocketValidation (client, socket) {
  7666. socket[kIdleSocketValidation] = 1
  7667. socket[kIdleSocketValidationTimeout] = setTimeout(() => {
  7668. socket[kIdleSocketValidationTimeout] = null
  7669. socket[kIdleSocketValidation] = 2
  7670. if (client[kSocket] === socket && !socket.destroyed) {
  7671. client[kResume]()
  7672. }
  7673. }, 0)
  7674. socket[kIdleSocketValidationTimeout].unref?.()
  7675. }
  7676. /**
  7677. * @param {import('./client.js')} client
  7678. */
  7679. function resumeH1 (client) {
  7680. const socket = client[kSocket]
  7681. if (socket && !socket.destroyed) {
  7682. if (client[kSize] === 0) {
  7683. if (!socket[kNoRef] && socket.unref) {
  7684. socket.unref()
  7685. socket[kNoRef] = true
  7686. }
  7687. } else if (socket[kNoRef] && socket.ref) {
  7688. socket.ref()
  7689. socket[kNoRef] = false
  7690. }
  7691. if (client[kRunning] === 0 && client[kPending] > 0 && socket[kSocketUsed]) {
  7692. if (socket[kIdleSocketValidation] === 0) {
  7693. scheduleIdleSocketValidation(client, socket)
  7694. socket[kParser].readMore()
  7695. if (socket.destroyed) {
  7696. return
  7697. }
  7698. return
  7699. }
  7700. if (socket[kIdleSocketValidation] === 1) {
  7701. socket[kParser].readMore()
  7702. if (socket.destroyed) {
  7703. return
  7704. }
  7705. return
  7706. }
  7707. }
  7708. if (client[kRunning] === 0) {
  7709. socket[kParser].readMore()
  7710. if (socket.destroyed) {
  7711. return
  7712. }
  7713. }
  7714. if (client[kSize] === 0) {
  7715. if (socket[kParser].timeoutType !== TIMEOUT_KEEP_ALIVE) {
  7716. socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_KEEP_ALIVE)
  7717. }
  7718. } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) {
  7719. if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) {
  7720. const request = client[kQueue][client[kRunningIdx]]
  7721. const headersTimeout = request.headersTimeout != null
  7722. ? request.headersTimeout
  7723. : client[kHeadersTimeout]
  7724. socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS)
  7725. }
  7726. }
  7727. }
  7728. }
  7729. // https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2
  7730. function shouldSendContentLength (method) {
  7731. return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
  7732. }
  7733. function writeH1 (client, request) {
  7734. const { method, path, host, upgrade, blocking, reset } = request
  7735. let { body, headers, contentLength } = request
  7736. // https://tools.ietf.org/html/rfc7231#section-4.3.1
  7737. // https://tools.ietf.org/html/rfc7231#section-4.3.2
  7738. // https://tools.ietf.org/html/rfc7231#section-4.3.5
  7739. // Sending a payload body on a request that does not
  7740. // expect it can cause undefined behavior on some
  7741. // servers and corrupt connection state. Do not
  7742. // re-use the connection for further requests.
  7743. const expectsPayload = (
  7744. method === 'PUT' ||
  7745. method === 'POST' ||
  7746. method === 'PATCH' ||
  7747. method === 'QUERY' ||
  7748. method === 'PROPFIND' ||
  7749. method === 'PROPPATCH'
  7750. )
  7751. if (util.isFormDataLike(body)) {
  7752. if (!extractBody) {
  7753. extractBody = (__nccwpck_require__(4492).extractBody)
  7754. }
  7755. const [bodyStream, contentType] = extractBody(body)
  7756. if (request.contentType == null) {
  7757. headers.push('content-type', contentType)
  7758. }
  7759. body = bodyStream.stream
  7760. contentLength = bodyStream.length
  7761. } else if (util.isBlobLike(body) && request.contentType == null && body.type) {
  7762. headers.push('content-type', body.type)
  7763. }
  7764. if (body && typeof body.read === 'function') {
  7765. // Try to read EOF in order to get length.
  7766. body.read(0)
  7767. }
  7768. const bodyLength = util.bodyLength(body)
  7769. contentLength = bodyLength ?? contentLength
  7770. if (contentLength === null) {
  7771. contentLength = request.contentLength
  7772. }
  7773. if (contentLength === 0 && !expectsPayload) {
  7774. // https://tools.ietf.org/html/rfc7230#section-3.3.2
  7775. // A user agent SHOULD NOT send a Content-Length header field when
  7776. // the request message does not contain a payload body and the method
  7777. // semantics do not anticipate such a body.
  7778. contentLength = null
  7779. }
  7780. // https://github.com/nodejs/undici/issues/2046
  7781. // A user agent may send a Content-Length header with 0 value, this should be allowed.
  7782. if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength !== null && request.contentLength !== contentLength) {
  7783. if (client[kStrictContentLength]) {
  7784. util.errorRequest(client, request, new RequestContentLengthMismatchError())
  7785. return false
  7786. }
  7787. process.emitWarning(new RequestContentLengthMismatchError())
  7788. }
  7789. const socket = client[kSocket]
  7790. clearIdleSocketValidation(socket)
  7791. const abort = (err) => {
  7792. if (request.aborted || request.completed) {
  7793. return
  7794. }
  7795. util.errorRequest(client, request, err || new RequestAbortedError())
  7796. util.destroy(body)
  7797. util.destroy(socket, new InformationalError('aborted'))
  7798. }
  7799. try {
  7800. request.onConnect(abort)
  7801. } catch (err) {
  7802. util.errorRequest(client, request, err)
  7803. }
  7804. if (request.aborted) {
  7805. return false
  7806. }
  7807. if (method === 'HEAD') {
  7808. // https://github.com/mcollina/undici/issues/258
  7809. // Close after a HEAD request to interop with misbehaving servers
  7810. // that may send a body in the response.
  7811. socket[kReset] = true
  7812. }
  7813. if (upgrade || method === 'CONNECT') {
  7814. // On CONNECT or upgrade, block pipeline from dispatching further
  7815. // requests on this connection.
  7816. socket[kReset] = true
  7817. }
  7818. if (reset != null) {
  7819. socket[kReset] = reset
  7820. }
  7821. if (client[kMaxRequests] && socket[kCounter]++ >= client[kMaxRequests]) {
  7822. socket[kReset] = true
  7823. }
  7824. if (blocking) {
  7825. socket[kBlocking] = true
  7826. }
  7827. let header = `${method} ${path} HTTP/1.1\r\n`
  7828. if (typeof host === 'string') {
  7829. header += `host: ${host}\r\n`
  7830. } else {
  7831. header += client[kHostHeader]
  7832. }
  7833. if (upgrade) {
  7834. header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n`
  7835. } else if (client[kPipelining] && !socket[kReset]) {
  7836. header += 'connection: keep-alive\r\n'
  7837. } else {
  7838. header += 'connection: close\r\n'
  7839. }
  7840. if (Array.isArray(headers)) {
  7841. for (let n = 0; n < headers.length; n += 2) {
  7842. const key = headers[n + 0]
  7843. const val = headers[n + 1]
  7844. if (Array.isArray(val)) {
  7845. for (let i = 0; i < val.length; i++) {
  7846. header += `${key}: ${val[i]}\r\n`
  7847. }
  7848. } else {
  7849. header += `${key}: ${val}\r\n`
  7850. }
  7851. }
  7852. }
  7853. if (channels.sendHeaders.hasSubscribers) {
  7854. channels.sendHeaders.publish({ request, headers: header, socket })
  7855. }
  7856. /* istanbul ignore else: assertion */
  7857. if (!body || bodyLength === 0) {
  7858. writeBuffer(abort, null, client, request, socket, contentLength, header, expectsPayload)
  7859. } else if (util.isBuffer(body)) {
  7860. writeBuffer(abort, body, client, request, socket, contentLength, header, expectsPayload)
  7861. } else if (util.isBlobLike(body)) {
  7862. if (typeof body.stream === 'function') {
  7863. writeIterable(abort, body.stream(), client, request, socket, contentLength, header, expectsPayload)
  7864. } else {
  7865. writeBlob(abort, body, client, request, socket, contentLength, header, expectsPayload)
  7866. }
  7867. } else if (util.isStream(body)) {
  7868. writeStream(abort, body, client, request, socket, contentLength, header, expectsPayload)
  7869. } else if (util.isIterable(body)) {
  7870. writeIterable(abort, body, client, request, socket, contentLength, header, expectsPayload)
  7871. } else {
  7872. assert(false)
  7873. }
  7874. return true
  7875. }
  7876. function writeStream (abort, body, client, request, socket, contentLength, header, expectsPayload) {
  7877. assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined')
  7878. let finished = false
  7879. const writer = new AsyncWriter({ abort, socket, request, contentLength, client, expectsPayload, header })
  7880. const onData = function (chunk) {
  7881. if (finished) {
  7882. return
  7883. }
  7884. try {
  7885. if (!writer.write(chunk) && this.pause) {
  7886. this.pause()
  7887. }
  7888. } catch (err) {
  7889. util.destroy(this, err)
  7890. }
  7891. }
  7892. const onDrain = function () {
  7893. if (finished) {
  7894. return
  7895. }
  7896. if (body.resume) {
  7897. body.resume()
  7898. }
  7899. }
  7900. const onClose = function () {
  7901. // 'close' might be emitted *before* 'error' for
  7902. // broken streams. Wait a tick to avoid this case.
  7903. queueMicrotask(() => {
  7904. // It's only safe to remove 'error' listener after
  7905. // 'close'.
  7906. body.removeListener('error', onFinished)
  7907. })
  7908. if (!finished) {
  7909. const err = new RequestAbortedError()
  7910. queueMicrotask(() => onFinished(err))
  7911. }
  7912. }
  7913. const onFinished = function (err) {
  7914. if (finished) {
  7915. return
  7916. }
  7917. finished = true
  7918. assert(socket.destroyed || (socket[kWriting] && client[kRunning] <= 1))
  7919. socket
  7920. .off('drain', onDrain)
  7921. .off('error', onFinished)
  7922. body
  7923. .removeListener('data', onData)
  7924. .removeListener('end', onFinished)
  7925. .removeListener('close', onClose)
  7926. if (!err) {
  7927. try {
  7928. writer.end()
  7929. } catch (er) {
  7930. err = er
  7931. }
  7932. }
  7933. writer.destroy(err)
  7934. if (err && (err.code !== 'UND_ERR_INFO' || err.message !== 'reset')) {
  7935. util.destroy(body, err)
  7936. } else {
  7937. util.destroy(body)
  7938. }
  7939. }
  7940. body
  7941. .on('data', onData)
  7942. .on('end', onFinished)
  7943. .on('error', onFinished)
  7944. .on('close', onClose)
  7945. if (body.resume) {
  7946. body.resume()
  7947. }
  7948. socket
  7949. .on('drain', onDrain)
  7950. .on('error', onFinished)
  7951. if (body.errorEmitted ?? body.errored) {
  7952. setImmediate(() => onFinished(body.errored))
  7953. } else if (body.endEmitted ?? body.readableEnded) {
  7954. setImmediate(() => onFinished(null))
  7955. }
  7956. if (body.closeEmitted ?? body.closed) {
  7957. setImmediate(onClose)
  7958. }
  7959. }
  7960. function writeBuffer (abort, body, client, request, socket, contentLength, header, expectsPayload) {
  7961. try {
  7962. if (!body) {
  7963. if (contentLength === 0) {
  7964. socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1')
  7965. } else {
  7966. assert(contentLength === null, 'no body must not have content length')
  7967. socket.write(`${header}\r\n`, 'latin1')
  7968. }
  7969. } else if (util.isBuffer(body)) {
  7970. assert(contentLength === body.byteLength, 'buffer body must have content length')
  7971. socket.cork()
  7972. socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1')
  7973. socket.write(body)
  7974. socket.uncork()
  7975. request.onBodySent(body)
  7976. if (!expectsPayload && request.reset !== false) {
  7977. socket[kReset] = true
  7978. }
  7979. }
  7980. request.onRequestSent()
  7981. client[kResume]()
  7982. } catch (err) {
  7983. abort(err)
  7984. }
  7985. }
  7986. async function writeBlob (abort, body, client, request, socket, contentLength, header, expectsPayload) {
  7987. assert(contentLength === body.size, 'blob body must have content length')
  7988. try {
  7989. if (contentLength != null && contentLength !== body.size) {
  7990. throw new RequestContentLengthMismatchError()
  7991. }
  7992. const buffer = Buffer.from(await body.arrayBuffer())
  7993. socket.cork()
  7994. socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1')
  7995. socket.write(buffer)
  7996. socket.uncork()
  7997. request.onBodySent(buffer)
  7998. request.onRequestSent()
  7999. if (!expectsPayload && request.reset !== false) {
  8000. socket[kReset] = true
  8001. }
  8002. client[kResume]()
  8003. } catch (err) {
  8004. abort(err)
  8005. }
  8006. }
  8007. async function writeIterable (abort, body, client, request, socket, contentLength, header, expectsPayload) {
  8008. assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined')
  8009. let callback = null
  8010. function onDrain () {
  8011. if (callback) {
  8012. const cb = callback
  8013. callback = null
  8014. cb()
  8015. }
  8016. }
  8017. const waitForDrain = () => new Promise((resolve, reject) => {
  8018. assert(callback === null)
  8019. if (socket[kError]) {
  8020. reject(socket[kError])
  8021. } else {
  8022. callback = resolve
  8023. }
  8024. })
  8025. socket
  8026. .on('close', onDrain)
  8027. .on('drain', onDrain)
  8028. const writer = new AsyncWriter({ abort, socket, request, contentLength, client, expectsPayload, header })
  8029. try {
  8030. // It's up to the user to somehow abort the async iterable.
  8031. for await (const chunk of body) {
  8032. if (socket[kError]) {
  8033. throw socket[kError]
  8034. }
  8035. if (!writer.write(chunk)) {
  8036. await waitForDrain()
  8037. }
  8038. }
  8039. writer.end()
  8040. } catch (err) {
  8041. writer.destroy(err)
  8042. } finally {
  8043. socket
  8044. .off('close', onDrain)
  8045. .off('drain', onDrain)
  8046. }
  8047. }
  8048. class AsyncWriter {
  8049. constructor ({ abort, socket, request, contentLength, client, expectsPayload, header }) {
  8050. this.socket = socket
  8051. this.request = request
  8052. this.contentLength = contentLength
  8053. this.client = client
  8054. this.bytesWritten = 0
  8055. this.expectsPayload = expectsPayload
  8056. this.header = header
  8057. this.abort = abort
  8058. socket[kWriting] = true
  8059. }
  8060. write (chunk) {
  8061. const { socket, request, contentLength, client, bytesWritten, expectsPayload, header } = this
  8062. if (socket[kError]) {
  8063. throw socket[kError]
  8064. }
  8065. if (socket.destroyed) {
  8066. return false
  8067. }
  8068. const len = Buffer.byteLength(chunk)
  8069. if (!len) {
  8070. return true
  8071. }
  8072. // We should defer writing chunks.
  8073. if (contentLength !== null && bytesWritten + len > contentLength) {
  8074. if (client[kStrictContentLength]) {
  8075. throw new RequestContentLengthMismatchError()
  8076. }
  8077. process.emitWarning(new RequestContentLengthMismatchError())
  8078. }
  8079. socket.cork()
  8080. if (bytesWritten === 0) {
  8081. if (!expectsPayload && request.reset !== false) {
  8082. socket[kReset] = true
  8083. }
  8084. if (contentLength === null) {
  8085. socket.write(`${header}transfer-encoding: chunked\r\n`, 'latin1')
  8086. } else {
  8087. socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1')
  8088. }
  8089. }
  8090. if (contentLength === null) {
  8091. socket.write(`\r\n${len.toString(16)}\r\n`, 'latin1')
  8092. }
  8093. this.bytesWritten += len
  8094. const ret = socket.write(chunk)
  8095. socket.uncork()
  8096. request.onBodySent(chunk)
  8097. if (!ret) {
  8098. if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
  8099. // istanbul ignore else: only for jest
  8100. if (socket[kParser].timeout.refresh) {
  8101. socket[kParser].timeout.refresh()
  8102. }
  8103. }
  8104. }
  8105. return ret
  8106. }
  8107. end () {
  8108. const { socket, contentLength, client, bytesWritten, expectsPayload, header, request } = this
  8109. request.onRequestSent()
  8110. socket[kWriting] = false
  8111. if (socket[kError]) {
  8112. throw socket[kError]
  8113. }
  8114. if (socket.destroyed) {
  8115. return
  8116. }
  8117. if (bytesWritten === 0) {
  8118. if (expectsPayload) {
  8119. // https://tools.ietf.org/html/rfc7230#section-3.3.2
  8120. // A user agent SHOULD send a Content-Length in a request message when
  8121. // no Transfer-Encoding is sent and the request method defines a meaning
  8122. // for an enclosed payload body.
  8123. socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1')
  8124. } else {
  8125. socket.write(`${header}\r\n`, 'latin1')
  8126. }
  8127. } else if (contentLength === null) {
  8128. socket.write('\r\n0\r\n\r\n', 'latin1')
  8129. }
  8130. if (contentLength !== null && bytesWritten !== contentLength) {
  8131. if (client[kStrictContentLength]) {
  8132. throw new RequestContentLengthMismatchError()
  8133. } else {
  8134. process.emitWarning(new RequestContentLengthMismatchError())
  8135. }
  8136. }
  8137. if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
  8138. // istanbul ignore else: only for jest
  8139. if (socket[kParser].timeout.refresh) {
  8140. socket[kParser].timeout.refresh()
  8141. }
  8142. }
  8143. client[kResume]()
  8144. }
  8145. destroy (err) {
  8146. const { socket, client, abort } = this
  8147. socket[kWriting] = false
  8148. if (err) {
  8149. assert(client[kRunning] <= 1, 'pipeline should only contain this request')
  8150. abort(err)
  8151. }
  8152. }
  8153. }
  8154. module.exports = connectH1
  8155. /***/ }),
  8156. /***/ 8788:
  8157. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  8158. const assert = __nccwpck_require__(4589)
  8159. const { pipeline } = __nccwpck_require__(7075)
  8160. const util = __nccwpck_require__(3440)
  8161. const {
  8162. RequestContentLengthMismatchError,
  8163. RequestAbortedError,
  8164. SocketError,
  8165. InformationalError
  8166. } = __nccwpck_require__(8707)
  8167. const {
  8168. kUrl,
  8169. kReset,
  8170. kClient,
  8171. kRunning,
  8172. kPending,
  8173. kQueue,
  8174. kPendingIdx,
  8175. kRunningIdx,
  8176. kError,
  8177. kSocket,
  8178. kStrictContentLength,
  8179. kOnError,
  8180. kMaxConcurrentStreams,
  8181. kHTTP2Session,
  8182. kResume,
  8183. kSize,
  8184. kHTTPContext
  8185. } = __nccwpck_require__(6443)
  8186. const kOpenStreams = Symbol('open streams')
  8187. let extractBody
  8188. // Experimental
  8189. let h2ExperimentalWarned = false
  8190. /** @type {import('http2')} */
  8191. let http2
  8192. try {
  8193. http2 = __nccwpck_require__(2467)
  8194. } catch {
  8195. // @ts-ignore
  8196. http2 = { constants: {} }
  8197. }
  8198. const {
  8199. constants: {
  8200. HTTP2_HEADER_AUTHORITY,
  8201. HTTP2_HEADER_METHOD,
  8202. HTTP2_HEADER_PATH,
  8203. HTTP2_HEADER_SCHEME,
  8204. HTTP2_HEADER_CONTENT_LENGTH,
  8205. HTTP2_HEADER_EXPECT,
  8206. HTTP2_HEADER_STATUS
  8207. }
  8208. } = http2
  8209. function parseH2Headers (headers) {
  8210. const result = []
  8211. for (const [name, value] of Object.entries(headers)) {
  8212. // h2 may concat the header value by array
  8213. // e.g. Set-Cookie
  8214. if (Array.isArray(value)) {
  8215. for (const subvalue of value) {
  8216. // we need to provide each header value of header name
  8217. // because the headers handler expect name-value pair
  8218. result.push(Buffer.from(name), Buffer.from(subvalue))
  8219. }
  8220. } else {
  8221. result.push(Buffer.from(name), Buffer.from(value))
  8222. }
  8223. }
  8224. return result
  8225. }
  8226. async function connectH2 (client, socket) {
  8227. client[kSocket] = socket
  8228. if (!h2ExperimentalWarned) {
  8229. h2ExperimentalWarned = true
  8230. process.emitWarning('H2 support is experimental, expect them to change at any time.', {
  8231. code: 'UNDICI-H2'
  8232. })
  8233. }
  8234. const session = http2.connect(client[kUrl], {
  8235. createConnection: () => socket,
  8236. peerMaxConcurrentStreams: client[kMaxConcurrentStreams]
  8237. })
  8238. session[kOpenStreams] = 0
  8239. session[kClient] = client
  8240. session[kSocket] = socket
  8241. util.addListener(session, 'error', onHttp2SessionError)
  8242. util.addListener(session, 'frameError', onHttp2FrameError)
  8243. util.addListener(session, 'end', onHttp2SessionEnd)
  8244. util.addListener(session, 'goaway', onHTTP2GoAway)
  8245. util.addListener(session, 'close', function () {
  8246. const { [kClient]: client } = this
  8247. const { [kSocket]: socket } = client
  8248. const err = this[kSocket][kError] || this[kError] || new SocketError('closed', util.getSocketInfo(socket))
  8249. client[kHTTP2Session] = null
  8250. if (client.destroyed) {
  8251. assert(client[kPending] === 0)
  8252. // Fail entire queue.
  8253. const requests = client[kQueue].splice(client[kRunningIdx])
  8254. for (let i = 0; i < requests.length; i++) {
  8255. const request = requests[i]
  8256. util.errorRequest(client, request, err)
  8257. }
  8258. }
  8259. })
  8260. session.unref()
  8261. client[kHTTP2Session] = session
  8262. socket[kHTTP2Session] = session
  8263. util.addListener(socket, 'error', function (err) {
  8264. assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
  8265. this[kError] = err
  8266. this[kClient][kOnError](err)
  8267. })
  8268. util.addListener(socket, 'end', function () {
  8269. util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this)))
  8270. })
  8271. util.addListener(socket, 'close', function () {
  8272. const err = this[kError] || new SocketError('closed', util.getSocketInfo(this))
  8273. client[kSocket] = null
  8274. if (this[kHTTP2Session] != null) {
  8275. this[kHTTP2Session].destroy(err)
  8276. }
  8277. client[kPendingIdx] = client[kRunningIdx]
  8278. assert(client[kRunning] === 0)
  8279. client.emit('disconnect', client[kUrl], [client], err)
  8280. client[kResume]()
  8281. })
  8282. let closed = false
  8283. socket.on('close', () => {
  8284. closed = true
  8285. })
  8286. return {
  8287. version: 'h2',
  8288. defaultPipelining: Infinity,
  8289. write (...args) {
  8290. return writeH2(client, ...args)
  8291. },
  8292. resume () {
  8293. resumeH2(client)
  8294. },
  8295. destroy (err, callback) {
  8296. if (closed) {
  8297. queueMicrotask(callback)
  8298. } else {
  8299. // Destroying the socket will trigger the session close
  8300. socket.destroy(err).on('close', callback)
  8301. }
  8302. },
  8303. get destroyed () {
  8304. return socket.destroyed
  8305. },
  8306. busy () {
  8307. return false
  8308. }
  8309. }
  8310. }
  8311. function resumeH2 (client) {
  8312. const socket = client[kSocket]
  8313. if (socket?.destroyed === false) {
  8314. if (client[kSize] === 0 && client[kMaxConcurrentStreams] === 0) {
  8315. socket.unref()
  8316. client[kHTTP2Session].unref()
  8317. } else {
  8318. socket.ref()
  8319. client[kHTTP2Session].ref()
  8320. }
  8321. }
  8322. }
  8323. function onHttp2SessionError (err) {
  8324. assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
  8325. this[kSocket][kError] = err
  8326. this[kClient][kOnError](err)
  8327. }
  8328. function onHttp2FrameError (type, code, id) {
  8329. if (id === 0) {
  8330. const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`)
  8331. this[kSocket][kError] = err
  8332. this[kClient][kOnError](err)
  8333. }
  8334. }
  8335. function onHttp2SessionEnd () {
  8336. const err = new SocketError('other side closed', util.getSocketInfo(this[kSocket]))
  8337. this.destroy(err)
  8338. util.destroy(this[kSocket], err)
  8339. }
  8340. /**
  8341. * This is the root cause of #3011
  8342. * We need to handle GOAWAY frames properly, and trigger the session close
  8343. * along with the socket right away
  8344. */
  8345. function onHTTP2GoAway (code) {
  8346. // We cannot recover, so best to close the session and the socket
  8347. const err = this[kError] || new SocketError(`HTTP/2: "GOAWAY" frame received with code ${code}`, util.getSocketInfo(this))
  8348. const client = this[kClient]
  8349. client[kSocket] = null
  8350. client[kHTTPContext] = null
  8351. if (this[kHTTP2Session] != null) {
  8352. this[kHTTP2Session].destroy(err)
  8353. this[kHTTP2Session] = null
  8354. }
  8355. util.destroy(this[kSocket], err)
  8356. // Fail head of pipeline.
  8357. if (client[kRunningIdx] < client[kQueue].length) {
  8358. const request = client[kQueue][client[kRunningIdx]]
  8359. client[kQueue][client[kRunningIdx]++] = null
  8360. util.errorRequest(client, request, err)
  8361. client[kPendingIdx] = client[kRunningIdx]
  8362. }
  8363. assert(client[kRunning] === 0)
  8364. client.emit('disconnect', client[kUrl], [client], err)
  8365. client[kResume]()
  8366. }
  8367. // https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2
  8368. function shouldSendContentLength (method) {
  8369. return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
  8370. }
  8371. function writeH2 (client, request) {
  8372. const session = client[kHTTP2Session]
  8373. const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request
  8374. let { body } = request
  8375. if (upgrade) {
  8376. util.errorRequest(client, request, new Error('Upgrade not supported for H2'))
  8377. return false
  8378. }
  8379. const headers = {}
  8380. for (let n = 0; n < reqHeaders.length; n += 2) {
  8381. const key = reqHeaders[n + 0]
  8382. const val = reqHeaders[n + 1]
  8383. if (Array.isArray(val)) {
  8384. for (let i = 0; i < val.length; i++) {
  8385. if (headers[key]) {
  8386. headers[key] += `,${val[i]}`
  8387. } else {
  8388. headers[key] = val[i]
  8389. }
  8390. }
  8391. } else {
  8392. headers[key] = val
  8393. }
  8394. }
  8395. /** @type {import('node:http2').ClientHttp2Stream} */
  8396. let stream
  8397. const { hostname, port } = client[kUrl]
  8398. headers[HTTP2_HEADER_AUTHORITY] = host || `${hostname}${port ? `:${port}` : ''}`
  8399. headers[HTTP2_HEADER_METHOD] = method
  8400. const abort = (err) => {
  8401. if (request.aborted || request.completed) {
  8402. return
  8403. }
  8404. err = err || new RequestAbortedError()
  8405. util.errorRequest(client, request, err)
  8406. if (stream != null) {
  8407. util.destroy(stream, err)
  8408. }
  8409. // We do not destroy the socket as we can continue using the session
  8410. // the stream get's destroyed and the session remains to create new streams
  8411. util.destroy(body, err)
  8412. client[kQueue][client[kRunningIdx]++] = null
  8413. client[kResume]()
  8414. }
  8415. try {
  8416. // We are already connected, streams are pending.
  8417. // We can call on connect, and wait for abort
  8418. request.onConnect(abort)
  8419. } catch (err) {
  8420. util.errorRequest(client, request, err)
  8421. }
  8422. if (request.aborted) {
  8423. return false
  8424. }
  8425. if (method === 'CONNECT') {
  8426. session.ref()
  8427. // We are already connected, streams are pending, first request
  8428. // will create a new stream. We trigger a request to create the stream and wait until
  8429. // `ready` event is triggered
  8430. // We disabled endStream to allow the user to write to the stream
  8431. stream = session.request(headers, { endStream: false, signal })
  8432. if (stream.id && !stream.pending) {
  8433. request.onUpgrade(null, null, stream)
  8434. ++session[kOpenStreams]
  8435. client[kQueue][client[kRunningIdx]++] = null
  8436. } else {
  8437. stream.once('ready', () => {
  8438. request.onUpgrade(null, null, stream)
  8439. ++session[kOpenStreams]
  8440. client[kQueue][client[kRunningIdx]++] = null
  8441. })
  8442. }
  8443. stream.once('close', () => {
  8444. session[kOpenStreams] -= 1
  8445. if (session[kOpenStreams] === 0) session.unref()
  8446. })
  8447. return true
  8448. }
  8449. // https://tools.ietf.org/html/rfc7540#section-8.3
  8450. // :path and :scheme headers must be omitted when sending CONNECT
  8451. headers[HTTP2_HEADER_PATH] = path
  8452. headers[HTTP2_HEADER_SCHEME] = 'https'
  8453. // https://tools.ietf.org/html/rfc7231#section-4.3.1
  8454. // https://tools.ietf.org/html/rfc7231#section-4.3.2
  8455. // https://tools.ietf.org/html/rfc7231#section-4.3.5
  8456. // Sending a payload body on a request that does not
  8457. // expect it can cause undefined behavior on some
  8458. // servers and corrupt connection state. Do not
  8459. // re-use the connection for further requests.
  8460. const expectsPayload = (
  8461. method === 'PUT' ||
  8462. method === 'POST' ||
  8463. method === 'PATCH'
  8464. )
  8465. if (body && typeof body.read === 'function') {
  8466. // Try to read EOF in order to get length.
  8467. body.read(0)
  8468. }
  8469. let contentLength = util.bodyLength(body)
  8470. if (util.isFormDataLike(body)) {
  8471. extractBody ??= (__nccwpck_require__(4492).extractBody)
  8472. const [bodyStream, contentType] = extractBody(body)
  8473. headers['content-type'] = contentType
  8474. body = bodyStream.stream
  8475. contentLength = bodyStream.length
  8476. }
  8477. if (contentLength == null) {
  8478. contentLength = request.contentLength
  8479. }
  8480. if (contentLength === 0 || !expectsPayload) {
  8481. // https://tools.ietf.org/html/rfc7230#section-3.3.2
  8482. // A user agent SHOULD NOT send a Content-Length header field when
  8483. // the request message does not contain a payload body and the method
  8484. // semantics do not anticipate such a body.
  8485. contentLength = null
  8486. }
  8487. // https://github.com/nodejs/undici/issues/2046
  8488. // A user agent may send a Content-Length header with 0 value, this should be allowed.
  8489. if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength != null && request.contentLength !== contentLength) {
  8490. if (client[kStrictContentLength]) {
  8491. util.errorRequest(client, request, new RequestContentLengthMismatchError())
  8492. return false
  8493. }
  8494. process.emitWarning(new RequestContentLengthMismatchError())
  8495. }
  8496. if (contentLength != null) {
  8497. assert(body, 'no body must not have content length')
  8498. headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}`
  8499. }
  8500. session.ref()
  8501. const shouldEndStream = method === 'GET' || method === 'HEAD' || body === null
  8502. if (expectContinue) {
  8503. headers[HTTP2_HEADER_EXPECT] = '100-continue'
  8504. stream = session.request(headers, { endStream: shouldEndStream, signal })
  8505. stream.once('continue', writeBodyH2)
  8506. } else {
  8507. stream = session.request(headers, {
  8508. endStream: shouldEndStream,
  8509. signal
  8510. })
  8511. writeBodyH2()
  8512. }
  8513. // Increment counter as we have new streams open
  8514. ++session[kOpenStreams]
  8515. stream.once('response', headers => {
  8516. const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers
  8517. request.onResponseStarted()
  8518. // Due to the stream nature, it is possible we face a race condition
  8519. // where the stream has been assigned, but the request has been aborted
  8520. // the request remains in-flight and headers hasn't been received yet
  8521. // for those scenarios, best effort is to destroy the stream immediately
  8522. // as there's no value to keep it open.
  8523. if (request.aborted) {
  8524. const err = new RequestAbortedError()
  8525. util.errorRequest(client, request, err)
  8526. util.destroy(stream, err)
  8527. return
  8528. }
  8529. if (request.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), '') === false) {
  8530. stream.pause()
  8531. }
  8532. stream.on('data', (chunk) => {
  8533. if (request.onData(chunk) === false) {
  8534. stream.pause()
  8535. }
  8536. })
  8537. })
  8538. stream.once('end', () => {
  8539. // When state is null, it means we haven't consumed body and the stream still do not have
  8540. // a state.
  8541. // Present specially when using pipeline or stream
  8542. if (stream.state?.state == null || stream.state.state < 6) {
  8543. request.onComplete([])
  8544. }
  8545. if (session[kOpenStreams] === 0) {
  8546. // Stream is closed or half-closed-remote (6), decrement counter and cleanup
  8547. // It does not have sense to continue working with the stream as we do not
  8548. // have yet RST_STREAM support on client-side
  8549. session.unref()
  8550. }
  8551. abort(new InformationalError('HTTP/2: stream half-closed (remote)'))
  8552. client[kQueue][client[kRunningIdx]++] = null
  8553. client[kPendingIdx] = client[kRunningIdx]
  8554. client[kResume]()
  8555. })
  8556. stream.once('close', () => {
  8557. session[kOpenStreams] -= 1
  8558. if (session[kOpenStreams] === 0) {
  8559. session.unref()
  8560. }
  8561. })
  8562. stream.once('error', function (err) {
  8563. abort(err)
  8564. })
  8565. stream.once('frameError', (type, code) => {
  8566. abort(new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`))
  8567. })
  8568. // stream.on('aborted', () => {
  8569. // // TODO(HTTP/2): Support aborted
  8570. // })
  8571. // stream.on('timeout', () => {
  8572. // // TODO(HTTP/2): Support timeout
  8573. // })
  8574. // stream.on('push', headers => {
  8575. // // TODO(HTTP/2): Support push
  8576. // })
  8577. // stream.on('trailers', headers => {
  8578. // // TODO(HTTP/2): Support trailers
  8579. // })
  8580. return true
  8581. function writeBodyH2 () {
  8582. /* istanbul ignore else: assertion */
  8583. if (!body || contentLength === 0) {
  8584. writeBuffer(
  8585. abort,
  8586. stream,
  8587. null,
  8588. client,
  8589. request,
  8590. client[kSocket],
  8591. contentLength,
  8592. expectsPayload
  8593. )
  8594. } else if (util.isBuffer(body)) {
  8595. writeBuffer(
  8596. abort,
  8597. stream,
  8598. body,
  8599. client,
  8600. request,
  8601. client[kSocket],
  8602. contentLength,
  8603. expectsPayload
  8604. )
  8605. } else if (util.isBlobLike(body)) {
  8606. if (typeof body.stream === 'function') {
  8607. writeIterable(
  8608. abort,
  8609. stream,
  8610. body.stream(),
  8611. client,
  8612. request,
  8613. client[kSocket],
  8614. contentLength,
  8615. expectsPayload
  8616. )
  8617. } else {
  8618. writeBlob(
  8619. abort,
  8620. stream,
  8621. body,
  8622. client,
  8623. request,
  8624. client[kSocket],
  8625. contentLength,
  8626. expectsPayload
  8627. )
  8628. }
  8629. } else if (util.isStream(body)) {
  8630. writeStream(
  8631. abort,
  8632. client[kSocket],
  8633. expectsPayload,
  8634. stream,
  8635. body,
  8636. client,
  8637. request,
  8638. contentLength
  8639. )
  8640. } else if (util.isIterable(body)) {
  8641. writeIterable(
  8642. abort,
  8643. stream,
  8644. body,
  8645. client,
  8646. request,
  8647. client[kSocket],
  8648. contentLength,
  8649. expectsPayload
  8650. )
  8651. } else {
  8652. assert(false)
  8653. }
  8654. }
  8655. }
  8656. function writeBuffer (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) {
  8657. try {
  8658. if (body != null && util.isBuffer(body)) {
  8659. assert(contentLength === body.byteLength, 'buffer body must have content length')
  8660. h2stream.cork()
  8661. h2stream.write(body)
  8662. h2stream.uncork()
  8663. h2stream.end()
  8664. request.onBodySent(body)
  8665. }
  8666. if (!expectsPayload) {
  8667. socket[kReset] = true
  8668. }
  8669. request.onRequestSent()
  8670. client[kResume]()
  8671. } catch (error) {
  8672. abort(error)
  8673. }
  8674. }
  8675. function writeStream (abort, socket, expectsPayload, h2stream, body, client, request, contentLength) {
  8676. assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined')
  8677. // For HTTP/2, is enough to pipe the stream
  8678. const pipe = pipeline(
  8679. body,
  8680. h2stream,
  8681. (err) => {
  8682. if (err) {
  8683. util.destroy(pipe, err)
  8684. abort(err)
  8685. } else {
  8686. util.removeAllListeners(pipe)
  8687. request.onRequestSent()
  8688. if (!expectsPayload) {
  8689. socket[kReset] = true
  8690. }
  8691. client[kResume]()
  8692. }
  8693. }
  8694. )
  8695. util.addListener(pipe, 'data', onPipeData)
  8696. function onPipeData (chunk) {
  8697. request.onBodySent(chunk)
  8698. }
  8699. }
  8700. async function writeBlob (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) {
  8701. assert(contentLength === body.size, 'blob body must have content length')
  8702. try {
  8703. if (contentLength != null && contentLength !== body.size) {
  8704. throw new RequestContentLengthMismatchError()
  8705. }
  8706. const buffer = Buffer.from(await body.arrayBuffer())
  8707. h2stream.cork()
  8708. h2stream.write(buffer)
  8709. h2stream.uncork()
  8710. h2stream.end()
  8711. request.onBodySent(buffer)
  8712. request.onRequestSent()
  8713. if (!expectsPayload) {
  8714. socket[kReset] = true
  8715. }
  8716. client[kResume]()
  8717. } catch (err) {
  8718. abort(err)
  8719. }
  8720. }
  8721. async function writeIterable (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) {
  8722. assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined')
  8723. let callback = null
  8724. function onDrain () {
  8725. if (callback) {
  8726. const cb = callback
  8727. callback = null
  8728. cb()
  8729. }
  8730. }
  8731. const waitForDrain = () => new Promise((resolve, reject) => {
  8732. assert(callback === null)
  8733. if (socket[kError]) {
  8734. reject(socket[kError])
  8735. } else {
  8736. callback = resolve
  8737. }
  8738. })
  8739. h2stream
  8740. .on('close', onDrain)
  8741. .on('drain', onDrain)
  8742. try {
  8743. // It's up to the user to somehow abort the async iterable.
  8744. for await (const chunk of body) {
  8745. if (socket[kError]) {
  8746. throw socket[kError]
  8747. }
  8748. const res = h2stream.write(chunk)
  8749. request.onBodySent(chunk)
  8750. if (!res) {
  8751. await waitForDrain()
  8752. }
  8753. }
  8754. h2stream.end()
  8755. request.onRequestSent()
  8756. if (!expectsPayload) {
  8757. socket[kReset] = true
  8758. }
  8759. client[kResume]()
  8760. } catch (err) {
  8761. abort(err)
  8762. } finally {
  8763. h2stream
  8764. .off('close', onDrain)
  8765. .off('drain', onDrain)
  8766. }
  8767. }
  8768. module.exports = connectH2
  8769. /***/ }),
  8770. /***/ 3701:
  8771. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  8772. // @ts-check
  8773. const assert = __nccwpck_require__(4589)
  8774. const net = __nccwpck_require__(7030)
  8775. const http = __nccwpck_require__(7067)
  8776. const util = __nccwpck_require__(3440)
  8777. const { channels } = __nccwpck_require__(2414)
  8778. const Request = __nccwpck_require__(4655)
  8779. const DispatcherBase = __nccwpck_require__(1841)
  8780. const {
  8781. InvalidArgumentError,
  8782. InformationalError,
  8783. ClientDestroyedError
  8784. } = __nccwpck_require__(8707)
  8785. const buildConnector = __nccwpck_require__(9136)
  8786. const {
  8787. kUrl,
  8788. kServerName,
  8789. kClient,
  8790. kBusy,
  8791. kConnect,
  8792. kResuming,
  8793. kRunning,
  8794. kPending,
  8795. kSize,
  8796. kQueue,
  8797. kConnected,
  8798. kConnecting,
  8799. kNeedDrain,
  8800. kKeepAliveDefaultTimeout,
  8801. kHostHeader,
  8802. kPendingIdx,
  8803. kRunningIdx,
  8804. kError,
  8805. kPipelining,
  8806. kKeepAliveTimeoutValue,
  8807. kMaxHeadersSize,
  8808. kKeepAliveMaxTimeout,
  8809. kKeepAliveTimeoutThreshold,
  8810. kHeadersTimeout,
  8811. kBodyTimeout,
  8812. kStrictContentLength,
  8813. kConnector,
  8814. kMaxRedirections,
  8815. kMaxRequests,
  8816. kCounter,
  8817. kClose,
  8818. kDestroy,
  8819. kDispatch,
  8820. kInterceptors,
  8821. kLocalAddress,
  8822. kMaxResponseSize,
  8823. kOnError,
  8824. kHTTPContext,
  8825. kMaxConcurrentStreams,
  8826. kResume
  8827. } = __nccwpck_require__(6443)
  8828. const connectH1 = __nccwpck_require__(637)
  8829. const connectH2 = __nccwpck_require__(8788)
  8830. let deprecatedInterceptorWarned = false
  8831. const kClosedResolve = Symbol('kClosedResolve')
  8832. const noop = () => {}
  8833. function getPipelining (client) {
  8834. return client[kPipelining] ?? client[kHTTPContext]?.defaultPipelining ?? 1
  8835. }
  8836. /**
  8837. * @type {import('../../types/client.js').default}
  8838. */
  8839. class Client extends DispatcherBase {
  8840. /**
  8841. *
  8842. * @param {string|URL} url
  8843. * @param {import('../../types/client.js').Client.Options} options
  8844. */
  8845. constructor (url, {
  8846. interceptors,
  8847. maxHeaderSize,
  8848. headersTimeout,
  8849. socketTimeout,
  8850. requestTimeout,
  8851. connectTimeout,
  8852. bodyTimeout,
  8853. idleTimeout,
  8854. keepAlive,
  8855. keepAliveTimeout,
  8856. maxKeepAliveTimeout,
  8857. keepAliveMaxTimeout,
  8858. keepAliveTimeoutThreshold,
  8859. socketPath,
  8860. pipelining,
  8861. tls,
  8862. strictContentLength,
  8863. maxCachedSessions,
  8864. maxRedirections,
  8865. connect,
  8866. maxRequestsPerClient,
  8867. localAddress,
  8868. maxResponseSize,
  8869. autoSelectFamily,
  8870. autoSelectFamilyAttemptTimeout,
  8871. // h2
  8872. maxConcurrentStreams,
  8873. allowH2,
  8874. webSocket
  8875. } = {}) {
  8876. super({ webSocket })
  8877. if (keepAlive !== undefined) {
  8878. throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
  8879. }
  8880. if (socketTimeout !== undefined) {
  8881. throw new InvalidArgumentError('unsupported socketTimeout, use headersTimeout & bodyTimeout instead')
  8882. }
  8883. if (requestTimeout !== undefined) {
  8884. throw new InvalidArgumentError('unsupported requestTimeout, use headersTimeout & bodyTimeout instead')
  8885. }
  8886. if (idleTimeout !== undefined) {
  8887. throw new InvalidArgumentError('unsupported idleTimeout, use keepAliveTimeout instead')
  8888. }
  8889. if (maxKeepAliveTimeout !== undefined) {
  8890. throw new InvalidArgumentError('unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead')
  8891. }
  8892. if (maxHeaderSize != null && !Number.isFinite(maxHeaderSize)) {
  8893. throw new InvalidArgumentError('invalid maxHeaderSize')
  8894. }
  8895. if (socketPath != null && typeof socketPath !== 'string') {
  8896. throw new InvalidArgumentError('invalid socketPath')
  8897. }
  8898. if (connectTimeout != null && (!Number.isFinite(connectTimeout) || connectTimeout < 0)) {
  8899. throw new InvalidArgumentError('invalid connectTimeout')
  8900. }
  8901. if (keepAliveTimeout != null && (!Number.isFinite(keepAliveTimeout) || keepAliveTimeout <= 0)) {
  8902. throw new InvalidArgumentError('invalid keepAliveTimeout')
  8903. }
  8904. if (keepAliveMaxTimeout != null && (!Number.isFinite(keepAliveMaxTimeout) || keepAliveMaxTimeout <= 0)) {
  8905. throw new InvalidArgumentError('invalid keepAliveMaxTimeout')
  8906. }
  8907. if (keepAliveTimeoutThreshold != null && !Number.isFinite(keepAliveTimeoutThreshold)) {
  8908. throw new InvalidArgumentError('invalid keepAliveTimeoutThreshold')
  8909. }
  8910. if (headersTimeout != null && (!Number.isInteger(headersTimeout) || headersTimeout < 0)) {
  8911. throw new InvalidArgumentError('headersTimeout must be a positive integer or zero')
  8912. }
  8913. if (bodyTimeout != null && (!Number.isInteger(bodyTimeout) || bodyTimeout < 0)) {
  8914. throw new InvalidArgumentError('bodyTimeout must be a positive integer or zero')
  8915. }
  8916. if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
  8917. throw new InvalidArgumentError('connect must be a function or an object')
  8918. }
  8919. if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
  8920. throw new InvalidArgumentError('maxRedirections must be a positive number')
  8921. }
  8922. if (maxRequestsPerClient != null && (!Number.isInteger(maxRequestsPerClient) || maxRequestsPerClient < 0)) {
  8923. throw new InvalidArgumentError('maxRequestsPerClient must be a positive number')
  8924. }
  8925. if (localAddress != null && (typeof localAddress !== 'string' || net.isIP(localAddress) === 0)) {
  8926. throw new InvalidArgumentError('localAddress must be valid string IP address')
  8927. }
  8928. if (maxResponseSize != null && (!Number.isInteger(maxResponseSize) || maxResponseSize < -1)) {
  8929. throw new InvalidArgumentError('maxResponseSize must be a positive number')
  8930. }
  8931. if (
  8932. autoSelectFamilyAttemptTimeout != null &&
  8933. (!Number.isInteger(autoSelectFamilyAttemptTimeout) || autoSelectFamilyAttemptTimeout < -1)
  8934. ) {
  8935. throw new InvalidArgumentError('autoSelectFamilyAttemptTimeout must be a positive number')
  8936. }
  8937. // h2
  8938. if (allowH2 != null && typeof allowH2 !== 'boolean') {
  8939. throw new InvalidArgumentError('allowH2 must be a valid boolean value')
  8940. }
  8941. if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== 'number' || maxConcurrentStreams < 1)) {
  8942. throw new InvalidArgumentError('maxConcurrentStreams must be a positive integer, greater than 0')
  8943. }
  8944. if (typeof connect !== 'function') {
  8945. connect = buildConnector({
  8946. ...tls,
  8947. maxCachedSessions,
  8948. allowH2,
  8949. socketPath,
  8950. timeout: connectTimeout,
  8951. ...(autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined),
  8952. ...connect
  8953. })
  8954. }
  8955. if (interceptors?.Client && Array.isArray(interceptors.Client)) {
  8956. this[kInterceptors] = interceptors.Client
  8957. if (!deprecatedInterceptorWarned) {
  8958. deprecatedInterceptorWarned = true
  8959. process.emitWarning('Client.Options#interceptor is deprecated. Use Dispatcher#compose instead.', {
  8960. code: 'UNDICI-CLIENT-INTERCEPTOR-DEPRECATED'
  8961. })
  8962. }
  8963. } else {
  8964. this[kInterceptors] = [createRedirectInterceptor({ maxRedirections })]
  8965. }
  8966. this[kUrl] = util.parseOrigin(url)
  8967. this[kConnector] = connect
  8968. this[kPipelining] = pipelining != null ? pipelining : 1
  8969. this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize
  8970. this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout
  8971. this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout
  8972. this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 2e3 : keepAliveTimeoutThreshold
  8973. this[kKeepAliveTimeoutValue] = this[kKeepAliveDefaultTimeout]
  8974. this[kServerName] = null
  8975. this[kLocalAddress] = localAddress != null ? localAddress : null
  8976. this[kResuming] = 0 // 0, idle, 1, scheduled, 2 resuming
  8977. this[kNeedDrain] = 0 // 0, idle, 1, scheduled, 2 resuming
  8978. this[kHostHeader] = `host: ${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}\r\n`
  8979. this[kBodyTimeout] = bodyTimeout != null ? bodyTimeout : 300e3
  8980. this[kHeadersTimeout] = headersTimeout != null ? headersTimeout : 300e3
  8981. this[kStrictContentLength] = strictContentLength == null ? true : strictContentLength
  8982. this[kMaxRedirections] = maxRedirections
  8983. this[kMaxRequests] = maxRequestsPerClient
  8984. this[kClosedResolve] = null
  8985. this[kMaxResponseSize] = maxResponseSize > -1 ? maxResponseSize : -1
  8986. this[kMaxConcurrentStreams] = maxConcurrentStreams != null ? maxConcurrentStreams : 100 // Max peerConcurrentStreams for a Node h2 server
  8987. this[kHTTPContext] = null
  8988. // kQueue is built up of 3 sections separated by
  8989. // the kRunningIdx and kPendingIdx indices.
  8990. // | complete | running | pending |
  8991. // ^ kRunningIdx ^ kPendingIdx ^ kQueue.length
  8992. // kRunningIdx points to the first running element.
  8993. // kPendingIdx points to the first pending element.
  8994. // This implements a fast queue with an amortized
  8995. // time of O(1).
  8996. this[kQueue] = []
  8997. this[kRunningIdx] = 0
  8998. this[kPendingIdx] = 0
  8999. this[kResume] = (sync) => resume(this, sync)
  9000. this[kOnError] = (err) => onError(this, err)
  9001. }
  9002. get pipelining () {
  9003. return this[kPipelining]
  9004. }
  9005. set pipelining (value) {
  9006. this[kPipelining] = value
  9007. this[kResume](true)
  9008. }
  9009. get [kPending] () {
  9010. return this[kQueue].length - this[kPendingIdx]
  9011. }
  9012. get [kRunning] () {
  9013. return this[kPendingIdx] - this[kRunningIdx]
  9014. }
  9015. get [kSize] () {
  9016. return this[kQueue].length - this[kRunningIdx]
  9017. }
  9018. get [kConnected] () {
  9019. return !!this[kHTTPContext] && !this[kConnecting] && !this[kHTTPContext].destroyed
  9020. }
  9021. get [kBusy] () {
  9022. return Boolean(
  9023. this[kHTTPContext]?.busy(null) ||
  9024. (this[kSize] >= (getPipelining(this) || 1)) ||
  9025. this[kPending] > 0
  9026. )
  9027. }
  9028. /* istanbul ignore: only used for test */
  9029. [kConnect] (cb) {
  9030. connect(this)
  9031. this.once('connect', cb)
  9032. }
  9033. [kDispatch] (opts, handler) {
  9034. const origin = opts.origin || this[kUrl].origin
  9035. const request = new Request(origin, opts, handler)
  9036. this[kQueue].push(request)
  9037. if (this[kResuming]) {
  9038. // Do nothing.
  9039. } else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) {
  9040. // Wait a tick in case stream/iterator is ended in the same tick.
  9041. this[kResuming] = 1
  9042. queueMicrotask(() => resume(this))
  9043. } else {
  9044. this[kResume](true)
  9045. }
  9046. if (this[kResuming] && this[kNeedDrain] !== 2 && this[kBusy]) {
  9047. this[kNeedDrain] = 2
  9048. }
  9049. return this[kNeedDrain] < 2
  9050. }
  9051. async [kClose] () {
  9052. // TODO: for H2 we need to gracefully flush the remaining enqueued
  9053. // request and close each stream.
  9054. return new Promise((resolve) => {
  9055. if (this[kSize]) {
  9056. this[kClosedResolve] = resolve
  9057. } else {
  9058. resolve(null)
  9059. }
  9060. })
  9061. }
  9062. async [kDestroy] (err) {
  9063. return new Promise((resolve) => {
  9064. const requests = this[kQueue].splice(this[kPendingIdx])
  9065. for (let i = 0; i < requests.length; i++) {
  9066. const request = requests[i]
  9067. util.errorRequest(this, request, err)
  9068. }
  9069. const callback = () => {
  9070. if (this[kClosedResolve]) {
  9071. // TODO (fix): Should we error here with ClientDestroyedError?
  9072. this[kClosedResolve]()
  9073. this[kClosedResolve] = null
  9074. }
  9075. resolve(null)
  9076. }
  9077. if (this[kHTTPContext]) {
  9078. this[kHTTPContext].destroy(err, callback)
  9079. this[kHTTPContext] = null
  9080. } else {
  9081. queueMicrotask(callback)
  9082. }
  9083. this[kResume]()
  9084. })
  9085. }
  9086. }
  9087. const createRedirectInterceptor = __nccwpck_require__(5092)
  9088. function onError (client, err) {
  9089. if (
  9090. client[kRunning] === 0 &&
  9091. err.code !== 'UND_ERR_INFO' &&
  9092. err.code !== 'UND_ERR_SOCKET'
  9093. ) {
  9094. // Error is not caused by running request and not a recoverable
  9095. // socket error.
  9096. assert(client[kPendingIdx] === client[kRunningIdx])
  9097. const requests = client[kQueue].splice(client[kRunningIdx])
  9098. for (let i = 0; i < requests.length; i++) {
  9099. const request = requests[i]
  9100. util.errorRequest(client, request, err)
  9101. }
  9102. assert(client[kSize] === 0)
  9103. }
  9104. }
  9105. /**
  9106. * @param {Client} client
  9107. * @returns
  9108. */
  9109. async function connect (client) {
  9110. assert(!client[kConnecting])
  9111. assert(!client[kHTTPContext])
  9112. let { host, hostname, protocol, port } = client[kUrl]
  9113. // Resolve ipv6
  9114. if (hostname[0] === '[') {
  9115. const idx = hostname.indexOf(']')
  9116. assert(idx !== -1)
  9117. const ip = hostname.substring(1, idx)
  9118. assert(net.isIP(ip))
  9119. hostname = ip
  9120. }
  9121. client[kConnecting] = true
  9122. if (channels.beforeConnect.hasSubscribers) {
  9123. channels.beforeConnect.publish({
  9124. connectParams: {
  9125. host,
  9126. hostname,
  9127. protocol,
  9128. port,
  9129. version: client[kHTTPContext]?.version,
  9130. servername: client[kServerName],
  9131. localAddress: client[kLocalAddress]
  9132. },
  9133. connector: client[kConnector]
  9134. })
  9135. }
  9136. try {
  9137. const socket = await new Promise((resolve, reject) => {
  9138. client[kConnector]({
  9139. host,
  9140. hostname,
  9141. protocol,
  9142. port,
  9143. servername: client[kServerName],
  9144. localAddress: client[kLocalAddress]
  9145. }, (err, socket) => {
  9146. if (err) {
  9147. reject(err)
  9148. } else {
  9149. resolve(socket)
  9150. }
  9151. })
  9152. })
  9153. if (client.destroyed) {
  9154. util.destroy(socket.on('error', noop), new ClientDestroyedError())
  9155. return
  9156. }
  9157. assert(socket)
  9158. try {
  9159. client[kHTTPContext] = socket.alpnProtocol === 'h2'
  9160. ? await connectH2(client, socket)
  9161. : await connectH1(client, socket)
  9162. } catch (err) {
  9163. socket.destroy().on('error', noop)
  9164. throw err
  9165. }
  9166. client[kConnecting] = false
  9167. socket[kCounter] = 0
  9168. socket[kMaxRequests] = client[kMaxRequests]
  9169. socket[kClient] = client
  9170. socket[kError] = null
  9171. if (channels.connected.hasSubscribers) {
  9172. channels.connected.publish({
  9173. connectParams: {
  9174. host,
  9175. hostname,
  9176. protocol,
  9177. port,
  9178. version: client[kHTTPContext]?.version,
  9179. servername: client[kServerName],
  9180. localAddress: client[kLocalAddress]
  9181. },
  9182. connector: client[kConnector],
  9183. socket
  9184. })
  9185. }
  9186. client.emit('connect', client[kUrl], [client])
  9187. } catch (err) {
  9188. if (client.destroyed) {
  9189. return
  9190. }
  9191. client[kConnecting] = false
  9192. if (channels.connectError.hasSubscribers) {
  9193. channels.connectError.publish({
  9194. connectParams: {
  9195. host,
  9196. hostname,
  9197. protocol,
  9198. port,
  9199. version: client[kHTTPContext]?.version,
  9200. servername: client[kServerName],
  9201. localAddress: client[kLocalAddress]
  9202. },
  9203. connector: client[kConnector],
  9204. error: err
  9205. })
  9206. }
  9207. if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') {
  9208. assert(client[kRunning] === 0)
  9209. while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) {
  9210. const request = client[kQueue][client[kPendingIdx]++]
  9211. util.errorRequest(client, request, err)
  9212. }
  9213. } else {
  9214. onError(client, err)
  9215. }
  9216. client.emit('connectionError', client[kUrl], [client], err)
  9217. }
  9218. client[kResume]()
  9219. }
  9220. function emitDrain (client) {
  9221. client[kNeedDrain] = 0
  9222. client.emit('drain', client[kUrl], [client])
  9223. }
  9224. function resume (client, sync) {
  9225. if (client[kResuming] === 2) {
  9226. return
  9227. }
  9228. client[kResuming] = 2
  9229. _resume(client, sync)
  9230. client[kResuming] = 0
  9231. if (client[kRunningIdx] > 256) {
  9232. client[kQueue].splice(0, client[kRunningIdx])
  9233. client[kPendingIdx] -= client[kRunningIdx]
  9234. client[kRunningIdx] = 0
  9235. }
  9236. }
  9237. function _resume (client, sync) {
  9238. while (true) {
  9239. if (client.destroyed) {
  9240. assert(client[kPending] === 0)
  9241. return
  9242. }
  9243. if (client[kClosedResolve] && !client[kSize]) {
  9244. client[kClosedResolve]()
  9245. client[kClosedResolve] = null
  9246. return
  9247. }
  9248. if (client[kHTTPContext]) {
  9249. client[kHTTPContext].resume()
  9250. }
  9251. if (client[kBusy]) {
  9252. client[kNeedDrain] = 2
  9253. } else if (client[kNeedDrain] === 2) {
  9254. if (sync) {
  9255. client[kNeedDrain] = 1
  9256. queueMicrotask(() => emitDrain(client))
  9257. } else {
  9258. emitDrain(client)
  9259. }
  9260. continue
  9261. }
  9262. if (client[kPending] === 0) {
  9263. return
  9264. }
  9265. if (client[kRunning] >= (getPipelining(client) || 1)) {
  9266. return
  9267. }
  9268. const request = client[kQueue][client[kPendingIdx]]
  9269. if (client[kUrl].protocol === 'https:' && client[kServerName] !== request.servername) {
  9270. if (client[kRunning] > 0) {
  9271. return
  9272. }
  9273. client[kServerName] = request.servername
  9274. client[kHTTPContext]?.destroy(new InformationalError('servername changed'), () => {
  9275. client[kHTTPContext] = null
  9276. resume(client)
  9277. })
  9278. }
  9279. if (client[kConnecting]) {
  9280. return
  9281. }
  9282. if (!client[kHTTPContext]) {
  9283. connect(client)
  9284. return
  9285. }
  9286. if (client[kHTTPContext].destroyed) {
  9287. return
  9288. }
  9289. if (client[kHTTPContext].busy(request)) {
  9290. return
  9291. }
  9292. if (!request.aborted && client[kHTTPContext].write(request)) {
  9293. client[kPendingIdx]++
  9294. } else {
  9295. client[kQueue].splice(client[kPendingIdx], 1)
  9296. }
  9297. }
  9298. }
  9299. module.exports = Client
  9300. /***/ }),
  9301. /***/ 1841:
  9302. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9303. const Dispatcher = __nccwpck_require__(883)
  9304. const {
  9305. ClientDestroyedError,
  9306. ClientClosedError,
  9307. InvalidArgumentError
  9308. } = __nccwpck_require__(8707)
  9309. const { kDestroy, kClose, kClosed, kDestroyed, kDispatch, kInterceptors } = __nccwpck_require__(6443)
  9310. const kOnDestroyed = Symbol('onDestroyed')
  9311. const kOnClosed = Symbol('onClosed')
  9312. const kInterceptedDispatch = Symbol('Intercepted Dispatch')
  9313. const kWebSocketOptions = Symbol('webSocketOptions')
  9314. class DispatcherBase extends Dispatcher {
  9315. constructor (opts) {
  9316. super()
  9317. this[kDestroyed] = false
  9318. this[kOnDestroyed] = null
  9319. this[kClosed] = false
  9320. this[kOnClosed] = []
  9321. this[kWebSocketOptions] = opts?.webSocket ?? {}
  9322. }
  9323. get webSocketOptions () {
  9324. return {
  9325. maxFragments: this[kWebSocketOptions].maxFragments ?? 131072,
  9326. maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
  9327. }
  9328. }
  9329. get destroyed () {
  9330. return this[kDestroyed]
  9331. }
  9332. get closed () {
  9333. return this[kClosed]
  9334. }
  9335. get interceptors () {
  9336. return this[kInterceptors]
  9337. }
  9338. set interceptors (newInterceptors) {
  9339. if (newInterceptors) {
  9340. for (let i = newInterceptors.length - 1; i >= 0; i--) {
  9341. const interceptor = this[kInterceptors][i]
  9342. if (typeof interceptor !== 'function') {
  9343. throw new InvalidArgumentError('interceptor must be an function')
  9344. }
  9345. }
  9346. }
  9347. this[kInterceptors] = newInterceptors
  9348. }
  9349. close (callback) {
  9350. if (callback === undefined) {
  9351. return new Promise((resolve, reject) => {
  9352. this.close((err, data) => {
  9353. return err ? reject(err) : resolve(data)
  9354. })
  9355. })
  9356. }
  9357. if (typeof callback !== 'function') {
  9358. throw new InvalidArgumentError('invalid callback')
  9359. }
  9360. if (this[kDestroyed]) {
  9361. queueMicrotask(() => callback(new ClientDestroyedError(), null))
  9362. return
  9363. }
  9364. if (this[kClosed]) {
  9365. if (this[kOnClosed]) {
  9366. this[kOnClosed].push(callback)
  9367. } else {
  9368. queueMicrotask(() => callback(null, null))
  9369. }
  9370. return
  9371. }
  9372. this[kClosed] = true
  9373. this[kOnClosed].push(callback)
  9374. const onClosed = () => {
  9375. const callbacks = this[kOnClosed]
  9376. this[kOnClosed] = null
  9377. for (let i = 0; i < callbacks.length; i++) {
  9378. callbacks[i](null, null)
  9379. }
  9380. }
  9381. // Should not error.
  9382. this[kClose]()
  9383. .then(() => this.destroy())
  9384. .then(() => {
  9385. queueMicrotask(onClosed)
  9386. })
  9387. }
  9388. destroy (err, callback) {
  9389. if (typeof err === 'function') {
  9390. callback = err
  9391. err = null
  9392. }
  9393. if (callback === undefined) {
  9394. return new Promise((resolve, reject) => {
  9395. this.destroy(err, (err, data) => {
  9396. return err ? /* istanbul ignore next: should never error */ reject(err) : resolve(data)
  9397. })
  9398. })
  9399. }
  9400. if (typeof callback !== 'function') {
  9401. throw new InvalidArgumentError('invalid callback')
  9402. }
  9403. if (this[kDestroyed]) {
  9404. if (this[kOnDestroyed]) {
  9405. this[kOnDestroyed].push(callback)
  9406. } else {
  9407. queueMicrotask(() => callback(null, null))
  9408. }
  9409. return
  9410. }
  9411. if (!err) {
  9412. err = new ClientDestroyedError()
  9413. }
  9414. this[kDestroyed] = true
  9415. this[kOnDestroyed] = this[kOnDestroyed] || []
  9416. this[kOnDestroyed].push(callback)
  9417. const onDestroyed = () => {
  9418. const callbacks = this[kOnDestroyed]
  9419. this[kOnDestroyed] = null
  9420. for (let i = 0; i < callbacks.length; i++) {
  9421. callbacks[i](null, null)
  9422. }
  9423. }
  9424. // Should not error.
  9425. this[kDestroy](err).then(() => {
  9426. queueMicrotask(onDestroyed)
  9427. })
  9428. }
  9429. [kInterceptedDispatch] (opts, handler) {
  9430. if (!this[kInterceptors] || this[kInterceptors].length === 0) {
  9431. this[kInterceptedDispatch] = this[kDispatch]
  9432. return this[kDispatch](opts, handler)
  9433. }
  9434. let dispatch = this[kDispatch].bind(this)
  9435. for (let i = this[kInterceptors].length - 1; i >= 0; i--) {
  9436. dispatch = this[kInterceptors][i](dispatch)
  9437. }
  9438. this[kInterceptedDispatch] = dispatch
  9439. return dispatch(opts, handler)
  9440. }
  9441. dispatch (opts, handler) {
  9442. if (!handler || typeof handler !== 'object') {
  9443. throw new InvalidArgumentError('handler must be an object')
  9444. }
  9445. try {
  9446. if (!opts || typeof opts !== 'object') {
  9447. throw new InvalidArgumentError('opts must be an object.')
  9448. }
  9449. if (this[kDestroyed] || this[kOnDestroyed]) {
  9450. throw new ClientDestroyedError()
  9451. }
  9452. if (this[kClosed]) {
  9453. throw new ClientClosedError()
  9454. }
  9455. return this[kInterceptedDispatch](opts, handler)
  9456. } catch (err) {
  9457. if (typeof handler.onError !== 'function') {
  9458. throw new InvalidArgumentError('invalid onError method')
  9459. }
  9460. handler.onError(err)
  9461. return false
  9462. }
  9463. }
  9464. }
  9465. module.exports = DispatcherBase
  9466. /***/ }),
  9467. /***/ 883:
  9468. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9469. const EventEmitter = __nccwpck_require__(8474)
  9470. class Dispatcher extends EventEmitter {
  9471. dispatch () {
  9472. throw new Error('not implemented')
  9473. }
  9474. close () {
  9475. throw new Error('not implemented')
  9476. }
  9477. destroy () {
  9478. throw new Error('not implemented')
  9479. }
  9480. compose (...args) {
  9481. // So we handle [interceptor1, interceptor2] or interceptor1, interceptor2, ...
  9482. const interceptors = Array.isArray(args[0]) ? args[0] : args
  9483. let dispatch = this.dispatch.bind(this)
  9484. for (const interceptor of interceptors) {
  9485. if (interceptor == null) {
  9486. continue
  9487. }
  9488. if (typeof interceptor !== 'function') {
  9489. throw new TypeError(`invalid interceptor, expected function received ${typeof interceptor}`)
  9490. }
  9491. dispatch = interceptor(dispatch)
  9492. if (dispatch == null || typeof dispatch !== 'function' || dispatch.length !== 2) {
  9493. throw new TypeError('invalid interceptor')
  9494. }
  9495. }
  9496. return new ComposedDispatcher(this, dispatch)
  9497. }
  9498. }
  9499. class ComposedDispatcher extends Dispatcher {
  9500. #dispatcher = null
  9501. #dispatch = null
  9502. constructor (dispatcher, dispatch) {
  9503. super()
  9504. this.#dispatcher = dispatcher
  9505. this.#dispatch = dispatch
  9506. }
  9507. dispatch (...args) {
  9508. this.#dispatch(...args)
  9509. }
  9510. close (...args) {
  9511. return this.#dispatcher.close(...args)
  9512. }
  9513. destroy (...args) {
  9514. return this.#dispatcher.destroy(...args)
  9515. }
  9516. }
  9517. module.exports = Dispatcher
  9518. /***/ }),
  9519. /***/ 3137:
  9520. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9521. const DispatcherBase = __nccwpck_require__(1841)
  9522. const { kClose, kDestroy, kClosed, kDestroyed, kDispatch, kNoProxyAgent, kHttpProxyAgent, kHttpsProxyAgent } = __nccwpck_require__(6443)
  9523. const ProxyAgent = __nccwpck_require__(6672)
  9524. const Agent = __nccwpck_require__(7405)
  9525. const DEFAULT_PORTS = {
  9526. 'http:': 80,
  9527. 'https:': 443
  9528. }
  9529. let experimentalWarned = false
  9530. class EnvHttpProxyAgent extends DispatcherBase {
  9531. #noProxyValue = null
  9532. #noProxyEntries = null
  9533. #opts = null
  9534. constructor (opts = {}) {
  9535. super()
  9536. this.#opts = opts
  9537. if (!experimentalWarned) {
  9538. experimentalWarned = true
  9539. process.emitWarning('EnvHttpProxyAgent is experimental, expect them to change at any time.', {
  9540. code: 'UNDICI-EHPA'
  9541. })
  9542. }
  9543. const { httpProxy, httpsProxy, noProxy, ...agentOpts } = opts
  9544. this[kNoProxyAgent] = new Agent(agentOpts)
  9545. const HTTP_PROXY = httpProxy ?? process.env.http_proxy ?? process.env.HTTP_PROXY
  9546. if (HTTP_PROXY) {
  9547. this[kHttpProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTP_PROXY })
  9548. } else {
  9549. this[kHttpProxyAgent] = this[kNoProxyAgent]
  9550. }
  9551. const HTTPS_PROXY = httpsProxy ?? process.env.https_proxy ?? process.env.HTTPS_PROXY
  9552. if (HTTPS_PROXY) {
  9553. this[kHttpsProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTPS_PROXY })
  9554. } else {
  9555. this[kHttpsProxyAgent] = this[kHttpProxyAgent]
  9556. }
  9557. this.#parseNoProxy()
  9558. }
  9559. [kDispatch] (opts, handler) {
  9560. const url = new URL(opts.origin)
  9561. const agent = this.#getProxyAgentForUrl(url)
  9562. return agent.dispatch(opts, handler)
  9563. }
  9564. async [kClose] () {
  9565. await this[kNoProxyAgent].close()
  9566. if (!this[kHttpProxyAgent][kClosed]) {
  9567. await this[kHttpProxyAgent].close()
  9568. }
  9569. if (!this[kHttpsProxyAgent][kClosed]) {
  9570. await this[kHttpsProxyAgent].close()
  9571. }
  9572. }
  9573. async [kDestroy] (err) {
  9574. await this[kNoProxyAgent].destroy(err)
  9575. if (!this[kHttpProxyAgent][kDestroyed]) {
  9576. await this[kHttpProxyAgent].destroy(err)
  9577. }
  9578. if (!this[kHttpsProxyAgent][kDestroyed]) {
  9579. await this[kHttpsProxyAgent].destroy(err)
  9580. }
  9581. }
  9582. #getProxyAgentForUrl (url) {
  9583. let { protocol, host: hostname, port } = url
  9584. // Stripping ports in this way instead of using parsedUrl.hostname to make
  9585. // sure that the brackets around IPv6 addresses are kept.
  9586. hostname = hostname.replace(/:\d*$/, '').toLowerCase()
  9587. port = Number.parseInt(port, 10) || DEFAULT_PORTS[protocol] || 0
  9588. if (!this.#shouldProxy(hostname, port)) {
  9589. return this[kNoProxyAgent]
  9590. }
  9591. if (protocol === 'https:') {
  9592. return this[kHttpsProxyAgent]
  9593. }
  9594. return this[kHttpProxyAgent]
  9595. }
  9596. #shouldProxy (hostname, port) {
  9597. if (this.#noProxyChanged) {
  9598. this.#parseNoProxy()
  9599. }
  9600. if (this.#noProxyEntries.length === 0) {
  9601. return true // Always proxy if NO_PROXY is not set or empty.
  9602. }
  9603. if (this.#noProxyValue === '*') {
  9604. return false // Never proxy if wildcard is set.
  9605. }
  9606. for (let i = 0; i < this.#noProxyEntries.length; i++) {
  9607. const entry = this.#noProxyEntries[i]
  9608. if (entry.port && entry.port !== port) {
  9609. continue // Skip if ports don't match.
  9610. }
  9611. if (!/^[.*]/.test(entry.hostname)) {
  9612. // No wildcards, so don't proxy only if there is not an exact match.
  9613. if (hostname === entry.hostname) {
  9614. return false
  9615. }
  9616. } else {
  9617. // Don't proxy if the hostname ends with the no_proxy host.
  9618. if (hostname.endsWith(entry.hostname.replace(/^\*/, ''))) {
  9619. return false
  9620. }
  9621. }
  9622. }
  9623. return true
  9624. }
  9625. #parseNoProxy () {
  9626. const noProxyValue = this.#opts.noProxy ?? this.#noProxyEnv
  9627. const noProxySplit = noProxyValue.split(/[,\s]/)
  9628. const noProxyEntries = []
  9629. for (let i = 0; i < noProxySplit.length; i++) {
  9630. const entry = noProxySplit[i]
  9631. if (!entry) {
  9632. continue
  9633. }
  9634. const parsed = entry.match(/^(.+):(\d+)$/)
  9635. noProxyEntries.push({
  9636. hostname: (parsed ? parsed[1] : entry).toLowerCase(),
  9637. port: parsed ? Number.parseInt(parsed[2], 10) : 0
  9638. })
  9639. }
  9640. this.#noProxyValue = noProxyValue
  9641. this.#noProxyEntries = noProxyEntries
  9642. }
  9643. get #noProxyChanged () {
  9644. if (this.#opts.noProxy !== undefined) {
  9645. return false
  9646. }
  9647. return this.#noProxyValue !== this.#noProxyEnv
  9648. }
  9649. get #noProxyEnv () {
  9650. return process.env.no_proxy ?? process.env.NO_PROXY ?? ''
  9651. }
  9652. }
  9653. module.exports = EnvHttpProxyAgent
  9654. /***/ }),
  9655. /***/ 4660:
  9656. /***/ ((module) => {
  9657. /* eslint-disable */
  9658. // Extracted from node/lib/internal/fixed_queue.js
  9659. // Currently optimal queue size, tested on V8 6.0 - 6.6. Must be power of two.
  9660. const kSize = 2048;
  9661. const kMask = kSize - 1;
  9662. // The FixedQueue is implemented as a singly-linked list of fixed-size
  9663. // circular buffers. It looks something like this:
  9664. //
  9665. // head tail
  9666. // | |
  9667. // v v
  9668. // +-----------+ <-----\ +-----------+ <------\ +-----------+
  9669. // | [null] | \----- | next | \------- | next |
  9670. // +-----------+ +-----------+ +-----------+
  9671. // | item | <-- bottom | item | <-- bottom | [empty] |
  9672. // | item | | item | | [empty] |
  9673. // | item | | item | | [empty] |
  9674. // | item | | item | | [empty] |
  9675. // | item | | item | bottom --> | item |
  9676. // | item | | item | | item |
  9677. // | ... | | ... | | ... |
  9678. // | item | | item | | item |
  9679. // | item | | item | | item |
  9680. // | [empty] | <-- top | item | | item |
  9681. // | [empty] | | item | | item |
  9682. // | [empty] | | [empty] | <-- top top --> | [empty] |
  9683. // +-----------+ +-----------+ +-----------+
  9684. //
  9685. // Or, if there is only one circular buffer, it looks something
  9686. // like either of these:
  9687. //
  9688. // head tail head tail
  9689. // | | | |
  9690. // v v v v
  9691. // +-----------+ +-----------+
  9692. // | [null] | | [null] |
  9693. // +-----------+ +-----------+
  9694. // | [empty] | | item |
  9695. // | [empty] | | item |
  9696. // | item | <-- bottom top --> | [empty] |
  9697. // | item | | [empty] |
  9698. // | [empty] | <-- top bottom --> | item |
  9699. // | [empty] | | item |
  9700. // +-----------+ +-----------+
  9701. //
  9702. // Adding a value means moving `top` forward by one, removing means
  9703. // moving `bottom` forward by one. After reaching the end, the queue
  9704. // wraps around.
  9705. //
  9706. // When `top === bottom` the current queue is empty and when
  9707. // `top + 1 === bottom` it's full. This wastes a single space of storage
  9708. // but allows much quicker checks.
  9709. class FixedCircularBuffer {
  9710. constructor() {
  9711. this.bottom = 0;
  9712. this.top = 0;
  9713. this.list = new Array(kSize);
  9714. this.next = null;
  9715. }
  9716. isEmpty() {
  9717. return this.top === this.bottom;
  9718. }
  9719. isFull() {
  9720. return ((this.top + 1) & kMask) === this.bottom;
  9721. }
  9722. push(data) {
  9723. this.list[this.top] = data;
  9724. this.top = (this.top + 1) & kMask;
  9725. }
  9726. shift() {
  9727. const nextItem = this.list[this.bottom];
  9728. if (nextItem === undefined)
  9729. return null;
  9730. this.list[this.bottom] = undefined;
  9731. this.bottom = (this.bottom + 1) & kMask;
  9732. return nextItem;
  9733. }
  9734. }
  9735. module.exports = class FixedQueue {
  9736. constructor() {
  9737. this.head = this.tail = new FixedCircularBuffer();
  9738. }
  9739. isEmpty() {
  9740. return this.head.isEmpty();
  9741. }
  9742. push(data) {
  9743. if (this.head.isFull()) {
  9744. // Head is full: Creates a new queue, sets the old queue's `.next` to it,
  9745. // and sets it as the new main queue.
  9746. this.head = this.head.next = new FixedCircularBuffer();
  9747. }
  9748. this.head.push(data);
  9749. }
  9750. shift() {
  9751. const tail = this.tail;
  9752. const next = tail.shift();
  9753. if (tail.isEmpty() && tail.next !== null) {
  9754. // If there is another queue, it forms the new tail.
  9755. this.tail = tail.next;
  9756. }
  9757. return next;
  9758. }
  9759. };
  9760. /***/ }),
  9761. /***/ 2128:
  9762. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9763. const DispatcherBase = __nccwpck_require__(1841)
  9764. const FixedQueue = __nccwpck_require__(4660)
  9765. const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(6443)
  9766. const PoolStats = __nccwpck_require__(3246)
  9767. const kClients = Symbol('clients')
  9768. const kNeedDrain = Symbol('needDrain')
  9769. const kQueue = Symbol('queue')
  9770. const kClosedResolve = Symbol('closed resolve')
  9771. const kOnDrain = Symbol('onDrain')
  9772. const kOnConnect = Symbol('onConnect')
  9773. const kOnDisconnect = Symbol('onDisconnect')
  9774. const kOnConnectionError = Symbol('onConnectionError')
  9775. const kGetDispatcher = Symbol('get dispatcher')
  9776. const kAddClient = Symbol('add client')
  9777. const kRemoveClient = Symbol('remove client')
  9778. const kStats = Symbol('stats')
  9779. class PoolBase extends DispatcherBase {
  9780. constructor (opts) {
  9781. super(opts)
  9782. this[kQueue] = new FixedQueue()
  9783. this[kClients] = []
  9784. this[kQueued] = 0
  9785. const pool = this
  9786. this[kOnDrain] = function onDrain (origin, targets) {
  9787. const queue = pool[kQueue]
  9788. let needDrain = false
  9789. while (!needDrain) {
  9790. const item = queue.shift()
  9791. if (!item) {
  9792. break
  9793. }
  9794. pool[kQueued]--
  9795. needDrain = !this.dispatch(item.opts, item.handler)
  9796. }
  9797. this[kNeedDrain] = needDrain
  9798. if (!this[kNeedDrain] && pool[kNeedDrain]) {
  9799. pool[kNeedDrain] = false
  9800. pool.emit('drain', origin, [pool, ...targets])
  9801. }
  9802. if (pool[kClosedResolve] && queue.isEmpty()) {
  9803. Promise
  9804. .all(pool[kClients].map(c => c.close()))
  9805. .then(pool[kClosedResolve])
  9806. }
  9807. }
  9808. this[kOnConnect] = (origin, targets) => {
  9809. pool.emit('connect', origin, [pool, ...targets])
  9810. }
  9811. this[kOnDisconnect] = (origin, targets, err) => {
  9812. pool.emit('disconnect', origin, [pool, ...targets], err)
  9813. }
  9814. this[kOnConnectionError] = (origin, targets, err) => {
  9815. pool.emit('connectionError', origin, [pool, ...targets], err)
  9816. }
  9817. this[kStats] = new PoolStats(this)
  9818. }
  9819. get [kBusy] () {
  9820. return this[kNeedDrain]
  9821. }
  9822. get [kConnected] () {
  9823. return this[kClients].filter(client => client[kConnected]).length
  9824. }
  9825. get [kFree] () {
  9826. return this[kClients].filter(client => client[kConnected] && !client[kNeedDrain]).length
  9827. }
  9828. get [kPending] () {
  9829. let ret = this[kQueued]
  9830. for (const { [kPending]: pending } of this[kClients]) {
  9831. ret += pending
  9832. }
  9833. return ret
  9834. }
  9835. get [kRunning] () {
  9836. let ret = 0
  9837. for (const { [kRunning]: running } of this[kClients]) {
  9838. ret += running
  9839. }
  9840. return ret
  9841. }
  9842. get [kSize] () {
  9843. let ret = this[kQueued]
  9844. for (const { [kSize]: size } of this[kClients]) {
  9845. ret += size
  9846. }
  9847. return ret
  9848. }
  9849. get stats () {
  9850. return this[kStats]
  9851. }
  9852. async [kClose] () {
  9853. if (this[kQueue].isEmpty()) {
  9854. await Promise.all(this[kClients].map(c => c.close()))
  9855. } else {
  9856. await new Promise((resolve) => {
  9857. this[kClosedResolve] = resolve
  9858. })
  9859. }
  9860. }
  9861. async [kDestroy] (err) {
  9862. while (true) {
  9863. const item = this[kQueue].shift()
  9864. if (!item) {
  9865. break
  9866. }
  9867. item.handler.onError(err)
  9868. }
  9869. await Promise.all(this[kClients].map(c => c.destroy(err)))
  9870. }
  9871. [kDispatch] (opts, handler) {
  9872. const dispatcher = this[kGetDispatcher]()
  9873. if (!dispatcher) {
  9874. this[kNeedDrain] = true
  9875. this[kQueue].push({ opts, handler })
  9876. this[kQueued]++
  9877. } else if (!dispatcher.dispatch(opts, handler)) {
  9878. dispatcher[kNeedDrain] = true
  9879. this[kNeedDrain] = !this[kGetDispatcher]()
  9880. }
  9881. return !this[kNeedDrain]
  9882. }
  9883. [kAddClient] (client) {
  9884. client
  9885. .on('drain', this[kOnDrain])
  9886. .on('connect', this[kOnConnect])
  9887. .on('disconnect', this[kOnDisconnect])
  9888. .on('connectionError', this[kOnConnectionError])
  9889. this[kClients].push(client)
  9890. if (this[kNeedDrain]) {
  9891. queueMicrotask(() => {
  9892. if (this[kNeedDrain]) {
  9893. this[kOnDrain](client[kUrl], [this, client])
  9894. }
  9895. })
  9896. }
  9897. return this
  9898. }
  9899. [kRemoveClient] (client) {
  9900. client.close(() => {
  9901. const idx = this[kClients].indexOf(client)
  9902. if (idx !== -1) {
  9903. this[kClients].splice(idx, 1)
  9904. }
  9905. })
  9906. this[kNeedDrain] = this[kClients].some(dispatcher => (
  9907. !dispatcher[kNeedDrain] &&
  9908. dispatcher.closed !== true &&
  9909. dispatcher.destroyed !== true
  9910. ))
  9911. }
  9912. }
  9913. module.exports = {
  9914. PoolBase,
  9915. kClients,
  9916. kNeedDrain,
  9917. kAddClient,
  9918. kRemoveClient,
  9919. kGetDispatcher
  9920. }
  9921. /***/ }),
  9922. /***/ 3246:
  9923. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9924. const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(6443)
  9925. const kPool = Symbol('pool')
  9926. class PoolStats {
  9927. constructor (pool) {
  9928. this[kPool] = pool
  9929. }
  9930. get connected () {
  9931. return this[kPool][kConnected]
  9932. }
  9933. get free () {
  9934. return this[kPool][kFree]
  9935. }
  9936. get pending () {
  9937. return this[kPool][kPending]
  9938. }
  9939. get queued () {
  9940. return this[kPool][kQueued]
  9941. }
  9942. get running () {
  9943. return this[kPool][kRunning]
  9944. }
  9945. get size () {
  9946. return this[kPool][kSize]
  9947. }
  9948. }
  9949. module.exports = PoolStats
  9950. /***/ }),
  9951. /***/ 628:
  9952. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9953. const {
  9954. PoolBase,
  9955. kClients,
  9956. kNeedDrain,
  9957. kAddClient,
  9958. kGetDispatcher
  9959. } = __nccwpck_require__(2128)
  9960. const Client = __nccwpck_require__(3701)
  9961. const {
  9962. InvalidArgumentError
  9963. } = __nccwpck_require__(8707)
  9964. const util = __nccwpck_require__(3440)
  9965. const { kUrl, kInterceptors } = __nccwpck_require__(6443)
  9966. const buildConnector = __nccwpck_require__(9136)
  9967. const kOptions = Symbol('options')
  9968. const kConnections = Symbol('connections')
  9969. const kFactory = Symbol('factory')
  9970. function defaultFactory (origin, opts) {
  9971. return new Client(origin, opts)
  9972. }
  9973. class Pool extends PoolBase {
  9974. constructor (origin, {
  9975. connections,
  9976. factory = defaultFactory,
  9977. connect,
  9978. connectTimeout,
  9979. tls,
  9980. maxCachedSessions,
  9981. socketPath,
  9982. autoSelectFamily,
  9983. autoSelectFamilyAttemptTimeout,
  9984. allowH2,
  9985. ...options
  9986. } = {}) {
  9987. if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
  9988. throw new InvalidArgumentError('invalid connections')
  9989. }
  9990. if (typeof factory !== 'function') {
  9991. throw new InvalidArgumentError('factory must be a function.')
  9992. }
  9993. if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
  9994. throw new InvalidArgumentError('connect must be a function or an object')
  9995. }
  9996. if (typeof connect !== 'function') {
  9997. connect = buildConnector({
  9998. ...tls,
  9999. maxCachedSessions,
  10000. allowH2,
  10001. socketPath,
  10002. timeout: connectTimeout,
  10003. ...(autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined),
  10004. ...connect
  10005. })
  10006. }
  10007. super(options)
  10008. this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool)
  10009. ? options.interceptors.Pool
  10010. : []
  10011. this[kConnections] = connections || null
  10012. this[kUrl] = util.parseOrigin(origin)
  10013. this[kOptions] = { ...util.deepClone(options), connect, allowH2 }
  10014. this[kOptions].interceptors = options.interceptors
  10015. ? { ...options.interceptors }
  10016. : undefined
  10017. this[kFactory] = factory
  10018. this.on('connectionError', (origin, targets, error) => {
  10019. // If a connection error occurs, we remove the client from the pool,
  10020. // and emit a connectionError event. They will not be re-used.
  10021. // Fixes https://github.com/nodejs/undici/issues/3895
  10022. for (const target of targets) {
  10023. // Do not use kRemoveClient here, as it will close the client,
  10024. // but the client cannot be closed in this state.
  10025. const idx = this[kClients].indexOf(target)
  10026. if (idx !== -1) {
  10027. this[kClients].splice(idx, 1)
  10028. }
  10029. }
  10030. })
  10031. }
  10032. [kGetDispatcher] () {
  10033. for (const client of this[kClients]) {
  10034. if (!client[kNeedDrain]) {
  10035. return client
  10036. }
  10037. }
  10038. if (!this[kConnections] || this[kClients].length < this[kConnections]) {
  10039. const dispatcher = this[kFactory](this[kUrl], this[kOptions])
  10040. this[kAddClient](dispatcher)
  10041. return dispatcher
  10042. }
  10043. }
  10044. }
  10045. module.exports = Pool
  10046. /***/ }),
  10047. /***/ 6672:
  10048. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10049. const { kProxy, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(6443)
  10050. const { URL } = __nccwpck_require__(3136)
  10051. const Agent = __nccwpck_require__(7405)
  10052. const Pool = __nccwpck_require__(628)
  10053. const DispatcherBase = __nccwpck_require__(1841)
  10054. const { InvalidArgumentError, RequestAbortedError, SecureProxyConnectionError } = __nccwpck_require__(8707)
  10055. const buildConnector = __nccwpck_require__(9136)
  10056. const Client = __nccwpck_require__(3701)
  10057. const kAgent = Symbol('proxy agent')
  10058. const kClient = Symbol('proxy client')
  10059. const kProxyHeaders = Symbol('proxy headers')
  10060. const kRequestTls = Symbol('request tls settings')
  10061. const kProxyTls = Symbol('proxy tls settings')
  10062. const kConnectEndpoint = Symbol('connect endpoint function')
  10063. const kTunnelProxy = Symbol('tunnel proxy')
  10064. function defaultProtocolPort (protocol) {
  10065. return protocol === 'https:' ? 443 : 80
  10066. }
  10067. function defaultFactory (origin, opts) {
  10068. return new Pool(origin, opts)
  10069. }
  10070. const noop = () => {}
  10071. function defaultAgentFactory (origin, opts) {
  10072. if (opts.connections === 1) {
  10073. return new Client(origin, opts)
  10074. }
  10075. return new Pool(origin, opts)
  10076. }
  10077. class Http1ProxyWrapper extends DispatcherBase {
  10078. #client
  10079. constructor (proxyUrl, { headers = {}, connect, factory }) {
  10080. super()
  10081. if (!proxyUrl) {
  10082. throw new InvalidArgumentError('Proxy URL is mandatory')
  10083. }
  10084. this[kProxyHeaders] = headers
  10085. if (factory) {
  10086. this.#client = factory(proxyUrl, { connect })
  10087. } else {
  10088. this.#client = new Client(proxyUrl, { connect })
  10089. }
  10090. }
  10091. [kDispatch] (opts, handler) {
  10092. const onHeaders = handler.onHeaders
  10093. handler.onHeaders = function (statusCode, data, resume) {
  10094. if (statusCode === 407) {
  10095. if (typeof handler.onError === 'function') {
  10096. handler.onError(new InvalidArgumentError('Proxy Authentication Required (407)'))
  10097. }
  10098. return
  10099. }
  10100. if (onHeaders) onHeaders.call(this, statusCode, data, resume)
  10101. }
  10102. // Rewrite request as an HTTP1 Proxy request, without tunneling.
  10103. const {
  10104. origin,
  10105. path = '/',
  10106. headers = {}
  10107. } = opts
  10108. opts.path = origin + path
  10109. if (!('host' in headers) && !('Host' in headers)) {
  10110. const { host } = new URL(origin)
  10111. headers.host = host
  10112. }
  10113. opts.headers = { ...this[kProxyHeaders], ...headers }
  10114. return this.#client[kDispatch](opts, handler)
  10115. }
  10116. async [kClose] () {
  10117. return this.#client.close()
  10118. }
  10119. async [kDestroy] (err) {
  10120. return this.#client.destroy(err)
  10121. }
  10122. }
  10123. class ProxyAgent extends DispatcherBase {
  10124. constructor (opts) {
  10125. super()
  10126. if (!opts || (typeof opts === 'object' && !(opts instanceof URL) && !opts.uri)) {
  10127. throw new InvalidArgumentError('Proxy uri is mandatory')
  10128. }
  10129. const { clientFactory = defaultFactory } = opts
  10130. if (typeof clientFactory !== 'function') {
  10131. throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.')
  10132. }
  10133. const { proxyTunnel = true } = opts
  10134. const url = this.#getUrl(opts)
  10135. const { href, origin, port, protocol, username, password, hostname: proxyHostname } = url
  10136. this[kProxy] = { uri: href, protocol }
  10137. this[kInterceptors] = opts.interceptors?.ProxyAgent && Array.isArray(opts.interceptors.ProxyAgent)
  10138. ? opts.interceptors.ProxyAgent
  10139. : []
  10140. this[kRequestTls] = opts.requestTls
  10141. this[kProxyTls] = opts.proxyTls
  10142. this[kProxyHeaders] = opts.headers || {}
  10143. this[kTunnelProxy] = proxyTunnel
  10144. if (opts.auth && opts.token) {
  10145. throw new InvalidArgumentError('opts.auth cannot be used in combination with opts.token')
  10146. } else if (opts.auth) {
  10147. /* @deprecated in favour of opts.token */
  10148. this[kProxyHeaders]['proxy-authorization'] = `Basic ${opts.auth}`
  10149. } else if (opts.token) {
  10150. this[kProxyHeaders]['proxy-authorization'] = opts.token
  10151. } else if (username && password) {
  10152. this[kProxyHeaders]['proxy-authorization'] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString('base64')}`
  10153. }
  10154. const connect = buildConnector({ ...opts.proxyTls })
  10155. this[kConnectEndpoint] = buildConnector({ ...opts.requestTls })
  10156. const agentFactory = opts.factory || defaultAgentFactory
  10157. const factory = (origin, options) => {
  10158. const { protocol } = new URL(origin)
  10159. if (!this[kTunnelProxy] && protocol === 'http:' && this[kProxy].protocol === 'http:') {
  10160. return new Http1ProxyWrapper(this[kProxy].uri, {
  10161. headers: this[kProxyHeaders],
  10162. connect,
  10163. factory: agentFactory
  10164. })
  10165. }
  10166. return agentFactory(origin, options)
  10167. }
  10168. this[kClient] = clientFactory(url, { connect })
  10169. this[kAgent] = new Agent({
  10170. ...opts,
  10171. factory,
  10172. connect: async (opts, callback) => {
  10173. let requestedPath = opts.host
  10174. if (!opts.port) {
  10175. requestedPath += `:${defaultProtocolPort(opts.protocol)}`
  10176. }
  10177. try {
  10178. const { socket, statusCode } = await this[kClient].connect({
  10179. origin,
  10180. port,
  10181. path: requestedPath,
  10182. signal: opts.signal,
  10183. headers: {
  10184. ...this[kProxyHeaders],
  10185. host: opts.host
  10186. },
  10187. servername: this[kProxyTls]?.servername || proxyHostname
  10188. })
  10189. if (statusCode !== 200) {
  10190. socket.on('error', noop).destroy()
  10191. callback(new RequestAbortedError(`Proxy response (${statusCode}) !== 200 when HTTP Tunneling`))
  10192. }
  10193. if (opts.protocol !== 'https:') {
  10194. callback(null, socket)
  10195. return
  10196. }
  10197. let servername
  10198. if (this[kRequestTls]) {
  10199. servername = this[kRequestTls].servername
  10200. } else {
  10201. servername = opts.servername
  10202. }
  10203. this[kConnectEndpoint]({ ...opts, servername, httpSocket: socket }, callback)
  10204. } catch (err) {
  10205. if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') {
  10206. // Throw a custom error to avoid loop in client.js#connect
  10207. callback(new SecureProxyConnectionError(err))
  10208. } else {
  10209. callback(err)
  10210. }
  10211. }
  10212. }
  10213. })
  10214. }
  10215. dispatch (opts, handler) {
  10216. const headers = buildHeaders(opts.headers)
  10217. throwIfProxyAuthIsSent(headers)
  10218. if (headers && !('host' in headers) && !('Host' in headers)) {
  10219. const { host } = new URL(opts.origin)
  10220. headers.host = host
  10221. }
  10222. return this[kAgent].dispatch(
  10223. {
  10224. ...opts,
  10225. headers
  10226. },
  10227. handler
  10228. )
  10229. }
  10230. /**
  10231. * @param {import('../types/proxy-agent').ProxyAgent.Options | string | URL} opts
  10232. * @returns {URL}
  10233. */
  10234. #getUrl (opts) {
  10235. if (typeof opts === 'string') {
  10236. return new URL(opts)
  10237. } else if (opts instanceof URL) {
  10238. return opts
  10239. } else {
  10240. return new URL(opts.uri)
  10241. }
  10242. }
  10243. async [kClose] () {
  10244. await this[kAgent].close()
  10245. await this[kClient].close()
  10246. }
  10247. async [kDestroy] () {
  10248. await this[kAgent].destroy()
  10249. await this[kClient].destroy()
  10250. }
  10251. }
  10252. /**
  10253. * @param {string[] | Record<string, string>} headers
  10254. * @returns {Record<string, string>}
  10255. */
  10256. function buildHeaders (headers) {
  10257. // When using undici.fetch, the headers list is stored
  10258. // as an array.
  10259. if (Array.isArray(headers)) {
  10260. /** @type {Record<string, string>} */
  10261. const headersPair = {}
  10262. for (let i = 0; i < headers.length; i += 2) {
  10263. headersPair[headers[i]] = headers[i + 1]
  10264. }
  10265. return headersPair
  10266. }
  10267. return headers
  10268. }
  10269. /**
  10270. * @param {Record<string, string>} headers
  10271. *
  10272. * Previous versions of ProxyAgent suggests the Proxy-Authorization in request headers
  10273. * Nevertheless, it was changed and to avoid a security vulnerability by end users
  10274. * this check was created.
  10275. * It should be removed in the next major version for performance reasons
  10276. */
  10277. function throwIfProxyAuthIsSent (headers) {
  10278. const existProxyAuth = headers && Object.keys(headers)
  10279. .find((key) => key.toLowerCase() === 'proxy-authorization')
  10280. if (existProxyAuth) {
  10281. throw new InvalidArgumentError('Proxy-Authorization should be sent in ProxyAgent constructor')
  10282. }
  10283. }
  10284. module.exports = ProxyAgent
  10285. /***/ }),
  10286. /***/ 50:
  10287. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10288. const Dispatcher = __nccwpck_require__(883)
  10289. const RetryHandler = __nccwpck_require__(7816)
  10290. class RetryAgent extends Dispatcher {
  10291. #agent = null
  10292. #options = null
  10293. constructor (agent, options = {}) {
  10294. super(options)
  10295. this.#agent = agent
  10296. this.#options = options
  10297. }
  10298. dispatch (opts, handler) {
  10299. const retry = new RetryHandler({
  10300. ...opts,
  10301. retryOptions: this.#options
  10302. }, {
  10303. dispatch: this.#agent.dispatch.bind(this.#agent),
  10304. handler
  10305. })
  10306. return this.#agent.dispatch(opts, retry)
  10307. }
  10308. close () {
  10309. return this.#agent.close()
  10310. }
  10311. destroy () {
  10312. return this.#agent.destroy()
  10313. }
  10314. }
  10315. module.exports = RetryAgent
  10316. /***/ }),
  10317. /***/ 2581:
  10318. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10319. // We include a version number for the Dispatcher API. In case of breaking changes,
  10320. // this version number must be increased to avoid conflicts.
  10321. const globalDispatcher = Symbol.for('undici.globalDispatcher.1')
  10322. const { InvalidArgumentError } = __nccwpck_require__(8707)
  10323. const Agent = __nccwpck_require__(7405)
  10324. if (getGlobalDispatcher() === undefined) {
  10325. setGlobalDispatcher(new Agent())
  10326. }
  10327. function setGlobalDispatcher (agent) {
  10328. if (!agent || typeof agent.dispatch !== 'function') {
  10329. throw new InvalidArgumentError('Argument agent must implement Agent')
  10330. }
  10331. Object.defineProperty(globalThis, globalDispatcher, {
  10332. value: agent,
  10333. writable: true,
  10334. enumerable: false,
  10335. configurable: false
  10336. })
  10337. }
  10338. function getGlobalDispatcher () {
  10339. return globalThis[globalDispatcher]
  10340. }
  10341. module.exports = {
  10342. setGlobalDispatcher,
  10343. getGlobalDispatcher
  10344. }
  10345. /***/ }),
  10346. /***/ 8155:
  10347. /***/ ((module) => {
  10348. module.exports = class DecoratorHandler {
  10349. #handler
  10350. constructor (handler) {
  10351. if (typeof handler !== 'object' || handler === null) {
  10352. throw new TypeError('handler must be an object')
  10353. }
  10354. this.#handler = handler
  10355. }
  10356. onConnect (...args) {
  10357. return this.#handler.onConnect?.(...args)
  10358. }
  10359. onError (...args) {
  10360. return this.#handler.onError?.(...args)
  10361. }
  10362. onUpgrade (...args) {
  10363. return this.#handler.onUpgrade?.(...args)
  10364. }
  10365. onResponseStarted (...args) {
  10366. return this.#handler.onResponseStarted?.(...args)
  10367. }
  10368. onHeaders (...args) {
  10369. return this.#handler.onHeaders?.(...args)
  10370. }
  10371. onData (...args) {
  10372. return this.#handler.onData?.(...args)
  10373. }
  10374. onComplete (...args) {
  10375. return this.#handler.onComplete?.(...args)
  10376. }
  10377. onBodySent (...args) {
  10378. return this.#handler.onBodySent?.(...args)
  10379. }
  10380. }
  10381. /***/ }),
  10382. /***/ 8754:
  10383. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10384. const util = __nccwpck_require__(3440)
  10385. const { kBodyUsed } = __nccwpck_require__(6443)
  10386. const assert = __nccwpck_require__(4589)
  10387. const { InvalidArgumentError } = __nccwpck_require__(8707)
  10388. const EE = __nccwpck_require__(8474)
  10389. const redirectableStatusCodes = [300, 301, 302, 303, 307, 308]
  10390. const kBody = Symbol('body')
  10391. class BodyAsyncIterable {
  10392. constructor (body) {
  10393. this[kBody] = body
  10394. this[kBodyUsed] = false
  10395. }
  10396. async * [Symbol.asyncIterator] () {
  10397. assert(!this[kBodyUsed], 'disturbed')
  10398. this[kBodyUsed] = true
  10399. yield * this[kBody]
  10400. }
  10401. }
  10402. class RedirectHandler {
  10403. constructor (dispatch, maxRedirections, opts, handler) {
  10404. if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
  10405. throw new InvalidArgumentError('maxRedirections must be a positive number')
  10406. }
  10407. util.validateHandler(handler, opts.method, opts.upgrade)
  10408. this.dispatch = dispatch
  10409. this.location = null
  10410. this.abort = null
  10411. this.opts = { ...opts, maxRedirections: 0 } // opts must be a copy
  10412. this.maxRedirections = maxRedirections
  10413. this.handler = handler
  10414. this.history = []
  10415. this.redirectionLimitReached = false
  10416. if (util.isStream(this.opts.body)) {
  10417. // TODO (fix): Provide some way for the user to cache the file to e.g. /tmp
  10418. // so that it can be dispatched again?
  10419. // TODO (fix): Do we need 100-expect support to provide a way to do this properly?
  10420. if (util.bodyLength(this.opts.body) === 0) {
  10421. this.opts.body
  10422. .on('data', function () {
  10423. assert(false)
  10424. })
  10425. }
  10426. if (typeof this.opts.body.readableDidRead !== 'boolean') {
  10427. this.opts.body[kBodyUsed] = false
  10428. EE.prototype.on.call(this.opts.body, 'data', function () {
  10429. this[kBodyUsed] = true
  10430. })
  10431. }
  10432. } else if (this.opts.body && typeof this.opts.body.pipeTo === 'function') {
  10433. // TODO (fix): We can't access ReadableStream internal state
  10434. // to determine whether or not it has been disturbed. This is just
  10435. // a workaround.
  10436. this.opts.body = new BodyAsyncIterable(this.opts.body)
  10437. } else if (
  10438. this.opts.body &&
  10439. typeof this.opts.body !== 'string' &&
  10440. !ArrayBuffer.isView(this.opts.body) &&
  10441. util.isIterable(this.opts.body)
  10442. ) {
  10443. // TODO: Should we allow re-using iterable if !this.opts.idempotent
  10444. // or through some other flag?
  10445. this.opts.body = new BodyAsyncIterable(this.opts.body)
  10446. }
  10447. }
  10448. onConnect (abort) {
  10449. this.abort = abort
  10450. this.handler.onConnect(abort, { history: this.history })
  10451. }
  10452. onUpgrade (statusCode, headers, socket) {
  10453. this.handler.onUpgrade(statusCode, headers, socket)
  10454. }
  10455. onError (error) {
  10456. this.handler.onError(error)
  10457. }
  10458. onHeaders (statusCode, headers, resume, statusText) {
  10459. this.location = this.history.length >= this.maxRedirections || util.isDisturbed(this.opts.body)
  10460. ? null
  10461. : parseLocation(statusCode, headers)
  10462. if (this.opts.throwOnMaxRedirect && this.history.length >= this.maxRedirections) {
  10463. if (this.request) {
  10464. this.request.abort(new Error('max redirects'))
  10465. }
  10466. this.redirectionLimitReached = true
  10467. this.abort(new Error('max redirects'))
  10468. return
  10469. }
  10470. if (this.opts.origin) {
  10471. this.history.push(new URL(this.opts.path, this.opts.origin))
  10472. }
  10473. if (!this.location) {
  10474. return this.handler.onHeaders(statusCode, headers, resume, statusText)
  10475. }
  10476. const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)))
  10477. const path = search ? `${pathname}${search}` : pathname
  10478. // Remove headers referring to the original URL.
  10479. // By default it is Host only, unless it's a 303 (see below), which removes also all Content-* headers.
  10480. // https://tools.ietf.org/html/rfc7231#section-6.4
  10481. this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin)
  10482. this.opts.path = path
  10483. this.opts.origin = origin
  10484. this.opts.maxRedirections = 0
  10485. this.opts.query = null
  10486. // https://tools.ietf.org/html/rfc7231#section-6.4.4
  10487. // In case of HTTP 303, always replace method to be either HEAD or GET
  10488. if (statusCode === 303 && this.opts.method !== 'HEAD') {
  10489. this.opts.method = 'GET'
  10490. this.opts.body = null
  10491. }
  10492. }
  10493. onData (chunk) {
  10494. if (this.location) {
  10495. /*
  10496. https://tools.ietf.org/html/rfc7231#section-6.4
  10497. TLDR: undici always ignores 3xx response bodies.
  10498. Redirection is used to serve the requested resource from another URL, so it is assumes that
  10499. no body is generated (and thus can be ignored). Even though generating a body is not prohibited.
  10500. For status 301, 302, 303, 307 and 308 (the latter from RFC 7238), the specs mention that the body usually
  10501. (which means it's optional and not mandated) contain just an hyperlink to the value of
  10502. the Location response header, so the body can be ignored safely.
  10503. For status 300, which is "Multiple Choices", the spec mentions both generating a Location
  10504. response header AND a response body with the other possible location to follow.
  10505. Since the spec explicitly chooses not to specify a format for such body and leave it to
  10506. servers and browsers implementors, we ignore the body as there is no specified way to eventually parse it.
  10507. */
  10508. } else {
  10509. return this.handler.onData(chunk)
  10510. }
  10511. }
  10512. onComplete (trailers) {
  10513. if (this.location) {
  10514. /*
  10515. https://tools.ietf.org/html/rfc7231#section-6.4
  10516. TLDR: undici always ignores 3xx response trailers as they are not expected in case of redirections
  10517. and neither are useful if present.
  10518. See comment on onData method above for more detailed information.
  10519. */
  10520. this.location = null
  10521. this.abort = null
  10522. this.dispatch(this.opts, this)
  10523. } else {
  10524. this.handler.onComplete(trailers)
  10525. }
  10526. }
  10527. onBodySent (chunk) {
  10528. if (this.handler.onBodySent) {
  10529. this.handler.onBodySent(chunk)
  10530. }
  10531. }
  10532. }
  10533. function parseLocation (statusCode, headers) {
  10534. if (redirectableStatusCodes.indexOf(statusCode) === -1) {
  10535. return null
  10536. }
  10537. for (let i = 0; i < headers.length; i += 2) {
  10538. if (headers[i].length === 8 && util.headerNameToString(headers[i]) === 'location') {
  10539. return headers[i + 1]
  10540. }
  10541. }
  10542. }
  10543. // https://tools.ietf.org/html/rfc7231#section-6.4.4
  10544. function shouldRemoveHeader (header, removeContent, unknownOrigin) {
  10545. if (header.length === 4) {
  10546. return util.headerNameToString(header) === 'host'
  10547. }
  10548. if (removeContent && util.headerNameToString(header).startsWith('content-')) {
  10549. return true
  10550. }
  10551. if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) {
  10552. const name = util.headerNameToString(header)
  10553. return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization'
  10554. }
  10555. return false
  10556. }
  10557. // https://tools.ietf.org/html/rfc7231#section-6.4
  10558. function cleanRequestHeaders (headers, removeContent, unknownOrigin) {
  10559. const ret = []
  10560. if (Array.isArray(headers)) {
  10561. for (let i = 0; i < headers.length; i += 2) {
  10562. if (!shouldRemoveHeader(headers[i], removeContent, unknownOrigin)) {
  10563. ret.push(headers[i], headers[i + 1])
  10564. }
  10565. }
  10566. } else if (headers && typeof headers === 'object') {
  10567. for (const key of Object.keys(headers)) {
  10568. if (!shouldRemoveHeader(key, removeContent, unknownOrigin)) {
  10569. ret.push(key, headers[key])
  10570. }
  10571. }
  10572. } else {
  10573. assert(headers == null, 'headers must be an object or an array')
  10574. }
  10575. return ret
  10576. }
  10577. module.exports = RedirectHandler
  10578. /***/ }),
  10579. /***/ 7816:
  10580. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10581. const assert = __nccwpck_require__(4589)
  10582. const { kRetryHandlerDefaultRetry } = __nccwpck_require__(6443)
  10583. const { RequestRetryError } = __nccwpck_require__(8707)
  10584. const {
  10585. isDisturbed,
  10586. parseHeaders,
  10587. parseRangeHeader,
  10588. wrapRequestBody
  10589. } = __nccwpck_require__(3440)
  10590. function calculateRetryAfterHeader (retryAfter) {
  10591. const current = Date.now()
  10592. return new Date(retryAfter).getTime() - current
  10593. }
  10594. class RetryHandler {
  10595. constructor (opts, handlers) {
  10596. const { retryOptions, ...dispatchOpts } = opts
  10597. const {
  10598. // Retry scoped
  10599. retry: retryFn,
  10600. maxRetries,
  10601. maxTimeout,
  10602. minTimeout,
  10603. timeoutFactor,
  10604. // Response scoped
  10605. methods,
  10606. errorCodes,
  10607. retryAfter,
  10608. statusCodes
  10609. } = retryOptions ?? {}
  10610. this.dispatch = handlers.dispatch
  10611. this.handler = handlers.handler
  10612. this.opts = { ...dispatchOpts, body: wrapRequestBody(opts.body) }
  10613. this.abort = null
  10614. this.aborted = false
  10615. this.retryOpts = {
  10616. retry: retryFn ?? RetryHandler[kRetryHandlerDefaultRetry],
  10617. retryAfter: retryAfter ?? true,
  10618. maxTimeout: maxTimeout ?? 30 * 1000, // 30s,
  10619. minTimeout: minTimeout ?? 500, // .5s
  10620. timeoutFactor: timeoutFactor ?? 2,
  10621. maxRetries: maxRetries ?? 5,
  10622. // What errors we should retry
  10623. methods: methods ?? ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'],
  10624. // Indicates which errors to retry
  10625. statusCodes: statusCodes ?? [500, 502, 503, 504, 429],
  10626. // List of errors to retry
  10627. errorCodes: errorCodes ?? [
  10628. 'ECONNRESET',
  10629. 'ECONNREFUSED',
  10630. 'ENOTFOUND',
  10631. 'ENETDOWN',
  10632. 'ENETUNREACH',
  10633. 'EHOSTDOWN',
  10634. 'EHOSTUNREACH',
  10635. 'EPIPE',
  10636. 'UND_ERR_SOCKET'
  10637. ]
  10638. }
  10639. this.retryCount = 0
  10640. this.retryCountCheckpoint = 0
  10641. this.start = 0
  10642. this.end = null
  10643. this.etag = null
  10644. this.resume = null
  10645. // Handle possible onConnect duplication
  10646. this.handler.onConnect(reason => {
  10647. this.aborted = true
  10648. if (this.abort) {
  10649. this.abort(reason)
  10650. } else {
  10651. this.reason = reason
  10652. }
  10653. })
  10654. }
  10655. onRequestSent () {
  10656. if (this.handler.onRequestSent) {
  10657. this.handler.onRequestSent()
  10658. }
  10659. }
  10660. onUpgrade (statusCode, headers, socket) {
  10661. if (this.handler.onUpgrade) {
  10662. this.handler.onUpgrade(statusCode, headers, socket)
  10663. }
  10664. }
  10665. onConnect (abort) {
  10666. if (this.aborted) {
  10667. abort(this.reason)
  10668. } else {
  10669. this.abort = abort
  10670. }
  10671. }
  10672. onBodySent (chunk) {
  10673. if (this.handler.onBodySent) return this.handler.onBodySent(chunk)
  10674. }
  10675. static [kRetryHandlerDefaultRetry] (err, { state, opts }, cb) {
  10676. const { statusCode, code, headers } = err
  10677. const { method, retryOptions } = opts
  10678. const {
  10679. maxRetries,
  10680. minTimeout,
  10681. maxTimeout,
  10682. timeoutFactor,
  10683. statusCodes,
  10684. errorCodes,
  10685. methods
  10686. } = retryOptions
  10687. const { counter } = state
  10688. // Any code that is not a Undici's originated and allowed to retry
  10689. if (code && code !== 'UND_ERR_REQ_RETRY' && !errorCodes.includes(code)) {
  10690. cb(err)
  10691. return
  10692. }
  10693. // If a set of method are provided and the current method is not in the list
  10694. if (Array.isArray(methods) && !methods.includes(method)) {
  10695. cb(err)
  10696. return
  10697. }
  10698. // If a set of status code are provided and the current status code is not in the list
  10699. if (
  10700. statusCode != null &&
  10701. Array.isArray(statusCodes) &&
  10702. !statusCodes.includes(statusCode)
  10703. ) {
  10704. cb(err)
  10705. return
  10706. }
  10707. // If we reached the max number of retries
  10708. if (counter > maxRetries) {
  10709. cb(err)
  10710. return
  10711. }
  10712. let retryAfterHeader = headers?.['retry-after']
  10713. if (retryAfterHeader) {
  10714. retryAfterHeader = Number(retryAfterHeader)
  10715. retryAfterHeader = Number.isNaN(retryAfterHeader)
  10716. ? calculateRetryAfterHeader(retryAfterHeader)
  10717. : retryAfterHeader * 1e3 // Retry-After is in seconds
  10718. }
  10719. const retryTimeout =
  10720. retryAfterHeader > 0
  10721. ? Math.min(retryAfterHeader, maxTimeout)
  10722. : Math.min(minTimeout * timeoutFactor ** (counter - 1), maxTimeout)
  10723. setTimeout(() => cb(null), retryTimeout)
  10724. }
  10725. onHeaders (statusCode, rawHeaders, resume, statusMessage) {
  10726. const headers = parseHeaders(rawHeaders)
  10727. this.retryCount += 1
  10728. if (statusCode >= 300) {
  10729. if (this.retryOpts.statusCodes.includes(statusCode) === false) {
  10730. return this.handler.onHeaders(
  10731. statusCode,
  10732. rawHeaders,
  10733. resume,
  10734. statusMessage
  10735. )
  10736. } else {
  10737. this.abort(
  10738. new RequestRetryError('Request failed', statusCode, {
  10739. headers,
  10740. data: {
  10741. count: this.retryCount
  10742. }
  10743. })
  10744. )
  10745. return false
  10746. }
  10747. }
  10748. // Checkpoint for resume from where we left it
  10749. if (this.resume != null) {
  10750. this.resume = null
  10751. // Only Partial Content 206 supposed to provide Content-Range,
  10752. // any other status code that partially consumed the payload
  10753. // should not be retry because it would result in downstream
  10754. // wrongly concatanete multiple responses.
  10755. if (statusCode !== 206 && (this.start > 0 || statusCode !== 200)) {
  10756. this.abort(
  10757. new RequestRetryError('server does not support the range header and the payload was partially consumed', statusCode, {
  10758. headers,
  10759. data: { count: this.retryCount }
  10760. })
  10761. )
  10762. return false
  10763. }
  10764. const contentRange = parseRangeHeader(headers['content-range'])
  10765. // If no content range
  10766. if (!contentRange) {
  10767. this.abort(
  10768. new RequestRetryError('Content-Range mismatch', statusCode, {
  10769. headers,
  10770. data: { count: this.retryCount }
  10771. })
  10772. )
  10773. return false
  10774. }
  10775. // Let's start with a weak etag check
  10776. if (this.etag != null && this.etag !== headers.etag) {
  10777. this.abort(
  10778. new RequestRetryError('ETag mismatch', statusCode, {
  10779. headers,
  10780. data: { count: this.retryCount }
  10781. })
  10782. )
  10783. return false
  10784. }
  10785. const { start, size, end = size - 1 } = contentRange
  10786. assert(this.start === start, 'content-range mismatch')
  10787. assert(this.end == null || this.end === end, 'content-range mismatch')
  10788. this.resume = resume
  10789. return true
  10790. }
  10791. if (this.end == null) {
  10792. if (statusCode === 206) {
  10793. // First time we receive 206
  10794. const range = parseRangeHeader(headers['content-range'])
  10795. if (range == null) {
  10796. return this.handler.onHeaders(
  10797. statusCode,
  10798. rawHeaders,
  10799. resume,
  10800. statusMessage
  10801. )
  10802. }
  10803. const { start, size, end = size - 1 } = range
  10804. assert(
  10805. start != null && Number.isFinite(start),
  10806. 'content-range mismatch'
  10807. )
  10808. assert(end != null && Number.isFinite(end), 'invalid content-length')
  10809. this.start = start
  10810. this.end = end
  10811. }
  10812. // We make our best to checkpoint the body for further range headers
  10813. if (this.end == null) {
  10814. const contentLength = headers['content-length']
  10815. this.end = contentLength != null ? Number(contentLength) - 1 : null
  10816. }
  10817. assert(Number.isFinite(this.start))
  10818. assert(
  10819. this.end == null || Number.isFinite(this.end),
  10820. 'invalid content-length'
  10821. )
  10822. this.resume = resume
  10823. this.etag = headers.etag != null ? headers.etag : null
  10824. // Weak etags are not useful for comparison nor cache
  10825. // for instance not safe to assume if the response is byte-per-byte
  10826. // equal
  10827. if (this.etag != null && this.etag.startsWith('W/')) {
  10828. this.etag = null
  10829. }
  10830. return this.handler.onHeaders(
  10831. statusCode,
  10832. rawHeaders,
  10833. resume,
  10834. statusMessage
  10835. )
  10836. }
  10837. const err = new RequestRetryError('Request failed', statusCode, {
  10838. headers,
  10839. data: { count: this.retryCount }
  10840. })
  10841. this.abort(err)
  10842. return false
  10843. }
  10844. onData (chunk) {
  10845. this.start += chunk.length
  10846. return this.handler.onData(chunk)
  10847. }
  10848. onComplete (rawTrailers) {
  10849. this.retryCount = 0
  10850. return this.handler.onComplete(rawTrailers)
  10851. }
  10852. onError (err) {
  10853. if (this.aborted || isDisturbed(this.opts.body)) {
  10854. return this.handler.onError(err)
  10855. }
  10856. // We reconcile in case of a mix between network errors
  10857. // and server error response
  10858. if (this.retryCount - this.retryCountCheckpoint > 0) {
  10859. // We count the difference between the last checkpoint and the current retry count
  10860. this.retryCount =
  10861. this.retryCountCheckpoint +
  10862. (this.retryCount - this.retryCountCheckpoint)
  10863. } else {
  10864. this.retryCount += 1
  10865. }
  10866. this.retryOpts.retry(
  10867. err,
  10868. {
  10869. state: { counter: this.retryCount },
  10870. opts: { retryOptions: this.retryOpts, ...this.opts }
  10871. },
  10872. onRetry.bind(this)
  10873. )
  10874. function onRetry (err) {
  10875. if (err != null || this.aborted || isDisturbed(this.opts.body)) {
  10876. return this.handler.onError(err)
  10877. }
  10878. if (this.start !== 0) {
  10879. const headers = { range: `bytes=${this.start}-${this.end ?? ''}` }
  10880. // Weak etag check - weak etags will make comparison algorithms never match
  10881. if (this.etag != null) {
  10882. headers['if-match'] = this.etag
  10883. }
  10884. this.opts = {
  10885. ...this.opts,
  10886. headers: {
  10887. ...this.opts.headers,
  10888. ...headers
  10889. }
  10890. }
  10891. }
  10892. try {
  10893. this.retryCountCheckpoint = this.retryCount
  10894. this.dispatch(this.opts, this)
  10895. } catch (err) {
  10896. this.handler.onError(err)
  10897. }
  10898. }
  10899. }
  10900. }
  10901. module.exports = RetryHandler
  10902. /***/ }),
  10903. /***/ 379:
  10904. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10905. const { isIP } = __nccwpck_require__(7030)
  10906. const { lookup } = __nccwpck_require__(610)
  10907. const DecoratorHandler = __nccwpck_require__(8155)
  10908. const { InvalidArgumentError, InformationalError } = __nccwpck_require__(8707)
  10909. const maxInt = Math.pow(2, 31) - 1
  10910. class DNSInstance {
  10911. #maxTTL = 0
  10912. #maxItems = 0
  10913. #records = new Map()
  10914. dualStack = true
  10915. affinity = null
  10916. lookup = null
  10917. pick = null
  10918. constructor (opts) {
  10919. this.#maxTTL = opts.maxTTL
  10920. this.#maxItems = opts.maxItems
  10921. this.dualStack = opts.dualStack
  10922. this.affinity = opts.affinity
  10923. this.lookup = opts.lookup ?? this.#defaultLookup
  10924. this.pick = opts.pick ?? this.#defaultPick
  10925. }
  10926. get full () {
  10927. return this.#records.size === this.#maxItems
  10928. }
  10929. runLookup (origin, opts, cb) {
  10930. const ips = this.#records.get(origin.hostname)
  10931. // If full, we just return the origin
  10932. if (ips == null && this.full) {
  10933. cb(null, origin.origin)
  10934. return
  10935. }
  10936. const newOpts = {
  10937. affinity: this.affinity,
  10938. dualStack: this.dualStack,
  10939. lookup: this.lookup,
  10940. pick: this.pick,
  10941. ...opts.dns,
  10942. maxTTL: this.#maxTTL,
  10943. maxItems: this.#maxItems
  10944. }
  10945. // If no IPs we lookup
  10946. if (ips == null) {
  10947. this.lookup(origin, newOpts, (err, addresses) => {
  10948. if (err || addresses == null || addresses.length === 0) {
  10949. cb(err ?? new InformationalError('No DNS entries found'))
  10950. return
  10951. }
  10952. this.setRecords(origin, addresses)
  10953. const records = this.#records.get(origin.hostname)
  10954. const ip = this.pick(
  10955. origin,
  10956. records,
  10957. newOpts.affinity
  10958. )
  10959. let port
  10960. if (typeof ip.port === 'number') {
  10961. port = `:${ip.port}`
  10962. } else if (origin.port !== '') {
  10963. port = `:${origin.port}`
  10964. } else {
  10965. port = ''
  10966. }
  10967. cb(
  10968. null,
  10969. `${origin.protocol}//${
  10970. ip.family === 6 ? `[${ip.address}]` : ip.address
  10971. }${port}`
  10972. )
  10973. })
  10974. } else {
  10975. // If there's IPs we pick
  10976. const ip = this.pick(
  10977. origin,
  10978. ips,
  10979. newOpts.affinity
  10980. )
  10981. // If no IPs we lookup - deleting old records
  10982. if (ip == null) {
  10983. this.#records.delete(origin.hostname)
  10984. this.runLookup(origin, opts, cb)
  10985. return
  10986. }
  10987. let port
  10988. if (typeof ip.port === 'number') {
  10989. port = `:${ip.port}`
  10990. } else if (origin.port !== '') {
  10991. port = `:${origin.port}`
  10992. } else {
  10993. port = ''
  10994. }
  10995. cb(
  10996. null,
  10997. `${origin.protocol}//${
  10998. ip.family === 6 ? `[${ip.address}]` : ip.address
  10999. }${port}`
  11000. )
  11001. }
  11002. }
  11003. #defaultLookup (origin, opts, cb) {
  11004. lookup(
  11005. origin.hostname,
  11006. {
  11007. all: true,
  11008. family: this.dualStack === false ? this.affinity : 0,
  11009. order: 'ipv4first'
  11010. },
  11011. (err, addresses) => {
  11012. if (err) {
  11013. return cb(err)
  11014. }
  11015. const results = new Map()
  11016. for (const addr of addresses) {
  11017. // On linux we found duplicates, we attempt to remove them with
  11018. // the latest record
  11019. results.set(`${addr.address}:${addr.family}`, addr)
  11020. }
  11021. cb(null, results.values())
  11022. }
  11023. )
  11024. }
  11025. #defaultPick (origin, hostnameRecords, affinity) {
  11026. let ip = null
  11027. const { records, offset } = hostnameRecords
  11028. let family
  11029. if (this.dualStack) {
  11030. if (affinity == null) {
  11031. // Balance between ip families
  11032. if (offset == null || offset === maxInt) {
  11033. hostnameRecords.offset = 0
  11034. affinity = 4
  11035. } else {
  11036. hostnameRecords.offset++
  11037. affinity = (hostnameRecords.offset & 1) === 1 ? 6 : 4
  11038. }
  11039. }
  11040. if (records[affinity] != null && records[affinity].ips.length > 0) {
  11041. family = records[affinity]
  11042. } else {
  11043. family = records[affinity === 4 ? 6 : 4]
  11044. }
  11045. } else {
  11046. family = records[affinity]
  11047. }
  11048. // If no IPs we return null
  11049. if (family == null || family.ips.length === 0) {
  11050. return ip
  11051. }
  11052. if (family.offset == null || family.offset === maxInt) {
  11053. family.offset = 0
  11054. } else {
  11055. family.offset++
  11056. }
  11057. const position = family.offset % family.ips.length
  11058. ip = family.ips[position] ?? null
  11059. if (ip == null) {
  11060. return ip
  11061. }
  11062. if (Date.now() - ip.timestamp > ip.ttl) { // record TTL is already in ms
  11063. // We delete expired records
  11064. // It is possible that they have different TTL, so we manage them individually
  11065. family.ips.splice(position, 1)
  11066. return this.pick(origin, hostnameRecords, affinity)
  11067. }
  11068. return ip
  11069. }
  11070. setRecords (origin, addresses) {
  11071. const timestamp = Date.now()
  11072. const records = { records: { 4: null, 6: null } }
  11073. for (const record of addresses) {
  11074. record.timestamp = timestamp
  11075. if (typeof record.ttl === 'number') {
  11076. // The record TTL is expected to be in ms
  11077. record.ttl = Math.min(record.ttl, this.#maxTTL)
  11078. } else {
  11079. record.ttl = this.#maxTTL
  11080. }
  11081. const familyRecords = records.records[record.family] ?? { ips: [] }
  11082. familyRecords.ips.push(record)
  11083. records.records[record.family] = familyRecords
  11084. }
  11085. this.#records.set(origin.hostname, records)
  11086. }
  11087. getHandler (meta, opts) {
  11088. return new DNSDispatchHandler(this, meta, opts)
  11089. }
  11090. }
  11091. class DNSDispatchHandler extends DecoratorHandler {
  11092. #state = null
  11093. #opts = null
  11094. #dispatch = null
  11095. #handler = null
  11096. #origin = null
  11097. constructor (state, { origin, handler, dispatch }, opts) {
  11098. super(handler)
  11099. this.#origin = origin
  11100. this.#handler = handler
  11101. this.#opts = { ...opts }
  11102. this.#state = state
  11103. this.#dispatch = dispatch
  11104. }
  11105. onError (err) {
  11106. switch (err.code) {
  11107. case 'ETIMEDOUT':
  11108. case 'ECONNREFUSED': {
  11109. if (this.#state.dualStack) {
  11110. // We delete the record and retry
  11111. this.#state.runLookup(this.#origin, this.#opts, (err, newOrigin) => {
  11112. if (err) {
  11113. return this.#handler.onError(err)
  11114. }
  11115. const dispatchOpts = {
  11116. ...this.#opts,
  11117. origin: newOrigin
  11118. }
  11119. this.#dispatch(dispatchOpts, this)
  11120. })
  11121. // if dual-stack disabled, we error out
  11122. return
  11123. }
  11124. this.#handler.onError(err)
  11125. return
  11126. }
  11127. case 'ENOTFOUND':
  11128. this.#state.deleteRecord(this.#origin)
  11129. // eslint-disable-next-line no-fallthrough
  11130. default:
  11131. this.#handler.onError(err)
  11132. break
  11133. }
  11134. }
  11135. }
  11136. module.exports = interceptorOpts => {
  11137. if (
  11138. interceptorOpts?.maxTTL != null &&
  11139. (typeof interceptorOpts?.maxTTL !== 'number' || interceptorOpts?.maxTTL < 0)
  11140. ) {
  11141. throw new InvalidArgumentError('Invalid maxTTL. Must be a positive number')
  11142. }
  11143. if (
  11144. interceptorOpts?.maxItems != null &&
  11145. (typeof interceptorOpts?.maxItems !== 'number' ||
  11146. interceptorOpts?.maxItems < 1)
  11147. ) {
  11148. throw new InvalidArgumentError(
  11149. 'Invalid maxItems. Must be a positive number and greater than zero'
  11150. )
  11151. }
  11152. if (
  11153. interceptorOpts?.affinity != null &&
  11154. interceptorOpts?.affinity !== 4 &&
  11155. interceptorOpts?.affinity !== 6
  11156. ) {
  11157. throw new InvalidArgumentError('Invalid affinity. Must be either 4 or 6')
  11158. }
  11159. if (
  11160. interceptorOpts?.dualStack != null &&
  11161. typeof interceptorOpts?.dualStack !== 'boolean'
  11162. ) {
  11163. throw new InvalidArgumentError('Invalid dualStack. Must be a boolean')
  11164. }
  11165. if (
  11166. interceptorOpts?.lookup != null &&
  11167. typeof interceptorOpts?.lookup !== 'function'
  11168. ) {
  11169. throw new InvalidArgumentError('Invalid lookup. Must be a function')
  11170. }
  11171. if (
  11172. interceptorOpts?.pick != null &&
  11173. typeof interceptorOpts?.pick !== 'function'
  11174. ) {
  11175. throw new InvalidArgumentError('Invalid pick. Must be a function')
  11176. }
  11177. const dualStack = interceptorOpts?.dualStack ?? true
  11178. let affinity
  11179. if (dualStack) {
  11180. affinity = interceptorOpts?.affinity ?? null
  11181. } else {
  11182. affinity = interceptorOpts?.affinity ?? 4
  11183. }
  11184. const opts = {
  11185. maxTTL: interceptorOpts?.maxTTL ?? 10e3, // Expressed in ms
  11186. lookup: interceptorOpts?.lookup ?? null,
  11187. pick: interceptorOpts?.pick ?? null,
  11188. dualStack,
  11189. affinity,
  11190. maxItems: interceptorOpts?.maxItems ?? Infinity
  11191. }
  11192. const instance = new DNSInstance(opts)
  11193. return dispatch => {
  11194. return function dnsInterceptor (origDispatchOpts, handler) {
  11195. const origin =
  11196. origDispatchOpts.origin.constructor === URL
  11197. ? origDispatchOpts.origin
  11198. : new URL(origDispatchOpts.origin)
  11199. if (isIP(origin.hostname) !== 0) {
  11200. return dispatch(origDispatchOpts, handler)
  11201. }
  11202. instance.runLookup(origin, origDispatchOpts, (err, newOrigin) => {
  11203. if (err) {
  11204. return handler.onError(err)
  11205. }
  11206. let dispatchOpts = null
  11207. dispatchOpts = {
  11208. ...origDispatchOpts,
  11209. servername: origin.hostname, // For SNI on TLS
  11210. origin: newOrigin,
  11211. headers: {
  11212. host: origin.hostname,
  11213. ...origDispatchOpts.headers
  11214. }
  11215. }
  11216. dispatch(
  11217. dispatchOpts,
  11218. instance.getHandler({ origin, dispatch, handler }, origDispatchOpts)
  11219. )
  11220. })
  11221. return true
  11222. }
  11223. }
  11224. }
  11225. /***/ }),
  11226. /***/ 8060:
  11227. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11228. const util = __nccwpck_require__(3440)
  11229. const { InvalidArgumentError, RequestAbortedError } = __nccwpck_require__(8707)
  11230. const DecoratorHandler = __nccwpck_require__(8155)
  11231. class DumpHandler extends DecoratorHandler {
  11232. #maxSize = 1024 * 1024
  11233. #abort = null
  11234. #dumped = false
  11235. #aborted = false
  11236. #size = 0
  11237. #reason = null
  11238. #handler = null
  11239. constructor ({ maxSize }, handler) {
  11240. super(handler)
  11241. if (maxSize != null && (!Number.isFinite(maxSize) || maxSize < 1)) {
  11242. throw new InvalidArgumentError('maxSize must be a number greater than 0')
  11243. }
  11244. this.#maxSize = maxSize ?? this.#maxSize
  11245. this.#handler = handler
  11246. }
  11247. onConnect (abort) {
  11248. this.#abort = abort
  11249. this.#handler.onConnect(this.#customAbort.bind(this))
  11250. }
  11251. #customAbort (reason) {
  11252. this.#aborted = true
  11253. this.#reason = reason
  11254. }
  11255. // TODO: will require adjustment after new hooks are out
  11256. onHeaders (statusCode, rawHeaders, resume, statusMessage) {
  11257. const headers = util.parseHeaders(rawHeaders)
  11258. const contentLength = headers['content-length']
  11259. if (contentLength != null && contentLength > this.#maxSize) {
  11260. throw new RequestAbortedError(
  11261. `Response size (${contentLength}) larger than maxSize (${
  11262. this.#maxSize
  11263. })`
  11264. )
  11265. }
  11266. if (this.#aborted) {
  11267. return true
  11268. }
  11269. return this.#handler.onHeaders(
  11270. statusCode,
  11271. rawHeaders,
  11272. resume,
  11273. statusMessage
  11274. )
  11275. }
  11276. onError (err) {
  11277. if (this.#dumped) {
  11278. return
  11279. }
  11280. err = this.#reason ?? err
  11281. this.#handler.onError(err)
  11282. }
  11283. onData (chunk) {
  11284. this.#size = this.#size + chunk.length
  11285. if (this.#size >= this.#maxSize) {
  11286. this.#dumped = true
  11287. if (this.#aborted) {
  11288. this.#handler.onError(this.#reason)
  11289. } else {
  11290. this.#handler.onComplete([])
  11291. }
  11292. }
  11293. return true
  11294. }
  11295. onComplete (trailers) {
  11296. if (this.#dumped) {
  11297. return
  11298. }
  11299. if (this.#aborted) {
  11300. this.#handler.onError(this.reason)
  11301. return
  11302. }
  11303. this.#handler.onComplete(trailers)
  11304. }
  11305. }
  11306. function createDumpInterceptor (
  11307. { maxSize: defaultMaxSize } = {
  11308. maxSize: 1024 * 1024
  11309. }
  11310. ) {
  11311. return dispatch => {
  11312. return function Intercept (opts, handler) {
  11313. const { dumpMaxSize = defaultMaxSize } =
  11314. opts
  11315. const dumpHandler = new DumpHandler(
  11316. { maxSize: dumpMaxSize },
  11317. handler
  11318. )
  11319. return dispatch(opts, dumpHandler)
  11320. }
  11321. }
  11322. }
  11323. module.exports = createDumpInterceptor
  11324. /***/ }),
  11325. /***/ 5092:
  11326. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11327. const RedirectHandler = __nccwpck_require__(8754)
  11328. function createRedirectInterceptor ({ maxRedirections: defaultMaxRedirections }) {
  11329. return (dispatch) => {
  11330. return function Intercept (opts, handler) {
  11331. const { maxRedirections = defaultMaxRedirections } = opts
  11332. if (!maxRedirections) {
  11333. return dispatch(opts, handler)
  11334. }
  11335. const redirectHandler = new RedirectHandler(dispatch, maxRedirections, opts, handler)
  11336. opts = { ...opts, maxRedirections: 0 } // Stop sub dispatcher from also redirecting.
  11337. return dispatch(opts, redirectHandler)
  11338. }
  11339. }
  11340. }
  11341. module.exports = createRedirectInterceptor
  11342. /***/ }),
  11343. /***/ 1514:
  11344. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11345. const RedirectHandler = __nccwpck_require__(8754)
  11346. module.exports = opts => {
  11347. const globalMaxRedirections = opts?.maxRedirections
  11348. return dispatch => {
  11349. return function redirectInterceptor (opts, handler) {
  11350. const { maxRedirections = globalMaxRedirections, ...baseOpts } = opts
  11351. if (!maxRedirections) {
  11352. return dispatch(opts, handler)
  11353. }
  11354. const redirectHandler = new RedirectHandler(
  11355. dispatch,
  11356. maxRedirections,
  11357. opts,
  11358. handler
  11359. )
  11360. return dispatch(baseOpts, redirectHandler)
  11361. }
  11362. }
  11363. }
  11364. /***/ }),
  11365. /***/ 2026:
  11366. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11367. const RetryHandler = __nccwpck_require__(7816)
  11368. module.exports = globalOpts => {
  11369. return dispatch => {
  11370. return function retryInterceptor (opts, handler) {
  11371. return dispatch(
  11372. opts,
  11373. new RetryHandler(
  11374. { ...opts, retryOptions: { ...globalOpts, ...opts.retryOptions } },
  11375. {
  11376. handler,
  11377. dispatch
  11378. }
  11379. )
  11380. )
  11381. }
  11382. }
  11383. }
  11384. /***/ }),
  11385. /***/ 2824:
  11386. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  11387. Object.defineProperty(exports, "__esModule", ({ value: true }));
  11388. 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;
  11389. const utils_1 = __nccwpck_require__(172);
  11390. // C headers
  11391. var ERROR;
  11392. (function (ERROR) {
  11393. ERROR[ERROR["OK"] = 0] = "OK";
  11394. ERROR[ERROR["INTERNAL"] = 1] = "INTERNAL";
  11395. ERROR[ERROR["STRICT"] = 2] = "STRICT";
  11396. ERROR[ERROR["LF_EXPECTED"] = 3] = "LF_EXPECTED";
  11397. ERROR[ERROR["UNEXPECTED_CONTENT_LENGTH"] = 4] = "UNEXPECTED_CONTENT_LENGTH";
  11398. ERROR[ERROR["CLOSED_CONNECTION"] = 5] = "CLOSED_CONNECTION";
  11399. ERROR[ERROR["INVALID_METHOD"] = 6] = "INVALID_METHOD";
  11400. ERROR[ERROR["INVALID_URL"] = 7] = "INVALID_URL";
  11401. ERROR[ERROR["INVALID_CONSTANT"] = 8] = "INVALID_CONSTANT";
  11402. ERROR[ERROR["INVALID_VERSION"] = 9] = "INVALID_VERSION";
  11403. ERROR[ERROR["INVALID_HEADER_TOKEN"] = 10] = "INVALID_HEADER_TOKEN";
  11404. ERROR[ERROR["INVALID_CONTENT_LENGTH"] = 11] = "INVALID_CONTENT_LENGTH";
  11405. ERROR[ERROR["INVALID_CHUNK_SIZE"] = 12] = "INVALID_CHUNK_SIZE";
  11406. ERROR[ERROR["INVALID_STATUS"] = 13] = "INVALID_STATUS";
  11407. ERROR[ERROR["INVALID_EOF_STATE"] = 14] = "INVALID_EOF_STATE";
  11408. ERROR[ERROR["INVALID_TRANSFER_ENCODING"] = 15] = "INVALID_TRANSFER_ENCODING";
  11409. ERROR[ERROR["CB_MESSAGE_BEGIN"] = 16] = "CB_MESSAGE_BEGIN";
  11410. ERROR[ERROR["CB_HEADERS_COMPLETE"] = 17] = "CB_HEADERS_COMPLETE";
  11411. ERROR[ERROR["CB_MESSAGE_COMPLETE"] = 18] = "CB_MESSAGE_COMPLETE";
  11412. ERROR[ERROR["CB_CHUNK_HEADER"] = 19] = "CB_CHUNK_HEADER";
  11413. ERROR[ERROR["CB_CHUNK_COMPLETE"] = 20] = "CB_CHUNK_COMPLETE";
  11414. ERROR[ERROR["PAUSED"] = 21] = "PAUSED";
  11415. ERROR[ERROR["PAUSED_UPGRADE"] = 22] = "PAUSED_UPGRADE";
  11416. ERROR[ERROR["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE";
  11417. ERROR[ERROR["USER"] = 24] = "USER";
  11418. })(ERROR = exports.ERROR || (exports.ERROR = {}));
  11419. var TYPE;
  11420. (function (TYPE) {
  11421. TYPE[TYPE["BOTH"] = 0] = "BOTH";
  11422. TYPE[TYPE["REQUEST"] = 1] = "REQUEST";
  11423. TYPE[TYPE["RESPONSE"] = 2] = "RESPONSE";
  11424. })(TYPE = exports.TYPE || (exports.TYPE = {}));
  11425. var FLAGS;
  11426. (function (FLAGS) {
  11427. FLAGS[FLAGS["CONNECTION_KEEP_ALIVE"] = 1] = "CONNECTION_KEEP_ALIVE";
  11428. FLAGS[FLAGS["CONNECTION_CLOSE"] = 2] = "CONNECTION_CLOSE";
  11429. FLAGS[FLAGS["CONNECTION_UPGRADE"] = 4] = "CONNECTION_UPGRADE";
  11430. FLAGS[FLAGS["CHUNKED"] = 8] = "CHUNKED";
  11431. FLAGS[FLAGS["UPGRADE"] = 16] = "UPGRADE";
  11432. FLAGS[FLAGS["CONTENT_LENGTH"] = 32] = "CONTENT_LENGTH";
  11433. FLAGS[FLAGS["SKIPBODY"] = 64] = "SKIPBODY";
  11434. FLAGS[FLAGS["TRAILING"] = 128] = "TRAILING";
  11435. // 1 << 8 is unused
  11436. FLAGS[FLAGS["TRANSFER_ENCODING"] = 512] = "TRANSFER_ENCODING";
  11437. })(FLAGS = exports.FLAGS || (exports.FLAGS = {}));
  11438. var LENIENT_FLAGS;
  11439. (function (LENIENT_FLAGS) {
  11440. LENIENT_FLAGS[LENIENT_FLAGS["HEADERS"] = 1] = "HEADERS";
  11441. LENIENT_FLAGS[LENIENT_FLAGS["CHUNKED_LENGTH"] = 2] = "CHUNKED_LENGTH";
  11442. LENIENT_FLAGS[LENIENT_FLAGS["KEEP_ALIVE"] = 4] = "KEEP_ALIVE";
  11443. })(LENIENT_FLAGS = exports.LENIENT_FLAGS || (exports.LENIENT_FLAGS = {}));
  11444. var METHODS;
  11445. (function (METHODS) {
  11446. METHODS[METHODS["DELETE"] = 0] = "DELETE";
  11447. METHODS[METHODS["GET"] = 1] = "GET";
  11448. METHODS[METHODS["HEAD"] = 2] = "HEAD";
  11449. METHODS[METHODS["POST"] = 3] = "POST";
  11450. METHODS[METHODS["PUT"] = 4] = "PUT";
  11451. /* pathological */
  11452. METHODS[METHODS["CONNECT"] = 5] = "CONNECT";
  11453. METHODS[METHODS["OPTIONS"] = 6] = "OPTIONS";
  11454. METHODS[METHODS["TRACE"] = 7] = "TRACE";
  11455. /* WebDAV */
  11456. METHODS[METHODS["COPY"] = 8] = "COPY";
  11457. METHODS[METHODS["LOCK"] = 9] = "LOCK";
  11458. METHODS[METHODS["MKCOL"] = 10] = "MKCOL";
  11459. METHODS[METHODS["MOVE"] = 11] = "MOVE";
  11460. METHODS[METHODS["PROPFIND"] = 12] = "PROPFIND";
  11461. METHODS[METHODS["PROPPATCH"] = 13] = "PROPPATCH";
  11462. METHODS[METHODS["SEARCH"] = 14] = "SEARCH";
  11463. METHODS[METHODS["UNLOCK"] = 15] = "UNLOCK";
  11464. METHODS[METHODS["BIND"] = 16] = "BIND";
  11465. METHODS[METHODS["REBIND"] = 17] = "REBIND";
  11466. METHODS[METHODS["UNBIND"] = 18] = "UNBIND";
  11467. METHODS[METHODS["ACL"] = 19] = "ACL";
  11468. /* subversion */
  11469. METHODS[METHODS["REPORT"] = 20] = "REPORT";
  11470. METHODS[METHODS["MKACTIVITY"] = 21] = "MKACTIVITY";
  11471. METHODS[METHODS["CHECKOUT"] = 22] = "CHECKOUT";
  11472. METHODS[METHODS["MERGE"] = 23] = "MERGE";
  11473. /* upnp */
  11474. METHODS[METHODS["M-SEARCH"] = 24] = "M-SEARCH";
  11475. METHODS[METHODS["NOTIFY"] = 25] = "NOTIFY";
  11476. METHODS[METHODS["SUBSCRIBE"] = 26] = "SUBSCRIBE";
  11477. METHODS[METHODS["UNSUBSCRIBE"] = 27] = "UNSUBSCRIBE";
  11478. /* RFC-5789 */
  11479. METHODS[METHODS["PATCH"] = 28] = "PATCH";
  11480. METHODS[METHODS["PURGE"] = 29] = "PURGE";
  11481. /* CalDAV */
  11482. METHODS[METHODS["MKCALENDAR"] = 30] = "MKCALENDAR";
  11483. /* RFC-2068, section 19.6.1.2 */
  11484. METHODS[METHODS["LINK"] = 31] = "LINK";
  11485. METHODS[METHODS["UNLINK"] = 32] = "UNLINK";
  11486. /* icecast */
  11487. METHODS[METHODS["SOURCE"] = 33] = "SOURCE";
  11488. /* RFC-7540, section 11.6 */
  11489. METHODS[METHODS["PRI"] = 34] = "PRI";
  11490. /* RFC-2326 RTSP */
  11491. METHODS[METHODS["DESCRIBE"] = 35] = "DESCRIBE";
  11492. METHODS[METHODS["ANNOUNCE"] = 36] = "ANNOUNCE";
  11493. METHODS[METHODS["SETUP"] = 37] = "SETUP";
  11494. METHODS[METHODS["PLAY"] = 38] = "PLAY";
  11495. METHODS[METHODS["PAUSE"] = 39] = "PAUSE";
  11496. METHODS[METHODS["TEARDOWN"] = 40] = "TEARDOWN";
  11497. METHODS[METHODS["GET_PARAMETER"] = 41] = "GET_PARAMETER";
  11498. METHODS[METHODS["SET_PARAMETER"] = 42] = "SET_PARAMETER";
  11499. METHODS[METHODS["REDIRECT"] = 43] = "REDIRECT";
  11500. METHODS[METHODS["RECORD"] = 44] = "RECORD";
  11501. /* RAOP */
  11502. METHODS[METHODS["FLUSH"] = 45] = "FLUSH";
  11503. })(METHODS = exports.METHODS || (exports.METHODS = {}));
  11504. exports.METHODS_HTTP = [
  11505. METHODS.DELETE,
  11506. METHODS.GET,
  11507. METHODS.HEAD,
  11508. METHODS.POST,
  11509. METHODS.PUT,
  11510. METHODS.CONNECT,
  11511. METHODS.OPTIONS,
  11512. METHODS.TRACE,
  11513. METHODS.COPY,
  11514. METHODS.LOCK,
  11515. METHODS.MKCOL,
  11516. METHODS.MOVE,
  11517. METHODS.PROPFIND,
  11518. METHODS.PROPPATCH,
  11519. METHODS.SEARCH,
  11520. METHODS.UNLOCK,
  11521. METHODS.BIND,
  11522. METHODS.REBIND,
  11523. METHODS.UNBIND,
  11524. METHODS.ACL,
  11525. METHODS.REPORT,
  11526. METHODS.MKACTIVITY,
  11527. METHODS.CHECKOUT,
  11528. METHODS.MERGE,
  11529. METHODS['M-SEARCH'],
  11530. METHODS.NOTIFY,
  11531. METHODS.SUBSCRIBE,
  11532. METHODS.UNSUBSCRIBE,
  11533. METHODS.PATCH,
  11534. METHODS.PURGE,
  11535. METHODS.MKCALENDAR,
  11536. METHODS.LINK,
  11537. METHODS.UNLINK,
  11538. METHODS.PRI,
  11539. // TODO(indutny): should we allow it with HTTP?
  11540. METHODS.SOURCE,
  11541. ];
  11542. exports.METHODS_ICE = [
  11543. METHODS.SOURCE,
  11544. ];
  11545. exports.METHODS_RTSP = [
  11546. METHODS.OPTIONS,
  11547. METHODS.DESCRIBE,
  11548. METHODS.ANNOUNCE,
  11549. METHODS.SETUP,
  11550. METHODS.PLAY,
  11551. METHODS.PAUSE,
  11552. METHODS.TEARDOWN,
  11553. METHODS.GET_PARAMETER,
  11554. METHODS.SET_PARAMETER,
  11555. METHODS.REDIRECT,
  11556. METHODS.RECORD,
  11557. METHODS.FLUSH,
  11558. // For AirPlay
  11559. METHODS.GET,
  11560. METHODS.POST,
  11561. ];
  11562. exports.METHOD_MAP = utils_1.enumToMap(METHODS);
  11563. exports.H_METHOD_MAP = {};
  11564. Object.keys(exports.METHOD_MAP).forEach((key) => {
  11565. if (/^H/.test(key)) {
  11566. exports.H_METHOD_MAP[key] = exports.METHOD_MAP[key];
  11567. }
  11568. });
  11569. var FINISH;
  11570. (function (FINISH) {
  11571. FINISH[FINISH["SAFE"] = 0] = "SAFE";
  11572. FINISH[FINISH["SAFE_WITH_CB"] = 1] = "SAFE_WITH_CB";
  11573. FINISH[FINISH["UNSAFE"] = 2] = "UNSAFE";
  11574. })(FINISH = exports.FINISH || (exports.FINISH = {}));
  11575. exports.ALPHA = [];
  11576. for (let i = 'A'.charCodeAt(0); i <= 'Z'.charCodeAt(0); i++) {
  11577. // Upper case
  11578. exports.ALPHA.push(String.fromCharCode(i));
  11579. // Lower case
  11580. exports.ALPHA.push(String.fromCharCode(i + 0x20));
  11581. }
  11582. exports.NUM_MAP = {
  11583. 0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
  11584. 5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
  11585. };
  11586. exports.HEX_MAP = {
  11587. 0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
  11588. 5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
  11589. A: 0XA, B: 0XB, C: 0XC, D: 0XD, E: 0XE, F: 0XF,
  11590. a: 0xa, b: 0xb, c: 0xc, d: 0xd, e: 0xe, f: 0xf,
  11591. };
  11592. exports.NUM = [
  11593. '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  11594. ];
  11595. exports.ALPHANUM = exports.ALPHA.concat(exports.NUM);
  11596. exports.MARK = ['-', '_', '.', '!', '~', '*', '\'', '(', ')'];
  11597. exports.USERINFO_CHARS = exports.ALPHANUM
  11598. .concat(exports.MARK)
  11599. .concat(['%', ';', ':', '&', '=', '+', '$', ',']);
  11600. // TODO(indutny): use RFC
  11601. exports.STRICT_URL_CHAR = [
  11602. '!', '"', '$', '%', '&', '\'',
  11603. '(', ')', '*', '+', ',', '-', '.', '/',
  11604. ':', ';', '<', '=', '>',
  11605. '@', '[', '\\', ']', '^', '_',
  11606. '`',
  11607. '{', '|', '}', '~',
  11608. ].concat(exports.ALPHANUM);
  11609. exports.URL_CHAR = exports.STRICT_URL_CHAR
  11610. .concat(['\t', '\f']);
  11611. // All characters with 0x80 bit set to 1
  11612. for (let i = 0x80; i <= 0xff; i++) {
  11613. exports.URL_CHAR.push(i);
  11614. }
  11615. exports.HEX = exports.NUM.concat(['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']);
  11616. /* Tokens as defined by rfc 2616. Also lowercases them.
  11617. * token = 1*<any CHAR except CTLs or separators>
  11618. * separators = "(" | ")" | "<" | ">" | "@"
  11619. * | "," | ";" | ":" | "\" | <">
  11620. * | "/" | "[" | "]" | "?" | "="
  11621. * | "{" | "}" | SP | HT
  11622. */
  11623. exports.STRICT_TOKEN = [
  11624. '!', '#', '$', '%', '&', '\'',
  11625. '*', '+', '-', '.',
  11626. '^', '_', '`',
  11627. '|', '~',
  11628. ].concat(exports.ALPHANUM);
  11629. exports.TOKEN = exports.STRICT_TOKEN.concat([' ']);
  11630. /*
  11631. * Verify that a char is a valid visible (printable) US-ASCII
  11632. * character or %x80-FF
  11633. */
  11634. exports.HEADER_CHARS = ['\t'];
  11635. for (let i = 32; i <= 255; i++) {
  11636. if (i !== 127) {
  11637. exports.HEADER_CHARS.push(i);
  11638. }
  11639. }
  11640. // ',' = \x44
  11641. exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS.filter((c) => c !== 44);
  11642. exports.MAJOR = exports.NUM_MAP;
  11643. exports.MINOR = exports.MAJOR;
  11644. var HEADER_STATE;
  11645. (function (HEADER_STATE) {
  11646. HEADER_STATE[HEADER_STATE["GENERAL"] = 0] = "GENERAL";
  11647. HEADER_STATE[HEADER_STATE["CONNECTION"] = 1] = "CONNECTION";
  11648. HEADER_STATE[HEADER_STATE["CONTENT_LENGTH"] = 2] = "CONTENT_LENGTH";
  11649. HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING"] = 3] = "TRANSFER_ENCODING";
  11650. HEADER_STATE[HEADER_STATE["UPGRADE"] = 4] = "UPGRADE";
  11651. HEADER_STATE[HEADER_STATE["CONNECTION_KEEP_ALIVE"] = 5] = "CONNECTION_KEEP_ALIVE";
  11652. HEADER_STATE[HEADER_STATE["CONNECTION_CLOSE"] = 6] = "CONNECTION_CLOSE";
  11653. HEADER_STATE[HEADER_STATE["CONNECTION_UPGRADE"] = 7] = "CONNECTION_UPGRADE";
  11654. HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING_CHUNKED"] = 8] = "TRANSFER_ENCODING_CHUNKED";
  11655. })(HEADER_STATE = exports.HEADER_STATE || (exports.HEADER_STATE = {}));
  11656. exports.SPECIAL_HEADERS = {
  11657. 'connection': HEADER_STATE.CONNECTION,
  11658. 'content-length': HEADER_STATE.CONTENT_LENGTH,
  11659. 'proxy-connection': HEADER_STATE.CONNECTION,
  11660. 'transfer-encoding': HEADER_STATE.TRANSFER_ENCODING,
  11661. 'upgrade': HEADER_STATE.UPGRADE,
  11662. };
  11663. //# sourceMappingURL=constants.js.map
  11664. /***/ }),
  11665. /***/ 3870:
  11666. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11667. const { Buffer } = __nccwpck_require__(4573)
  11668. module.exports = Buffer.from('AGFzbQEAAAABJwdgAX8Bf2ADf39/AX9gAX8AYAJ/fwBgBH9/f38Bf2AAAGADf39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQAEA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAAy0sBQYAAAIAAAAAAAACAQIAAgICAAADAAAAAAMDAwMBAQEBAQEBAQEAAAIAAAAEBQFwARISBQMBAAIGCAF/AUGA1AQLB9EFIgZtZW1vcnkCAAtfaW5pdGlhbGl6ZQAIGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtsbGh0dHBfaW5pdAAJGGxsaHR0cF9zaG91bGRfa2VlcF9hbGl2ZQAvDGxsaHR0cF9hbGxvYwALBm1hbGxvYwAxC2xsaHR0cF9mcmVlAAwEZnJlZQAMD2xsaHR0cF9nZXRfdHlwZQANFWxsaHR0cF9nZXRfaHR0cF9tYWpvcgAOFWxsaHR0cF9nZXRfaHR0cF9taW5vcgAPEWxsaHR0cF9nZXRfbWV0aG9kABAWbGxodHRwX2dldF9zdGF0dXNfY29kZQAREmxsaHR0cF9nZXRfdXBncmFkZQASDGxsaHR0cF9yZXNldAATDmxsaHR0cF9leGVjdXRlABQUbGxodHRwX3NldHRpbmdzX2luaXQAFQ1sbGh0dHBfZmluaXNoABYMbGxodHRwX3BhdXNlABcNbGxodHRwX3Jlc3VtZQAYG2xsaHR0cF9yZXN1bWVfYWZ0ZXJfdXBncmFkZQAZEGxsaHR0cF9nZXRfZ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ATYCDCAAIAE2AgggASAANgIMIAEgAjYCCAwBC0EfIQIgBEH///8HTQRAIARBJiAEQQh2ZyIAa3ZBAXEgAEEBdGtBPmohAgsgASACNgIcIAFCADcCECACQQJ0QbzSAGohAAJAQZDQACgCACIDQQEgAnQiB3FFBEAgACABNgIAQZDQACADIAdyNgIAIAEgADYCGCABIAE2AgggASABNgIMDAELIARBGSACQQF2a0EAIAJBH0cbdCECIAAoAgAhAAJAA0AgACIDKAIEQXhxIARGDQEgAkEddiEAIAJBAXQhAiADIABBBHFqQRBqIgcoAgAiAA0ACyAHIAE2AgAgASADNgIYIAEgATYCDCABIAE2AggMAQsgAygCCCIAIAE2AgwgAyABNgIIIAFBADYCGCABIAM2AgwgASAANgIIC0Gs0ABBrNAAKAIAQQFrIgBBfyAAGzYCAAsLBwAgAC0AKAsHACAALQAqCwcAIAAtACsLBwAgAC0AKQsHACAALwEyCwcAIAAtAC4LQAEEfyAAKAIYIQEgAC0ALSECIAAtACghAyAAKAI4IQQgABAwIAAgBDYCOCAAIAM6ACggACACOgAtIAAgATYCGAu74gECB38DfiABIAJqIQQCQCAAIgIoAgwiAA0AIAIoAgQEQCACIAE2AgQLIwBBEGsiCCQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAA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DC0HAAQwCC0HCAQwBC0HBAQshAwNAAkACQAJAAkACQAJAAkACQAJAIAICfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAgJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAn8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCADDsYBAAECAwQFBgcICQoLDA0ODxAREh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NDSFNFQVlTVEFUQ0hHRU9SRElSRUNUT1JUUkNIUEFSQU1FVEVSVVJDRUJTQ1JJQkVBUkRPV05BQ0VJTkROS0NLVUJTQ1JJQkVIVFRQL0FEVFAv', 'base64')
  11669. /***/ }),
  11670. /***/ 3434:
  11671. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11672. const { Buffer } = __nccwpck_require__(4573)
  11673. module.exports = Buffer.from('AGFzbQEAAAABJwdgAX8Bf2ADf39/AX9gAX8AYAJ/fwBgBH9/f38Bf2AAAGADf39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQAEA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAAy0sBQYAAAIAAAAAAAACAQIAAgICAAADAAAAAAMDAwMBAQEBAQEBAQEAAAIAAAAEBQFwARISBQMBAAIGCAF/AUGA1AQLB9EFIgZtZW1vcnkCAAtfaW5pdGlhbGl6ZQAIGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtsbGh0dHBfaW5pdAAJGGxsaHR0cF9zaG91bGRfa2VlcF9hbGl2ZQAvDGxsaHR0cF9hbGxvYwALBm1hbGxvYwAxC2xsaHR0cF9mcmVlAAwEZnJlZQAMD2xsaHR0cF9nZXRfdHlwZQANFWxsaHR0cF9nZXRfaHR0cF9tYWpvcgAOFWxsaHR0cF9nZXRfaHR0cF9taW5vcgAPEWxsaHR0cF9nZXRfbWV0aG9kABAWbGxodHRwX2dldF9zdGF0dXNfY29kZQAREmxsaHR0cF9nZXRfdXBncmFkZQASDGxsaHR0cF9yZXNldAATDmxsaHR0cF9leGVjdXRlABQU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AsgASAEaiAENgIAIAEgBEEBcjYCBCABQaDQACgCAEcNAEGU0AAgBDYCAAwBCyAEQf8BTQRAIARBeHFBtNAAaiEAAn9BjNAAKAIAIgJBASAEQQN2dCIDcUUEQEGM0AAgAiADcjYCACAADAELIAAoAggLIgIgATYCDCAAIAE2AgggASAANgIMIAEgAjYCCAwBC0EfIQIgBEH///8HTQRAIARBJiAEQQh2ZyIAa3ZBAXEgAEEBdGtBPmohAgsgASACNgIcIAFCADcCECACQQJ0QbzSAGohAAJAQZDQACgCACIDQQEgAnQiB3FFBEAgACABNgIAQZDQACADIAdyNgIAIAEgADYCGCABIAE2AgggASABNgIMDAELIARBGSACQQF2a0EAIAJBH0cbdCECIAAoAgAhAAJAA0AgACIDKAIEQXhxIARGDQEgAkEddiEAIAJBAXQhAiADIABBBHFqQRBqIgcoAgAiAA0ACyAHIAE2AgAgASADNgIYIAEgATYCDCABIAE2AggMAQsgAygCCCIAIAE2AgwgAyABNgIIIAFBADYCGCABIAM2AgwgASAANgIIC0Gs0ABBrNAAKAIAQQFrIgBBfyAAGzYCAAsLBwAgAC0AKAsHACAALQAqCwcAIAAtACsLBwAgAC0AKQsHACAALwEyCwcAIAAtAC4LQAEEfyAAKAIYIQEgAC0ALSECIAAtACghAyAAKAI4IQQgABAwIAAgBDYCOCAAIAM6ACggACACOgAtIAAgATYCGAu74gECB38DfiABIAJqIQQCQCAAIgIoAgwiAA0AIAIoAgQEQCACIAE2AgQLIwBBEGsiCCQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQ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VC0GvAQwUC0GwAQwTC0GxAQwSC0GzAQwRC0GyAQwQC0G0AQwPC0G1AQwOC0G2AQwNC0G3AQwMC0G4AQwLC0G5AQwKC0G6AQwJC0G7AQwIC0HGAQwHC0G8AQwGC0G9AQwFC0G+AQwEC0G/AQwDC0HAAQwCC0HCAQwBC0HBAQshAwNAAkACQAJAAkACQAJAAkACQAJAIAICfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAgJ/AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACfwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACfwJAAkACQAJAAn8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAA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wMDAwMDAwMDAwMDAwBB+swACwQBAAABAEGQzQALAQEAQZrNAAsGAgAAAAACAEGxzQALOgMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAQfDOAAuWAU5PVU5DRUVDS09VVE5FQ1RFVEVDUklCRUxVU0hFVEVBRFNFQVJDSFJHRUNUSVZJVFlMRU5EQVJWRU9USUZZUFRJT05TQ0hTRUFZU1RBVENIR0VPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFSFRUUC9BRFRQLw==', 'base64')
  11674. /***/ }),
  11675. /***/ 172:
  11676. /***/ ((__unused_webpack_module, exports) => {
  11677. Object.defineProperty(exports, "__esModule", ({ value: true }));
  11678. exports.enumToMap = void 0;
  11679. function enumToMap(obj) {
  11680. const res = {};
  11681. Object.keys(obj).forEach((key) => {
  11682. const value = obj[key];
  11683. if (typeof value === 'number') {
  11684. res[key] = value;
  11685. }
  11686. });
  11687. return res;
  11688. }
  11689. exports.enumToMap = enumToMap;
  11690. //# sourceMappingURL=utils.js.map
  11691. /***/ }),
  11692. /***/ 7501:
  11693. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11694. const { kClients } = __nccwpck_require__(6443)
  11695. const Agent = __nccwpck_require__(7405)
  11696. const {
  11697. kAgent,
  11698. kMockAgentSet,
  11699. kMockAgentGet,
  11700. kDispatches,
  11701. kIsMockActive,
  11702. kNetConnect,
  11703. kGetNetConnect,
  11704. kOptions,
  11705. kFactory
  11706. } = __nccwpck_require__(1117)
  11707. const MockClient = __nccwpck_require__(7365)
  11708. const MockPool = __nccwpck_require__(4004)
  11709. const { matchValue, buildMockOptions } = __nccwpck_require__(3397)
  11710. const { InvalidArgumentError, UndiciError } = __nccwpck_require__(8707)
  11711. const Dispatcher = __nccwpck_require__(883)
  11712. const Pluralizer = __nccwpck_require__(1529)
  11713. const PendingInterceptorsFormatter = __nccwpck_require__(6142)
  11714. class MockAgent extends Dispatcher {
  11715. constructor (opts) {
  11716. super(opts)
  11717. this[kNetConnect] = true
  11718. this[kIsMockActive] = true
  11719. // Instantiate Agent and encapsulate
  11720. if ((opts?.agent && typeof opts.agent.dispatch !== 'function')) {
  11721. throw new InvalidArgumentError('Argument opts.agent must implement Agent')
  11722. }
  11723. const agent = opts?.agent ? opts.agent : new Agent(opts)
  11724. this[kAgent] = agent
  11725. this[kClients] = agent[kClients]
  11726. this[kOptions] = buildMockOptions(opts)
  11727. }
  11728. get (origin) {
  11729. let dispatcher = this[kMockAgentGet](origin)
  11730. if (!dispatcher) {
  11731. dispatcher = this[kFactory](origin)
  11732. this[kMockAgentSet](origin, dispatcher)
  11733. }
  11734. return dispatcher
  11735. }
  11736. dispatch (opts, handler) {
  11737. // Call MockAgent.get to perform additional setup before dispatching as normal
  11738. this.get(opts.origin)
  11739. return this[kAgent].dispatch(opts, handler)
  11740. }
  11741. async close () {
  11742. await this[kAgent].close()
  11743. this[kClients].clear()
  11744. }
  11745. deactivate () {
  11746. this[kIsMockActive] = false
  11747. }
  11748. activate () {
  11749. this[kIsMockActive] = true
  11750. }
  11751. enableNetConnect (matcher) {
  11752. if (typeof matcher === 'string' || typeof matcher === 'function' || matcher instanceof RegExp) {
  11753. if (Array.isArray(this[kNetConnect])) {
  11754. this[kNetConnect].push(matcher)
  11755. } else {
  11756. this[kNetConnect] = [matcher]
  11757. }
  11758. } else if (typeof matcher === 'undefined') {
  11759. this[kNetConnect] = true
  11760. } else {
  11761. throw new InvalidArgumentError('Unsupported matcher. Must be one of String|Function|RegExp.')
  11762. }
  11763. }
  11764. disableNetConnect () {
  11765. this[kNetConnect] = false
  11766. }
  11767. // This is required to bypass issues caused by using global symbols - see:
  11768. // https://github.com/nodejs/undici/issues/1447
  11769. get isMockActive () {
  11770. return this[kIsMockActive]
  11771. }
  11772. [kMockAgentSet] (origin, dispatcher) {
  11773. this[kClients].set(origin, dispatcher)
  11774. }
  11775. [kFactory] (origin) {
  11776. const mockOptions = Object.assign({ agent: this }, this[kOptions])
  11777. return this[kOptions] && this[kOptions].connections === 1
  11778. ? new MockClient(origin, mockOptions)
  11779. : new MockPool(origin, mockOptions)
  11780. }
  11781. [kMockAgentGet] (origin) {
  11782. // First check if we can immediately find it
  11783. const client = this[kClients].get(origin)
  11784. if (client) {
  11785. return client
  11786. }
  11787. // If the origin is not a string create a dummy parent pool and return to user
  11788. if (typeof origin !== 'string') {
  11789. const dispatcher = this[kFactory]('http://localhost:9999')
  11790. this[kMockAgentSet](origin, dispatcher)
  11791. return dispatcher
  11792. }
  11793. // If we match, create a pool and assign the same dispatches
  11794. for (const [keyMatcher, nonExplicitDispatcher] of Array.from(this[kClients])) {
  11795. if (nonExplicitDispatcher && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) {
  11796. const dispatcher = this[kFactory](origin)
  11797. this[kMockAgentSet](origin, dispatcher)
  11798. dispatcher[kDispatches] = nonExplicitDispatcher[kDispatches]
  11799. return dispatcher
  11800. }
  11801. }
  11802. }
  11803. [kGetNetConnect] () {
  11804. return this[kNetConnect]
  11805. }
  11806. pendingInterceptors () {
  11807. const mockAgentClients = this[kClients]
  11808. return Array.from(mockAgentClients.entries())
  11809. .flatMap(([origin, scope]) => scope[kDispatches].map(dispatch => ({ ...dispatch, origin })))
  11810. .filter(({ pending }) => pending)
  11811. }
  11812. assertNoPendingInterceptors ({ pendingInterceptorsFormatter = new PendingInterceptorsFormatter() } = {}) {
  11813. const pending = this.pendingInterceptors()
  11814. if (pending.length === 0) {
  11815. return
  11816. }
  11817. const pluralizer = new Pluralizer('interceptor', 'interceptors').pluralize(pending.length)
  11818. throw new UndiciError(`
  11819. ${pluralizer.count} ${pluralizer.noun} ${pluralizer.is} pending:
  11820. ${pendingInterceptorsFormatter.format(pending)}
  11821. `.trim())
  11822. }
  11823. }
  11824. module.exports = MockAgent
  11825. /***/ }),
  11826. /***/ 7365:
  11827. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11828. const { promisify } = __nccwpck_require__(7975)
  11829. const Client = __nccwpck_require__(3701)
  11830. const { buildMockDispatch } = __nccwpck_require__(3397)
  11831. const {
  11832. kDispatches,
  11833. kMockAgent,
  11834. kClose,
  11835. kOriginalClose,
  11836. kOrigin,
  11837. kOriginalDispatch,
  11838. kConnected
  11839. } = __nccwpck_require__(1117)
  11840. const { MockInterceptor } = __nccwpck_require__(1511)
  11841. const Symbols = __nccwpck_require__(6443)
  11842. const { InvalidArgumentError } = __nccwpck_require__(8707)
  11843. /**
  11844. * MockClient provides an API that extends the Client to influence the mockDispatches.
  11845. */
  11846. class MockClient extends Client {
  11847. constructor (origin, opts) {
  11848. super(origin, opts)
  11849. if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') {
  11850. throw new InvalidArgumentError('Argument opts.agent must implement Agent')
  11851. }
  11852. this[kMockAgent] = opts.agent
  11853. this[kOrigin] = origin
  11854. this[kDispatches] = []
  11855. this[kConnected] = 1
  11856. this[kOriginalDispatch] = this.dispatch
  11857. this[kOriginalClose] = this.close.bind(this)
  11858. this.dispatch = buildMockDispatch.call(this)
  11859. this.close = this[kClose]
  11860. }
  11861. get [Symbols.kConnected] () {
  11862. return this[kConnected]
  11863. }
  11864. /**
  11865. * Sets up the base interceptor for mocking replies from undici.
  11866. */
  11867. intercept (opts) {
  11868. return new MockInterceptor(opts, this[kDispatches])
  11869. }
  11870. async [kClose] () {
  11871. await promisify(this[kOriginalClose])()
  11872. this[kConnected] = 0
  11873. this[kMockAgent][Symbols.kClients].delete(this[kOrigin])
  11874. }
  11875. }
  11876. module.exports = MockClient
  11877. /***/ }),
  11878. /***/ 2429:
  11879. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11880. const { UndiciError } = __nccwpck_require__(8707)
  11881. const kMockNotMatchedError = Symbol.for('undici.error.UND_MOCK_ERR_MOCK_NOT_MATCHED')
  11882. /**
  11883. * The request does not match any registered mock dispatches.
  11884. */
  11885. class MockNotMatchedError extends UndiciError {
  11886. constructor (message) {
  11887. super(message)
  11888. Error.captureStackTrace(this, MockNotMatchedError)
  11889. this.name = 'MockNotMatchedError'
  11890. this.message = message || 'The request does not match any registered mock dispatches'
  11891. this.code = 'UND_MOCK_ERR_MOCK_NOT_MATCHED'
  11892. }
  11893. static [Symbol.hasInstance] (instance) {
  11894. return instance && instance[kMockNotMatchedError] === true
  11895. }
  11896. [kMockNotMatchedError] = true
  11897. }
  11898. module.exports = {
  11899. MockNotMatchedError
  11900. }
  11901. /***/ }),
  11902. /***/ 1511:
  11903. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11904. const { getResponseData, buildKey, addMockDispatch } = __nccwpck_require__(3397)
  11905. const {
  11906. kDispatches,
  11907. kDispatchKey,
  11908. kDefaultHeaders,
  11909. kDefaultTrailers,
  11910. kContentLength,
  11911. kMockDispatch
  11912. } = __nccwpck_require__(1117)
  11913. const { InvalidArgumentError } = __nccwpck_require__(8707)
  11914. const { buildURL } = __nccwpck_require__(3440)
  11915. /**
  11916. * Defines the scope API for an interceptor reply
  11917. */
  11918. class MockScope {
  11919. constructor (mockDispatch) {
  11920. this[kMockDispatch] = mockDispatch
  11921. }
  11922. /**
  11923. * Delay a reply by a set amount in ms.
  11924. */
  11925. delay (waitInMs) {
  11926. if (typeof waitInMs !== 'number' || !Number.isInteger(waitInMs) || waitInMs <= 0) {
  11927. throw new InvalidArgumentError('waitInMs must be a valid integer > 0')
  11928. }
  11929. this[kMockDispatch].delay = waitInMs
  11930. return this
  11931. }
  11932. /**
  11933. * For a defined reply, never mark as consumed.
  11934. */
  11935. persist () {
  11936. this[kMockDispatch].persist = true
  11937. return this
  11938. }
  11939. /**
  11940. * Allow one to define a reply for a set amount of matching requests.
  11941. */
  11942. times (repeatTimes) {
  11943. if (typeof repeatTimes !== 'number' || !Number.isInteger(repeatTimes) || repeatTimes <= 0) {
  11944. throw new InvalidArgumentError('repeatTimes must be a valid integer > 0')
  11945. }
  11946. this[kMockDispatch].times = repeatTimes
  11947. return this
  11948. }
  11949. }
  11950. /**
  11951. * Defines an interceptor for a Mock
  11952. */
  11953. class MockInterceptor {
  11954. constructor (opts, mockDispatches) {
  11955. if (typeof opts !== 'object') {
  11956. throw new InvalidArgumentError('opts must be an object')
  11957. }
  11958. if (typeof opts.path === 'undefined') {
  11959. throw new InvalidArgumentError('opts.path must be defined')
  11960. }
  11961. if (typeof opts.method === 'undefined') {
  11962. opts.method = 'GET'
  11963. }
  11964. // See https://github.com/nodejs/undici/issues/1245
  11965. // As per RFC 3986, clients are not supposed to send URI
  11966. // fragments to servers when they retrieve a document,
  11967. if (typeof opts.path === 'string') {
  11968. if (opts.query) {
  11969. opts.path = buildURL(opts.path, opts.query)
  11970. } else {
  11971. // Matches https://github.com/nodejs/undici/blob/main/lib/web/fetch/index.js#L1811
  11972. const parsedURL = new URL(opts.path, 'data://')
  11973. opts.path = parsedURL.pathname + parsedURL.search
  11974. }
  11975. }
  11976. if (typeof opts.method === 'string') {
  11977. opts.method = opts.method.toUpperCase()
  11978. }
  11979. this[kDispatchKey] = buildKey(opts)
  11980. this[kDispatches] = mockDispatches
  11981. this[kDefaultHeaders] = {}
  11982. this[kDefaultTrailers] = {}
  11983. this[kContentLength] = false
  11984. }
  11985. createMockScopeDispatchData ({ statusCode, data, responseOptions }) {
  11986. const responseData = getResponseData(data)
  11987. const contentLength = this[kContentLength] ? { 'content-length': responseData.length } : {}
  11988. const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }
  11989. const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }
  11990. return { statusCode, data, headers, trailers }
  11991. }
  11992. validateReplyParameters (replyParameters) {
  11993. if (typeof replyParameters.statusCode === 'undefined') {
  11994. throw new InvalidArgumentError('statusCode must be defined')
  11995. }
  11996. if (typeof replyParameters.responseOptions !== 'object' || replyParameters.responseOptions === null) {
  11997. throw new InvalidArgumentError('responseOptions must be an object')
  11998. }
  11999. }
  12000. /**
  12001. * Mock an undici request with a defined reply.
  12002. */
  12003. reply (replyOptionsCallbackOrStatusCode) {
  12004. // Values of reply aren't available right now as they
  12005. // can only be available when the reply callback is invoked.
  12006. if (typeof replyOptionsCallbackOrStatusCode === 'function') {
  12007. // We'll first wrap the provided callback in another function,
  12008. // this function will properly resolve the data from the callback
  12009. // when invoked.
  12010. const wrappedDefaultsCallback = (opts) => {
  12011. // Our reply options callback contains the parameter for statusCode, data and options.
  12012. const resolvedData = replyOptionsCallbackOrStatusCode(opts)
  12013. // Check if it is in the right format
  12014. if (typeof resolvedData !== 'object' || resolvedData === null) {
  12015. throw new InvalidArgumentError('reply options callback must return an object')
  12016. }
  12017. const replyParameters = { data: '', responseOptions: {}, ...resolvedData }
  12018. this.validateReplyParameters(replyParameters)
  12019. // Since the values can be obtained immediately we return them
  12020. // from this higher order function that will be resolved later.
  12021. return {
  12022. ...this.createMockScopeDispatchData(replyParameters)
  12023. }
  12024. }
  12025. // Add usual dispatch data, but this time set the data parameter to function that will eventually provide data.
  12026. const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], wrappedDefaultsCallback)
  12027. return new MockScope(newMockDispatch)
  12028. }
  12029. // We can have either one or three parameters, if we get here,
  12030. // we should have 1-3 parameters. So we spread the arguments of
  12031. // this function to obtain the parameters, since replyData will always
  12032. // just be the statusCode.
  12033. const replyParameters = {
  12034. statusCode: replyOptionsCallbackOrStatusCode,
  12035. data: arguments[1] === undefined ? '' : arguments[1],
  12036. responseOptions: arguments[2] === undefined ? {} : arguments[2]
  12037. }
  12038. this.validateReplyParameters(replyParameters)
  12039. // Send in-already provided data like usual
  12040. const dispatchData = this.createMockScopeDispatchData(replyParameters)
  12041. const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], dispatchData)
  12042. return new MockScope(newMockDispatch)
  12043. }
  12044. /**
  12045. * Mock an undici request with a defined error.
  12046. */
  12047. replyWithError (error) {
  12048. if (typeof error === 'undefined') {
  12049. throw new InvalidArgumentError('error must be defined')
  12050. }
  12051. const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error })
  12052. return new MockScope(newMockDispatch)
  12053. }
  12054. /**
  12055. * Set default reply headers on the interceptor for subsequent replies
  12056. */
  12057. defaultReplyHeaders (headers) {
  12058. if (typeof headers === 'undefined') {
  12059. throw new InvalidArgumentError('headers must be defined')
  12060. }
  12061. this[kDefaultHeaders] = headers
  12062. return this
  12063. }
  12064. /**
  12065. * Set default reply trailers on the interceptor for subsequent replies
  12066. */
  12067. defaultReplyTrailers (trailers) {
  12068. if (typeof trailers === 'undefined') {
  12069. throw new InvalidArgumentError('trailers must be defined')
  12070. }
  12071. this[kDefaultTrailers] = trailers
  12072. return this
  12073. }
  12074. /**
  12075. * Set reply content length header for replies on the interceptor
  12076. */
  12077. replyContentLength () {
  12078. this[kContentLength] = true
  12079. return this
  12080. }
  12081. }
  12082. module.exports.MockInterceptor = MockInterceptor
  12083. module.exports.MockScope = MockScope
  12084. /***/ }),
  12085. /***/ 4004:
  12086. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12087. const { promisify } = __nccwpck_require__(7975)
  12088. const Pool = __nccwpck_require__(628)
  12089. const { buildMockDispatch } = __nccwpck_require__(3397)
  12090. const {
  12091. kDispatches,
  12092. kMockAgent,
  12093. kClose,
  12094. kOriginalClose,
  12095. kOrigin,
  12096. kOriginalDispatch,
  12097. kConnected
  12098. } = __nccwpck_require__(1117)
  12099. const { MockInterceptor } = __nccwpck_require__(1511)
  12100. const Symbols = __nccwpck_require__(6443)
  12101. const { InvalidArgumentError } = __nccwpck_require__(8707)
  12102. /**
  12103. * MockPool provides an API that extends the Pool to influence the mockDispatches.
  12104. */
  12105. class MockPool extends Pool {
  12106. constructor (origin, opts) {
  12107. super(origin, opts)
  12108. if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') {
  12109. throw new InvalidArgumentError('Argument opts.agent must implement Agent')
  12110. }
  12111. this[kMockAgent] = opts.agent
  12112. this[kOrigin] = origin
  12113. this[kDispatches] = []
  12114. this[kConnected] = 1
  12115. this[kOriginalDispatch] = this.dispatch
  12116. this[kOriginalClose] = this.close.bind(this)
  12117. this.dispatch = buildMockDispatch.call(this)
  12118. this.close = this[kClose]
  12119. }
  12120. get [Symbols.kConnected] () {
  12121. return this[kConnected]
  12122. }
  12123. /**
  12124. * Sets up the base interceptor for mocking replies from undici.
  12125. */
  12126. intercept (opts) {
  12127. return new MockInterceptor(opts, this[kDispatches])
  12128. }
  12129. async [kClose] () {
  12130. await promisify(this[kOriginalClose])()
  12131. this[kConnected] = 0
  12132. this[kMockAgent][Symbols.kClients].delete(this[kOrigin])
  12133. }
  12134. }
  12135. module.exports = MockPool
  12136. /***/ }),
  12137. /***/ 1117:
  12138. /***/ ((module) => {
  12139. module.exports = {
  12140. kAgent: Symbol('agent'),
  12141. kOptions: Symbol('options'),
  12142. kFactory: Symbol('factory'),
  12143. kDispatches: Symbol('dispatches'),
  12144. kDispatchKey: Symbol('dispatch key'),
  12145. kDefaultHeaders: Symbol('default headers'),
  12146. kDefaultTrailers: Symbol('default trailers'),
  12147. kContentLength: Symbol('content length'),
  12148. kMockAgent: Symbol('mock agent'),
  12149. kMockAgentSet: Symbol('mock agent set'),
  12150. kMockAgentGet: Symbol('mock agent get'),
  12151. kMockDispatch: Symbol('mock dispatch'),
  12152. kClose: Symbol('close'),
  12153. kOriginalClose: Symbol('original agent close'),
  12154. kOrigin: Symbol('origin'),
  12155. kIsMockActive: Symbol('is mock active'),
  12156. kNetConnect: Symbol('net connect'),
  12157. kGetNetConnect: Symbol('get net connect'),
  12158. kConnected: Symbol('connected')
  12159. }
  12160. /***/ }),
  12161. /***/ 3397:
  12162. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12163. const { MockNotMatchedError } = __nccwpck_require__(2429)
  12164. const {
  12165. kDispatches,
  12166. kMockAgent,
  12167. kOriginalDispatch,
  12168. kOrigin,
  12169. kGetNetConnect
  12170. } = __nccwpck_require__(1117)
  12171. const { buildURL } = __nccwpck_require__(3440)
  12172. const { STATUS_CODES } = __nccwpck_require__(7067)
  12173. const {
  12174. types: {
  12175. isPromise
  12176. }
  12177. } = __nccwpck_require__(7975)
  12178. function matchValue (match, value) {
  12179. if (typeof match === 'string') {
  12180. return match === value
  12181. }
  12182. if (match instanceof RegExp) {
  12183. return match.test(value)
  12184. }
  12185. if (typeof match === 'function') {
  12186. return match(value) === true
  12187. }
  12188. return false
  12189. }
  12190. function lowerCaseEntries (headers) {
  12191. return Object.fromEntries(
  12192. Object.entries(headers).map(([headerName, headerValue]) => {
  12193. return [headerName.toLocaleLowerCase(), headerValue]
  12194. })
  12195. )
  12196. }
  12197. /**
  12198. * @param {import('../../index').Headers|string[]|Record<string, string>} headers
  12199. * @param {string} key
  12200. */
  12201. function getHeaderByName (headers, key) {
  12202. if (Array.isArray(headers)) {
  12203. for (let i = 0; i < headers.length; i += 2) {
  12204. if (headers[i].toLocaleLowerCase() === key.toLocaleLowerCase()) {
  12205. return headers[i + 1]
  12206. }
  12207. }
  12208. return undefined
  12209. } else if (typeof headers.get === 'function') {
  12210. return headers.get(key)
  12211. } else {
  12212. return lowerCaseEntries(headers)[key.toLocaleLowerCase()]
  12213. }
  12214. }
  12215. /** @param {string[]} headers */
  12216. function buildHeadersFromArray (headers) { // fetch HeadersList
  12217. const clone = headers.slice()
  12218. const entries = []
  12219. for (let index = 0; index < clone.length; index += 2) {
  12220. entries.push([clone[index], clone[index + 1]])
  12221. }
  12222. return Object.fromEntries(entries)
  12223. }
  12224. function matchHeaders (mockDispatch, headers) {
  12225. if (typeof mockDispatch.headers === 'function') {
  12226. if (Array.isArray(headers)) { // fetch HeadersList
  12227. headers = buildHeadersFromArray(headers)
  12228. }
  12229. return mockDispatch.headers(headers ? lowerCaseEntries(headers) : {})
  12230. }
  12231. if (typeof mockDispatch.headers === 'undefined') {
  12232. return true
  12233. }
  12234. if (typeof headers !== 'object' || typeof mockDispatch.headers !== 'object') {
  12235. return false
  12236. }
  12237. for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch.headers)) {
  12238. const headerValue = getHeaderByName(headers, matchHeaderName)
  12239. if (!matchValue(matchHeaderValue, headerValue)) {
  12240. return false
  12241. }
  12242. }
  12243. return true
  12244. }
  12245. function safeUrl (path) {
  12246. if (typeof path !== 'string') {
  12247. return path
  12248. }
  12249. const pathSegments = path.split('?')
  12250. if (pathSegments.length !== 2) {
  12251. return path
  12252. }
  12253. const qp = new URLSearchParams(pathSegments.pop())
  12254. qp.sort()
  12255. return [...pathSegments, qp.toString()].join('?')
  12256. }
  12257. function matchKey (mockDispatch, { path, method, body, headers }) {
  12258. const pathMatch = matchValue(mockDispatch.path, path)
  12259. const methodMatch = matchValue(mockDispatch.method, method)
  12260. const bodyMatch = typeof mockDispatch.body !== 'undefined' ? matchValue(mockDispatch.body, body) : true
  12261. const headersMatch = matchHeaders(mockDispatch, headers)
  12262. return pathMatch && methodMatch && bodyMatch && headersMatch
  12263. }
  12264. function getResponseData (data) {
  12265. if (Buffer.isBuffer(data)) {
  12266. return data
  12267. } else if (data instanceof Uint8Array) {
  12268. return data
  12269. } else if (data instanceof ArrayBuffer) {
  12270. return data
  12271. } else if (typeof data === 'object') {
  12272. return JSON.stringify(data)
  12273. } else {
  12274. return data.toString()
  12275. }
  12276. }
  12277. function getMockDispatch (mockDispatches, key) {
  12278. const basePath = key.query ? buildURL(key.path, key.query) : key.path
  12279. const resolvedPath = typeof basePath === 'string' ? safeUrl(basePath) : basePath
  12280. // Match path
  12281. let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path }) => matchValue(safeUrl(path), resolvedPath))
  12282. if (matchedMockDispatches.length === 0) {
  12283. throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`)
  12284. }
  12285. // Match method
  12286. matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method))
  12287. if (matchedMockDispatches.length === 0) {
  12288. throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}' on path '${resolvedPath}'`)
  12289. }
  12290. // Match body
  12291. matchedMockDispatches = matchedMockDispatches.filter(({ body }) => typeof body !== 'undefined' ? matchValue(body, key.body) : true)
  12292. if (matchedMockDispatches.length === 0) {
  12293. throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}' on path '${resolvedPath}'`)
  12294. }
  12295. // Match headers
  12296. matchedMockDispatches = matchedMockDispatches.filter((mockDispatch) => matchHeaders(mockDispatch, key.headers))
  12297. if (matchedMockDispatches.length === 0) {
  12298. const headers = typeof key.headers === 'object' ? JSON.stringify(key.headers) : key.headers
  12299. throw new MockNotMatchedError(`Mock dispatch not matched for headers '${headers}' on path '${resolvedPath}'`)
  12300. }
  12301. return matchedMockDispatches[0]
  12302. }
  12303. function addMockDispatch (mockDispatches, key, data) {
  12304. const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false }
  12305. const replyData = typeof data === 'function' ? { callback: data } : { ...data }
  12306. const newMockDispatch = { ...baseData, ...key, pending: true, data: { error: null, ...replyData } }
  12307. mockDispatches.push(newMockDispatch)
  12308. return newMockDispatch
  12309. }
  12310. function deleteMockDispatch (mockDispatches, key) {
  12311. const index = mockDispatches.findIndex(dispatch => {
  12312. if (!dispatch.consumed) {
  12313. return false
  12314. }
  12315. return matchKey(dispatch, key)
  12316. })
  12317. if (index !== -1) {
  12318. mockDispatches.splice(index, 1)
  12319. }
  12320. }
  12321. function buildKey (opts) {
  12322. const { path, method, body, headers, query } = opts
  12323. return {
  12324. path,
  12325. method,
  12326. body,
  12327. headers,
  12328. query
  12329. }
  12330. }
  12331. function generateKeyValues (data) {
  12332. const keys = Object.keys(data)
  12333. const result = []
  12334. for (let i = 0; i < keys.length; ++i) {
  12335. const key = keys[i]
  12336. const value = data[key]
  12337. const name = Buffer.from(`${key}`)
  12338. if (Array.isArray(value)) {
  12339. for (let j = 0; j < value.length; ++j) {
  12340. result.push(name, Buffer.from(`${value[j]}`))
  12341. }
  12342. } else {
  12343. result.push(name, Buffer.from(`${value}`))
  12344. }
  12345. }
  12346. return result
  12347. }
  12348. /**
  12349. * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
  12350. * @param {number} statusCode
  12351. */
  12352. function getStatusText (statusCode) {
  12353. return STATUS_CODES[statusCode] || 'unknown'
  12354. }
  12355. async function getResponse (body) {
  12356. const buffers = []
  12357. for await (const data of body) {
  12358. buffers.push(data)
  12359. }
  12360. return Buffer.concat(buffers).toString('utf8')
  12361. }
  12362. /**
  12363. * Mock dispatch function used to simulate undici dispatches
  12364. */
  12365. function mockDispatch (opts, handler) {
  12366. // Get mock dispatch from built key
  12367. const key = buildKey(opts)
  12368. const mockDispatch = getMockDispatch(this[kDispatches], key)
  12369. mockDispatch.timesInvoked++
  12370. // Here's where we resolve a callback if a callback is present for the dispatch data.
  12371. if (mockDispatch.data.callback) {
  12372. mockDispatch.data = { ...mockDispatch.data, ...mockDispatch.data.callback(opts) }
  12373. }
  12374. // Parse mockDispatch data
  12375. const { data: { statusCode, data, headers, trailers, error }, delay, persist } = mockDispatch
  12376. const { timesInvoked, times } = mockDispatch
  12377. // If it's used up and not persistent, mark as consumed
  12378. mockDispatch.consumed = !persist && timesInvoked >= times
  12379. mockDispatch.pending = timesInvoked < times
  12380. // If specified, trigger dispatch error
  12381. if (error !== null) {
  12382. deleteMockDispatch(this[kDispatches], key)
  12383. handler.onError(error)
  12384. return true
  12385. }
  12386. // Handle the request with a delay if necessary
  12387. if (typeof delay === 'number' && delay > 0) {
  12388. setTimeout(() => {
  12389. handleReply(this[kDispatches])
  12390. }, delay)
  12391. } else {
  12392. handleReply(this[kDispatches])
  12393. }
  12394. function handleReply (mockDispatches, _data = data) {
  12395. // fetch's HeadersList is a 1D string array
  12396. const optsHeaders = Array.isArray(opts.headers)
  12397. ? buildHeadersFromArray(opts.headers)
  12398. : opts.headers
  12399. const body = typeof _data === 'function'
  12400. ? _data({ ...opts, headers: optsHeaders })
  12401. : _data
  12402. // util.types.isPromise is likely needed for jest.
  12403. if (isPromise(body)) {
  12404. // If handleReply is asynchronous, throwing an error
  12405. // in the callback will reject the promise, rather than
  12406. // synchronously throw the error, which breaks some tests.
  12407. // Rather, we wait for the callback to resolve if it is a
  12408. // promise, and then re-run handleReply with the new body.
  12409. body.then((newData) => handleReply(mockDispatches, newData))
  12410. return
  12411. }
  12412. const responseData = getResponseData(body)
  12413. const responseHeaders = generateKeyValues(headers)
  12414. const responseTrailers = generateKeyValues(trailers)
  12415. handler.onConnect?.(err => handler.onError(err), null)
  12416. handler.onHeaders?.(statusCode, responseHeaders, resume, getStatusText(statusCode))
  12417. handler.onData?.(Buffer.from(responseData))
  12418. handler.onComplete?.(responseTrailers)
  12419. deleteMockDispatch(mockDispatches, key)
  12420. }
  12421. function resume () {}
  12422. return true
  12423. }
  12424. function buildMockDispatch () {
  12425. const agent = this[kMockAgent]
  12426. const origin = this[kOrigin]
  12427. const originalDispatch = this[kOriginalDispatch]
  12428. return function dispatch (opts, handler) {
  12429. if (agent.isMockActive) {
  12430. try {
  12431. mockDispatch.call(this, opts, handler)
  12432. } catch (error) {
  12433. if (error instanceof MockNotMatchedError) {
  12434. const netConnect = agent[kGetNetConnect]()
  12435. if (netConnect === false) {
  12436. throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`)
  12437. }
  12438. if (checkNetConnect(netConnect, origin)) {
  12439. originalDispatch.call(this, opts, handler)
  12440. } else {
  12441. throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`)
  12442. }
  12443. } else {
  12444. throw error
  12445. }
  12446. }
  12447. } else {
  12448. originalDispatch.call(this, opts, handler)
  12449. }
  12450. }
  12451. }
  12452. function checkNetConnect (netConnect, origin) {
  12453. const url = new URL(origin)
  12454. if (netConnect === true) {
  12455. return true
  12456. } else if (Array.isArray(netConnect) && netConnect.some((matcher) => matchValue(matcher, url.host))) {
  12457. return true
  12458. }
  12459. return false
  12460. }
  12461. function buildMockOptions (opts) {
  12462. if (opts) {
  12463. const { agent, ...mockOptions } = opts
  12464. return mockOptions
  12465. }
  12466. }
  12467. module.exports = {
  12468. getResponseData,
  12469. getMockDispatch,
  12470. addMockDispatch,
  12471. deleteMockDispatch,
  12472. buildKey,
  12473. generateKeyValues,
  12474. matchValue,
  12475. getResponse,
  12476. getStatusText,
  12477. mockDispatch,
  12478. buildMockDispatch,
  12479. checkNetConnect,
  12480. buildMockOptions,
  12481. getHeaderByName,
  12482. buildHeadersFromArray
  12483. }
  12484. /***/ }),
  12485. /***/ 6142:
  12486. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12487. const { Transform } = __nccwpck_require__(7075)
  12488. const { Console } = __nccwpck_require__(7540)
  12489. const PERSISTENT = process.versions.icu ? '✅' : 'Y '
  12490. const NOT_PERSISTENT = process.versions.icu ? '❌' : 'N '
  12491. /**
  12492. * Gets the output of `console.table(…)` as a string.
  12493. */
  12494. module.exports = class PendingInterceptorsFormatter {
  12495. constructor ({ disableColors } = {}) {
  12496. this.transform = new Transform({
  12497. transform (chunk, _enc, cb) {
  12498. cb(null, chunk)
  12499. }
  12500. })
  12501. this.logger = new Console({
  12502. stdout: this.transform,
  12503. inspectOptions: {
  12504. colors: !disableColors && !process.env.CI
  12505. }
  12506. })
  12507. }
  12508. format (pendingInterceptors) {
  12509. const withPrettyHeaders = pendingInterceptors.map(
  12510. ({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
  12511. Method: method,
  12512. Origin: origin,
  12513. Path: path,
  12514. 'Status code': statusCode,
  12515. Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
  12516. Invocations: timesInvoked,
  12517. Remaining: persist ? Infinity : times - timesInvoked
  12518. }))
  12519. this.logger.table(withPrettyHeaders)
  12520. return this.transform.read().toString()
  12521. }
  12522. }
  12523. /***/ }),
  12524. /***/ 1529:
  12525. /***/ ((module) => {
  12526. const singulars = {
  12527. pronoun: 'it',
  12528. is: 'is',
  12529. was: 'was',
  12530. this: 'this'
  12531. }
  12532. const plurals = {
  12533. pronoun: 'they',
  12534. is: 'are',
  12535. was: 'were',
  12536. this: 'these'
  12537. }
  12538. module.exports = class Pluralizer {
  12539. constructor (singular, plural) {
  12540. this.singular = singular
  12541. this.plural = plural
  12542. }
  12543. pluralize (count) {
  12544. const one = count === 1
  12545. const keys = one ? singulars : plurals
  12546. const noun = one ? this.singular : this.plural
  12547. return { ...keys, count, noun }
  12548. }
  12549. }
  12550. /***/ }),
  12551. /***/ 6603:
  12552. /***/ ((module) => {
  12553. /**
  12554. * This module offers an optimized timer implementation designed for scenarios
  12555. * where high precision is not critical.
  12556. *
  12557. * The timer achieves faster performance by using a low-resolution approach,
  12558. * with an accuracy target of within 500ms. This makes it particularly useful
  12559. * for timers with delays of 1 second or more, where exact timing is less
  12560. * crucial.
  12561. *
  12562. * It's important to note that Node.js timers are inherently imprecise, as
  12563. * delays can occur due to the event loop being blocked by other operations.
  12564. * Consequently, timers may trigger later than their scheduled time.
  12565. */
  12566. /**
  12567. * The fastNow variable contains the internal fast timer clock value.
  12568. *
  12569. * @type {number}
  12570. */
  12571. let fastNow = 0
  12572. /**
  12573. * RESOLUTION_MS represents the target resolution time in milliseconds.
  12574. *
  12575. * @type {number}
  12576. * @default 1000
  12577. */
  12578. const RESOLUTION_MS = 1e3
  12579. /**
  12580. * TICK_MS defines the desired interval in milliseconds between each tick.
  12581. * The target value is set to half the resolution time, minus 1 ms, to account
  12582. * for potential event loop overhead.
  12583. *
  12584. * @type {number}
  12585. * @default 499
  12586. */
  12587. const TICK_MS = (RESOLUTION_MS >> 1) - 1
  12588. /**
  12589. * fastNowTimeout is a Node.js timer used to manage and process
  12590. * the FastTimers stored in the `fastTimers` array.
  12591. *
  12592. * @type {NodeJS.Timeout}
  12593. */
  12594. let fastNowTimeout
  12595. /**
  12596. * The kFastTimer symbol is used to identify FastTimer instances.
  12597. *
  12598. * @type {Symbol}
  12599. */
  12600. const kFastTimer = Symbol('kFastTimer')
  12601. /**
  12602. * The fastTimers array contains all active FastTimers.
  12603. *
  12604. * @type {FastTimer[]}
  12605. */
  12606. const fastTimers = []
  12607. /**
  12608. * These constants represent the various states of a FastTimer.
  12609. */
  12610. /**
  12611. * The `NOT_IN_LIST` constant indicates that the FastTimer is not included
  12612. * in the `fastTimers` array. Timers with this status will not be processed
  12613. * during the next tick by the `onTick` function.
  12614. *
  12615. * A FastTimer can be re-added to the `fastTimers` array by invoking the
  12616. * `refresh` method on the FastTimer instance.
  12617. *
  12618. * @type {-2}
  12619. */
  12620. const NOT_IN_LIST = -2
  12621. /**
  12622. * The `TO_BE_CLEARED` constant indicates that the FastTimer is scheduled
  12623. * for removal from the `fastTimers` array. A FastTimer in this state will
  12624. * be removed in the next tick by the `onTick` function and will no longer
  12625. * be processed.
  12626. *
  12627. * This status is also set when the `clear` method is called on the FastTimer instance.
  12628. *
  12629. * @type {-1}
  12630. */
  12631. const TO_BE_CLEARED = -1
  12632. /**
  12633. * The `PENDING` constant signifies that the FastTimer is awaiting processing
  12634. * in the next tick by the `onTick` function. Timers with this status will have
  12635. * their `_idleStart` value set and their status updated to `ACTIVE` in the next tick.
  12636. *
  12637. * @type {0}
  12638. */
  12639. const PENDING = 0
  12640. /**
  12641. * The `ACTIVE` constant indicates that the FastTimer is active and waiting
  12642. * for its timer to expire. During the next tick, the `onTick` function will
  12643. * check if the timer has expired, and if so, it will execute the associated callback.
  12644. *
  12645. * @type {1}
  12646. */
  12647. const ACTIVE = 1
  12648. /**
  12649. * The onTick function processes the fastTimers array.
  12650. *
  12651. * @returns {void}
  12652. */
  12653. function onTick () {
  12654. /**
  12655. * Increment the fastNow value by the TICK_MS value, despite the actual time
  12656. * that has passed since the last tick. This approach ensures independence
  12657. * from the system clock and delays caused by a blocked event loop.
  12658. *
  12659. * @type {number}
  12660. */
  12661. fastNow += TICK_MS
  12662. /**
  12663. * The `idx` variable is used to iterate over the `fastTimers` array.
  12664. * Expired timers are removed by replacing them with the last element in the array.
  12665. * Consequently, `idx` is only incremented when the current element is not removed.
  12666. *
  12667. * @type {number}
  12668. */
  12669. let idx = 0
  12670. /**
  12671. * The len variable will contain the length of the fastTimers array
  12672. * and will be decremented when a FastTimer should be removed from the
  12673. * fastTimers array.
  12674. *
  12675. * @type {number}
  12676. */
  12677. let len = fastTimers.length
  12678. while (idx < len) {
  12679. /**
  12680. * @type {FastTimer}
  12681. */
  12682. const timer = fastTimers[idx]
  12683. // If the timer is in the ACTIVE state and the timer has expired, it will
  12684. // be processed in the next tick.
  12685. if (timer._state === PENDING) {
  12686. // Set the _idleStart value to the fastNow value minus the TICK_MS value
  12687. // to account for the time the timer was in the PENDING state.
  12688. timer._idleStart = fastNow - TICK_MS
  12689. timer._state = ACTIVE
  12690. } else if (
  12691. timer._state === ACTIVE &&
  12692. fastNow >= timer._idleStart + timer._idleTimeout
  12693. ) {
  12694. timer._state = TO_BE_CLEARED
  12695. timer._idleStart = -1
  12696. timer._onTimeout(timer._timerArg)
  12697. }
  12698. if (timer._state === TO_BE_CLEARED) {
  12699. timer._state = NOT_IN_LIST
  12700. // Move the last element to the current index and decrement len if it is
  12701. // not the only element in the array.
  12702. if (--len !== 0) {
  12703. fastTimers[idx] = fastTimers[len]
  12704. }
  12705. } else {
  12706. ++idx
  12707. }
  12708. }
  12709. // Set the length of the fastTimers array to the new length and thus
  12710. // removing the excess FastTimers elements from the array.
  12711. fastTimers.length = len
  12712. // If there are still active FastTimers in the array, refresh the Timer.
  12713. // If there are no active FastTimers, the timer will be refreshed again
  12714. // when a new FastTimer is instantiated.
  12715. if (fastTimers.length !== 0) {
  12716. refreshTimeout()
  12717. }
  12718. }
  12719. function refreshTimeout () {
  12720. // If the fastNowTimeout is already set, refresh it.
  12721. if (fastNowTimeout) {
  12722. fastNowTimeout.refresh()
  12723. // fastNowTimeout is not instantiated yet, create a new Timer.
  12724. } else {
  12725. clearTimeout(fastNowTimeout)
  12726. fastNowTimeout = setTimeout(onTick, TICK_MS)
  12727. // If the Timer has an unref method, call it to allow the process to exit if
  12728. // there are no other active handles.
  12729. if (fastNowTimeout.unref) {
  12730. fastNowTimeout.unref()
  12731. }
  12732. }
  12733. }
  12734. /**
  12735. * The `FastTimer` class is a data structure designed to store and manage
  12736. * timer information.
  12737. */
  12738. class FastTimer {
  12739. [kFastTimer] = true
  12740. /**
  12741. * The state of the timer, which can be one of the following:
  12742. * - NOT_IN_LIST (-2)
  12743. * - TO_BE_CLEARED (-1)
  12744. * - PENDING (0)
  12745. * - ACTIVE (1)
  12746. *
  12747. * @type {-2|-1|0|1}
  12748. * @private
  12749. */
  12750. _state = NOT_IN_LIST
  12751. /**
  12752. * The number of milliseconds to wait before calling the callback.
  12753. *
  12754. * @type {number}
  12755. * @private
  12756. */
  12757. _idleTimeout = -1
  12758. /**
  12759. * The time in milliseconds when the timer was started. This value is used to
  12760. * calculate when the timer should expire.
  12761. *
  12762. * @type {number}
  12763. * @default -1
  12764. * @private
  12765. */
  12766. _idleStart = -1
  12767. /**
  12768. * The function to be executed when the timer expires.
  12769. * @type {Function}
  12770. * @private
  12771. */
  12772. _onTimeout
  12773. /**
  12774. * The argument to be passed to the callback when the timer expires.
  12775. *
  12776. * @type {*}
  12777. * @private
  12778. */
  12779. _timerArg
  12780. /**
  12781. * @constructor
  12782. * @param {Function} callback A function to be executed after the timer
  12783. * expires.
  12784. * @param {number} delay The time, in milliseconds that the timer should wait
  12785. * before the specified function or code is executed.
  12786. * @param {*} arg
  12787. */
  12788. constructor (callback, delay, arg) {
  12789. this._onTimeout = callback
  12790. this._idleTimeout = delay
  12791. this._timerArg = arg
  12792. this.refresh()
  12793. }
  12794. /**
  12795. * Sets the timer's start time to the current time, and reschedules the timer
  12796. * to call its callback at the previously specified duration adjusted to the
  12797. * current time.
  12798. * Using this on a timer that has already called its callback will reactivate
  12799. * the timer.
  12800. *
  12801. * @returns {void}
  12802. */
  12803. refresh () {
  12804. // In the special case that the timer is not in the list of active timers,
  12805. // add it back to the array to be processed in the next tick by the onTick
  12806. // function.
  12807. if (this._state === NOT_IN_LIST) {
  12808. fastTimers.push(this)
  12809. }
  12810. // If the timer is the only active timer, refresh the fastNowTimeout for
  12811. // better resolution.
  12812. if (!fastNowTimeout || fastTimers.length === 1) {
  12813. refreshTimeout()
  12814. }
  12815. // Setting the state to PENDING will cause the timer to be reset in the
  12816. // next tick by the onTick function.
  12817. this._state = PENDING
  12818. }
  12819. /**
  12820. * The `clear` method cancels the timer, preventing it from executing.
  12821. *
  12822. * @returns {void}
  12823. * @private
  12824. */
  12825. clear () {
  12826. // Set the state to TO_BE_CLEARED to mark the timer for removal in the next
  12827. // tick by the onTick function.
  12828. this._state = TO_BE_CLEARED
  12829. // Reset the _idleStart value to -1 to indicate that the timer is no longer
  12830. // active.
  12831. this._idleStart = -1
  12832. }
  12833. }
  12834. /**
  12835. * This module exports a setTimeout and clearTimeout function that can be
  12836. * used as a drop-in replacement for the native functions.
  12837. */
  12838. module.exports = {
  12839. /**
  12840. * The setTimeout() method sets a timer which executes a function once the
  12841. * timer expires.
  12842. * @param {Function} callback A function to be executed after the timer
  12843. * expires.
  12844. * @param {number} delay The time, in milliseconds that the timer should
  12845. * wait before the specified function or code is executed.
  12846. * @param {*} [arg] An optional argument to be passed to the callback function
  12847. * when the timer expires.
  12848. * @returns {NodeJS.Timeout|FastTimer}
  12849. */
  12850. setTimeout (callback, delay, arg) {
  12851. // If the delay is less than or equal to the RESOLUTION_MS value return a
  12852. // native Node.js Timer instance.
  12853. return delay <= RESOLUTION_MS
  12854. ? setTimeout(callback, delay, arg)
  12855. : new FastTimer(callback, delay, arg)
  12856. },
  12857. /**
  12858. * The clearTimeout method cancels an instantiated Timer previously created
  12859. * by calling setTimeout.
  12860. *
  12861. * @param {NodeJS.Timeout|FastTimer} timeout
  12862. */
  12863. clearTimeout (timeout) {
  12864. // If the timeout is a FastTimer, call its own clear method.
  12865. if (timeout[kFastTimer]) {
  12866. /**
  12867. * @type {FastTimer}
  12868. */
  12869. timeout.clear()
  12870. // Otherwise it is an instance of a native NodeJS.Timeout, so call the
  12871. // Node.js native clearTimeout function.
  12872. } else {
  12873. clearTimeout(timeout)
  12874. }
  12875. },
  12876. /**
  12877. * The setFastTimeout() method sets a fastTimer which executes a function once
  12878. * the timer expires.
  12879. * @param {Function} callback A function to be executed after the timer
  12880. * expires.
  12881. * @param {number} delay The time, in milliseconds that the timer should
  12882. * wait before the specified function or code is executed.
  12883. * @param {*} [arg] An optional argument to be passed to the callback function
  12884. * when the timer expires.
  12885. * @returns {FastTimer}
  12886. */
  12887. setFastTimeout (callback, delay, arg) {
  12888. return new FastTimer(callback, delay, arg)
  12889. },
  12890. /**
  12891. * The clearTimeout method cancels an instantiated FastTimer previously
  12892. * created by calling setFastTimeout.
  12893. *
  12894. * @param {FastTimer} timeout
  12895. */
  12896. clearFastTimeout (timeout) {
  12897. timeout.clear()
  12898. },
  12899. /**
  12900. * The now method returns the value of the internal fast timer clock.
  12901. *
  12902. * @returns {number}
  12903. */
  12904. now () {
  12905. return fastNow
  12906. },
  12907. /**
  12908. * Trigger the onTick function to process the fastTimers array.
  12909. * Exported for testing purposes only.
  12910. * Marking as deprecated to discourage any use outside of testing.
  12911. * @deprecated
  12912. * @param {number} [delay=0] The delay in milliseconds to add to the now value.
  12913. */
  12914. tick (delay = 0) {
  12915. fastNow += delay - RESOLUTION_MS + 1
  12916. onTick()
  12917. onTick()
  12918. },
  12919. /**
  12920. * Reset FastTimers.
  12921. * Exported for testing purposes only.
  12922. * Marking as deprecated to discourage any use outside of testing.
  12923. * @deprecated
  12924. */
  12925. reset () {
  12926. fastNow = 0
  12927. fastTimers.length = 0
  12928. clearTimeout(fastNowTimeout)
  12929. fastNowTimeout = null
  12930. },
  12931. /**
  12932. * Exporting for testing purposes only.
  12933. * Marking as deprecated to discourage any use outside of testing.
  12934. * @deprecated
  12935. */
  12936. kFastTimer
  12937. }
  12938. /***/ }),
  12939. /***/ 9634:
  12940. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12941. const { kConstruct } = __nccwpck_require__(109)
  12942. const { urlEquals, getFieldValues } = __nccwpck_require__(6798)
  12943. const { kEnumerableProperty, isDisturbed } = __nccwpck_require__(3440)
  12944. const { webidl } = __nccwpck_require__(5893)
  12945. const { Response, cloneResponse, fromInnerResponse } = __nccwpck_require__(9051)
  12946. const { Request, fromInnerRequest } = __nccwpck_require__(9967)
  12947. const { kState } = __nccwpck_require__(3627)
  12948. const { fetching } = __nccwpck_require__(4398)
  12949. const { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = __nccwpck_require__(3168)
  12950. const assert = __nccwpck_require__(4589)
  12951. /**
  12952. * @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation
  12953. * @typedef {Object} CacheBatchOperation
  12954. * @property {'delete' | 'put'} type
  12955. * @property {any} request
  12956. * @property {any} response
  12957. * @property {import('../../types/cache').CacheQueryOptions} options
  12958. */
  12959. /**
  12960. * @see https://w3c.github.io/ServiceWorker/#dfn-request-response-list
  12961. * @typedef {[any, any][]} requestResponseList
  12962. */
  12963. class Cache {
  12964. /**
  12965. * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-request-response-list
  12966. * @type {requestResponseList}
  12967. */
  12968. #relevantRequestResponseList
  12969. constructor () {
  12970. if (arguments[0] !== kConstruct) {
  12971. webidl.illegalConstructor()
  12972. }
  12973. webidl.util.markAsUncloneable(this)
  12974. this.#relevantRequestResponseList = arguments[1]
  12975. }
  12976. async match (request, options = {}) {
  12977. webidl.brandCheck(this, Cache)
  12978. const prefix = 'Cache.match'
  12979. webidl.argumentLengthCheck(arguments, 1, prefix)
  12980. request = webidl.converters.RequestInfo(request, prefix, 'request')
  12981. options = webidl.converters.CacheQueryOptions(options, prefix, 'options')
  12982. const p = this.#internalMatchAll(request, options, 1)
  12983. if (p.length === 0) {
  12984. return
  12985. }
  12986. return p[0]
  12987. }
  12988. async matchAll (request = undefined, options = {}) {
  12989. webidl.brandCheck(this, Cache)
  12990. const prefix = 'Cache.matchAll'
  12991. if (request !== undefined) request = webidl.converters.RequestInfo(request, prefix, 'request')
  12992. options = webidl.converters.CacheQueryOptions(options, prefix, 'options')
  12993. return this.#internalMatchAll(request, options)
  12994. }
  12995. async add (request) {
  12996. webidl.brandCheck(this, Cache)
  12997. const prefix = 'Cache.add'
  12998. webidl.argumentLengthCheck(arguments, 1, prefix)
  12999. request = webidl.converters.RequestInfo(request, prefix, 'request')
  13000. // 1.
  13001. const requests = [request]
  13002. // 2.
  13003. const responseArrayPromise = this.addAll(requests)
  13004. // 3.
  13005. return await responseArrayPromise
  13006. }
  13007. async addAll (requests) {
  13008. webidl.brandCheck(this, Cache)
  13009. const prefix = 'Cache.addAll'
  13010. webidl.argumentLengthCheck(arguments, 1, prefix)
  13011. // 1.
  13012. const responsePromises = []
  13013. // 2.
  13014. const requestList = []
  13015. // 3.
  13016. for (let request of requests) {
  13017. if (request === undefined) {
  13018. throw webidl.errors.conversionFailed({
  13019. prefix,
  13020. argument: 'Argument 1',
  13021. types: ['undefined is not allowed']
  13022. })
  13023. }
  13024. request = webidl.converters.RequestInfo(request)
  13025. if (typeof request === 'string') {
  13026. continue
  13027. }
  13028. // 3.1
  13029. const r = request[kState]
  13030. // 3.2
  13031. if (!urlIsHttpHttpsScheme(r.url) || r.method !== 'GET') {
  13032. throw webidl.errors.exception({
  13033. header: prefix,
  13034. message: 'Expected http/s scheme when method is not GET.'
  13035. })
  13036. }
  13037. }
  13038. // 4.
  13039. /** @type {ReturnType<typeof fetching>[]} */
  13040. const fetchControllers = []
  13041. // 5.
  13042. for (const request of requests) {
  13043. // 5.1
  13044. const r = new Request(request)[kState]
  13045. // 5.2
  13046. if (!urlIsHttpHttpsScheme(r.url)) {
  13047. throw webidl.errors.exception({
  13048. header: prefix,
  13049. message: 'Expected http/s scheme.'
  13050. })
  13051. }
  13052. // 5.4
  13053. r.initiator = 'fetch'
  13054. r.destination = 'subresource'
  13055. // 5.5
  13056. requestList.push(r)
  13057. // 5.6
  13058. const responsePromise = createDeferredPromise()
  13059. // 5.7
  13060. fetchControllers.push(fetching({
  13061. request: r,
  13062. processResponse (response) {
  13063. // 1.
  13064. if (response.type === 'error' || response.status === 206 || response.status < 200 || response.status > 299) {
  13065. responsePromise.reject(webidl.errors.exception({
  13066. header: 'Cache.addAll',
  13067. message: 'Received an invalid status code or the request failed.'
  13068. }))
  13069. } else if (response.headersList.contains('vary')) { // 2.
  13070. // 2.1
  13071. const fieldValues = getFieldValues(response.headersList.get('vary'))
  13072. // 2.2
  13073. for (const fieldValue of fieldValues) {
  13074. // 2.2.1
  13075. if (fieldValue === '*') {
  13076. responsePromise.reject(webidl.errors.exception({
  13077. header: 'Cache.addAll',
  13078. message: 'invalid vary field value'
  13079. }))
  13080. for (const controller of fetchControllers) {
  13081. controller.abort()
  13082. }
  13083. return
  13084. }
  13085. }
  13086. }
  13087. },
  13088. processResponseEndOfBody (response) {
  13089. // 1.
  13090. if (response.aborted) {
  13091. responsePromise.reject(new DOMException('aborted', 'AbortError'))
  13092. return
  13093. }
  13094. // 2.
  13095. responsePromise.resolve(response)
  13096. }
  13097. }))
  13098. // 5.8
  13099. responsePromises.push(responsePromise.promise)
  13100. }
  13101. // 6.
  13102. const p = Promise.all(responsePromises)
  13103. // 7.
  13104. const responses = await p
  13105. // 7.1
  13106. const operations = []
  13107. // 7.2
  13108. let index = 0
  13109. // 7.3
  13110. for (const response of responses) {
  13111. // 7.3.1
  13112. /** @type {CacheBatchOperation} */
  13113. const operation = {
  13114. type: 'put', // 7.3.2
  13115. request: requestList[index], // 7.3.3
  13116. response // 7.3.4
  13117. }
  13118. operations.push(operation) // 7.3.5
  13119. index++ // 7.3.6
  13120. }
  13121. // 7.5
  13122. const cacheJobPromise = createDeferredPromise()
  13123. // 7.6.1
  13124. let errorData = null
  13125. // 7.6.2
  13126. try {
  13127. this.#batchCacheOperations(operations)
  13128. } catch (e) {
  13129. errorData = e
  13130. }
  13131. // 7.6.3
  13132. queueMicrotask(() => {
  13133. // 7.6.3.1
  13134. if (errorData === null) {
  13135. cacheJobPromise.resolve(undefined)
  13136. } else {
  13137. // 7.6.3.2
  13138. cacheJobPromise.reject(errorData)
  13139. }
  13140. })
  13141. // 7.7
  13142. return cacheJobPromise.promise
  13143. }
  13144. async put (request, response) {
  13145. webidl.brandCheck(this, Cache)
  13146. const prefix = 'Cache.put'
  13147. webidl.argumentLengthCheck(arguments, 2, prefix)
  13148. request = webidl.converters.RequestInfo(request, prefix, 'request')
  13149. response = webidl.converters.Response(response, prefix, 'response')
  13150. // 1.
  13151. let innerRequest = null
  13152. // 2.
  13153. if (request instanceof Request) {
  13154. innerRequest = request[kState]
  13155. } else { // 3.
  13156. innerRequest = new Request(request)[kState]
  13157. }
  13158. // 4.
  13159. if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== 'GET') {
  13160. throw webidl.errors.exception({
  13161. header: prefix,
  13162. message: 'Expected an http/s scheme when method is not GET'
  13163. })
  13164. }
  13165. // 5.
  13166. const innerResponse = response[kState]
  13167. // 6.
  13168. if (innerResponse.status === 206) {
  13169. throw webidl.errors.exception({
  13170. header: prefix,
  13171. message: 'Got 206 status'
  13172. })
  13173. }
  13174. // 7.
  13175. if (innerResponse.headersList.contains('vary')) {
  13176. // 7.1.
  13177. const fieldValues = getFieldValues(innerResponse.headersList.get('vary'))
  13178. // 7.2.
  13179. for (const fieldValue of fieldValues) {
  13180. // 7.2.1
  13181. if (fieldValue === '*') {
  13182. throw webidl.errors.exception({
  13183. header: prefix,
  13184. message: 'Got * vary field value'
  13185. })
  13186. }
  13187. }
  13188. }
  13189. // 8.
  13190. if (innerResponse.body && (isDisturbed(innerResponse.body.stream) || innerResponse.body.stream.locked)) {
  13191. throw webidl.errors.exception({
  13192. header: prefix,
  13193. message: 'Response body is locked or disturbed'
  13194. })
  13195. }
  13196. // 9.
  13197. const clonedResponse = cloneResponse(innerResponse)
  13198. // 10.
  13199. const bodyReadPromise = createDeferredPromise()
  13200. // 11.
  13201. if (innerResponse.body != null) {
  13202. // 11.1
  13203. const stream = innerResponse.body.stream
  13204. // 11.2
  13205. const reader = stream.getReader()
  13206. // 11.3
  13207. readAllBytes(reader).then(bodyReadPromise.resolve, bodyReadPromise.reject)
  13208. } else {
  13209. bodyReadPromise.resolve(undefined)
  13210. }
  13211. // 12.
  13212. /** @type {CacheBatchOperation[]} */
  13213. const operations = []
  13214. // 13.
  13215. /** @type {CacheBatchOperation} */
  13216. const operation = {
  13217. type: 'put', // 14.
  13218. request: innerRequest, // 15.
  13219. response: clonedResponse // 16.
  13220. }
  13221. // 17.
  13222. operations.push(operation)
  13223. // 19.
  13224. const bytes = await bodyReadPromise.promise
  13225. if (clonedResponse.body != null) {
  13226. clonedResponse.body.source = bytes
  13227. }
  13228. // 19.1
  13229. const cacheJobPromise = createDeferredPromise()
  13230. // 19.2.1
  13231. let errorData = null
  13232. // 19.2.2
  13233. try {
  13234. this.#batchCacheOperations(operations)
  13235. } catch (e) {
  13236. errorData = e
  13237. }
  13238. // 19.2.3
  13239. queueMicrotask(() => {
  13240. // 19.2.3.1
  13241. if (errorData === null) {
  13242. cacheJobPromise.resolve()
  13243. } else { // 19.2.3.2
  13244. cacheJobPromise.reject(errorData)
  13245. }
  13246. })
  13247. return cacheJobPromise.promise
  13248. }
  13249. async delete (request, options = {}) {
  13250. webidl.brandCheck(this, Cache)
  13251. const prefix = 'Cache.delete'
  13252. webidl.argumentLengthCheck(arguments, 1, prefix)
  13253. request = webidl.converters.RequestInfo(request, prefix, 'request')
  13254. options = webidl.converters.CacheQueryOptions(options, prefix, 'options')
  13255. /**
  13256. * @type {Request}
  13257. */
  13258. let r = null
  13259. if (request instanceof Request) {
  13260. r = request[kState]
  13261. if (r.method !== 'GET' && !options.ignoreMethod) {
  13262. return false
  13263. }
  13264. } else {
  13265. assert(typeof request === 'string')
  13266. r = new Request(request)[kState]
  13267. }
  13268. /** @type {CacheBatchOperation[]} */
  13269. const operations = []
  13270. /** @type {CacheBatchOperation} */
  13271. const operation = {
  13272. type: 'delete',
  13273. request: r,
  13274. options
  13275. }
  13276. operations.push(operation)
  13277. const cacheJobPromise = createDeferredPromise()
  13278. let errorData = null
  13279. let requestResponses
  13280. try {
  13281. requestResponses = this.#batchCacheOperations(operations)
  13282. } catch (e) {
  13283. errorData = e
  13284. }
  13285. queueMicrotask(() => {
  13286. if (errorData === null) {
  13287. cacheJobPromise.resolve(!!requestResponses?.length)
  13288. } else {
  13289. cacheJobPromise.reject(errorData)
  13290. }
  13291. })
  13292. return cacheJobPromise.promise
  13293. }
  13294. /**
  13295. * @see https://w3c.github.io/ServiceWorker/#dom-cache-keys
  13296. * @param {any} request
  13297. * @param {import('../../types/cache').CacheQueryOptions} options
  13298. * @returns {Promise<readonly Request[]>}
  13299. */
  13300. async keys (request = undefined, options = {}) {
  13301. webidl.brandCheck(this, Cache)
  13302. const prefix = 'Cache.keys'
  13303. if (request !== undefined) request = webidl.converters.RequestInfo(request, prefix, 'request')
  13304. options = webidl.converters.CacheQueryOptions(options, prefix, 'options')
  13305. // 1.
  13306. let r = null
  13307. // 2.
  13308. if (request !== undefined) {
  13309. // 2.1
  13310. if (request instanceof Request) {
  13311. // 2.1.1
  13312. r = request[kState]
  13313. // 2.1.2
  13314. if (r.method !== 'GET' && !options.ignoreMethod) {
  13315. return []
  13316. }
  13317. } else if (typeof request === 'string') { // 2.2
  13318. r = new Request(request)[kState]
  13319. }
  13320. }
  13321. // 4.
  13322. const promise = createDeferredPromise()
  13323. // 5.
  13324. // 5.1
  13325. const requests = []
  13326. // 5.2
  13327. if (request === undefined) {
  13328. // 5.2.1
  13329. for (const requestResponse of this.#relevantRequestResponseList) {
  13330. // 5.2.1.1
  13331. requests.push(requestResponse[0])
  13332. }
  13333. } else { // 5.3
  13334. // 5.3.1
  13335. const requestResponses = this.#queryCache(r, options)
  13336. // 5.3.2
  13337. for (const requestResponse of requestResponses) {
  13338. // 5.3.2.1
  13339. requests.push(requestResponse[0])
  13340. }
  13341. }
  13342. // 5.4
  13343. queueMicrotask(() => {
  13344. // 5.4.1
  13345. const requestList = []
  13346. // 5.4.2
  13347. for (const request of requests) {
  13348. const requestObject = fromInnerRequest(
  13349. request,
  13350. new AbortController().signal,
  13351. 'immutable'
  13352. )
  13353. // 5.4.2.1
  13354. requestList.push(requestObject)
  13355. }
  13356. // 5.4.3
  13357. promise.resolve(Object.freeze(requestList))
  13358. })
  13359. return promise.promise
  13360. }
  13361. /**
  13362. * @see https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm
  13363. * @param {CacheBatchOperation[]} operations
  13364. * @returns {requestResponseList}
  13365. */
  13366. #batchCacheOperations (operations) {
  13367. // 1.
  13368. const cache = this.#relevantRequestResponseList
  13369. // 2.
  13370. const backupCache = [...cache]
  13371. // 3.
  13372. const addedItems = []
  13373. // 4.1
  13374. const resultList = []
  13375. try {
  13376. // 4.2
  13377. for (const operation of operations) {
  13378. // 4.2.1
  13379. if (operation.type !== 'delete' && operation.type !== 'put') {
  13380. throw webidl.errors.exception({
  13381. header: 'Cache.#batchCacheOperations',
  13382. message: 'operation type does not match "delete" or "put"'
  13383. })
  13384. }
  13385. // 4.2.2
  13386. if (operation.type === 'delete' && operation.response != null) {
  13387. throw webidl.errors.exception({
  13388. header: 'Cache.#batchCacheOperations',
  13389. message: 'delete operation should not have an associated response'
  13390. })
  13391. }
  13392. // 4.2.3
  13393. if (this.#queryCache(operation.request, operation.options, addedItems).length) {
  13394. throw new DOMException('???', 'InvalidStateError')
  13395. }
  13396. // 4.2.4
  13397. let requestResponses
  13398. // 4.2.5
  13399. if (operation.type === 'delete') {
  13400. // 4.2.5.1
  13401. requestResponses = this.#queryCache(operation.request, operation.options)
  13402. // TODO: the spec is wrong, this is needed to pass WPTs
  13403. if (requestResponses.length === 0) {
  13404. return []
  13405. }
  13406. // 4.2.5.2
  13407. for (const requestResponse of requestResponses) {
  13408. const idx = cache.indexOf(requestResponse)
  13409. assert(idx !== -1)
  13410. // 4.2.5.2.1
  13411. cache.splice(idx, 1)
  13412. }
  13413. } else if (operation.type === 'put') { // 4.2.6
  13414. // 4.2.6.1
  13415. if (operation.response == null) {
  13416. throw webidl.errors.exception({
  13417. header: 'Cache.#batchCacheOperations',
  13418. message: 'put operation should have an associated response'
  13419. })
  13420. }
  13421. // 4.2.6.2
  13422. const r = operation.request
  13423. // 4.2.6.3
  13424. if (!urlIsHttpHttpsScheme(r.url)) {
  13425. throw webidl.errors.exception({
  13426. header: 'Cache.#batchCacheOperations',
  13427. message: 'expected http or https scheme'
  13428. })
  13429. }
  13430. // 4.2.6.4
  13431. if (r.method !== 'GET') {
  13432. throw webidl.errors.exception({
  13433. header: 'Cache.#batchCacheOperations',
  13434. message: 'not get method'
  13435. })
  13436. }
  13437. // 4.2.6.5
  13438. if (operation.options != null) {
  13439. throw webidl.errors.exception({
  13440. header: 'Cache.#batchCacheOperations',
  13441. message: 'options must not be defined'
  13442. })
  13443. }
  13444. // 4.2.6.6
  13445. requestResponses = this.#queryCache(operation.request)
  13446. // 4.2.6.7
  13447. for (const requestResponse of requestResponses) {
  13448. const idx = cache.indexOf(requestResponse)
  13449. assert(idx !== -1)
  13450. // 4.2.6.7.1
  13451. cache.splice(idx, 1)
  13452. }
  13453. // 4.2.6.8
  13454. cache.push([operation.request, operation.response])
  13455. // 4.2.6.10
  13456. addedItems.push([operation.request, operation.response])
  13457. }
  13458. // 4.2.7
  13459. resultList.push([operation.request, operation.response])
  13460. }
  13461. // 4.3
  13462. return resultList
  13463. } catch (e) { // 5.
  13464. // 5.1
  13465. this.#relevantRequestResponseList.length = 0
  13466. // 5.2
  13467. this.#relevantRequestResponseList = backupCache
  13468. // 5.3
  13469. throw e
  13470. }
  13471. }
  13472. /**
  13473. * @see https://w3c.github.io/ServiceWorker/#query-cache
  13474. * @param {any} requestQuery
  13475. * @param {import('../../types/cache').CacheQueryOptions} options
  13476. * @param {requestResponseList} targetStorage
  13477. * @returns {requestResponseList}
  13478. */
  13479. #queryCache (requestQuery, options, targetStorage) {
  13480. /** @type {requestResponseList} */
  13481. const resultList = []
  13482. const storage = targetStorage ?? this.#relevantRequestResponseList
  13483. for (const requestResponse of storage) {
  13484. const [cachedRequest, cachedResponse] = requestResponse
  13485. if (this.#requestMatchesCachedItem(requestQuery, cachedRequest, cachedResponse, options)) {
  13486. resultList.push(requestResponse)
  13487. }
  13488. }
  13489. return resultList
  13490. }
  13491. /**
  13492. * @see https://w3c.github.io/ServiceWorker/#request-matches-cached-item-algorithm
  13493. * @param {any} requestQuery
  13494. * @param {any} request
  13495. * @param {any | null} response
  13496. * @param {import('../../types/cache').CacheQueryOptions | undefined} options
  13497. * @returns {boolean}
  13498. */
  13499. #requestMatchesCachedItem (requestQuery, request, response = null, options) {
  13500. // if (options?.ignoreMethod === false && request.method === 'GET') {
  13501. // return false
  13502. // }
  13503. const queryURL = new URL(requestQuery.url)
  13504. const cachedURL = new URL(request.url)
  13505. if (options?.ignoreSearch) {
  13506. cachedURL.search = ''
  13507. queryURL.search = ''
  13508. }
  13509. if (!urlEquals(queryURL, cachedURL, true)) {
  13510. return false
  13511. }
  13512. if (
  13513. response == null ||
  13514. options?.ignoreVary ||
  13515. !response.headersList.contains('vary')
  13516. ) {
  13517. return true
  13518. }
  13519. const fieldValues = getFieldValues(response.headersList.get('vary'))
  13520. for (const fieldValue of fieldValues) {
  13521. if (fieldValue === '*') {
  13522. return false
  13523. }
  13524. const requestValue = request.headersList.get(fieldValue)
  13525. const queryValue = requestQuery.headersList.get(fieldValue)
  13526. // If one has the header and the other doesn't, or one has
  13527. // a different value than the other, return false
  13528. if (requestValue !== queryValue) {
  13529. return false
  13530. }
  13531. }
  13532. return true
  13533. }
  13534. #internalMatchAll (request, options, maxResponses = Infinity) {
  13535. // 1.
  13536. let r = null
  13537. // 2.
  13538. if (request !== undefined) {
  13539. if (request instanceof Request) {
  13540. // 2.1.1
  13541. r = request[kState]
  13542. // 2.1.2
  13543. if (r.method !== 'GET' && !options.ignoreMethod) {
  13544. return []
  13545. }
  13546. } else if (typeof request === 'string') {
  13547. // 2.2.1
  13548. r = new Request(request)[kState]
  13549. }
  13550. }
  13551. // 5.
  13552. // 5.1
  13553. const responses = []
  13554. // 5.2
  13555. if (request === undefined) {
  13556. // 5.2.1
  13557. for (const requestResponse of this.#relevantRequestResponseList) {
  13558. responses.push(requestResponse[1])
  13559. }
  13560. } else { // 5.3
  13561. // 5.3.1
  13562. const requestResponses = this.#queryCache(r, options)
  13563. // 5.3.2
  13564. for (const requestResponse of requestResponses) {
  13565. responses.push(requestResponse[1])
  13566. }
  13567. }
  13568. // 5.4
  13569. // We don't implement CORs so we don't need to loop over the responses, yay!
  13570. // 5.5.1
  13571. const responseList = []
  13572. // 5.5.2
  13573. for (const response of responses) {
  13574. // 5.5.2.1
  13575. const responseObject = fromInnerResponse(response, 'immutable')
  13576. responseList.push(responseObject.clone())
  13577. if (responseList.length >= maxResponses) {
  13578. break
  13579. }
  13580. }
  13581. // 6.
  13582. return Object.freeze(responseList)
  13583. }
  13584. }
  13585. Object.defineProperties(Cache.prototype, {
  13586. [Symbol.toStringTag]: {
  13587. value: 'Cache',
  13588. configurable: true
  13589. },
  13590. match: kEnumerableProperty,
  13591. matchAll: kEnumerableProperty,
  13592. add: kEnumerableProperty,
  13593. addAll: kEnumerableProperty,
  13594. put: kEnumerableProperty,
  13595. delete: kEnumerableProperty,
  13596. keys: kEnumerableProperty
  13597. })
  13598. const cacheQueryOptionConverters = [
  13599. {
  13600. key: 'ignoreSearch',
  13601. converter: webidl.converters.boolean,
  13602. defaultValue: () => false
  13603. },
  13604. {
  13605. key: 'ignoreMethod',
  13606. converter: webidl.converters.boolean,
  13607. defaultValue: () => false
  13608. },
  13609. {
  13610. key: 'ignoreVary',
  13611. converter: webidl.converters.boolean,
  13612. defaultValue: () => false
  13613. }
  13614. ]
  13615. webidl.converters.CacheQueryOptions = webidl.dictionaryConverter(cacheQueryOptionConverters)
  13616. webidl.converters.MultiCacheQueryOptions = webidl.dictionaryConverter([
  13617. ...cacheQueryOptionConverters,
  13618. {
  13619. key: 'cacheName',
  13620. converter: webidl.converters.DOMString
  13621. }
  13622. ])
  13623. webidl.converters.Response = webidl.interfaceConverter(Response)
  13624. webidl.converters['sequence<RequestInfo>'] = webidl.sequenceConverter(
  13625. webidl.converters.RequestInfo
  13626. )
  13627. module.exports = {
  13628. Cache
  13629. }
  13630. /***/ }),
  13631. /***/ 3245:
  13632. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  13633. const { kConstruct } = __nccwpck_require__(109)
  13634. const { Cache } = __nccwpck_require__(9634)
  13635. const { webidl } = __nccwpck_require__(5893)
  13636. const { kEnumerableProperty } = __nccwpck_require__(3440)
  13637. class CacheStorage {
  13638. /**
  13639. * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-name-to-cache-map
  13640. * @type {Map<string, import('./cache').requestResponseList}
  13641. */
  13642. #caches = new Map()
  13643. constructor () {
  13644. if (arguments[0] !== kConstruct) {
  13645. webidl.illegalConstructor()
  13646. }
  13647. webidl.util.markAsUncloneable(this)
  13648. }
  13649. async match (request, options = {}) {
  13650. webidl.brandCheck(this, CacheStorage)
  13651. webidl.argumentLengthCheck(arguments, 1, 'CacheStorage.match')
  13652. request = webidl.converters.RequestInfo(request)
  13653. options = webidl.converters.MultiCacheQueryOptions(options)
  13654. // 1.
  13655. if (options.cacheName != null) {
  13656. // 1.1.1.1
  13657. if (this.#caches.has(options.cacheName)) {
  13658. // 1.1.1.1.1
  13659. const cacheList = this.#caches.get(options.cacheName)
  13660. const cache = new Cache(kConstruct, cacheList)
  13661. return await cache.match(request, options)
  13662. }
  13663. } else { // 2.
  13664. // 2.2
  13665. for (const cacheList of this.#caches.values()) {
  13666. const cache = new Cache(kConstruct, cacheList)
  13667. // 2.2.1.2
  13668. const response = await cache.match(request, options)
  13669. if (response !== undefined) {
  13670. return response
  13671. }
  13672. }
  13673. }
  13674. }
  13675. /**
  13676. * @see https://w3c.github.io/ServiceWorker/#cache-storage-has
  13677. * @param {string} cacheName
  13678. * @returns {Promise<boolean>}
  13679. */
  13680. async has (cacheName) {
  13681. webidl.brandCheck(this, CacheStorage)
  13682. const prefix = 'CacheStorage.has'
  13683. webidl.argumentLengthCheck(arguments, 1, prefix)
  13684. cacheName = webidl.converters.DOMString(cacheName, prefix, 'cacheName')
  13685. // 2.1.1
  13686. // 2.2
  13687. return this.#caches.has(cacheName)
  13688. }
  13689. /**
  13690. * @see https://w3c.github.io/ServiceWorker/#dom-cachestorage-open
  13691. * @param {string} cacheName
  13692. * @returns {Promise<Cache>}
  13693. */
  13694. async open (cacheName) {
  13695. webidl.brandCheck(this, CacheStorage)
  13696. const prefix = 'CacheStorage.open'
  13697. webidl.argumentLengthCheck(arguments, 1, prefix)
  13698. cacheName = webidl.converters.DOMString(cacheName, prefix, 'cacheName')
  13699. // 2.1
  13700. if (this.#caches.has(cacheName)) {
  13701. // await caches.open('v1') !== await caches.open('v1')
  13702. // 2.1.1
  13703. const cache = this.#caches.get(cacheName)
  13704. // 2.1.1.1
  13705. return new Cache(kConstruct, cache)
  13706. }
  13707. // 2.2
  13708. const cache = []
  13709. // 2.3
  13710. this.#caches.set(cacheName, cache)
  13711. // 2.4
  13712. return new Cache(kConstruct, cache)
  13713. }
  13714. /**
  13715. * @see https://w3c.github.io/ServiceWorker/#cache-storage-delete
  13716. * @param {string} cacheName
  13717. * @returns {Promise<boolean>}
  13718. */
  13719. async delete (cacheName) {
  13720. webidl.brandCheck(this, CacheStorage)
  13721. const prefix = 'CacheStorage.delete'
  13722. webidl.argumentLengthCheck(arguments, 1, prefix)
  13723. cacheName = webidl.converters.DOMString(cacheName, prefix, 'cacheName')
  13724. return this.#caches.delete(cacheName)
  13725. }
  13726. /**
  13727. * @see https://w3c.github.io/ServiceWorker/#cache-storage-keys
  13728. * @returns {Promise<string[]>}
  13729. */
  13730. async keys () {
  13731. webidl.brandCheck(this, CacheStorage)
  13732. // 2.1
  13733. const keys = this.#caches.keys()
  13734. // 2.2
  13735. return [...keys]
  13736. }
  13737. }
  13738. Object.defineProperties(CacheStorage.prototype, {
  13739. [Symbol.toStringTag]: {
  13740. value: 'CacheStorage',
  13741. configurable: true
  13742. },
  13743. match: kEnumerableProperty,
  13744. has: kEnumerableProperty,
  13745. open: kEnumerableProperty,
  13746. delete: kEnumerableProperty,
  13747. keys: kEnumerableProperty
  13748. })
  13749. module.exports = {
  13750. CacheStorage
  13751. }
  13752. /***/ }),
  13753. /***/ 109:
  13754. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  13755. module.exports = {
  13756. kConstruct: (__nccwpck_require__(6443).kConstruct)
  13757. }
  13758. /***/ }),
  13759. /***/ 6798:
  13760. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  13761. const assert = __nccwpck_require__(4589)
  13762. const { URLSerializer } = __nccwpck_require__(1900)
  13763. const { isValidHeaderName } = __nccwpck_require__(3168)
  13764. /**
  13765. * @see https://url.spec.whatwg.org/#concept-url-equals
  13766. * @param {URL} A
  13767. * @param {URL} B
  13768. * @param {boolean | undefined} excludeFragment
  13769. * @returns {boolean}
  13770. */
  13771. function urlEquals (A, B, excludeFragment = false) {
  13772. const serializedA = URLSerializer(A, excludeFragment)
  13773. const serializedB = URLSerializer(B, excludeFragment)
  13774. return serializedA === serializedB
  13775. }
  13776. /**
  13777. * @see https://github.com/chromium/chromium/blob/694d20d134cb553d8d89e5500b9148012b1ba299/content/browser/cache_storage/cache_storage_cache.cc#L260-L262
  13778. * @param {string} header
  13779. */
  13780. function getFieldValues (header) {
  13781. assert(header !== null)
  13782. const values = []
  13783. for (let value of header.split(',')) {
  13784. value = value.trim()
  13785. if (isValidHeaderName(value)) {
  13786. values.push(value)
  13787. }
  13788. }
  13789. return values
  13790. }
  13791. module.exports = {
  13792. urlEquals,
  13793. getFieldValues
  13794. }
  13795. /***/ }),
  13796. /***/ 1276:
  13797. /***/ ((module) => {
  13798. // https://wicg.github.io/cookie-store/#cookie-maximum-attribute-value-size
  13799. const maxAttributeValueSize = 1024
  13800. // https://wicg.github.io/cookie-store/#cookie-maximum-name-value-pair-size
  13801. const maxNameValuePairSize = 4096
  13802. module.exports = {
  13803. maxAttributeValueSize,
  13804. maxNameValuePairSize
  13805. }
  13806. /***/ }),
  13807. /***/ 9061:
  13808. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  13809. const { parseSetCookie } = __nccwpck_require__(1978)
  13810. const { stringify } = __nccwpck_require__(7797)
  13811. const { webidl } = __nccwpck_require__(5893)
  13812. const { Headers } = __nccwpck_require__(660)
  13813. /**
  13814. * @typedef {Object} Cookie
  13815. * @property {string} name
  13816. * @property {string} value
  13817. * @property {Date|number|undefined} expires
  13818. * @property {number|undefined} maxAge
  13819. * @property {string|undefined} domain
  13820. * @property {string|undefined} path
  13821. * @property {boolean|undefined} secure
  13822. * @property {boolean|undefined} httpOnly
  13823. * @property {'Strict'|'Lax'|'None'} sameSite
  13824. * @property {string[]} unparsed
  13825. */
  13826. /**
  13827. * @param {Headers} headers
  13828. * @returns {Record<string, string>}
  13829. */
  13830. function getCookies (headers) {
  13831. webidl.argumentLengthCheck(arguments, 1, 'getCookies')
  13832. webidl.brandCheck(headers, Headers, { strict: false })
  13833. const cookie = headers.get('cookie')
  13834. const out = {}
  13835. if (!cookie) {
  13836. return out
  13837. }
  13838. for (const piece of cookie.split(';')) {
  13839. const [name, ...value] = piece.split('=')
  13840. out[name.trim()] = value.join('=')
  13841. }
  13842. return out
  13843. }
  13844. /**
  13845. * @param {Headers} headers
  13846. * @param {string} name
  13847. * @param {{ path?: string, domain?: string }|undefined} attributes
  13848. * @returns {void}
  13849. */
  13850. function deleteCookie (headers, name, attributes) {
  13851. webidl.brandCheck(headers, Headers, { strict: false })
  13852. const prefix = 'deleteCookie'
  13853. webidl.argumentLengthCheck(arguments, 2, prefix)
  13854. name = webidl.converters.DOMString(name, prefix, 'name')
  13855. attributes = webidl.converters.DeleteCookieAttributes(attributes)
  13856. // Matches behavior of
  13857. // https://github.com/denoland/deno_std/blob/63827b16330b82489a04614027c33b7904e08be5/http/cookie.ts#L278
  13858. setCookie(headers, {
  13859. name,
  13860. value: '',
  13861. expires: new Date(0),
  13862. ...attributes
  13863. })
  13864. }
  13865. /**
  13866. * @param {Headers} headers
  13867. * @returns {Cookie[]}
  13868. */
  13869. function getSetCookies (headers) {
  13870. webidl.argumentLengthCheck(arguments, 1, 'getSetCookies')
  13871. webidl.brandCheck(headers, Headers, { strict: false })
  13872. const cookies = headers.getSetCookie()
  13873. if (!cookies) {
  13874. return []
  13875. }
  13876. return cookies.map((pair) => parseSetCookie(pair))
  13877. }
  13878. /**
  13879. * @param {Headers} headers
  13880. * @param {Cookie} cookie
  13881. * @returns {void}
  13882. */
  13883. function setCookie (headers, cookie) {
  13884. webidl.argumentLengthCheck(arguments, 2, 'setCookie')
  13885. webidl.brandCheck(headers, Headers, { strict: false })
  13886. cookie = webidl.converters.Cookie(cookie)
  13887. const str = stringify(cookie)
  13888. if (str) {
  13889. headers.append('Set-Cookie', str)
  13890. }
  13891. }
  13892. webidl.converters.DeleteCookieAttributes = webidl.dictionaryConverter([
  13893. {
  13894. converter: webidl.nullableConverter(webidl.converters.DOMString),
  13895. key: 'path',
  13896. defaultValue: () => null
  13897. },
  13898. {
  13899. converter: webidl.nullableConverter(webidl.converters.DOMString),
  13900. key: 'domain',
  13901. defaultValue: () => null
  13902. }
  13903. ])
  13904. webidl.converters.Cookie = webidl.dictionaryConverter([
  13905. {
  13906. converter: webidl.converters.DOMString,
  13907. key: 'name'
  13908. },
  13909. {
  13910. converter: webidl.converters.DOMString,
  13911. key: 'value'
  13912. },
  13913. {
  13914. converter: webidl.nullableConverter((value) => {
  13915. if (typeof value === 'number') {
  13916. return webidl.converters['unsigned long long'](value)
  13917. }
  13918. return new Date(value)
  13919. }),
  13920. key: 'expires',
  13921. defaultValue: () => null
  13922. },
  13923. {
  13924. converter: webidl.nullableConverter(webidl.converters['long long']),
  13925. key: 'maxAge',
  13926. defaultValue: () => null
  13927. },
  13928. {
  13929. converter: webidl.nullableConverter(webidl.converters.DOMString),
  13930. key: 'domain',
  13931. defaultValue: () => null
  13932. },
  13933. {
  13934. converter: webidl.nullableConverter(webidl.converters.DOMString),
  13935. key: 'path',
  13936. defaultValue: () => null
  13937. },
  13938. {
  13939. converter: webidl.nullableConverter(webidl.converters.boolean),
  13940. key: 'secure',
  13941. defaultValue: () => null
  13942. },
  13943. {
  13944. converter: webidl.nullableConverter(webidl.converters.boolean),
  13945. key: 'httpOnly',
  13946. defaultValue: () => null
  13947. },
  13948. {
  13949. converter: webidl.converters.USVString,
  13950. key: 'sameSite',
  13951. allowedValues: ['Strict', 'Lax', 'None']
  13952. },
  13953. {
  13954. converter: webidl.sequenceConverter(webidl.converters.DOMString),
  13955. key: 'unparsed',
  13956. defaultValue: () => new Array(0)
  13957. }
  13958. ])
  13959. module.exports = {
  13960. getCookies,
  13961. deleteCookie,
  13962. getSetCookies,
  13963. setCookie
  13964. }
  13965. /***/ }),
  13966. /***/ 1978:
  13967. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  13968. const { maxNameValuePairSize, maxAttributeValueSize } = __nccwpck_require__(1276)
  13969. const { isCTLExcludingHtab } = __nccwpck_require__(7797)
  13970. const { collectASequenceOfCodePointsFast } = __nccwpck_require__(1900)
  13971. const assert = __nccwpck_require__(4589)
  13972. /**
  13973. * @description Parses the field-value attributes of a set-cookie header string.
  13974. * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4
  13975. * @param {string} header
  13976. * @returns if the header is invalid, null will be returned
  13977. */
  13978. function parseSetCookie (header) {
  13979. // 1. If the set-cookie-string contains a %x00-08 / %x0A-1F / %x7F
  13980. // character (CTL characters excluding HTAB): Abort these steps and
  13981. // ignore the set-cookie-string entirely.
  13982. if (isCTLExcludingHtab(header)) {
  13983. return null
  13984. }
  13985. let nameValuePair = ''
  13986. let unparsedAttributes = ''
  13987. let name = ''
  13988. let value = ''
  13989. // 2. If the set-cookie-string contains a %x3B (";") character:
  13990. if (header.includes(';')) {
  13991. // 1. The name-value-pair string consists of the characters up to,
  13992. // but not including, the first %x3B (";"), and the unparsed-
  13993. // attributes consist of the remainder of the set-cookie-string
  13994. // (including the %x3B (";") in question).
  13995. const position = { position: 0 }
  13996. nameValuePair = collectASequenceOfCodePointsFast(';', header, position)
  13997. unparsedAttributes = header.slice(position.position)
  13998. } else {
  13999. // Otherwise:
  14000. // 1. The name-value-pair string consists of all the characters
  14001. // contained in the set-cookie-string, and the unparsed-
  14002. // attributes is the empty string.
  14003. nameValuePair = header
  14004. }
  14005. // 3. If the name-value-pair string lacks a %x3D ("=") character, then
  14006. // the name string is empty, and the value string is the value of
  14007. // name-value-pair.
  14008. if (!nameValuePair.includes('=')) {
  14009. value = nameValuePair
  14010. } else {
  14011. // Otherwise, the name string consists of the characters up to, but
  14012. // not including, the first %x3D ("=") character, and the (possibly
  14013. // empty) value string consists of the characters after the first
  14014. // %x3D ("=") character.
  14015. const position = { position: 0 }
  14016. name = collectASequenceOfCodePointsFast(
  14017. '=',
  14018. nameValuePair,
  14019. position
  14020. )
  14021. value = nameValuePair.slice(position.position + 1)
  14022. }
  14023. // 4. Remove any leading or trailing WSP characters from the name
  14024. // string and the value string.
  14025. name = name.trim()
  14026. value = value.trim()
  14027. // 5. If the sum of the lengths of the name string and the value string
  14028. // is more than 4096 octets, abort these steps and ignore the set-
  14029. // cookie-string entirely.
  14030. if (name.length + value.length > maxNameValuePairSize) {
  14031. return null
  14032. }
  14033. // 6. The cookie-name is the name string, and the cookie-value is the
  14034. // value string.
  14035. return {
  14036. name, value, ...parseUnparsedAttributes(unparsedAttributes)
  14037. }
  14038. }
  14039. /**
  14040. * Parses the remaining attributes of a set-cookie header
  14041. * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4
  14042. * @param {string} unparsedAttributes
  14043. * @param {[Object.<string, unknown>]={}} cookieAttributeList
  14044. */
  14045. function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {}) {
  14046. // 1. If the unparsed-attributes string is empty, skip the rest of
  14047. // these steps.
  14048. if (unparsedAttributes.length === 0) {
  14049. return cookieAttributeList
  14050. }
  14051. // 2. Discard the first character of the unparsed-attributes (which
  14052. // will be a %x3B (";") character).
  14053. assert(unparsedAttributes[0] === ';')
  14054. unparsedAttributes = unparsedAttributes.slice(1)
  14055. let cookieAv = ''
  14056. // 3. If the remaining unparsed-attributes contains a %x3B (";")
  14057. // character:
  14058. if (unparsedAttributes.includes(';')) {
  14059. // 1. Consume the characters of the unparsed-attributes up to, but
  14060. // not including, the first %x3B (";") character.
  14061. cookieAv = collectASequenceOfCodePointsFast(
  14062. ';',
  14063. unparsedAttributes,
  14064. { position: 0 }
  14065. )
  14066. unparsedAttributes = unparsedAttributes.slice(cookieAv.length)
  14067. } else {
  14068. // Otherwise:
  14069. // 1. Consume the remainder of the unparsed-attributes.
  14070. cookieAv = unparsedAttributes
  14071. unparsedAttributes = ''
  14072. }
  14073. // Let the cookie-av string be the characters consumed in this step.
  14074. let attributeName = ''
  14075. let attributeValue = ''
  14076. // 4. If the cookie-av string contains a %x3D ("=") character:
  14077. if (cookieAv.includes('=')) {
  14078. // 1. The (possibly empty) attribute-name string consists of the
  14079. // characters up to, but not including, the first %x3D ("=")
  14080. // character, and the (possibly empty) attribute-value string
  14081. // consists of the characters after the first %x3D ("=")
  14082. // character.
  14083. const position = { position: 0 }
  14084. attributeName = collectASequenceOfCodePointsFast(
  14085. '=',
  14086. cookieAv,
  14087. position
  14088. )
  14089. attributeValue = cookieAv.slice(position.position + 1)
  14090. } else {
  14091. // Otherwise:
  14092. // 1. The attribute-name string consists of the entire cookie-av
  14093. // string, and the attribute-value string is empty.
  14094. attributeName = cookieAv
  14095. }
  14096. // 5. Remove any leading or trailing WSP characters from the attribute-
  14097. // name string and the attribute-value string.
  14098. attributeName = attributeName.trim()
  14099. attributeValue = attributeValue.trim()
  14100. // 6. If the attribute-value is longer than 1024 octets, ignore the
  14101. // cookie-av string and return to Step 1 of this algorithm.
  14102. if (attributeValue.length > maxAttributeValueSize) {
  14103. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14104. }
  14105. // 7. Process the attribute-name and attribute-value according to the
  14106. // requirements in the following subsections. (Notice that
  14107. // attributes with unrecognized attribute-names are ignored.)
  14108. const attributeNameLowercase = attributeName.toLowerCase()
  14109. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.1
  14110. // If the attribute-name case-insensitively matches the string
  14111. // "Expires", the user agent MUST process the cookie-av as follows.
  14112. if (attributeNameLowercase === 'expires') {
  14113. // 1. Let the expiry-time be the result of parsing the attribute-value
  14114. // as cookie-date (see Section 5.1.1).
  14115. const expiryTime = new Date(attributeValue)
  14116. // 2. If the attribute-value failed to parse as a cookie date, ignore
  14117. // the cookie-av.
  14118. cookieAttributeList.expires = expiryTime
  14119. } else if (attributeNameLowercase === 'max-age') {
  14120. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.2
  14121. // If the attribute-name case-insensitively matches the string "Max-
  14122. // Age", the user agent MUST process the cookie-av as follows.
  14123. // 1. If the first character of the attribute-value is not a DIGIT or a
  14124. // "-" character, ignore the cookie-av.
  14125. const charCode = attributeValue.charCodeAt(0)
  14126. if ((charCode < 48 || charCode > 57) && attributeValue[0] !== '-') {
  14127. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14128. }
  14129. // 2. If the remainder of attribute-value contains a non-DIGIT
  14130. // character, ignore the cookie-av.
  14131. if (!/^\d+$/.test(attributeValue)) {
  14132. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14133. }
  14134. // 3. Let delta-seconds be the attribute-value converted to an integer.
  14135. const deltaSeconds = Number(attributeValue)
  14136. // 4. Let cookie-age-limit be the maximum age of the cookie (which
  14137. // SHOULD be 400 days or less, see Section 4.1.2.2).
  14138. // 5. Set delta-seconds to the smaller of its present value and cookie-
  14139. // age-limit.
  14140. // deltaSeconds = Math.min(deltaSeconds * 1000, maxExpiresMs)
  14141. // 6. If delta-seconds is less than or equal to zero (0), let expiry-
  14142. // time be the earliest representable date and time. Otherwise, let
  14143. // the expiry-time be the current date and time plus delta-seconds
  14144. // seconds.
  14145. // const expiryTime = deltaSeconds <= 0 ? Date.now() : Date.now() + deltaSeconds
  14146. // 7. Append an attribute to the cookie-attribute-list with an
  14147. // attribute-name of Max-Age and an attribute-value of expiry-time.
  14148. cookieAttributeList.maxAge = deltaSeconds
  14149. } else if (attributeNameLowercase === 'domain') {
  14150. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.3
  14151. // If the attribute-name case-insensitively matches the string "Domain",
  14152. // the user agent MUST process the cookie-av as follows.
  14153. // 1. Let cookie-domain be the attribute-value.
  14154. let cookieDomain = attributeValue
  14155. // 2. If cookie-domain starts with %x2E ("."), let cookie-domain be
  14156. // cookie-domain without its leading %x2E (".").
  14157. if (cookieDomain[0] === '.') {
  14158. cookieDomain = cookieDomain.slice(1)
  14159. }
  14160. // 3. Convert the cookie-domain to lower case.
  14161. cookieDomain = cookieDomain.toLowerCase()
  14162. // 4. Append an attribute to the cookie-attribute-list with an
  14163. // attribute-name of Domain and an attribute-value of cookie-domain.
  14164. cookieAttributeList.domain = cookieDomain
  14165. } else if (attributeNameLowercase === 'path') {
  14166. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.4
  14167. // If the attribute-name case-insensitively matches the string "Path",
  14168. // the user agent MUST process the cookie-av as follows.
  14169. // 1. If the attribute-value is empty or if the first character of the
  14170. // attribute-value is not %x2F ("/"):
  14171. let cookiePath = ''
  14172. if (attributeValue.length === 0 || attributeValue[0] !== '/') {
  14173. // 1. Let cookie-path be the default-path.
  14174. cookiePath = '/'
  14175. } else {
  14176. // Otherwise:
  14177. // 1. Let cookie-path be the attribute-value.
  14178. cookiePath = attributeValue
  14179. }
  14180. // 2. Append an attribute to the cookie-attribute-list with an
  14181. // attribute-name of Path and an attribute-value of cookie-path.
  14182. cookieAttributeList.path = cookiePath
  14183. } else if (attributeNameLowercase === 'secure') {
  14184. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.5
  14185. // If the attribute-name case-insensitively matches the string "Secure",
  14186. // the user agent MUST append an attribute to the cookie-attribute-list
  14187. // with an attribute-name of Secure and an empty attribute-value.
  14188. cookieAttributeList.secure = true
  14189. } else if (attributeNameLowercase === 'httponly') {
  14190. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.6
  14191. // If the attribute-name case-insensitively matches the string
  14192. // "HttpOnly", the user agent MUST append an attribute to the cookie-
  14193. // attribute-list with an attribute-name of HttpOnly and an empty
  14194. // attribute-value.
  14195. cookieAttributeList.httpOnly = true
  14196. } else if (attributeNameLowercase === 'samesite') {
  14197. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.7
  14198. // If the attribute-name case-insensitively matches the string
  14199. // "SameSite", the user agent MUST process the cookie-av as follows:
  14200. const attributeValueLowercase = attributeValue.toLowerCase()
  14201. // 1. If cookie-av's attribute-value is a case-insensitive match for
  14202. // "None", append an attribute to the cookie-attribute-list with an
  14203. // attribute-name of "SameSite" and an attribute-value of "None".
  14204. if (attributeValueLowercase === 'none') {
  14205. cookieAttributeList.sameSite = 'None'
  14206. } else if (attributeValueLowercase === 'strict') {
  14207. // 2. If cookie-av's attribute-value is a case-insensitive match for
  14208. // "Strict", append an attribute to the cookie-attribute-list with
  14209. // an attribute-name of "SameSite" and an attribute-value of
  14210. // "Strict".
  14211. cookieAttributeList.sameSite = 'Strict'
  14212. } else if (attributeValueLowercase === 'lax') {
  14213. // 3. If cookie-av's attribute-value is a case-insensitive match for
  14214. // "Lax", append an attribute to the cookie-attribute-list with an
  14215. // attribute-name of "SameSite" and an attribute-value of "Lax".
  14216. cookieAttributeList.sameSite = 'Lax'
  14217. }
  14218. } else {
  14219. cookieAttributeList.unparsed ??= []
  14220. cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`)
  14221. }
  14222. // 8. Return to Step 1 of this algorithm.
  14223. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14224. }
  14225. module.exports = {
  14226. parseSetCookie,
  14227. parseUnparsedAttributes
  14228. }
  14229. /***/ }),
  14230. /***/ 7797:
  14231. /***/ ((module) => {
  14232. /**
  14233. * @param {string} value
  14234. * @returns {boolean}
  14235. */
  14236. function isCTLExcludingHtab (value) {
  14237. for (let i = 0; i < value.length; ++i) {
  14238. const code = value.charCodeAt(i)
  14239. if (
  14240. (code >= 0x00 && code <= 0x08) ||
  14241. (code >= 0x0A && code <= 0x1F) ||
  14242. code === 0x7F
  14243. ) {
  14244. return true
  14245. }
  14246. }
  14247. return false
  14248. }
  14249. /**
  14250. CHAR = <any US-ASCII character (octets 0 - 127)>
  14251. token = 1*<any CHAR except CTLs or separators>
  14252. separators = "(" | ")" | "<" | ">" | "@"
  14253. | "," | ";" | ":" | "\" | <">
  14254. | "/" | "[" | "]" | "?" | "="
  14255. | "{" | "}" | SP | HT
  14256. * @param {string} name
  14257. */
  14258. function validateCookieName (name) {
  14259. for (let i = 0; i < name.length; ++i) {
  14260. const code = name.charCodeAt(i)
  14261. if (
  14262. code < 0x21 || // exclude CTLs (0-31), SP and HT
  14263. code > 0x7E || // exclude non-ascii and DEL
  14264. code === 0x22 || // "
  14265. code === 0x28 || // (
  14266. code === 0x29 || // )
  14267. code === 0x3C || // <
  14268. code === 0x3E || // >
  14269. code === 0x40 || // @
  14270. code === 0x2C || // ,
  14271. code === 0x3B || // ;
  14272. code === 0x3A || // :
  14273. code === 0x5C || // \
  14274. code === 0x2F || // /
  14275. code === 0x5B || // [
  14276. code === 0x5D || // ]
  14277. code === 0x3F || // ?
  14278. code === 0x3D || // =
  14279. code === 0x7B || // {
  14280. code === 0x7D // }
  14281. ) {
  14282. throw new Error('Invalid cookie name')
  14283. }
  14284. }
  14285. }
  14286. /**
  14287. cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
  14288. cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
  14289. ; US-ASCII characters excluding CTLs,
  14290. ; whitespace DQUOTE, comma, semicolon,
  14291. ; and backslash
  14292. * @param {string} value
  14293. */
  14294. function validateCookieValue (value) {
  14295. let len = value.length
  14296. let i = 0
  14297. // if the value is wrapped in DQUOTE
  14298. if (value[0] === '"') {
  14299. if (len === 1 || value[len - 1] !== '"') {
  14300. throw new Error('Invalid cookie value')
  14301. }
  14302. --len
  14303. ++i
  14304. }
  14305. while (i < len) {
  14306. const code = value.charCodeAt(i++)
  14307. if (
  14308. code < 0x21 || // exclude CTLs (0-31)
  14309. code > 0x7E || // non-ascii and DEL (127)
  14310. code === 0x22 || // "
  14311. code === 0x2C || // ,
  14312. code === 0x3B || // ;
  14313. code === 0x5C // \
  14314. ) {
  14315. throw new Error('Invalid cookie value')
  14316. }
  14317. }
  14318. }
  14319. /**
  14320. * path-value = <any CHAR except CTLs or ";">
  14321. * @param {string} path
  14322. */
  14323. function validateCookiePath (path) {
  14324. for (let i = 0; i < path.length; ++i) {
  14325. const code = path.charCodeAt(i)
  14326. if (
  14327. code < 0x20 || // exclude CTLs (0-31)
  14328. code === 0x7F || // DEL
  14329. code === 0x3B // ;
  14330. ) {
  14331. throw new Error('Invalid cookie path')
  14332. }
  14333. }
  14334. }
  14335. /**
  14336. * I have no idea why these values aren't allowed to be honest,
  14337. * but Deno tests these. - Khafra
  14338. * @param {string} domain
  14339. */
  14340. function validateCookieDomain (domain) {
  14341. if (
  14342. domain.startsWith('-') ||
  14343. domain.endsWith('.') ||
  14344. domain.endsWith('-')
  14345. ) {
  14346. throw new Error('Invalid cookie domain')
  14347. }
  14348. }
  14349. const IMFDays = [
  14350. 'Sun', 'Mon', 'Tue', 'Wed',
  14351. 'Thu', 'Fri', 'Sat'
  14352. ]
  14353. const IMFMonths = [
  14354. 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  14355. 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
  14356. ]
  14357. const IMFPaddedNumbers = Array(61).fill(0).map((_, i) => i.toString().padStart(2, '0'))
  14358. /**
  14359. * @see https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1
  14360. * @param {number|Date} date
  14361. IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT
  14362. ; fixed length/zone/capitalization subset of the format
  14363. ; see Section 3.3 of [RFC5322]
  14364. day-name = %x4D.6F.6E ; "Mon", case-sensitive
  14365. / %x54.75.65 ; "Tue", case-sensitive
  14366. / %x57.65.64 ; "Wed", case-sensitive
  14367. / %x54.68.75 ; "Thu", case-sensitive
  14368. / %x46.72.69 ; "Fri", case-sensitive
  14369. / %x53.61.74 ; "Sat", case-sensitive
  14370. / %x53.75.6E ; "Sun", case-sensitive
  14371. date1 = day SP month SP year
  14372. ; e.g., 02 Jun 1982
  14373. day = 2DIGIT
  14374. month = %x4A.61.6E ; "Jan", case-sensitive
  14375. / %x46.65.62 ; "Feb", case-sensitive
  14376. / %x4D.61.72 ; "Mar", case-sensitive
  14377. / %x41.70.72 ; "Apr", case-sensitive
  14378. / %x4D.61.79 ; "May", case-sensitive
  14379. / %x4A.75.6E ; "Jun", case-sensitive
  14380. / %x4A.75.6C ; "Jul", case-sensitive
  14381. / %x41.75.67 ; "Aug", case-sensitive
  14382. / %x53.65.70 ; "Sep", case-sensitive
  14383. / %x4F.63.74 ; "Oct", case-sensitive
  14384. / %x4E.6F.76 ; "Nov", case-sensitive
  14385. / %x44.65.63 ; "Dec", case-sensitive
  14386. year = 4DIGIT
  14387. GMT = %x47.4D.54 ; "GMT", case-sensitive
  14388. time-of-day = hour ":" minute ":" second
  14389. ; 00:00:00 - 23:59:60 (leap second)
  14390. hour = 2DIGIT
  14391. minute = 2DIGIT
  14392. second = 2DIGIT
  14393. */
  14394. function toIMFDate (date) {
  14395. if (typeof date === 'number') {
  14396. date = new Date(date)
  14397. }
  14398. return `${IMFDays[date.getUTCDay()]}, ${IMFPaddedNumbers[date.getUTCDate()]} ${IMFMonths[date.getUTCMonth()]} ${date.getUTCFullYear()} ${IMFPaddedNumbers[date.getUTCHours()]}:${IMFPaddedNumbers[date.getUTCMinutes()]}:${IMFPaddedNumbers[date.getUTCSeconds()]} GMT`
  14399. }
  14400. /**
  14401. max-age-av = "Max-Age=" non-zero-digit *DIGIT
  14402. ; In practice, both expires-av and max-age-av
  14403. ; are limited to dates representable by the
  14404. ; user agent.
  14405. * @param {number} maxAge
  14406. */
  14407. function validateCookieMaxAge (maxAge) {
  14408. if (maxAge < 0) {
  14409. throw new Error('Invalid cookie max-age')
  14410. }
  14411. }
  14412. /**
  14413. * @see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1
  14414. * @param {import('./index').Cookie} cookie
  14415. */
  14416. function stringify (cookie) {
  14417. if (cookie.name.length === 0) {
  14418. return null
  14419. }
  14420. validateCookieName(cookie.name)
  14421. validateCookieValue(cookie.value)
  14422. const out = [`${cookie.name}=${cookie.value}`]
  14423. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.1
  14424. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.2
  14425. if (cookie.name.startsWith('__Secure-')) {
  14426. cookie.secure = true
  14427. }
  14428. if (cookie.name.startsWith('__Host-')) {
  14429. cookie.secure = true
  14430. cookie.domain = null
  14431. cookie.path = '/'
  14432. }
  14433. if (cookie.secure) {
  14434. out.push('Secure')
  14435. }
  14436. if (cookie.httpOnly) {
  14437. out.push('HttpOnly')
  14438. }
  14439. if (typeof cookie.maxAge === 'number') {
  14440. validateCookieMaxAge(cookie.maxAge)
  14441. out.push(`Max-Age=${cookie.maxAge}`)
  14442. }
  14443. if (cookie.domain) {
  14444. validateCookieDomain(cookie.domain)
  14445. out.push(`Domain=${cookie.domain}`)
  14446. }
  14447. if (cookie.path) {
  14448. validateCookiePath(cookie.path)
  14449. out.push(`Path=${cookie.path}`)
  14450. }
  14451. if (cookie.expires && cookie.expires.toString() !== 'Invalid Date') {
  14452. out.push(`Expires=${toIMFDate(cookie.expires)}`)
  14453. }
  14454. if (cookie.sameSite) {
  14455. out.push(`SameSite=${cookie.sameSite}`)
  14456. }
  14457. for (const part of cookie.unparsed) {
  14458. if (!part.includes('=')) {
  14459. throw new Error('Invalid unparsed')
  14460. }
  14461. const [key, ...value] = part.split('=')
  14462. out.push(`${key.trim()}=${value.join('=')}`)
  14463. }
  14464. return out.join('; ')
  14465. }
  14466. module.exports = {
  14467. isCTLExcludingHtab,
  14468. validateCookieName,
  14469. validateCookiePath,
  14470. validateCookieValue,
  14471. toIMFDate,
  14472. stringify
  14473. }
  14474. /***/ }),
  14475. /***/ 4031:
  14476. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  14477. const { Transform } = __nccwpck_require__(7075)
  14478. const { isASCIINumber, isValidLastEventId } = __nccwpck_require__(4811)
  14479. /**
  14480. * @type {number[]} BOM
  14481. */
  14482. const BOM = [0xEF, 0xBB, 0xBF]
  14483. /**
  14484. * @type {10} LF
  14485. */
  14486. const LF = 0x0A
  14487. /**
  14488. * @type {13} CR
  14489. */
  14490. const CR = 0x0D
  14491. /**
  14492. * @type {58} COLON
  14493. */
  14494. const COLON = 0x3A
  14495. /**
  14496. * @type {32} SPACE
  14497. */
  14498. const SPACE = 0x20
  14499. /**
  14500. * @typedef {object} EventSourceStreamEvent
  14501. * @type {object}
  14502. * @property {string} [event] The event type.
  14503. * @property {string} [data] The data of the message.
  14504. * @property {string} [id] A unique ID for the event.
  14505. * @property {string} [retry] The reconnection time, in milliseconds.
  14506. */
  14507. /**
  14508. * @typedef eventSourceSettings
  14509. * @type {object}
  14510. * @property {string} lastEventId The last event ID received from the server.
  14511. * @property {string} origin The origin of the event source.
  14512. * @property {number} reconnectionTime The reconnection time, in milliseconds.
  14513. */
  14514. class EventSourceStream extends Transform {
  14515. /**
  14516. * @type {eventSourceSettings}
  14517. */
  14518. state = null
  14519. /**
  14520. * Leading byte-order-mark check.
  14521. * @type {boolean}
  14522. */
  14523. checkBOM = true
  14524. /**
  14525. * @type {boolean}
  14526. */
  14527. crlfCheck = false
  14528. /**
  14529. * @type {boolean}
  14530. */
  14531. eventEndCheck = false
  14532. /**
  14533. * @type {Buffer}
  14534. */
  14535. buffer = null
  14536. pos = 0
  14537. event = {
  14538. data: undefined,
  14539. event: undefined,
  14540. id: undefined,
  14541. retry: undefined
  14542. }
  14543. /**
  14544. * @param {object} options
  14545. * @param {eventSourceSettings} options.eventSourceSettings
  14546. * @param {Function} [options.push]
  14547. */
  14548. constructor (options = {}) {
  14549. // Enable object mode as EventSourceStream emits objects of shape
  14550. // EventSourceStreamEvent
  14551. options.readableObjectMode = true
  14552. super(options)
  14553. this.state = options.eventSourceSettings || {}
  14554. if (options.push) {
  14555. this.push = options.push
  14556. }
  14557. }
  14558. /**
  14559. * @param {Buffer} chunk
  14560. * @param {string} _encoding
  14561. * @param {Function} callback
  14562. * @returns {void}
  14563. */
  14564. _transform (chunk, _encoding, callback) {
  14565. if (chunk.length === 0) {
  14566. callback()
  14567. return
  14568. }
  14569. // Cache the chunk in the buffer, as the data might not be complete while
  14570. // processing it
  14571. // TODO: Investigate if there is a more performant way to handle
  14572. // incoming chunks
  14573. // see: https://github.com/nodejs/undici/issues/2630
  14574. if (this.buffer) {
  14575. this.buffer = Buffer.concat([this.buffer, chunk])
  14576. } else {
  14577. this.buffer = chunk
  14578. }
  14579. // Strip leading byte-order-mark if we opened the stream and started
  14580. // the processing of the incoming data
  14581. if (this.checkBOM) {
  14582. switch (this.buffer.length) {
  14583. case 1:
  14584. // Check if the first byte is the same as the first byte of the BOM
  14585. if (this.buffer[0] === BOM[0]) {
  14586. // If it is, we need to wait for more data
  14587. callback()
  14588. return
  14589. }
  14590. // Set the checkBOM flag to false as we don't need to check for the
  14591. // BOM anymore
  14592. this.checkBOM = false
  14593. // The buffer only contains one byte so we need to wait for more data
  14594. callback()
  14595. return
  14596. case 2:
  14597. // Check if the first two bytes are the same as the first two bytes
  14598. // of the BOM
  14599. if (
  14600. this.buffer[0] === BOM[0] &&
  14601. this.buffer[1] === BOM[1]
  14602. ) {
  14603. // If it is, we need to wait for more data, because the third byte
  14604. // is needed to determine if it is the BOM or not
  14605. callback()
  14606. return
  14607. }
  14608. // Set the checkBOM flag to false as we don't need to check for the
  14609. // BOM anymore
  14610. this.checkBOM = false
  14611. break
  14612. case 3:
  14613. // Check if the first three bytes are the same as the first three
  14614. // bytes of the BOM
  14615. if (
  14616. this.buffer[0] === BOM[0] &&
  14617. this.buffer[1] === BOM[1] &&
  14618. this.buffer[2] === BOM[2]
  14619. ) {
  14620. // If it is, we can drop the buffered data, as it is only the BOM
  14621. this.buffer = Buffer.alloc(0)
  14622. // Set the checkBOM flag to false as we don't need to check for the
  14623. // BOM anymore
  14624. this.checkBOM = false
  14625. // Await more data
  14626. callback()
  14627. return
  14628. }
  14629. // If it is not the BOM, we can start processing the data
  14630. this.checkBOM = false
  14631. break
  14632. default:
  14633. // The buffer is longer than 3 bytes, so we can drop the BOM if it is
  14634. // present
  14635. if (
  14636. this.buffer[0] === BOM[0] &&
  14637. this.buffer[1] === BOM[1] &&
  14638. this.buffer[2] === BOM[2]
  14639. ) {
  14640. // Remove the BOM from the buffer
  14641. this.buffer = this.buffer.subarray(3)
  14642. }
  14643. // Set the checkBOM flag to false as we don't need to check for the
  14644. this.checkBOM = false
  14645. break
  14646. }
  14647. }
  14648. while (this.pos < this.buffer.length) {
  14649. // If the previous line ended with an end-of-line, we need to check
  14650. // if the next character is also an end-of-line.
  14651. if (this.eventEndCheck) {
  14652. // If the the current character is an end-of-line, then the event
  14653. // is finished and we can process it
  14654. // If the previous line ended with a carriage return, we need to
  14655. // check if the current character is a line feed and remove it
  14656. // from the buffer.
  14657. if (this.crlfCheck) {
  14658. // If the current character is a line feed, we can remove it
  14659. // from the buffer and reset the crlfCheck flag
  14660. if (this.buffer[this.pos] === LF) {
  14661. this.buffer = this.buffer.subarray(this.pos + 1)
  14662. this.pos = 0
  14663. this.crlfCheck = false
  14664. // It is possible that the line feed is not the end of the
  14665. // event. We need to check if the next character is an
  14666. // end-of-line character to determine if the event is
  14667. // finished. We simply continue the loop to check the next
  14668. // character.
  14669. // As we removed the line feed from the buffer and set the
  14670. // crlfCheck flag to false, we basically don't make any
  14671. // distinction between a line feed and a carriage return.
  14672. continue
  14673. }
  14674. this.crlfCheck = false
  14675. }
  14676. if (this.buffer[this.pos] === LF || this.buffer[this.pos] === CR) {
  14677. // If the current character is a carriage return, we need to
  14678. // set the crlfCheck flag to true, as we need to check if the
  14679. // next character is a line feed so we can remove it from the
  14680. // buffer
  14681. if (this.buffer[this.pos] === CR) {
  14682. this.crlfCheck = true
  14683. }
  14684. this.buffer = this.buffer.subarray(this.pos + 1)
  14685. this.pos = 0
  14686. if (
  14687. this.event.data !== undefined || this.event.event || this.event.id || this.event.retry) {
  14688. this.processEvent(this.event)
  14689. }
  14690. this.clearEvent()
  14691. continue
  14692. }
  14693. // If the current character is not an end-of-line, then the event
  14694. // is not finished and we have to reset the eventEndCheck flag
  14695. this.eventEndCheck = false
  14696. continue
  14697. }
  14698. // If the current character is an end-of-line, we can process the
  14699. // line
  14700. if (this.buffer[this.pos] === LF || this.buffer[this.pos] === CR) {
  14701. // If the current character is a carriage return, we need to
  14702. // set the crlfCheck flag to true, as we need to check if the
  14703. // next character is a line feed
  14704. if (this.buffer[this.pos] === CR) {
  14705. this.crlfCheck = true
  14706. }
  14707. // In any case, we can process the line as we reached an
  14708. // end-of-line character
  14709. this.parseLine(this.buffer.subarray(0, this.pos), this.event)
  14710. // Remove the processed line from the buffer
  14711. this.buffer = this.buffer.subarray(this.pos + 1)
  14712. // Reset the position as we removed the processed line from the buffer
  14713. this.pos = 0
  14714. // A line was processed and this could be the end of the event. We need
  14715. // to check if the next line is empty to determine if the event is
  14716. // finished.
  14717. this.eventEndCheck = true
  14718. continue
  14719. }
  14720. this.pos++
  14721. }
  14722. callback()
  14723. }
  14724. /**
  14725. * @param {Buffer} line
  14726. * @param {EventStreamEvent} event
  14727. */
  14728. parseLine (line, event) {
  14729. // If the line is empty (a blank line)
  14730. // Dispatch the event, as defined below.
  14731. // This will be handled in the _transform method
  14732. if (line.length === 0) {
  14733. return
  14734. }
  14735. // If the line starts with a U+003A COLON character (:)
  14736. // Ignore the line.
  14737. const colonPosition = line.indexOf(COLON)
  14738. if (colonPosition === 0) {
  14739. return
  14740. }
  14741. let field = ''
  14742. let value = ''
  14743. // If the line contains a U+003A COLON character (:)
  14744. if (colonPosition !== -1) {
  14745. // Collect the characters on the line before the first U+003A COLON
  14746. // character (:), and let field be that string.
  14747. // TODO: Investigate if there is a more performant way to extract the
  14748. // field
  14749. // see: https://github.com/nodejs/undici/issues/2630
  14750. field = line.subarray(0, colonPosition).toString('utf8')
  14751. // Collect the characters on the line after the first U+003A COLON
  14752. // character (:), and let value be that string.
  14753. // If value starts with a U+0020 SPACE character, remove it from value.
  14754. let valueStart = colonPosition + 1
  14755. if (line[valueStart] === SPACE) {
  14756. ++valueStart
  14757. }
  14758. // TODO: Investigate if there is a more performant way to extract the
  14759. // value
  14760. // see: https://github.com/nodejs/undici/issues/2630
  14761. value = line.subarray(valueStart).toString('utf8')
  14762. // Otherwise, the string is not empty but does not contain a U+003A COLON
  14763. // character (:)
  14764. } else {
  14765. // Process the field using the steps described below, using the whole
  14766. // line as the field name, and the empty string as the field value.
  14767. field = line.toString('utf8')
  14768. value = ''
  14769. }
  14770. // Modify the event with the field name and value. The value is also
  14771. // decoded as UTF-8
  14772. switch (field) {
  14773. case 'data':
  14774. if (event[field] === undefined) {
  14775. event[field] = value
  14776. } else {
  14777. event[field] += `\n${value}`
  14778. }
  14779. break
  14780. case 'retry':
  14781. if (isASCIINumber(value)) {
  14782. event[field] = value
  14783. }
  14784. break
  14785. case 'id':
  14786. if (isValidLastEventId(value)) {
  14787. event[field] = value
  14788. }
  14789. break
  14790. case 'event':
  14791. if (value.length > 0) {
  14792. event[field] = value
  14793. }
  14794. break
  14795. }
  14796. }
  14797. /**
  14798. * @param {EventSourceStreamEvent} event
  14799. */
  14800. processEvent (event) {
  14801. if (event.retry && isASCIINumber(event.retry)) {
  14802. this.state.reconnectionTime = parseInt(event.retry, 10)
  14803. }
  14804. if (event.id && isValidLastEventId(event.id)) {
  14805. this.state.lastEventId = event.id
  14806. }
  14807. // only dispatch event, when data is provided
  14808. if (event.data !== undefined) {
  14809. this.push({
  14810. type: event.event || 'message',
  14811. options: {
  14812. data: event.data,
  14813. lastEventId: this.state.lastEventId,
  14814. origin: this.state.origin
  14815. }
  14816. })
  14817. }
  14818. }
  14819. clearEvent () {
  14820. this.event = {
  14821. data: undefined,
  14822. event: undefined,
  14823. id: undefined,
  14824. retry: undefined
  14825. }
  14826. }
  14827. }
  14828. module.exports = {
  14829. EventSourceStream
  14830. }
  14831. /***/ }),
  14832. /***/ 1238:
  14833. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  14834. const { pipeline } = __nccwpck_require__(7075)
  14835. const { fetching } = __nccwpck_require__(4398)
  14836. const { makeRequest } = __nccwpck_require__(9967)
  14837. const { webidl } = __nccwpck_require__(5893)
  14838. const { EventSourceStream } = __nccwpck_require__(4031)
  14839. const { parseMIMEType } = __nccwpck_require__(1900)
  14840. const { createFastMessageEvent } = __nccwpck_require__(5188)
  14841. const { isNetworkError } = __nccwpck_require__(9051)
  14842. const { delay } = __nccwpck_require__(4811)
  14843. const { kEnumerableProperty } = __nccwpck_require__(3440)
  14844. const { environmentSettingsObject } = __nccwpck_require__(3168)
  14845. let experimentalWarned = false
  14846. /**
  14847. * A reconnection time, in milliseconds. This must initially be an implementation-defined value,
  14848. * probably in the region of a few seconds.
  14849. *
  14850. * In Comparison:
  14851. * - Chrome uses 3000ms.
  14852. * - Deno uses 5000ms.
  14853. *
  14854. * @type {3000}
  14855. */
  14856. const defaultReconnectionTime = 3000
  14857. /**
  14858. * The readyState attribute represents the state of the connection.
  14859. * @enum
  14860. * @readonly
  14861. * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#dom-eventsource-readystate-dev
  14862. */
  14863. /**
  14864. * The connection has not yet been established, or it was closed and the user
  14865. * agent is reconnecting.
  14866. * @type {0}
  14867. */
  14868. const CONNECTING = 0
  14869. /**
  14870. * The user agent has an open connection and is dispatching events as it
  14871. * receives them.
  14872. * @type {1}
  14873. */
  14874. const OPEN = 1
  14875. /**
  14876. * The connection is not open, and the user agent is not trying to reconnect.
  14877. * @type {2}
  14878. */
  14879. const CLOSED = 2
  14880. /**
  14881. * Requests for the element will have their mode set to "cors" and their credentials mode set to "same-origin".
  14882. * @type {'anonymous'}
  14883. */
  14884. const ANONYMOUS = 'anonymous'
  14885. /**
  14886. * Requests for the element will have their mode set to "cors" and their credentials mode set to "include".
  14887. * @type {'use-credentials'}
  14888. */
  14889. const USE_CREDENTIALS = 'use-credentials'
  14890. /**
  14891. * The EventSource interface is used to receive server-sent events. It
  14892. * connects to a server over HTTP and receives events in text/event-stream
  14893. * format without closing the connection.
  14894. * @extends {EventTarget}
  14895. * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events
  14896. * @api public
  14897. */
  14898. class EventSource extends EventTarget {
  14899. #events = {
  14900. open: null,
  14901. error: null,
  14902. message: null
  14903. }
  14904. #url = null
  14905. #withCredentials = false
  14906. #readyState = CONNECTING
  14907. #request = null
  14908. #controller = null
  14909. #dispatcher
  14910. /**
  14911. * @type {import('./eventsource-stream').eventSourceSettings}
  14912. */
  14913. #state
  14914. /**
  14915. * Creates a new EventSource object.
  14916. * @param {string} url
  14917. * @param {EventSourceInit} [eventSourceInitDict]
  14918. * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#the-eventsource-interface
  14919. */
  14920. constructor (url, eventSourceInitDict = {}) {
  14921. // 1. Let ev be a new EventSource object.
  14922. super()
  14923. webidl.util.markAsUncloneable(this)
  14924. const prefix = 'EventSource constructor'
  14925. webidl.argumentLengthCheck(arguments, 1, prefix)
  14926. if (!experimentalWarned) {
  14927. experimentalWarned = true
  14928. process.emitWarning('EventSource is experimental, expect them to change at any time.', {
  14929. code: 'UNDICI-ES'
  14930. })
  14931. }
  14932. url = webidl.converters.USVString(url, prefix, 'url')
  14933. eventSourceInitDict = webidl.converters.EventSourceInitDict(eventSourceInitDict, prefix, 'eventSourceInitDict')
  14934. this.#dispatcher = eventSourceInitDict.dispatcher
  14935. this.#state = {
  14936. lastEventId: '',
  14937. reconnectionTime: defaultReconnectionTime
  14938. }
  14939. // 2. Let settings be ev's relevant settings object.
  14940. // https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
  14941. const settings = environmentSettingsObject
  14942. let urlRecord
  14943. try {
  14944. // 3. Let urlRecord be the result of encoding-parsing a URL given url, relative to settings.
  14945. urlRecord = new URL(url, settings.settingsObject.baseUrl)
  14946. this.#state.origin = urlRecord.origin
  14947. } catch (e) {
  14948. // 4. If urlRecord is failure, then throw a "SyntaxError" DOMException.
  14949. throw new DOMException(e, 'SyntaxError')
  14950. }
  14951. // 5. Set ev's url to urlRecord.
  14952. this.#url = urlRecord.href
  14953. // 6. Let corsAttributeState be Anonymous.
  14954. let corsAttributeState = ANONYMOUS
  14955. // 7. If the value of eventSourceInitDict's withCredentials member is true,
  14956. // then set corsAttributeState to Use Credentials and set ev's
  14957. // withCredentials attribute to true.
  14958. if (eventSourceInitDict.withCredentials) {
  14959. corsAttributeState = USE_CREDENTIALS
  14960. this.#withCredentials = true
  14961. }
  14962. // 8. Let request be the result of creating a potential-CORS request given
  14963. // urlRecord, the empty string, and corsAttributeState.
  14964. const initRequest = {
  14965. redirect: 'follow',
  14966. keepalive: true,
  14967. // @see https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes
  14968. mode: 'cors',
  14969. credentials: corsAttributeState === 'anonymous'
  14970. ? 'same-origin'
  14971. : 'omit',
  14972. referrer: 'no-referrer'
  14973. }
  14974. // 9. Set request's client to settings.
  14975. initRequest.client = environmentSettingsObject.settingsObject
  14976. // 10. User agents may set (`Accept`, `text/event-stream`) in request's header list.
  14977. initRequest.headersList = [['accept', { name: 'accept', value: 'text/event-stream' }]]
  14978. // 11. Set request's cache mode to "no-store".
  14979. initRequest.cache = 'no-store'
  14980. // 12. Set request's initiator type to "other".
  14981. initRequest.initiator = 'other'
  14982. initRequest.urlList = [new URL(this.#url)]
  14983. // 13. Set ev's request to request.
  14984. this.#request = makeRequest(initRequest)
  14985. this.#connect()
  14986. }
  14987. /**
  14988. * Returns the state of this EventSource object's connection. It can have the
  14989. * values described below.
  14990. * @returns {0|1|2}
  14991. * @readonly
  14992. */
  14993. get readyState () {
  14994. return this.#readyState
  14995. }
  14996. /**
  14997. * Returns the URL providing the event stream.
  14998. * @readonly
  14999. * @returns {string}
  15000. */
  15001. get url () {
  15002. return this.#url
  15003. }
  15004. /**
  15005. * Returns a boolean indicating whether the EventSource object was
  15006. * instantiated with CORS credentials set (true), or not (false, the default).
  15007. */
  15008. get withCredentials () {
  15009. return this.#withCredentials
  15010. }
  15011. #connect () {
  15012. if (this.#readyState === CLOSED) return
  15013. this.#readyState = CONNECTING
  15014. const fetchParams = {
  15015. request: this.#request,
  15016. dispatcher: this.#dispatcher
  15017. }
  15018. // 14. Let processEventSourceEndOfBody given response res be the following step: if res is not a network error, then reestablish the connection.
  15019. const processEventSourceEndOfBody = (response) => {
  15020. if (isNetworkError(response)) {
  15021. this.dispatchEvent(new Event('error'))
  15022. this.close()
  15023. }
  15024. this.#reconnect()
  15025. }
  15026. // 15. Fetch request, with processResponseEndOfBody set to processEventSourceEndOfBody...
  15027. fetchParams.processResponseEndOfBody = processEventSourceEndOfBody
  15028. // and processResponse set to the following steps given response res:
  15029. fetchParams.processResponse = (response) => {
  15030. // 1. If res is an aborted network error, then fail the connection.
  15031. if (isNetworkError(response)) {
  15032. // 1. When a user agent is to fail the connection, the user agent
  15033. // must queue a task which, if the readyState attribute is set to a
  15034. // value other than CLOSED, sets the readyState attribute to CLOSED
  15035. // and fires an event named error at the EventSource object. Once the
  15036. // user agent has failed the connection, it does not attempt to
  15037. // reconnect.
  15038. if (response.aborted) {
  15039. this.close()
  15040. this.dispatchEvent(new Event('error'))
  15041. return
  15042. // 2. Otherwise, if res is a network error, then reestablish the
  15043. // connection, unless the user agent knows that to be futile, in
  15044. // which case the user agent may fail the connection.
  15045. } else {
  15046. this.#reconnect()
  15047. return
  15048. }
  15049. }
  15050. // 3. Otherwise, if res's status is not 200, or if res's `Content-Type`
  15051. // is not `text/event-stream`, then fail the connection.
  15052. const contentType = response.headersList.get('content-type', true)
  15053. const mimeType = contentType !== null ? parseMIMEType(contentType) : 'failure'
  15054. const contentTypeValid = mimeType !== 'failure' && mimeType.essence === 'text/event-stream'
  15055. if (
  15056. response.status !== 200 ||
  15057. contentTypeValid === false
  15058. ) {
  15059. this.close()
  15060. this.dispatchEvent(new Event('error'))
  15061. return
  15062. }
  15063. // 4. Otherwise, announce the connection and interpret res's body
  15064. // line by line.
  15065. // When a user agent is to announce the connection, the user agent
  15066. // must queue a task which, if the readyState attribute is set to a
  15067. // value other than CLOSED, sets the readyState attribute to OPEN
  15068. // and fires an event named open at the EventSource object.
  15069. // @see https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model
  15070. this.#readyState = OPEN
  15071. this.dispatchEvent(new Event('open'))
  15072. // If redirected to a different origin, set the origin to the new origin.
  15073. this.#state.origin = response.urlList[response.urlList.length - 1].origin
  15074. const eventSourceStream = new EventSourceStream({
  15075. eventSourceSettings: this.#state,
  15076. push: (event) => {
  15077. this.dispatchEvent(createFastMessageEvent(
  15078. event.type,
  15079. event.options
  15080. ))
  15081. }
  15082. })
  15083. pipeline(response.body.stream,
  15084. eventSourceStream,
  15085. (error) => {
  15086. if (
  15087. error?.aborted === false
  15088. ) {
  15089. this.close()
  15090. this.dispatchEvent(new Event('error'))
  15091. }
  15092. })
  15093. }
  15094. this.#controller = fetching(fetchParams)
  15095. }
  15096. /**
  15097. * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model
  15098. * @returns {Promise<void>}
  15099. */
  15100. async #reconnect () {
  15101. // When a user agent is to reestablish the connection, the user agent must
  15102. // run the following steps. These steps are run in parallel, not as part of
  15103. // a task. (The tasks that it queues, of course, are run like normal tasks
  15104. // and not themselves in parallel.)
  15105. // 1. Queue a task to run the following steps:
  15106. // 1. If the readyState attribute is set to CLOSED, abort the task.
  15107. if (this.#readyState === CLOSED) return
  15108. // 2. Set the readyState attribute to CONNECTING.
  15109. this.#readyState = CONNECTING
  15110. // 3. Fire an event named error at the EventSource object.
  15111. this.dispatchEvent(new Event('error'))
  15112. // 2. Wait a delay equal to the reconnection time of the event source.
  15113. await delay(this.#state.reconnectionTime)
  15114. // 5. Queue a task to run the following steps:
  15115. // 1. If the EventSource object's readyState attribute is not set to
  15116. // CONNECTING, then return.
  15117. if (this.#readyState !== CONNECTING) return
  15118. // 2. Let request be the EventSource object's request.
  15119. // 3. If the EventSource object's last event ID string is not the empty
  15120. // string, then:
  15121. // 1. Let lastEventIDValue be the EventSource object's last event ID
  15122. // string, encoded as UTF-8.
  15123. // 2. Set (`Last-Event-ID`, lastEventIDValue) in request's header
  15124. // list.
  15125. if (this.#state.lastEventId.length) {
  15126. this.#request.headersList.set('last-event-id', this.#state.lastEventId, true)
  15127. }
  15128. // 4. Fetch request and process the response obtained in this fashion, if any, as described earlier in this section.
  15129. this.#connect()
  15130. }
  15131. /**
  15132. * Closes the connection, if any, and sets the readyState attribute to
  15133. * CLOSED.
  15134. */
  15135. close () {
  15136. webidl.brandCheck(this, EventSource)
  15137. if (this.#readyState === CLOSED) return
  15138. this.#readyState = CLOSED
  15139. this.#controller.abort()
  15140. this.#request = null
  15141. }
  15142. get onopen () {
  15143. return this.#events.open
  15144. }
  15145. set onopen (fn) {
  15146. if (this.#events.open) {
  15147. this.removeEventListener('open', this.#events.open)
  15148. }
  15149. if (typeof fn === 'function') {
  15150. this.#events.open = fn
  15151. this.addEventListener('open', fn)
  15152. } else {
  15153. this.#events.open = null
  15154. }
  15155. }
  15156. get onmessage () {
  15157. return this.#events.message
  15158. }
  15159. set onmessage (fn) {
  15160. if (this.#events.message) {
  15161. this.removeEventListener('message', this.#events.message)
  15162. }
  15163. if (typeof fn === 'function') {
  15164. this.#events.message = fn
  15165. this.addEventListener('message', fn)
  15166. } else {
  15167. this.#events.message = null
  15168. }
  15169. }
  15170. get onerror () {
  15171. return this.#events.error
  15172. }
  15173. set onerror (fn) {
  15174. if (this.#events.error) {
  15175. this.removeEventListener('error', this.#events.error)
  15176. }
  15177. if (typeof fn === 'function') {
  15178. this.#events.error = fn
  15179. this.addEventListener('error', fn)
  15180. } else {
  15181. this.#events.error = null
  15182. }
  15183. }
  15184. }
  15185. const constantsPropertyDescriptors = {
  15186. CONNECTING: {
  15187. __proto__: null,
  15188. configurable: false,
  15189. enumerable: true,
  15190. value: CONNECTING,
  15191. writable: false
  15192. },
  15193. OPEN: {
  15194. __proto__: null,
  15195. configurable: false,
  15196. enumerable: true,
  15197. value: OPEN,
  15198. writable: false
  15199. },
  15200. CLOSED: {
  15201. __proto__: null,
  15202. configurable: false,
  15203. enumerable: true,
  15204. value: CLOSED,
  15205. writable: false
  15206. }
  15207. }
  15208. Object.defineProperties(EventSource, constantsPropertyDescriptors)
  15209. Object.defineProperties(EventSource.prototype, constantsPropertyDescriptors)
  15210. Object.defineProperties(EventSource.prototype, {
  15211. close: kEnumerableProperty,
  15212. onerror: kEnumerableProperty,
  15213. onmessage: kEnumerableProperty,
  15214. onopen: kEnumerableProperty,
  15215. readyState: kEnumerableProperty,
  15216. url: kEnumerableProperty,
  15217. withCredentials: kEnumerableProperty
  15218. })
  15219. webidl.converters.EventSourceInitDict = webidl.dictionaryConverter([
  15220. {
  15221. key: 'withCredentials',
  15222. converter: webidl.converters.boolean,
  15223. defaultValue: () => false
  15224. },
  15225. {
  15226. key: 'dispatcher', // undici only
  15227. converter: webidl.converters.any
  15228. }
  15229. ])
  15230. module.exports = {
  15231. EventSource,
  15232. defaultReconnectionTime
  15233. }
  15234. /***/ }),
  15235. /***/ 4811:
  15236. /***/ ((module) => {
  15237. /**
  15238. * Checks if the given value is a valid LastEventId.
  15239. * @param {string} value
  15240. * @returns {boolean}
  15241. */
  15242. function isValidLastEventId (value) {
  15243. // LastEventId should not contain U+0000 NULL
  15244. return value.indexOf('\u0000') === -1
  15245. }
  15246. /**
  15247. * Checks if the given value is a base 10 digit.
  15248. * @param {string} value
  15249. * @returns {boolean}
  15250. */
  15251. function isASCIINumber (value) {
  15252. if (value.length === 0) return false
  15253. for (let i = 0; i < value.length; i++) {
  15254. if (value.charCodeAt(i) < 0x30 || value.charCodeAt(i) > 0x39) return false
  15255. }
  15256. return true
  15257. }
  15258. // https://github.com/nodejs/undici/issues/2664
  15259. function delay (ms) {
  15260. return new Promise((resolve) => {
  15261. setTimeout(resolve, ms).unref()
  15262. })
  15263. }
  15264. module.exports = {
  15265. isValidLastEventId,
  15266. isASCIINumber,
  15267. delay
  15268. }
  15269. /***/ }),
  15270. /***/ 4492:
  15271. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  15272. const util = __nccwpck_require__(3440)
  15273. const {
  15274. ReadableStreamFrom,
  15275. isBlobLike,
  15276. isReadableStreamLike,
  15277. readableStreamClose,
  15278. createDeferredPromise,
  15279. fullyReadBody,
  15280. extractMimeType,
  15281. utf8DecodeBytes
  15282. } = __nccwpck_require__(3168)
  15283. const { FormData } = __nccwpck_require__(5910)
  15284. const { kState } = __nccwpck_require__(3627)
  15285. const { webidl } = __nccwpck_require__(5893)
  15286. const { Blob } = __nccwpck_require__(4573)
  15287. const assert = __nccwpck_require__(4589)
  15288. const { isErrored, isDisturbed } = __nccwpck_require__(7075)
  15289. const { isArrayBuffer } = __nccwpck_require__(3429)
  15290. const { serializeAMimeType } = __nccwpck_require__(1900)
  15291. const { multipartFormDataParser } = __nccwpck_require__(116)
  15292. let random
  15293. try {
  15294. const crypto = __nccwpck_require__(7598)
  15295. random = (max) => crypto.randomInt(0, max)
  15296. } catch {
  15297. random = (max) => Math.floor(Math.random(max))
  15298. }
  15299. const textEncoder = new TextEncoder()
  15300. function noop () {}
  15301. const hasFinalizationRegistry = globalThis.FinalizationRegistry && process.version.indexOf('v18') !== 0
  15302. let streamRegistry
  15303. if (hasFinalizationRegistry) {
  15304. streamRegistry = new FinalizationRegistry((weakRef) => {
  15305. const stream = weakRef.deref()
  15306. if (stream && !stream.locked && !isDisturbed(stream) && !isErrored(stream)) {
  15307. stream.cancel('Response object has been garbage collected').catch(noop)
  15308. }
  15309. })
  15310. }
  15311. // https://fetch.spec.whatwg.org/#concept-bodyinit-extract
  15312. function extractBody (object, keepalive = false) {
  15313. // 1. Let stream be null.
  15314. let stream = null
  15315. // 2. If object is a ReadableStream object, then set stream to object.
  15316. if (object instanceof ReadableStream) {
  15317. stream = object
  15318. } else if (isBlobLike(object)) {
  15319. // 3. Otherwise, if object is a Blob object, set stream to the
  15320. // result of running object’s get stream.
  15321. stream = object.stream()
  15322. } else {
  15323. // 4. Otherwise, set stream to a new ReadableStream object, and set
  15324. // up stream with byte reading support.
  15325. stream = new ReadableStream({
  15326. async pull (controller) {
  15327. const buffer = typeof source === 'string' ? textEncoder.encode(source) : source
  15328. if (buffer.byteLength) {
  15329. controller.enqueue(buffer)
  15330. }
  15331. queueMicrotask(() => readableStreamClose(controller))
  15332. },
  15333. start () {},
  15334. type: 'bytes'
  15335. })
  15336. }
  15337. // 5. Assert: stream is a ReadableStream object.
  15338. assert(isReadableStreamLike(stream))
  15339. // 6. Let action be null.
  15340. let action = null
  15341. // 7. Let source be null.
  15342. let source = null
  15343. // 8. Let length be null.
  15344. let length = null
  15345. // 9. Let type be null.
  15346. let type = null
  15347. // 10. Switch on object:
  15348. if (typeof object === 'string') {
  15349. // Set source to the UTF-8 encoding of object.
  15350. // Note: setting source to a Uint8Array here breaks some mocking assumptions.
  15351. source = object
  15352. // Set type to `text/plain;charset=UTF-8`.
  15353. type = 'text/plain;charset=UTF-8'
  15354. } else if (object instanceof URLSearchParams) {
  15355. // URLSearchParams
  15356. // spec says to run application/x-www-form-urlencoded on body.list
  15357. // this is implemented in Node.js as apart of an URLSearchParams instance toString method
  15358. // See: https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L490
  15359. // and https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L1100
  15360. // Set source to the result of running the application/x-www-form-urlencoded serializer with object’s list.
  15361. source = object.toString()
  15362. // Set type to `application/x-www-form-urlencoded;charset=UTF-8`.
  15363. type = 'application/x-www-form-urlencoded;charset=UTF-8'
  15364. } else if (isArrayBuffer(object)) {
  15365. // BufferSource/ArrayBuffer
  15366. // Set source to a copy of the bytes held by object.
  15367. source = new Uint8Array(object.slice())
  15368. } else if (ArrayBuffer.isView(object)) {
  15369. // BufferSource/ArrayBufferView
  15370. // Set source to a copy of the bytes held by object.
  15371. source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
  15372. } else if (util.isFormDataLike(object)) {
  15373. const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
  15374. const prefix = `--${boundary}\r\nContent-Disposition: form-data`
  15375. /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
  15376. const escape = (str) =>
  15377. str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22')
  15378. const normalizeLinefeeds = (value) => value.replace(/\r?\n|\r/g, '\r\n')
  15379. // Set action to this step: run the multipart/form-data
  15380. // encoding algorithm, with object’s entry list and UTF-8.
  15381. // - This ensures that the body is immutable and can't be changed afterwords
  15382. // - That the content-length is calculated in advance.
  15383. // - And that all parts are pre-encoded and ready to be sent.
  15384. const blobParts = []
  15385. const rn = new Uint8Array([13, 10]) // '\r\n'
  15386. length = 0
  15387. let hasUnknownSizeValue = false
  15388. for (const [name, value] of object) {
  15389. if (typeof value === 'string') {
  15390. const chunk = textEncoder.encode(prefix +
  15391. `; name="${escape(normalizeLinefeeds(name))}"` +
  15392. `\r\n\r\n${normalizeLinefeeds(value)}\r\n`)
  15393. blobParts.push(chunk)
  15394. length += chunk.byteLength
  15395. } else {
  15396. const chunk = textEncoder.encode(`${prefix}; name="${escape(normalizeLinefeeds(name))}"` +
  15397. (value.name ? `; filename="${escape(value.name)}"` : '') + '\r\n' +
  15398. `Content-Type: ${
  15399. value.type || 'application/octet-stream'
  15400. }\r\n\r\n`)
  15401. blobParts.push(chunk, value, rn)
  15402. if (typeof value.size === 'number') {
  15403. length += chunk.byteLength + value.size + rn.byteLength
  15404. } else {
  15405. hasUnknownSizeValue = true
  15406. }
  15407. }
  15408. }
  15409. // CRLF is appended to the body to function with legacy servers and match other implementations.
  15410. // https://github.com/curl/curl/blob/3434c6b46e682452973972e8313613dfa58cd690/lib/mime.c#L1029-L1030
  15411. // https://github.com/form-data/form-data/issues/63
  15412. const chunk = textEncoder.encode(`--${boundary}--\r\n`)
  15413. blobParts.push(chunk)
  15414. length += chunk.byteLength
  15415. if (hasUnknownSizeValue) {
  15416. length = null
  15417. }
  15418. // Set source to object.
  15419. source = object
  15420. action = async function * () {
  15421. for (const part of blobParts) {
  15422. if (part.stream) {
  15423. yield * part.stream()
  15424. } else {
  15425. yield part
  15426. }
  15427. }
  15428. }
  15429. // Set type to `multipart/form-data; boundary=`,
  15430. // followed by the multipart/form-data boundary string generated
  15431. // by the multipart/form-data encoding algorithm.
  15432. type = `multipart/form-data; boundary=${boundary}`
  15433. } else if (isBlobLike(object)) {
  15434. // Blob
  15435. // Set source to object.
  15436. source = object
  15437. // Set length to object’s size.
  15438. length = object.size
  15439. // If object’s type attribute is not the empty byte sequence, set
  15440. // type to its value.
  15441. if (object.type) {
  15442. type = object.type
  15443. }
  15444. } else if (typeof object[Symbol.asyncIterator] === 'function') {
  15445. // If keepalive is true, then throw a TypeError.
  15446. if (keepalive) {
  15447. throw new TypeError('keepalive')
  15448. }
  15449. // If object is disturbed or locked, then throw a TypeError.
  15450. if (util.isDisturbed(object) || object.locked) {
  15451. throw new TypeError(
  15452. 'Response body object should not be disturbed or locked'
  15453. )
  15454. }
  15455. stream =
  15456. object instanceof ReadableStream ? object : ReadableStreamFrom(object)
  15457. }
  15458. // 11. If source is a byte sequence, then set action to a
  15459. // step that returns source and length to source’s length.
  15460. if (typeof source === 'string' || util.isBuffer(source)) {
  15461. length = Buffer.byteLength(source)
  15462. }
  15463. // 12. If action is non-null, then run these steps in in parallel:
  15464. if (action != null) {
  15465. // Run action.
  15466. let iterator
  15467. stream = new ReadableStream({
  15468. async start () {
  15469. iterator = action(object)[Symbol.asyncIterator]()
  15470. },
  15471. async pull (controller) {
  15472. const { value, done } = await iterator.next()
  15473. if (done) {
  15474. // When running action is done, close stream.
  15475. queueMicrotask(() => {
  15476. controller.close()
  15477. controller.byobRequest?.respond(0)
  15478. })
  15479. } else {
  15480. // Whenever one or more bytes are available and stream is not errored,
  15481. // enqueue a Uint8Array wrapping an ArrayBuffer containing the available
  15482. // bytes into stream.
  15483. if (!isErrored(stream)) {
  15484. const buffer = new Uint8Array(value)
  15485. if (buffer.byteLength) {
  15486. controller.enqueue(buffer)
  15487. }
  15488. }
  15489. }
  15490. return controller.desiredSize > 0
  15491. },
  15492. async cancel (reason) {
  15493. await iterator.return()
  15494. },
  15495. type: 'bytes'
  15496. })
  15497. }
  15498. // 13. Let body be a body whose stream is stream, source is source,
  15499. // and length is length.
  15500. const body = { stream, source, length }
  15501. // 14. Return (body, type).
  15502. return [body, type]
  15503. }
  15504. // https://fetch.spec.whatwg.org/#bodyinit-safely-extract
  15505. function safelyExtractBody (object, keepalive = false) {
  15506. // To safely extract a body and a `Content-Type` value from
  15507. // a byte sequence or BodyInit object object, run these steps:
  15508. // 1. If object is a ReadableStream object, then:
  15509. if (object instanceof ReadableStream) {
  15510. // Assert: object is neither disturbed nor locked.
  15511. // istanbul ignore next
  15512. assert(!util.isDisturbed(object), 'The body has already been consumed.')
  15513. // istanbul ignore next
  15514. assert(!object.locked, 'The stream is locked.')
  15515. }
  15516. // 2. Return the results of extracting object.
  15517. return extractBody(object, keepalive)
  15518. }
  15519. function cloneBody (instance, body) {
  15520. // To clone a body body, run these steps:
  15521. // https://fetch.spec.whatwg.org/#concept-body-clone
  15522. // 1. Let « out1, out2 » be the result of teeing body’s stream.
  15523. const [out1, out2] = body.stream.tee()
  15524. // 2. Set body’s stream to out1.
  15525. body.stream = out1
  15526. // 3. Return a body whose stream is out2 and other members are copied from body.
  15527. return {
  15528. stream: out2,
  15529. length: body.length,
  15530. source: body.source
  15531. }
  15532. }
  15533. function throwIfAborted (state) {
  15534. if (state.aborted) {
  15535. throw new DOMException('The operation was aborted.', 'AbortError')
  15536. }
  15537. }
  15538. function bodyMixinMethods (instance) {
  15539. const methods = {
  15540. blob () {
  15541. // The blob() method steps are to return the result of
  15542. // running consume body with this and the following step
  15543. // given a byte sequence bytes: return a Blob whose
  15544. // contents are bytes and whose type attribute is this’s
  15545. // MIME type.
  15546. return consumeBody(this, (bytes) => {
  15547. let mimeType = bodyMimeType(this)
  15548. if (mimeType === null) {
  15549. mimeType = ''
  15550. } else if (mimeType) {
  15551. mimeType = serializeAMimeType(mimeType)
  15552. }
  15553. // Return a Blob whose contents are bytes and type attribute
  15554. // is mimeType.
  15555. return new Blob([bytes], { type: mimeType })
  15556. }, instance)
  15557. },
  15558. arrayBuffer () {
  15559. // The arrayBuffer() method steps are to return the result
  15560. // of running consume body with this and the following step
  15561. // given a byte sequence bytes: return a new ArrayBuffer
  15562. // whose contents are bytes.
  15563. return consumeBody(this, (bytes) => {
  15564. return new Uint8Array(bytes).buffer
  15565. }, instance)
  15566. },
  15567. text () {
  15568. // The text() method steps are to return the result of running
  15569. // consume body with this and UTF-8 decode.
  15570. return consumeBody(this, utf8DecodeBytes, instance)
  15571. },
  15572. json () {
  15573. // The json() method steps are to return the result of running
  15574. // consume body with this and parse JSON from bytes.
  15575. return consumeBody(this, parseJSONFromBytes, instance)
  15576. },
  15577. formData () {
  15578. // The formData() method steps are to return the result of running
  15579. // consume body with this and the following step given a byte sequence bytes:
  15580. return consumeBody(this, (value) => {
  15581. // 1. Let mimeType be the result of get the MIME type with this.
  15582. const mimeType = bodyMimeType(this)
  15583. // 2. If mimeType is non-null, then switch on mimeType’s essence and run
  15584. // the corresponding steps:
  15585. if (mimeType !== null) {
  15586. switch (mimeType.essence) {
  15587. case 'multipart/form-data': {
  15588. // 1. ... [long step]
  15589. const parsed = multipartFormDataParser(value, mimeType)
  15590. // 2. If that fails for some reason, then throw a TypeError.
  15591. if (parsed === 'failure') {
  15592. throw new TypeError('Failed to parse body as FormData.')
  15593. }
  15594. // 3. Return a new FormData object, appending each entry,
  15595. // resulting from the parsing operation, to its entry list.
  15596. const fd = new FormData()
  15597. fd[kState] = parsed
  15598. return fd
  15599. }
  15600. case 'application/x-www-form-urlencoded': {
  15601. // 1. Let entries be the result of parsing bytes.
  15602. const entries = new URLSearchParams(value.toString())
  15603. // 2. If entries is failure, then throw a TypeError.
  15604. // 3. Return a new FormData object whose entry list is entries.
  15605. const fd = new FormData()
  15606. for (const [name, value] of entries) {
  15607. fd.append(name, value)
  15608. }
  15609. return fd
  15610. }
  15611. }
  15612. }
  15613. // 3. Throw a TypeError.
  15614. throw new TypeError(
  15615. 'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
  15616. )
  15617. }, instance)
  15618. },
  15619. bytes () {
  15620. // The bytes() method steps are to return the result of running consume body
  15621. // with this and the following step given a byte sequence bytes: return the
  15622. // result of creating a Uint8Array from bytes in this’s relevant realm.
  15623. return consumeBody(this, (bytes) => {
  15624. return new Uint8Array(bytes)
  15625. }, instance)
  15626. }
  15627. }
  15628. return methods
  15629. }
  15630. function mixinBody (prototype) {
  15631. Object.assign(prototype.prototype, bodyMixinMethods(prototype))
  15632. }
  15633. /**
  15634. * @see https://fetch.spec.whatwg.org/#concept-body-consume-body
  15635. * @param {Response|Request} object
  15636. * @param {(value: unknown) => unknown} convertBytesToJSValue
  15637. * @param {Response|Request} instance
  15638. */
  15639. async function consumeBody (object, convertBytesToJSValue, instance) {
  15640. webidl.brandCheck(object, instance)
  15641. // 1. If object is unusable, then return a promise rejected
  15642. // with a TypeError.
  15643. if (bodyUnusable(object)) {
  15644. throw new TypeError('Body is unusable: Body has already been read')
  15645. }
  15646. throwIfAborted(object[kState])
  15647. // 2. Let promise be a new promise.
  15648. const promise = createDeferredPromise()
  15649. // 3. Let errorSteps given error be to reject promise with error.
  15650. const errorSteps = (error) => promise.reject(error)
  15651. // 4. Let successSteps given a byte sequence data be to resolve
  15652. // promise with the result of running convertBytesToJSValue
  15653. // with data. If that threw an exception, then run errorSteps
  15654. // with that exception.
  15655. const successSteps = (data) => {
  15656. try {
  15657. promise.resolve(convertBytesToJSValue(data))
  15658. } catch (e) {
  15659. errorSteps(e)
  15660. }
  15661. }
  15662. // 5. If object’s body is null, then run successSteps with an
  15663. // empty byte sequence.
  15664. if (object[kState].body == null) {
  15665. successSteps(Buffer.allocUnsafe(0))
  15666. return promise.promise
  15667. }
  15668. // 6. Otherwise, fully read object’s body given successSteps,
  15669. // errorSteps, and object’s relevant global object.
  15670. await fullyReadBody(object[kState].body, successSteps, errorSteps)
  15671. // 7. Return promise.
  15672. return promise.promise
  15673. }
  15674. // https://fetch.spec.whatwg.org/#body-unusable
  15675. function bodyUnusable (object) {
  15676. const body = object[kState].body
  15677. // An object including the Body interface mixin is
  15678. // said to be unusable if its body is non-null and
  15679. // its body’s stream is disturbed or locked.
  15680. return body != null && (body.stream.locked || util.isDisturbed(body.stream))
  15681. }
  15682. /**
  15683. * @see https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value
  15684. * @param {Uint8Array} bytes
  15685. */
  15686. function parseJSONFromBytes (bytes) {
  15687. return JSON.parse(utf8DecodeBytes(bytes))
  15688. }
  15689. /**
  15690. * @see https://fetch.spec.whatwg.org/#concept-body-mime-type
  15691. * @param {import('./response').Response|import('./request').Request} requestOrResponse
  15692. */
  15693. function bodyMimeType (requestOrResponse) {
  15694. // 1. Let headers be null.
  15695. // 2. If requestOrResponse is a Request object, then set headers to requestOrResponse’s request’s header list.
  15696. // 3. Otherwise, set headers to requestOrResponse’s response’s header list.
  15697. /** @type {import('./headers').HeadersList} */
  15698. const headers = requestOrResponse[kState].headersList
  15699. // 4. Let mimeType be the result of extracting a MIME type from headers.
  15700. const mimeType = extractMimeType(headers)
  15701. // 5. If mimeType is failure, then return null.
  15702. if (mimeType === 'failure') {
  15703. return null
  15704. }
  15705. // 6. Return mimeType.
  15706. return mimeType
  15707. }
  15708. module.exports = {
  15709. extractBody,
  15710. safelyExtractBody,
  15711. cloneBody,
  15712. mixinBody,
  15713. streamRegistry,
  15714. hasFinalizationRegistry,
  15715. bodyUnusable
  15716. }
  15717. /***/ }),
  15718. /***/ 4495:
  15719. /***/ ((module) => {
  15720. const corsSafeListedMethods = /** @type {const} */ (['GET', 'HEAD', 'POST'])
  15721. const corsSafeListedMethodsSet = new Set(corsSafeListedMethods)
  15722. const nullBodyStatus = /** @type {const} */ ([101, 204, 205, 304])
  15723. const redirectStatus = /** @type {const} */ ([301, 302, 303, 307, 308])
  15724. const redirectStatusSet = new Set(redirectStatus)
  15725. /**
  15726. * @see https://fetch.spec.whatwg.org/#block-bad-port
  15727. */
  15728. const badPorts = /** @type {const} */ ([
  15729. '1', '7', '9', '11', '13', '15', '17', '19', '20', '21', '22', '23', '25', '37', '42', '43', '53', '69', '77', '79',
  15730. '87', '95', '101', '102', '103', '104', '109', '110', '111', '113', '115', '117', '119', '123', '135', '137',
  15731. '139', '143', '161', '179', '389', '427', '465', '512', '513', '514', '515', '526', '530', '531', '532',
  15732. '540', '548', '554', '556', '563', '587', '601', '636', '989', '990', '993', '995', '1719', '1720', '1723',
  15733. '2049', '3659', '4045', '4190', '5060', '5061', '6000', '6566', '6665', '6666', '6667', '6668', '6669', '6679',
  15734. '6697', '10080'
  15735. ])
  15736. const badPortsSet = new Set(badPorts)
  15737. /**
  15738. * @see https://w3c.github.io/webappsec-referrer-policy/#referrer-policies
  15739. */
  15740. const referrerPolicy = /** @type {const} */ ([
  15741. '',
  15742. 'no-referrer',
  15743. 'no-referrer-when-downgrade',
  15744. 'same-origin',
  15745. 'origin',
  15746. 'strict-origin',
  15747. 'origin-when-cross-origin',
  15748. 'strict-origin-when-cross-origin',
  15749. 'unsafe-url'
  15750. ])
  15751. const referrerPolicySet = new Set(referrerPolicy)
  15752. const requestRedirect = /** @type {const} */ (['follow', 'manual', 'error'])
  15753. const safeMethods = /** @type {const} */ (['GET', 'HEAD', 'OPTIONS', 'TRACE'])
  15754. const safeMethodsSet = new Set(safeMethods)
  15755. const requestMode = /** @type {const} */ (['navigate', 'same-origin', 'no-cors', 'cors'])
  15756. const requestCredentials = /** @type {const} */ (['omit', 'same-origin', 'include'])
  15757. const requestCache = /** @type {const} */ ([
  15758. 'default',
  15759. 'no-store',
  15760. 'reload',
  15761. 'no-cache',
  15762. 'force-cache',
  15763. 'only-if-cached'
  15764. ])
  15765. /**
  15766. * @see https://fetch.spec.whatwg.org/#request-body-header-name
  15767. */
  15768. const requestBodyHeader = /** @type {const} */ ([
  15769. 'content-encoding',
  15770. 'content-language',
  15771. 'content-location',
  15772. 'content-type',
  15773. // See https://github.com/nodejs/undici/issues/2021
  15774. // 'Content-Length' is a forbidden header name, which is typically
  15775. // removed in the Headers implementation. However, undici doesn't
  15776. // filter out headers, so we add it here.
  15777. 'content-length'
  15778. ])
  15779. /**
  15780. * @see https://fetch.spec.whatwg.org/#enumdef-requestduplex
  15781. */
  15782. const requestDuplex = /** @type {const} */ ([
  15783. 'half'
  15784. ])
  15785. /**
  15786. * @see http://fetch.spec.whatwg.org/#forbidden-method
  15787. */
  15788. const forbiddenMethods = /** @type {const} */ (['CONNECT', 'TRACE', 'TRACK'])
  15789. const forbiddenMethodsSet = new Set(forbiddenMethods)
  15790. const subresource = /** @type {const} */ ([
  15791. 'audio',
  15792. 'audioworklet',
  15793. 'font',
  15794. 'image',
  15795. 'manifest',
  15796. 'paintworklet',
  15797. 'script',
  15798. 'style',
  15799. 'track',
  15800. 'video',
  15801. 'xslt',
  15802. ''
  15803. ])
  15804. const subresourceSet = new Set(subresource)
  15805. module.exports = {
  15806. subresource,
  15807. forbiddenMethods,
  15808. requestBodyHeader,
  15809. referrerPolicy,
  15810. requestRedirect,
  15811. requestMode,
  15812. requestCredentials,
  15813. requestCache,
  15814. redirectStatus,
  15815. corsSafeListedMethods,
  15816. nullBodyStatus,
  15817. safeMethods,
  15818. badPorts,
  15819. requestDuplex,
  15820. subresourceSet,
  15821. badPortsSet,
  15822. redirectStatusSet,
  15823. corsSafeListedMethodsSet,
  15824. safeMethodsSet,
  15825. forbiddenMethodsSet,
  15826. referrerPolicySet
  15827. }
  15828. /***/ }),
  15829. /***/ 1900:
  15830. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  15831. const assert = __nccwpck_require__(4589)
  15832. const encoder = new TextEncoder()
  15833. /**
  15834. * @see https://mimesniff.spec.whatwg.org/#http-token-code-point
  15835. */
  15836. const HTTP_TOKEN_CODEPOINTS = /^[!#$%&'*+\-.^_|~A-Za-z0-9]+$/
  15837. const HTTP_WHITESPACE_REGEX = /[\u000A\u000D\u0009\u0020]/ // eslint-disable-line
  15838. const ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g // eslint-disable-line
  15839. /**
  15840. * @see https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point
  15841. */
  15842. const HTTP_QUOTED_STRING_TOKENS = /^[\u0009\u0020-\u007E\u0080-\u00FF]+$/ // eslint-disable-line
  15843. // https://fetch.spec.whatwg.org/#data-url-processor
  15844. /** @param {URL} dataURL */
  15845. function dataURLProcessor (dataURL) {
  15846. // 1. Assert: dataURL’s scheme is "data".
  15847. assert(dataURL.protocol === 'data:')
  15848. // 2. Let input be the result of running the URL
  15849. // serializer on dataURL with exclude fragment
  15850. // set to true.
  15851. let input = URLSerializer(dataURL, true)
  15852. // 3. Remove the leading "data:" string from input.
  15853. input = input.slice(5)
  15854. // 4. Let position point at the start of input.
  15855. const position = { position: 0 }
  15856. // 5. Let mimeType be the result of collecting a
  15857. // sequence of code points that are not equal
  15858. // to U+002C (,), given position.
  15859. let mimeType = collectASequenceOfCodePointsFast(
  15860. ',',
  15861. input,
  15862. position
  15863. )
  15864. // 6. Strip leading and trailing ASCII whitespace
  15865. // from mimeType.
  15866. // Undici implementation note: we need to store the
  15867. // length because if the mimetype has spaces removed,
  15868. // the wrong amount will be sliced from the input in
  15869. // step #9
  15870. const mimeTypeLength = mimeType.length
  15871. mimeType = removeASCIIWhitespace(mimeType, true, true)
  15872. // 7. If position is past the end of input, then
  15873. // return failure
  15874. if (position.position >= input.length) {
  15875. return 'failure'
  15876. }
  15877. // 8. Advance position by 1.
  15878. position.position++
  15879. // 9. Let encodedBody be the remainder of input.
  15880. const encodedBody = input.slice(mimeTypeLength + 1)
  15881. // 10. Let body be the percent-decoding of encodedBody.
  15882. let body = stringPercentDecode(encodedBody)
  15883. // 11. If mimeType ends with U+003B (;), followed by
  15884. // zero or more U+0020 SPACE, followed by an ASCII
  15885. // case-insensitive match for "base64", then:
  15886. if (/;(\u0020){0,}base64$/i.test(mimeType)) {
  15887. // 1. Let stringBody be the isomorphic decode of body.
  15888. const stringBody = isomorphicDecode(body)
  15889. // 2. Set body to the forgiving-base64 decode of
  15890. // stringBody.
  15891. body = forgivingBase64(stringBody)
  15892. // 3. If body is failure, then return failure.
  15893. if (body === 'failure') {
  15894. return 'failure'
  15895. }
  15896. // 4. Remove the last 6 code points from mimeType.
  15897. mimeType = mimeType.slice(0, -6)
  15898. // 5. Remove trailing U+0020 SPACE code points from mimeType,
  15899. // if any.
  15900. mimeType = mimeType.replace(/(\u0020)+$/, '')
  15901. // 6. Remove the last U+003B (;) code point from mimeType.
  15902. mimeType = mimeType.slice(0, -1)
  15903. }
  15904. // 12. If mimeType starts with U+003B (;), then prepend
  15905. // "text/plain" to mimeType.
  15906. if (mimeType.startsWith(';')) {
  15907. mimeType = 'text/plain' + mimeType
  15908. }
  15909. // 13. Let mimeTypeRecord be the result of parsing
  15910. // mimeType.
  15911. let mimeTypeRecord = parseMIMEType(mimeType)
  15912. // 14. If mimeTypeRecord is failure, then set
  15913. // mimeTypeRecord to text/plain;charset=US-ASCII.
  15914. if (mimeTypeRecord === 'failure') {
  15915. mimeTypeRecord = parseMIMEType('text/plain;charset=US-ASCII')
  15916. }
  15917. // 15. Return a new data: URL struct whose MIME
  15918. // type is mimeTypeRecord and body is body.
  15919. // https://fetch.spec.whatwg.org/#data-url-struct
  15920. return { mimeType: mimeTypeRecord, body }
  15921. }
  15922. // https://url.spec.whatwg.org/#concept-url-serializer
  15923. /**
  15924. * @param {URL} url
  15925. * @param {boolean} excludeFragment
  15926. */
  15927. function URLSerializer (url, excludeFragment = false) {
  15928. if (!excludeFragment) {
  15929. return url.href
  15930. }
  15931. const href = url.href
  15932. const hashLength = url.hash.length
  15933. const serialized = hashLength === 0 ? href : href.substring(0, href.length - hashLength)
  15934. if (!hashLength && href.endsWith('#')) {
  15935. return serialized.slice(0, -1)
  15936. }
  15937. return serialized
  15938. }
  15939. // https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points
  15940. /**
  15941. * @param {(char: string) => boolean} condition
  15942. * @param {string} input
  15943. * @param {{ position: number }} position
  15944. */
  15945. function collectASequenceOfCodePoints (condition, input, position) {
  15946. // 1. Let result be the empty string.
  15947. let result = ''
  15948. // 2. While position doesn’t point past the end of input and the
  15949. // code point at position within input meets the condition condition:
  15950. while (position.position < input.length && condition(input[position.position])) {
  15951. // 1. Append that code point to the end of result.
  15952. result += input[position.position]
  15953. // 2. Advance position by 1.
  15954. position.position++
  15955. }
  15956. // 3. Return result.
  15957. return result
  15958. }
  15959. /**
  15960. * A faster collectASequenceOfCodePoints that only works when comparing a single character.
  15961. * @param {string} char
  15962. * @param {string} input
  15963. * @param {{ position: number }} position
  15964. */
  15965. function collectASequenceOfCodePointsFast (char, input, position) {
  15966. const idx = input.indexOf(char, position.position)
  15967. const start = position.position
  15968. if (idx === -1) {
  15969. position.position = input.length
  15970. return input.slice(start)
  15971. }
  15972. position.position = idx
  15973. return input.slice(start, position.position)
  15974. }
  15975. // https://url.spec.whatwg.org/#string-percent-decode
  15976. /** @param {string} input */
  15977. function stringPercentDecode (input) {
  15978. // 1. Let bytes be the UTF-8 encoding of input.
  15979. const bytes = encoder.encode(input)
  15980. // 2. Return the percent-decoding of bytes.
  15981. return percentDecode(bytes)
  15982. }
  15983. /**
  15984. * @param {number} byte
  15985. */
  15986. function isHexCharByte (byte) {
  15987. // 0-9 A-F a-f
  15988. return (byte >= 0x30 && byte <= 0x39) || (byte >= 0x41 && byte <= 0x46) || (byte >= 0x61 && byte <= 0x66)
  15989. }
  15990. /**
  15991. * @param {number} byte
  15992. */
  15993. function hexByteToNumber (byte) {
  15994. return (
  15995. // 0-9
  15996. byte >= 0x30 && byte <= 0x39
  15997. ? (byte - 48)
  15998. // Convert to uppercase
  15999. // ((byte & 0xDF) - 65) + 10
  16000. : ((byte & 0xDF) - 55)
  16001. )
  16002. }
  16003. // https://url.spec.whatwg.org/#percent-decode
  16004. /** @param {Uint8Array} input */
  16005. function percentDecode (input) {
  16006. const length = input.length
  16007. // 1. Let output be an empty byte sequence.
  16008. /** @type {Uint8Array} */
  16009. const output = new Uint8Array(length)
  16010. let j = 0
  16011. // 2. For each byte byte in input:
  16012. for (let i = 0; i < length; ++i) {
  16013. const byte = input[i]
  16014. // 1. If byte is not 0x25 (%), then append byte to output.
  16015. if (byte !== 0x25) {
  16016. output[j++] = byte
  16017. // 2. Otherwise, if byte is 0x25 (%) and the next two bytes
  16018. // after byte in input are not in the ranges
  16019. // 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F),
  16020. // and 0x61 (a) to 0x66 (f), all inclusive, append byte
  16021. // to output.
  16022. } else if (
  16023. byte === 0x25 &&
  16024. !(isHexCharByte(input[i + 1]) && isHexCharByte(input[i + 2]))
  16025. ) {
  16026. output[j++] = 0x25
  16027. // 3. Otherwise:
  16028. } else {
  16029. // 1. Let bytePoint be the two bytes after byte in input,
  16030. // decoded, and then interpreted as hexadecimal number.
  16031. // 2. Append a byte whose value is bytePoint to output.
  16032. output[j++] = (hexByteToNumber(input[i + 1]) << 4) | hexByteToNumber(input[i + 2])
  16033. // 3. Skip the next two bytes in input.
  16034. i += 2
  16035. }
  16036. }
  16037. // 3. Return output.
  16038. return length === j ? output : output.subarray(0, j)
  16039. }
  16040. // https://mimesniff.spec.whatwg.org/#parse-a-mime-type
  16041. /** @param {string} input */
  16042. function parseMIMEType (input) {
  16043. // 1. Remove any leading and trailing HTTP whitespace
  16044. // from input.
  16045. input = removeHTTPWhitespace(input, true, true)
  16046. // 2. Let position be a position variable for input,
  16047. // initially pointing at the start of input.
  16048. const position = { position: 0 }
  16049. // 3. Let type be the result of collecting a sequence
  16050. // of code points that are not U+002F (/) from
  16051. // input, given position.
  16052. const type = collectASequenceOfCodePointsFast(
  16053. '/',
  16054. input,
  16055. position
  16056. )
  16057. // 4. If type is the empty string or does not solely
  16058. // contain HTTP token code points, then return failure.
  16059. // https://mimesniff.spec.whatwg.org/#http-token-code-point
  16060. if (type.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type)) {
  16061. return 'failure'
  16062. }
  16063. // 5. If position is past the end of input, then return
  16064. // failure
  16065. if (position.position > input.length) {
  16066. return 'failure'
  16067. }
  16068. // 6. Advance position by 1. (This skips past U+002F (/).)
  16069. position.position++
  16070. // 7. Let subtype be the result of collecting a sequence of
  16071. // code points that are not U+003B (;) from input, given
  16072. // position.
  16073. let subtype = collectASequenceOfCodePointsFast(
  16074. ';',
  16075. input,
  16076. position
  16077. )
  16078. // 8. Remove any trailing HTTP whitespace from subtype.
  16079. subtype = removeHTTPWhitespace(subtype, false, true)
  16080. // 9. If subtype is the empty string or does not solely
  16081. // contain HTTP token code points, then return failure.
  16082. if (subtype.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(subtype)) {
  16083. return 'failure'
  16084. }
  16085. const typeLowercase = type.toLowerCase()
  16086. const subtypeLowercase = subtype.toLowerCase()
  16087. // 10. Let mimeType be a new MIME type record whose type
  16088. // is type, in ASCII lowercase, and subtype is subtype,
  16089. // in ASCII lowercase.
  16090. // https://mimesniff.spec.whatwg.org/#mime-type
  16091. const mimeType = {
  16092. type: typeLowercase,
  16093. subtype: subtypeLowercase,
  16094. /** @type {Map<string, string>} */
  16095. parameters: new Map(),
  16096. // https://mimesniff.spec.whatwg.org/#mime-type-essence
  16097. essence: `${typeLowercase}/${subtypeLowercase}`
  16098. }
  16099. // 11. While position is not past the end of input:
  16100. while (position.position < input.length) {
  16101. // 1. Advance position by 1. (This skips past U+003B (;).)
  16102. position.position++
  16103. // 2. Collect a sequence of code points that are HTTP
  16104. // whitespace from input given position.
  16105. collectASequenceOfCodePoints(
  16106. // https://fetch.spec.whatwg.org/#http-whitespace
  16107. char => HTTP_WHITESPACE_REGEX.test(char),
  16108. input,
  16109. position
  16110. )
  16111. // 3. Let parameterName be the result of collecting a
  16112. // sequence of code points that are not U+003B (;)
  16113. // or U+003D (=) from input, given position.
  16114. let parameterName = collectASequenceOfCodePoints(
  16115. (char) => char !== ';' && char !== '=',
  16116. input,
  16117. position
  16118. )
  16119. // 4. Set parameterName to parameterName, in ASCII
  16120. // lowercase.
  16121. parameterName = parameterName.toLowerCase()
  16122. // 5. If position is not past the end of input, then:
  16123. if (position.position < input.length) {
  16124. // 1. If the code point at position within input is
  16125. // U+003B (;), then continue.
  16126. if (input[position.position] === ';') {
  16127. continue
  16128. }
  16129. // 2. Advance position by 1. (This skips past U+003D (=).)
  16130. position.position++
  16131. }
  16132. // 6. If position is past the end of input, then break.
  16133. if (position.position > input.length) {
  16134. break
  16135. }
  16136. // 7. Let parameterValue be null.
  16137. let parameterValue = null
  16138. // 8. If the code point at position within input is
  16139. // U+0022 ("), then:
  16140. if (input[position.position] === '"') {
  16141. // 1. Set parameterValue to the result of collecting
  16142. // an HTTP quoted string from input, given position
  16143. // and the extract-value flag.
  16144. parameterValue = collectAnHTTPQuotedString(input, position, true)
  16145. // 2. Collect a sequence of code points that are not
  16146. // U+003B (;) from input, given position.
  16147. collectASequenceOfCodePointsFast(
  16148. ';',
  16149. input,
  16150. position
  16151. )
  16152. // 9. Otherwise:
  16153. } else {
  16154. // 1. Set parameterValue to the result of collecting
  16155. // a sequence of code points that are not U+003B (;)
  16156. // from input, given position.
  16157. parameterValue = collectASequenceOfCodePointsFast(
  16158. ';',
  16159. input,
  16160. position
  16161. )
  16162. // 2. Remove any trailing HTTP whitespace from parameterValue.
  16163. parameterValue = removeHTTPWhitespace(parameterValue, false, true)
  16164. // 3. If parameterValue is the empty string, then continue.
  16165. if (parameterValue.length === 0) {
  16166. continue
  16167. }
  16168. }
  16169. // 10. If all of the following are true
  16170. // - parameterName is not the empty string
  16171. // - parameterName solely contains HTTP token code points
  16172. // - parameterValue solely contains HTTP quoted-string token code points
  16173. // - mimeType’s parameters[parameterName] does not exist
  16174. // then set mimeType’s parameters[parameterName] to parameterValue.
  16175. if (
  16176. parameterName.length !== 0 &&
  16177. HTTP_TOKEN_CODEPOINTS.test(parameterName) &&
  16178. (parameterValue.length === 0 || HTTP_QUOTED_STRING_TOKENS.test(parameterValue)) &&
  16179. !mimeType.parameters.has(parameterName)
  16180. ) {
  16181. mimeType.parameters.set(parameterName, parameterValue)
  16182. }
  16183. }
  16184. // 12. Return mimeType.
  16185. return mimeType
  16186. }
  16187. // https://infra.spec.whatwg.org/#forgiving-base64-decode
  16188. /** @param {string} data */
  16189. function forgivingBase64 (data) {
  16190. // 1. Remove all ASCII whitespace from data.
  16191. data = data.replace(ASCII_WHITESPACE_REPLACE_REGEX, '') // eslint-disable-line
  16192. let dataLength = data.length
  16193. // 2. If data’s code point length divides by 4 leaving
  16194. // no remainder, then:
  16195. if (dataLength % 4 === 0) {
  16196. // 1. If data ends with one or two U+003D (=) code points,
  16197. // then remove them from data.
  16198. if (data.charCodeAt(dataLength - 1) === 0x003D) {
  16199. --dataLength
  16200. if (data.charCodeAt(dataLength - 1) === 0x003D) {
  16201. --dataLength
  16202. }
  16203. }
  16204. }
  16205. // 3. If data’s code point length divides by 4 leaving
  16206. // a remainder of 1, then return failure.
  16207. if (dataLength % 4 === 1) {
  16208. return 'failure'
  16209. }
  16210. // 4. If data contains a code point that is not one of
  16211. // U+002B (+)
  16212. // U+002F (/)
  16213. // ASCII alphanumeric
  16214. // then return failure.
  16215. if (/[^+/0-9A-Za-z]/.test(data.length === dataLength ? data : data.substring(0, dataLength))) {
  16216. return 'failure'
  16217. }
  16218. const buffer = Buffer.from(data, 'base64')
  16219. return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength)
  16220. }
  16221. // https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
  16222. // tests: https://fetch.spec.whatwg.org/#example-http-quoted-string
  16223. /**
  16224. * @param {string} input
  16225. * @param {{ position: number }} position
  16226. * @param {boolean?} extractValue
  16227. */
  16228. function collectAnHTTPQuotedString (input, position, extractValue) {
  16229. // 1. Let positionStart be position.
  16230. const positionStart = position.position
  16231. // 2. Let value be the empty string.
  16232. let value = ''
  16233. // 3. Assert: the code point at position within input
  16234. // is U+0022 (").
  16235. assert(input[position.position] === '"')
  16236. // 4. Advance position by 1.
  16237. position.position++
  16238. // 5. While true:
  16239. while (true) {
  16240. // 1. Append the result of collecting a sequence of code points
  16241. // that are not U+0022 (") or U+005C (\) from input, given
  16242. // position, to value.
  16243. value += collectASequenceOfCodePoints(
  16244. (char) => char !== '"' && char !== '\\',
  16245. input,
  16246. position
  16247. )
  16248. // 2. If position is past the end of input, then break.
  16249. if (position.position >= input.length) {
  16250. break
  16251. }
  16252. // 3. Let quoteOrBackslash be the code point at position within
  16253. // input.
  16254. const quoteOrBackslash = input[position.position]
  16255. // 4. Advance position by 1.
  16256. position.position++
  16257. // 5. If quoteOrBackslash is U+005C (\), then:
  16258. if (quoteOrBackslash === '\\') {
  16259. // 1. If position is past the end of input, then append
  16260. // U+005C (\) to value and break.
  16261. if (position.position >= input.length) {
  16262. value += '\\'
  16263. break
  16264. }
  16265. // 2. Append the code point at position within input to value.
  16266. value += input[position.position]
  16267. // 3. Advance position by 1.
  16268. position.position++
  16269. // 6. Otherwise:
  16270. } else {
  16271. // 1. Assert: quoteOrBackslash is U+0022 (").
  16272. assert(quoteOrBackslash === '"')
  16273. // 2. Break.
  16274. break
  16275. }
  16276. }
  16277. // 6. If the extract-value flag is set, then return value.
  16278. if (extractValue) {
  16279. return value
  16280. }
  16281. // 7. Return the code points from positionStart to position,
  16282. // inclusive, within input.
  16283. return input.slice(positionStart, position.position)
  16284. }
  16285. /**
  16286. * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type
  16287. */
  16288. function serializeAMimeType (mimeType) {
  16289. assert(mimeType !== 'failure')
  16290. const { parameters, essence } = mimeType
  16291. // 1. Let serialization be the concatenation of mimeType’s
  16292. // type, U+002F (/), and mimeType’s subtype.
  16293. let serialization = essence
  16294. // 2. For each name → value of mimeType’s parameters:
  16295. for (let [name, value] of parameters.entries()) {
  16296. // 1. Append U+003B (;) to serialization.
  16297. serialization += ';'
  16298. // 2. Append name to serialization.
  16299. serialization += name
  16300. // 3. Append U+003D (=) to serialization.
  16301. serialization += '='
  16302. // 4. If value does not solely contain HTTP token code
  16303. // points or value is the empty string, then:
  16304. if (!HTTP_TOKEN_CODEPOINTS.test(value)) {
  16305. // 1. Precede each occurrence of U+0022 (") or
  16306. // U+005C (\) in value with U+005C (\).
  16307. value = value.replace(/(\\|")/g, '\\$1')
  16308. // 2. Prepend U+0022 (") to value.
  16309. value = '"' + value
  16310. // 3. Append U+0022 (") to value.
  16311. value += '"'
  16312. }
  16313. // 5. Append value to serialization.
  16314. serialization += value
  16315. }
  16316. // 3. Return serialization.
  16317. return serialization
  16318. }
  16319. /**
  16320. * @see https://fetch.spec.whatwg.org/#http-whitespace
  16321. * @param {number} char
  16322. */
  16323. function isHTTPWhiteSpace (char) {
  16324. // "\r\n\t "
  16325. return char === 0x00d || char === 0x00a || char === 0x009 || char === 0x020
  16326. }
  16327. /**
  16328. * @see https://fetch.spec.whatwg.org/#http-whitespace
  16329. * @param {string} str
  16330. * @param {boolean} [leading=true]
  16331. * @param {boolean} [trailing=true]
  16332. */
  16333. function removeHTTPWhitespace (str, leading = true, trailing = true) {
  16334. return removeChars(str, leading, trailing, isHTTPWhiteSpace)
  16335. }
  16336. /**
  16337. * @see https://infra.spec.whatwg.org/#ascii-whitespace
  16338. * @param {number} char
  16339. */
  16340. function isASCIIWhitespace (char) {
  16341. // "\r\n\t\f "
  16342. return char === 0x00d || char === 0x00a || char === 0x009 || char === 0x00c || char === 0x020
  16343. }
  16344. /**
  16345. * @see https://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace
  16346. * @param {string} str
  16347. * @param {boolean} [leading=true]
  16348. * @param {boolean} [trailing=true]
  16349. */
  16350. function removeASCIIWhitespace (str, leading = true, trailing = true) {
  16351. return removeChars(str, leading, trailing, isASCIIWhitespace)
  16352. }
  16353. /**
  16354. * @param {string} str
  16355. * @param {boolean} leading
  16356. * @param {boolean} trailing
  16357. * @param {(charCode: number) => boolean} predicate
  16358. * @returns
  16359. */
  16360. function removeChars (str, leading, trailing, predicate) {
  16361. let lead = 0
  16362. let trail = str.length - 1
  16363. if (leading) {
  16364. while (lead < str.length && predicate(str.charCodeAt(lead))) lead++
  16365. }
  16366. if (trailing) {
  16367. while (trail > 0 && predicate(str.charCodeAt(trail))) trail--
  16368. }
  16369. return lead === 0 && trail === str.length - 1 ? str : str.slice(lead, trail + 1)
  16370. }
  16371. /**
  16372. * @see https://infra.spec.whatwg.org/#isomorphic-decode
  16373. * @param {Uint8Array} input
  16374. * @returns {string}
  16375. */
  16376. function isomorphicDecode (input) {
  16377. // 1. To isomorphic decode a byte sequence input, return a string whose code point
  16378. // length is equal to input’s length and whose code points have the same values
  16379. // as the values of input’s bytes, in the same order.
  16380. const length = input.length
  16381. if ((2 << 15) - 1 > length) {
  16382. return String.fromCharCode.apply(null, input)
  16383. }
  16384. let result = ''; let i = 0
  16385. let addition = (2 << 15) - 1
  16386. while (i < length) {
  16387. if (i + addition > length) {
  16388. addition = length - i
  16389. }
  16390. result += String.fromCharCode.apply(null, input.subarray(i, i += addition))
  16391. }
  16392. return result
  16393. }
  16394. /**
  16395. * @see https://mimesniff.spec.whatwg.org/#minimize-a-supported-mime-type
  16396. * @param {Exclude<ReturnType<typeof parseMIMEType>, 'failure'>} mimeType
  16397. */
  16398. function minimizeSupportedMimeType (mimeType) {
  16399. switch (mimeType.essence) {
  16400. case 'application/ecmascript':
  16401. case 'application/javascript':
  16402. case 'application/x-ecmascript':
  16403. case 'application/x-javascript':
  16404. case 'text/ecmascript':
  16405. case 'text/javascript':
  16406. case 'text/javascript1.0':
  16407. case 'text/javascript1.1':
  16408. case 'text/javascript1.2':
  16409. case 'text/javascript1.3':
  16410. case 'text/javascript1.4':
  16411. case 'text/javascript1.5':
  16412. case 'text/jscript':
  16413. case 'text/livescript':
  16414. case 'text/x-ecmascript':
  16415. case 'text/x-javascript':
  16416. // 1. If mimeType is a JavaScript MIME type, then return "text/javascript".
  16417. return 'text/javascript'
  16418. case 'application/json':
  16419. case 'text/json':
  16420. // 2. If mimeType is a JSON MIME type, then return "application/json".
  16421. return 'application/json'
  16422. case 'image/svg+xml':
  16423. // 3. If mimeType’s essence is "image/svg+xml", then return "image/svg+xml".
  16424. return 'image/svg+xml'
  16425. case 'text/xml':
  16426. case 'application/xml':
  16427. // 4. If mimeType is an XML MIME type, then return "application/xml".
  16428. return 'application/xml'
  16429. }
  16430. // 2. If mimeType is a JSON MIME type, then return "application/json".
  16431. if (mimeType.subtype.endsWith('+json')) {
  16432. return 'application/json'
  16433. }
  16434. // 4. If mimeType is an XML MIME type, then return "application/xml".
  16435. if (mimeType.subtype.endsWith('+xml')) {
  16436. return 'application/xml'
  16437. }
  16438. // 5. If mimeType is supported by the user agent, then return mimeType’s essence.
  16439. // Technically, node doesn't support any mimetypes.
  16440. // 6. Return the empty string.
  16441. return ''
  16442. }
  16443. module.exports = {
  16444. dataURLProcessor,
  16445. URLSerializer,
  16446. collectASequenceOfCodePoints,
  16447. collectASequenceOfCodePointsFast,
  16448. stringPercentDecode,
  16449. parseMIMEType,
  16450. collectAnHTTPQuotedString,
  16451. serializeAMimeType,
  16452. removeChars,
  16453. removeHTTPWhitespace,
  16454. minimizeSupportedMimeType,
  16455. HTTP_TOKEN_CODEPOINTS,
  16456. isomorphicDecode
  16457. }
  16458. /***/ }),
  16459. /***/ 6653:
  16460. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16461. const { kConnected, kSize } = __nccwpck_require__(6443)
  16462. class CompatWeakRef {
  16463. constructor (value) {
  16464. this.value = value
  16465. }
  16466. deref () {
  16467. return this.value[kConnected] === 0 && this.value[kSize] === 0
  16468. ? undefined
  16469. : this.value
  16470. }
  16471. }
  16472. class CompatFinalizer {
  16473. constructor (finalizer) {
  16474. this.finalizer = finalizer
  16475. }
  16476. register (dispatcher, key) {
  16477. if (dispatcher.on) {
  16478. dispatcher.on('disconnect', () => {
  16479. if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) {
  16480. this.finalizer(key)
  16481. }
  16482. })
  16483. }
  16484. }
  16485. unregister (key) {}
  16486. }
  16487. module.exports = function () {
  16488. // FIXME: remove workaround when the Node bug is backported to v18
  16489. // https://github.com/nodejs/node/issues/49344#issuecomment-1741776308
  16490. if (process.env.NODE_V8_COVERAGE && process.version.startsWith('v18')) {
  16491. process._rawDebug('Using compatibility WeakRef and FinalizationRegistry')
  16492. return {
  16493. WeakRef: CompatWeakRef,
  16494. FinalizationRegistry: CompatFinalizer
  16495. }
  16496. }
  16497. return { WeakRef, FinalizationRegistry }
  16498. }
  16499. /***/ }),
  16500. /***/ 7114:
  16501. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16502. const { Blob, File } = __nccwpck_require__(4573)
  16503. const { kState } = __nccwpck_require__(3627)
  16504. const { webidl } = __nccwpck_require__(5893)
  16505. // TODO(@KhafraDev): remove
  16506. class FileLike {
  16507. constructor (blobLike, fileName, options = {}) {
  16508. // TODO: argument idl type check
  16509. // The File constructor is invoked with two or three parameters, depending
  16510. // on whether the optional dictionary parameter is used. When the File()
  16511. // constructor is invoked, user agents must run the following steps:
  16512. // 1. Let bytes be the result of processing blob parts given fileBits and
  16513. // options.
  16514. // 2. Let n be the fileName argument to the constructor.
  16515. const n = fileName
  16516. // 3. Process FilePropertyBag dictionary argument by running the following
  16517. // substeps:
  16518. // 1. If the type member is provided and is not the empty string, let t
  16519. // be set to the type dictionary member. If t contains any characters
  16520. // outside the range U+0020 to U+007E, then set t to the empty string
  16521. // and return from these substeps.
  16522. // TODO
  16523. const t = options.type
  16524. // 2. Convert every character in t to ASCII lowercase.
  16525. // TODO
  16526. // 3. If the lastModified member is provided, let d be set to the
  16527. // lastModified dictionary member. If it is not provided, set d to the
  16528. // current date and time represented as the number of milliseconds since
  16529. // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]).
  16530. const d = options.lastModified ?? Date.now()
  16531. // 4. Return a new File object F such that:
  16532. // F refers to the bytes byte sequence.
  16533. // F.size is set to the number of total bytes in bytes.
  16534. // F.name is set to n.
  16535. // F.type is set to t.
  16536. // F.lastModified is set to d.
  16537. this[kState] = {
  16538. blobLike,
  16539. name: n,
  16540. type: t,
  16541. lastModified: d
  16542. }
  16543. }
  16544. stream (...args) {
  16545. webidl.brandCheck(this, FileLike)
  16546. return this[kState].blobLike.stream(...args)
  16547. }
  16548. arrayBuffer (...args) {
  16549. webidl.brandCheck(this, FileLike)
  16550. return this[kState].blobLike.arrayBuffer(...args)
  16551. }
  16552. slice (...args) {
  16553. webidl.brandCheck(this, FileLike)
  16554. return this[kState].blobLike.slice(...args)
  16555. }
  16556. text (...args) {
  16557. webidl.brandCheck(this, FileLike)
  16558. return this[kState].blobLike.text(...args)
  16559. }
  16560. get size () {
  16561. webidl.brandCheck(this, FileLike)
  16562. return this[kState].blobLike.size
  16563. }
  16564. get type () {
  16565. webidl.brandCheck(this, FileLike)
  16566. return this[kState].blobLike.type
  16567. }
  16568. get name () {
  16569. webidl.brandCheck(this, FileLike)
  16570. return this[kState].name
  16571. }
  16572. get lastModified () {
  16573. webidl.brandCheck(this, FileLike)
  16574. return this[kState].lastModified
  16575. }
  16576. get [Symbol.toStringTag] () {
  16577. return 'File'
  16578. }
  16579. }
  16580. webidl.converters.Blob = webidl.interfaceConverter(Blob)
  16581. // If this function is moved to ./util.js, some tools (such as
  16582. // rollup) will warn about circular dependencies. See:
  16583. // https://github.com/nodejs/undici/issues/1629
  16584. function isFileLike (object) {
  16585. return (
  16586. (object instanceof File) ||
  16587. (
  16588. object &&
  16589. (typeof object.stream === 'function' ||
  16590. typeof object.arrayBuffer === 'function') &&
  16591. object[Symbol.toStringTag] === 'File'
  16592. )
  16593. )
  16594. }
  16595. module.exports = { FileLike, isFileLike }
  16596. /***/ }),
  16597. /***/ 116:
  16598. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16599. const { isUSVString, bufferToLowerCasedHeaderName } = __nccwpck_require__(3440)
  16600. const { utf8DecodeBytes } = __nccwpck_require__(3168)
  16601. const { HTTP_TOKEN_CODEPOINTS, isomorphicDecode } = __nccwpck_require__(1900)
  16602. const { isFileLike } = __nccwpck_require__(7114)
  16603. const { makeEntry } = __nccwpck_require__(5910)
  16604. const assert = __nccwpck_require__(4589)
  16605. const { File: NodeFile } = __nccwpck_require__(4573)
  16606. const File = globalThis.File ?? NodeFile
  16607. const formDataNameBuffer = Buffer.from('form-data; name="')
  16608. const filenameBuffer = Buffer.from('; filename')
  16609. const dd = Buffer.from('--')
  16610. const ddcrlf = Buffer.from('--\r\n')
  16611. /**
  16612. * @param {string} chars
  16613. */
  16614. function isAsciiString (chars) {
  16615. for (let i = 0; i < chars.length; ++i) {
  16616. if ((chars.charCodeAt(i) & ~0x7F) !== 0) {
  16617. return false
  16618. }
  16619. }
  16620. return true
  16621. }
  16622. /**
  16623. * @see https://andreubotella.github.io/multipart-form-data/#multipart-form-data-boundary
  16624. * @param {string} boundary
  16625. */
  16626. function validateBoundary (boundary) {
  16627. const length = boundary.length
  16628. // - its length is greater or equal to 27 and lesser or equal to 70, and
  16629. if (length < 27 || length > 70) {
  16630. return false
  16631. }
  16632. // - it is composed by bytes in the ranges 0x30 to 0x39, 0x41 to 0x5A, or
  16633. // 0x61 to 0x7A, inclusive (ASCII alphanumeric), or which are 0x27 ('),
  16634. // 0x2D (-) or 0x5F (_).
  16635. for (let i = 0; i < length; ++i) {
  16636. const cp = boundary.charCodeAt(i)
  16637. if (!(
  16638. (cp >= 0x30 && cp <= 0x39) ||
  16639. (cp >= 0x41 && cp <= 0x5a) ||
  16640. (cp >= 0x61 && cp <= 0x7a) ||
  16641. cp === 0x27 ||
  16642. cp === 0x2d ||
  16643. cp === 0x5f
  16644. )) {
  16645. return false
  16646. }
  16647. }
  16648. return true
  16649. }
  16650. /**
  16651. * @see https://andreubotella.github.io/multipart-form-data/#multipart-form-data-parser
  16652. * @param {Buffer} input
  16653. * @param {ReturnType<import('./data-url')['parseMIMEType']>} mimeType
  16654. */
  16655. function multipartFormDataParser (input, mimeType) {
  16656. // 1. Assert: mimeType’s essence is "multipart/form-data".
  16657. assert(mimeType !== 'failure' && mimeType.essence === 'multipart/form-data')
  16658. const boundaryString = mimeType.parameters.get('boundary')
  16659. // 2. If mimeType’s parameters["boundary"] does not exist, return failure.
  16660. // Otherwise, let boundary be the result of UTF-8 decoding mimeType’s
  16661. // parameters["boundary"].
  16662. if (boundaryString === undefined) {
  16663. return 'failure'
  16664. }
  16665. const boundary = Buffer.from(`--${boundaryString}`, 'utf8')
  16666. // 3. Let entry list be an empty entry list.
  16667. const entryList = []
  16668. // 4. Let position be a pointer to a byte in input, initially pointing at
  16669. // the first byte.
  16670. const position = { position: 0 }
  16671. // Note: undici addition, allows leading and trailing CRLFs.
  16672. while (input[position.position] === 0x0d && input[position.position + 1] === 0x0a) {
  16673. position.position += 2
  16674. }
  16675. let trailing = input.length
  16676. while (input[trailing - 1] === 0x0a && input[trailing - 2] === 0x0d) {
  16677. trailing -= 2
  16678. }
  16679. if (trailing !== input.length) {
  16680. input = input.subarray(0, trailing)
  16681. }
  16682. // 5. While true:
  16683. while (true) {
  16684. // 5.1. If position points to a sequence of bytes starting with 0x2D 0x2D
  16685. // (`--`) followed by boundary, advance position by 2 + the length of
  16686. // boundary. Otherwise, return failure.
  16687. // Note: boundary is padded with 2 dashes already, no need to add 2.
  16688. if (input.subarray(position.position, position.position + boundary.length).equals(boundary)) {
  16689. position.position += boundary.length
  16690. } else {
  16691. return 'failure'
  16692. }
  16693. // 5.2. If position points to the sequence of bytes 0x2D 0x2D 0x0D 0x0A
  16694. // (`--` followed by CR LF) followed by the end of input, return entry list.
  16695. // Note: a body does NOT need to end with CRLF. It can end with --.
  16696. if (
  16697. (position.position === input.length - 2 && bufferStartsWith(input, dd, position)) ||
  16698. (position.position === input.length - 4 && bufferStartsWith(input, ddcrlf, position))
  16699. ) {
  16700. return entryList
  16701. }
  16702. // 5.3. If position does not point to a sequence of bytes starting with 0x0D
  16703. // 0x0A (CR LF), return failure.
  16704. if (input[position.position] !== 0x0d || input[position.position + 1] !== 0x0a) {
  16705. return 'failure'
  16706. }
  16707. // 5.4. Advance position by 2. (This skips past the newline.)
  16708. position.position += 2
  16709. // 5.5. Let name, filename and contentType be the result of parsing
  16710. // multipart/form-data headers on input and position, if the result
  16711. // is not failure. Otherwise, return failure.
  16712. const result = parseMultipartFormDataHeaders(input, position)
  16713. if (result === 'failure') {
  16714. return 'failure'
  16715. }
  16716. let { name, filename, contentType, encoding } = result
  16717. // 5.6. Advance position by 2. (This skips past the empty line that marks
  16718. // the end of the headers.)
  16719. position.position += 2
  16720. // 5.7. Let body be the empty byte sequence.
  16721. let body
  16722. // 5.8. Body loop: While position is not past the end of input:
  16723. // TODO: the steps here are completely wrong
  16724. {
  16725. const boundaryIndex = input.indexOf(boundary.subarray(2), position.position)
  16726. if (boundaryIndex === -1) {
  16727. return 'failure'
  16728. }
  16729. body = input.subarray(position.position, boundaryIndex - 4)
  16730. position.position += body.length
  16731. // Note: position must be advanced by the body's length before being
  16732. // decoded, otherwise the parsing will fail.
  16733. if (encoding === 'base64') {
  16734. body = Buffer.from(body.toString(), 'base64')
  16735. }
  16736. }
  16737. // 5.9. If position does not point to a sequence of bytes starting with
  16738. // 0x0D 0x0A (CR LF), return failure. Otherwise, advance position by 2.
  16739. if (input[position.position] !== 0x0d || input[position.position + 1] !== 0x0a) {
  16740. return 'failure'
  16741. } else {
  16742. position.position += 2
  16743. }
  16744. // 5.10. If filename is not null:
  16745. let value
  16746. if (filename !== null) {
  16747. // 5.10.1. If contentType is null, set contentType to "text/plain".
  16748. contentType ??= 'text/plain'
  16749. // 5.10.2. If contentType is not an ASCII string, set contentType to the empty string.
  16750. // Note: `buffer.isAscii` can be used at zero-cost, but converting a string to a buffer is a high overhead.
  16751. // Content-Type is a relatively small string, so it is faster to use `String#charCodeAt`.
  16752. if (!isAsciiString(contentType)) {
  16753. contentType = ''
  16754. }
  16755. // 5.10.3. Let value be a new File object with name filename, type contentType, and body body.
  16756. value = new File([body], filename, { type: contentType })
  16757. } else {
  16758. // 5.11. Otherwise:
  16759. // 5.11.1. Let value be the UTF-8 decoding without BOM of body.
  16760. value = utf8DecodeBytes(Buffer.from(body))
  16761. }
  16762. // 5.12. Assert: name is a scalar value string and value is either a scalar value string or a File object.
  16763. assert(isUSVString(name))
  16764. assert((typeof value === 'string' && isUSVString(value)) || isFileLike(value))
  16765. // 5.13. Create an entry with name and value, and append it to entry list.
  16766. entryList.push(makeEntry(name, value, filename))
  16767. }
  16768. }
  16769. /**
  16770. * @see https://andreubotella.github.io/multipart-form-data/#parse-multipart-form-data-headers
  16771. * @param {Buffer} input
  16772. * @param {{ position: number }} position
  16773. */
  16774. function parseMultipartFormDataHeaders (input, position) {
  16775. // 1. Let name, filename and contentType be null.
  16776. let name = null
  16777. let filename = null
  16778. let contentType = null
  16779. let encoding = null
  16780. // 2. While true:
  16781. while (true) {
  16782. // 2.1. If position points to a sequence of bytes starting with 0x0D 0x0A (CR LF):
  16783. if (input[position.position] === 0x0d && input[position.position + 1] === 0x0a) {
  16784. // 2.1.1. If name is null, return failure.
  16785. if (name === null) {
  16786. return 'failure'
  16787. }
  16788. // 2.1.2. Return name, filename and contentType.
  16789. return { name, filename, contentType, encoding }
  16790. }
  16791. // 2.2. Let header name be the result of collecting a sequence of bytes that are
  16792. // not 0x0A (LF), 0x0D (CR) or 0x3A (:), given position.
  16793. let headerName = collectASequenceOfBytes(
  16794. (char) => char !== 0x0a && char !== 0x0d && char !== 0x3a,
  16795. input,
  16796. position
  16797. )
  16798. // 2.3. Remove any HTTP tab or space bytes from the start or end of header name.
  16799. headerName = removeChars(headerName, true, true, (char) => char === 0x9 || char === 0x20)
  16800. // 2.4. If header name does not match the field-name token production, return failure.
  16801. if (!HTTP_TOKEN_CODEPOINTS.test(headerName.toString())) {
  16802. return 'failure'
  16803. }
  16804. // 2.5. If the byte at position is not 0x3A (:), return failure.
  16805. if (input[position.position] !== 0x3a) {
  16806. return 'failure'
  16807. }
  16808. // 2.6. Advance position by 1.
  16809. position.position++
  16810. // 2.7. Collect a sequence of bytes that are HTTP tab or space bytes given position.
  16811. // (Do nothing with those bytes.)
  16812. collectASequenceOfBytes(
  16813. (char) => char === 0x20 || char === 0x09,
  16814. input,
  16815. position
  16816. )
  16817. // 2.8. Byte-lowercase header name and switch on the result:
  16818. switch (bufferToLowerCasedHeaderName(headerName)) {
  16819. case 'content-disposition': {
  16820. // 1. Set name and filename to null.
  16821. name = filename = null
  16822. // 2. If position does not point to a sequence of bytes starting with
  16823. // `form-data; name="`, return failure.
  16824. if (!bufferStartsWith(input, formDataNameBuffer, position)) {
  16825. return 'failure'
  16826. }
  16827. // 3. Advance position so it points at the byte after the next 0x22 (")
  16828. // byte (the one in the sequence of bytes matched above).
  16829. position.position += 17
  16830. // 4. Set name to the result of parsing a multipart/form-data name given
  16831. // input and position, if the result is not failure. Otherwise, return
  16832. // failure.
  16833. name = parseMultipartFormDataName(input, position)
  16834. if (name === null) {
  16835. return 'failure'
  16836. }
  16837. // 5. If position points to a sequence of bytes starting with `; filename="`:
  16838. if (bufferStartsWith(input, filenameBuffer, position)) {
  16839. // Note: undici also handles filename*
  16840. let check = position.position + filenameBuffer.length
  16841. if (input[check] === 0x2a) {
  16842. position.position += 1
  16843. check += 1
  16844. }
  16845. if (input[check] !== 0x3d || input[check + 1] !== 0x22) { // ="
  16846. return 'failure'
  16847. }
  16848. // 1. Advance position so it points at the byte after the next 0x22 (") byte
  16849. // (the one in the sequence of bytes matched above).
  16850. position.position += 12
  16851. // 2. Set filename to the result of parsing a multipart/form-data name given
  16852. // input and position, if the result is not failure. Otherwise, return failure.
  16853. filename = parseMultipartFormDataName(input, position)
  16854. if (filename === null) {
  16855. return 'failure'
  16856. }
  16857. }
  16858. break
  16859. }
  16860. case 'content-type': {
  16861. // 1. Let header value be the result of collecting a sequence of bytes that are
  16862. // not 0x0A (LF) or 0x0D (CR), given position.
  16863. let headerValue = collectASequenceOfBytes(
  16864. (char) => char !== 0x0a && char !== 0x0d,
  16865. input,
  16866. position
  16867. )
  16868. // 2. Remove any HTTP tab or space bytes from the end of header value.
  16869. headerValue = removeChars(headerValue, false, true, (char) => char === 0x9 || char === 0x20)
  16870. // 3. Set contentType to the isomorphic decoding of header value.
  16871. contentType = isomorphicDecode(headerValue)
  16872. break
  16873. }
  16874. case 'content-transfer-encoding': {
  16875. let headerValue = collectASequenceOfBytes(
  16876. (char) => char !== 0x0a && char !== 0x0d,
  16877. input,
  16878. position
  16879. )
  16880. headerValue = removeChars(headerValue, false, true, (char) => char === 0x9 || char === 0x20)
  16881. encoding = isomorphicDecode(headerValue)
  16882. break
  16883. }
  16884. default: {
  16885. // Collect a sequence of bytes that are not 0x0A (LF) or 0x0D (CR), given position.
  16886. // (Do nothing with those bytes.)
  16887. collectASequenceOfBytes(
  16888. (char) => char !== 0x0a && char !== 0x0d,
  16889. input,
  16890. position
  16891. )
  16892. }
  16893. }
  16894. // 2.9. If position does not point to a sequence of bytes starting with 0x0D 0x0A
  16895. // (CR LF), return failure. Otherwise, advance position by 2 (past the newline).
  16896. if (input[position.position] !== 0x0d && input[position.position + 1] !== 0x0a) {
  16897. return 'failure'
  16898. } else {
  16899. position.position += 2
  16900. }
  16901. }
  16902. }
  16903. /**
  16904. * @see https://andreubotella.github.io/multipart-form-data/#parse-a-multipart-form-data-name
  16905. * @param {Buffer} input
  16906. * @param {{ position: number }} position
  16907. */
  16908. function parseMultipartFormDataName (input, position) {
  16909. // 1. Assert: The byte at (position - 1) is 0x22 (").
  16910. assert(input[position.position - 1] === 0x22)
  16911. // 2. Let name be the result of collecting a sequence of bytes that are not 0x0A (LF), 0x0D (CR) or 0x22 ("), given position.
  16912. /** @type {string | Buffer} */
  16913. let name = collectASequenceOfBytes(
  16914. (char) => char !== 0x0a && char !== 0x0d && char !== 0x22,
  16915. input,
  16916. position
  16917. )
  16918. // 3. If the byte at position is not 0x22 ("), return failure. Otherwise, advance position by 1.
  16919. if (input[position.position] !== 0x22) {
  16920. return null // name could be 'failure'
  16921. } else {
  16922. position.position++
  16923. }
  16924. // 4. Replace any occurrence of the following subsequences in name with the given byte:
  16925. // - `%0A`: 0x0A (LF)
  16926. // - `%0D`: 0x0D (CR)
  16927. // - `%22`: 0x22 (")
  16928. name = new TextDecoder().decode(name)
  16929. .replace(/%0A/ig, '\n')
  16930. .replace(/%0D/ig, '\r')
  16931. .replace(/%22/g, '"')
  16932. // 5. Return the UTF-8 decoding without BOM of name.
  16933. return name
  16934. }
  16935. /**
  16936. * @param {(char: number) => boolean} condition
  16937. * @param {Buffer} input
  16938. * @param {{ position: number }} position
  16939. */
  16940. function collectASequenceOfBytes (condition, input, position) {
  16941. let start = position.position
  16942. while (start < input.length && condition(input[start])) {
  16943. ++start
  16944. }
  16945. return input.subarray(position.position, (position.position = start))
  16946. }
  16947. /**
  16948. * @param {Buffer} buf
  16949. * @param {boolean} leading
  16950. * @param {boolean} trailing
  16951. * @param {(charCode: number) => boolean} predicate
  16952. * @returns {Buffer}
  16953. */
  16954. function removeChars (buf, leading, trailing, predicate) {
  16955. let lead = 0
  16956. let trail = buf.length - 1
  16957. if (leading) {
  16958. while (lead < buf.length && predicate(buf[lead])) lead++
  16959. }
  16960. if (trailing) {
  16961. while (trail > 0 && predicate(buf[trail])) trail--
  16962. }
  16963. return lead === 0 && trail === buf.length - 1 ? buf : buf.subarray(lead, trail + 1)
  16964. }
  16965. /**
  16966. * Checks if {@param buffer} starts with {@param start}
  16967. * @param {Buffer} buffer
  16968. * @param {Buffer} start
  16969. * @param {{ position: number }} position
  16970. */
  16971. function bufferStartsWith (buffer, start, position) {
  16972. if (buffer.length < start.length) {
  16973. return false
  16974. }
  16975. for (let i = 0; i < start.length; i++) {
  16976. if (start[i] !== buffer[position.position + i]) {
  16977. return false
  16978. }
  16979. }
  16980. return true
  16981. }
  16982. module.exports = {
  16983. multipartFormDataParser,
  16984. validateBoundary
  16985. }
  16986. /***/ }),
  16987. /***/ 5910:
  16988. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16989. const { isBlobLike, iteratorMixin } = __nccwpck_require__(3168)
  16990. const { kState } = __nccwpck_require__(3627)
  16991. const { kEnumerableProperty } = __nccwpck_require__(3440)
  16992. const { FileLike, isFileLike } = __nccwpck_require__(7114)
  16993. const { webidl } = __nccwpck_require__(5893)
  16994. const { File: NativeFile } = __nccwpck_require__(4573)
  16995. const nodeUtil = __nccwpck_require__(7975)
  16996. /** @type {globalThis['File']} */
  16997. const File = globalThis.File ?? NativeFile
  16998. // https://xhr.spec.whatwg.org/#formdata
  16999. class FormData {
  17000. constructor (form) {
  17001. webidl.util.markAsUncloneable(this)
  17002. if (form !== undefined) {
  17003. throw webidl.errors.conversionFailed({
  17004. prefix: 'FormData constructor',
  17005. argument: 'Argument 1',
  17006. types: ['undefined']
  17007. })
  17008. }
  17009. this[kState] = []
  17010. }
  17011. append (name, value, filename = undefined) {
  17012. webidl.brandCheck(this, FormData)
  17013. const prefix = 'FormData.append'
  17014. webidl.argumentLengthCheck(arguments, 2, prefix)
  17015. if (arguments.length === 3 && !isBlobLike(value)) {
  17016. throw new TypeError(
  17017. "Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'"
  17018. )
  17019. }
  17020. // 1. Let value be value if given; otherwise blobValue.
  17021. name = webidl.converters.USVString(name, prefix, 'name')
  17022. value = isBlobLike(value)
  17023. ? webidl.converters.Blob(value, prefix, 'value', { strict: false })
  17024. : webidl.converters.USVString(value, prefix, 'value')
  17025. filename = arguments.length === 3
  17026. ? webidl.converters.USVString(filename, prefix, 'filename')
  17027. : undefined
  17028. // 2. Let entry be the result of creating an entry with
  17029. // name, value, and filename if given.
  17030. const entry = makeEntry(name, value, filename)
  17031. // 3. Append entry to this’s entry list.
  17032. this[kState].push(entry)
  17033. }
  17034. delete (name) {
  17035. webidl.brandCheck(this, FormData)
  17036. const prefix = 'FormData.delete'
  17037. webidl.argumentLengthCheck(arguments, 1, prefix)
  17038. name = webidl.converters.USVString(name, prefix, 'name')
  17039. // The delete(name) method steps are to remove all entries whose name
  17040. // is name from this’s entry list.
  17041. this[kState] = this[kState].filter(entry => entry.name !== name)
  17042. }
  17043. get (name) {
  17044. webidl.brandCheck(this, FormData)
  17045. const prefix = 'FormData.get'
  17046. webidl.argumentLengthCheck(arguments, 1, prefix)
  17047. name = webidl.converters.USVString(name, prefix, 'name')
  17048. // 1. If there is no entry whose name is name in this’s entry list,
  17049. // then return null.
  17050. const idx = this[kState].findIndex((entry) => entry.name === name)
  17051. if (idx === -1) {
  17052. return null
  17053. }
  17054. // 2. Return the value of the first entry whose name is name from
  17055. // this’s entry list.
  17056. return this[kState][idx].value
  17057. }
  17058. getAll (name) {
  17059. webidl.brandCheck(this, FormData)
  17060. const prefix = 'FormData.getAll'
  17061. webidl.argumentLengthCheck(arguments, 1, prefix)
  17062. name = webidl.converters.USVString(name, prefix, 'name')
  17063. // 1. If there is no entry whose name is name in this’s entry list,
  17064. // then return the empty list.
  17065. // 2. Return the values of all entries whose name is name, in order,
  17066. // from this’s entry list.
  17067. return this[kState]
  17068. .filter((entry) => entry.name === name)
  17069. .map((entry) => entry.value)
  17070. }
  17071. has (name) {
  17072. webidl.brandCheck(this, FormData)
  17073. const prefix = 'FormData.has'
  17074. webidl.argumentLengthCheck(arguments, 1, prefix)
  17075. name = webidl.converters.USVString(name, prefix, 'name')
  17076. // The has(name) method steps are to return true if there is an entry
  17077. // whose name is name in this’s entry list; otherwise false.
  17078. return this[kState].findIndex((entry) => entry.name === name) !== -1
  17079. }
  17080. set (name, value, filename = undefined) {
  17081. webidl.brandCheck(this, FormData)
  17082. const prefix = 'FormData.set'
  17083. webidl.argumentLengthCheck(arguments, 2, prefix)
  17084. if (arguments.length === 3 && !isBlobLike(value)) {
  17085. throw new TypeError(
  17086. "Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'"
  17087. )
  17088. }
  17089. // The set(name, value) and set(name, blobValue, filename) method steps
  17090. // are:
  17091. // 1. Let value be value if given; otherwise blobValue.
  17092. name = webidl.converters.USVString(name, prefix, 'name')
  17093. value = isBlobLike(value)
  17094. ? webidl.converters.Blob(value, prefix, 'name', { strict: false })
  17095. : webidl.converters.USVString(value, prefix, 'name')
  17096. filename = arguments.length === 3
  17097. ? webidl.converters.USVString(filename, prefix, 'name')
  17098. : undefined
  17099. // 2. Let entry be the result of creating an entry with name, value, and
  17100. // filename if given.
  17101. const entry = makeEntry(name, value, filename)
  17102. // 3. If there are entries in this’s entry list whose name is name, then
  17103. // replace the first such entry with entry and remove the others.
  17104. const idx = this[kState].findIndex((entry) => entry.name === name)
  17105. if (idx !== -1) {
  17106. this[kState] = [
  17107. ...this[kState].slice(0, idx),
  17108. entry,
  17109. ...this[kState].slice(idx + 1).filter((entry) => entry.name !== name)
  17110. ]
  17111. } else {
  17112. // 4. Otherwise, append entry to this’s entry list.
  17113. this[kState].push(entry)
  17114. }
  17115. }
  17116. [nodeUtil.inspect.custom] (depth, options) {
  17117. const state = this[kState].reduce((a, b) => {
  17118. if (a[b.name]) {
  17119. if (Array.isArray(a[b.name])) {
  17120. a[b.name].push(b.value)
  17121. } else {
  17122. a[b.name] = [a[b.name], b.value]
  17123. }
  17124. } else {
  17125. a[b.name] = b.value
  17126. }
  17127. return a
  17128. }, { __proto__: null })
  17129. options.depth ??= depth
  17130. options.colors ??= true
  17131. const output = nodeUtil.formatWithOptions(options, state)
  17132. // remove [Object null prototype]
  17133. return `FormData ${output.slice(output.indexOf(']') + 2)}`
  17134. }
  17135. }
  17136. iteratorMixin('FormData', FormData, kState, 'name', 'value')
  17137. Object.defineProperties(FormData.prototype, {
  17138. append: kEnumerableProperty,
  17139. delete: kEnumerableProperty,
  17140. get: kEnumerableProperty,
  17141. getAll: kEnumerableProperty,
  17142. has: kEnumerableProperty,
  17143. set: kEnumerableProperty,
  17144. [Symbol.toStringTag]: {
  17145. value: 'FormData',
  17146. configurable: true
  17147. }
  17148. })
  17149. /**
  17150. * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#create-an-entry
  17151. * @param {string} name
  17152. * @param {string|Blob} value
  17153. * @param {?string} filename
  17154. * @returns
  17155. */
  17156. function makeEntry (name, value, filename) {
  17157. // 1. Set name to the result of converting name into a scalar value string.
  17158. // Note: This operation was done by the webidl converter USVString.
  17159. // 2. If value is a string, then set value to the result of converting
  17160. // value into a scalar value string.
  17161. if (typeof value === 'string') {
  17162. // Note: This operation was done by the webidl converter USVString.
  17163. } else {
  17164. // 3. Otherwise:
  17165. // 1. If value is not a File object, then set value to a new File object,
  17166. // representing the same bytes, whose name attribute value is "blob"
  17167. if (!isFileLike(value)) {
  17168. value = value instanceof Blob
  17169. ? new File([value], 'blob', { type: value.type })
  17170. : new FileLike(value, 'blob', { type: value.type })
  17171. }
  17172. // 2. If filename is given, then set value to a new File object,
  17173. // representing the same bytes, whose name attribute is filename.
  17174. if (filename !== undefined) {
  17175. /** @type {FilePropertyBag} */
  17176. const options = {
  17177. type: value.type,
  17178. lastModified: value.lastModified
  17179. }
  17180. value = value instanceof NativeFile
  17181. ? new File([value], filename, options)
  17182. : new FileLike(value, filename, options)
  17183. }
  17184. }
  17185. // 4. Return an entry whose name is name and whose value is value.
  17186. return { name, value }
  17187. }
  17188. module.exports = { FormData, makeEntry }
  17189. /***/ }),
  17190. /***/ 1059:
  17191. /***/ ((module) => {
  17192. // In case of breaking changes, increase the version
  17193. // number to avoid conflicts.
  17194. const globalOrigin = Symbol.for('undici.globalOrigin.1')
  17195. function getGlobalOrigin () {
  17196. return globalThis[globalOrigin]
  17197. }
  17198. function setGlobalOrigin (newOrigin) {
  17199. if (newOrigin === undefined) {
  17200. Object.defineProperty(globalThis, globalOrigin, {
  17201. value: undefined,
  17202. writable: true,
  17203. enumerable: false,
  17204. configurable: false
  17205. })
  17206. return
  17207. }
  17208. const parsedURL = new URL(newOrigin)
  17209. if (parsedURL.protocol !== 'http:' && parsedURL.protocol !== 'https:') {
  17210. throw new TypeError(`Only http & https urls are allowed, received ${parsedURL.protocol}`)
  17211. }
  17212. Object.defineProperty(globalThis, globalOrigin, {
  17213. value: parsedURL,
  17214. writable: true,
  17215. enumerable: false,
  17216. configurable: false
  17217. })
  17218. }
  17219. module.exports = {
  17220. getGlobalOrigin,
  17221. setGlobalOrigin
  17222. }
  17223. /***/ }),
  17224. /***/ 660:
  17225. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  17226. // https://github.com/Ethan-Arrowood/undici-fetch
  17227. const { kConstruct } = __nccwpck_require__(6443)
  17228. const { kEnumerableProperty } = __nccwpck_require__(3440)
  17229. const {
  17230. iteratorMixin,
  17231. isValidHeaderName,
  17232. isValidHeaderValue
  17233. } = __nccwpck_require__(3168)
  17234. const { webidl } = __nccwpck_require__(5893)
  17235. const assert = __nccwpck_require__(4589)
  17236. const util = __nccwpck_require__(7975)
  17237. const kHeadersMap = Symbol('headers map')
  17238. const kHeadersSortedMap = Symbol('headers map sorted')
  17239. /**
  17240. * @param {number} code
  17241. */
  17242. function isHTTPWhiteSpaceCharCode (code) {
  17243. return code === 0x00a || code === 0x00d || code === 0x009 || code === 0x020
  17244. }
  17245. /**
  17246. * @see https://fetch.spec.whatwg.org/#concept-header-value-normalize
  17247. * @param {string} potentialValue
  17248. */
  17249. function headerValueNormalize (potentialValue) {
  17250. // To normalize a byte sequence potentialValue, remove
  17251. // any leading and trailing HTTP whitespace bytes from
  17252. // potentialValue.
  17253. let i = 0; let j = potentialValue.length
  17254. while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(j - 1))) --j
  17255. while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(i))) ++i
  17256. return i === 0 && j === potentialValue.length ? potentialValue : potentialValue.substring(i, j)
  17257. }
  17258. function fill (headers, object) {
  17259. // To fill a Headers object headers with a given object object, run these steps:
  17260. // 1. If object is a sequence, then for each header in object:
  17261. // Note: webidl conversion to array has already been done.
  17262. if (Array.isArray(object)) {
  17263. for (let i = 0; i < object.length; ++i) {
  17264. const header = object[i]
  17265. // 1. If header does not contain exactly two items, then throw a TypeError.
  17266. if (header.length !== 2) {
  17267. throw webidl.errors.exception({
  17268. header: 'Headers constructor',
  17269. message: `expected name/value pair to be length 2, found ${header.length}.`
  17270. })
  17271. }
  17272. // 2. Append (header’s first item, header’s second item) to headers.
  17273. appendHeader(headers, header[0], header[1])
  17274. }
  17275. } else if (typeof object === 'object' && object !== null) {
  17276. // Note: null should throw
  17277. // 2. Otherwise, object is a record, then for each key → value in object,
  17278. // append (key, value) to headers
  17279. const keys = Object.keys(object)
  17280. for (let i = 0; i < keys.length; ++i) {
  17281. appendHeader(headers, keys[i], object[keys[i]])
  17282. }
  17283. } else {
  17284. throw webidl.errors.conversionFailed({
  17285. prefix: 'Headers constructor',
  17286. argument: 'Argument 1',
  17287. types: ['sequence<sequence<ByteString>>', 'record<ByteString, ByteString>']
  17288. })
  17289. }
  17290. }
  17291. /**
  17292. * @see https://fetch.spec.whatwg.org/#concept-headers-append
  17293. */
  17294. function appendHeader (headers, name, value) {
  17295. // 1. Normalize value.
  17296. value = headerValueNormalize(value)
  17297. // 2. If name is not a header name or value is not a
  17298. // header value, then throw a TypeError.
  17299. if (!isValidHeaderName(name)) {
  17300. throw webidl.errors.invalidArgument({
  17301. prefix: 'Headers.append',
  17302. value: name,
  17303. type: 'header name'
  17304. })
  17305. } else if (!isValidHeaderValue(value)) {
  17306. throw webidl.errors.invalidArgument({
  17307. prefix: 'Headers.append',
  17308. value,
  17309. type: 'header value'
  17310. })
  17311. }
  17312. // 3. If headers’s guard is "immutable", then throw a TypeError.
  17313. // 4. Otherwise, if headers’s guard is "request" and name is a
  17314. // forbidden header name, return.
  17315. // 5. Otherwise, if headers’s guard is "request-no-cors":
  17316. // TODO
  17317. // Note: undici does not implement forbidden header names
  17318. if (getHeadersGuard(headers) === 'immutable') {
  17319. throw new TypeError('immutable')
  17320. }
  17321. // 6. Otherwise, if headers’s guard is "response" and name is a
  17322. // forbidden response-header name, return.
  17323. // 7. Append (name, value) to headers’s header list.
  17324. return getHeadersList(headers).append(name, value, false)
  17325. // 8. If headers’s guard is "request-no-cors", then remove
  17326. // privileged no-CORS request headers from headers
  17327. }
  17328. function compareHeaderName (a, b) {
  17329. return a[0] < b[0] ? -1 : 1
  17330. }
  17331. class HeadersList {
  17332. /** @type {[string, string][]|null} */
  17333. cookies = null
  17334. constructor (init) {
  17335. if (init instanceof HeadersList) {
  17336. this[kHeadersMap] = new Map(init[kHeadersMap])
  17337. this[kHeadersSortedMap] = init[kHeadersSortedMap]
  17338. this.cookies = init.cookies === null ? null : [...init.cookies]
  17339. } else {
  17340. this[kHeadersMap] = new Map(init)
  17341. this[kHeadersSortedMap] = null
  17342. }
  17343. }
  17344. /**
  17345. * @see https://fetch.spec.whatwg.org/#header-list-contains
  17346. * @param {string} name
  17347. * @param {boolean} isLowerCase
  17348. */
  17349. contains (name, isLowerCase) {
  17350. // A header list list contains a header name name if list
  17351. // contains a header whose name is a byte-case-insensitive
  17352. // match for name.
  17353. return this[kHeadersMap].has(isLowerCase ? name : name.toLowerCase())
  17354. }
  17355. clear () {
  17356. this[kHeadersMap].clear()
  17357. this[kHeadersSortedMap] = null
  17358. this.cookies = null
  17359. }
  17360. /**
  17361. * @see https://fetch.spec.whatwg.org/#concept-header-list-append
  17362. * @param {string} name
  17363. * @param {string} value
  17364. * @param {boolean} isLowerCase
  17365. */
  17366. append (name, value, isLowerCase) {
  17367. this[kHeadersSortedMap] = null
  17368. // 1. If list contains name, then set name to the first such
  17369. // header’s name.
  17370. const lowercaseName = isLowerCase ? name : name.toLowerCase()
  17371. const exists = this[kHeadersMap].get(lowercaseName)
  17372. // 2. Append (name, value) to list.
  17373. if (exists) {
  17374. const delimiter = lowercaseName === 'cookie' ? '; ' : ', '
  17375. this[kHeadersMap].set(lowercaseName, {
  17376. name: exists.name,
  17377. value: `${exists.value}${delimiter}${value}`
  17378. })
  17379. } else {
  17380. this[kHeadersMap].set(lowercaseName, { name, value })
  17381. }
  17382. if (lowercaseName === 'set-cookie') {
  17383. (this.cookies ??= []).push(value)
  17384. }
  17385. }
  17386. /**
  17387. * @see https://fetch.spec.whatwg.org/#concept-header-list-set
  17388. * @param {string} name
  17389. * @param {string} value
  17390. * @param {boolean} isLowerCase
  17391. */
  17392. set (name, value, isLowerCase) {
  17393. this[kHeadersSortedMap] = null
  17394. const lowercaseName = isLowerCase ? name : name.toLowerCase()
  17395. if (lowercaseName === 'set-cookie') {
  17396. this.cookies = [value]
  17397. }
  17398. // 1. If list contains name, then set the value of
  17399. // the first such header to value and remove the
  17400. // others.
  17401. // 2. Otherwise, append header (name, value) to list.
  17402. this[kHeadersMap].set(lowercaseName, { name, value })
  17403. }
  17404. /**
  17405. * @see https://fetch.spec.whatwg.org/#concept-header-list-delete
  17406. * @param {string} name
  17407. * @param {boolean} isLowerCase
  17408. */
  17409. delete (name, isLowerCase) {
  17410. this[kHeadersSortedMap] = null
  17411. if (!isLowerCase) name = name.toLowerCase()
  17412. if (name === 'set-cookie') {
  17413. this.cookies = null
  17414. }
  17415. this[kHeadersMap].delete(name)
  17416. }
  17417. /**
  17418. * @see https://fetch.spec.whatwg.org/#concept-header-list-get
  17419. * @param {string} name
  17420. * @param {boolean} isLowerCase
  17421. * @returns {string | null}
  17422. */
  17423. get (name, isLowerCase) {
  17424. // 1. If list does not contain name, then return null.
  17425. // 2. Return the values of all headers in list whose name
  17426. // is a byte-case-insensitive match for name,
  17427. // separated from each other by 0x2C 0x20, in order.
  17428. return this[kHeadersMap].get(isLowerCase ? name : name.toLowerCase())?.value ?? null
  17429. }
  17430. * [Symbol.iterator] () {
  17431. // use the lowercased name
  17432. for (const { 0: name, 1: { value } } of this[kHeadersMap]) {
  17433. yield [name, value]
  17434. }
  17435. }
  17436. get entries () {
  17437. const headers = {}
  17438. if (this[kHeadersMap].size !== 0) {
  17439. for (const { name, value } of this[kHeadersMap].values()) {
  17440. headers[name] = value
  17441. }
  17442. }
  17443. return headers
  17444. }
  17445. rawValues () {
  17446. return this[kHeadersMap].values()
  17447. }
  17448. get entriesList () {
  17449. const headers = []
  17450. if (this[kHeadersMap].size !== 0) {
  17451. for (const { 0: lowerName, 1: { name, value } } of this[kHeadersMap]) {
  17452. if (lowerName === 'set-cookie') {
  17453. for (const cookie of this.cookies) {
  17454. headers.push([name, cookie])
  17455. }
  17456. } else {
  17457. headers.push([name, value])
  17458. }
  17459. }
  17460. }
  17461. return headers
  17462. }
  17463. // https://fetch.spec.whatwg.org/#convert-header-names-to-a-sorted-lowercase-set
  17464. toSortedArray () {
  17465. const size = this[kHeadersMap].size
  17466. const array = new Array(size)
  17467. // In most cases, you will use the fast-path.
  17468. // fast-path: Use binary insertion sort for small arrays.
  17469. if (size <= 32) {
  17470. if (size === 0) {
  17471. // If empty, it is an empty array. To avoid the first index assignment.
  17472. return array
  17473. }
  17474. // Improve performance by unrolling loop and avoiding double-loop.
  17475. // Double-loop-less version of the binary insertion sort.
  17476. const iterator = this[kHeadersMap][Symbol.iterator]()
  17477. const firstValue = iterator.next().value
  17478. // set [name, value] to first index.
  17479. array[0] = [firstValue[0], firstValue[1].value]
  17480. // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
  17481. // 3.2.2. Assert: value is non-null.
  17482. assert(firstValue[1].value !== null)
  17483. for (
  17484. let i = 1, j = 0, right = 0, left = 0, pivot = 0, x, value;
  17485. i < size;
  17486. ++i
  17487. ) {
  17488. // get next value
  17489. value = iterator.next().value
  17490. // set [name, value] to current index.
  17491. x = array[i] = [value[0], value[1].value]
  17492. // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
  17493. // 3.2.2. Assert: value is non-null.
  17494. assert(x[1] !== null)
  17495. left = 0
  17496. right = i
  17497. // binary search
  17498. while (left < right) {
  17499. // middle index
  17500. pivot = left + ((right - left) >> 1)
  17501. // compare header name
  17502. if (array[pivot][0] <= x[0]) {
  17503. left = pivot + 1
  17504. } else {
  17505. right = pivot
  17506. }
  17507. }
  17508. if (i !== pivot) {
  17509. j = i
  17510. while (j > left) {
  17511. array[j] = array[--j]
  17512. }
  17513. array[left] = x
  17514. }
  17515. }
  17516. /* c8 ignore next 4 */
  17517. if (!iterator.next().done) {
  17518. // This is for debugging and will never be called.
  17519. throw new TypeError('Unreachable')
  17520. }
  17521. return array
  17522. } else {
  17523. // This case would be a rare occurrence.
  17524. // slow-path: fallback
  17525. let i = 0
  17526. for (const { 0: name, 1: { value } } of this[kHeadersMap]) {
  17527. array[i++] = [name, value]
  17528. // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
  17529. // 3.2.2. Assert: value is non-null.
  17530. assert(value !== null)
  17531. }
  17532. return array.sort(compareHeaderName)
  17533. }
  17534. }
  17535. }
  17536. // https://fetch.spec.whatwg.org/#headers-class
  17537. class Headers {
  17538. #guard
  17539. #headersList
  17540. constructor (init = undefined) {
  17541. webidl.util.markAsUncloneable(this)
  17542. if (init === kConstruct) {
  17543. return
  17544. }
  17545. this.#headersList = new HeadersList()
  17546. // The new Headers(init) constructor steps are:
  17547. // 1. Set this’s guard to "none".
  17548. this.#guard = 'none'
  17549. // 2. If init is given, then fill this with init.
  17550. if (init !== undefined) {
  17551. init = webidl.converters.HeadersInit(init, 'Headers contructor', 'init')
  17552. fill(this, init)
  17553. }
  17554. }
  17555. // https://fetch.spec.whatwg.org/#dom-headers-append
  17556. append (name, value) {
  17557. webidl.brandCheck(this, Headers)
  17558. webidl.argumentLengthCheck(arguments, 2, 'Headers.append')
  17559. const prefix = 'Headers.append'
  17560. name = webidl.converters.ByteString(name, prefix, 'name')
  17561. value = webidl.converters.ByteString(value, prefix, 'value')
  17562. return appendHeader(this, name, value)
  17563. }
  17564. // https://fetch.spec.whatwg.org/#dom-headers-delete
  17565. delete (name) {
  17566. webidl.brandCheck(this, Headers)
  17567. webidl.argumentLengthCheck(arguments, 1, 'Headers.delete')
  17568. const prefix = 'Headers.delete'
  17569. name = webidl.converters.ByteString(name, prefix, 'name')
  17570. // 1. If name is not a header name, then throw a TypeError.
  17571. if (!isValidHeaderName(name)) {
  17572. throw webidl.errors.invalidArgument({
  17573. prefix: 'Headers.delete',
  17574. value: name,
  17575. type: 'header name'
  17576. })
  17577. }
  17578. // 2. If this’s guard is "immutable", then throw a TypeError.
  17579. // 3. Otherwise, if this’s guard is "request" and name is a
  17580. // forbidden header name, return.
  17581. // 4. Otherwise, if this’s guard is "request-no-cors", name
  17582. // is not a no-CORS-safelisted request-header name, and
  17583. // name is not a privileged no-CORS request-header name,
  17584. // return.
  17585. // 5. Otherwise, if this’s guard is "response" and name is
  17586. // a forbidden response-header name, return.
  17587. // Note: undici does not implement forbidden header names
  17588. if (this.#guard === 'immutable') {
  17589. throw new TypeError('immutable')
  17590. }
  17591. // 6. If this’s header list does not contain name, then
  17592. // return.
  17593. if (!this.#headersList.contains(name, false)) {
  17594. return
  17595. }
  17596. // 7. Delete name from this’s header list.
  17597. // 8. If this’s guard is "request-no-cors", then remove
  17598. // privileged no-CORS request headers from this.
  17599. this.#headersList.delete(name, false)
  17600. }
  17601. // https://fetch.spec.whatwg.org/#dom-headers-get
  17602. get (name) {
  17603. webidl.brandCheck(this, Headers)
  17604. webidl.argumentLengthCheck(arguments, 1, 'Headers.get')
  17605. const prefix = 'Headers.get'
  17606. name = webidl.converters.ByteString(name, prefix, 'name')
  17607. // 1. If name is not a header name, then throw a TypeError.
  17608. if (!isValidHeaderName(name)) {
  17609. throw webidl.errors.invalidArgument({
  17610. prefix,
  17611. value: name,
  17612. type: 'header name'
  17613. })
  17614. }
  17615. // 2. Return the result of getting name from this’s header
  17616. // list.
  17617. return this.#headersList.get(name, false)
  17618. }
  17619. // https://fetch.spec.whatwg.org/#dom-headers-has
  17620. has (name) {
  17621. webidl.brandCheck(this, Headers)
  17622. webidl.argumentLengthCheck(arguments, 1, 'Headers.has')
  17623. const prefix = 'Headers.has'
  17624. name = webidl.converters.ByteString(name, prefix, 'name')
  17625. // 1. If name is not a header name, then throw a TypeError.
  17626. if (!isValidHeaderName(name)) {
  17627. throw webidl.errors.invalidArgument({
  17628. prefix,
  17629. value: name,
  17630. type: 'header name'
  17631. })
  17632. }
  17633. // 2. Return true if this’s header list contains name;
  17634. // otherwise false.
  17635. return this.#headersList.contains(name, false)
  17636. }
  17637. // https://fetch.spec.whatwg.org/#dom-headers-set
  17638. set (name, value) {
  17639. webidl.brandCheck(this, Headers)
  17640. webidl.argumentLengthCheck(arguments, 2, 'Headers.set')
  17641. const prefix = 'Headers.set'
  17642. name = webidl.converters.ByteString(name, prefix, 'name')
  17643. value = webidl.converters.ByteString(value, prefix, 'value')
  17644. // 1. Normalize value.
  17645. value = headerValueNormalize(value)
  17646. // 2. If name is not a header name or value is not a
  17647. // header value, then throw a TypeError.
  17648. if (!isValidHeaderName(name)) {
  17649. throw webidl.errors.invalidArgument({
  17650. prefix,
  17651. value: name,
  17652. type: 'header name'
  17653. })
  17654. } else if (!isValidHeaderValue(value)) {
  17655. throw webidl.errors.invalidArgument({
  17656. prefix,
  17657. value,
  17658. type: 'header value'
  17659. })
  17660. }
  17661. // 3. If this’s guard is "immutable", then throw a TypeError.
  17662. // 4. Otherwise, if this’s guard is "request" and name is a
  17663. // forbidden header name, return.
  17664. // 5. Otherwise, if this’s guard is "request-no-cors" and
  17665. // name/value is not a no-CORS-safelisted request-header,
  17666. // return.
  17667. // 6. Otherwise, if this’s guard is "response" and name is a
  17668. // forbidden response-header name, return.
  17669. // Note: undici does not implement forbidden header names
  17670. if (this.#guard === 'immutable') {
  17671. throw new TypeError('immutable')
  17672. }
  17673. // 7. Set (name, value) in this’s header list.
  17674. // 8. If this’s guard is "request-no-cors", then remove
  17675. // privileged no-CORS request headers from this
  17676. this.#headersList.set(name, value, false)
  17677. }
  17678. // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie
  17679. getSetCookie () {
  17680. webidl.brandCheck(this, Headers)
  17681. // 1. If this’s header list does not contain `Set-Cookie`, then return « ».
  17682. // 2. Return the values of all headers in this’s header list whose name is
  17683. // a byte-case-insensitive match for `Set-Cookie`, in order.
  17684. const list = this.#headersList.cookies
  17685. if (list) {
  17686. return [...list]
  17687. }
  17688. return []
  17689. }
  17690. // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
  17691. get [kHeadersSortedMap] () {
  17692. if (this.#headersList[kHeadersSortedMap]) {
  17693. return this.#headersList[kHeadersSortedMap]
  17694. }
  17695. // 1. Let headers be an empty list of headers with the key being the name
  17696. // and value the value.
  17697. const headers = []
  17698. // 2. Let names be the result of convert header names to a sorted-lowercase
  17699. // set with all the names of the headers in list.
  17700. const names = this.#headersList.toSortedArray()
  17701. const cookies = this.#headersList.cookies
  17702. // fast-path
  17703. if (cookies === null || cookies.length === 1) {
  17704. // Note: The non-null assertion of value has already been done by `HeadersList#toSortedArray`
  17705. return (this.#headersList[kHeadersSortedMap] = names)
  17706. }
  17707. // 3. For each name of names:
  17708. for (let i = 0; i < names.length; ++i) {
  17709. const { 0: name, 1: value } = names[i]
  17710. // 1. If name is `set-cookie`, then:
  17711. if (name === 'set-cookie') {
  17712. // 1. Let values be a list of all values of headers in list whose name
  17713. // is a byte-case-insensitive match for name, in order.
  17714. // 2. For each value of values:
  17715. // 1. Append (name, value) to headers.
  17716. for (let j = 0; j < cookies.length; ++j) {
  17717. headers.push([name, cookies[j]])
  17718. }
  17719. } else {
  17720. // 2. Otherwise:
  17721. // 1. Let value be the result of getting name from list.
  17722. // 2. Assert: value is non-null.
  17723. // Note: This operation was done by `HeadersList#toSortedArray`.
  17724. // 3. Append (name, value) to headers.
  17725. headers.push([name, value])
  17726. }
  17727. }
  17728. // 4. Return headers.
  17729. return (this.#headersList[kHeadersSortedMap] = headers)
  17730. }
  17731. [util.inspect.custom] (depth, options) {
  17732. options.depth ??= depth
  17733. return `Headers ${util.formatWithOptions(options, this.#headersList.entries)}`
  17734. }
  17735. static getHeadersGuard (o) {
  17736. return o.#guard
  17737. }
  17738. static setHeadersGuard (o, guard) {
  17739. o.#guard = guard
  17740. }
  17741. static getHeadersList (o) {
  17742. return o.#headersList
  17743. }
  17744. static setHeadersList (o, list) {
  17745. o.#headersList = list
  17746. }
  17747. }
  17748. const { getHeadersGuard, setHeadersGuard, getHeadersList, setHeadersList } = Headers
  17749. Reflect.deleteProperty(Headers, 'getHeadersGuard')
  17750. Reflect.deleteProperty(Headers, 'setHeadersGuard')
  17751. Reflect.deleteProperty(Headers, 'getHeadersList')
  17752. Reflect.deleteProperty(Headers, 'setHeadersList')
  17753. iteratorMixin('Headers', Headers, kHeadersSortedMap, 0, 1)
  17754. Object.defineProperties(Headers.prototype, {
  17755. append: kEnumerableProperty,
  17756. delete: kEnumerableProperty,
  17757. get: kEnumerableProperty,
  17758. has: kEnumerableProperty,
  17759. set: kEnumerableProperty,
  17760. getSetCookie: kEnumerableProperty,
  17761. [Symbol.toStringTag]: {
  17762. value: 'Headers',
  17763. configurable: true
  17764. },
  17765. [util.inspect.custom]: {
  17766. enumerable: false
  17767. }
  17768. })
  17769. webidl.converters.HeadersInit = function (V, prefix, argument) {
  17770. if (webidl.util.Type(V) === 'Object') {
  17771. const iterator = Reflect.get(V, Symbol.iterator)
  17772. // A work-around to ensure we send the properly-cased Headers when V is a Headers object.
  17773. // Read https://github.com/nodejs/undici/pull/3159#issuecomment-2075537226 before touching, please.
  17774. if (!util.types.isProxy(V) && iterator === Headers.prototype.entries) { // Headers object
  17775. try {
  17776. return getHeadersList(V).entriesList
  17777. } catch {
  17778. // fall-through
  17779. }
  17780. }
  17781. if (typeof iterator === 'function') {
  17782. return webidl.converters['sequence<sequence<ByteString>>'](V, prefix, argument, iterator.bind(V))
  17783. }
  17784. return webidl.converters['record<ByteString, ByteString>'](V, prefix, argument)
  17785. }
  17786. throw webidl.errors.conversionFailed({
  17787. prefix: 'Headers constructor',
  17788. argument: 'Argument 1',
  17789. types: ['sequence<sequence<ByteString>>', 'record<ByteString, ByteString>']
  17790. })
  17791. }
  17792. module.exports = {
  17793. fill,
  17794. // for test.
  17795. compareHeaderName,
  17796. Headers,
  17797. HeadersList,
  17798. getHeadersGuard,
  17799. setHeadersGuard,
  17800. setHeadersList,
  17801. getHeadersList
  17802. }
  17803. /***/ }),
  17804. /***/ 4398:
  17805. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  17806. // https://github.com/Ethan-Arrowood/undici-fetch
  17807. const {
  17808. makeNetworkError,
  17809. makeAppropriateNetworkError,
  17810. filterResponse,
  17811. makeResponse,
  17812. fromInnerResponse
  17813. } = __nccwpck_require__(9051)
  17814. const { HeadersList } = __nccwpck_require__(660)
  17815. const { Request, cloneRequest } = __nccwpck_require__(9967)
  17816. const zlib = __nccwpck_require__(8522)
  17817. const {
  17818. bytesMatch,
  17819. makePolicyContainer,
  17820. clonePolicyContainer,
  17821. requestBadPort,
  17822. TAOCheck,
  17823. appendRequestOriginHeader,
  17824. responseLocationURL,
  17825. requestCurrentURL,
  17826. setRequestReferrerPolicyOnRedirect,
  17827. tryUpgradeRequestToAPotentiallyTrustworthyURL,
  17828. createOpaqueTimingInfo,
  17829. appendFetchMetadata,
  17830. corsCheck,
  17831. crossOriginResourcePolicyCheck,
  17832. determineRequestsReferrer,
  17833. coarsenedSharedCurrentTime,
  17834. createDeferredPromise,
  17835. isBlobLike,
  17836. sameOrigin,
  17837. isCancelled,
  17838. isAborted,
  17839. isErrorLike,
  17840. fullyReadBody,
  17841. readableStreamClose,
  17842. isomorphicEncode,
  17843. urlIsLocal,
  17844. urlIsHttpHttpsScheme,
  17845. urlHasHttpsScheme,
  17846. clampAndCoarsenConnectionTimingInfo,
  17847. simpleRangeHeaderValue,
  17848. buildContentRange,
  17849. createInflate,
  17850. extractMimeType
  17851. } = __nccwpck_require__(3168)
  17852. const { kState, kDispatcher } = __nccwpck_require__(3627)
  17853. const assert = __nccwpck_require__(4589)
  17854. const { safelyExtractBody, extractBody } = __nccwpck_require__(4492)
  17855. const {
  17856. redirectStatusSet,
  17857. nullBodyStatus,
  17858. safeMethodsSet,
  17859. requestBodyHeader,
  17860. subresourceSet
  17861. } = __nccwpck_require__(4495)
  17862. const EE = __nccwpck_require__(8474)
  17863. const { Readable, pipeline, finished } = __nccwpck_require__(7075)
  17864. const { addAbortListener, isErrored, isReadable, bufferToLowerCasedHeaderName } = __nccwpck_require__(3440)
  17865. const { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = __nccwpck_require__(1900)
  17866. const { getGlobalDispatcher } = __nccwpck_require__(2581)
  17867. const { webidl } = __nccwpck_require__(5893)
  17868. const { STATUS_CODES } = __nccwpck_require__(7067)
  17869. const GET_OR_HEAD = ['GET', 'HEAD']
  17870. const defaultUserAgent = typeof __UNDICI_IS_NODE__ !== 'undefined' || typeof esbuildDetection !== 'undefined'
  17871. ? 'node'
  17872. : 'undici'
  17873. /** @type {import('buffer').resolveObjectURL} */
  17874. let resolveObjectURL
  17875. class Fetch extends EE {
  17876. constructor (dispatcher) {
  17877. super()
  17878. this.dispatcher = dispatcher
  17879. this.connection = null
  17880. this.dump = false
  17881. this.state = 'ongoing'
  17882. }
  17883. terminate (reason) {
  17884. if (this.state !== 'ongoing') {
  17885. return
  17886. }
  17887. this.state = 'terminated'
  17888. this.connection?.destroy(reason)
  17889. this.emit('terminated', reason)
  17890. }
  17891. // https://fetch.spec.whatwg.org/#fetch-controller-abort
  17892. abort (error) {
  17893. if (this.state !== 'ongoing') {
  17894. return
  17895. }
  17896. // 1. Set controller’s state to "aborted".
  17897. this.state = 'aborted'
  17898. // 2. Let fallbackError be an "AbortError" DOMException.
  17899. // 3. Set error to fallbackError if it is not given.
  17900. if (!error) {
  17901. error = new DOMException('The operation was aborted.', 'AbortError')
  17902. }
  17903. // 4. Let serializedError be StructuredSerialize(error).
  17904. // If that threw an exception, catch it, and let
  17905. // serializedError be StructuredSerialize(fallbackError).
  17906. // 5. Set controller’s serialized abort reason to serializedError.
  17907. this.serializedAbortReason = error
  17908. this.connection?.destroy(error)
  17909. this.emit('terminated', error)
  17910. }
  17911. }
  17912. function handleFetchDone (response) {
  17913. finalizeAndReportTiming(response, 'fetch')
  17914. }
  17915. // https://fetch.spec.whatwg.org/#fetch-method
  17916. function fetch (input, init = undefined) {
  17917. webidl.argumentLengthCheck(arguments, 1, 'globalThis.fetch')
  17918. // 1. Let p be a new promise.
  17919. let p = createDeferredPromise()
  17920. // 2. Let requestObject be the result of invoking the initial value of
  17921. // Request as constructor with input and init as arguments. If this throws
  17922. // an exception, reject p with it and return p.
  17923. let requestObject
  17924. try {
  17925. requestObject = new Request(input, init)
  17926. } catch (e) {
  17927. p.reject(e)
  17928. return p.promise
  17929. }
  17930. // 3. Let request be requestObject’s request.
  17931. const request = requestObject[kState]
  17932. // 4. If requestObject’s signal’s aborted flag is set, then:
  17933. if (requestObject.signal.aborted) {
  17934. // 1. Abort the fetch() call with p, request, null, and
  17935. // requestObject’s signal’s abort reason.
  17936. abortFetch(p, request, null, requestObject.signal.reason)
  17937. // 2. Return p.
  17938. return p.promise
  17939. }
  17940. // 5. Let globalObject be request’s client’s global object.
  17941. const globalObject = request.client.globalObject
  17942. // 6. If globalObject is a ServiceWorkerGlobalScope object, then set
  17943. // request’s service-workers mode to "none".
  17944. if (globalObject?.constructor?.name === 'ServiceWorkerGlobalScope') {
  17945. request.serviceWorkers = 'none'
  17946. }
  17947. // 7. Let responseObject be null.
  17948. let responseObject = null
  17949. // 8. Let relevantRealm be this’s relevant Realm.
  17950. // 9. Let locallyAborted be false.
  17951. let locallyAborted = false
  17952. // 10. Let controller be null.
  17953. let controller = null
  17954. // 11. Add the following abort steps to requestObject’s signal:
  17955. addAbortListener(
  17956. requestObject.signal,
  17957. () => {
  17958. // 1. Set locallyAborted to true.
  17959. locallyAborted = true
  17960. // 2. Assert: controller is non-null.
  17961. assert(controller != null)
  17962. // 3. Abort controller with requestObject’s signal’s abort reason.
  17963. controller.abort(requestObject.signal.reason)
  17964. const realResponse = responseObject?.deref()
  17965. // 4. Abort the fetch() call with p, request, responseObject,
  17966. // and requestObject’s signal’s abort reason.
  17967. abortFetch(p, request, realResponse, requestObject.signal.reason)
  17968. }
  17969. )
  17970. // 12. Let handleFetchDone given response response be to finalize and
  17971. // report timing with response, globalObject, and "fetch".
  17972. // see function handleFetchDone
  17973. // 13. Set controller to the result of calling fetch given request,
  17974. // with processResponseEndOfBody set to handleFetchDone, and processResponse
  17975. // given response being these substeps:
  17976. const processResponse = (response) => {
  17977. // 1. If locallyAborted is true, terminate these substeps.
  17978. if (locallyAborted) {
  17979. return
  17980. }
  17981. // 2. If response’s aborted flag is set, then:
  17982. if (response.aborted) {
  17983. // 1. Let deserializedError be the result of deserialize a serialized
  17984. // abort reason given controller’s serialized abort reason and
  17985. // relevantRealm.
  17986. // 2. Abort the fetch() call with p, request, responseObject, and
  17987. // deserializedError.
  17988. abortFetch(p, request, responseObject, controller.serializedAbortReason)
  17989. return
  17990. }
  17991. // 3. If response is a network error, then reject p with a TypeError
  17992. // and terminate these substeps.
  17993. if (response.type === 'error') {
  17994. p.reject(new TypeError('fetch failed', { cause: response.error }))
  17995. return
  17996. }
  17997. // 4. Set responseObject to the result of creating a Response object,
  17998. // given response, "immutable", and relevantRealm.
  17999. responseObject = new WeakRef(fromInnerResponse(response, 'immutable'))
  18000. // 5. Resolve p with responseObject.
  18001. p.resolve(responseObject.deref())
  18002. p = null
  18003. }
  18004. controller = fetching({
  18005. request,
  18006. processResponseEndOfBody: handleFetchDone,
  18007. processResponse,
  18008. dispatcher: requestObject[kDispatcher] // undici
  18009. })
  18010. // 14. Return p.
  18011. return p.promise
  18012. }
  18013. // https://fetch.spec.whatwg.org/#finalize-and-report-timing
  18014. function finalizeAndReportTiming (response, initiatorType = 'other') {
  18015. // 1. If response is an aborted network error, then return.
  18016. if (response.type === 'error' && response.aborted) {
  18017. return
  18018. }
  18019. // 2. If response’s URL list is null or empty, then return.
  18020. if (!response.urlList?.length) {
  18021. return
  18022. }
  18023. // 3. Let originalURL be response’s URL list[0].
  18024. const originalURL = response.urlList[0]
  18025. // 4. Let timingInfo be response’s timing info.
  18026. let timingInfo = response.timingInfo
  18027. // 5. Let cacheState be response’s cache state.
  18028. let cacheState = response.cacheState
  18029. // 6. If originalURL’s scheme is not an HTTP(S) scheme, then return.
  18030. if (!urlIsHttpHttpsScheme(originalURL)) {
  18031. return
  18032. }
  18033. // 7. If timingInfo is null, then return.
  18034. if (timingInfo === null) {
  18035. return
  18036. }
  18037. // 8. If response’s timing allow passed flag is not set, then:
  18038. if (!response.timingAllowPassed) {
  18039. // 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo.
  18040. timingInfo = createOpaqueTimingInfo({
  18041. startTime: timingInfo.startTime
  18042. })
  18043. // 2. Set cacheState to the empty string.
  18044. cacheState = ''
  18045. }
  18046. // 9. Set timingInfo’s end time to the coarsened shared current time
  18047. // given global’s relevant settings object’s cross-origin isolated
  18048. // capability.
  18049. // TODO: given global’s relevant settings object’s cross-origin isolated
  18050. // capability?
  18051. timingInfo.endTime = coarsenedSharedCurrentTime()
  18052. // 10. Set response’s timing info to timingInfo.
  18053. response.timingInfo = timingInfo
  18054. // 11. Mark resource timing for timingInfo, originalURL, initiatorType,
  18055. // global, and cacheState.
  18056. markResourceTiming(
  18057. timingInfo,
  18058. originalURL.href,
  18059. initiatorType,
  18060. globalThis,
  18061. cacheState
  18062. )
  18063. }
  18064. // https://w3c.github.io/resource-timing/#dfn-mark-resource-timing
  18065. const markResourceTiming = performance.markResourceTiming
  18066. // https://fetch.spec.whatwg.org/#abort-fetch
  18067. function abortFetch (p, request, responseObject, error) {
  18068. // 1. Reject promise with error.
  18069. if (p) {
  18070. // We might have already resolved the promise at this stage
  18071. p.reject(error)
  18072. }
  18073. // 2. If request’s body is not null and is readable, then cancel request’s
  18074. // body with error.
  18075. if (request.body != null && isReadable(request.body?.stream)) {
  18076. request.body.stream.cancel(error).catch((err) => {
  18077. if (err.code === 'ERR_INVALID_STATE') {
  18078. // Node bug?
  18079. return
  18080. }
  18081. throw err
  18082. })
  18083. }
  18084. // 3. If responseObject is null, then return.
  18085. if (responseObject == null) {
  18086. return
  18087. }
  18088. // 4. Let response be responseObject’s response.
  18089. const response = responseObject[kState]
  18090. // 5. If response’s body is not null and is readable, then error response’s
  18091. // body with error.
  18092. if (response.body != null && isReadable(response.body?.stream)) {
  18093. response.body.stream.cancel(error).catch((err) => {
  18094. if (err.code === 'ERR_INVALID_STATE') {
  18095. // Node bug?
  18096. return
  18097. }
  18098. throw err
  18099. })
  18100. }
  18101. }
  18102. // https://fetch.spec.whatwg.org/#fetching
  18103. function fetching ({
  18104. request,
  18105. processRequestBodyChunkLength,
  18106. processRequestEndOfBody,
  18107. processResponse,
  18108. processResponseEndOfBody,
  18109. processResponseConsumeBody,
  18110. useParallelQueue = false,
  18111. dispatcher = getGlobalDispatcher() // undici
  18112. }) {
  18113. // Ensure that the dispatcher is set accordingly
  18114. assert(dispatcher)
  18115. // 1. Let taskDestination be null.
  18116. let taskDestination = null
  18117. // 2. Let crossOriginIsolatedCapability be false.
  18118. let crossOriginIsolatedCapability = false
  18119. // 3. If request’s client is non-null, then:
  18120. if (request.client != null) {
  18121. // 1. Set taskDestination to request’s client’s global object.
  18122. taskDestination = request.client.globalObject
  18123. // 2. Set crossOriginIsolatedCapability to request’s client’s cross-origin
  18124. // isolated capability.
  18125. crossOriginIsolatedCapability =
  18126. request.client.crossOriginIsolatedCapability
  18127. }
  18128. // 4. If useParallelQueue is true, then set taskDestination to the result of
  18129. // starting a new parallel queue.
  18130. // TODO
  18131. // 5. Let timingInfo be a new fetch timing info whose start time and
  18132. // post-redirect start time are the coarsened shared current time given
  18133. // crossOriginIsolatedCapability.
  18134. const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability)
  18135. const timingInfo = createOpaqueTimingInfo({
  18136. startTime: currentTime
  18137. })
  18138. // 6. Let fetchParams be a new fetch params whose
  18139. // request is request,
  18140. // timing info is timingInfo,
  18141. // process request body chunk length is processRequestBodyChunkLength,
  18142. // process request end-of-body is processRequestEndOfBody,
  18143. // process response is processResponse,
  18144. // process response consume body is processResponseConsumeBody,
  18145. // process response end-of-body is processResponseEndOfBody,
  18146. // task destination is taskDestination,
  18147. // and cross-origin isolated capability is crossOriginIsolatedCapability.
  18148. const fetchParams = {
  18149. controller: new Fetch(dispatcher),
  18150. request,
  18151. timingInfo,
  18152. processRequestBodyChunkLength,
  18153. processRequestEndOfBody,
  18154. processResponse,
  18155. processResponseConsumeBody,
  18156. processResponseEndOfBody,
  18157. taskDestination,
  18158. crossOriginIsolatedCapability
  18159. }
  18160. // 7. If request’s body is a byte sequence, then set request’s body to
  18161. // request’s body as a body.
  18162. // NOTE: Since fetching is only called from fetch, body should already be
  18163. // extracted.
  18164. assert(!request.body || request.body.stream)
  18165. // 8. If request’s window is "client", then set request’s window to request’s
  18166. // client, if request’s client’s global object is a Window object; otherwise
  18167. // "no-window".
  18168. if (request.window === 'client') {
  18169. // TODO: What if request.client is null?
  18170. request.window =
  18171. request.client?.globalObject?.constructor?.name === 'Window'
  18172. ? request.client
  18173. : 'no-window'
  18174. }
  18175. // 9. If request’s origin is "client", then set request’s origin to request’s
  18176. // client’s origin.
  18177. if (request.origin === 'client') {
  18178. request.origin = request.client.origin
  18179. }
  18180. // 10. If all of the following conditions are true:
  18181. // TODO
  18182. // 11. If request’s policy container is "client", then:
  18183. if (request.policyContainer === 'client') {
  18184. // 1. If request’s client is non-null, then set request’s policy
  18185. // container to a clone of request’s client’s policy container. [HTML]
  18186. if (request.client != null) {
  18187. request.policyContainer = clonePolicyContainer(
  18188. request.client.policyContainer
  18189. )
  18190. } else {
  18191. // 2. Otherwise, set request’s policy container to a new policy
  18192. // container.
  18193. request.policyContainer = makePolicyContainer()
  18194. }
  18195. }
  18196. // 12. If request’s header list does not contain `Accept`, then:
  18197. if (!request.headersList.contains('accept', true)) {
  18198. // 1. Let value be `*/*`.
  18199. const value = '*/*'
  18200. // 2. A user agent should set value to the first matching statement, if
  18201. // any, switching on request’s destination:
  18202. // "document"
  18203. // "frame"
  18204. // "iframe"
  18205. // `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`
  18206. // "image"
  18207. // `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5`
  18208. // "style"
  18209. // `text/css,*/*;q=0.1`
  18210. // TODO
  18211. // 3. Append `Accept`/value to request’s header list.
  18212. request.headersList.append('accept', value, true)
  18213. }
  18214. // 13. If request’s header list does not contain `Accept-Language`, then
  18215. // user agents should append `Accept-Language`/an appropriate value to
  18216. // request’s header list.
  18217. if (!request.headersList.contains('accept-language', true)) {
  18218. request.headersList.append('accept-language', '*', true)
  18219. }
  18220. // 14. If request’s priority is null, then use request’s initiator and
  18221. // destination appropriately in setting request’s priority to a
  18222. // user-agent-defined object.
  18223. if (request.priority === null) {
  18224. // TODO
  18225. }
  18226. // 15. If request is a subresource request, then:
  18227. if (subresourceSet.has(request.destination)) {
  18228. // TODO
  18229. }
  18230. // 16. Run main fetch given fetchParams.
  18231. mainFetch(fetchParams)
  18232. .catch(err => {
  18233. fetchParams.controller.terminate(err)
  18234. })
  18235. // 17. Return fetchParam's controller
  18236. return fetchParams.controller
  18237. }
  18238. // https://fetch.spec.whatwg.org/#concept-main-fetch
  18239. async function mainFetch (fetchParams, recursive = false) {
  18240. // 1. Let request be fetchParams’s request.
  18241. const request = fetchParams.request
  18242. // 2. Let response be null.
  18243. let response = null
  18244. // 3. If request’s local-URLs-only flag is set and request’s current URL is
  18245. // not local, then set response to a network error.
  18246. if (request.localURLsOnly && !urlIsLocal(requestCurrentURL(request))) {
  18247. response = makeNetworkError('local URLs only')
  18248. }
  18249. // 4. Run report Content Security Policy violations for request.
  18250. // TODO
  18251. // 5. Upgrade request to a potentially trustworthy URL, if appropriate.
  18252. tryUpgradeRequestToAPotentiallyTrustworthyURL(request)
  18253. // 6. If should request be blocked due to a bad port, should fetching request
  18254. // be blocked as mixed content, or should request be blocked by Content
  18255. // Security Policy returns blocked, then set response to a network error.
  18256. if (requestBadPort(request) === 'blocked') {
  18257. response = makeNetworkError('bad port')
  18258. }
  18259. // TODO: should fetching request be blocked as mixed content?
  18260. // TODO: should request be blocked by Content Security Policy?
  18261. // 7. If request’s referrer policy is the empty string, then set request’s
  18262. // referrer policy to request’s policy container’s referrer policy.
  18263. if (request.referrerPolicy === '') {
  18264. request.referrerPolicy = request.policyContainer.referrerPolicy
  18265. }
  18266. // 8. If request’s referrer is not "no-referrer", then set request’s
  18267. // referrer to the result of invoking determine request’s referrer.
  18268. if (request.referrer !== 'no-referrer') {
  18269. request.referrer = determineRequestsReferrer(request)
  18270. }
  18271. // 9. Set request’s current URL’s scheme to "https" if all of the following
  18272. // conditions are true:
  18273. // - request’s current URL’s scheme is "http"
  18274. // - request’s current URL’s host is a domain
  18275. // - Matching request’s current URL’s host per Known HSTS Host Domain Name
  18276. // Matching results in either a superdomain match with an asserted
  18277. // includeSubDomains directive or a congruent match (with or without an
  18278. // asserted includeSubDomains directive). [HSTS]
  18279. // TODO
  18280. // 10. If recursive is false, then run the remaining steps in parallel.
  18281. // TODO
  18282. // 11. If response is null, then set response to the result of running
  18283. // the steps corresponding to the first matching statement:
  18284. if (response === null) {
  18285. response = await (async () => {
  18286. const currentURL = requestCurrentURL(request)
  18287. if (
  18288. // - request’s current URL’s origin is same origin with request’s origin,
  18289. // and request’s response tainting is "basic"
  18290. (sameOrigin(currentURL, request.url) && request.responseTainting === 'basic') ||
  18291. // request’s current URL’s scheme is "data"
  18292. (currentURL.protocol === 'data:') ||
  18293. // - request’s mode is "navigate" or "websocket"
  18294. (request.mode === 'navigate' || request.mode === 'websocket')
  18295. ) {
  18296. // 1. Set request’s response tainting to "basic".
  18297. request.responseTainting = 'basic'
  18298. // 2. Return the result of running scheme fetch given fetchParams.
  18299. return await schemeFetch(fetchParams)
  18300. }
  18301. // request’s mode is "same-origin"
  18302. if (request.mode === 'same-origin') {
  18303. // 1. Return a network error.
  18304. return makeNetworkError('request mode cannot be "same-origin"')
  18305. }
  18306. // request’s mode is "no-cors"
  18307. if (request.mode === 'no-cors') {
  18308. // 1. If request’s redirect mode is not "follow", then return a network
  18309. // error.
  18310. if (request.redirect !== 'follow') {
  18311. return makeNetworkError(
  18312. 'redirect mode cannot be "follow" for "no-cors" request'
  18313. )
  18314. }
  18315. // 2. Set request’s response tainting to "opaque".
  18316. request.responseTainting = 'opaque'
  18317. // 3. Return the result of running scheme fetch given fetchParams.
  18318. return await schemeFetch(fetchParams)
  18319. }
  18320. // request’s current URL’s scheme is not an HTTP(S) scheme
  18321. if (!urlIsHttpHttpsScheme(requestCurrentURL(request))) {
  18322. // Return a network error.
  18323. return makeNetworkError('URL scheme must be a HTTP(S) scheme')
  18324. }
  18325. // - request’s use-CORS-preflight flag is set
  18326. // - request’s unsafe-request flag is set and either request’s method is
  18327. // not a CORS-safelisted method or CORS-unsafe request-header names with
  18328. // request’s header list is not empty
  18329. // 1. Set request’s response tainting to "cors".
  18330. // 2. Let corsWithPreflightResponse be the result of running HTTP fetch
  18331. // given fetchParams and true.
  18332. // 3. If corsWithPreflightResponse is a network error, then clear cache
  18333. // entries using request.
  18334. // 4. Return corsWithPreflightResponse.
  18335. // TODO
  18336. // Otherwise
  18337. // 1. Set request’s response tainting to "cors".
  18338. request.responseTainting = 'cors'
  18339. // 2. Return the result of running HTTP fetch given fetchParams.
  18340. return await httpFetch(fetchParams)
  18341. })()
  18342. }
  18343. // 12. If recursive is true, then return response.
  18344. if (recursive) {
  18345. return response
  18346. }
  18347. // 13. If response is not a network error and response is not a filtered
  18348. // response, then:
  18349. if (response.status !== 0 && !response.internalResponse) {
  18350. // If request’s response tainting is "cors", then:
  18351. if (request.responseTainting === 'cors') {
  18352. // 1. Let headerNames be the result of extracting header list values
  18353. // given `Access-Control-Expose-Headers` and response’s header list.
  18354. // TODO
  18355. // 2. If request’s credentials mode is not "include" and headerNames
  18356. // contains `*`, then set response’s CORS-exposed header-name list to
  18357. // all unique header names in response’s header list.
  18358. // TODO
  18359. // 3. Otherwise, if headerNames is not null or failure, then set
  18360. // response’s CORS-exposed header-name list to headerNames.
  18361. // TODO
  18362. }
  18363. // Set response to the following filtered response with response as its
  18364. // internal response, depending on request’s response tainting:
  18365. if (request.responseTainting === 'basic') {
  18366. response = filterResponse(response, 'basic')
  18367. } else if (request.responseTainting === 'cors') {
  18368. response = filterResponse(response, 'cors')
  18369. } else if (request.responseTainting === 'opaque') {
  18370. response = filterResponse(response, 'opaque')
  18371. } else {
  18372. assert(false)
  18373. }
  18374. }
  18375. // 14. Let internalResponse be response, if response is a network error,
  18376. // and response’s internal response otherwise.
  18377. let internalResponse =
  18378. response.status === 0 ? response : response.internalResponse
  18379. // 15. If internalResponse’s URL list is empty, then set it to a clone of
  18380. // request’s URL list.
  18381. if (internalResponse.urlList.length === 0) {
  18382. internalResponse.urlList.push(...request.urlList)
  18383. }
  18384. // 16. If request’s timing allow failed flag is unset, then set
  18385. // internalResponse’s timing allow passed flag.
  18386. if (!request.timingAllowFailed) {
  18387. response.timingAllowPassed = true
  18388. }
  18389. // 17. If response is not a network error and any of the following returns
  18390. // blocked
  18391. // - should internalResponse to request be blocked as mixed content
  18392. // - should internalResponse to request be blocked by Content Security Policy
  18393. // - should internalResponse to request be blocked due to its MIME type
  18394. // - should internalResponse to request be blocked due to nosniff
  18395. // TODO
  18396. // 18. If response’s type is "opaque", internalResponse’s status is 206,
  18397. // internalResponse’s range-requested flag is set, and request’s header
  18398. // list does not contain `Range`, then set response and internalResponse
  18399. // to a network error.
  18400. if (
  18401. response.type === 'opaque' &&
  18402. internalResponse.status === 206 &&
  18403. internalResponse.rangeRequested &&
  18404. !request.headers.contains('range', true)
  18405. ) {
  18406. response = internalResponse = makeNetworkError()
  18407. }
  18408. // 19. If response is not a network error and either request’s method is
  18409. // `HEAD` or `CONNECT`, or internalResponse’s status is a null body status,
  18410. // set internalResponse’s body to null and disregard any enqueuing toward
  18411. // it (if any).
  18412. if (
  18413. response.status !== 0 &&
  18414. (request.method === 'HEAD' ||
  18415. request.method === 'CONNECT' ||
  18416. nullBodyStatus.includes(internalResponse.status))
  18417. ) {
  18418. internalResponse.body = null
  18419. fetchParams.controller.dump = true
  18420. }
  18421. // 20. If request’s integrity metadata is not the empty string, then:
  18422. if (request.integrity) {
  18423. // 1. Let processBodyError be this step: run fetch finale given fetchParams
  18424. // and a network error.
  18425. const processBodyError = (reason) =>
  18426. fetchFinale(fetchParams, makeNetworkError(reason))
  18427. // 2. If request’s response tainting is "opaque", or response’s body is null,
  18428. // then run processBodyError and abort these steps.
  18429. if (request.responseTainting === 'opaque' || response.body == null) {
  18430. processBodyError(response.error)
  18431. return
  18432. }
  18433. // 3. Let processBody given bytes be these steps:
  18434. const processBody = (bytes) => {
  18435. // 1. If bytes do not match request’s integrity metadata,
  18436. // then run processBodyError and abort these steps. [SRI]
  18437. if (!bytesMatch(bytes, request.integrity)) {
  18438. processBodyError('integrity mismatch')
  18439. return
  18440. }
  18441. // 2. Set response’s body to bytes as a body.
  18442. response.body = safelyExtractBody(bytes)[0]
  18443. // 3. Run fetch finale given fetchParams and response.
  18444. fetchFinale(fetchParams, response)
  18445. }
  18446. // 4. Fully read response’s body given processBody and processBodyError.
  18447. await fullyReadBody(response.body, processBody, processBodyError)
  18448. } else {
  18449. // 21. Otherwise, run fetch finale given fetchParams and response.
  18450. fetchFinale(fetchParams, response)
  18451. }
  18452. }
  18453. // https://fetch.spec.whatwg.org/#concept-scheme-fetch
  18454. // given a fetch params fetchParams
  18455. function schemeFetch (fetchParams) {
  18456. // Note: since the connection is destroyed on redirect, which sets fetchParams to a
  18457. // cancelled state, we do not want this condition to trigger *unless* there have been
  18458. // no redirects. See https://github.com/nodejs/undici/issues/1776
  18459. // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
  18460. if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) {
  18461. return Promise.resolve(makeAppropriateNetworkError(fetchParams))
  18462. }
  18463. // 2. Let request be fetchParams’s request.
  18464. const { request } = fetchParams
  18465. const { protocol: scheme } = requestCurrentURL(request)
  18466. // 3. Switch on request’s current URL’s scheme and run the associated steps:
  18467. switch (scheme) {
  18468. case 'about:': {
  18469. // If request’s current URL’s path is the string "blank", then return a new response
  18470. // whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) »,
  18471. // and body is the empty byte sequence as a body.
  18472. // Otherwise, return a network error.
  18473. return Promise.resolve(makeNetworkError('about scheme is not supported'))
  18474. }
  18475. case 'blob:': {
  18476. if (!resolveObjectURL) {
  18477. resolveObjectURL = (__nccwpck_require__(4573).resolveObjectURL)
  18478. }
  18479. // 1. Let blobURLEntry be request’s current URL’s blob URL entry.
  18480. const blobURLEntry = requestCurrentURL(request)
  18481. // https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56
  18482. // Buffer.resolveObjectURL does not ignore URL queries.
  18483. if (blobURLEntry.search.length !== 0) {
  18484. return Promise.resolve(makeNetworkError('NetworkError when attempting to fetch resource.'))
  18485. }
  18486. const blob = resolveObjectURL(blobURLEntry.toString())
  18487. // 2. If request’s method is not `GET`, blobURLEntry is null, or blobURLEntry’s
  18488. // object is not a Blob object, then return a network error.
  18489. if (request.method !== 'GET' || !isBlobLike(blob)) {
  18490. return Promise.resolve(makeNetworkError('invalid method'))
  18491. }
  18492. // 3. Let blob be blobURLEntry’s object.
  18493. // Note: done above
  18494. // 4. Let response be a new response.
  18495. const response = makeResponse()
  18496. // 5. Let fullLength be blob’s size.
  18497. const fullLength = blob.size
  18498. // 6. Let serializedFullLength be fullLength, serialized and isomorphic encoded.
  18499. const serializedFullLength = isomorphicEncode(`${fullLength}`)
  18500. // 7. Let type be blob’s type.
  18501. const type = blob.type
  18502. // 8. If request’s header list does not contain `Range`:
  18503. // 9. Otherwise:
  18504. if (!request.headersList.contains('range', true)) {
  18505. // 1. Let bodyWithType be the result of safely extracting blob.
  18506. // Note: in the FileAPI a blob "object" is a Blob *or* a MediaSource.
  18507. // In node, this can only ever be a Blob. Therefore we can safely
  18508. // use extractBody directly.
  18509. const bodyWithType = extractBody(blob)
  18510. // 2. Set response’s status message to `OK`.
  18511. response.statusText = 'OK'
  18512. // 3. Set response’s body to bodyWithType’s body.
  18513. response.body = bodyWithType[0]
  18514. // 4. Set response’s header list to « (`Content-Length`, serializedFullLength), (`Content-Type`, type) ».
  18515. response.headersList.set('content-length', serializedFullLength, true)
  18516. response.headersList.set('content-type', type, true)
  18517. } else {
  18518. // 1. Set response’s range-requested flag.
  18519. response.rangeRequested = true
  18520. // 2. Let rangeHeader be the result of getting `Range` from request’s header list.
  18521. const rangeHeader = request.headersList.get('range', true)
  18522. // 3. Let rangeValue be the result of parsing a single range header value given rangeHeader and true.
  18523. const rangeValue = simpleRangeHeaderValue(rangeHeader, true)
  18524. // 4. If rangeValue is failure, then return a network error.
  18525. if (rangeValue === 'failure') {
  18526. return Promise.resolve(makeNetworkError('failed to fetch the data URL'))
  18527. }
  18528. // 5. Let (rangeStart, rangeEnd) be rangeValue.
  18529. let { rangeStartValue: rangeStart, rangeEndValue: rangeEnd } = rangeValue
  18530. // 6. If rangeStart is null:
  18531. // 7. Otherwise:
  18532. if (rangeStart === null) {
  18533. // 1. Set rangeStart to fullLength − rangeEnd.
  18534. rangeStart = fullLength - rangeEnd
  18535. // 2. Set rangeEnd to rangeStart + rangeEnd − 1.
  18536. rangeEnd = rangeStart + rangeEnd - 1
  18537. } else {
  18538. // 1. If rangeStart is greater than or equal to fullLength, then return a network error.
  18539. if (rangeStart >= fullLength) {
  18540. return Promise.resolve(makeNetworkError('Range start is greater than the blob\'s size.'))
  18541. }
  18542. // 2. If rangeEnd is null or rangeEnd is greater than or equal to fullLength, then set
  18543. // rangeEnd to fullLength − 1.
  18544. if (rangeEnd === null || rangeEnd >= fullLength) {
  18545. rangeEnd = fullLength - 1
  18546. }
  18547. }
  18548. // 8. Let slicedBlob be the result of invoking slice blob given blob, rangeStart,
  18549. // rangeEnd + 1, and type.
  18550. const slicedBlob = blob.slice(rangeStart, rangeEnd, type)
  18551. // 9. Let slicedBodyWithType be the result of safely extracting slicedBlob.
  18552. // Note: same reason as mentioned above as to why we use extractBody
  18553. const slicedBodyWithType = extractBody(slicedBlob)
  18554. // 10. Set response’s body to slicedBodyWithType’s body.
  18555. response.body = slicedBodyWithType[0]
  18556. // 11. Let serializedSlicedLength be slicedBlob’s size, serialized and isomorphic encoded.
  18557. const serializedSlicedLength = isomorphicEncode(`${slicedBlob.size}`)
  18558. // 12. Let contentRange be the result of invoking build a content range given rangeStart,
  18559. // rangeEnd, and fullLength.
  18560. const contentRange = buildContentRange(rangeStart, rangeEnd, fullLength)
  18561. // 13. Set response’s status to 206.
  18562. response.status = 206
  18563. // 14. Set response’s status message to `Partial Content`.
  18564. response.statusText = 'Partial Content'
  18565. // 15. Set response’s header list to « (`Content-Length`, serializedSlicedLength),
  18566. // (`Content-Type`, type), (`Content-Range`, contentRange) ».
  18567. response.headersList.set('content-length', serializedSlicedLength, true)
  18568. response.headersList.set('content-type', type, true)
  18569. response.headersList.set('content-range', contentRange, true)
  18570. }
  18571. // 10. Return response.
  18572. return Promise.resolve(response)
  18573. }
  18574. case 'data:': {
  18575. // 1. Let dataURLStruct be the result of running the
  18576. // data: URL processor on request’s current URL.
  18577. const currentURL = requestCurrentURL(request)
  18578. const dataURLStruct = dataURLProcessor(currentURL)
  18579. // 2. If dataURLStruct is failure, then return a
  18580. // network error.
  18581. if (dataURLStruct === 'failure') {
  18582. return Promise.resolve(makeNetworkError('failed to fetch the data URL'))
  18583. }
  18584. // 3. Let mimeType be dataURLStruct’s MIME type, serialized.
  18585. const mimeType = serializeAMimeType(dataURLStruct.mimeType)
  18586. // 4. Return a response whose status message is `OK`,
  18587. // header list is « (`Content-Type`, mimeType) »,
  18588. // and body is dataURLStruct’s body as a body.
  18589. return Promise.resolve(makeResponse({
  18590. statusText: 'OK',
  18591. headersList: [
  18592. ['content-type', { name: 'Content-Type', value: mimeType }]
  18593. ],
  18594. body: safelyExtractBody(dataURLStruct.body)[0]
  18595. }))
  18596. }
  18597. case 'file:': {
  18598. // For now, unfortunate as it is, file URLs are left as an exercise for the reader.
  18599. // When in doubt, return a network error.
  18600. return Promise.resolve(makeNetworkError('not implemented... yet...'))
  18601. }
  18602. case 'http:':
  18603. case 'https:': {
  18604. // Return the result of running HTTP fetch given fetchParams.
  18605. return httpFetch(fetchParams)
  18606. .catch((err) => makeNetworkError(err))
  18607. }
  18608. default: {
  18609. return Promise.resolve(makeNetworkError('unknown scheme'))
  18610. }
  18611. }
  18612. }
  18613. // https://fetch.spec.whatwg.org/#finalize-response
  18614. function finalizeResponse (fetchParams, response) {
  18615. // 1. Set fetchParams’s request’s done flag.
  18616. fetchParams.request.done = true
  18617. // 2, If fetchParams’s process response done is not null, then queue a fetch
  18618. // task to run fetchParams’s process response done given response, with
  18619. // fetchParams’s task destination.
  18620. if (fetchParams.processResponseDone != null) {
  18621. queueMicrotask(() => fetchParams.processResponseDone(response))
  18622. }
  18623. }
  18624. // https://fetch.spec.whatwg.org/#fetch-finale
  18625. function fetchFinale (fetchParams, response) {
  18626. // 1. Let timingInfo be fetchParams’s timing info.
  18627. let timingInfo = fetchParams.timingInfo
  18628. // 2. If response is not a network error and fetchParams’s request’s client is a secure context,
  18629. // then set timingInfo’s server-timing headers to the result of getting, decoding, and splitting
  18630. // `Server-Timing` from response’s internal response’s header list.
  18631. // TODO
  18632. // 3. Let processResponseEndOfBody be the following steps:
  18633. const processResponseEndOfBody = () => {
  18634. // 1. Let unsafeEndTime be the unsafe shared current time.
  18635. const unsafeEndTime = Date.now() // ?
  18636. // 2. If fetchParams’s request’s destination is "document", then set fetchParams’s controller’s
  18637. // full timing info to fetchParams’s timing info.
  18638. if (fetchParams.request.destination === 'document') {
  18639. fetchParams.controller.fullTimingInfo = timingInfo
  18640. }
  18641. // 3. Set fetchParams’s controller’s report timing steps to the following steps given a global object global:
  18642. fetchParams.controller.reportTimingSteps = () => {
  18643. // 1. If fetchParams’s request’s URL’s scheme is not an HTTP(S) scheme, then return.
  18644. if (fetchParams.request.url.protocol !== 'https:') {
  18645. return
  18646. }
  18647. // 2. Set timingInfo’s end time to the relative high resolution time given unsafeEndTime and global.
  18648. timingInfo.endTime = unsafeEndTime
  18649. // 3. Let cacheState be response’s cache state.
  18650. let cacheState = response.cacheState
  18651. // 4. Let bodyInfo be response’s body info.
  18652. const bodyInfo = response.bodyInfo
  18653. // 5. If response’s timing allow passed flag is not set, then set timingInfo to the result of creating an
  18654. // opaque timing info for timingInfo and set cacheState to the empty string.
  18655. if (!response.timingAllowPassed) {
  18656. timingInfo = createOpaqueTimingInfo(timingInfo)
  18657. cacheState = ''
  18658. }
  18659. // 6. Let responseStatus be 0.
  18660. let responseStatus = 0
  18661. // 7. If fetchParams’s request’s mode is not "navigate" or response’s has-cross-origin-redirects is false:
  18662. if (fetchParams.request.mode !== 'navigator' || !response.hasCrossOriginRedirects) {
  18663. // 1. Set responseStatus to response’s status.
  18664. responseStatus = response.status
  18665. // 2. Let mimeType be the result of extracting a MIME type from response’s header list.
  18666. const mimeType = extractMimeType(response.headersList)
  18667. // 3. If mimeType is not failure, then set bodyInfo’s content type to the result of minimizing a supported MIME type given mimeType.
  18668. if (mimeType !== 'failure') {
  18669. bodyInfo.contentType = minimizeSupportedMimeType(mimeType)
  18670. }
  18671. }
  18672. // 8. If fetchParams’s request’s initiator type is non-null, then mark resource timing given timingInfo,
  18673. // fetchParams’s request’s URL, fetchParams’s request’s initiator type, global, cacheState, bodyInfo,
  18674. // and responseStatus.
  18675. if (fetchParams.request.initiatorType != null) {
  18676. // TODO: update markresourcetiming
  18677. markResourceTiming(timingInfo, fetchParams.request.url.href, fetchParams.request.initiatorType, globalThis, cacheState, bodyInfo, responseStatus)
  18678. }
  18679. }
  18680. // 4. Let processResponseEndOfBodyTask be the following steps:
  18681. const processResponseEndOfBodyTask = () => {
  18682. // 1. Set fetchParams’s request’s done flag.
  18683. fetchParams.request.done = true
  18684. // 2. If fetchParams’s process response end-of-body is non-null, then run fetchParams’s process
  18685. // response end-of-body given response.
  18686. if (fetchParams.processResponseEndOfBody != null) {
  18687. queueMicrotask(() => fetchParams.processResponseEndOfBody(response))
  18688. }
  18689. // 3. If fetchParams’s request’s initiator type is non-null and fetchParams’s request’s client’s
  18690. // global object is fetchParams’s task destination, then run fetchParams’s controller’s report
  18691. // timing steps given fetchParams’s request’s client’s global object.
  18692. if (fetchParams.request.initiatorType != null) {
  18693. fetchParams.controller.reportTimingSteps()
  18694. }
  18695. }
  18696. // 5. Queue a fetch task to run processResponseEndOfBodyTask with fetchParams’s task destination
  18697. queueMicrotask(() => processResponseEndOfBodyTask())
  18698. }
  18699. // 4. If fetchParams’s process response is non-null, then queue a fetch task to run fetchParams’s
  18700. // process response given response, with fetchParams’s task destination.
  18701. if (fetchParams.processResponse != null) {
  18702. queueMicrotask(() => {
  18703. fetchParams.processResponse(response)
  18704. fetchParams.processResponse = null
  18705. })
  18706. }
  18707. // 5. Let internalResponse be response, if response is a network error; otherwise response’s internal response.
  18708. const internalResponse = response.type === 'error' ? response : (response.internalResponse ?? response)
  18709. // 6. If internalResponse’s body is null, then run processResponseEndOfBody.
  18710. // 7. Otherwise:
  18711. if (internalResponse.body == null) {
  18712. processResponseEndOfBody()
  18713. } else {
  18714. // mcollina: all the following steps of the specs are skipped.
  18715. // The internal transform stream is not needed.
  18716. // See https://github.com/nodejs/undici/pull/3093#issuecomment-2050198541
  18717. // 1. Let transformStream be a new TransformStream.
  18718. // 2. Let identityTransformAlgorithm be an algorithm which, given chunk, enqueues chunk in transformStream.
  18719. // 3. Set up transformStream with transformAlgorithm set to identityTransformAlgorithm and flushAlgorithm
  18720. // set to processResponseEndOfBody.
  18721. // 4. Set internalResponse’s body’s stream to the result of internalResponse’s body’s stream piped through transformStream.
  18722. finished(internalResponse.body.stream, () => {
  18723. processResponseEndOfBody()
  18724. })
  18725. }
  18726. }
  18727. // https://fetch.spec.whatwg.org/#http-fetch
  18728. async function httpFetch (fetchParams) {
  18729. // 1. Let request be fetchParams’s request.
  18730. const request = fetchParams.request
  18731. // 2. Let response be null.
  18732. let response = null
  18733. // 3. Let actualResponse be null.
  18734. let actualResponse = null
  18735. // 4. Let timingInfo be fetchParams’s timing info.
  18736. const timingInfo = fetchParams.timingInfo
  18737. // 5. If request’s service-workers mode is "all", then:
  18738. if (request.serviceWorkers === 'all') {
  18739. // TODO
  18740. }
  18741. // 6. If response is null, then:
  18742. if (response === null) {
  18743. // 1. If makeCORSPreflight is true and one of these conditions is true:
  18744. // TODO
  18745. // 2. If request’s redirect mode is "follow", then set request’s
  18746. // service-workers mode to "none".
  18747. if (request.redirect === 'follow') {
  18748. request.serviceWorkers = 'none'
  18749. }
  18750. // 3. Set response and actualResponse to the result of running
  18751. // HTTP-network-or-cache fetch given fetchParams.
  18752. actualResponse = response = await httpNetworkOrCacheFetch(fetchParams)
  18753. // 4. If request’s response tainting is "cors" and a CORS check
  18754. // for request and response returns failure, then return a network error.
  18755. if (
  18756. request.responseTainting === 'cors' &&
  18757. corsCheck(request, response) === 'failure'
  18758. ) {
  18759. return makeNetworkError('cors failure')
  18760. }
  18761. // 5. If the TAO check for request and response returns failure, then set
  18762. // request’s timing allow failed flag.
  18763. if (TAOCheck(request, response) === 'failure') {
  18764. request.timingAllowFailed = true
  18765. }
  18766. }
  18767. // 7. If either request’s response tainting or response’s type
  18768. // is "opaque", and the cross-origin resource policy check with
  18769. // request’s origin, request’s client, request’s destination,
  18770. // and actualResponse returns blocked, then return a network error.
  18771. if (
  18772. (request.responseTainting === 'opaque' || response.type === 'opaque') &&
  18773. crossOriginResourcePolicyCheck(
  18774. request.origin,
  18775. request.client,
  18776. request.destination,
  18777. actualResponse
  18778. ) === 'blocked'
  18779. ) {
  18780. return makeNetworkError('blocked')
  18781. }
  18782. // 8. If actualResponse’s status is a redirect status, then:
  18783. if (redirectStatusSet.has(actualResponse.status)) {
  18784. // 1. If actualResponse’s status is not 303, request’s body is not null,
  18785. // and the connection uses HTTP/2, then user agents may, and are even
  18786. // encouraged to, transmit an RST_STREAM frame.
  18787. // See, https://github.com/whatwg/fetch/issues/1288
  18788. if (request.redirect !== 'manual') {
  18789. fetchParams.controller.connection.destroy(undefined, false)
  18790. }
  18791. // 2. Switch on request’s redirect mode:
  18792. if (request.redirect === 'error') {
  18793. // Set response to a network error.
  18794. response = makeNetworkError('unexpected redirect')
  18795. } else if (request.redirect === 'manual') {
  18796. // Set response to an opaque-redirect filtered response whose internal
  18797. // response is actualResponse.
  18798. // NOTE(spec): On the web this would return an `opaqueredirect` response,
  18799. // but that doesn't make sense server side.
  18800. // See https://github.com/nodejs/undici/issues/1193.
  18801. response = actualResponse
  18802. } else if (request.redirect === 'follow') {
  18803. // Set response to the result of running HTTP-redirect fetch given
  18804. // fetchParams and response.
  18805. response = await httpRedirectFetch(fetchParams, response)
  18806. } else {
  18807. assert(false)
  18808. }
  18809. }
  18810. // 9. Set response’s timing info to timingInfo.
  18811. response.timingInfo = timingInfo
  18812. // 10. Return response.
  18813. return response
  18814. }
  18815. // https://fetch.spec.whatwg.org/#http-redirect-fetch
  18816. function httpRedirectFetch (fetchParams, response) {
  18817. // 1. Let request be fetchParams’s request.
  18818. const request = fetchParams.request
  18819. // 2. Let actualResponse be response, if response is not a filtered response,
  18820. // and response’s internal response otherwise.
  18821. const actualResponse = response.internalResponse
  18822. ? response.internalResponse
  18823. : response
  18824. // 3. Let locationURL be actualResponse’s location URL given request’s current
  18825. // URL’s fragment.
  18826. let locationURL
  18827. try {
  18828. locationURL = responseLocationURL(
  18829. actualResponse,
  18830. requestCurrentURL(request).hash
  18831. )
  18832. // 4. If locationURL is null, then return response.
  18833. if (locationURL == null) {
  18834. return response
  18835. }
  18836. } catch (err) {
  18837. // 5. If locationURL is failure, then return a network error.
  18838. return Promise.resolve(makeNetworkError(err))
  18839. }
  18840. // 6. If locationURL’s scheme is not an HTTP(S) scheme, then return a network
  18841. // error.
  18842. if (!urlIsHttpHttpsScheme(locationURL)) {
  18843. return Promise.resolve(makeNetworkError('URL scheme must be a HTTP(S) scheme'))
  18844. }
  18845. // 7. If request’s redirect count is 20, then return a network error.
  18846. if (request.redirectCount === 20) {
  18847. return Promise.resolve(makeNetworkError('redirect count exceeded'))
  18848. }
  18849. // 8. Increase request’s redirect count by 1.
  18850. request.redirectCount += 1
  18851. // 9. If request’s mode is "cors", locationURL includes credentials, and
  18852. // request’s origin is not same origin with locationURL’s origin, then return
  18853. // a network error.
  18854. if (
  18855. request.mode === 'cors' &&
  18856. (locationURL.username || locationURL.password) &&
  18857. !sameOrigin(request, locationURL)
  18858. ) {
  18859. return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"'))
  18860. }
  18861. // 10. If request’s response tainting is "cors" and locationURL includes
  18862. // credentials, then return a network error.
  18863. if (
  18864. request.responseTainting === 'cors' &&
  18865. (locationURL.username || locationURL.password)
  18866. ) {
  18867. return Promise.resolve(makeNetworkError(
  18868. 'URL cannot contain credentials for request mode "cors"'
  18869. ))
  18870. }
  18871. // 11. If actualResponse’s status is not 303, request’s body is non-null,
  18872. // and request’s body’s source is null, then return a network error.
  18873. if (
  18874. actualResponse.status !== 303 &&
  18875. request.body != null &&
  18876. request.body.source == null
  18877. ) {
  18878. return Promise.resolve(makeNetworkError())
  18879. }
  18880. // 12. If one of the following is true
  18881. // - actualResponse’s status is 301 or 302 and request’s method is `POST`
  18882. // - actualResponse’s status is 303 and request’s method is not `GET` or `HEAD`
  18883. if (
  18884. ([301, 302].includes(actualResponse.status) && request.method === 'POST') ||
  18885. (actualResponse.status === 303 &&
  18886. !GET_OR_HEAD.includes(request.method))
  18887. ) {
  18888. // then:
  18889. // 1. Set request’s method to `GET` and request’s body to null.
  18890. request.method = 'GET'
  18891. request.body = null
  18892. // 2. For each headerName of request-body-header name, delete headerName from
  18893. // request’s header list.
  18894. for (const headerName of requestBodyHeader) {
  18895. request.headersList.delete(headerName)
  18896. }
  18897. }
  18898. // 13. If request’s current URL’s origin is not same origin with locationURL’s
  18899. // origin, then for each headerName of CORS non-wildcard request-header name,
  18900. // delete headerName from request’s header list.
  18901. if (!sameOrigin(requestCurrentURL(request), locationURL)) {
  18902. // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
  18903. request.headersList.delete('authorization', true)
  18904. // https://fetch.spec.whatwg.org/#authentication-entries
  18905. request.headersList.delete('proxy-authorization', true)
  18906. // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
  18907. request.headersList.delete('cookie', true)
  18908. request.headersList.delete('host', true)
  18909. }
  18910. // 14. If request’s body is non-null, then set request’s body to the first return
  18911. // value of safely extracting request’s body’s source.
  18912. if (request.body != null) {
  18913. assert(request.body.source != null)
  18914. request.body = safelyExtractBody(request.body.source)[0]
  18915. }
  18916. // 15. Let timingInfo be fetchParams’s timing info.
  18917. const timingInfo = fetchParams.timingInfo
  18918. // 16. Set timingInfo’s redirect end time and post-redirect start time to the
  18919. // coarsened shared current time given fetchParams’s cross-origin isolated
  18920. // capability.
  18921. timingInfo.redirectEndTime = timingInfo.postRedirectStartTime =
  18922. coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
  18923. // 17. If timingInfo’s redirect start time is 0, then set timingInfo’s
  18924. // redirect start time to timingInfo’s start time.
  18925. if (timingInfo.redirectStartTime === 0) {
  18926. timingInfo.redirectStartTime = timingInfo.startTime
  18927. }
  18928. // 18. Append locationURL to request’s URL list.
  18929. request.urlList.push(locationURL)
  18930. // 19. Invoke set request’s referrer policy on redirect on request and
  18931. // actualResponse.
  18932. setRequestReferrerPolicyOnRedirect(request, actualResponse)
  18933. // 20. Return the result of running main fetch given fetchParams and true.
  18934. return mainFetch(fetchParams, true)
  18935. }
  18936. // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch
  18937. async function httpNetworkOrCacheFetch (
  18938. fetchParams,
  18939. isAuthenticationFetch = false,
  18940. isNewConnectionFetch = false
  18941. ) {
  18942. // 1. Let request be fetchParams’s request.
  18943. const request = fetchParams.request
  18944. // 2. Let httpFetchParams be null.
  18945. let httpFetchParams = null
  18946. // 3. Let httpRequest be null.
  18947. let httpRequest = null
  18948. // 4. Let response be null.
  18949. let response = null
  18950. // 5. Let storedResponse be null.
  18951. // TODO: cache
  18952. // 6. Let httpCache be null.
  18953. const httpCache = null
  18954. // 7. Let the revalidatingFlag be unset.
  18955. const revalidatingFlag = false
  18956. // 8. Run these steps, but abort when the ongoing fetch is terminated:
  18957. // 1. If request’s window is "no-window" and request’s redirect mode is
  18958. // "error", then set httpFetchParams to fetchParams and httpRequest to
  18959. // request.
  18960. if (request.window === 'no-window' && request.redirect === 'error') {
  18961. httpFetchParams = fetchParams
  18962. httpRequest = request
  18963. } else {
  18964. // Otherwise:
  18965. // 1. Set httpRequest to a clone of request.
  18966. httpRequest = cloneRequest(request)
  18967. // 2. Set httpFetchParams to a copy of fetchParams.
  18968. httpFetchParams = { ...fetchParams }
  18969. // 3. Set httpFetchParams’s request to httpRequest.
  18970. httpFetchParams.request = httpRequest
  18971. }
  18972. // 3. Let includeCredentials be true if one of
  18973. const includeCredentials =
  18974. request.credentials === 'include' ||
  18975. (request.credentials === 'same-origin' &&
  18976. request.responseTainting === 'basic')
  18977. // 4. Let contentLength be httpRequest’s body’s length, if httpRequest’s
  18978. // body is non-null; otherwise null.
  18979. const contentLength = httpRequest.body ? httpRequest.body.length : null
  18980. // 5. Let contentLengthHeaderValue be null.
  18981. let contentLengthHeaderValue = null
  18982. // 6. If httpRequest’s body is null and httpRequest’s method is `POST` or
  18983. // `PUT`, then set contentLengthHeaderValue to `0`.
  18984. if (
  18985. httpRequest.body == null &&
  18986. ['POST', 'PUT'].includes(httpRequest.method)
  18987. ) {
  18988. contentLengthHeaderValue = '0'
  18989. }
  18990. // 7. If contentLength is non-null, then set contentLengthHeaderValue to
  18991. // contentLength, serialized and isomorphic encoded.
  18992. if (contentLength != null) {
  18993. contentLengthHeaderValue = isomorphicEncode(`${contentLength}`)
  18994. }
  18995. // 8. If contentLengthHeaderValue is non-null, then append
  18996. // `Content-Length`/contentLengthHeaderValue to httpRequest’s header
  18997. // list.
  18998. if (contentLengthHeaderValue != null) {
  18999. httpRequest.headersList.append('content-length', contentLengthHeaderValue, true)
  19000. }
  19001. // 9. If contentLengthHeaderValue is non-null, then append (`Content-Length`,
  19002. // contentLengthHeaderValue) to httpRequest’s header list.
  19003. // 10. If contentLength is non-null and httpRequest’s keepalive is true,
  19004. // then:
  19005. if (contentLength != null && httpRequest.keepalive) {
  19006. // NOTE: keepalive is a noop outside of browser context.
  19007. }
  19008. // 11. If httpRequest’s referrer is a URL, then append
  19009. // `Referer`/httpRequest’s referrer, serialized and isomorphic encoded,
  19010. // to httpRequest’s header list.
  19011. if (httpRequest.referrer instanceof URL) {
  19012. httpRequest.headersList.append('referer', isomorphicEncode(httpRequest.referrer.href), true)
  19013. }
  19014. // 12. Append a request `Origin` header for httpRequest.
  19015. appendRequestOriginHeader(httpRequest)
  19016. // 13. Append the Fetch metadata headers for httpRequest. [FETCH-METADATA]
  19017. appendFetchMetadata(httpRequest)
  19018. // 14. If httpRequest’s header list does not contain `User-Agent`, then
  19019. // user agents should append `User-Agent`/default `User-Agent` value to
  19020. // httpRequest’s header list.
  19021. if (!httpRequest.headersList.contains('user-agent', true)) {
  19022. httpRequest.headersList.append('user-agent', defaultUserAgent)
  19023. }
  19024. // 15. If httpRequest’s cache mode is "default" and httpRequest’s header
  19025. // list contains `If-Modified-Since`, `If-None-Match`,
  19026. // `If-Unmodified-Since`, `If-Match`, or `If-Range`, then set
  19027. // httpRequest’s cache mode to "no-store".
  19028. if (
  19029. httpRequest.cache === 'default' &&
  19030. (httpRequest.headersList.contains('if-modified-since', true) ||
  19031. httpRequest.headersList.contains('if-none-match', true) ||
  19032. httpRequest.headersList.contains('if-unmodified-since', true) ||
  19033. httpRequest.headersList.contains('if-match', true) ||
  19034. httpRequest.headersList.contains('if-range', true))
  19035. ) {
  19036. httpRequest.cache = 'no-store'
  19037. }
  19038. // 16. If httpRequest’s cache mode is "no-cache", httpRequest’s prevent
  19039. // no-cache cache-control header modification flag is unset, and
  19040. // httpRequest’s header list does not contain `Cache-Control`, then append
  19041. // `Cache-Control`/`max-age=0` to httpRequest’s header list.
  19042. if (
  19043. httpRequest.cache === 'no-cache' &&
  19044. !httpRequest.preventNoCacheCacheControlHeaderModification &&
  19045. !httpRequest.headersList.contains('cache-control', true)
  19046. ) {
  19047. httpRequest.headersList.append('cache-control', 'max-age=0', true)
  19048. }
  19049. // 17. If httpRequest’s cache mode is "no-store" or "reload", then:
  19050. if (httpRequest.cache === 'no-store' || httpRequest.cache === 'reload') {
  19051. // 1. If httpRequest’s header list does not contain `Pragma`, then append
  19052. // `Pragma`/`no-cache` to httpRequest’s header list.
  19053. if (!httpRequest.headersList.contains('pragma', true)) {
  19054. httpRequest.headersList.append('pragma', 'no-cache', true)
  19055. }
  19056. // 2. If httpRequest’s header list does not contain `Cache-Control`,
  19057. // then append `Cache-Control`/`no-cache` to httpRequest’s header list.
  19058. if (!httpRequest.headersList.contains('cache-control', true)) {
  19059. httpRequest.headersList.append('cache-control', 'no-cache', true)
  19060. }
  19061. }
  19062. // 18. If httpRequest’s header list contains `Range`, then append
  19063. // `Accept-Encoding`/`identity` to httpRequest’s header list.
  19064. if (httpRequest.headersList.contains('range', true)) {
  19065. httpRequest.headersList.append('accept-encoding', 'identity', true)
  19066. }
  19067. // 19. Modify httpRequest’s header list per HTTP. Do not append a given
  19068. // header if httpRequest’s header list contains that header’s name.
  19069. // TODO: https://github.com/whatwg/fetch/issues/1285#issuecomment-896560129
  19070. if (!httpRequest.headersList.contains('accept-encoding', true)) {
  19071. if (urlHasHttpsScheme(requestCurrentURL(httpRequest))) {
  19072. httpRequest.headersList.append('accept-encoding', 'br, gzip, deflate', true)
  19073. } else {
  19074. httpRequest.headersList.append('accept-encoding', 'gzip, deflate', true)
  19075. }
  19076. }
  19077. httpRequest.headersList.delete('host', true)
  19078. // 20. If includeCredentials is true, then:
  19079. if (includeCredentials) {
  19080. // 1. If the user agent is not configured to block cookies for httpRequest
  19081. // (see section 7 of [COOKIES]), then:
  19082. // TODO: credentials
  19083. // 2. If httpRequest’s header list does not contain `Authorization`, then:
  19084. // TODO: credentials
  19085. }
  19086. // 21. If there’s a proxy-authentication entry, use it as appropriate.
  19087. // TODO: proxy-authentication
  19088. // 22. Set httpCache to the result of determining the HTTP cache
  19089. // partition, given httpRequest.
  19090. // TODO: cache
  19091. // 23. If httpCache is null, then set httpRequest’s cache mode to
  19092. // "no-store".
  19093. if (httpCache == null) {
  19094. httpRequest.cache = 'no-store'
  19095. }
  19096. // 24. If httpRequest’s cache mode is neither "no-store" nor "reload",
  19097. // then:
  19098. if (httpRequest.cache !== 'no-store' && httpRequest.cache !== 'reload') {
  19099. // TODO: cache
  19100. }
  19101. // 9. If aborted, then return the appropriate network error for fetchParams.
  19102. // TODO
  19103. // 10. If response is null, then:
  19104. if (response == null) {
  19105. // 1. If httpRequest’s cache mode is "only-if-cached", then return a
  19106. // network error.
  19107. if (httpRequest.cache === 'only-if-cached') {
  19108. return makeNetworkError('only if cached')
  19109. }
  19110. // 2. Let forwardResponse be the result of running HTTP-network fetch
  19111. // given httpFetchParams, includeCredentials, and isNewConnectionFetch.
  19112. const forwardResponse = await httpNetworkFetch(
  19113. httpFetchParams,
  19114. includeCredentials,
  19115. isNewConnectionFetch
  19116. )
  19117. // 3. If httpRequest’s method is unsafe and forwardResponse’s status is
  19118. // in the range 200 to 399, inclusive, invalidate appropriate stored
  19119. // responses in httpCache, as per the "Invalidation" chapter of HTTP
  19120. // Caching, and set storedResponse to null. [HTTP-CACHING]
  19121. if (
  19122. !safeMethodsSet.has(httpRequest.method) &&
  19123. forwardResponse.status >= 200 &&
  19124. forwardResponse.status <= 399
  19125. ) {
  19126. // TODO: cache
  19127. }
  19128. // 4. If the revalidatingFlag is set and forwardResponse’s status is 304,
  19129. // then:
  19130. if (revalidatingFlag && forwardResponse.status === 304) {
  19131. // TODO: cache
  19132. }
  19133. // 5. If response is null, then:
  19134. if (response == null) {
  19135. // 1. Set response to forwardResponse.
  19136. response = forwardResponse
  19137. // 2. Store httpRequest and forwardResponse in httpCache, as per the
  19138. // "Storing Responses in Caches" chapter of HTTP Caching. [HTTP-CACHING]
  19139. // TODO: cache
  19140. }
  19141. }
  19142. // 11. Set response’s URL list to a clone of httpRequest’s URL list.
  19143. response.urlList = [...httpRequest.urlList]
  19144. // 12. If httpRequest’s header list contains `Range`, then set response’s
  19145. // range-requested flag.
  19146. if (httpRequest.headersList.contains('range', true)) {
  19147. response.rangeRequested = true
  19148. }
  19149. // 13. Set response’s request-includes-credentials to includeCredentials.
  19150. response.requestIncludesCredentials = includeCredentials
  19151. // 14. If response’s status is 401, httpRequest’s response tainting is not
  19152. // "cors", includeCredentials is true, and request’s window is an environment
  19153. // settings object, then:
  19154. // TODO
  19155. // 15. If response’s status is 407, then:
  19156. if (response.status === 407) {
  19157. // 1. If request’s window is "no-window", then return a network error.
  19158. if (request.window === 'no-window') {
  19159. return makeNetworkError()
  19160. }
  19161. // 2. ???
  19162. // 3. If fetchParams is canceled, then return the appropriate network error for fetchParams.
  19163. if (isCancelled(fetchParams)) {
  19164. return makeAppropriateNetworkError(fetchParams)
  19165. }
  19166. // 4. Prompt the end user as appropriate in request’s window and store
  19167. // the result as a proxy-authentication entry. [HTTP-AUTH]
  19168. // TODO: Invoke some kind of callback?
  19169. // 5. Set response to the result of running HTTP-network-or-cache fetch given
  19170. // fetchParams.
  19171. // TODO
  19172. return makeNetworkError('proxy authentication required')
  19173. }
  19174. // 16. If all of the following are true
  19175. if (
  19176. // response’s status is 421
  19177. response.status === 421 &&
  19178. // isNewConnectionFetch is false
  19179. !isNewConnectionFetch &&
  19180. // request’s body is null, or request’s body is non-null and request’s body’s source is non-null
  19181. (request.body == null || request.body.source != null)
  19182. ) {
  19183. // then:
  19184. // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
  19185. if (isCancelled(fetchParams)) {
  19186. return makeAppropriateNetworkError(fetchParams)
  19187. }
  19188. // 2. Set response to the result of running HTTP-network-or-cache
  19189. // fetch given fetchParams, isAuthenticationFetch, and true.
  19190. // TODO (spec): The spec doesn't specify this but we need to cancel
  19191. // the active response before we can start a new one.
  19192. // https://github.com/whatwg/fetch/issues/1293
  19193. fetchParams.controller.connection.destroy()
  19194. response = await httpNetworkOrCacheFetch(
  19195. fetchParams,
  19196. isAuthenticationFetch,
  19197. true
  19198. )
  19199. }
  19200. // 17. If isAuthenticationFetch is true, then create an authentication entry
  19201. if (isAuthenticationFetch) {
  19202. // TODO
  19203. }
  19204. // 18. Return response.
  19205. return response
  19206. }
  19207. // https://fetch.spec.whatwg.org/#http-network-fetch
  19208. async function httpNetworkFetch (
  19209. fetchParams,
  19210. includeCredentials = false,
  19211. forceNewConnection = false
  19212. ) {
  19213. assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed)
  19214. fetchParams.controller.connection = {
  19215. abort: null,
  19216. destroyed: false,
  19217. destroy (err, abort = true) {
  19218. if (!this.destroyed) {
  19219. this.destroyed = true
  19220. if (abort) {
  19221. this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError'))
  19222. }
  19223. }
  19224. }
  19225. }
  19226. // 1. Let request be fetchParams’s request.
  19227. const request = fetchParams.request
  19228. // 2. Let response be null.
  19229. let response = null
  19230. // 3. Let timingInfo be fetchParams’s timing info.
  19231. const timingInfo = fetchParams.timingInfo
  19232. // 4. Let httpCache be the result of determining the HTTP cache partition,
  19233. // given request.
  19234. // TODO: cache
  19235. const httpCache = null
  19236. // 5. If httpCache is null, then set request’s cache mode to "no-store".
  19237. if (httpCache == null) {
  19238. request.cache = 'no-store'
  19239. }
  19240. // 6. Let networkPartitionKey be the result of determining the network
  19241. // partition key given request.
  19242. // TODO
  19243. // 7. Let newConnection be "yes" if forceNewConnection is true; otherwise
  19244. // "no".
  19245. const newConnection = forceNewConnection ? 'yes' : 'no' // eslint-disable-line no-unused-vars
  19246. // 8. Switch on request’s mode:
  19247. if (request.mode === 'websocket') {
  19248. // Let connection be the result of obtaining a WebSocket connection,
  19249. // given request’s current URL.
  19250. // TODO
  19251. } else {
  19252. // Let connection be the result of obtaining a connection, given
  19253. // networkPartitionKey, request’s current URL’s origin,
  19254. // includeCredentials, and forceNewConnection.
  19255. // TODO
  19256. }
  19257. // 9. Run these steps, but abort when the ongoing fetch is terminated:
  19258. // 1. If connection is failure, then return a network error.
  19259. // 2. Set timingInfo’s final connection timing info to the result of
  19260. // calling clamp and coarsen connection timing info with connection’s
  19261. // timing info, timingInfo’s post-redirect start time, and fetchParams’s
  19262. // cross-origin isolated capability.
  19263. // 3. If connection is not an HTTP/2 connection, request’s body is non-null,
  19264. // and request’s body’s source is null, then append (`Transfer-Encoding`,
  19265. // `chunked`) to request’s header list.
  19266. // 4. Set timingInfo’s final network-request start time to the coarsened
  19267. // shared current time given fetchParams’s cross-origin isolated
  19268. // capability.
  19269. // 5. Set response to the result of making an HTTP request over connection
  19270. // using request with the following caveats:
  19271. // - Follow the relevant requirements from HTTP. [HTTP] [HTTP-SEMANTICS]
  19272. // [HTTP-COND] [HTTP-CACHING] [HTTP-AUTH]
  19273. // - If request’s body is non-null, and request’s body’s source is null,
  19274. // then the user agent may have a buffer of up to 64 kibibytes and store
  19275. // a part of request’s body in that buffer. If the user agent reads from
  19276. // request’s body beyond that buffer’s size and the user agent needs to
  19277. // resend request, then instead return a network error.
  19278. // - Set timingInfo’s final network-response start time to the coarsened
  19279. // shared current time given fetchParams’s cross-origin isolated capability,
  19280. // immediately after the user agent’s HTTP parser receives the first byte
  19281. // of the response (e.g., frame header bytes for HTTP/2 or response status
  19282. // line for HTTP/1.x).
  19283. // - Wait until all the headers are transmitted.
  19284. // - Any responses whose status is in the range 100 to 199, inclusive,
  19285. // and is not 101, are to be ignored, except for the purposes of setting
  19286. // timingInfo’s final network-response start time above.
  19287. // - If request’s header list contains `Transfer-Encoding`/`chunked` and
  19288. // response is transferred via HTTP/1.0 or older, then return a network
  19289. // error.
  19290. // - If the HTTP request results in a TLS client certificate dialog, then:
  19291. // 1. If request’s window is an environment settings object, make the
  19292. // dialog available in request’s window.
  19293. // 2. Otherwise, return a network error.
  19294. // To transmit request’s body body, run these steps:
  19295. let requestBody = null
  19296. // 1. If body is null and fetchParams’s process request end-of-body is
  19297. // non-null, then queue a fetch task given fetchParams’s process request
  19298. // end-of-body and fetchParams’s task destination.
  19299. if (request.body == null && fetchParams.processRequestEndOfBody) {
  19300. queueMicrotask(() => fetchParams.processRequestEndOfBody())
  19301. } else if (request.body != null) {
  19302. // 2. Otherwise, if body is non-null:
  19303. // 1. Let processBodyChunk given bytes be these steps:
  19304. const processBodyChunk = async function * (bytes) {
  19305. // 1. If the ongoing fetch is terminated, then abort these steps.
  19306. if (isCancelled(fetchParams)) {
  19307. return
  19308. }
  19309. // 2. Run this step in parallel: transmit bytes.
  19310. yield bytes
  19311. // 3. If fetchParams’s process request body is non-null, then run
  19312. // fetchParams’s process request body given bytes’s length.
  19313. fetchParams.processRequestBodyChunkLength?.(bytes.byteLength)
  19314. }
  19315. // 2. Let processEndOfBody be these steps:
  19316. const processEndOfBody = () => {
  19317. // 1. If fetchParams is canceled, then abort these steps.
  19318. if (isCancelled(fetchParams)) {
  19319. return
  19320. }
  19321. // 2. If fetchParams’s process request end-of-body is non-null,
  19322. // then run fetchParams’s process request end-of-body.
  19323. if (fetchParams.processRequestEndOfBody) {
  19324. fetchParams.processRequestEndOfBody()
  19325. }
  19326. }
  19327. // 3. Let processBodyError given e be these steps:
  19328. const processBodyError = (e) => {
  19329. // 1. If fetchParams is canceled, then abort these steps.
  19330. if (isCancelled(fetchParams)) {
  19331. return
  19332. }
  19333. // 2. If e is an "AbortError" DOMException, then abort fetchParams’s controller.
  19334. if (e.name === 'AbortError') {
  19335. fetchParams.controller.abort()
  19336. } else {
  19337. fetchParams.controller.terminate(e)
  19338. }
  19339. }
  19340. // 4. Incrementally read request’s body given processBodyChunk, processEndOfBody,
  19341. // processBodyError, and fetchParams’s task destination.
  19342. requestBody = (async function * () {
  19343. try {
  19344. for await (const bytes of request.body.stream) {
  19345. yield * processBodyChunk(bytes)
  19346. }
  19347. processEndOfBody()
  19348. } catch (err) {
  19349. processBodyError(err)
  19350. }
  19351. })()
  19352. }
  19353. try {
  19354. // socket is only provided for websockets
  19355. const { body, status, statusText, headersList, socket } = await dispatch({ body: requestBody })
  19356. if (socket) {
  19357. response = makeResponse({ status, statusText, headersList, socket })
  19358. } else {
  19359. const iterator = body[Symbol.asyncIterator]()
  19360. fetchParams.controller.next = () => iterator.next()
  19361. response = makeResponse({ status, statusText, headersList })
  19362. }
  19363. } catch (err) {
  19364. // 10. If aborted, then:
  19365. if (err.name === 'AbortError') {
  19366. // 1. If connection uses HTTP/2, then transmit an RST_STREAM frame.
  19367. fetchParams.controller.connection.destroy()
  19368. // 2. Return the appropriate network error for fetchParams.
  19369. return makeAppropriateNetworkError(fetchParams, err)
  19370. }
  19371. return makeNetworkError(err)
  19372. }
  19373. // 11. Let pullAlgorithm be an action that resumes the ongoing fetch
  19374. // if it is suspended.
  19375. const pullAlgorithm = async () => {
  19376. await fetchParams.controller.resume()
  19377. }
  19378. // 12. Let cancelAlgorithm be an algorithm that aborts fetchParams’s
  19379. // controller with reason, given reason.
  19380. const cancelAlgorithm = (reason) => {
  19381. // If the aborted fetch was already terminated, then we do not
  19382. // need to do anything.
  19383. if (!isCancelled(fetchParams)) {
  19384. fetchParams.controller.abort(reason)
  19385. }
  19386. }
  19387. // 13. Let highWaterMark be a non-negative, non-NaN number, chosen by
  19388. // the user agent.
  19389. // TODO
  19390. // 14. Let sizeAlgorithm be an algorithm that accepts a chunk object
  19391. // and returns a non-negative, non-NaN, non-infinite number, chosen by the user agent.
  19392. // TODO
  19393. // 15. Let stream be a new ReadableStream.
  19394. // 16. Set up stream with byte reading support with pullAlgorithm set to pullAlgorithm,
  19395. // cancelAlgorithm set to cancelAlgorithm.
  19396. const stream = new ReadableStream(
  19397. {
  19398. async start (controller) {
  19399. fetchParams.controller.controller = controller
  19400. },
  19401. async pull (controller) {
  19402. await pullAlgorithm(controller)
  19403. },
  19404. async cancel (reason) {
  19405. await cancelAlgorithm(reason)
  19406. },
  19407. type: 'bytes'
  19408. }
  19409. )
  19410. // 17. Run these steps, but abort when the ongoing fetch is terminated:
  19411. // 1. Set response’s body to a new body whose stream is stream.
  19412. response.body = { stream, source: null, length: null }
  19413. // 2. If response is not a network error and request’s cache mode is
  19414. // not "no-store", then update response in httpCache for request.
  19415. // TODO
  19416. // 3. If includeCredentials is true and the user agent is not configured
  19417. // to block cookies for request (see section 7 of [COOKIES]), then run the
  19418. // "set-cookie-string" parsing algorithm (see section 5.2 of [COOKIES]) on
  19419. // the value of each header whose name is a byte-case-insensitive match for
  19420. // `Set-Cookie` in response’s header list, if any, and request’s current URL.
  19421. // TODO
  19422. // 18. If aborted, then:
  19423. // TODO
  19424. // 19. Run these steps in parallel:
  19425. // 1. Run these steps, but abort when fetchParams is canceled:
  19426. fetchParams.controller.onAborted = onAborted
  19427. fetchParams.controller.on('terminated', onAborted)
  19428. fetchParams.controller.resume = async () => {
  19429. // 1. While true
  19430. while (true) {
  19431. // 1-3. See onData...
  19432. // 4. Set bytes to the result of handling content codings given
  19433. // codings and bytes.
  19434. let bytes
  19435. let isFailure
  19436. try {
  19437. const { done, value } = await fetchParams.controller.next()
  19438. if (isAborted(fetchParams)) {
  19439. break
  19440. }
  19441. bytes = done ? undefined : value
  19442. } catch (err) {
  19443. if (fetchParams.controller.ended && !timingInfo.encodedBodySize) {
  19444. // zlib doesn't like empty streams.
  19445. bytes = undefined
  19446. } else {
  19447. bytes = err
  19448. // err may be propagated from the result of calling readablestream.cancel,
  19449. // which might not be an error. https://github.com/nodejs/undici/issues/2009
  19450. isFailure = true
  19451. }
  19452. }
  19453. if (bytes === undefined) {
  19454. // 2. Otherwise, if the bytes transmission for response’s message
  19455. // body is done normally and stream is readable, then close
  19456. // stream, finalize response for fetchParams and response, and
  19457. // abort these in-parallel steps.
  19458. readableStreamClose(fetchParams.controller.controller)
  19459. finalizeResponse(fetchParams, response)
  19460. return
  19461. }
  19462. // 5. Increase timingInfo’s decoded body size by bytes’s length.
  19463. timingInfo.decodedBodySize += bytes?.byteLength ?? 0
  19464. // 6. If bytes is failure, then terminate fetchParams’s controller.
  19465. if (isFailure) {
  19466. fetchParams.controller.terminate(bytes)
  19467. return
  19468. }
  19469. // 7. Enqueue a Uint8Array wrapping an ArrayBuffer containing bytes
  19470. // into stream.
  19471. const buffer = new Uint8Array(bytes)
  19472. if (buffer.byteLength) {
  19473. fetchParams.controller.controller.enqueue(buffer)
  19474. }
  19475. // 8. If stream is errored, then terminate the ongoing fetch.
  19476. if (isErrored(stream)) {
  19477. fetchParams.controller.terminate()
  19478. return
  19479. }
  19480. // 9. If stream doesn’t need more data ask the user agent to suspend
  19481. // the ongoing fetch.
  19482. if (fetchParams.controller.controller.desiredSize <= 0) {
  19483. return
  19484. }
  19485. }
  19486. }
  19487. // 2. If aborted, then:
  19488. function onAborted (reason) {
  19489. // 2. If fetchParams is aborted, then:
  19490. if (isAborted(fetchParams)) {
  19491. // 1. Set response’s aborted flag.
  19492. response.aborted = true
  19493. // 2. If stream is readable, then error stream with the result of
  19494. // deserialize a serialized abort reason given fetchParams’s
  19495. // controller’s serialized abort reason and an
  19496. // implementation-defined realm.
  19497. if (isReadable(stream)) {
  19498. fetchParams.controller.controller.error(
  19499. fetchParams.controller.serializedAbortReason
  19500. )
  19501. }
  19502. } else {
  19503. // 3. Otherwise, if stream is readable, error stream with a TypeError.
  19504. if (isReadable(stream)) {
  19505. fetchParams.controller.controller.error(new TypeError('terminated', {
  19506. cause: isErrorLike(reason) ? reason : undefined
  19507. }))
  19508. }
  19509. }
  19510. // 4. If connection uses HTTP/2, then transmit an RST_STREAM frame.
  19511. // 5. Otherwise, the user agent should close connection unless it would be bad for performance to do so.
  19512. fetchParams.controller.connection.destroy()
  19513. }
  19514. // 20. Return response.
  19515. return response
  19516. function dispatch ({ body }) {
  19517. const url = requestCurrentURL(request)
  19518. /** @type {import('../..').Agent} */
  19519. const agent = fetchParams.controller.dispatcher
  19520. return new Promise((resolve, reject) => agent.dispatch(
  19521. {
  19522. path: url.pathname + url.search,
  19523. origin: url.origin,
  19524. method: request.method,
  19525. body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body,
  19526. headers: request.headersList.entries,
  19527. maxRedirections: 0,
  19528. upgrade: request.mode === 'websocket' ? 'websocket' : undefined
  19529. },
  19530. {
  19531. body: null,
  19532. abort: null,
  19533. onConnect (abort) {
  19534. // TODO (fix): Do we need connection here?
  19535. const { connection } = fetchParams.controller
  19536. // Set timingInfo’s final connection timing info to the result of calling clamp and coarsen
  19537. // connection timing info with connection’s timing info, timingInfo’s post-redirect start
  19538. // time, and fetchParams’s cross-origin isolated capability.
  19539. // TODO: implement connection timing
  19540. timingInfo.finalConnectionTimingInfo = clampAndCoarsenConnectionTimingInfo(undefined, timingInfo.postRedirectStartTime, fetchParams.crossOriginIsolatedCapability)
  19541. if (connection.destroyed) {
  19542. abort(new DOMException('The operation was aborted.', 'AbortError'))
  19543. } else {
  19544. fetchParams.controller.on('terminated', abort)
  19545. this.abort = connection.abort = abort
  19546. }
  19547. // Set timingInfo’s final network-request start time to the coarsened shared current time given
  19548. // fetchParams’s cross-origin isolated capability.
  19549. timingInfo.finalNetworkRequestStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
  19550. },
  19551. onResponseStarted () {
  19552. // Set timingInfo’s final network-response start time to the coarsened shared current
  19553. // time given fetchParams’s cross-origin isolated capability, immediately after the
  19554. // user agent’s HTTP parser receives the first byte of the response (e.g., frame header
  19555. // bytes for HTTP/2 or response status line for HTTP/1.x).
  19556. timingInfo.finalNetworkResponseStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
  19557. },
  19558. onHeaders (status, rawHeaders, resume, statusText) {
  19559. if (status < 200) {
  19560. return
  19561. }
  19562. let location = ''
  19563. const headersList = new HeadersList()
  19564. for (let i = 0; i < rawHeaders.length; i += 2) {
  19565. headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i]), rawHeaders[i + 1].toString('latin1'), true)
  19566. }
  19567. location = headersList.get('location', true)
  19568. this.body = new Readable({ read: resume })
  19569. const decoders = []
  19570. const willFollow = location && request.redirect === 'follow' &&
  19571. redirectStatusSet.has(status)
  19572. // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
  19573. if (request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) {
  19574. // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1
  19575. const contentEncoding = headersList.get('content-encoding', true)
  19576. // "All content-coding values are case-insensitive..."
  19577. /** @type {string[]} */
  19578. const codings = contentEncoding ? contentEncoding.toLowerCase().split(',') : []
  19579. // Limit the number of content-encodings to prevent resource exhaustion.
  19580. // CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
  19581. const maxContentEncodings = 5
  19582. if (codings.length > maxContentEncodings) {
  19583. reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
  19584. return true
  19585. }
  19586. for (let i = codings.length - 1; i >= 0; --i) {
  19587. const coding = codings[i].trim()
  19588. // https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2
  19589. if (coding === 'x-gzip' || coding === 'gzip') {
  19590. decoders.push(zlib.createGunzip({
  19591. // Be less strict when decoding compressed responses, since sometimes
  19592. // servers send slightly invalid responses that are still accepted
  19593. // by common browsers.
  19594. // Always using Z_SYNC_FLUSH is what cURL does.
  19595. flush: zlib.constants.Z_SYNC_FLUSH,
  19596. finishFlush: zlib.constants.Z_SYNC_FLUSH
  19597. }))
  19598. } else if (coding === 'deflate') {
  19599. decoders.push(createInflate({
  19600. flush: zlib.constants.Z_SYNC_FLUSH,
  19601. finishFlush: zlib.constants.Z_SYNC_FLUSH
  19602. }))
  19603. } else if (coding === 'br') {
  19604. decoders.push(zlib.createBrotliDecompress({
  19605. flush: zlib.constants.BROTLI_OPERATION_FLUSH,
  19606. finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
  19607. }))
  19608. } else {
  19609. decoders.length = 0
  19610. break
  19611. }
  19612. }
  19613. }
  19614. const onError = this.onError.bind(this)
  19615. resolve({
  19616. status,
  19617. statusText,
  19618. headersList,
  19619. body: decoders.length
  19620. ? pipeline(this.body, ...decoders, (err) => {
  19621. if (err) {
  19622. this.onError(err)
  19623. }
  19624. }).on('error', onError)
  19625. : this.body.on('error', onError)
  19626. })
  19627. return true
  19628. },
  19629. onData (chunk) {
  19630. if (fetchParams.controller.dump) {
  19631. return
  19632. }
  19633. // 1. If one or more bytes have been transmitted from response’s
  19634. // message body, then:
  19635. // 1. Let bytes be the transmitted bytes.
  19636. const bytes = chunk
  19637. // 2. Let codings be the result of extracting header list values
  19638. // given `Content-Encoding` and response’s header list.
  19639. // See pullAlgorithm.
  19640. // 3. Increase timingInfo’s encoded body size by bytes’s length.
  19641. timingInfo.encodedBodySize += bytes.byteLength
  19642. // 4. See pullAlgorithm...
  19643. return this.body.push(bytes)
  19644. },
  19645. onComplete () {
  19646. if (this.abort) {
  19647. fetchParams.controller.off('terminated', this.abort)
  19648. }
  19649. if (fetchParams.controller.onAborted) {
  19650. fetchParams.controller.off('terminated', fetchParams.controller.onAborted)
  19651. }
  19652. fetchParams.controller.ended = true
  19653. this.body.push(null)
  19654. },
  19655. onError (error) {
  19656. if (this.abort) {
  19657. fetchParams.controller.off('terminated', this.abort)
  19658. }
  19659. this.body?.destroy(error)
  19660. fetchParams.controller.terminate(error)
  19661. reject(error)
  19662. },
  19663. onUpgrade (status, rawHeaders, socket) {
  19664. if (status !== 101) {
  19665. return
  19666. }
  19667. const headersList = new HeadersList()
  19668. for (let i = 0; i < rawHeaders.length; i += 2) {
  19669. headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i]), rawHeaders[i + 1].toString('latin1'), true)
  19670. }
  19671. resolve({
  19672. status,
  19673. statusText: STATUS_CODES[status],
  19674. headersList,
  19675. socket
  19676. })
  19677. return true
  19678. }
  19679. }
  19680. ))
  19681. }
  19682. }
  19683. module.exports = {
  19684. fetch,
  19685. Fetch,
  19686. fetching,
  19687. finalizeAndReportTiming
  19688. }
  19689. /***/ }),
  19690. /***/ 9967:
  19691. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  19692. /* globals AbortController */
  19693. const { extractBody, mixinBody, cloneBody, bodyUnusable } = __nccwpck_require__(4492)
  19694. const { Headers, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = __nccwpck_require__(660)
  19695. const { FinalizationRegistry } = __nccwpck_require__(6653)()
  19696. const util = __nccwpck_require__(3440)
  19697. const nodeUtil = __nccwpck_require__(7975)
  19698. const {
  19699. isValidHTTPToken,
  19700. sameOrigin,
  19701. environmentSettingsObject
  19702. } = __nccwpck_require__(3168)
  19703. const {
  19704. forbiddenMethodsSet,
  19705. corsSafeListedMethodsSet,
  19706. referrerPolicy,
  19707. requestRedirect,
  19708. requestMode,
  19709. requestCredentials,
  19710. requestCache,
  19711. requestDuplex
  19712. } = __nccwpck_require__(4495)
  19713. const { kEnumerableProperty, normalizedMethodRecordsBase, normalizedMethodRecords } = util
  19714. const { kHeaders, kSignal, kState, kDispatcher } = __nccwpck_require__(3627)
  19715. const { webidl } = __nccwpck_require__(5893)
  19716. const { URLSerializer } = __nccwpck_require__(1900)
  19717. const { kConstruct } = __nccwpck_require__(6443)
  19718. const assert = __nccwpck_require__(4589)
  19719. const { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __nccwpck_require__(8474)
  19720. const kAbortController = Symbol('abortController')
  19721. const requestFinalizer = new FinalizationRegistry(({ signal, abort }) => {
  19722. signal.removeEventListener('abort', abort)
  19723. })
  19724. const dependentControllerMap = new WeakMap()
  19725. function buildAbort (acRef) {
  19726. return abort
  19727. function abort () {
  19728. const ac = acRef.deref()
  19729. if (ac !== undefined) {
  19730. // Currently, there is a problem with FinalizationRegistry.
  19731. // https://github.com/nodejs/node/issues/49344
  19732. // https://github.com/nodejs/node/issues/47748
  19733. // In the case of abort, the first step is to unregister from it.
  19734. // If the controller can refer to it, it is still registered.
  19735. // It will be removed in the future.
  19736. requestFinalizer.unregister(abort)
  19737. // Unsubscribe a listener.
  19738. // FinalizationRegistry will no longer be called, so this must be done.
  19739. this.removeEventListener('abort', abort)
  19740. ac.abort(this.reason)
  19741. const controllerList = dependentControllerMap.get(ac.signal)
  19742. if (controllerList !== undefined) {
  19743. if (controllerList.size !== 0) {
  19744. for (const ref of controllerList) {
  19745. const ctrl = ref.deref()
  19746. if (ctrl !== undefined) {
  19747. ctrl.abort(this.reason)
  19748. }
  19749. }
  19750. controllerList.clear()
  19751. }
  19752. dependentControllerMap.delete(ac.signal)
  19753. }
  19754. }
  19755. }
  19756. }
  19757. let patchMethodWarning = false
  19758. // https://fetch.spec.whatwg.org/#request-class
  19759. class Request {
  19760. // https://fetch.spec.whatwg.org/#dom-request
  19761. constructor (input, init = {}) {
  19762. webidl.util.markAsUncloneable(this)
  19763. if (input === kConstruct) {
  19764. return
  19765. }
  19766. const prefix = 'Request constructor'
  19767. webidl.argumentLengthCheck(arguments, 1, prefix)
  19768. input = webidl.converters.RequestInfo(input, prefix, 'input')
  19769. init = webidl.converters.RequestInit(init, prefix, 'init')
  19770. // 1. Let request be null.
  19771. let request = null
  19772. // 2. Let fallbackMode be null.
  19773. let fallbackMode = null
  19774. // 3. Let baseURL be this’s relevant settings object’s API base URL.
  19775. const baseUrl = environmentSettingsObject.settingsObject.baseUrl
  19776. // 4. Let signal be null.
  19777. let signal = null
  19778. // 5. If input is a string, then:
  19779. if (typeof input === 'string') {
  19780. this[kDispatcher] = init.dispatcher
  19781. // 1. Let parsedURL be the result of parsing input with baseURL.
  19782. // 2. If parsedURL is failure, then throw a TypeError.
  19783. let parsedURL
  19784. try {
  19785. parsedURL = new URL(input, baseUrl)
  19786. } catch (err) {
  19787. throw new TypeError('Failed to parse URL from ' + input, { cause: err })
  19788. }
  19789. // 3. If parsedURL includes credentials, then throw a TypeError.
  19790. if (parsedURL.username || parsedURL.password) {
  19791. throw new TypeError(
  19792. 'Request cannot be constructed from a URL that includes credentials: ' +
  19793. input
  19794. )
  19795. }
  19796. // 4. Set request to a new request whose URL is parsedURL.
  19797. request = makeRequest({ urlList: [parsedURL] })
  19798. // 5. Set fallbackMode to "cors".
  19799. fallbackMode = 'cors'
  19800. } else {
  19801. this[kDispatcher] = init.dispatcher || input[kDispatcher]
  19802. // 6. Otherwise:
  19803. // 7. Assert: input is a Request object.
  19804. assert(input instanceof Request)
  19805. // 8. Set request to input’s request.
  19806. request = input[kState]
  19807. // 9. Set signal to input’s signal.
  19808. signal = input[kSignal]
  19809. }
  19810. // 7. Let origin be this’s relevant settings object’s origin.
  19811. const origin = environmentSettingsObject.settingsObject.origin
  19812. // 8. Let window be "client".
  19813. let window = 'client'
  19814. // 9. If request’s window is an environment settings object and its origin
  19815. // is same origin with origin, then set window to request’s window.
  19816. if (
  19817. request.window?.constructor?.name === 'EnvironmentSettingsObject' &&
  19818. sameOrigin(request.window, origin)
  19819. ) {
  19820. window = request.window
  19821. }
  19822. // 10. If init["window"] exists and is non-null, then throw a TypeError.
  19823. if (init.window != null) {
  19824. throw new TypeError(`'window' option '${window}' must be null`)
  19825. }
  19826. // 11. If init["window"] exists, then set window to "no-window".
  19827. if ('window' in init) {
  19828. window = 'no-window'
  19829. }
  19830. // 12. Set request to a new request with the following properties:
  19831. request = makeRequest({
  19832. // URL request’s URL.
  19833. // undici implementation note: this is set as the first item in request's urlList in makeRequest
  19834. // method request’s method.
  19835. method: request.method,
  19836. // header list A copy of request’s header list.
  19837. // undici implementation note: headersList is cloned in makeRequest
  19838. headersList: request.headersList,
  19839. // unsafe-request flag Set.
  19840. unsafeRequest: request.unsafeRequest,
  19841. // client This’s relevant settings object.
  19842. client: environmentSettingsObject.settingsObject,
  19843. // window window.
  19844. window,
  19845. // priority request’s priority.
  19846. priority: request.priority,
  19847. // origin request’s origin. The propagation of the origin is only significant for navigation requests
  19848. // being handled by a service worker. In this scenario a request can have an origin that is different
  19849. // from the current client.
  19850. origin: request.origin,
  19851. // referrer request’s referrer.
  19852. referrer: request.referrer,
  19853. // referrer policy request’s referrer policy.
  19854. referrerPolicy: request.referrerPolicy,
  19855. // mode request’s mode.
  19856. mode: request.mode,
  19857. // credentials mode request’s credentials mode.
  19858. credentials: request.credentials,
  19859. // cache mode request’s cache mode.
  19860. cache: request.cache,
  19861. // redirect mode request’s redirect mode.
  19862. redirect: request.redirect,
  19863. // integrity metadata request’s integrity metadata.
  19864. integrity: request.integrity,
  19865. // keepalive request’s keepalive.
  19866. keepalive: request.keepalive,
  19867. // reload-navigation flag request’s reload-navigation flag.
  19868. reloadNavigation: request.reloadNavigation,
  19869. // history-navigation flag request’s history-navigation flag.
  19870. historyNavigation: request.historyNavigation,
  19871. // URL list A clone of request’s URL list.
  19872. urlList: [...request.urlList]
  19873. })
  19874. const initHasKey = Object.keys(init).length !== 0
  19875. // 13. If init is not empty, then:
  19876. if (initHasKey) {
  19877. // 1. If request’s mode is "navigate", then set it to "same-origin".
  19878. if (request.mode === 'navigate') {
  19879. request.mode = 'same-origin'
  19880. }
  19881. // 2. Unset request’s reload-navigation flag.
  19882. request.reloadNavigation = false
  19883. // 3. Unset request’s history-navigation flag.
  19884. request.historyNavigation = false
  19885. // 4. Set request’s origin to "client".
  19886. request.origin = 'client'
  19887. // 5. Set request’s referrer to "client"
  19888. request.referrer = 'client'
  19889. // 6. Set request’s referrer policy to the empty string.
  19890. request.referrerPolicy = ''
  19891. // 7. Set request’s URL to request’s current URL.
  19892. request.url = request.urlList[request.urlList.length - 1]
  19893. // 8. Set request’s URL list to « request’s URL ».
  19894. request.urlList = [request.url]
  19895. }
  19896. // 14. If init["referrer"] exists, then:
  19897. if (init.referrer !== undefined) {
  19898. // 1. Let referrer be init["referrer"].
  19899. const referrer = init.referrer
  19900. // 2. If referrer is the empty string, then set request’s referrer to "no-referrer".
  19901. if (referrer === '') {
  19902. request.referrer = 'no-referrer'
  19903. } else {
  19904. // 1. Let parsedReferrer be the result of parsing referrer with
  19905. // baseURL.
  19906. // 2. If parsedReferrer is failure, then throw a TypeError.
  19907. let parsedReferrer
  19908. try {
  19909. parsedReferrer = new URL(referrer, baseUrl)
  19910. } catch (err) {
  19911. throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err })
  19912. }
  19913. // 3. If one of the following is true
  19914. // - parsedReferrer’s scheme is "about" and path is the string "client"
  19915. // - parsedReferrer’s origin is not same origin with origin
  19916. // then set request’s referrer to "client".
  19917. if (
  19918. (parsedReferrer.protocol === 'about:' && parsedReferrer.hostname === 'client') ||
  19919. (origin && !sameOrigin(parsedReferrer, environmentSettingsObject.settingsObject.baseUrl))
  19920. ) {
  19921. request.referrer = 'client'
  19922. } else {
  19923. // 4. Otherwise, set request’s referrer to parsedReferrer.
  19924. request.referrer = parsedReferrer
  19925. }
  19926. }
  19927. }
  19928. // 15. If init["referrerPolicy"] exists, then set request’s referrer policy
  19929. // to it.
  19930. if (init.referrerPolicy !== undefined) {
  19931. request.referrerPolicy = init.referrerPolicy
  19932. }
  19933. // 16. Let mode be init["mode"] if it exists, and fallbackMode otherwise.
  19934. let mode
  19935. if (init.mode !== undefined) {
  19936. mode = init.mode
  19937. } else {
  19938. mode = fallbackMode
  19939. }
  19940. // 17. If mode is "navigate", then throw a TypeError.
  19941. if (mode === 'navigate') {
  19942. throw webidl.errors.exception({
  19943. header: 'Request constructor',
  19944. message: 'invalid request mode navigate.'
  19945. })
  19946. }
  19947. // 18. If mode is non-null, set request’s mode to mode.
  19948. if (mode != null) {
  19949. request.mode = mode
  19950. }
  19951. // 19. If init["credentials"] exists, then set request’s credentials mode
  19952. // to it.
  19953. if (init.credentials !== undefined) {
  19954. request.credentials = init.credentials
  19955. }
  19956. // 18. If init["cache"] exists, then set request’s cache mode to it.
  19957. if (init.cache !== undefined) {
  19958. request.cache = init.cache
  19959. }
  19960. // 21. If request’s cache mode is "only-if-cached" and request’s mode is
  19961. // not "same-origin", then throw a TypeError.
  19962. if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
  19963. throw new TypeError(
  19964. "'only-if-cached' can be set only with 'same-origin' mode"
  19965. )
  19966. }
  19967. // 22. If init["redirect"] exists, then set request’s redirect mode to it.
  19968. if (init.redirect !== undefined) {
  19969. request.redirect = init.redirect
  19970. }
  19971. // 23. If init["integrity"] exists, then set request’s integrity metadata to it.
  19972. if (init.integrity != null) {
  19973. request.integrity = String(init.integrity)
  19974. }
  19975. // 24. If init["keepalive"] exists, then set request’s keepalive to it.
  19976. if (init.keepalive !== undefined) {
  19977. request.keepalive = Boolean(init.keepalive)
  19978. }
  19979. // 25. If init["method"] exists, then:
  19980. if (init.method !== undefined) {
  19981. // 1. Let method be init["method"].
  19982. let method = init.method
  19983. const mayBeNormalized = normalizedMethodRecords[method]
  19984. if (mayBeNormalized !== undefined) {
  19985. // Note: Bypass validation DELETE, GET, HEAD, OPTIONS, POST, PUT, PATCH and these lowercase ones
  19986. request.method = mayBeNormalized
  19987. } else {
  19988. // 2. If method is not a method or method is a forbidden method, then
  19989. // throw a TypeError.
  19990. if (!isValidHTTPToken(method)) {
  19991. throw new TypeError(`'${method}' is not a valid HTTP method.`)
  19992. }
  19993. const upperCase = method.toUpperCase()
  19994. if (forbiddenMethodsSet.has(upperCase)) {
  19995. throw new TypeError(`'${method}' HTTP method is unsupported.`)
  19996. }
  19997. // 3. Normalize method.
  19998. // https://fetch.spec.whatwg.org/#concept-method-normalize
  19999. // Note: must be in uppercase
  20000. method = normalizedMethodRecordsBase[upperCase] ?? method
  20001. // 4. Set request’s method to method.
  20002. request.method = method
  20003. }
  20004. if (!patchMethodWarning && request.method === 'patch') {
  20005. process.emitWarning('Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.', {
  20006. code: 'UNDICI-FETCH-patch'
  20007. })
  20008. patchMethodWarning = true
  20009. }
  20010. }
  20011. // 26. If init["signal"] exists, then set signal to it.
  20012. if (init.signal !== undefined) {
  20013. signal = init.signal
  20014. }
  20015. // 27. Set this’s request to request.
  20016. this[kState] = request
  20017. // 28. Set this’s signal to a new AbortSignal object with this’s relevant
  20018. // Realm.
  20019. // TODO: could this be simplified with AbortSignal.any
  20020. // (https://dom.spec.whatwg.org/#dom-abortsignal-any)
  20021. const ac = new AbortController()
  20022. this[kSignal] = ac.signal
  20023. // 29. If signal is not null, then make this’s signal follow signal.
  20024. if (signal != null) {
  20025. if (
  20026. !signal ||
  20027. typeof signal.aborted !== 'boolean' ||
  20028. typeof signal.addEventListener !== 'function'
  20029. ) {
  20030. throw new TypeError(
  20031. "Failed to construct 'Request': member signal is not of type AbortSignal."
  20032. )
  20033. }
  20034. if (signal.aborted) {
  20035. ac.abort(signal.reason)
  20036. } else {
  20037. // Keep a strong ref to ac while request object
  20038. // is alive. This is needed to prevent AbortController
  20039. // from being prematurely garbage collected.
  20040. // See, https://github.com/nodejs/undici/issues/1926.
  20041. this[kAbortController] = ac
  20042. const acRef = new WeakRef(ac)
  20043. const abort = buildAbort(acRef)
  20044. // Third-party AbortControllers may not work with these.
  20045. // See, https://github.com/nodejs/undici/pull/1910#issuecomment-1464495619.
  20046. try {
  20047. // If the max amount of listeners is equal to the default, increase it
  20048. // This is only available in node >= v19.9.0
  20049. if (typeof getMaxListeners === 'function' && getMaxListeners(signal) === defaultMaxListeners) {
  20050. setMaxListeners(1500, signal)
  20051. } else if (getEventListeners(signal, 'abort').length >= defaultMaxListeners) {
  20052. setMaxListeners(1500, signal)
  20053. }
  20054. } catch {}
  20055. util.addAbortListener(signal, abort)
  20056. // The third argument must be a registry key to be unregistered.
  20057. // Without it, you cannot unregister.
  20058. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
  20059. // abort is used as the unregister key. (because it is unique)
  20060. requestFinalizer.register(ac, { signal, abort }, abort)
  20061. }
  20062. }
  20063. // 30. Set this’s headers to a new Headers object with this’s relevant
  20064. // Realm, whose header list is request’s header list and guard is
  20065. // "request".
  20066. this[kHeaders] = new Headers(kConstruct)
  20067. setHeadersList(this[kHeaders], request.headersList)
  20068. setHeadersGuard(this[kHeaders], 'request')
  20069. // 31. If this’s request’s mode is "no-cors", then:
  20070. if (mode === 'no-cors') {
  20071. // 1. If this’s request’s method is not a CORS-safelisted method,
  20072. // then throw a TypeError.
  20073. if (!corsSafeListedMethodsSet.has(request.method)) {
  20074. throw new TypeError(
  20075. `'${request.method} is unsupported in no-cors mode.`
  20076. )
  20077. }
  20078. // 2. Set this’s headers’s guard to "request-no-cors".
  20079. setHeadersGuard(this[kHeaders], 'request-no-cors')
  20080. }
  20081. // 32. If init is not empty, then:
  20082. if (initHasKey) {
  20083. /** @type {HeadersList} */
  20084. const headersList = getHeadersList(this[kHeaders])
  20085. // 1. Let headers be a copy of this’s headers and its associated header
  20086. // list.
  20087. // 2. If init["headers"] exists, then set headers to init["headers"].
  20088. const headers = init.headers !== undefined ? init.headers : new HeadersList(headersList)
  20089. // 3. Empty this’s headers’s header list.
  20090. headersList.clear()
  20091. // 4. If headers is a Headers object, then for each header in its header
  20092. // list, append header’s name/header’s value to this’s headers.
  20093. if (headers instanceof HeadersList) {
  20094. for (const { name, value } of headers.rawValues()) {
  20095. headersList.append(name, value, false)
  20096. }
  20097. // Note: Copy the `set-cookie` meta-data.
  20098. headersList.cookies = headers.cookies
  20099. } else {
  20100. // 5. Otherwise, fill this’s headers with headers.
  20101. fillHeaders(this[kHeaders], headers)
  20102. }
  20103. }
  20104. // 33. Let inputBody be input’s request’s body if input is a Request
  20105. // object; otherwise null.
  20106. const inputBody = input instanceof Request ? input[kState].body : null
  20107. // 34. If either init["body"] exists and is non-null or inputBody is
  20108. // non-null, and request’s method is `GET` or `HEAD`, then throw a
  20109. // TypeError.
  20110. if (
  20111. (init.body != null || inputBody != null) &&
  20112. (request.method === 'GET' || request.method === 'HEAD')
  20113. ) {
  20114. throw new TypeError('Request with GET/HEAD method cannot have body.')
  20115. }
  20116. // 35. Let initBody be null.
  20117. let initBody = null
  20118. // 36. If init["body"] exists and is non-null, then:
  20119. if (init.body != null) {
  20120. // 1. Let Content-Type be null.
  20121. // 2. Set initBody and Content-Type to the result of extracting
  20122. // init["body"], with keepalive set to request’s keepalive.
  20123. const [extractedBody, contentType] = extractBody(
  20124. init.body,
  20125. request.keepalive
  20126. )
  20127. initBody = extractedBody
  20128. // 3, If Content-Type is non-null and this’s headers’s header list does
  20129. // not contain `Content-Type`, then append `Content-Type`/Content-Type to
  20130. // this’s headers.
  20131. if (contentType && !getHeadersList(this[kHeaders]).contains('content-type', true)) {
  20132. this[kHeaders].append('content-type', contentType)
  20133. }
  20134. }
  20135. // 37. Let inputOrInitBody be initBody if it is non-null; otherwise
  20136. // inputBody.
  20137. const inputOrInitBody = initBody ?? inputBody
  20138. // 38. If inputOrInitBody is non-null and inputOrInitBody’s source is
  20139. // null, then:
  20140. if (inputOrInitBody != null && inputOrInitBody.source == null) {
  20141. // 1. If initBody is non-null and init["duplex"] does not exist,
  20142. // then throw a TypeError.
  20143. if (initBody != null && init.duplex == null) {
  20144. throw new TypeError('RequestInit: duplex option is required when sending a body.')
  20145. }
  20146. // 2. If this’s request’s mode is neither "same-origin" nor "cors",
  20147. // then throw a TypeError.
  20148. if (request.mode !== 'same-origin' && request.mode !== 'cors') {
  20149. throw new TypeError(
  20150. 'If request is made from ReadableStream, mode should be "same-origin" or "cors"'
  20151. )
  20152. }
  20153. // 3. Set this’s request’s use-CORS-preflight flag.
  20154. request.useCORSPreflightFlag = true
  20155. }
  20156. // 39. Let finalBody be inputOrInitBody.
  20157. let finalBody = inputOrInitBody
  20158. // 40. If initBody is null and inputBody is non-null, then:
  20159. if (initBody == null && inputBody != null) {
  20160. // 1. If input is unusable, then throw a TypeError.
  20161. if (bodyUnusable(input)) {
  20162. throw new TypeError(
  20163. 'Cannot construct a Request with a Request object that has already been used.'
  20164. )
  20165. }
  20166. // 2. Set finalBody to the result of creating a proxy for inputBody.
  20167. // https://streams.spec.whatwg.org/#readablestream-create-a-proxy
  20168. const identityTransform = new TransformStream()
  20169. inputBody.stream.pipeThrough(identityTransform)
  20170. finalBody = {
  20171. source: inputBody.source,
  20172. length: inputBody.length,
  20173. stream: identityTransform.readable
  20174. }
  20175. }
  20176. // 41. Set this’s request’s body to finalBody.
  20177. this[kState].body = finalBody
  20178. }
  20179. // Returns request’s HTTP method, which is "GET" by default.
  20180. get method () {
  20181. webidl.brandCheck(this, Request)
  20182. // The method getter steps are to return this’s request’s method.
  20183. return this[kState].method
  20184. }
  20185. // Returns the URL of request as a string.
  20186. get url () {
  20187. webidl.brandCheck(this, Request)
  20188. // The url getter steps are to return this’s request’s URL, serialized.
  20189. return URLSerializer(this[kState].url)
  20190. }
  20191. // Returns a Headers object consisting of the headers associated with request.
  20192. // Note that headers added in the network layer by the user agent will not
  20193. // be accounted for in this object, e.g., the "Host" header.
  20194. get headers () {
  20195. webidl.brandCheck(this, Request)
  20196. // The headers getter steps are to return this’s headers.
  20197. return this[kHeaders]
  20198. }
  20199. // Returns the kind of resource requested by request, e.g., "document"
  20200. // or "script".
  20201. get destination () {
  20202. webidl.brandCheck(this, Request)
  20203. // The destination getter are to return this’s request’s destination.
  20204. return this[kState].destination
  20205. }
  20206. // Returns the referrer of request. Its value can be a same-origin URL if
  20207. // explicitly set in init, the empty string to indicate no referrer, and
  20208. // "about:client" when defaulting to the global’s default. This is used
  20209. // during fetching to determine the value of the `Referer` header of the
  20210. // request being made.
  20211. get referrer () {
  20212. webidl.brandCheck(this, Request)
  20213. // 1. If this’s request’s referrer is "no-referrer", then return the
  20214. // empty string.
  20215. if (this[kState].referrer === 'no-referrer') {
  20216. return ''
  20217. }
  20218. // 2. If this’s request’s referrer is "client", then return
  20219. // "about:client".
  20220. if (this[kState].referrer === 'client') {
  20221. return 'about:client'
  20222. }
  20223. // Return this’s request’s referrer, serialized.
  20224. return this[kState].referrer.toString()
  20225. }
  20226. // Returns the referrer policy associated with request.
  20227. // This is used during fetching to compute the value of the request’s
  20228. // referrer.
  20229. get referrerPolicy () {
  20230. webidl.brandCheck(this, Request)
  20231. // The referrerPolicy getter steps are to return this’s request’s referrer policy.
  20232. return this[kState].referrerPolicy
  20233. }
  20234. // Returns the mode associated with request, which is a string indicating
  20235. // whether the request will use CORS, or will be restricted to same-origin
  20236. // URLs.
  20237. get mode () {
  20238. webidl.brandCheck(this, Request)
  20239. // The mode getter steps are to return this’s request’s mode.
  20240. return this[kState].mode
  20241. }
  20242. // Returns the credentials mode associated with request,
  20243. // which is a string indicating whether credentials will be sent with the
  20244. // request always, never, or only when sent to a same-origin URL.
  20245. get credentials () {
  20246. // The credentials getter steps are to return this’s request’s credentials mode.
  20247. return this[kState].credentials
  20248. }
  20249. // Returns the cache mode associated with request,
  20250. // which is a string indicating how the request will
  20251. // interact with the browser’s cache when fetching.
  20252. get cache () {
  20253. webidl.brandCheck(this, Request)
  20254. // The cache getter steps are to return this’s request’s cache mode.
  20255. return this[kState].cache
  20256. }
  20257. // Returns the redirect mode associated with request,
  20258. // which is a string indicating how redirects for the
  20259. // request will be handled during fetching. A request
  20260. // will follow redirects by default.
  20261. get redirect () {
  20262. webidl.brandCheck(this, Request)
  20263. // The redirect getter steps are to return this’s request’s redirect mode.
  20264. return this[kState].redirect
  20265. }
  20266. // Returns request’s subresource integrity metadata, which is a
  20267. // cryptographic hash of the resource being fetched. Its value
  20268. // consists of multiple hashes separated by whitespace. [SRI]
  20269. get integrity () {
  20270. webidl.brandCheck(this, Request)
  20271. // The integrity getter steps are to return this’s request’s integrity
  20272. // metadata.
  20273. return this[kState].integrity
  20274. }
  20275. // Returns a boolean indicating whether or not request can outlive the
  20276. // global in which it was created.
  20277. get keepalive () {
  20278. webidl.brandCheck(this, Request)
  20279. // The keepalive getter steps are to return this’s request’s keepalive.
  20280. return this[kState].keepalive
  20281. }
  20282. // Returns a boolean indicating whether or not request is for a reload
  20283. // navigation.
  20284. get isReloadNavigation () {
  20285. webidl.brandCheck(this, Request)
  20286. // The isReloadNavigation getter steps are to return true if this’s
  20287. // request’s reload-navigation flag is set; otherwise false.
  20288. return this[kState].reloadNavigation
  20289. }
  20290. // Returns a boolean indicating whether or not request is for a history
  20291. // navigation (a.k.a. back-forward navigation).
  20292. get isHistoryNavigation () {
  20293. webidl.brandCheck(this, Request)
  20294. // The isHistoryNavigation getter steps are to return true if this’s request’s
  20295. // history-navigation flag is set; otherwise false.
  20296. return this[kState].historyNavigation
  20297. }
  20298. // Returns the signal associated with request, which is an AbortSignal
  20299. // object indicating whether or not request has been aborted, and its
  20300. // abort event handler.
  20301. get signal () {
  20302. webidl.brandCheck(this, Request)
  20303. // The signal getter steps are to return this’s signal.
  20304. return this[kSignal]
  20305. }
  20306. get body () {
  20307. webidl.brandCheck(this, Request)
  20308. return this[kState].body ? this[kState].body.stream : null
  20309. }
  20310. get bodyUsed () {
  20311. webidl.brandCheck(this, Request)
  20312. return !!this[kState].body && util.isDisturbed(this[kState].body.stream)
  20313. }
  20314. get duplex () {
  20315. webidl.brandCheck(this, Request)
  20316. return 'half'
  20317. }
  20318. // Returns a clone of request.
  20319. clone () {
  20320. webidl.brandCheck(this, Request)
  20321. // 1. If this is unusable, then throw a TypeError.
  20322. if (bodyUnusable(this)) {
  20323. throw new TypeError('unusable')
  20324. }
  20325. // 2. Let clonedRequest be the result of cloning this’s request.
  20326. const clonedRequest = cloneRequest(this[kState])
  20327. // 3. Let clonedRequestObject be the result of creating a Request object,
  20328. // given clonedRequest, this’s headers’s guard, and this’s relevant Realm.
  20329. // 4. Make clonedRequestObject’s signal follow this’s signal.
  20330. const ac = new AbortController()
  20331. if (this.signal.aborted) {
  20332. ac.abort(this.signal.reason)
  20333. } else {
  20334. let list = dependentControllerMap.get(this.signal)
  20335. if (list === undefined) {
  20336. list = new Set()
  20337. dependentControllerMap.set(this.signal, list)
  20338. }
  20339. const acRef = new WeakRef(ac)
  20340. list.add(acRef)
  20341. util.addAbortListener(
  20342. ac.signal,
  20343. buildAbort(acRef)
  20344. )
  20345. }
  20346. // 4. Return clonedRequestObject.
  20347. return fromInnerRequest(clonedRequest, ac.signal, getHeadersGuard(this[kHeaders]))
  20348. }
  20349. [nodeUtil.inspect.custom] (depth, options) {
  20350. if (options.depth === null) {
  20351. options.depth = 2
  20352. }
  20353. options.colors ??= true
  20354. const properties = {
  20355. method: this.method,
  20356. url: this.url,
  20357. headers: this.headers,
  20358. destination: this.destination,
  20359. referrer: this.referrer,
  20360. referrerPolicy: this.referrerPolicy,
  20361. mode: this.mode,
  20362. credentials: this.credentials,
  20363. cache: this.cache,
  20364. redirect: this.redirect,
  20365. integrity: this.integrity,
  20366. keepalive: this.keepalive,
  20367. isReloadNavigation: this.isReloadNavigation,
  20368. isHistoryNavigation: this.isHistoryNavigation,
  20369. signal: this.signal
  20370. }
  20371. return `Request ${nodeUtil.formatWithOptions(options, properties)}`
  20372. }
  20373. }
  20374. mixinBody(Request)
  20375. // https://fetch.spec.whatwg.org/#requests
  20376. function makeRequest (init) {
  20377. return {
  20378. method: init.method ?? 'GET',
  20379. localURLsOnly: init.localURLsOnly ?? false,
  20380. unsafeRequest: init.unsafeRequest ?? false,
  20381. body: init.body ?? null,
  20382. client: init.client ?? null,
  20383. reservedClient: init.reservedClient ?? null,
  20384. replacesClientId: init.replacesClientId ?? '',
  20385. window: init.window ?? 'client',
  20386. keepalive: init.keepalive ?? false,
  20387. serviceWorkers: init.serviceWorkers ?? 'all',
  20388. initiator: init.initiator ?? '',
  20389. destination: init.destination ?? '',
  20390. priority: init.priority ?? null,
  20391. origin: init.origin ?? 'client',
  20392. policyContainer: init.policyContainer ?? 'client',
  20393. referrer: init.referrer ?? 'client',
  20394. referrerPolicy: init.referrerPolicy ?? '',
  20395. mode: init.mode ?? 'no-cors',
  20396. useCORSPreflightFlag: init.useCORSPreflightFlag ?? false,
  20397. credentials: init.credentials ?? 'same-origin',
  20398. useCredentials: init.useCredentials ?? false,
  20399. cache: init.cache ?? 'default',
  20400. redirect: init.redirect ?? 'follow',
  20401. integrity: init.integrity ?? '',
  20402. cryptoGraphicsNonceMetadata: init.cryptoGraphicsNonceMetadata ?? '',
  20403. parserMetadata: init.parserMetadata ?? '',
  20404. reloadNavigation: init.reloadNavigation ?? false,
  20405. historyNavigation: init.historyNavigation ?? false,
  20406. userActivation: init.userActivation ?? false,
  20407. taintedOrigin: init.taintedOrigin ?? false,
  20408. redirectCount: init.redirectCount ?? 0,
  20409. responseTainting: init.responseTainting ?? 'basic',
  20410. preventNoCacheCacheControlHeaderModification: init.preventNoCacheCacheControlHeaderModification ?? false,
  20411. done: init.done ?? false,
  20412. timingAllowFailed: init.timingAllowFailed ?? false,
  20413. urlList: init.urlList,
  20414. url: init.urlList[0],
  20415. headersList: init.headersList
  20416. ? new HeadersList(init.headersList)
  20417. : new HeadersList()
  20418. }
  20419. }
  20420. // https://fetch.spec.whatwg.org/#concept-request-clone
  20421. function cloneRequest (request) {
  20422. // To clone a request request, run these steps:
  20423. // 1. Let newRequest be a copy of request, except for its body.
  20424. const newRequest = makeRequest({ ...request, body: null })
  20425. // 2. If request’s body is non-null, set newRequest’s body to the
  20426. // result of cloning request’s body.
  20427. if (request.body != null) {
  20428. newRequest.body = cloneBody(newRequest, request.body)
  20429. }
  20430. // 3. Return newRequest.
  20431. return newRequest
  20432. }
  20433. /**
  20434. * @see https://fetch.spec.whatwg.org/#request-create
  20435. * @param {any} innerRequest
  20436. * @param {AbortSignal} signal
  20437. * @param {'request' | 'immutable' | 'request-no-cors' | 'response' | 'none'} guard
  20438. * @returns {Request}
  20439. */
  20440. function fromInnerRequest (innerRequest, signal, guard) {
  20441. const request = new Request(kConstruct)
  20442. request[kState] = innerRequest
  20443. request[kSignal] = signal
  20444. request[kHeaders] = new Headers(kConstruct)
  20445. setHeadersList(request[kHeaders], innerRequest.headersList)
  20446. setHeadersGuard(request[kHeaders], guard)
  20447. return request
  20448. }
  20449. Object.defineProperties(Request.prototype, {
  20450. method: kEnumerableProperty,
  20451. url: kEnumerableProperty,
  20452. headers: kEnumerableProperty,
  20453. redirect: kEnumerableProperty,
  20454. clone: kEnumerableProperty,
  20455. signal: kEnumerableProperty,
  20456. duplex: kEnumerableProperty,
  20457. destination: kEnumerableProperty,
  20458. body: kEnumerableProperty,
  20459. bodyUsed: kEnumerableProperty,
  20460. isHistoryNavigation: kEnumerableProperty,
  20461. isReloadNavigation: kEnumerableProperty,
  20462. keepalive: kEnumerableProperty,
  20463. integrity: kEnumerableProperty,
  20464. cache: kEnumerableProperty,
  20465. credentials: kEnumerableProperty,
  20466. attribute: kEnumerableProperty,
  20467. referrerPolicy: kEnumerableProperty,
  20468. referrer: kEnumerableProperty,
  20469. mode: kEnumerableProperty,
  20470. [Symbol.toStringTag]: {
  20471. value: 'Request',
  20472. configurable: true
  20473. }
  20474. })
  20475. webidl.converters.Request = webidl.interfaceConverter(
  20476. Request
  20477. )
  20478. // https://fetch.spec.whatwg.org/#requestinfo
  20479. webidl.converters.RequestInfo = function (V, prefix, argument) {
  20480. if (typeof V === 'string') {
  20481. return webidl.converters.USVString(V, prefix, argument)
  20482. }
  20483. if (V instanceof Request) {
  20484. return webidl.converters.Request(V, prefix, argument)
  20485. }
  20486. return webidl.converters.USVString(V, prefix, argument)
  20487. }
  20488. webidl.converters.AbortSignal = webidl.interfaceConverter(
  20489. AbortSignal
  20490. )
  20491. // https://fetch.spec.whatwg.org/#requestinit
  20492. webidl.converters.RequestInit = webidl.dictionaryConverter([
  20493. {
  20494. key: 'method',
  20495. converter: webidl.converters.ByteString
  20496. },
  20497. {
  20498. key: 'headers',
  20499. converter: webidl.converters.HeadersInit
  20500. },
  20501. {
  20502. key: 'body',
  20503. converter: webidl.nullableConverter(
  20504. webidl.converters.BodyInit
  20505. )
  20506. },
  20507. {
  20508. key: 'referrer',
  20509. converter: webidl.converters.USVString
  20510. },
  20511. {
  20512. key: 'referrerPolicy',
  20513. converter: webidl.converters.DOMString,
  20514. // https://w3c.github.io/webappsec-referrer-policy/#referrer-policy
  20515. allowedValues: referrerPolicy
  20516. },
  20517. {
  20518. key: 'mode',
  20519. converter: webidl.converters.DOMString,
  20520. // https://fetch.spec.whatwg.org/#concept-request-mode
  20521. allowedValues: requestMode
  20522. },
  20523. {
  20524. key: 'credentials',
  20525. converter: webidl.converters.DOMString,
  20526. // https://fetch.spec.whatwg.org/#requestcredentials
  20527. allowedValues: requestCredentials
  20528. },
  20529. {
  20530. key: 'cache',
  20531. converter: webidl.converters.DOMString,
  20532. // https://fetch.spec.whatwg.org/#requestcache
  20533. allowedValues: requestCache
  20534. },
  20535. {
  20536. key: 'redirect',
  20537. converter: webidl.converters.DOMString,
  20538. // https://fetch.spec.whatwg.org/#requestredirect
  20539. allowedValues: requestRedirect
  20540. },
  20541. {
  20542. key: 'integrity',
  20543. converter: webidl.converters.DOMString
  20544. },
  20545. {
  20546. key: 'keepalive',
  20547. converter: webidl.converters.boolean
  20548. },
  20549. {
  20550. key: 'signal',
  20551. converter: webidl.nullableConverter(
  20552. (signal) => webidl.converters.AbortSignal(
  20553. signal,
  20554. 'RequestInit',
  20555. 'signal',
  20556. { strict: false }
  20557. )
  20558. )
  20559. },
  20560. {
  20561. key: 'window',
  20562. converter: webidl.converters.any
  20563. },
  20564. {
  20565. key: 'duplex',
  20566. converter: webidl.converters.DOMString,
  20567. allowedValues: requestDuplex
  20568. },
  20569. {
  20570. key: 'dispatcher', // undici specific option
  20571. converter: webidl.converters.any
  20572. }
  20573. ])
  20574. module.exports = { Request, makeRequest, fromInnerRequest, cloneRequest }
  20575. /***/ }),
  20576. /***/ 9051:
  20577. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  20578. const { Headers, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = __nccwpck_require__(660)
  20579. const { extractBody, cloneBody, mixinBody, hasFinalizationRegistry, streamRegistry, bodyUnusable } = __nccwpck_require__(4492)
  20580. const util = __nccwpck_require__(3440)
  20581. const nodeUtil = __nccwpck_require__(7975)
  20582. const { kEnumerableProperty } = util
  20583. const {
  20584. isValidReasonPhrase,
  20585. isCancelled,
  20586. isAborted,
  20587. isBlobLike,
  20588. serializeJavascriptValueToJSONString,
  20589. isErrorLike,
  20590. isomorphicEncode,
  20591. environmentSettingsObject: relevantRealm
  20592. } = __nccwpck_require__(3168)
  20593. const {
  20594. redirectStatusSet,
  20595. nullBodyStatus
  20596. } = __nccwpck_require__(4495)
  20597. const { kState, kHeaders } = __nccwpck_require__(3627)
  20598. const { webidl } = __nccwpck_require__(5893)
  20599. const { FormData } = __nccwpck_require__(5910)
  20600. const { URLSerializer } = __nccwpck_require__(1900)
  20601. const { kConstruct } = __nccwpck_require__(6443)
  20602. const assert = __nccwpck_require__(4589)
  20603. const { types } = __nccwpck_require__(7975)
  20604. const textEncoder = new TextEncoder('utf-8')
  20605. // https://fetch.spec.whatwg.org/#response-class
  20606. class Response {
  20607. // Creates network error Response.
  20608. static error () {
  20609. // The static error() method steps are to return the result of creating a
  20610. // Response object, given a new network error, "immutable", and this’s
  20611. // relevant Realm.
  20612. const responseObject = fromInnerResponse(makeNetworkError(), 'immutable')
  20613. return responseObject
  20614. }
  20615. // https://fetch.spec.whatwg.org/#dom-response-json
  20616. static json (data, init = {}) {
  20617. webidl.argumentLengthCheck(arguments, 1, 'Response.json')
  20618. if (init !== null) {
  20619. init = webidl.converters.ResponseInit(init)
  20620. }
  20621. // 1. Let bytes the result of running serialize a JavaScript value to JSON bytes on data.
  20622. const bytes = textEncoder.encode(
  20623. serializeJavascriptValueToJSONString(data)
  20624. )
  20625. // 2. Let body be the result of extracting bytes.
  20626. const body = extractBody(bytes)
  20627. // 3. Let responseObject be the result of creating a Response object, given a new response,
  20628. // "response", and this’s relevant Realm.
  20629. const responseObject = fromInnerResponse(makeResponse({}), 'response')
  20630. // 4. Perform initialize a response given responseObject, init, and (body, "application/json").
  20631. initializeResponse(responseObject, init, { body: body[0], type: 'application/json' })
  20632. // 5. Return responseObject.
  20633. return responseObject
  20634. }
  20635. // Creates a redirect Response that redirects to url with status status.
  20636. static redirect (url, status = 302) {
  20637. webidl.argumentLengthCheck(arguments, 1, 'Response.redirect')
  20638. url = webidl.converters.USVString(url)
  20639. status = webidl.converters['unsigned short'](status)
  20640. // 1. Let parsedURL be the result of parsing url with current settings
  20641. // object’s API base URL.
  20642. // 2. If parsedURL is failure, then throw a TypeError.
  20643. // TODO: base-URL?
  20644. let parsedURL
  20645. try {
  20646. parsedURL = new URL(url, relevantRealm.settingsObject.baseUrl)
  20647. } catch (err) {
  20648. throw new TypeError(`Failed to parse URL from ${url}`, { cause: err })
  20649. }
  20650. // 3. If status is not a redirect status, then throw a RangeError.
  20651. if (!redirectStatusSet.has(status)) {
  20652. throw new RangeError(`Invalid status code ${status}`)
  20653. }
  20654. // 4. Let responseObject be the result of creating a Response object,
  20655. // given a new response, "immutable", and this’s relevant Realm.
  20656. const responseObject = fromInnerResponse(makeResponse({}), 'immutable')
  20657. // 5. Set responseObject’s response’s status to status.
  20658. responseObject[kState].status = status
  20659. // 6. Let value be parsedURL, serialized and isomorphic encoded.
  20660. const value = isomorphicEncode(URLSerializer(parsedURL))
  20661. // 7. Append `Location`/value to responseObject’s response’s header list.
  20662. responseObject[kState].headersList.append('location', value, true)
  20663. // 8. Return responseObject.
  20664. return responseObject
  20665. }
  20666. // https://fetch.spec.whatwg.org/#dom-response
  20667. constructor (body = null, init = {}) {
  20668. webidl.util.markAsUncloneable(this)
  20669. if (body === kConstruct) {
  20670. return
  20671. }
  20672. if (body !== null) {
  20673. body = webidl.converters.BodyInit(body)
  20674. }
  20675. init = webidl.converters.ResponseInit(init)
  20676. // 1. Set this’s response to a new response.
  20677. this[kState] = makeResponse({})
  20678. // 2. Set this’s headers to a new Headers object with this’s relevant
  20679. // Realm, whose header list is this’s response’s header list and guard
  20680. // is "response".
  20681. this[kHeaders] = new Headers(kConstruct)
  20682. setHeadersGuard(this[kHeaders], 'response')
  20683. setHeadersList(this[kHeaders], this[kState].headersList)
  20684. // 3. Let bodyWithType be null.
  20685. let bodyWithType = null
  20686. // 4. If body is non-null, then set bodyWithType to the result of extracting body.
  20687. if (body != null) {
  20688. const [extractedBody, type] = extractBody(body)
  20689. bodyWithType = { body: extractedBody, type }
  20690. }
  20691. // 5. Perform initialize a response given this, init, and bodyWithType.
  20692. initializeResponse(this, init, bodyWithType)
  20693. }
  20694. // Returns response’s type, e.g., "cors".
  20695. get type () {
  20696. webidl.brandCheck(this, Response)
  20697. // The type getter steps are to return this’s response’s type.
  20698. return this[kState].type
  20699. }
  20700. // Returns response’s URL, if it has one; otherwise the empty string.
  20701. get url () {
  20702. webidl.brandCheck(this, Response)
  20703. const urlList = this[kState].urlList
  20704. // The url getter steps are to return the empty string if this’s
  20705. // response’s URL is null; otherwise this’s response’s URL,
  20706. // serialized with exclude fragment set to true.
  20707. const url = urlList[urlList.length - 1] ?? null
  20708. if (url === null) {
  20709. return ''
  20710. }
  20711. return URLSerializer(url, true)
  20712. }
  20713. // Returns whether response was obtained through a redirect.
  20714. get redirected () {
  20715. webidl.brandCheck(this, Response)
  20716. // The redirected getter steps are to return true if this’s response’s URL
  20717. // list has more than one item; otherwise false.
  20718. return this[kState].urlList.length > 1
  20719. }
  20720. // Returns response’s status.
  20721. get status () {
  20722. webidl.brandCheck(this, Response)
  20723. // The status getter steps are to return this’s response’s status.
  20724. return this[kState].status
  20725. }
  20726. // Returns whether response’s status is an ok status.
  20727. get ok () {
  20728. webidl.brandCheck(this, Response)
  20729. // The ok getter steps are to return true if this’s response’s status is an
  20730. // ok status; otherwise false.
  20731. return this[kState].status >= 200 && this[kState].status <= 299
  20732. }
  20733. // Returns response’s status message.
  20734. get statusText () {
  20735. webidl.brandCheck(this, Response)
  20736. // The statusText getter steps are to return this’s response’s status
  20737. // message.
  20738. return this[kState].statusText
  20739. }
  20740. // Returns response’s headers as Headers.
  20741. get headers () {
  20742. webidl.brandCheck(this, Response)
  20743. // The headers getter steps are to return this’s headers.
  20744. return this[kHeaders]
  20745. }
  20746. get body () {
  20747. webidl.brandCheck(this, Response)
  20748. return this[kState].body ? this[kState].body.stream : null
  20749. }
  20750. get bodyUsed () {
  20751. webidl.brandCheck(this, Response)
  20752. return !!this[kState].body && util.isDisturbed(this[kState].body.stream)
  20753. }
  20754. // Returns a clone of response.
  20755. clone () {
  20756. webidl.brandCheck(this, Response)
  20757. // 1. If this is unusable, then throw a TypeError.
  20758. if (bodyUnusable(this)) {
  20759. throw webidl.errors.exception({
  20760. header: 'Response.clone',
  20761. message: 'Body has already been consumed.'
  20762. })
  20763. }
  20764. // 2. Let clonedResponse be the result of cloning this’s response.
  20765. const clonedResponse = cloneResponse(this[kState])
  20766. // Note: To re-register because of a new stream.
  20767. if (hasFinalizationRegistry && this[kState].body?.stream) {
  20768. streamRegistry.register(this, new WeakRef(this[kState].body.stream))
  20769. }
  20770. // 3. Return the result of creating a Response object, given
  20771. // clonedResponse, this’s headers’s guard, and this’s relevant Realm.
  20772. return fromInnerResponse(clonedResponse, getHeadersGuard(this[kHeaders]))
  20773. }
  20774. [nodeUtil.inspect.custom] (depth, options) {
  20775. if (options.depth === null) {
  20776. options.depth = 2
  20777. }
  20778. options.colors ??= true
  20779. const properties = {
  20780. status: this.status,
  20781. statusText: this.statusText,
  20782. headers: this.headers,
  20783. body: this.body,
  20784. bodyUsed: this.bodyUsed,
  20785. ok: this.ok,
  20786. redirected: this.redirected,
  20787. type: this.type,
  20788. url: this.url
  20789. }
  20790. return `Response ${nodeUtil.formatWithOptions(options, properties)}`
  20791. }
  20792. }
  20793. mixinBody(Response)
  20794. Object.defineProperties(Response.prototype, {
  20795. type: kEnumerableProperty,
  20796. url: kEnumerableProperty,
  20797. status: kEnumerableProperty,
  20798. ok: kEnumerableProperty,
  20799. redirected: kEnumerableProperty,
  20800. statusText: kEnumerableProperty,
  20801. headers: kEnumerableProperty,
  20802. clone: kEnumerableProperty,
  20803. body: kEnumerableProperty,
  20804. bodyUsed: kEnumerableProperty,
  20805. [Symbol.toStringTag]: {
  20806. value: 'Response',
  20807. configurable: true
  20808. }
  20809. })
  20810. Object.defineProperties(Response, {
  20811. json: kEnumerableProperty,
  20812. redirect: kEnumerableProperty,
  20813. error: kEnumerableProperty
  20814. })
  20815. // https://fetch.spec.whatwg.org/#concept-response-clone
  20816. function cloneResponse (response) {
  20817. // To clone a response response, run these steps:
  20818. // 1. If response is a filtered response, then return a new identical
  20819. // filtered response whose internal response is a clone of response’s
  20820. // internal response.
  20821. if (response.internalResponse) {
  20822. return filterResponse(
  20823. cloneResponse(response.internalResponse),
  20824. response.type
  20825. )
  20826. }
  20827. // 2. Let newResponse be a copy of response, except for its body.
  20828. const newResponse = makeResponse({ ...response, body: null })
  20829. // 3. If response’s body is non-null, then set newResponse’s body to the
  20830. // result of cloning response’s body.
  20831. if (response.body != null) {
  20832. newResponse.body = cloneBody(newResponse, response.body)
  20833. }
  20834. // 4. Return newResponse.
  20835. return newResponse
  20836. }
  20837. function makeResponse (init) {
  20838. return {
  20839. aborted: false,
  20840. rangeRequested: false,
  20841. timingAllowPassed: false,
  20842. requestIncludesCredentials: false,
  20843. type: 'default',
  20844. status: 200,
  20845. timingInfo: null,
  20846. cacheState: '',
  20847. statusText: '',
  20848. ...init,
  20849. headersList: init?.headersList
  20850. ? new HeadersList(init?.headersList)
  20851. : new HeadersList(),
  20852. urlList: init?.urlList ? [...init.urlList] : []
  20853. }
  20854. }
  20855. function makeNetworkError (reason) {
  20856. const isError = isErrorLike(reason)
  20857. return makeResponse({
  20858. type: 'error',
  20859. status: 0,
  20860. error: isError
  20861. ? reason
  20862. : new Error(reason ? String(reason) : reason),
  20863. aborted: reason && reason.name === 'AbortError'
  20864. })
  20865. }
  20866. // @see https://fetch.spec.whatwg.org/#concept-network-error
  20867. function isNetworkError (response) {
  20868. return (
  20869. // A network error is a response whose type is "error",
  20870. response.type === 'error' &&
  20871. // status is 0
  20872. response.status === 0
  20873. )
  20874. }
  20875. function makeFilteredResponse (response, state) {
  20876. state = {
  20877. internalResponse: response,
  20878. ...state
  20879. }
  20880. return new Proxy(response, {
  20881. get (target, p) {
  20882. return p in state ? state[p] : target[p]
  20883. },
  20884. set (target, p, value) {
  20885. assert(!(p in state))
  20886. target[p] = value
  20887. return true
  20888. }
  20889. })
  20890. }
  20891. // https://fetch.spec.whatwg.org/#concept-filtered-response
  20892. function filterResponse (response, type) {
  20893. // Set response to the following filtered response with response as its
  20894. // internal response, depending on request’s response tainting:
  20895. if (type === 'basic') {
  20896. // A basic filtered response is a filtered response whose type is "basic"
  20897. // and header list excludes any headers in internal response’s header list
  20898. // whose name is a forbidden response-header name.
  20899. // Note: undici does not implement forbidden response-header names
  20900. return makeFilteredResponse(response, {
  20901. type: 'basic',
  20902. headersList: response.headersList
  20903. })
  20904. } else if (type === 'cors') {
  20905. // A CORS filtered response is a filtered response whose type is "cors"
  20906. // and header list excludes any headers in internal response’s header
  20907. // list whose name is not a CORS-safelisted response-header name, given
  20908. // internal response’s CORS-exposed header-name list.
  20909. // Note: undici does not implement CORS-safelisted response-header names
  20910. return makeFilteredResponse(response, {
  20911. type: 'cors',
  20912. headersList: response.headersList
  20913. })
  20914. } else if (type === 'opaque') {
  20915. // An opaque filtered response is a filtered response whose type is
  20916. // "opaque", URL list is the empty list, status is 0, status message
  20917. // is the empty byte sequence, header list is empty, and body is null.
  20918. return makeFilteredResponse(response, {
  20919. type: 'opaque',
  20920. urlList: Object.freeze([]),
  20921. status: 0,
  20922. statusText: '',
  20923. body: null
  20924. })
  20925. } else if (type === 'opaqueredirect') {
  20926. // An opaque-redirect filtered response is a filtered response whose type
  20927. // is "opaqueredirect", status is 0, status message is the empty byte
  20928. // sequence, header list is empty, and body is null.
  20929. return makeFilteredResponse(response, {
  20930. type: 'opaqueredirect',
  20931. status: 0,
  20932. statusText: '',
  20933. headersList: [],
  20934. body: null
  20935. })
  20936. } else {
  20937. assert(false)
  20938. }
  20939. }
  20940. // https://fetch.spec.whatwg.org/#appropriate-network-error
  20941. function makeAppropriateNetworkError (fetchParams, err = null) {
  20942. // 1. Assert: fetchParams is canceled.
  20943. assert(isCancelled(fetchParams))
  20944. // 2. Return an aborted network error if fetchParams is aborted;
  20945. // otherwise return a network error.
  20946. return isAborted(fetchParams)
  20947. ? makeNetworkError(Object.assign(new DOMException('The operation was aborted.', 'AbortError'), { cause: err }))
  20948. : makeNetworkError(Object.assign(new DOMException('Request was cancelled.'), { cause: err }))
  20949. }
  20950. // https://whatpr.org/fetch/1392.html#initialize-a-response
  20951. function initializeResponse (response, init, body) {
  20952. // 1. If init["status"] is not in the range 200 to 599, inclusive, then
  20953. // throw a RangeError.
  20954. if (init.status !== null && (init.status < 200 || init.status > 599)) {
  20955. throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.')
  20956. }
  20957. // 2. If init["statusText"] does not match the reason-phrase token production,
  20958. // then throw a TypeError.
  20959. if ('statusText' in init && init.statusText != null) {
  20960. // See, https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2:
  20961. // reason-phrase = *( HTAB / SP / VCHAR / obs-text )
  20962. if (!isValidReasonPhrase(String(init.statusText))) {
  20963. throw new TypeError('Invalid statusText')
  20964. }
  20965. }
  20966. // 3. Set response’s response’s status to init["status"].
  20967. if ('status' in init && init.status != null) {
  20968. response[kState].status = init.status
  20969. }
  20970. // 4. Set response’s response’s status message to init["statusText"].
  20971. if ('statusText' in init && init.statusText != null) {
  20972. response[kState].statusText = init.statusText
  20973. }
  20974. // 5. If init["headers"] exists, then fill response’s headers with init["headers"].
  20975. if ('headers' in init && init.headers != null) {
  20976. fill(response[kHeaders], init.headers)
  20977. }
  20978. // 6. If body was given, then:
  20979. if (body) {
  20980. // 1. If response's status is a null body status, then throw a TypeError.
  20981. if (nullBodyStatus.includes(response.status)) {
  20982. throw webidl.errors.exception({
  20983. header: 'Response constructor',
  20984. message: `Invalid response status code ${response.status}`
  20985. })
  20986. }
  20987. // 2. Set response's body to body's body.
  20988. response[kState].body = body.body
  20989. // 3. If body's type is non-null and response's header list does not contain
  20990. // `Content-Type`, then append (`Content-Type`, body's type) to response's header list.
  20991. if (body.type != null && !response[kState].headersList.contains('content-type', true)) {
  20992. response[kState].headersList.append('content-type', body.type, true)
  20993. }
  20994. }
  20995. }
  20996. /**
  20997. * @see https://fetch.spec.whatwg.org/#response-create
  20998. * @param {any} innerResponse
  20999. * @param {'request' | 'immutable' | 'request-no-cors' | 'response' | 'none'} guard
  21000. * @returns {Response}
  21001. */
  21002. function fromInnerResponse (innerResponse, guard) {
  21003. const response = new Response(kConstruct)
  21004. response[kState] = innerResponse
  21005. response[kHeaders] = new Headers(kConstruct)
  21006. setHeadersList(response[kHeaders], innerResponse.headersList)
  21007. setHeadersGuard(response[kHeaders], guard)
  21008. if (hasFinalizationRegistry && innerResponse.body?.stream) {
  21009. // If the target (response) is reclaimed, the cleanup callback may be called at some point with
  21010. // the held value provided for it (innerResponse.body.stream). The held value can be any value:
  21011. // a primitive or an object, even undefined. If the held value is an object, the registry keeps
  21012. // a strong reference to it (so it can pass it to the cleanup callback later). Reworded from
  21013. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
  21014. streamRegistry.register(response, new WeakRef(innerResponse.body.stream))
  21015. }
  21016. return response
  21017. }
  21018. webidl.converters.ReadableStream = webidl.interfaceConverter(
  21019. ReadableStream
  21020. )
  21021. webidl.converters.FormData = webidl.interfaceConverter(
  21022. FormData
  21023. )
  21024. webidl.converters.URLSearchParams = webidl.interfaceConverter(
  21025. URLSearchParams
  21026. )
  21027. // https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit
  21028. webidl.converters.XMLHttpRequestBodyInit = function (V, prefix, name) {
  21029. if (typeof V === 'string') {
  21030. return webidl.converters.USVString(V, prefix, name)
  21031. }
  21032. if (isBlobLike(V)) {
  21033. return webidl.converters.Blob(V, prefix, name, { strict: false })
  21034. }
  21035. if (ArrayBuffer.isView(V) || types.isArrayBuffer(V)) {
  21036. return webidl.converters.BufferSource(V, prefix, name)
  21037. }
  21038. if (util.isFormDataLike(V)) {
  21039. return webidl.converters.FormData(V, prefix, name, { strict: false })
  21040. }
  21041. if (V instanceof URLSearchParams) {
  21042. return webidl.converters.URLSearchParams(V, prefix, name)
  21043. }
  21044. return webidl.converters.DOMString(V, prefix, name)
  21045. }
  21046. // https://fetch.spec.whatwg.org/#bodyinit
  21047. webidl.converters.BodyInit = function (V, prefix, argument) {
  21048. if (V instanceof ReadableStream) {
  21049. return webidl.converters.ReadableStream(V, prefix, argument)
  21050. }
  21051. // Note: the spec doesn't include async iterables,
  21052. // this is an undici extension.
  21053. if (V?.[Symbol.asyncIterator]) {
  21054. return V
  21055. }
  21056. return webidl.converters.XMLHttpRequestBodyInit(V, prefix, argument)
  21057. }
  21058. webidl.converters.ResponseInit = webidl.dictionaryConverter([
  21059. {
  21060. key: 'status',
  21061. converter: webidl.converters['unsigned short'],
  21062. defaultValue: () => 200
  21063. },
  21064. {
  21065. key: 'statusText',
  21066. converter: webidl.converters.ByteString,
  21067. defaultValue: () => ''
  21068. },
  21069. {
  21070. key: 'headers',
  21071. converter: webidl.converters.HeadersInit
  21072. }
  21073. ])
  21074. module.exports = {
  21075. isNetworkError,
  21076. makeNetworkError,
  21077. makeResponse,
  21078. makeAppropriateNetworkError,
  21079. filterResponse,
  21080. Response,
  21081. cloneResponse,
  21082. fromInnerResponse
  21083. }
  21084. /***/ }),
  21085. /***/ 3627:
  21086. /***/ ((module) => {
  21087. module.exports = {
  21088. kUrl: Symbol('url'),
  21089. kHeaders: Symbol('headers'),
  21090. kSignal: Symbol('signal'),
  21091. kState: Symbol('state'),
  21092. kDispatcher: Symbol('dispatcher')
  21093. }
  21094. /***/ }),
  21095. /***/ 3168:
  21096. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  21097. const { Transform } = __nccwpck_require__(7075)
  21098. const zlib = __nccwpck_require__(8522)
  21099. const { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = __nccwpck_require__(4495)
  21100. const { getGlobalOrigin } = __nccwpck_require__(1059)
  21101. const { collectASequenceOfCodePoints, collectAnHTTPQuotedString, removeChars, parseMIMEType } = __nccwpck_require__(1900)
  21102. const { performance } = __nccwpck_require__(643)
  21103. const { isBlobLike, ReadableStreamFrom, isValidHTTPToken, normalizedMethodRecordsBase } = __nccwpck_require__(3440)
  21104. const assert = __nccwpck_require__(4589)
  21105. const { isUint8Array } = __nccwpck_require__(3429)
  21106. const { webidl } = __nccwpck_require__(5893)
  21107. let supportedHashes = []
  21108. // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
  21109. /** @type {import('crypto')} */
  21110. let crypto
  21111. try {
  21112. crypto = __nccwpck_require__(7598)
  21113. const possibleRelevantHashes = ['sha256', 'sha384', 'sha512']
  21114. supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash))
  21115. /* c8 ignore next 3 */
  21116. } catch {
  21117. }
  21118. function responseURL (response) {
  21119. // https://fetch.spec.whatwg.org/#responses
  21120. // A response has an associated URL. It is a pointer to the last URL
  21121. // in response’s URL list and null if response’s URL list is empty.
  21122. const urlList = response.urlList
  21123. const length = urlList.length
  21124. return length === 0 ? null : urlList[length - 1].toString()
  21125. }
  21126. // https://fetch.spec.whatwg.org/#concept-response-location-url
  21127. function responseLocationURL (response, requestFragment) {
  21128. // 1. If response’s status is not a redirect status, then return null.
  21129. if (!redirectStatusSet.has(response.status)) {
  21130. return null
  21131. }
  21132. // 2. Let location be the result of extracting header list values given
  21133. // `Location` and response’s header list.
  21134. let location = response.headersList.get('location', true)
  21135. // 3. If location is a header value, then set location to the result of
  21136. // parsing location with response’s URL.
  21137. if (location !== null && isValidHeaderValue(location)) {
  21138. if (!isValidEncodedURL(location)) {
  21139. // Some websites respond location header in UTF-8 form without encoding them as ASCII
  21140. // and major browsers redirect them to correctly UTF-8 encoded addresses.
  21141. // Here, we handle that behavior in the same way.
  21142. location = normalizeBinaryStringToUtf8(location)
  21143. }
  21144. location = new URL(location, responseURL(response))
  21145. }
  21146. // 4. If location is a URL whose fragment is null, then set location’s
  21147. // fragment to requestFragment.
  21148. if (location && !location.hash) {
  21149. location.hash = requestFragment
  21150. }
  21151. // 5. Return location.
  21152. return location
  21153. }
  21154. /**
  21155. * @see https://www.rfc-editor.org/rfc/rfc1738#section-2.2
  21156. * @param {string} url
  21157. * @returns {boolean}
  21158. */
  21159. function isValidEncodedURL (url) {
  21160. for (let i = 0; i < url.length; ++i) {
  21161. const code = url.charCodeAt(i)
  21162. if (
  21163. code > 0x7E || // Non-US-ASCII + DEL
  21164. code < 0x20 // Control characters NUL - US
  21165. ) {
  21166. return false
  21167. }
  21168. }
  21169. return true
  21170. }
  21171. /**
  21172. * If string contains non-ASCII characters, assumes it's UTF-8 encoded and decodes it.
  21173. * Since UTF-8 is a superset of ASCII, this will work for ASCII strings as well.
  21174. * @param {string} value
  21175. * @returns {string}
  21176. */
  21177. function normalizeBinaryStringToUtf8 (value) {
  21178. return Buffer.from(value, 'binary').toString('utf8')
  21179. }
  21180. /** @returns {URL} */
  21181. function requestCurrentURL (request) {
  21182. return request.urlList[request.urlList.length - 1]
  21183. }
  21184. function requestBadPort (request) {
  21185. // 1. Let url be request’s current URL.
  21186. const url = requestCurrentURL(request)
  21187. // 2. If url’s scheme is an HTTP(S) scheme and url’s port is a bad port,
  21188. // then return blocked.
  21189. if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) {
  21190. return 'blocked'
  21191. }
  21192. // 3. Return allowed.
  21193. return 'allowed'
  21194. }
  21195. function isErrorLike (object) {
  21196. return object instanceof Error || (
  21197. object?.constructor?.name === 'Error' ||
  21198. object?.constructor?.name === 'DOMException'
  21199. )
  21200. }
  21201. // Check whether |statusText| is a ByteString and
  21202. // matches the Reason-Phrase token production.
  21203. // RFC 2616: https://tools.ietf.org/html/rfc2616
  21204. // RFC 7230: https://tools.ietf.org/html/rfc7230
  21205. // "reason-phrase = *( HTAB / SP / VCHAR / obs-text )"
  21206. // https://github.com/chromium/chromium/blob/94.0.4604.1/third_party/blink/renderer/core/fetch/response.cc#L116
  21207. function isValidReasonPhrase (statusText) {
  21208. for (let i = 0; i < statusText.length; ++i) {
  21209. const c = statusText.charCodeAt(i)
  21210. if (
  21211. !(
  21212. (
  21213. c === 0x09 || // HTAB
  21214. (c >= 0x20 && c <= 0x7e) || // SP / VCHAR
  21215. (c >= 0x80 && c <= 0xff)
  21216. ) // obs-text
  21217. )
  21218. ) {
  21219. return false
  21220. }
  21221. }
  21222. return true
  21223. }
  21224. /**
  21225. * @see https://fetch.spec.whatwg.org/#header-name
  21226. * @param {string} potentialValue
  21227. */
  21228. const isValidHeaderName = isValidHTTPToken
  21229. /**
  21230. * @see https://fetch.spec.whatwg.org/#header-value
  21231. * @param {string} potentialValue
  21232. */
  21233. function isValidHeaderValue (potentialValue) {
  21234. // - Has no leading or trailing HTTP tab or space bytes.
  21235. // - Contains no 0x00 (NUL) or HTTP newline bytes.
  21236. return (
  21237. potentialValue[0] === '\t' ||
  21238. potentialValue[0] === ' ' ||
  21239. potentialValue[potentialValue.length - 1] === '\t' ||
  21240. potentialValue[potentialValue.length - 1] === ' ' ||
  21241. potentialValue.includes('\n') ||
  21242. potentialValue.includes('\r') ||
  21243. potentialValue.includes('\0')
  21244. ) === false
  21245. }
  21246. // https://w3c.github.io/webappsec-referrer-policy/#set-requests-referrer-policy-on-redirect
  21247. function setRequestReferrerPolicyOnRedirect (request, actualResponse) {
  21248. // Given a request request and a response actualResponse, this algorithm
  21249. // updates request’s referrer policy according to the Referrer-Policy
  21250. // header (if any) in actualResponse.
  21251. // 1. Let policy be the result of executing § 8.1 Parse a referrer policy
  21252. // from a Referrer-Policy header on actualResponse.
  21253. // 8.1 Parse a referrer policy from a Referrer-Policy header
  21254. // 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy` and response’s header list.
  21255. const { headersList } = actualResponse
  21256. // 2. Let policy be the empty string.
  21257. // 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.
  21258. // 4. Return policy.
  21259. const policyHeader = (headersList.get('referrer-policy', true) ?? '').split(',')
  21260. // Note: As the referrer-policy can contain multiple policies
  21261. // separated by comma, we need to loop through all of them
  21262. // and pick the first valid one.
  21263. // Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#specify_a_fallback_policy
  21264. let policy = ''
  21265. if (policyHeader.length > 0) {
  21266. // The right-most policy takes precedence.
  21267. // The left-most policy is the fallback.
  21268. for (let i = policyHeader.length; i !== 0; i--) {
  21269. const token = policyHeader[i - 1].trim()
  21270. if (referrerPolicyTokens.has(token)) {
  21271. policy = token
  21272. break
  21273. }
  21274. }
  21275. }
  21276. // 2. If policy is not the empty string, then set request’s referrer policy to policy.
  21277. if (policy !== '') {
  21278. request.referrerPolicy = policy
  21279. }
  21280. }
  21281. // https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check
  21282. function crossOriginResourcePolicyCheck () {
  21283. // TODO
  21284. return 'allowed'
  21285. }
  21286. // https://fetch.spec.whatwg.org/#concept-cors-check
  21287. function corsCheck () {
  21288. // TODO
  21289. return 'success'
  21290. }
  21291. // https://fetch.spec.whatwg.org/#concept-tao-check
  21292. function TAOCheck () {
  21293. // TODO
  21294. return 'success'
  21295. }
  21296. function appendFetchMetadata (httpRequest) {
  21297. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-dest-header
  21298. // TODO
  21299. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-mode-header
  21300. // 1. Assert: r’s url is a potentially trustworthy URL.
  21301. // TODO
  21302. // 2. Let header be a Structured Header whose value is a token.
  21303. let header = null
  21304. // 3. Set header’s value to r’s mode.
  21305. header = httpRequest.mode
  21306. // 4. Set a structured field value `Sec-Fetch-Mode`/header in r’s header list.
  21307. httpRequest.headersList.set('sec-fetch-mode', header, true)
  21308. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-site-header
  21309. // TODO
  21310. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-user-header
  21311. // TODO
  21312. }
  21313. // https://fetch.spec.whatwg.org/#append-a-request-origin-header
  21314. function appendRequestOriginHeader (request) {
  21315. // 1. Let serializedOrigin be the result of byte-serializing a request origin
  21316. // with request.
  21317. // TODO: implement "byte-serializing a request origin"
  21318. let serializedOrigin = request.origin
  21319. // - "'client' is changed to an origin during fetching."
  21320. // This doesn't happen in undici (in most cases) because undici, by default,
  21321. // has no concept of origin.
  21322. // - request.origin can also be set to request.client.origin (client being
  21323. // an environment settings object), which is undefined without using
  21324. // setGlobalOrigin.
  21325. if (serializedOrigin === 'client' || serializedOrigin === undefined) {
  21326. return
  21327. }
  21328. // 2. If request’s response tainting is "cors" or request’s mode is "websocket",
  21329. // then append (`Origin`, serializedOrigin) to request’s header list.
  21330. // 3. Otherwise, if request’s method is neither `GET` nor `HEAD`, then:
  21331. if (request.responseTainting === 'cors' || request.mode === 'websocket') {
  21332. request.headersList.append('origin', serializedOrigin, true)
  21333. } else if (request.method !== 'GET' && request.method !== 'HEAD') {
  21334. // 1. Switch on request’s referrer policy:
  21335. switch (request.referrerPolicy) {
  21336. case 'no-referrer':
  21337. // Set serializedOrigin to `null`.
  21338. serializedOrigin = null
  21339. break
  21340. case 'no-referrer-when-downgrade':
  21341. case 'strict-origin':
  21342. case 'strict-origin-when-cross-origin':
  21343. // If request’s origin is a tuple origin, its scheme is "https", and
  21344. // request’s current URL’s scheme is not "https", then set
  21345. // serializedOrigin to `null`.
  21346. if (request.origin && urlHasHttpsScheme(request.origin) && !urlHasHttpsScheme(requestCurrentURL(request))) {
  21347. serializedOrigin = null
  21348. }
  21349. break
  21350. case 'same-origin':
  21351. // If request’s origin is not same origin with request’s current URL’s
  21352. // origin, then set serializedOrigin to `null`.
  21353. if (!sameOrigin(request, requestCurrentURL(request))) {
  21354. serializedOrigin = null
  21355. }
  21356. break
  21357. default:
  21358. // Do nothing.
  21359. }
  21360. // 2. Append (`Origin`, serializedOrigin) to request’s header list.
  21361. request.headersList.append('origin', serializedOrigin, true)
  21362. }
  21363. }
  21364. // https://w3c.github.io/hr-time/#dfn-coarsen-time
  21365. function coarsenTime (timestamp, crossOriginIsolatedCapability) {
  21366. // TODO
  21367. return timestamp
  21368. }
  21369. // https://fetch.spec.whatwg.org/#clamp-and-coarsen-connection-timing-info
  21370. function clampAndCoarsenConnectionTimingInfo (connectionTimingInfo, defaultStartTime, crossOriginIsolatedCapability) {
  21371. if (!connectionTimingInfo?.startTime || connectionTimingInfo.startTime < defaultStartTime) {
  21372. return {
  21373. domainLookupStartTime: defaultStartTime,
  21374. domainLookupEndTime: defaultStartTime,
  21375. connectionStartTime: defaultStartTime,
  21376. connectionEndTime: defaultStartTime,
  21377. secureConnectionStartTime: defaultStartTime,
  21378. ALPNNegotiatedProtocol: connectionTimingInfo?.ALPNNegotiatedProtocol
  21379. }
  21380. }
  21381. return {
  21382. domainLookupStartTime: coarsenTime(connectionTimingInfo.domainLookupStartTime, crossOriginIsolatedCapability),
  21383. domainLookupEndTime: coarsenTime(connectionTimingInfo.domainLookupEndTime, crossOriginIsolatedCapability),
  21384. connectionStartTime: coarsenTime(connectionTimingInfo.connectionStartTime, crossOriginIsolatedCapability),
  21385. connectionEndTime: coarsenTime(connectionTimingInfo.connectionEndTime, crossOriginIsolatedCapability),
  21386. secureConnectionStartTime: coarsenTime(connectionTimingInfo.secureConnectionStartTime, crossOriginIsolatedCapability),
  21387. ALPNNegotiatedProtocol: connectionTimingInfo.ALPNNegotiatedProtocol
  21388. }
  21389. }
  21390. // https://w3c.github.io/hr-time/#dfn-coarsened-shared-current-time
  21391. function coarsenedSharedCurrentTime (crossOriginIsolatedCapability) {
  21392. return coarsenTime(performance.now(), crossOriginIsolatedCapability)
  21393. }
  21394. // https://fetch.spec.whatwg.org/#create-an-opaque-timing-info
  21395. function createOpaqueTimingInfo (timingInfo) {
  21396. return {
  21397. startTime: timingInfo.startTime ?? 0,
  21398. redirectStartTime: 0,
  21399. redirectEndTime: 0,
  21400. postRedirectStartTime: timingInfo.startTime ?? 0,
  21401. finalServiceWorkerStartTime: 0,
  21402. finalNetworkResponseStartTime: 0,
  21403. finalNetworkRequestStartTime: 0,
  21404. endTime: 0,
  21405. encodedBodySize: 0,
  21406. decodedBodySize: 0,
  21407. finalConnectionTimingInfo: null
  21408. }
  21409. }
  21410. // https://html.spec.whatwg.org/multipage/origin.html#policy-container
  21411. function makePolicyContainer () {
  21412. // Note: the fetch spec doesn't make use of embedder policy or CSP list
  21413. return {
  21414. referrerPolicy: 'strict-origin-when-cross-origin'
  21415. }
  21416. }
  21417. // https://html.spec.whatwg.org/multipage/origin.html#clone-a-policy-container
  21418. function clonePolicyContainer (policyContainer) {
  21419. return {
  21420. referrerPolicy: policyContainer.referrerPolicy
  21421. }
  21422. }
  21423. // https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer
  21424. function determineRequestsReferrer (request) {
  21425. // 1. Let policy be request's referrer policy.
  21426. const policy = request.referrerPolicy
  21427. // Note: policy cannot (shouldn't) be null or an empty string.
  21428. assert(policy)
  21429. // 2. Let environment be request’s client.
  21430. let referrerSource = null
  21431. // 3. Switch on request’s referrer:
  21432. if (request.referrer === 'client') {
  21433. // Note: node isn't a browser and doesn't implement document/iframes,
  21434. // so we bypass this step and replace it with our own.
  21435. const globalOrigin = getGlobalOrigin()
  21436. if (!globalOrigin || globalOrigin.origin === 'null') {
  21437. return 'no-referrer'
  21438. }
  21439. // note: we need to clone it as it's mutated
  21440. referrerSource = new URL(globalOrigin)
  21441. } else if (request.referrer instanceof URL) {
  21442. // Let referrerSource be request’s referrer.
  21443. referrerSource = request.referrer
  21444. }
  21445. // 4. Let request’s referrerURL be the result of stripping referrerSource for
  21446. // use as a referrer.
  21447. let referrerURL = stripURLForReferrer(referrerSource)
  21448. // 5. Let referrerOrigin be the result of stripping referrerSource for use as
  21449. // a referrer, with the origin-only flag set to true.
  21450. const referrerOrigin = stripURLForReferrer(referrerSource, true)
  21451. // 6. If the result of serializing referrerURL is a string whose length is
  21452. // greater than 4096, set referrerURL to referrerOrigin.
  21453. if (referrerURL.toString().length > 4096) {
  21454. referrerURL = referrerOrigin
  21455. }
  21456. const areSameOrigin = sameOrigin(request, referrerURL)
  21457. const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) &&
  21458. !isURLPotentiallyTrustworthy(request.url)
  21459. // 8. Execute the switch statements corresponding to the value of policy:
  21460. switch (policy) {
  21461. case 'origin': return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true)
  21462. case 'unsafe-url': return referrerURL
  21463. case 'same-origin':
  21464. return areSameOrigin ? referrerOrigin : 'no-referrer'
  21465. case 'origin-when-cross-origin':
  21466. return areSameOrigin ? referrerURL : referrerOrigin
  21467. case 'strict-origin-when-cross-origin': {
  21468. const currentURL = requestCurrentURL(request)
  21469. // 1. If the origin of referrerURL and the origin of request’s current
  21470. // URL are the same, then return referrerURL.
  21471. if (sameOrigin(referrerURL, currentURL)) {
  21472. return referrerURL
  21473. }
  21474. // 2. If referrerURL is a potentially trustworthy URL and request’s
  21475. // current URL is not a potentially trustworthy URL, then return no
  21476. // referrer.
  21477. if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) {
  21478. return 'no-referrer'
  21479. }
  21480. // 3. Return referrerOrigin.
  21481. return referrerOrigin
  21482. }
  21483. case 'strict-origin': // eslint-disable-line
  21484. /**
  21485. * 1. If referrerURL is a potentially trustworthy URL and
  21486. * request’s current URL is not a potentially trustworthy URL,
  21487. * then return no referrer.
  21488. * 2. Return referrerOrigin
  21489. */
  21490. case 'no-referrer-when-downgrade': // eslint-disable-line
  21491. /**
  21492. * 1. If referrerURL is a potentially trustworthy URL and
  21493. * request’s current URL is not a potentially trustworthy URL,
  21494. * then return no referrer.
  21495. * 2. Return referrerOrigin
  21496. */
  21497. default: // eslint-disable-line
  21498. return isNonPotentiallyTrustWorthy ? 'no-referrer' : referrerOrigin
  21499. }
  21500. }
  21501. /**
  21502. * @see https://w3c.github.io/webappsec-referrer-policy/#strip-url
  21503. * @param {URL} url
  21504. * @param {boolean|undefined} originOnly
  21505. */
  21506. function stripURLForReferrer (url, originOnly) {
  21507. // 1. Assert: url is a URL.
  21508. assert(url instanceof URL)
  21509. url = new URL(url)
  21510. // 2. If url’s scheme is a local scheme, then return no referrer.
  21511. if (url.protocol === 'file:' || url.protocol === 'about:' || url.protocol === 'blank:') {
  21512. return 'no-referrer'
  21513. }
  21514. // 3. Set url’s username to the empty string.
  21515. url.username = ''
  21516. // 4. Set url’s password to the empty string.
  21517. url.password = ''
  21518. // 5. Set url’s fragment to null.
  21519. url.hash = ''
  21520. // 6. If the origin-only flag is true, then:
  21521. if (originOnly) {
  21522. // 1. Set url’s path to « the empty string ».
  21523. url.pathname = ''
  21524. // 2. Set url’s query to null.
  21525. url.search = ''
  21526. }
  21527. // 7. Return url.
  21528. return url
  21529. }
  21530. function isURLPotentiallyTrustworthy (url) {
  21531. if (!(url instanceof URL)) {
  21532. return false
  21533. }
  21534. // If child of about, return true
  21535. if (url.href === 'about:blank' || url.href === 'about:srcdoc') {
  21536. return true
  21537. }
  21538. // If scheme is data, return true
  21539. if (url.protocol === 'data:') return true
  21540. // If file, return true
  21541. if (url.protocol === 'file:') return true
  21542. return isOriginPotentiallyTrustworthy(url.origin)
  21543. function isOriginPotentiallyTrustworthy (origin) {
  21544. // If origin is explicitly null, return false
  21545. if (origin == null || origin === 'null') return false
  21546. const originAsURL = new URL(origin)
  21547. // If secure, return true
  21548. if (originAsURL.protocol === 'https:' || originAsURL.protocol === 'wss:') {
  21549. return true
  21550. }
  21551. // If localhost or variants, return true
  21552. if (/^127(?:\.[0-9]+){0,2}\.[0-9]+$|^\[(?:0*:)*?:?0*1\]$/.test(originAsURL.hostname) ||
  21553. (originAsURL.hostname === 'localhost' || originAsURL.hostname.includes('localhost.')) ||
  21554. (originAsURL.hostname.endsWith('.localhost'))) {
  21555. return true
  21556. }
  21557. // If any other, return false
  21558. return false
  21559. }
  21560. }
  21561. /**
  21562. * @see https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist
  21563. * @param {Uint8Array} bytes
  21564. * @param {string} metadataList
  21565. */
  21566. function bytesMatch (bytes, metadataList) {
  21567. // If node is not built with OpenSSL support, we cannot check
  21568. // a request's integrity, so allow it by default (the spec will
  21569. // allow requests if an invalid hash is given, as precedence).
  21570. /* istanbul ignore if: only if node is built with --without-ssl */
  21571. if (crypto === undefined) {
  21572. return true
  21573. }
  21574. // 1. Let parsedMetadata be the result of parsing metadataList.
  21575. const parsedMetadata = parseMetadata(metadataList)
  21576. // 2. If parsedMetadata is no metadata, return true.
  21577. if (parsedMetadata === 'no metadata') {
  21578. return true
  21579. }
  21580. // 3. If response is not eligible for integrity validation, return false.
  21581. // TODO
  21582. // 4. If parsedMetadata is the empty set, return true.
  21583. if (parsedMetadata.length === 0) {
  21584. return true
  21585. }
  21586. // 5. Let metadata be the result of getting the strongest
  21587. // metadata from parsedMetadata.
  21588. const strongest = getStrongestMetadata(parsedMetadata)
  21589. const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest)
  21590. // 6. For each item in metadata:
  21591. for (const item of metadata) {
  21592. // 1. Let algorithm be the alg component of item.
  21593. const algorithm = item.algo
  21594. // 2. Let expectedValue be the val component of item.
  21595. const expectedValue = item.hash
  21596. // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
  21597. // "be liberal with padding". This is annoying, and it's not even in the spec.
  21598. // 3. Let actualValue be the result of applying algorithm to bytes.
  21599. let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64')
  21600. if (actualValue[actualValue.length - 1] === '=') {
  21601. if (actualValue[actualValue.length - 2] === '=') {
  21602. actualValue = actualValue.slice(0, -2)
  21603. } else {
  21604. actualValue = actualValue.slice(0, -1)
  21605. }
  21606. }
  21607. // 4. If actualValue is a case-sensitive match for expectedValue,
  21608. // return true.
  21609. if (compareBase64Mixed(actualValue, expectedValue)) {
  21610. return true
  21611. }
  21612. }
  21613. // 7. Return false.
  21614. return false
  21615. }
  21616. // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
  21617. // https://www.w3.org/TR/CSP2/#source-list-syntax
  21618. // https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
  21619. const parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i
  21620. /**
  21621. * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
  21622. * @param {string} metadata
  21623. */
  21624. function parseMetadata (metadata) {
  21625. // 1. Let result be the empty set.
  21626. /** @type {{ algo: string, hash: string }[]} */
  21627. const result = []
  21628. // 2. Let empty be equal to true.
  21629. let empty = true
  21630. // 3. For each token returned by splitting metadata on spaces:
  21631. for (const token of metadata.split(' ')) {
  21632. // 1. Set empty to false.
  21633. empty = false
  21634. // 2. Parse token as a hash-with-options.
  21635. const parsedToken = parseHashWithOptions.exec(token)
  21636. // 3. If token does not parse, continue to the next token.
  21637. if (
  21638. parsedToken === null ||
  21639. parsedToken.groups === undefined ||
  21640. parsedToken.groups.algo === undefined
  21641. ) {
  21642. // Note: Chromium blocks the request at this point, but Firefox
  21643. // gives a warning that an invalid integrity was given. The
  21644. // correct behavior is to ignore these, and subsequently not
  21645. // check the integrity of the resource.
  21646. continue
  21647. }
  21648. // 4. Let algorithm be the hash-algo component of token.
  21649. const algorithm = parsedToken.groups.algo.toLowerCase()
  21650. // 5. If algorithm is a hash function recognized by the user
  21651. // agent, add the parsed token to result.
  21652. if (supportedHashes.includes(algorithm)) {
  21653. result.push(parsedToken.groups)
  21654. }
  21655. }
  21656. // 4. Return no metadata if empty is true, otherwise return result.
  21657. if (empty === true) {
  21658. return 'no metadata'
  21659. }
  21660. return result
  21661. }
  21662. /**
  21663. * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList
  21664. */
  21665. function getStrongestMetadata (metadataList) {
  21666. // Let algorithm be the algo component of the first item in metadataList.
  21667. // Can be sha256
  21668. let algorithm = metadataList[0].algo
  21669. // If the algorithm is sha512, then it is the strongest
  21670. // and we can return immediately
  21671. if (algorithm[3] === '5') {
  21672. return algorithm
  21673. }
  21674. for (let i = 1; i < metadataList.length; ++i) {
  21675. const metadata = metadataList[i]
  21676. // If the algorithm is sha512, then it is the strongest
  21677. // and we can break the loop immediately
  21678. if (metadata.algo[3] === '5') {
  21679. algorithm = 'sha512'
  21680. break
  21681. // If the algorithm is sha384, then a potential sha256 or sha384 is ignored
  21682. } else if (algorithm[3] === '3') {
  21683. continue
  21684. // algorithm is sha256, check if algorithm is sha384 and if so, set it as
  21685. // the strongest
  21686. } else if (metadata.algo[3] === '3') {
  21687. algorithm = 'sha384'
  21688. }
  21689. }
  21690. return algorithm
  21691. }
  21692. function filterMetadataListByAlgorithm (metadataList, algorithm) {
  21693. if (metadataList.length === 1) {
  21694. return metadataList
  21695. }
  21696. let pos = 0
  21697. for (let i = 0; i < metadataList.length; ++i) {
  21698. if (metadataList[i].algo === algorithm) {
  21699. metadataList[pos++] = metadataList[i]
  21700. }
  21701. }
  21702. metadataList.length = pos
  21703. return metadataList
  21704. }
  21705. /**
  21706. * Compares two base64 strings, allowing for base64url
  21707. * in the second string.
  21708. *
  21709. * @param {string} actualValue always base64
  21710. * @param {string} expectedValue base64 or base64url
  21711. * @returns {boolean}
  21712. */
  21713. function compareBase64Mixed (actualValue, expectedValue) {
  21714. if (actualValue.length !== expectedValue.length) {
  21715. return false
  21716. }
  21717. for (let i = 0; i < actualValue.length; ++i) {
  21718. if (actualValue[i] !== expectedValue[i]) {
  21719. if (
  21720. (actualValue[i] === '+' && expectedValue[i] === '-') ||
  21721. (actualValue[i] === '/' && expectedValue[i] === '_')
  21722. ) {
  21723. continue
  21724. }
  21725. return false
  21726. }
  21727. }
  21728. return true
  21729. }
  21730. // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
  21731. function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) {
  21732. // TODO
  21733. }
  21734. /**
  21735. * @link {https://html.spec.whatwg.org/multipage/origin.html#same-origin}
  21736. * @param {URL} A
  21737. * @param {URL} B
  21738. */
  21739. function sameOrigin (A, B) {
  21740. // 1. If A and B are the same opaque origin, then return true.
  21741. if (A.origin === B.origin && A.origin === 'null') {
  21742. return true
  21743. }
  21744. // 2. If A and B are both tuple origins and their schemes,
  21745. // hosts, and port are identical, then return true.
  21746. if (A.protocol === B.protocol && A.hostname === B.hostname && A.port === B.port) {
  21747. return true
  21748. }
  21749. // 3. Return false.
  21750. return false
  21751. }
  21752. function createDeferredPromise () {
  21753. let res
  21754. let rej
  21755. const promise = new Promise((resolve, reject) => {
  21756. res = resolve
  21757. rej = reject
  21758. })
  21759. return { promise, resolve: res, reject: rej }
  21760. }
  21761. function isAborted (fetchParams) {
  21762. return fetchParams.controller.state === 'aborted'
  21763. }
  21764. function isCancelled (fetchParams) {
  21765. return fetchParams.controller.state === 'aborted' ||
  21766. fetchParams.controller.state === 'terminated'
  21767. }
  21768. /**
  21769. * @see https://fetch.spec.whatwg.org/#concept-method-normalize
  21770. * @param {string} method
  21771. */
  21772. function normalizeMethod (method) {
  21773. return normalizedMethodRecordsBase[method.toLowerCase()] ?? method
  21774. }
  21775. // https://infra.spec.whatwg.org/#serialize-a-javascript-value-to-a-json-string
  21776. function serializeJavascriptValueToJSONString (value) {
  21777. // 1. Let result be ? Call(%JSON.stringify%, undefined, « value »).
  21778. const result = JSON.stringify(value)
  21779. // 2. If result is undefined, then throw a TypeError.
  21780. if (result === undefined) {
  21781. throw new TypeError('Value is not JSON serializable')
  21782. }
  21783. // 3. Assert: result is a string.
  21784. assert(typeof result === 'string')
  21785. // 4. Return result.
  21786. return result
  21787. }
  21788. // https://tc39.es/ecma262/#sec-%25iteratorprototype%25-object
  21789. const esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))
  21790. /**
  21791. * @see https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object
  21792. * @param {string} name name of the instance
  21793. * @param {symbol} kInternalIterator
  21794. * @param {string | number} [keyIndex]
  21795. * @param {string | number} [valueIndex]
  21796. */
  21797. function createIterator (name, kInternalIterator, keyIndex = 0, valueIndex = 1) {
  21798. class FastIterableIterator {
  21799. /** @type {any} */
  21800. #target
  21801. /** @type {'key' | 'value' | 'key+value'} */
  21802. #kind
  21803. /** @type {number} */
  21804. #index
  21805. /**
  21806. * @see https://webidl.spec.whatwg.org/#dfn-default-iterator-object
  21807. * @param {unknown} target
  21808. * @param {'key' | 'value' | 'key+value'} kind
  21809. */
  21810. constructor (target, kind) {
  21811. this.#target = target
  21812. this.#kind = kind
  21813. this.#index = 0
  21814. }
  21815. next () {
  21816. // 1. Let interface be the interface for which the iterator prototype object exists.
  21817. // 2. Let thisValue be the this value.
  21818. // 3. Let object be ? ToObject(thisValue).
  21819. // 4. If object is a platform object, then perform a security
  21820. // check, passing:
  21821. // 5. If object is not a default iterator object for interface,
  21822. // then throw a TypeError.
  21823. if (typeof this !== 'object' || this === null || !(#target in this)) {
  21824. throw new TypeError(
  21825. `'next' called on an object that does not implement interface ${name} Iterator.`
  21826. )
  21827. }
  21828. // 6. Let index be object’s index.
  21829. // 7. Let kind be object’s kind.
  21830. // 8. Let values be object’s target's value pairs to iterate over.
  21831. const index = this.#index
  21832. const values = this.#target[kInternalIterator]
  21833. // 9. Let len be the length of values.
  21834. const len = values.length
  21835. // 10. If index is greater than or equal to len, then return
  21836. // CreateIterResultObject(undefined, true).
  21837. if (index >= len) {
  21838. return {
  21839. value: undefined,
  21840. done: true
  21841. }
  21842. }
  21843. // 11. Let pair be the entry in values at index index.
  21844. const { [keyIndex]: key, [valueIndex]: value } = values[index]
  21845. // 12. Set object’s index to index + 1.
  21846. this.#index = index + 1
  21847. // 13. Return the iterator result for pair and kind.
  21848. // https://webidl.spec.whatwg.org/#iterator-result
  21849. // 1. Let result be a value determined by the value of kind:
  21850. let result
  21851. switch (this.#kind) {
  21852. case 'key':
  21853. // 1. Let idlKey be pair’s key.
  21854. // 2. Let key be the result of converting idlKey to an
  21855. // ECMAScript value.
  21856. // 3. result is key.
  21857. result = key
  21858. break
  21859. case 'value':
  21860. // 1. Let idlValue be pair’s value.
  21861. // 2. Let value be the result of converting idlValue to
  21862. // an ECMAScript value.
  21863. // 3. result is value.
  21864. result = value
  21865. break
  21866. case 'key+value':
  21867. // 1. Let idlKey be pair’s key.
  21868. // 2. Let idlValue be pair’s value.
  21869. // 3. Let key be the result of converting idlKey to an
  21870. // ECMAScript value.
  21871. // 4. Let value be the result of converting idlValue to
  21872. // an ECMAScript value.
  21873. // 5. Let array be ! ArrayCreate(2).
  21874. // 6. Call ! CreateDataProperty(array, "0", key).
  21875. // 7. Call ! CreateDataProperty(array, "1", value).
  21876. // 8. result is array.
  21877. result = [key, value]
  21878. break
  21879. }
  21880. // 2. Return CreateIterResultObject(result, false).
  21881. return {
  21882. value: result,
  21883. done: false
  21884. }
  21885. }
  21886. }
  21887. // https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object
  21888. // @ts-ignore
  21889. delete FastIterableIterator.prototype.constructor
  21890. Object.setPrototypeOf(FastIterableIterator.prototype, esIteratorPrototype)
  21891. Object.defineProperties(FastIterableIterator.prototype, {
  21892. [Symbol.toStringTag]: {
  21893. writable: false,
  21894. enumerable: false,
  21895. configurable: true,
  21896. value: `${name} Iterator`
  21897. },
  21898. next: { writable: true, enumerable: true, configurable: true }
  21899. })
  21900. /**
  21901. * @param {unknown} target
  21902. * @param {'key' | 'value' | 'key+value'} kind
  21903. * @returns {IterableIterator<any>}
  21904. */
  21905. return function (target, kind) {
  21906. return new FastIterableIterator(target, kind)
  21907. }
  21908. }
  21909. /**
  21910. * @see https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object
  21911. * @param {string} name name of the instance
  21912. * @param {any} object class
  21913. * @param {symbol} kInternalIterator
  21914. * @param {string | number} [keyIndex]
  21915. * @param {string | number} [valueIndex]
  21916. */
  21917. function iteratorMixin (name, object, kInternalIterator, keyIndex = 0, valueIndex = 1) {
  21918. const makeIterator = createIterator(name, kInternalIterator, keyIndex, valueIndex)
  21919. const properties = {
  21920. keys: {
  21921. writable: true,
  21922. enumerable: true,
  21923. configurable: true,
  21924. value: function keys () {
  21925. webidl.brandCheck(this, object)
  21926. return makeIterator(this, 'key')
  21927. }
  21928. },
  21929. values: {
  21930. writable: true,
  21931. enumerable: true,
  21932. configurable: true,
  21933. value: function values () {
  21934. webidl.brandCheck(this, object)
  21935. return makeIterator(this, 'value')
  21936. }
  21937. },
  21938. entries: {
  21939. writable: true,
  21940. enumerable: true,
  21941. configurable: true,
  21942. value: function entries () {
  21943. webidl.brandCheck(this, object)
  21944. return makeIterator(this, 'key+value')
  21945. }
  21946. },
  21947. forEach: {
  21948. writable: true,
  21949. enumerable: true,
  21950. configurable: true,
  21951. value: function forEach (callbackfn, thisArg = globalThis) {
  21952. webidl.brandCheck(this, object)
  21953. webidl.argumentLengthCheck(arguments, 1, `${name}.forEach`)
  21954. if (typeof callbackfn !== 'function') {
  21955. throw new TypeError(
  21956. `Failed to execute 'forEach' on '${name}': parameter 1 is not of type 'Function'.`
  21957. )
  21958. }
  21959. for (const { 0: key, 1: value } of makeIterator(this, 'key+value')) {
  21960. callbackfn.call(thisArg, value, key, this)
  21961. }
  21962. }
  21963. }
  21964. }
  21965. return Object.defineProperties(object.prototype, {
  21966. ...properties,
  21967. [Symbol.iterator]: {
  21968. writable: true,
  21969. enumerable: false,
  21970. configurable: true,
  21971. value: properties.entries.value
  21972. }
  21973. })
  21974. }
  21975. /**
  21976. * @see https://fetch.spec.whatwg.org/#body-fully-read
  21977. */
  21978. async function fullyReadBody (body, processBody, processBodyError) {
  21979. // 1. If taskDestination is null, then set taskDestination to
  21980. // the result of starting a new parallel queue.
  21981. // 2. Let successSteps given a byte sequence bytes be to queue a
  21982. // fetch task to run processBody given bytes, with taskDestination.
  21983. const successSteps = processBody
  21984. // 3. Let errorSteps be to queue a fetch task to run processBodyError,
  21985. // with taskDestination.
  21986. const errorSteps = processBodyError
  21987. // 4. Let reader be the result of getting a reader for body’s stream.
  21988. // If that threw an exception, then run errorSteps with that
  21989. // exception and return.
  21990. let reader
  21991. try {
  21992. reader = body.stream.getReader()
  21993. } catch (e) {
  21994. errorSteps(e)
  21995. return
  21996. }
  21997. // 5. Read all bytes from reader, given successSteps and errorSteps.
  21998. try {
  21999. successSteps(await readAllBytes(reader))
  22000. } catch (e) {
  22001. errorSteps(e)
  22002. }
  22003. }
  22004. function isReadableStreamLike (stream) {
  22005. return stream instanceof ReadableStream || (
  22006. stream[Symbol.toStringTag] === 'ReadableStream' &&
  22007. typeof stream.tee === 'function'
  22008. )
  22009. }
  22010. /**
  22011. * @param {ReadableStreamController<Uint8Array>} controller
  22012. */
  22013. function readableStreamClose (controller) {
  22014. try {
  22015. controller.close()
  22016. controller.byobRequest?.respond(0)
  22017. } catch (err) {
  22018. // TODO: add comment explaining why this error occurs.
  22019. if (!err.message.includes('Controller is already closed') && !err.message.includes('ReadableStream is already closed')) {
  22020. throw err
  22021. }
  22022. }
  22023. }
  22024. const invalidIsomorphicEncodeValueRegex = /[^\x00-\xFF]/ // eslint-disable-line
  22025. /**
  22026. * @see https://infra.spec.whatwg.org/#isomorphic-encode
  22027. * @param {string} input
  22028. */
  22029. function isomorphicEncode (input) {
  22030. // 1. Assert: input contains no code points greater than U+00FF.
  22031. assert(!invalidIsomorphicEncodeValueRegex.test(input))
  22032. // 2. Return a byte sequence whose length is equal to input’s code
  22033. // point length and whose bytes have the same values as the
  22034. // values of input’s code points, in the same order
  22035. return input
  22036. }
  22037. /**
  22038. * @see https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes
  22039. * @see https://streams.spec.whatwg.org/#read-loop
  22040. * @param {ReadableStreamDefaultReader} reader
  22041. */
  22042. async function readAllBytes (reader) {
  22043. const bytes = []
  22044. let byteLength = 0
  22045. while (true) {
  22046. const { done, value: chunk } = await reader.read()
  22047. if (done) {
  22048. // 1. Call successSteps with bytes.
  22049. return Buffer.concat(bytes, byteLength)
  22050. }
  22051. // 1. If chunk is not a Uint8Array object, call failureSteps
  22052. // with a TypeError and abort these steps.
  22053. if (!isUint8Array(chunk)) {
  22054. throw new TypeError('Received non-Uint8Array chunk')
  22055. }
  22056. // 2. Append the bytes represented by chunk to bytes.
  22057. bytes.push(chunk)
  22058. byteLength += chunk.length
  22059. // 3. Read-loop given reader, bytes, successSteps, and failureSteps.
  22060. }
  22061. }
  22062. /**
  22063. * @see https://fetch.spec.whatwg.org/#is-local
  22064. * @param {URL} url
  22065. */
  22066. function urlIsLocal (url) {
  22067. assert('protocol' in url) // ensure it's a url object
  22068. const protocol = url.protocol
  22069. return protocol === 'about:' || protocol === 'blob:' || protocol === 'data:'
  22070. }
  22071. /**
  22072. * @param {string|URL} url
  22073. * @returns {boolean}
  22074. */
  22075. function urlHasHttpsScheme (url) {
  22076. return (
  22077. (
  22078. typeof url === 'string' &&
  22079. url[5] === ':' &&
  22080. url[0] === 'h' &&
  22081. url[1] === 't' &&
  22082. url[2] === 't' &&
  22083. url[3] === 'p' &&
  22084. url[4] === 's'
  22085. ) ||
  22086. url.protocol === 'https:'
  22087. )
  22088. }
  22089. /**
  22090. * @see https://fetch.spec.whatwg.org/#http-scheme
  22091. * @param {URL} url
  22092. */
  22093. function urlIsHttpHttpsScheme (url) {
  22094. assert('protocol' in url) // ensure it's a url object
  22095. const protocol = url.protocol
  22096. return protocol === 'http:' || protocol === 'https:'
  22097. }
  22098. /**
  22099. * @see https://fetch.spec.whatwg.org/#simple-range-header-value
  22100. * @param {string} value
  22101. * @param {boolean} allowWhitespace
  22102. */
  22103. function simpleRangeHeaderValue (value, allowWhitespace) {
  22104. // 1. Let data be the isomorphic decoding of value.
  22105. // Note: isomorphic decoding takes a sequence of bytes (ie. a Uint8Array) and turns it into a string,
  22106. // nothing more. We obviously don't need to do that if value is a string already.
  22107. const data = value
  22108. // 2. If data does not start with "bytes", then return failure.
  22109. if (!data.startsWith('bytes')) {
  22110. return 'failure'
  22111. }
  22112. // 3. Let position be a position variable for data, initially pointing at the 5th code point of data.
  22113. const position = { position: 5 }
  22114. // 4. If allowWhitespace is true, collect a sequence of code points that are HTTP tab or space,
  22115. // from data given position.
  22116. if (allowWhitespace) {
  22117. collectASequenceOfCodePoints(
  22118. (char) => char === '\t' || char === ' ',
  22119. data,
  22120. position
  22121. )
  22122. }
  22123. // 5. If the code point at position within data is not U+003D (=), then return failure.
  22124. if (data.charCodeAt(position.position) !== 0x3D) {
  22125. return 'failure'
  22126. }
  22127. // 6. Advance position by 1.
  22128. position.position++
  22129. // 7. If allowWhitespace is true, collect a sequence of code points that are HTTP tab or space, from
  22130. // data given position.
  22131. if (allowWhitespace) {
  22132. collectASequenceOfCodePoints(
  22133. (char) => char === '\t' || char === ' ',
  22134. data,
  22135. position
  22136. )
  22137. }
  22138. // 8. Let rangeStart be the result of collecting a sequence of code points that are ASCII digits,
  22139. // from data given position.
  22140. const rangeStart = collectASequenceOfCodePoints(
  22141. (char) => {
  22142. const code = char.charCodeAt(0)
  22143. return code >= 0x30 && code <= 0x39
  22144. },
  22145. data,
  22146. position
  22147. )
  22148. // 9. Let rangeStartValue be rangeStart, interpreted as decimal number, if rangeStart is not the
  22149. // empty string; otherwise null.
  22150. const rangeStartValue = rangeStart.length ? Number(rangeStart) : null
  22151. // 10. If allowWhitespace is true, collect a sequence of code points that are HTTP tab or space,
  22152. // from data given position.
  22153. if (allowWhitespace) {
  22154. collectASequenceOfCodePoints(
  22155. (char) => char === '\t' || char === ' ',
  22156. data,
  22157. position
  22158. )
  22159. }
  22160. // 11. If the code point at position within data is not U+002D (-), then return failure.
  22161. if (data.charCodeAt(position.position) !== 0x2D) {
  22162. return 'failure'
  22163. }
  22164. // 12. Advance position by 1.
  22165. position.position++
  22166. // 13. If allowWhitespace is true, collect a sequence of code points that are HTTP tab
  22167. // or space, from data given position.
  22168. // Note from Khafra: its the same step as in #8 again lol
  22169. if (allowWhitespace) {
  22170. collectASequenceOfCodePoints(
  22171. (char) => char === '\t' || char === ' ',
  22172. data,
  22173. position
  22174. )
  22175. }
  22176. // 14. Let rangeEnd be the result of collecting a sequence of code points that are
  22177. // ASCII digits, from data given position.
  22178. // Note from Khafra: you wouldn't guess it, but this is also the same step as #8
  22179. const rangeEnd = collectASequenceOfCodePoints(
  22180. (char) => {
  22181. const code = char.charCodeAt(0)
  22182. return code >= 0x30 && code <= 0x39
  22183. },
  22184. data,
  22185. position
  22186. )
  22187. // 15. Let rangeEndValue be rangeEnd, interpreted as decimal number, if rangeEnd
  22188. // is not the empty string; otherwise null.
  22189. // Note from Khafra: THE SAME STEP, AGAIN!!!
  22190. // Note: why interpret as a decimal if we only collect ascii digits?
  22191. const rangeEndValue = rangeEnd.length ? Number(rangeEnd) : null
  22192. // 16. If position is not past the end of data, then return failure.
  22193. if (position.position < data.length) {
  22194. return 'failure'
  22195. }
  22196. // 17. If rangeEndValue and rangeStartValue are null, then return failure.
  22197. if (rangeEndValue === null && rangeStartValue === null) {
  22198. return 'failure'
  22199. }
  22200. // 18. If rangeStartValue and rangeEndValue are numbers, and rangeStartValue is
  22201. // greater than rangeEndValue, then return failure.
  22202. // Note: ... when can they not be numbers?
  22203. if (rangeStartValue > rangeEndValue) {
  22204. return 'failure'
  22205. }
  22206. // 19. Return (rangeStartValue, rangeEndValue).
  22207. return { rangeStartValue, rangeEndValue }
  22208. }
  22209. /**
  22210. * @see https://fetch.spec.whatwg.org/#build-a-content-range
  22211. * @param {number} rangeStart
  22212. * @param {number} rangeEnd
  22213. * @param {number} fullLength
  22214. */
  22215. function buildContentRange (rangeStart, rangeEnd, fullLength) {
  22216. // 1. Let contentRange be `bytes `.
  22217. let contentRange = 'bytes '
  22218. // 2. Append rangeStart, serialized and isomorphic encoded, to contentRange.
  22219. contentRange += isomorphicEncode(`${rangeStart}`)
  22220. // 3. Append 0x2D (-) to contentRange.
  22221. contentRange += '-'
  22222. // 4. Append rangeEnd, serialized and isomorphic encoded to contentRange.
  22223. contentRange += isomorphicEncode(`${rangeEnd}`)
  22224. // 5. Append 0x2F (/) to contentRange.
  22225. contentRange += '/'
  22226. // 6. Append fullLength, serialized and isomorphic encoded to contentRange.
  22227. contentRange += isomorphicEncode(`${fullLength}`)
  22228. // 7. Return contentRange.
  22229. return contentRange
  22230. }
  22231. // A Stream, which pipes the response to zlib.createInflate() or
  22232. // zlib.createInflateRaw() depending on the first byte of the Buffer.
  22233. // If the lower byte of the first byte is 0x08, then the stream is
  22234. // interpreted as a zlib stream, otherwise it's interpreted as a
  22235. // raw deflate stream.
  22236. class InflateStream extends Transform {
  22237. #zlibOptions
  22238. /** @param {zlib.ZlibOptions} [zlibOptions] */
  22239. constructor (zlibOptions) {
  22240. super()
  22241. this.#zlibOptions = zlibOptions
  22242. }
  22243. _transform (chunk, encoding, callback) {
  22244. if (!this._inflateStream) {
  22245. if (chunk.length === 0) {
  22246. callback()
  22247. return
  22248. }
  22249. this._inflateStream = (chunk[0] & 0x0F) === 0x08
  22250. ? zlib.createInflate(this.#zlibOptions)
  22251. : zlib.createInflateRaw(this.#zlibOptions)
  22252. this._inflateStream.on('data', this.push.bind(this))
  22253. this._inflateStream.on('end', () => this.push(null))
  22254. this._inflateStream.on('error', (err) => this.destroy(err))
  22255. }
  22256. this._inflateStream.write(chunk, encoding, callback)
  22257. }
  22258. _final (callback) {
  22259. if (this._inflateStream) {
  22260. this._inflateStream.end()
  22261. this._inflateStream = null
  22262. }
  22263. callback()
  22264. }
  22265. }
  22266. /**
  22267. * @param {zlib.ZlibOptions} [zlibOptions]
  22268. * @returns {InflateStream}
  22269. */
  22270. function createInflate (zlibOptions) {
  22271. return new InflateStream(zlibOptions)
  22272. }
  22273. /**
  22274. * @see https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
  22275. * @param {import('./headers').HeadersList} headers
  22276. */
  22277. function extractMimeType (headers) {
  22278. // 1. Let charset be null.
  22279. let charset = null
  22280. // 2. Let essence be null.
  22281. let essence = null
  22282. // 3. Let mimeType be null.
  22283. let mimeType = null
  22284. // 4. Let values be the result of getting, decoding, and splitting `Content-Type` from headers.
  22285. const values = getDecodeSplit('content-type', headers)
  22286. // 5. If values is null, then return failure.
  22287. if (values === null) {
  22288. return 'failure'
  22289. }
  22290. // 6. For each value of values:
  22291. for (const value of values) {
  22292. // 6.1. Let temporaryMimeType be the result of parsing value.
  22293. const temporaryMimeType = parseMIMEType(value)
  22294. // 6.2. If temporaryMimeType is failure or its essence is "*/*", then continue.
  22295. if (temporaryMimeType === 'failure' || temporaryMimeType.essence === '*/*') {
  22296. continue
  22297. }
  22298. // 6.3. Set mimeType to temporaryMimeType.
  22299. mimeType = temporaryMimeType
  22300. // 6.4. If mimeType’s essence is not essence, then:
  22301. if (mimeType.essence !== essence) {
  22302. // 6.4.1. Set charset to null.
  22303. charset = null
  22304. // 6.4.2. If mimeType’s parameters["charset"] exists, then set charset to
  22305. // mimeType’s parameters["charset"].
  22306. if (mimeType.parameters.has('charset')) {
  22307. charset = mimeType.parameters.get('charset')
  22308. }
  22309. // 6.4.3. Set essence to mimeType’s essence.
  22310. essence = mimeType.essence
  22311. } else if (!mimeType.parameters.has('charset') && charset !== null) {
  22312. // 6.5. Otherwise, if mimeType’s parameters["charset"] does not exist, and
  22313. // charset is non-null, set mimeType’s parameters["charset"] to charset.
  22314. mimeType.parameters.set('charset', charset)
  22315. }
  22316. }
  22317. // 7. If mimeType is null, then return failure.
  22318. if (mimeType == null) {
  22319. return 'failure'
  22320. }
  22321. // 8. Return mimeType.
  22322. return mimeType
  22323. }
  22324. /**
  22325. * @see https://fetch.spec.whatwg.org/#header-value-get-decode-and-split
  22326. * @param {string|null} value
  22327. */
  22328. function gettingDecodingSplitting (value) {
  22329. // 1. Let input be the result of isomorphic decoding value.
  22330. const input = value
  22331. // 2. Let position be a position variable for input, initially pointing at the start of input.
  22332. const position = { position: 0 }
  22333. // 3. Let values be a list of strings, initially empty.
  22334. const values = []
  22335. // 4. Let temporaryValue be the empty string.
  22336. let temporaryValue = ''
  22337. // 5. While position is not past the end of input:
  22338. while (position.position < input.length) {
  22339. // 5.1. Append the result of collecting a sequence of code points that are not U+0022 (")
  22340. // or U+002C (,) from input, given position, to temporaryValue.
  22341. temporaryValue += collectASequenceOfCodePoints(
  22342. (char) => char !== '"' && char !== ',',
  22343. input,
  22344. position
  22345. )
  22346. // 5.2. If position is not past the end of input, then:
  22347. if (position.position < input.length) {
  22348. // 5.2.1. If the code point at position within input is U+0022 ("), then:
  22349. if (input.charCodeAt(position.position) === 0x22) {
  22350. // 5.2.1.1. Append the result of collecting an HTTP quoted string from input, given position, to temporaryValue.
  22351. temporaryValue += collectAnHTTPQuotedString(
  22352. input,
  22353. position
  22354. )
  22355. // 5.2.1.2. If position is not past the end of input, then continue.
  22356. if (position.position < input.length) {
  22357. continue
  22358. }
  22359. } else {
  22360. // 5.2.2. Otherwise:
  22361. // 5.2.2.1. Assert: the code point at position within input is U+002C (,).
  22362. assert(input.charCodeAt(position.position) === 0x2C)
  22363. // 5.2.2.2. Advance position by 1.
  22364. position.position++
  22365. }
  22366. }
  22367. // 5.3. Remove all HTTP tab or space from the start and end of temporaryValue.
  22368. temporaryValue = removeChars(temporaryValue, true, true, (char) => char === 0x9 || char === 0x20)
  22369. // 5.4. Append temporaryValue to values.
  22370. values.push(temporaryValue)
  22371. // 5.6. Set temporaryValue to the empty string.
  22372. temporaryValue = ''
  22373. }
  22374. // 6. Return values.
  22375. return values
  22376. }
  22377. /**
  22378. * @see https://fetch.spec.whatwg.org/#concept-header-list-get-decode-split
  22379. * @param {string} name lowercase header name
  22380. * @param {import('./headers').HeadersList} list
  22381. */
  22382. function getDecodeSplit (name, list) {
  22383. // 1. Let value be the result of getting name from list.
  22384. const value = list.get(name, true)
  22385. // 2. If value is null, then return null.
  22386. if (value === null) {
  22387. return null
  22388. }
  22389. // 3. Return the result of getting, decoding, and splitting value.
  22390. return gettingDecodingSplitting(value)
  22391. }
  22392. const textDecoder = new TextDecoder()
  22393. /**
  22394. * @see https://encoding.spec.whatwg.org/#utf-8-decode
  22395. * @param {Buffer} buffer
  22396. */
  22397. function utf8DecodeBytes (buffer) {
  22398. if (buffer.length === 0) {
  22399. return ''
  22400. }
  22401. // 1. Let buffer be the result of peeking three bytes from
  22402. // ioQueue, converted to a byte sequence.
  22403. // 2. If buffer is 0xEF 0xBB 0xBF, then read three
  22404. // bytes from ioQueue. (Do nothing with those bytes.)
  22405. if (buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
  22406. buffer = buffer.subarray(3)
  22407. }
  22408. // 3. Process a queue with an instance of UTF-8’s
  22409. // decoder, ioQueue, output, and "replacement".
  22410. const output = textDecoder.decode(buffer)
  22411. // 4. Return output.
  22412. return output
  22413. }
  22414. class EnvironmentSettingsObjectBase {
  22415. get baseUrl () {
  22416. return getGlobalOrigin()
  22417. }
  22418. get origin () {
  22419. return this.baseUrl?.origin
  22420. }
  22421. policyContainer = makePolicyContainer()
  22422. }
  22423. class EnvironmentSettingsObject {
  22424. settingsObject = new EnvironmentSettingsObjectBase()
  22425. }
  22426. const environmentSettingsObject = new EnvironmentSettingsObject()
  22427. module.exports = {
  22428. isAborted,
  22429. isCancelled,
  22430. isValidEncodedURL,
  22431. createDeferredPromise,
  22432. ReadableStreamFrom,
  22433. tryUpgradeRequestToAPotentiallyTrustworthyURL,
  22434. clampAndCoarsenConnectionTimingInfo,
  22435. coarsenedSharedCurrentTime,
  22436. determineRequestsReferrer,
  22437. makePolicyContainer,
  22438. clonePolicyContainer,
  22439. appendFetchMetadata,
  22440. appendRequestOriginHeader,
  22441. TAOCheck,
  22442. corsCheck,
  22443. crossOriginResourcePolicyCheck,
  22444. createOpaqueTimingInfo,
  22445. setRequestReferrerPolicyOnRedirect,
  22446. isValidHTTPToken,
  22447. requestBadPort,
  22448. requestCurrentURL,
  22449. responseURL,
  22450. responseLocationURL,
  22451. isBlobLike,
  22452. isURLPotentiallyTrustworthy,
  22453. isValidReasonPhrase,
  22454. sameOrigin,
  22455. normalizeMethod,
  22456. serializeJavascriptValueToJSONString,
  22457. iteratorMixin,
  22458. createIterator,
  22459. isValidHeaderName,
  22460. isValidHeaderValue,
  22461. isErrorLike,
  22462. fullyReadBody,
  22463. bytesMatch,
  22464. isReadableStreamLike,
  22465. readableStreamClose,
  22466. isomorphicEncode,
  22467. urlIsLocal,
  22468. urlHasHttpsScheme,
  22469. urlIsHttpHttpsScheme,
  22470. readAllBytes,
  22471. simpleRangeHeaderValue,
  22472. buildContentRange,
  22473. parseMetadata,
  22474. createInflate,
  22475. extractMimeType,
  22476. getDecodeSplit,
  22477. utf8DecodeBytes,
  22478. environmentSettingsObject
  22479. }
  22480. /***/ }),
  22481. /***/ 5893:
  22482. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  22483. const { types, inspect } = __nccwpck_require__(7975)
  22484. const { markAsUncloneable } = __nccwpck_require__(5919)
  22485. const { toUSVString } = __nccwpck_require__(3440)
  22486. /** @type {import('../../../types/webidl').Webidl} */
  22487. const webidl = {}
  22488. webidl.converters = {}
  22489. webidl.util = {}
  22490. webidl.errors = {}
  22491. webidl.errors.exception = function (message) {
  22492. return new TypeError(`${message.header}: ${message.message}`)
  22493. }
  22494. webidl.errors.conversionFailed = function (context) {
  22495. const plural = context.types.length === 1 ? '' : ' one of'
  22496. const message =
  22497. `${context.argument} could not be converted to` +
  22498. `${plural}: ${context.types.join(', ')}.`
  22499. return webidl.errors.exception({
  22500. header: context.prefix,
  22501. message
  22502. })
  22503. }
  22504. webidl.errors.invalidArgument = function (context) {
  22505. return webidl.errors.exception({
  22506. header: context.prefix,
  22507. message: `"${context.value}" is an invalid ${context.type}.`
  22508. })
  22509. }
  22510. // https://webidl.spec.whatwg.org/#implements
  22511. webidl.brandCheck = function (V, I, opts) {
  22512. if (opts?.strict !== false) {
  22513. if (!(V instanceof I)) {
  22514. const err = new TypeError('Illegal invocation')
  22515. err.code = 'ERR_INVALID_THIS' // node compat.
  22516. throw err
  22517. }
  22518. } else {
  22519. if (V?.[Symbol.toStringTag] !== I.prototype[Symbol.toStringTag]) {
  22520. const err = new TypeError('Illegal invocation')
  22521. err.code = 'ERR_INVALID_THIS' // node compat.
  22522. throw err
  22523. }
  22524. }
  22525. }
  22526. webidl.argumentLengthCheck = function ({ length }, min, ctx) {
  22527. if (length < min) {
  22528. throw webidl.errors.exception({
  22529. message: `${min} argument${min !== 1 ? 's' : ''} required, ` +
  22530. `but${length ? ' only' : ''} ${length} found.`,
  22531. header: ctx
  22532. })
  22533. }
  22534. }
  22535. webidl.illegalConstructor = function () {
  22536. throw webidl.errors.exception({
  22537. header: 'TypeError',
  22538. message: 'Illegal constructor'
  22539. })
  22540. }
  22541. // https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values
  22542. webidl.util.Type = function (V) {
  22543. switch (typeof V) {
  22544. case 'undefined': return 'Undefined'
  22545. case 'boolean': return 'Boolean'
  22546. case 'string': return 'String'
  22547. case 'symbol': return 'Symbol'
  22548. case 'number': return 'Number'
  22549. case 'bigint': return 'BigInt'
  22550. case 'function':
  22551. case 'object': {
  22552. if (V === null) {
  22553. return 'Null'
  22554. }
  22555. return 'Object'
  22556. }
  22557. }
  22558. }
  22559. webidl.util.markAsUncloneable = markAsUncloneable || (() => {})
  22560. // https://webidl.spec.whatwg.org/#abstract-opdef-converttoint
  22561. webidl.util.ConvertToInt = function (V, bitLength, signedness, opts) {
  22562. let upperBound
  22563. let lowerBound
  22564. // 1. If bitLength is 64, then:
  22565. if (bitLength === 64) {
  22566. // 1. Let upperBound be 2^53 − 1.
  22567. upperBound = Math.pow(2, 53) - 1
  22568. // 2. If signedness is "unsigned", then let lowerBound be 0.
  22569. if (signedness === 'unsigned') {
  22570. lowerBound = 0
  22571. } else {
  22572. // 3. Otherwise let lowerBound be −2^53 + 1.
  22573. lowerBound = Math.pow(-2, 53) + 1
  22574. }
  22575. } else if (signedness === 'unsigned') {
  22576. // 2. Otherwise, if signedness is "unsigned", then:
  22577. // 1. Let lowerBound be 0.
  22578. lowerBound = 0
  22579. // 2. Let upperBound be 2^bitLength − 1.
  22580. upperBound = Math.pow(2, bitLength) - 1
  22581. } else {
  22582. // 3. Otherwise:
  22583. // 1. Let lowerBound be -2^bitLength − 1.
  22584. lowerBound = Math.pow(-2, bitLength) - 1
  22585. // 2. Let upperBound be 2^bitLength − 1 − 1.
  22586. upperBound = Math.pow(2, bitLength - 1) - 1
  22587. }
  22588. // 4. Let x be ? ToNumber(V).
  22589. let x = Number(V)
  22590. // 5. If x is −0, then set x to +0.
  22591. if (x === 0) {
  22592. x = 0
  22593. }
  22594. // 6. If the conversion is to an IDL type associated
  22595. // with the [EnforceRange] extended attribute, then:
  22596. if (opts?.enforceRange === true) {
  22597. // 1. If x is NaN, +∞, or −∞, then throw a TypeError.
  22598. if (
  22599. Number.isNaN(x) ||
  22600. x === Number.POSITIVE_INFINITY ||
  22601. x === Number.NEGATIVE_INFINITY
  22602. ) {
  22603. throw webidl.errors.exception({
  22604. header: 'Integer conversion',
  22605. message: `Could not convert ${webidl.util.Stringify(V)} to an integer.`
  22606. })
  22607. }
  22608. // 2. Set x to IntegerPart(x).
  22609. x = webidl.util.IntegerPart(x)
  22610. // 3. If x < lowerBound or x > upperBound, then
  22611. // throw a TypeError.
  22612. if (x < lowerBound || x > upperBound) {
  22613. throw webidl.errors.exception({
  22614. header: 'Integer conversion',
  22615. message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.`
  22616. })
  22617. }
  22618. // 4. Return x.
  22619. return x
  22620. }
  22621. // 7. If x is not NaN and the conversion is to an IDL
  22622. // type associated with the [Clamp] extended
  22623. // attribute, then:
  22624. if (!Number.isNaN(x) && opts?.clamp === true) {
  22625. // 1. Set x to min(max(x, lowerBound), upperBound).
  22626. x = Math.min(Math.max(x, lowerBound), upperBound)
  22627. // 2. Round x to the nearest integer, choosing the
  22628. // even integer if it lies halfway between two,
  22629. // and choosing +0 rather than −0.
  22630. if (Math.floor(x) % 2 === 0) {
  22631. x = Math.floor(x)
  22632. } else {
  22633. x = Math.ceil(x)
  22634. }
  22635. // 3. Return x.
  22636. return x
  22637. }
  22638. // 8. If x is NaN, +0, +∞, or −∞, then return +0.
  22639. if (
  22640. Number.isNaN(x) ||
  22641. (x === 0 && Object.is(0, x)) ||
  22642. x === Number.POSITIVE_INFINITY ||
  22643. x === Number.NEGATIVE_INFINITY
  22644. ) {
  22645. return 0
  22646. }
  22647. // 9. Set x to IntegerPart(x).
  22648. x = webidl.util.IntegerPart(x)
  22649. // 10. Set x to x modulo 2^bitLength.
  22650. x = x % Math.pow(2, bitLength)
  22651. // 11. If signedness is "signed" and x ≥ 2^bitLength − 1,
  22652. // then return x − 2^bitLength.
  22653. if (signedness === 'signed' && x >= Math.pow(2, bitLength) - 1) {
  22654. return x - Math.pow(2, bitLength)
  22655. }
  22656. // 12. Otherwise, return x.
  22657. return x
  22658. }
  22659. // https://webidl.spec.whatwg.org/#abstract-opdef-integerpart
  22660. webidl.util.IntegerPart = function (n) {
  22661. // 1. Let r be floor(abs(n)).
  22662. const r = Math.floor(Math.abs(n))
  22663. // 2. If n < 0, then return -1 × r.
  22664. if (n < 0) {
  22665. return -1 * r
  22666. }
  22667. // 3. Otherwise, return r.
  22668. return r
  22669. }
  22670. webidl.util.Stringify = function (V) {
  22671. const type = webidl.util.Type(V)
  22672. switch (type) {
  22673. case 'Symbol':
  22674. return `Symbol(${V.description})`
  22675. case 'Object':
  22676. return inspect(V)
  22677. case 'String':
  22678. return `"${V}"`
  22679. default:
  22680. return `${V}`
  22681. }
  22682. }
  22683. // https://webidl.spec.whatwg.org/#es-sequence
  22684. webidl.sequenceConverter = function (converter) {
  22685. return (V, prefix, argument, Iterable) => {
  22686. // 1. If Type(V) is not Object, throw a TypeError.
  22687. if (webidl.util.Type(V) !== 'Object') {
  22688. throw webidl.errors.exception({
  22689. header: prefix,
  22690. message: `${argument} (${webidl.util.Stringify(V)}) is not iterable.`
  22691. })
  22692. }
  22693. // 2. Let method be ? GetMethod(V, @@iterator).
  22694. /** @type {Generator} */
  22695. const method = typeof Iterable === 'function' ? Iterable() : V?.[Symbol.iterator]?.()
  22696. const seq = []
  22697. let index = 0
  22698. // 3. If method is undefined, throw a TypeError.
  22699. if (
  22700. method === undefined ||
  22701. typeof method.next !== 'function'
  22702. ) {
  22703. throw webidl.errors.exception({
  22704. header: prefix,
  22705. message: `${argument} is not iterable.`
  22706. })
  22707. }
  22708. // https://webidl.spec.whatwg.org/#create-sequence-from-iterable
  22709. while (true) {
  22710. const { done, value } = method.next()
  22711. if (done) {
  22712. break
  22713. }
  22714. seq.push(converter(value, prefix, `${argument}[${index++}]`))
  22715. }
  22716. return seq
  22717. }
  22718. }
  22719. // https://webidl.spec.whatwg.org/#es-to-record
  22720. webidl.recordConverter = function (keyConverter, valueConverter) {
  22721. return (O, prefix, argument) => {
  22722. // 1. If Type(O) is not Object, throw a TypeError.
  22723. if (webidl.util.Type(O) !== 'Object') {
  22724. throw webidl.errors.exception({
  22725. header: prefix,
  22726. message: `${argument} ("${webidl.util.Type(O)}") is not an Object.`
  22727. })
  22728. }
  22729. // 2. Let result be a new empty instance of record<K, V>.
  22730. const result = {}
  22731. if (!types.isProxy(O)) {
  22732. // 1. Let desc be ? O.[[GetOwnProperty]](key).
  22733. const keys = [...Object.getOwnPropertyNames(O), ...Object.getOwnPropertySymbols(O)]
  22734. for (const key of keys) {
  22735. // 1. Let typedKey be key converted to an IDL value of type K.
  22736. const typedKey = keyConverter(key, prefix, argument)
  22737. // 2. Let value be ? Get(O, key).
  22738. // 3. Let typedValue be value converted to an IDL value of type V.
  22739. const typedValue = valueConverter(O[key], prefix, argument)
  22740. // 4. Set result[typedKey] to typedValue.
  22741. result[typedKey] = typedValue
  22742. }
  22743. // 5. Return result.
  22744. return result
  22745. }
  22746. // 3. Let keys be ? O.[[OwnPropertyKeys]]().
  22747. const keys = Reflect.ownKeys(O)
  22748. // 4. For each key of keys.
  22749. for (const key of keys) {
  22750. // 1. Let desc be ? O.[[GetOwnProperty]](key).
  22751. const desc = Reflect.getOwnPropertyDescriptor(O, key)
  22752. // 2. If desc is not undefined and desc.[[Enumerable]] is true:
  22753. if (desc?.enumerable) {
  22754. // 1. Let typedKey be key converted to an IDL value of type K.
  22755. const typedKey = keyConverter(key, prefix, argument)
  22756. // 2. Let value be ? Get(O, key).
  22757. // 3. Let typedValue be value converted to an IDL value of type V.
  22758. const typedValue = valueConverter(O[key], prefix, argument)
  22759. // 4. Set result[typedKey] to typedValue.
  22760. result[typedKey] = typedValue
  22761. }
  22762. }
  22763. // 5. Return result.
  22764. return result
  22765. }
  22766. }
  22767. webidl.interfaceConverter = function (i) {
  22768. return (V, prefix, argument, opts) => {
  22769. if (opts?.strict !== false && !(V instanceof i)) {
  22770. throw webidl.errors.exception({
  22771. header: prefix,
  22772. message: `Expected ${argument} ("${webidl.util.Stringify(V)}") to be an instance of ${i.name}.`
  22773. })
  22774. }
  22775. return V
  22776. }
  22777. }
  22778. webidl.dictionaryConverter = function (converters) {
  22779. return (dictionary, prefix, argument) => {
  22780. const type = webidl.util.Type(dictionary)
  22781. const dict = {}
  22782. if (type === 'Null' || type === 'Undefined') {
  22783. return dict
  22784. } else if (type !== 'Object') {
  22785. throw webidl.errors.exception({
  22786. header: prefix,
  22787. message: `Expected ${dictionary} to be one of: Null, Undefined, Object.`
  22788. })
  22789. }
  22790. for (const options of converters) {
  22791. const { key, defaultValue, required, converter } = options
  22792. if (required === true) {
  22793. if (!Object.hasOwn(dictionary, key)) {
  22794. throw webidl.errors.exception({
  22795. header: prefix,
  22796. message: `Missing required key "${key}".`
  22797. })
  22798. }
  22799. }
  22800. let value = dictionary[key]
  22801. const hasDefault = Object.hasOwn(options, 'defaultValue')
  22802. // Only use defaultValue if value is undefined and
  22803. // a defaultValue options was provided.
  22804. if (hasDefault && value !== null) {
  22805. value ??= defaultValue()
  22806. }
  22807. // A key can be optional and have no default value.
  22808. // When this happens, do not perform a conversion,
  22809. // and do not assign the key a value.
  22810. if (required || hasDefault || value !== undefined) {
  22811. value = converter(value, prefix, `${argument}.${key}`)
  22812. if (
  22813. options.allowedValues &&
  22814. !options.allowedValues.includes(value)
  22815. ) {
  22816. throw webidl.errors.exception({
  22817. header: prefix,
  22818. message: `${value} is not an accepted type. Expected one of ${options.allowedValues.join(', ')}.`
  22819. })
  22820. }
  22821. dict[key] = value
  22822. }
  22823. }
  22824. return dict
  22825. }
  22826. }
  22827. webidl.nullableConverter = function (converter) {
  22828. return (V, prefix, argument) => {
  22829. if (V === null) {
  22830. return V
  22831. }
  22832. return converter(V, prefix, argument)
  22833. }
  22834. }
  22835. // https://webidl.spec.whatwg.org/#es-DOMString
  22836. webidl.converters.DOMString = function (V, prefix, argument, opts) {
  22837. // 1. If V is null and the conversion is to an IDL type
  22838. // associated with the [LegacyNullToEmptyString]
  22839. // extended attribute, then return the DOMString value
  22840. // that represents the empty string.
  22841. if (V === null && opts?.legacyNullToEmptyString) {
  22842. return ''
  22843. }
  22844. // 2. Let x be ? ToString(V).
  22845. if (typeof V === 'symbol') {
  22846. throw webidl.errors.exception({
  22847. header: prefix,
  22848. message: `${argument} is a symbol, which cannot be converted to a DOMString.`
  22849. })
  22850. }
  22851. // 3. Return the IDL DOMString value that represents the
  22852. // same sequence of code units as the one the
  22853. // ECMAScript String value x represents.
  22854. return String(V)
  22855. }
  22856. // https://webidl.spec.whatwg.org/#es-ByteString
  22857. webidl.converters.ByteString = function (V, prefix, argument) {
  22858. // 1. Let x be ? ToString(V).
  22859. // Note: DOMString converter perform ? ToString(V)
  22860. const x = webidl.converters.DOMString(V, prefix, argument)
  22861. // 2. If the value of any element of x is greater than
  22862. // 255, then throw a TypeError.
  22863. for (let index = 0; index < x.length; index++) {
  22864. if (x.charCodeAt(index) > 255) {
  22865. throw new TypeError(
  22866. 'Cannot convert argument to a ByteString because the character at ' +
  22867. `index ${index} has a value of ${x.charCodeAt(index)} which is greater than 255.`
  22868. )
  22869. }
  22870. }
  22871. // 3. Return an IDL ByteString value whose length is the
  22872. // length of x, and where the value of each element is
  22873. // the value of the corresponding element of x.
  22874. return x
  22875. }
  22876. // https://webidl.spec.whatwg.org/#es-USVString
  22877. // TODO: rewrite this so we can control the errors thrown
  22878. webidl.converters.USVString = toUSVString
  22879. // https://webidl.spec.whatwg.org/#es-boolean
  22880. webidl.converters.boolean = function (V) {
  22881. // 1. Let x be the result of computing ToBoolean(V).
  22882. const x = Boolean(V)
  22883. // 2. Return the IDL boolean value that is the one that represents
  22884. // the same truth value as the ECMAScript Boolean value x.
  22885. return x
  22886. }
  22887. // https://webidl.spec.whatwg.org/#es-any
  22888. webidl.converters.any = function (V) {
  22889. return V
  22890. }
  22891. // https://webidl.spec.whatwg.org/#es-long-long
  22892. webidl.converters['long long'] = function (V, prefix, argument) {
  22893. // 1. Let x be ? ConvertToInt(V, 64, "signed").
  22894. const x = webidl.util.ConvertToInt(V, 64, 'signed', undefined, prefix, argument)
  22895. // 2. Return the IDL long long value that represents
  22896. // the same numeric value as x.
  22897. return x
  22898. }
  22899. // https://webidl.spec.whatwg.org/#es-unsigned-long-long
  22900. webidl.converters['unsigned long long'] = function (V, prefix, argument) {
  22901. // 1. Let x be ? ConvertToInt(V, 64, "unsigned").
  22902. const x = webidl.util.ConvertToInt(V, 64, 'unsigned', undefined, prefix, argument)
  22903. // 2. Return the IDL unsigned long long value that
  22904. // represents the same numeric value as x.
  22905. return x
  22906. }
  22907. // https://webidl.spec.whatwg.org/#es-unsigned-long
  22908. webidl.converters['unsigned long'] = function (V, prefix, argument) {
  22909. // 1. Let x be ? ConvertToInt(V, 32, "unsigned").
  22910. const x = webidl.util.ConvertToInt(V, 32, 'unsigned', undefined, prefix, argument)
  22911. // 2. Return the IDL unsigned long value that
  22912. // represents the same numeric value as x.
  22913. return x
  22914. }
  22915. // https://webidl.spec.whatwg.org/#es-unsigned-short
  22916. webidl.converters['unsigned short'] = function (V, prefix, argument, opts) {
  22917. // 1. Let x be ? ConvertToInt(V, 16, "unsigned").
  22918. const x = webidl.util.ConvertToInt(V, 16, 'unsigned', opts, prefix, argument)
  22919. // 2. Return the IDL unsigned short value that represents
  22920. // the same numeric value as x.
  22921. return x
  22922. }
  22923. // https://webidl.spec.whatwg.org/#idl-ArrayBuffer
  22924. webidl.converters.ArrayBuffer = function (V, prefix, argument, opts) {
  22925. // 1. If Type(V) is not Object, or V does not have an
  22926. // [[ArrayBufferData]] internal slot, then throw a
  22927. // TypeError.
  22928. // see: https://tc39.es/ecma262/#sec-properties-of-the-arraybuffer-instances
  22929. // see: https://tc39.es/ecma262/#sec-properties-of-the-sharedarraybuffer-instances
  22930. if (
  22931. webidl.util.Type(V) !== 'Object' ||
  22932. !types.isAnyArrayBuffer(V)
  22933. ) {
  22934. throw webidl.errors.conversionFailed({
  22935. prefix,
  22936. argument: `${argument} ("${webidl.util.Stringify(V)}")`,
  22937. types: ['ArrayBuffer']
  22938. })
  22939. }
  22940. // 2. If the conversion is not to an IDL type associated
  22941. // with the [AllowShared] extended attribute, and
  22942. // IsSharedArrayBuffer(V) is true, then throw a
  22943. // TypeError.
  22944. if (opts?.allowShared === false && types.isSharedArrayBuffer(V)) {
  22945. throw webidl.errors.exception({
  22946. header: 'ArrayBuffer',
  22947. message: 'SharedArrayBuffer is not allowed.'
  22948. })
  22949. }
  22950. // 3. If the conversion is not to an IDL type associated
  22951. // with the [AllowResizable] extended attribute, and
  22952. // IsResizableArrayBuffer(V) is true, then throw a
  22953. // TypeError.
  22954. if (V.resizable || V.growable) {
  22955. throw webidl.errors.exception({
  22956. header: 'ArrayBuffer',
  22957. message: 'Received a resizable ArrayBuffer.'
  22958. })
  22959. }
  22960. // 4. Return the IDL ArrayBuffer value that is a
  22961. // reference to the same object as V.
  22962. return V
  22963. }
  22964. webidl.converters.TypedArray = function (V, T, prefix, name, opts) {
  22965. // 1. Let T be the IDL type V is being converted to.
  22966. // 2. If Type(V) is not Object, or V does not have a
  22967. // [[TypedArrayName]] internal slot with a value
  22968. // equal to T’s name, then throw a TypeError.
  22969. if (
  22970. webidl.util.Type(V) !== 'Object' ||
  22971. !types.isTypedArray(V) ||
  22972. V.constructor.name !== T.name
  22973. ) {
  22974. throw webidl.errors.conversionFailed({
  22975. prefix,
  22976. argument: `${name} ("${webidl.util.Stringify(V)}")`,
  22977. types: [T.name]
  22978. })
  22979. }
  22980. // 3. If the conversion is not to an IDL type associated
  22981. // with the [AllowShared] extended attribute, and
  22982. // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is
  22983. // true, then throw a TypeError.
  22984. if (opts?.allowShared === false && types.isSharedArrayBuffer(V.buffer)) {
  22985. throw webidl.errors.exception({
  22986. header: 'ArrayBuffer',
  22987. message: 'SharedArrayBuffer is not allowed.'
  22988. })
  22989. }
  22990. // 4. If the conversion is not to an IDL type associated
  22991. // with the [AllowResizable] extended attribute, and
  22992. // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
  22993. // true, then throw a TypeError.
  22994. if (V.buffer.resizable || V.buffer.growable) {
  22995. throw webidl.errors.exception({
  22996. header: 'ArrayBuffer',
  22997. message: 'Received a resizable ArrayBuffer.'
  22998. })
  22999. }
  23000. // 5. Return the IDL value of type T that is a reference
  23001. // to the same object as V.
  23002. return V
  23003. }
  23004. webidl.converters.DataView = function (V, prefix, name, opts) {
  23005. // 1. If Type(V) is not Object, or V does not have a
  23006. // [[DataView]] internal slot, then throw a TypeError.
  23007. if (webidl.util.Type(V) !== 'Object' || !types.isDataView(V)) {
  23008. throw webidl.errors.exception({
  23009. header: prefix,
  23010. message: `${name} is not a DataView.`
  23011. })
  23012. }
  23013. // 2. If the conversion is not to an IDL type associated
  23014. // with the [AllowShared] extended attribute, and
  23015. // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true,
  23016. // then throw a TypeError.
  23017. if (opts?.allowShared === false && types.isSharedArrayBuffer(V.buffer)) {
  23018. throw webidl.errors.exception({
  23019. header: 'ArrayBuffer',
  23020. message: 'SharedArrayBuffer is not allowed.'
  23021. })
  23022. }
  23023. // 3. If the conversion is not to an IDL type associated
  23024. // with the [AllowResizable] extended attribute, and
  23025. // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
  23026. // true, then throw a TypeError.
  23027. if (V.buffer.resizable || V.buffer.growable) {
  23028. throw webidl.errors.exception({
  23029. header: 'ArrayBuffer',
  23030. message: 'Received a resizable ArrayBuffer.'
  23031. })
  23032. }
  23033. // 4. Return the IDL DataView value that is a reference
  23034. // to the same object as V.
  23035. return V
  23036. }
  23037. // https://webidl.spec.whatwg.org/#BufferSource
  23038. webidl.converters.BufferSource = function (V, prefix, name, opts) {
  23039. if (types.isAnyArrayBuffer(V)) {
  23040. return webidl.converters.ArrayBuffer(V, prefix, name, { ...opts, allowShared: false })
  23041. }
  23042. if (types.isTypedArray(V)) {
  23043. return webidl.converters.TypedArray(V, V.constructor, prefix, name, { ...opts, allowShared: false })
  23044. }
  23045. if (types.isDataView(V)) {
  23046. return webidl.converters.DataView(V, prefix, name, { ...opts, allowShared: false })
  23047. }
  23048. throw webidl.errors.conversionFailed({
  23049. prefix,
  23050. argument: `${name} ("${webidl.util.Stringify(V)}")`,
  23051. types: ['BufferSource']
  23052. })
  23053. }
  23054. webidl.converters['sequence<ByteString>'] = webidl.sequenceConverter(
  23055. webidl.converters.ByteString
  23056. )
  23057. webidl.converters['sequence<sequence<ByteString>>'] = webidl.sequenceConverter(
  23058. webidl.converters['sequence<ByteString>']
  23059. )
  23060. webidl.converters['record<ByteString, ByteString>'] = webidl.recordConverter(
  23061. webidl.converters.ByteString,
  23062. webidl.converters.ByteString
  23063. )
  23064. module.exports = {
  23065. webidl
  23066. }
  23067. /***/ }),
  23068. /***/ 2607:
  23069. /***/ ((module) => {
  23070. /**
  23071. * @see https://encoding.spec.whatwg.org/#concept-encoding-get
  23072. * @param {string|undefined} label
  23073. */
  23074. function getEncoding (label) {
  23075. if (!label) {
  23076. return 'failure'
  23077. }
  23078. // 1. Remove any leading and trailing ASCII whitespace from label.
  23079. // 2. If label is an ASCII case-insensitive match for any of the
  23080. // labels listed in the table below, then return the
  23081. // corresponding encoding; otherwise return failure.
  23082. switch (label.trim().toLowerCase()) {
  23083. case 'unicode-1-1-utf-8':
  23084. case 'unicode11utf8':
  23085. case 'unicode20utf8':
  23086. case 'utf-8':
  23087. case 'utf8':
  23088. case 'x-unicode20utf8':
  23089. return 'UTF-8'
  23090. case '866':
  23091. case 'cp866':
  23092. case 'csibm866':
  23093. case 'ibm866':
  23094. return 'IBM866'
  23095. case 'csisolatin2':
  23096. case 'iso-8859-2':
  23097. case 'iso-ir-101':
  23098. case 'iso8859-2':
  23099. case 'iso88592':
  23100. case 'iso_8859-2':
  23101. case 'iso_8859-2:1987':
  23102. case 'l2':
  23103. case 'latin2':
  23104. return 'ISO-8859-2'
  23105. case 'csisolatin3':
  23106. case 'iso-8859-3':
  23107. case 'iso-ir-109':
  23108. case 'iso8859-3':
  23109. case 'iso88593':
  23110. case 'iso_8859-3':
  23111. case 'iso_8859-3:1988':
  23112. case 'l3':
  23113. case 'latin3':
  23114. return 'ISO-8859-3'
  23115. case 'csisolatin4':
  23116. case 'iso-8859-4':
  23117. case 'iso-ir-110':
  23118. case 'iso8859-4':
  23119. case 'iso88594':
  23120. case 'iso_8859-4':
  23121. case 'iso_8859-4:1988':
  23122. case 'l4':
  23123. case 'latin4':
  23124. return 'ISO-8859-4'
  23125. case 'csisolatincyrillic':
  23126. case 'cyrillic':
  23127. case 'iso-8859-5':
  23128. case 'iso-ir-144':
  23129. case 'iso8859-5':
  23130. case 'iso88595':
  23131. case 'iso_8859-5':
  23132. case 'iso_8859-5:1988':
  23133. return 'ISO-8859-5'
  23134. case 'arabic':
  23135. case 'asmo-708':
  23136. case 'csiso88596e':
  23137. case 'csiso88596i':
  23138. case 'csisolatinarabic':
  23139. case 'ecma-114':
  23140. case 'iso-8859-6':
  23141. case 'iso-8859-6-e':
  23142. case 'iso-8859-6-i':
  23143. case 'iso-ir-127':
  23144. case 'iso8859-6':
  23145. case 'iso88596':
  23146. case 'iso_8859-6':
  23147. case 'iso_8859-6:1987':
  23148. return 'ISO-8859-6'
  23149. case 'csisolatingreek':
  23150. case 'ecma-118':
  23151. case 'elot_928':
  23152. case 'greek':
  23153. case 'greek8':
  23154. case 'iso-8859-7':
  23155. case 'iso-ir-126':
  23156. case 'iso8859-7':
  23157. case 'iso88597':
  23158. case 'iso_8859-7':
  23159. case 'iso_8859-7:1987':
  23160. case 'sun_eu_greek':
  23161. return 'ISO-8859-7'
  23162. case 'csiso88598e':
  23163. case 'csisolatinhebrew':
  23164. case 'hebrew':
  23165. case 'iso-8859-8':
  23166. case 'iso-8859-8-e':
  23167. case 'iso-ir-138':
  23168. case 'iso8859-8':
  23169. case 'iso88598':
  23170. case 'iso_8859-8':
  23171. case 'iso_8859-8:1988':
  23172. case 'visual':
  23173. return 'ISO-8859-8'
  23174. case 'csiso88598i':
  23175. case 'iso-8859-8-i':
  23176. case 'logical':
  23177. return 'ISO-8859-8-I'
  23178. case 'csisolatin6':
  23179. case 'iso-8859-10':
  23180. case 'iso-ir-157':
  23181. case 'iso8859-10':
  23182. case 'iso885910':
  23183. case 'l6':
  23184. case 'latin6':
  23185. return 'ISO-8859-10'
  23186. case 'iso-8859-13':
  23187. case 'iso8859-13':
  23188. case 'iso885913':
  23189. return 'ISO-8859-13'
  23190. case 'iso-8859-14':
  23191. case 'iso8859-14':
  23192. case 'iso885914':
  23193. return 'ISO-8859-14'
  23194. case 'csisolatin9':
  23195. case 'iso-8859-15':
  23196. case 'iso8859-15':
  23197. case 'iso885915':
  23198. case 'iso_8859-15':
  23199. case 'l9':
  23200. return 'ISO-8859-15'
  23201. case 'iso-8859-16':
  23202. return 'ISO-8859-16'
  23203. case 'cskoi8r':
  23204. case 'koi':
  23205. case 'koi8':
  23206. case 'koi8-r':
  23207. case 'koi8_r':
  23208. return 'KOI8-R'
  23209. case 'koi8-ru':
  23210. case 'koi8-u':
  23211. return 'KOI8-U'
  23212. case 'csmacintosh':
  23213. case 'mac':
  23214. case 'macintosh':
  23215. case 'x-mac-roman':
  23216. return 'macintosh'
  23217. case 'iso-8859-11':
  23218. case 'iso8859-11':
  23219. case 'iso885911':
  23220. case 'tis-620':
  23221. case 'windows-874':
  23222. return 'windows-874'
  23223. case 'cp1250':
  23224. case 'windows-1250':
  23225. case 'x-cp1250':
  23226. return 'windows-1250'
  23227. case 'cp1251':
  23228. case 'windows-1251':
  23229. case 'x-cp1251':
  23230. return 'windows-1251'
  23231. case 'ansi_x3.4-1968':
  23232. case 'ascii':
  23233. case 'cp1252':
  23234. case 'cp819':
  23235. case 'csisolatin1':
  23236. case 'ibm819':
  23237. case 'iso-8859-1':
  23238. case 'iso-ir-100':
  23239. case 'iso8859-1':
  23240. case 'iso88591':
  23241. case 'iso_8859-1':
  23242. case 'iso_8859-1:1987':
  23243. case 'l1':
  23244. case 'latin1':
  23245. case 'us-ascii':
  23246. case 'windows-1252':
  23247. case 'x-cp1252':
  23248. return 'windows-1252'
  23249. case 'cp1253':
  23250. case 'windows-1253':
  23251. case 'x-cp1253':
  23252. return 'windows-1253'
  23253. case 'cp1254':
  23254. case 'csisolatin5':
  23255. case 'iso-8859-9':
  23256. case 'iso-ir-148':
  23257. case 'iso8859-9':
  23258. case 'iso88599':
  23259. case 'iso_8859-9':
  23260. case 'iso_8859-9:1989':
  23261. case 'l5':
  23262. case 'latin5':
  23263. case 'windows-1254':
  23264. case 'x-cp1254':
  23265. return 'windows-1254'
  23266. case 'cp1255':
  23267. case 'windows-1255':
  23268. case 'x-cp1255':
  23269. return 'windows-1255'
  23270. case 'cp1256':
  23271. case 'windows-1256':
  23272. case 'x-cp1256':
  23273. return 'windows-1256'
  23274. case 'cp1257':
  23275. case 'windows-1257':
  23276. case 'x-cp1257':
  23277. return 'windows-1257'
  23278. case 'cp1258':
  23279. case 'windows-1258':
  23280. case 'x-cp1258':
  23281. return 'windows-1258'
  23282. case 'x-mac-cyrillic':
  23283. case 'x-mac-ukrainian':
  23284. return 'x-mac-cyrillic'
  23285. case 'chinese':
  23286. case 'csgb2312':
  23287. case 'csiso58gb231280':
  23288. case 'gb2312':
  23289. case 'gb_2312':
  23290. case 'gb_2312-80':
  23291. case 'gbk':
  23292. case 'iso-ir-58':
  23293. case 'x-gbk':
  23294. return 'GBK'
  23295. case 'gb18030':
  23296. return 'gb18030'
  23297. case 'big5':
  23298. case 'big5-hkscs':
  23299. case 'cn-big5':
  23300. case 'csbig5':
  23301. case 'x-x-big5':
  23302. return 'Big5'
  23303. case 'cseucpkdfmtjapanese':
  23304. case 'euc-jp':
  23305. case 'x-euc-jp':
  23306. return 'EUC-JP'
  23307. case 'csiso2022jp':
  23308. case 'iso-2022-jp':
  23309. return 'ISO-2022-JP'
  23310. case 'csshiftjis':
  23311. case 'ms932':
  23312. case 'ms_kanji':
  23313. case 'shift-jis':
  23314. case 'shift_jis':
  23315. case 'sjis':
  23316. case 'windows-31j':
  23317. case 'x-sjis':
  23318. return 'Shift_JIS'
  23319. case 'cseuckr':
  23320. case 'csksc56011987':
  23321. case 'euc-kr':
  23322. case 'iso-ir-149':
  23323. case 'korean':
  23324. case 'ks_c_5601-1987':
  23325. case 'ks_c_5601-1989':
  23326. case 'ksc5601':
  23327. case 'ksc_5601':
  23328. case 'windows-949':
  23329. return 'EUC-KR'
  23330. case 'csiso2022kr':
  23331. case 'hz-gb-2312':
  23332. case 'iso-2022-cn':
  23333. case 'iso-2022-cn-ext':
  23334. case 'iso-2022-kr':
  23335. case 'replacement':
  23336. return 'replacement'
  23337. case 'unicodefffe':
  23338. case 'utf-16be':
  23339. return 'UTF-16BE'
  23340. case 'csunicode':
  23341. case 'iso-10646-ucs-2':
  23342. case 'ucs-2':
  23343. case 'unicode':
  23344. case 'unicodefeff':
  23345. case 'utf-16':
  23346. case 'utf-16le':
  23347. return 'UTF-16LE'
  23348. case 'x-user-defined':
  23349. return 'x-user-defined'
  23350. default: return 'failure'
  23351. }
  23352. }
  23353. module.exports = {
  23354. getEncoding
  23355. }
  23356. /***/ }),
  23357. /***/ 8355:
  23358. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  23359. const {
  23360. staticPropertyDescriptors,
  23361. readOperation,
  23362. fireAProgressEvent
  23363. } = __nccwpck_require__(3610)
  23364. const {
  23365. kState,
  23366. kError,
  23367. kResult,
  23368. kEvents,
  23369. kAborted
  23370. } = __nccwpck_require__(961)
  23371. const { webidl } = __nccwpck_require__(5893)
  23372. const { kEnumerableProperty } = __nccwpck_require__(3440)
  23373. class FileReader extends EventTarget {
  23374. constructor () {
  23375. super()
  23376. this[kState] = 'empty'
  23377. this[kResult] = null
  23378. this[kError] = null
  23379. this[kEvents] = {
  23380. loadend: null,
  23381. error: null,
  23382. abort: null,
  23383. load: null,
  23384. progress: null,
  23385. loadstart: null
  23386. }
  23387. }
  23388. /**
  23389. * @see https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer
  23390. * @param {import('buffer').Blob} blob
  23391. */
  23392. readAsArrayBuffer (blob) {
  23393. webidl.brandCheck(this, FileReader)
  23394. webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsArrayBuffer')
  23395. blob = webidl.converters.Blob(blob, { strict: false })
  23396. // The readAsArrayBuffer(blob) method, when invoked,
  23397. // must initiate a read operation for blob with ArrayBuffer.
  23398. readOperation(this, blob, 'ArrayBuffer')
  23399. }
  23400. /**
  23401. * @see https://w3c.github.io/FileAPI/#readAsBinaryString
  23402. * @param {import('buffer').Blob} blob
  23403. */
  23404. readAsBinaryString (blob) {
  23405. webidl.brandCheck(this, FileReader)
  23406. webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsBinaryString')
  23407. blob = webidl.converters.Blob(blob, { strict: false })
  23408. // The readAsBinaryString(blob) method, when invoked,
  23409. // must initiate a read operation for blob with BinaryString.
  23410. readOperation(this, blob, 'BinaryString')
  23411. }
  23412. /**
  23413. * @see https://w3c.github.io/FileAPI/#readAsDataText
  23414. * @param {import('buffer').Blob} blob
  23415. * @param {string?} encoding
  23416. */
  23417. readAsText (blob, encoding = undefined) {
  23418. webidl.brandCheck(this, FileReader)
  23419. webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsText')
  23420. blob = webidl.converters.Blob(blob, { strict: false })
  23421. if (encoding !== undefined) {
  23422. encoding = webidl.converters.DOMString(encoding, 'FileReader.readAsText', 'encoding')
  23423. }
  23424. // The readAsText(blob, encoding) method, when invoked,
  23425. // must initiate a read operation for blob with Text and encoding.
  23426. readOperation(this, blob, 'Text', encoding)
  23427. }
  23428. /**
  23429. * @see https://w3c.github.io/FileAPI/#dfn-readAsDataURL
  23430. * @param {import('buffer').Blob} blob
  23431. */
  23432. readAsDataURL (blob) {
  23433. webidl.brandCheck(this, FileReader)
  23434. webidl.argumentLengthCheck(arguments, 1, 'FileReader.readAsDataURL')
  23435. blob = webidl.converters.Blob(blob, { strict: false })
  23436. // The readAsDataURL(blob) method, when invoked, must
  23437. // initiate a read operation for blob with DataURL.
  23438. readOperation(this, blob, 'DataURL')
  23439. }
  23440. /**
  23441. * @see https://w3c.github.io/FileAPI/#dfn-abort
  23442. */
  23443. abort () {
  23444. // 1. If this's state is "empty" or if this's state is
  23445. // "done" set this's result to null and terminate
  23446. // this algorithm.
  23447. if (this[kState] === 'empty' || this[kState] === 'done') {
  23448. this[kResult] = null
  23449. return
  23450. }
  23451. // 2. If this's state is "loading" set this's state to
  23452. // "done" and set this's result to null.
  23453. if (this[kState] === 'loading') {
  23454. this[kState] = 'done'
  23455. this[kResult] = null
  23456. }
  23457. // 3. If there are any tasks from this on the file reading
  23458. // task source in an affiliated task queue, then remove
  23459. // those tasks from that task queue.
  23460. this[kAborted] = true
  23461. // 4. Terminate the algorithm for the read method being processed.
  23462. // TODO
  23463. // 5. Fire a progress event called abort at this.
  23464. fireAProgressEvent('abort', this)
  23465. // 6. If this's state is not "loading", fire a progress
  23466. // event called loadend at this.
  23467. if (this[kState] !== 'loading') {
  23468. fireAProgressEvent('loadend', this)
  23469. }
  23470. }
  23471. /**
  23472. * @see https://w3c.github.io/FileAPI/#dom-filereader-readystate
  23473. */
  23474. get readyState () {
  23475. webidl.brandCheck(this, FileReader)
  23476. switch (this[kState]) {
  23477. case 'empty': return this.EMPTY
  23478. case 'loading': return this.LOADING
  23479. case 'done': return this.DONE
  23480. }
  23481. }
  23482. /**
  23483. * @see https://w3c.github.io/FileAPI/#dom-filereader-result
  23484. */
  23485. get result () {
  23486. webidl.brandCheck(this, FileReader)
  23487. // The result attribute’s getter, when invoked, must return
  23488. // this's result.
  23489. return this[kResult]
  23490. }
  23491. /**
  23492. * @see https://w3c.github.io/FileAPI/#dom-filereader-error
  23493. */
  23494. get error () {
  23495. webidl.brandCheck(this, FileReader)
  23496. // The error attribute’s getter, when invoked, must return
  23497. // this's error.
  23498. return this[kError]
  23499. }
  23500. get onloadend () {
  23501. webidl.brandCheck(this, FileReader)
  23502. return this[kEvents].loadend
  23503. }
  23504. set onloadend (fn) {
  23505. webidl.brandCheck(this, FileReader)
  23506. if (this[kEvents].loadend) {
  23507. this.removeEventListener('loadend', this[kEvents].loadend)
  23508. }
  23509. if (typeof fn === 'function') {
  23510. this[kEvents].loadend = fn
  23511. this.addEventListener('loadend', fn)
  23512. } else {
  23513. this[kEvents].loadend = null
  23514. }
  23515. }
  23516. get onerror () {
  23517. webidl.brandCheck(this, FileReader)
  23518. return this[kEvents].error
  23519. }
  23520. set onerror (fn) {
  23521. webidl.brandCheck(this, FileReader)
  23522. if (this[kEvents].error) {
  23523. this.removeEventListener('error', this[kEvents].error)
  23524. }
  23525. if (typeof fn === 'function') {
  23526. this[kEvents].error = fn
  23527. this.addEventListener('error', fn)
  23528. } else {
  23529. this[kEvents].error = null
  23530. }
  23531. }
  23532. get onloadstart () {
  23533. webidl.brandCheck(this, FileReader)
  23534. return this[kEvents].loadstart
  23535. }
  23536. set onloadstart (fn) {
  23537. webidl.brandCheck(this, FileReader)
  23538. if (this[kEvents].loadstart) {
  23539. this.removeEventListener('loadstart', this[kEvents].loadstart)
  23540. }
  23541. if (typeof fn === 'function') {
  23542. this[kEvents].loadstart = fn
  23543. this.addEventListener('loadstart', fn)
  23544. } else {
  23545. this[kEvents].loadstart = null
  23546. }
  23547. }
  23548. get onprogress () {
  23549. webidl.brandCheck(this, FileReader)
  23550. return this[kEvents].progress
  23551. }
  23552. set onprogress (fn) {
  23553. webidl.brandCheck(this, FileReader)
  23554. if (this[kEvents].progress) {
  23555. this.removeEventListener('progress', this[kEvents].progress)
  23556. }
  23557. if (typeof fn === 'function') {
  23558. this[kEvents].progress = fn
  23559. this.addEventListener('progress', fn)
  23560. } else {
  23561. this[kEvents].progress = null
  23562. }
  23563. }
  23564. get onload () {
  23565. webidl.brandCheck(this, FileReader)
  23566. return this[kEvents].load
  23567. }
  23568. set onload (fn) {
  23569. webidl.brandCheck(this, FileReader)
  23570. if (this[kEvents].load) {
  23571. this.removeEventListener('load', this[kEvents].load)
  23572. }
  23573. if (typeof fn === 'function') {
  23574. this[kEvents].load = fn
  23575. this.addEventListener('load', fn)
  23576. } else {
  23577. this[kEvents].load = null
  23578. }
  23579. }
  23580. get onabort () {
  23581. webidl.brandCheck(this, FileReader)
  23582. return this[kEvents].abort
  23583. }
  23584. set onabort (fn) {
  23585. webidl.brandCheck(this, FileReader)
  23586. if (this[kEvents].abort) {
  23587. this.removeEventListener('abort', this[kEvents].abort)
  23588. }
  23589. if (typeof fn === 'function') {
  23590. this[kEvents].abort = fn
  23591. this.addEventListener('abort', fn)
  23592. } else {
  23593. this[kEvents].abort = null
  23594. }
  23595. }
  23596. }
  23597. // https://w3c.github.io/FileAPI/#dom-filereader-empty
  23598. FileReader.EMPTY = FileReader.prototype.EMPTY = 0
  23599. // https://w3c.github.io/FileAPI/#dom-filereader-loading
  23600. FileReader.LOADING = FileReader.prototype.LOADING = 1
  23601. // https://w3c.github.io/FileAPI/#dom-filereader-done
  23602. FileReader.DONE = FileReader.prototype.DONE = 2
  23603. Object.defineProperties(FileReader.prototype, {
  23604. EMPTY: staticPropertyDescriptors,
  23605. LOADING: staticPropertyDescriptors,
  23606. DONE: staticPropertyDescriptors,
  23607. readAsArrayBuffer: kEnumerableProperty,
  23608. readAsBinaryString: kEnumerableProperty,
  23609. readAsText: kEnumerableProperty,
  23610. readAsDataURL: kEnumerableProperty,
  23611. abort: kEnumerableProperty,
  23612. readyState: kEnumerableProperty,
  23613. result: kEnumerableProperty,
  23614. error: kEnumerableProperty,
  23615. onloadstart: kEnumerableProperty,
  23616. onprogress: kEnumerableProperty,
  23617. onload: kEnumerableProperty,
  23618. onabort: kEnumerableProperty,
  23619. onerror: kEnumerableProperty,
  23620. onloadend: kEnumerableProperty,
  23621. [Symbol.toStringTag]: {
  23622. value: 'FileReader',
  23623. writable: false,
  23624. enumerable: false,
  23625. configurable: true
  23626. }
  23627. })
  23628. Object.defineProperties(FileReader, {
  23629. EMPTY: staticPropertyDescriptors,
  23630. LOADING: staticPropertyDescriptors,
  23631. DONE: staticPropertyDescriptors
  23632. })
  23633. module.exports = {
  23634. FileReader
  23635. }
  23636. /***/ }),
  23637. /***/ 8573:
  23638. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  23639. const { webidl } = __nccwpck_require__(5893)
  23640. const kState = Symbol('ProgressEvent state')
  23641. /**
  23642. * @see https://xhr.spec.whatwg.org/#progressevent
  23643. */
  23644. class ProgressEvent extends Event {
  23645. constructor (type, eventInitDict = {}) {
  23646. type = webidl.converters.DOMString(type, 'ProgressEvent constructor', 'type')
  23647. eventInitDict = webidl.converters.ProgressEventInit(eventInitDict ?? {})
  23648. super(type, eventInitDict)
  23649. this[kState] = {
  23650. lengthComputable: eventInitDict.lengthComputable,
  23651. loaded: eventInitDict.loaded,
  23652. total: eventInitDict.total
  23653. }
  23654. }
  23655. get lengthComputable () {
  23656. webidl.brandCheck(this, ProgressEvent)
  23657. return this[kState].lengthComputable
  23658. }
  23659. get loaded () {
  23660. webidl.brandCheck(this, ProgressEvent)
  23661. return this[kState].loaded
  23662. }
  23663. get total () {
  23664. webidl.brandCheck(this, ProgressEvent)
  23665. return this[kState].total
  23666. }
  23667. }
  23668. webidl.converters.ProgressEventInit = webidl.dictionaryConverter([
  23669. {
  23670. key: 'lengthComputable',
  23671. converter: webidl.converters.boolean,
  23672. defaultValue: () => false
  23673. },
  23674. {
  23675. key: 'loaded',
  23676. converter: webidl.converters['unsigned long long'],
  23677. defaultValue: () => 0
  23678. },
  23679. {
  23680. key: 'total',
  23681. converter: webidl.converters['unsigned long long'],
  23682. defaultValue: () => 0
  23683. },
  23684. {
  23685. key: 'bubbles',
  23686. converter: webidl.converters.boolean,
  23687. defaultValue: () => false
  23688. },
  23689. {
  23690. key: 'cancelable',
  23691. converter: webidl.converters.boolean,
  23692. defaultValue: () => false
  23693. },
  23694. {
  23695. key: 'composed',
  23696. converter: webidl.converters.boolean,
  23697. defaultValue: () => false
  23698. }
  23699. ])
  23700. module.exports = {
  23701. ProgressEvent
  23702. }
  23703. /***/ }),
  23704. /***/ 961:
  23705. /***/ ((module) => {
  23706. module.exports = {
  23707. kState: Symbol('FileReader state'),
  23708. kResult: Symbol('FileReader result'),
  23709. kError: Symbol('FileReader error'),
  23710. kLastProgressEventFired: Symbol('FileReader last progress event fired timestamp'),
  23711. kEvents: Symbol('FileReader events'),
  23712. kAborted: Symbol('FileReader aborted')
  23713. }
  23714. /***/ }),
  23715. /***/ 3610:
  23716. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  23717. const {
  23718. kState,
  23719. kError,
  23720. kResult,
  23721. kAborted,
  23722. kLastProgressEventFired
  23723. } = __nccwpck_require__(961)
  23724. const { ProgressEvent } = __nccwpck_require__(8573)
  23725. const { getEncoding } = __nccwpck_require__(2607)
  23726. const { serializeAMimeType, parseMIMEType } = __nccwpck_require__(1900)
  23727. const { types } = __nccwpck_require__(7975)
  23728. const { StringDecoder } = __nccwpck_require__(3193)
  23729. const { btoa } = __nccwpck_require__(4573)
  23730. /** @type {PropertyDescriptor} */
  23731. const staticPropertyDescriptors = {
  23732. enumerable: true,
  23733. writable: false,
  23734. configurable: false
  23735. }
  23736. /**
  23737. * @see https://w3c.github.io/FileAPI/#readOperation
  23738. * @param {import('./filereader').FileReader} fr
  23739. * @param {import('buffer').Blob} blob
  23740. * @param {string} type
  23741. * @param {string?} encodingName
  23742. */
  23743. function readOperation (fr, blob, type, encodingName) {
  23744. // 1. If fr’s state is "loading", throw an InvalidStateError
  23745. // DOMException.
  23746. if (fr[kState] === 'loading') {
  23747. throw new DOMException('Invalid state', 'InvalidStateError')
  23748. }
  23749. // 2. Set fr’s state to "loading".
  23750. fr[kState] = 'loading'
  23751. // 3. Set fr’s result to null.
  23752. fr[kResult] = null
  23753. // 4. Set fr’s error to null.
  23754. fr[kError] = null
  23755. // 5. Let stream be the result of calling get stream on blob.
  23756. /** @type {import('stream/web').ReadableStream} */
  23757. const stream = blob.stream()
  23758. // 6. Let reader be the result of getting a reader from stream.
  23759. const reader = stream.getReader()
  23760. // 7. Let bytes be an empty byte sequence.
  23761. /** @type {Uint8Array[]} */
  23762. const bytes = []
  23763. // 8. Let chunkPromise be the result of reading a chunk from
  23764. // stream with reader.
  23765. let chunkPromise = reader.read()
  23766. // 9. Let isFirstChunk be true.
  23767. let isFirstChunk = true
  23768. // 10. In parallel, while true:
  23769. // Note: "In parallel" just means non-blocking
  23770. // Note 2: readOperation itself cannot be async as double
  23771. // reading the body would then reject the promise, instead
  23772. // of throwing an error.
  23773. ;(async () => {
  23774. while (!fr[kAborted]) {
  23775. // 1. Wait for chunkPromise to be fulfilled or rejected.
  23776. try {
  23777. const { done, value } = await chunkPromise
  23778. // 2. If chunkPromise is fulfilled, and isFirstChunk is
  23779. // true, queue a task to fire a progress event called
  23780. // loadstart at fr.
  23781. if (isFirstChunk && !fr[kAborted]) {
  23782. queueMicrotask(() => {
  23783. fireAProgressEvent('loadstart', fr)
  23784. })
  23785. }
  23786. // 3. Set isFirstChunk to false.
  23787. isFirstChunk = false
  23788. // 4. If chunkPromise is fulfilled with an object whose
  23789. // done property is false and whose value property is
  23790. // a Uint8Array object, run these steps:
  23791. if (!done && types.isUint8Array(value)) {
  23792. // 1. Let bs be the byte sequence represented by the
  23793. // Uint8Array object.
  23794. // 2. Append bs to bytes.
  23795. bytes.push(value)
  23796. // 3. If roughly 50ms have passed since these steps
  23797. // were last invoked, queue a task to fire a
  23798. // progress event called progress at fr.
  23799. if (
  23800. (
  23801. fr[kLastProgressEventFired] === undefined ||
  23802. Date.now() - fr[kLastProgressEventFired] >= 50
  23803. ) &&
  23804. !fr[kAborted]
  23805. ) {
  23806. fr[kLastProgressEventFired] = Date.now()
  23807. queueMicrotask(() => {
  23808. fireAProgressEvent('progress', fr)
  23809. })
  23810. }
  23811. // 4. Set chunkPromise to the result of reading a
  23812. // chunk from stream with reader.
  23813. chunkPromise = reader.read()
  23814. } else if (done) {
  23815. // 5. Otherwise, if chunkPromise is fulfilled with an
  23816. // object whose done property is true, queue a task
  23817. // to run the following steps and abort this algorithm:
  23818. queueMicrotask(() => {
  23819. // 1. Set fr’s state to "done".
  23820. fr[kState] = 'done'
  23821. // 2. Let result be the result of package data given
  23822. // bytes, type, blob’s type, and encodingName.
  23823. try {
  23824. const result = packageData(bytes, type, blob.type, encodingName)
  23825. // 4. Else:
  23826. if (fr[kAborted]) {
  23827. return
  23828. }
  23829. // 1. Set fr’s result to result.
  23830. fr[kResult] = result
  23831. // 2. Fire a progress event called load at the fr.
  23832. fireAProgressEvent('load', fr)
  23833. } catch (error) {
  23834. // 3. If package data threw an exception error:
  23835. // 1. Set fr’s error to error.
  23836. fr[kError] = error
  23837. // 2. Fire a progress event called error at fr.
  23838. fireAProgressEvent('error', fr)
  23839. }
  23840. // 5. If fr’s state is not "loading", fire a progress
  23841. // event called loadend at the fr.
  23842. if (fr[kState] !== 'loading') {
  23843. fireAProgressEvent('loadend', fr)
  23844. }
  23845. })
  23846. break
  23847. }
  23848. } catch (error) {
  23849. if (fr[kAborted]) {
  23850. return
  23851. }
  23852. // 6. Otherwise, if chunkPromise is rejected with an
  23853. // error error, queue a task to run the following
  23854. // steps and abort this algorithm:
  23855. queueMicrotask(() => {
  23856. // 1. Set fr’s state to "done".
  23857. fr[kState] = 'done'
  23858. // 2. Set fr’s error to error.
  23859. fr[kError] = error
  23860. // 3. Fire a progress event called error at fr.
  23861. fireAProgressEvent('error', fr)
  23862. // 4. If fr’s state is not "loading", fire a progress
  23863. // event called loadend at fr.
  23864. if (fr[kState] !== 'loading') {
  23865. fireAProgressEvent('loadend', fr)
  23866. }
  23867. })
  23868. break
  23869. }
  23870. }
  23871. })()
  23872. }
  23873. /**
  23874. * @see https://w3c.github.io/FileAPI/#fire-a-progress-event
  23875. * @see https://dom.spec.whatwg.org/#concept-event-fire
  23876. * @param {string} e The name of the event
  23877. * @param {import('./filereader').FileReader} reader
  23878. */
  23879. function fireAProgressEvent (e, reader) {
  23880. // The progress event e does not bubble. e.bubbles must be false
  23881. // The progress event e is NOT cancelable. e.cancelable must be false
  23882. const event = new ProgressEvent(e, {
  23883. bubbles: false,
  23884. cancelable: false
  23885. })
  23886. reader.dispatchEvent(event)
  23887. }
  23888. /**
  23889. * @see https://w3c.github.io/FileAPI/#blob-package-data
  23890. * @param {Uint8Array[]} bytes
  23891. * @param {string} type
  23892. * @param {string?} mimeType
  23893. * @param {string?} encodingName
  23894. */
  23895. function packageData (bytes, type, mimeType, encodingName) {
  23896. // 1. A Blob has an associated package data algorithm, given
  23897. // bytes, a type, a optional mimeType, and a optional
  23898. // encodingName, which switches on type and runs the
  23899. // associated steps:
  23900. switch (type) {
  23901. case 'DataURL': {
  23902. // 1. Return bytes as a DataURL [RFC2397] subject to
  23903. // the considerations below:
  23904. // * Use mimeType as part of the Data URL if it is
  23905. // available in keeping with the Data URL
  23906. // specification [RFC2397].
  23907. // * If mimeType is not available return a Data URL
  23908. // without a media-type. [RFC2397].
  23909. // https://datatracker.ietf.org/doc/html/rfc2397#section-3
  23910. // dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
  23911. // mediatype := [ type "/" subtype ] *( ";" parameter )
  23912. // data := *urlchar
  23913. // parameter := attribute "=" value
  23914. let dataURL = 'data:'
  23915. const parsed = parseMIMEType(mimeType || 'application/octet-stream')
  23916. if (parsed !== 'failure') {
  23917. dataURL += serializeAMimeType(parsed)
  23918. }
  23919. dataURL += ';base64,'
  23920. const decoder = new StringDecoder('latin1')
  23921. for (const chunk of bytes) {
  23922. dataURL += btoa(decoder.write(chunk))
  23923. }
  23924. dataURL += btoa(decoder.end())
  23925. return dataURL
  23926. }
  23927. case 'Text': {
  23928. // 1. Let encoding be failure
  23929. let encoding = 'failure'
  23930. // 2. If the encodingName is present, set encoding to the
  23931. // result of getting an encoding from encodingName.
  23932. if (encodingName) {
  23933. encoding = getEncoding(encodingName)
  23934. }
  23935. // 3. If encoding is failure, and mimeType is present:
  23936. if (encoding === 'failure' && mimeType) {
  23937. // 1. Let type be the result of parse a MIME type
  23938. // given mimeType.
  23939. const type = parseMIMEType(mimeType)
  23940. // 2. If type is not failure, set encoding to the result
  23941. // of getting an encoding from type’s parameters["charset"].
  23942. if (type !== 'failure') {
  23943. encoding = getEncoding(type.parameters.get('charset'))
  23944. }
  23945. }
  23946. // 4. If encoding is failure, then set encoding to UTF-8.
  23947. if (encoding === 'failure') {
  23948. encoding = 'UTF-8'
  23949. }
  23950. // 5. Decode bytes using fallback encoding encoding, and
  23951. // return the result.
  23952. return decode(bytes, encoding)
  23953. }
  23954. case 'ArrayBuffer': {
  23955. // Return a new ArrayBuffer whose contents are bytes.
  23956. const sequence = combineByteSequences(bytes)
  23957. return sequence.buffer
  23958. }
  23959. case 'BinaryString': {
  23960. // Return bytes as a binary string, in which every byte
  23961. // is represented by a code unit of equal value [0..255].
  23962. let binaryString = ''
  23963. const decoder = new StringDecoder('latin1')
  23964. for (const chunk of bytes) {
  23965. binaryString += decoder.write(chunk)
  23966. }
  23967. binaryString += decoder.end()
  23968. return binaryString
  23969. }
  23970. }
  23971. }
  23972. /**
  23973. * @see https://encoding.spec.whatwg.org/#decode
  23974. * @param {Uint8Array[]} ioQueue
  23975. * @param {string} encoding
  23976. */
  23977. function decode (ioQueue, encoding) {
  23978. const bytes = combineByteSequences(ioQueue)
  23979. // 1. Let BOMEncoding be the result of BOM sniffing ioQueue.
  23980. const BOMEncoding = BOMSniffing(bytes)
  23981. let slice = 0
  23982. // 2. If BOMEncoding is non-null:
  23983. if (BOMEncoding !== null) {
  23984. // 1. Set encoding to BOMEncoding.
  23985. encoding = BOMEncoding
  23986. // 2. Read three bytes from ioQueue, if BOMEncoding is
  23987. // UTF-8; otherwise read two bytes.
  23988. // (Do nothing with those bytes.)
  23989. slice = BOMEncoding === 'UTF-8' ? 3 : 2
  23990. }
  23991. // 3. Process a queue with an instance of encoding’s
  23992. // decoder, ioQueue, output, and "replacement".
  23993. // 4. Return output.
  23994. const sliced = bytes.slice(slice)
  23995. return new TextDecoder(encoding).decode(sliced)
  23996. }
  23997. /**
  23998. * @see https://encoding.spec.whatwg.org/#bom-sniff
  23999. * @param {Uint8Array} ioQueue
  24000. */
  24001. function BOMSniffing (ioQueue) {
  24002. // 1. Let BOM be the result of peeking 3 bytes from ioQueue,
  24003. // converted to a byte sequence.
  24004. const [a, b, c] = ioQueue
  24005. // 2. For each of the rows in the table below, starting with
  24006. // the first one and going down, if BOM starts with the
  24007. // bytes given in the first column, then return the
  24008. // encoding given in the cell in the second column of that
  24009. // row. Otherwise, return null.
  24010. if (a === 0xEF && b === 0xBB && c === 0xBF) {
  24011. return 'UTF-8'
  24012. } else if (a === 0xFE && b === 0xFF) {
  24013. return 'UTF-16BE'
  24014. } else if (a === 0xFF && b === 0xFE) {
  24015. return 'UTF-16LE'
  24016. }
  24017. return null
  24018. }
  24019. /**
  24020. * @param {Uint8Array[]} sequences
  24021. */
  24022. function combineByteSequences (sequences) {
  24023. const size = sequences.reduce((a, b) => {
  24024. return a + b.byteLength
  24025. }, 0)
  24026. let offset = 0
  24027. return sequences.reduce((a, b) => {
  24028. a.set(b, offset)
  24029. offset += b.byteLength
  24030. return a
  24031. }, new Uint8Array(size))
  24032. }
  24033. module.exports = {
  24034. staticPropertyDescriptors,
  24035. readOperation,
  24036. fireAProgressEvent
  24037. }
  24038. /***/ }),
  24039. /***/ 6897:
  24040. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24041. const { uid, states, sentCloseFrameState, emptyBuffer, opcodes } = __nccwpck_require__(736)
  24042. const {
  24043. kReadyState,
  24044. kSentClose,
  24045. kByteParser,
  24046. kReceivedClose,
  24047. kResponse
  24048. } = __nccwpck_require__(1216)
  24049. const { fireEvent, failWebsocketConnection, isClosing, isClosed, isEstablished, parseExtensions } = __nccwpck_require__(8625)
  24050. const { channels } = __nccwpck_require__(2414)
  24051. const { CloseEvent } = __nccwpck_require__(5188)
  24052. const { makeRequest } = __nccwpck_require__(9967)
  24053. const { fetching } = __nccwpck_require__(4398)
  24054. const { Headers, getHeadersList } = __nccwpck_require__(660)
  24055. const { getDecodeSplit } = __nccwpck_require__(3168)
  24056. const { WebsocketFrameSend } = __nccwpck_require__(3264)
  24057. /** @type {import('crypto')} */
  24058. let crypto
  24059. try {
  24060. crypto = __nccwpck_require__(7598)
  24061. /* c8 ignore next 3 */
  24062. } catch {
  24063. }
  24064. /**
  24065. * @see https://websockets.spec.whatwg.org/#concept-websocket-establish
  24066. * @param {URL} url
  24067. * @param {string|string[]} protocols
  24068. * @param {import('./websocket').WebSocket} ws
  24069. * @param {(response: any, extensions: string[] | undefined) => void} onEstablish
  24070. * @param {Partial<import('../../types/websocket').WebSocketInit>} options
  24071. */
  24072. function establishWebSocketConnection (url, protocols, client, ws, onEstablish, options) {
  24073. // 1. Let requestURL be a copy of url, with its scheme set to "http", if url’s
  24074. // scheme is "ws", and to "https" otherwise.
  24075. const requestURL = url
  24076. requestURL.protocol = url.protocol === 'ws:' ? 'http:' : 'https:'
  24077. // 2. Let request be a new request, whose URL is requestURL, client is client,
  24078. // service-workers mode is "none", referrer is "no-referrer", mode is
  24079. // "websocket", credentials mode is "include", cache mode is "no-store" ,
  24080. // and redirect mode is "error".
  24081. const request = makeRequest({
  24082. urlList: [requestURL],
  24083. client,
  24084. serviceWorkers: 'none',
  24085. referrer: 'no-referrer',
  24086. mode: 'websocket',
  24087. credentials: 'include',
  24088. cache: 'no-store',
  24089. redirect: 'error'
  24090. })
  24091. // Note: undici extension, allow setting custom headers.
  24092. if (options.headers) {
  24093. const headersList = getHeadersList(new Headers(options.headers))
  24094. request.headersList = headersList
  24095. }
  24096. // 3. Append (`Upgrade`, `websocket`) to request’s header list.
  24097. // 4. Append (`Connection`, `Upgrade`) to request’s header list.
  24098. // Note: both of these are handled by undici currently.
  24099. // https://github.com/nodejs/undici/blob/68c269c4144c446f3f1220951338daef4a6b5ec4/lib/client.js#L1397
  24100. // 5. Let keyValue be a nonce consisting of a randomly selected
  24101. // 16-byte value that has been forgiving-base64-encoded and
  24102. // isomorphic encoded.
  24103. const keyValue = crypto.randomBytes(16).toString('base64')
  24104. // 6. Append (`Sec-WebSocket-Key`, keyValue) to request’s
  24105. // header list.
  24106. request.headersList.append('sec-websocket-key', keyValue)
  24107. // 7. Append (`Sec-WebSocket-Version`, `13`) to request’s
  24108. // header list.
  24109. request.headersList.append('sec-websocket-version', '13')
  24110. // 8. For each protocol in protocols, combine
  24111. // (`Sec-WebSocket-Protocol`, protocol) in request’s header
  24112. // list.
  24113. for (const protocol of protocols) {
  24114. request.headersList.append('sec-websocket-protocol', protocol)
  24115. }
  24116. // 9. Let permessageDeflate be a user-agent defined
  24117. // "permessage-deflate" extension header value.
  24118. // https://github.com/mozilla/gecko-dev/blob/ce78234f5e653a5d3916813ff990f053510227bc/netwerk/protocol/websocket/WebSocketChannel.cpp#L2673
  24119. const permessageDeflate = 'permessage-deflate; client_max_window_bits'
  24120. // 10. Append (`Sec-WebSocket-Extensions`, permessageDeflate) to
  24121. // request’s header list.
  24122. request.headersList.append('sec-websocket-extensions', permessageDeflate)
  24123. // 11. Fetch request with useParallelQueue set to true, and
  24124. // processResponse given response being these steps:
  24125. const controller = fetching({
  24126. request,
  24127. useParallelQueue: true,
  24128. dispatcher: options.dispatcher,
  24129. processResponse (response) {
  24130. // 1. If response is a network error or its status is not 101,
  24131. // fail the WebSocket connection.
  24132. if (response.type === 'error' || response.status !== 101) {
  24133. failWebsocketConnection(ws, 'Received network error or non-101 status code.')
  24134. return
  24135. }
  24136. // 2. If protocols is not the empty list and extracting header
  24137. // list values given `Sec-WebSocket-Protocol` and response’s
  24138. // header list results in null, failure, or the empty byte
  24139. // sequence, then fail the WebSocket connection.
  24140. if (protocols.length !== 0 && !response.headersList.get('Sec-WebSocket-Protocol')) {
  24141. failWebsocketConnection(ws, 'Server did not respond with sent protocols.')
  24142. return
  24143. }
  24144. // 3. Follow the requirements stated step 2 to step 6, inclusive,
  24145. // of the last set of steps in section 4.1 of The WebSocket
  24146. // Protocol to validate response. This either results in fail
  24147. // the WebSocket connection or the WebSocket connection is
  24148. // established.
  24149. // 2. If the response lacks an |Upgrade| header field or the |Upgrade|
  24150. // header field contains a value that is not an ASCII case-
  24151. // insensitive match for the value "websocket", the client MUST
  24152. // _Fail the WebSocket Connection_.
  24153. if (response.headersList.get('Upgrade')?.toLowerCase() !== 'websocket') {
  24154. failWebsocketConnection(ws, 'Server did not set Upgrade header to "websocket".')
  24155. return
  24156. }
  24157. // 3. If the response lacks a |Connection| header field or the
  24158. // |Connection| header field doesn't contain a token that is an
  24159. // ASCII case-insensitive match for the value "Upgrade", the client
  24160. // MUST _Fail the WebSocket Connection_.
  24161. if (response.headersList.get('Connection')?.toLowerCase() !== 'upgrade') {
  24162. failWebsocketConnection(ws, 'Server did not set Connection header to "upgrade".')
  24163. return
  24164. }
  24165. // 4. If the response lacks a |Sec-WebSocket-Accept| header field or
  24166. // the |Sec-WebSocket-Accept| contains a value other than the
  24167. // base64-encoded SHA-1 of the concatenation of the |Sec-WebSocket-
  24168. // Key| (as a string, not base64-decoded) with the string "258EAFA5-
  24169. // E914-47DA-95CA-C5AB0DC85B11" but ignoring any leading and
  24170. // trailing whitespace, the client MUST _Fail the WebSocket
  24171. // Connection_.
  24172. const secWSAccept = response.headersList.get('Sec-WebSocket-Accept')
  24173. const digest = crypto.createHash('sha1').update(keyValue + uid).digest('base64')
  24174. if (secWSAccept !== digest) {
  24175. failWebsocketConnection(ws, 'Incorrect hash received in Sec-WebSocket-Accept header.')
  24176. return
  24177. }
  24178. // 5. If the response includes a |Sec-WebSocket-Extensions| header
  24179. // field and this header field indicates the use of an extension
  24180. // that was not present in the client's handshake (the server has
  24181. // indicated an extension not requested by the client), the client
  24182. // MUST _Fail the WebSocket Connection_. (The parsing of this
  24183. // header field to determine which extensions are requested is
  24184. // discussed in Section 9.1.)
  24185. const secExtension = response.headersList.get('Sec-WebSocket-Extensions')
  24186. let extensions
  24187. if (secExtension !== null) {
  24188. extensions = parseExtensions(secExtension)
  24189. if (!extensions.has('permessage-deflate')) {
  24190. failWebsocketConnection(ws, 'Sec-WebSocket-Extensions header does not match.')
  24191. return
  24192. }
  24193. }
  24194. // 6. If the response includes a |Sec-WebSocket-Protocol| header field
  24195. // and this header field indicates the use of a subprotocol that was
  24196. // not present in the client's handshake (the server has indicated a
  24197. // subprotocol not requested by the client), the client MUST _Fail
  24198. // the WebSocket Connection_.
  24199. const secProtocol = response.headersList.get('Sec-WebSocket-Protocol')
  24200. if (secProtocol !== null) {
  24201. const requestProtocols = getDecodeSplit('sec-websocket-protocol', request.headersList)
  24202. // The client can request that the server use a specific subprotocol by
  24203. // including the |Sec-WebSocket-Protocol| field in its handshake. If it
  24204. // is specified, the server needs to include the same field and one of
  24205. // the selected subprotocol values in its response for the connection to
  24206. // be established.
  24207. if (!requestProtocols.includes(secProtocol)) {
  24208. failWebsocketConnection(ws, 'Protocol was not set in the opening handshake.')
  24209. return
  24210. }
  24211. }
  24212. response.socket.on('data', onSocketData)
  24213. response.socket.on('close', onSocketClose)
  24214. response.socket.on('error', onSocketError)
  24215. if (channels.open.hasSubscribers) {
  24216. channels.open.publish({
  24217. address: response.socket.address(),
  24218. protocol: secProtocol,
  24219. extensions: secExtension
  24220. })
  24221. }
  24222. onEstablish(response, extensions)
  24223. }
  24224. })
  24225. return controller
  24226. }
  24227. function closeWebSocketConnection (ws, code, reason, reasonByteLength) {
  24228. if (isClosing(ws) || isClosed(ws)) {
  24229. // If this's ready state is CLOSING (2) or CLOSED (3)
  24230. // Do nothing.
  24231. } else if (!isEstablished(ws)) {
  24232. // If the WebSocket connection is not yet established
  24233. // Fail the WebSocket connection and set this's ready state
  24234. // to CLOSING (2).
  24235. failWebsocketConnection(ws, 'Connection was closed before it was established.')
  24236. ws[kReadyState] = states.CLOSING
  24237. } else if (ws[kSentClose] === sentCloseFrameState.NOT_SENT) {
  24238. // If the WebSocket closing handshake has not yet been started
  24239. // Start the WebSocket closing handshake and set this's ready
  24240. // state to CLOSING (2).
  24241. // - If neither code nor reason is present, the WebSocket Close
  24242. // message must not have a body.
  24243. // - If code is present, then the status code to use in the
  24244. // WebSocket Close message must be the integer given by code.
  24245. // - If reason is also present, then reasonBytes must be
  24246. // provided in the Close message after the status code.
  24247. ws[kSentClose] = sentCloseFrameState.PROCESSING
  24248. const frame = new WebsocketFrameSend()
  24249. // If neither code nor reason is present, the WebSocket Close
  24250. // message must not have a body.
  24251. // If code is present, then the status code to use in the
  24252. // WebSocket Close message must be the integer given by code.
  24253. if (code !== undefined && reason === undefined) {
  24254. frame.frameData = Buffer.allocUnsafe(2)
  24255. frame.frameData.writeUInt16BE(code, 0)
  24256. } else if (code !== undefined && reason !== undefined) {
  24257. // If reason is also present, then reasonBytes must be
  24258. // provided in the Close message after the status code.
  24259. frame.frameData = Buffer.allocUnsafe(2 + reasonByteLength)
  24260. frame.frameData.writeUInt16BE(code, 0)
  24261. // the body MAY contain UTF-8-encoded data with value /reason/
  24262. frame.frameData.write(reason, 2, 'utf-8')
  24263. } else {
  24264. frame.frameData = emptyBuffer
  24265. }
  24266. /** @type {import('stream').Duplex} */
  24267. const socket = ws[kResponse].socket
  24268. socket.write(frame.createFrame(opcodes.CLOSE))
  24269. ws[kSentClose] = sentCloseFrameState.SENT
  24270. // Upon either sending or receiving a Close control frame, it is said
  24271. // that _The WebSocket Closing Handshake is Started_ and that the
  24272. // WebSocket connection is in the CLOSING state.
  24273. ws[kReadyState] = states.CLOSING
  24274. } else {
  24275. // Otherwise
  24276. // Set this's ready state to CLOSING (2).
  24277. ws[kReadyState] = states.CLOSING
  24278. }
  24279. }
  24280. /**
  24281. * @param {Buffer} chunk
  24282. */
  24283. function onSocketData (chunk) {
  24284. if (!this.ws[kByteParser].write(chunk)) {
  24285. this.pause()
  24286. }
  24287. }
  24288. /**
  24289. * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol
  24290. * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.4
  24291. */
  24292. function onSocketClose () {
  24293. const { ws } = this
  24294. const { [kResponse]: response } = ws
  24295. response.socket.off('data', onSocketData)
  24296. response.socket.off('close', onSocketClose)
  24297. response.socket.off('error', onSocketError)
  24298. // If the TCP connection was closed after the
  24299. // WebSocket closing handshake was completed, the WebSocket connection
  24300. // is said to have been closed _cleanly_.
  24301. const wasClean = ws[kSentClose] === sentCloseFrameState.SENT && ws[kReceivedClose]
  24302. let code = 1005
  24303. let reason = ''
  24304. const result = ws[kByteParser].closingInfo
  24305. if (result && !result.error) {
  24306. code = result.code ?? 1005
  24307. reason = result.reason
  24308. } else if (!ws[kReceivedClose]) {
  24309. // If _The WebSocket
  24310. // Connection is Closed_ and no Close control frame was received by the
  24311. // endpoint (such as could occur if the underlying transport connection
  24312. // is lost), _The WebSocket Connection Close Code_ is considered to be
  24313. // 1006.
  24314. code = 1006
  24315. }
  24316. // 1. Change the ready state to CLOSED (3).
  24317. ws[kReadyState] = states.CLOSED
  24318. // 2. If the user agent was required to fail the WebSocket
  24319. // connection, or if the WebSocket connection was closed
  24320. // after being flagged as full, fire an event named error
  24321. // at the WebSocket object.
  24322. // TODO
  24323. // 3. Fire an event named close at the WebSocket object,
  24324. // using CloseEvent, with the wasClean attribute
  24325. // initialized to true if the connection closed cleanly
  24326. // and false otherwise, the code attribute initialized to
  24327. // the WebSocket connection close code, and the reason
  24328. // attribute initialized to the result of applying UTF-8
  24329. // decode without BOM to the WebSocket connection close
  24330. // reason.
  24331. // TODO: process.nextTick
  24332. fireEvent('close', ws, (type, init) => new CloseEvent(type, init), {
  24333. wasClean, code, reason
  24334. })
  24335. if (channels.close.hasSubscribers) {
  24336. channels.close.publish({
  24337. websocket: ws,
  24338. code,
  24339. reason
  24340. })
  24341. }
  24342. }
  24343. function onSocketError (error) {
  24344. const { ws } = this
  24345. ws[kReadyState] = states.CLOSING
  24346. if (channels.socketError.hasSubscribers) {
  24347. channels.socketError.publish(error)
  24348. }
  24349. this.destroy()
  24350. }
  24351. module.exports = {
  24352. establishWebSocketConnection,
  24353. closeWebSocketConnection
  24354. }
  24355. /***/ }),
  24356. /***/ 736:
  24357. /***/ ((module) => {
  24358. // This is a Globally Unique Identifier unique used
  24359. // to validate that the endpoint accepts websocket
  24360. // connections.
  24361. // See https://www.rfc-editor.org/rfc/rfc6455.html#section-1.3
  24362. const uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
  24363. /** @type {PropertyDescriptor} */
  24364. const staticPropertyDescriptors = {
  24365. enumerable: true,
  24366. writable: false,
  24367. configurable: false
  24368. }
  24369. const states = {
  24370. CONNECTING: 0,
  24371. OPEN: 1,
  24372. CLOSING: 2,
  24373. CLOSED: 3
  24374. }
  24375. const sentCloseFrameState = {
  24376. NOT_SENT: 0,
  24377. PROCESSING: 1,
  24378. SENT: 2
  24379. }
  24380. const opcodes = {
  24381. CONTINUATION: 0x0,
  24382. TEXT: 0x1,
  24383. BINARY: 0x2,
  24384. CLOSE: 0x8,
  24385. PING: 0x9,
  24386. PONG: 0xA
  24387. }
  24388. const maxUnsigned16Bit = 2 ** 16 - 1 // 65535
  24389. const parserStates = {
  24390. INFO: 0,
  24391. PAYLOADLENGTH_16: 2,
  24392. PAYLOADLENGTH_64: 3,
  24393. READ_DATA: 4
  24394. }
  24395. const emptyBuffer = Buffer.allocUnsafe(0)
  24396. const sendHints = {
  24397. string: 1,
  24398. typedArray: 2,
  24399. arrayBuffer: 3,
  24400. blob: 4
  24401. }
  24402. module.exports = {
  24403. uid,
  24404. sentCloseFrameState,
  24405. staticPropertyDescriptors,
  24406. states,
  24407. opcodes,
  24408. maxUnsigned16Bit,
  24409. parserStates,
  24410. emptyBuffer,
  24411. sendHints
  24412. }
  24413. /***/ }),
  24414. /***/ 5188:
  24415. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24416. const { webidl } = __nccwpck_require__(5893)
  24417. const { kEnumerableProperty } = __nccwpck_require__(3440)
  24418. const { kConstruct } = __nccwpck_require__(6443)
  24419. const { MessagePort } = __nccwpck_require__(5919)
  24420. /**
  24421. * @see https://html.spec.whatwg.org/multipage/comms.html#messageevent
  24422. */
  24423. class MessageEvent extends Event {
  24424. #eventInit
  24425. constructor (type, eventInitDict = {}) {
  24426. if (type === kConstruct) {
  24427. super(arguments[1], arguments[2])
  24428. webidl.util.markAsUncloneable(this)
  24429. return
  24430. }
  24431. const prefix = 'MessageEvent constructor'
  24432. webidl.argumentLengthCheck(arguments, 1, prefix)
  24433. type = webidl.converters.DOMString(type, prefix, 'type')
  24434. eventInitDict = webidl.converters.MessageEventInit(eventInitDict, prefix, 'eventInitDict')
  24435. super(type, eventInitDict)
  24436. this.#eventInit = eventInitDict
  24437. webidl.util.markAsUncloneable(this)
  24438. }
  24439. get data () {
  24440. webidl.brandCheck(this, MessageEvent)
  24441. return this.#eventInit.data
  24442. }
  24443. get origin () {
  24444. webidl.brandCheck(this, MessageEvent)
  24445. return this.#eventInit.origin
  24446. }
  24447. get lastEventId () {
  24448. webidl.brandCheck(this, MessageEvent)
  24449. return this.#eventInit.lastEventId
  24450. }
  24451. get source () {
  24452. webidl.brandCheck(this, MessageEvent)
  24453. return this.#eventInit.source
  24454. }
  24455. get ports () {
  24456. webidl.brandCheck(this, MessageEvent)
  24457. if (!Object.isFrozen(this.#eventInit.ports)) {
  24458. Object.freeze(this.#eventInit.ports)
  24459. }
  24460. return this.#eventInit.ports
  24461. }
  24462. initMessageEvent (
  24463. type,
  24464. bubbles = false,
  24465. cancelable = false,
  24466. data = null,
  24467. origin = '',
  24468. lastEventId = '',
  24469. source = null,
  24470. ports = []
  24471. ) {
  24472. webidl.brandCheck(this, MessageEvent)
  24473. webidl.argumentLengthCheck(arguments, 1, 'MessageEvent.initMessageEvent')
  24474. return new MessageEvent(type, {
  24475. bubbles, cancelable, data, origin, lastEventId, source, ports
  24476. })
  24477. }
  24478. static createFastMessageEvent (type, init) {
  24479. const messageEvent = new MessageEvent(kConstruct, type, init)
  24480. messageEvent.#eventInit = init
  24481. messageEvent.#eventInit.data ??= null
  24482. messageEvent.#eventInit.origin ??= ''
  24483. messageEvent.#eventInit.lastEventId ??= ''
  24484. messageEvent.#eventInit.source ??= null
  24485. messageEvent.#eventInit.ports ??= []
  24486. return messageEvent
  24487. }
  24488. }
  24489. const { createFastMessageEvent } = MessageEvent
  24490. delete MessageEvent.createFastMessageEvent
  24491. /**
  24492. * @see https://websockets.spec.whatwg.org/#the-closeevent-interface
  24493. */
  24494. class CloseEvent extends Event {
  24495. #eventInit
  24496. constructor (type, eventInitDict = {}) {
  24497. const prefix = 'CloseEvent constructor'
  24498. webidl.argumentLengthCheck(arguments, 1, prefix)
  24499. type = webidl.converters.DOMString(type, prefix, 'type')
  24500. eventInitDict = webidl.converters.CloseEventInit(eventInitDict)
  24501. super(type, eventInitDict)
  24502. this.#eventInit = eventInitDict
  24503. webidl.util.markAsUncloneable(this)
  24504. }
  24505. get wasClean () {
  24506. webidl.brandCheck(this, CloseEvent)
  24507. return this.#eventInit.wasClean
  24508. }
  24509. get code () {
  24510. webidl.brandCheck(this, CloseEvent)
  24511. return this.#eventInit.code
  24512. }
  24513. get reason () {
  24514. webidl.brandCheck(this, CloseEvent)
  24515. return this.#eventInit.reason
  24516. }
  24517. }
  24518. // https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface
  24519. class ErrorEvent extends Event {
  24520. #eventInit
  24521. constructor (type, eventInitDict) {
  24522. const prefix = 'ErrorEvent constructor'
  24523. webidl.argumentLengthCheck(arguments, 1, prefix)
  24524. super(type, eventInitDict)
  24525. webidl.util.markAsUncloneable(this)
  24526. type = webidl.converters.DOMString(type, prefix, 'type')
  24527. eventInitDict = webidl.converters.ErrorEventInit(eventInitDict ?? {})
  24528. this.#eventInit = eventInitDict
  24529. }
  24530. get message () {
  24531. webidl.brandCheck(this, ErrorEvent)
  24532. return this.#eventInit.message
  24533. }
  24534. get filename () {
  24535. webidl.brandCheck(this, ErrorEvent)
  24536. return this.#eventInit.filename
  24537. }
  24538. get lineno () {
  24539. webidl.brandCheck(this, ErrorEvent)
  24540. return this.#eventInit.lineno
  24541. }
  24542. get colno () {
  24543. webidl.brandCheck(this, ErrorEvent)
  24544. return this.#eventInit.colno
  24545. }
  24546. get error () {
  24547. webidl.brandCheck(this, ErrorEvent)
  24548. return this.#eventInit.error
  24549. }
  24550. }
  24551. Object.defineProperties(MessageEvent.prototype, {
  24552. [Symbol.toStringTag]: {
  24553. value: 'MessageEvent',
  24554. configurable: true
  24555. },
  24556. data: kEnumerableProperty,
  24557. origin: kEnumerableProperty,
  24558. lastEventId: kEnumerableProperty,
  24559. source: kEnumerableProperty,
  24560. ports: kEnumerableProperty,
  24561. initMessageEvent: kEnumerableProperty
  24562. })
  24563. Object.defineProperties(CloseEvent.prototype, {
  24564. [Symbol.toStringTag]: {
  24565. value: 'CloseEvent',
  24566. configurable: true
  24567. },
  24568. reason: kEnumerableProperty,
  24569. code: kEnumerableProperty,
  24570. wasClean: kEnumerableProperty
  24571. })
  24572. Object.defineProperties(ErrorEvent.prototype, {
  24573. [Symbol.toStringTag]: {
  24574. value: 'ErrorEvent',
  24575. configurable: true
  24576. },
  24577. message: kEnumerableProperty,
  24578. filename: kEnumerableProperty,
  24579. lineno: kEnumerableProperty,
  24580. colno: kEnumerableProperty,
  24581. error: kEnumerableProperty
  24582. })
  24583. webidl.converters.MessagePort = webidl.interfaceConverter(MessagePort)
  24584. webidl.converters['sequence<MessagePort>'] = webidl.sequenceConverter(
  24585. webidl.converters.MessagePort
  24586. )
  24587. const eventInit = [
  24588. {
  24589. key: 'bubbles',
  24590. converter: webidl.converters.boolean,
  24591. defaultValue: () => false
  24592. },
  24593. {
  24594. key: 'cancelable',
  24595. converter: webidl.converters.boolean,
  24596. defaultValue: () => false
  24597. },
  24598. {
  24599. key: 'composed',
  24600. converter: webidl.converters.boolean,
  24601. defaultValue: () => false
  24602. }
  24603. ]
  24604. webidl.converters.MessageEventInit = webidl.dictionaryConverter([
  24605. ...eventInit,
  24606. {
  24607. key: 'data',
  24608. converter: webidl.converters.any,
  24609. defaultValue: () => null
  24610. },
  24611. {
  24612. key: 'origin',
  24613. converter: webidl.converters.USVString,
  24614. defaultValue: () => ''
  24615. },
  24616. {
  24617. key: 'lastEventId',
  24618. converter: webidl.converters.DOMString,
  24619. defaultValue: () => ''
  24620. },
  24621. {
  24622. key: 'source',
  24623. // Node doesn't implement WindowProxy or ServiceWorker, so the only
  24624. // valid value for source is a MessagePort.
  24625. converter: webidl.nullableConverter(webidl.converters.MessagePort),
  24626. defaultValue: () => null
  24627. },
  24628. {
  24629. key: 'ports',
  24630. converter: webidl.converters['sequence<MessagePort>'],
  24631. defaultValue: () => new Array(0)
  24632. }
  24633. ])
  24634. webidl.converters.CloseEventInit = webidl.dictionaryConverter([
  24635. ...eventInit,
  24636. {
  24637. key: 'wasClean',
  24638. converter: webidl.converters.boolean,
  24639. defaultValue: () => false
  24640. },
  24641. {
  24642. key: 'code',
  24643. converter: webidl.converters['unsigned short'],
  24644. defaultValue: () => 0
  24645. },
  24646. {
  24647. key: 'reason',
  24648. converter: webidl.converters.USVString,
  24649. defaultValue: () => ''
  24650. }
  24651. ])
  24652. webidl.converters.ErrorEventInit = webidl.dictionaryConverter([
  24653. ...eventInit,
  24654. {
  24655. key: 'message',
  24656. converter: webidl.converters.DOMString,
  24657. defaultValue: () => ''
  24658. },
  24659. {
  24660. key: 'filename',
  24661. converter: webidl.converters.USVString,
  24662. defaultValue: () => ''
  24663. },
  24664. {
  24665. key: 'lineno',
  24666. converter: webidl.converters['unsigned long'],
  24667. defaultValue: () => 0
  24668. },
  24669. {
  24670. key: 'colno',
  24671. converter: webidl.converters['unsigned long'],
  24672. defaultValue: () => 0
  24673. },
  24674. {
  24675. key: 'error',
  24676. converter: webidl.converters.any
  24677. }
  24678. ])
  24679. module.exports = {
  24680. MessageEvent,
  24681. CloseEvent,
  24682. ErrorEvent,
  24683. createFastMessageEvent
  24684. }
  24685. /***/ }),
  24686. /***/ 3264:
  24687. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24688. const { maxUnsigned16Bit } = __nccwpck_require__(736)
  24689. const BUFFER_SIZE = 16386
  24690. /** @type {import('crypto')} */
  24691. let crypto
  24692. let buffer = null
  24693. let bufIdx = BUFFER_SIZE
  24694. try {
  24695. crypto = __nccwpck_require__(7598)
  24696. /* c8 ignore next 3 */
  24697. } catch {
  24698. crypto = {
  24699. // not full compatibility, but minimum.
  24700. randomFillSync: function randomFillSync (buffer, _offset, _size) {
  24701. for (let i = 0; i < buffer.length; ++i) {
  24702. buffer[i] = Math.random() * 255 | 0
  24703. }
  24704. return buffer
  24705. }
  24706. }
  24707. }
  24708. function generateMask () {
  24709. if (bufIdx === BUFFER_SIZE) {
  24710. bufIdx = 0
  24711. crypto.randomFillSync((buffer ??= Buffer.allocUnsafe(BUFFER_SIZE)), 0, BUFFER_SIZE)
  24712. }
  24713. return [buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++]]
  24714. }
  24715. class WebsocketFrameSend {
  24716. /**
  24717. * @param {Buffer|undefined} data
  24718. */
  24719. constructor (data) {
  24720. this.frameData = data
  24721. }
  24722. createFrame (opcode) {
  24723. const frameData = this.frameData
  24724. const maskKey = generateMask()
  24725. const bodyLength = frameData?.byteLength ?? 0
  24726. /** @type {number} */
  24727. let payloadLength = bodyLength // 0-125
  24728. let offset = 6
  24729. if (bodyLength > maxUnsigned16Bit) {
  24730. offset += 8 // payload length is next 8 bytes
  24731. payloadLength = 127
  24732. } else if (bodyLength > 125) {
  24733. offset += 2 // payload length is next 2 bytes
  24734. payloadLength = 126
  24735. }
  24736. const buffer = Buffer.allocUnsafe(bodyLength + offset)
  24737. // Clear first 2 bytes, everything else is overwritten
  24738. buffer[0] = buffer[1] = 0
  24739. buffer[0] |= 0x80 // FIN
  24740. buffer[0] = (buffer[0] & 0xF0) + opcode // opcode
  24741. /*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */
  24742. buffer[offset - 4] = maskKey[0]
  24743. buffer[offset - 3] = maskKey[1]
  24744. buffer[offset - 2] = maskKey[2]
  24745. buffer[offset - 1] = maskKey[3]
  24746. buffer[1] = payloadLength
  24747. if (payloadLength === 126) {
  24748. buffer.writeUInt16BE(bodyLength, 2)
  24749. } else if (payloadLength === 127) {
  24750. // Clear extended payload length
  24751. buffer[2] = buffer[3] = 0
  24752. buffer.writeUIntBE(bodyLength, 4, 6)
  24753. }
  24754. buffer[1] |= 0x80 // MASK
  24755. // mask body
  24756. for (let i = 0; i < bodyLength; ++i) {
  24757. buffer[offset + i] = frameData[i] ^ maskKey[i & 3]
  24758. }
  24759. return buffer
  24760. }
  24761. }
  24762. module.exports = {
  24763. WebsocketFrameSend
  24764. }
  24765. /***/ }),
  24766. /***/ 9469:
  24767. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24768. const { createInflateRaw, Z_DEFAULT_WINDOWBITS } = __nccwpck_require__(8522)
  24769. const { isValidClientWindowBits } = __nccwpck_require__(8625)
  24770. const { MessageSizeExceededError } = __nccwpck_require__(8707)
  24771. const tail = Buffer.from([0x00, 0x00, 0xff, 0xff])
  24772. const kBuffer = Symbol('kBuffer')
  24773. const kLength = Symbol('kLength')
  24774. class PerMessageDeflate {
  24775. /** @type {import('node:zlib').InflateRaw} */
  24776. #inflate
  24777. #options = {}
  24778. #maxPayloadSize = 0
  24779. /**
  24780. * @param {Map<string, string>} extensions
  24781. */
  24782. constructor (extensions, options) {
  24783. this.#options.serverNoContextTakeover = extensions.has('server_no_context_takeover')
  24784. this.#options.serverMaxWindowBits = extensions.get('server_max_window_bits')
  24785. this.#maxPayloadSize = options.maxPayloadSize
  24786. }
  24787. /**
  24788. * Decompress a compressed payload.
  24789. * @param {Buffer} chunk Compressed data
  24790. * @param {boolean} fin Final fragment flag
  24791. * @param {Function} callback Callback function
  24792. */
  24793. decompress (chunk, fin, callback) {
  24794. // An endpoint uses the following algorithm to decompress a message.
  24795. // 1. Append 4 octets of 0x00 0x00 0xff 0xff to the tail end of the
  24796. // payload of the message.
  24797. // 2. Decompress the resulting data using DEFLATE.
  24798. if (!this.#inflate) {
  24799. let windowBits = Z_DEFAULT_WINDOWBITS
  24800. if (this.#options.serverMaxWindowBits) { // empty values default to Z_DEFAULT_WINDOWBITS
  24801. if (!isValidClientWindowBits(this.#options.serverMaxWindowBits)) {
  24802. callback(new Error('Invalid server_max_window_bits'))
  24803. return
  24804. }
  24805. windowBits = Number.parseInt(this.#options.serverMaxWindowBits)
  24806. }
  24807. try {
  24808. this.#inflate = createInflateRaw({ windowBits })
  24809. } catch (err) {
  24810. callback(err)
  24811. return
  24812. }
  24813. this.#inflate[kBuffer] = []
  24814. this.#inflate[kLength] = 0
  24815. this.#inflate.on('data', (data) => {
  24816. this.#inflate[kLength] += data.length
  24817. if (this.#maxPayloadSize > 0 && this.#inflate[kLength] > this.#maxPayloadSize) {
  24818. callback(new MessageSizeExceededError())
  24819. this.#inflate.removeAllListeners()
  24820. this.#inflate = null
  24821. return
  24822. }
  24823. this.#inflate[kBuffer].push(data)
  24824. })
  24825. this.#inflate.on('error', (err) => {
  24826. this.#inflate = null
  24827. callback(err)
  24828. })
  24829. }
  24830. this.#inflate.write(chunk)
  24831. if (fin) {
  24832. this.#inflate.write(tail)
  24833. }
  24834. this.#inflate.flush(() => {
  24835. if (!this.#inflate) {
  24836. return
  24837. }
  24838. const full = Buffer.concat(this.#inflate[kBuffer], this.#inflate[kLength])
  24839. this.#inflate[kBuffer].length = 0
  24840. this.#inflate[kLength] = 0
  24841. callback(null, full)
  24842. })
  24843. }
  24844. }
  24845. module.exports = { PerMessageDeflate }
  24846. /***/ }),
  24847. /***/ 1652:
  24848. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24849. const { Writable } = __nccwpck_require__(7075)
  24850. const assert = __nccwpck_require__(4589)
  24851. const { parserStates, opcodes, states, emptyBuffer, sentCloseFrameState } = __nccwpck_require__(736)
  24852. const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(1216)
  24853. const { channels } = __nccwpck_require__(2414)
  24854. const {
  24855. isValidStatusCode,
  24856. isValidOpcode,
  24857. failWebsocketConnection,
  24858. websocketMessageReceived,
  24859. utf8Decode,
  24860. isControlFrame,
  24861. isTextBinaryFrame,
  24862. isContinuationFrame
  24863. } = __nccwpck_require__(8625)
  24864. const { WebsocketFrameSend } = __nccwpck_require__(3264)
  24865. const { closeWebSocketConnection } = __nccwpck_require__(6897)
  24866. const { PerMessageDeflate } = __nccwpck_require__(9469)
  24867. const { MessageSizeExceededError } = __nccwpck_require__(8707)
  24868. function failWebsocketConnectionWithCode (ws, code, reason) {
  24869. closeWebSocketConnection(ws, code, reason, Buffer.byteLength(reason))
  24870. failWebsocketConnection(ws, reason)
  24871. }
  24872. // This code was influenced by ws released under the MIT license.
  24873. // Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  24874. // Copyright (c) 2013 Arnout Kazemier and contributors
  24875. // Copyright (c) 2016 Luigi Pinca and contributors
  24876. class ByteParser extends Writable {
  24877. #buffers = []
  24878. #fragmentsBytes = 0
  24879. #byteOffset = 0
  24880. #loop = false
  24881. #state = parserStates.INFO
  24882. #info = {}
  24883. #fragments = []
  24884. /** @type {Map<string, PerMessageDeflate>} */
  24885. #extensions
  24886. /** @type {number} */
  24887. #maxFragments
  24888. /** @type {number} */
  24889. #maxPayloadSize
  24890. /**
  24891. * @param {import('./websocket').WebSocket} ws
  24892. * @param {Map<string, string>|null} extensions
  24893. * @param {{ maxFragments?: number, maxPayloadSize?: number }} [options]
  24894. */
  24895. constructor (ws, extensions, options = {}) {
  24896. super()
  24897. this.ws = ws
  24898. this.#extensions = extensions == null ? new Map() : extensions
  24899. this.#maxFragments = options.maxFragments ?? 0
  24900. this.#maxPayloadSize = options.maxPayloadSize ?? 0
  24901. if (this.#extensions.has('permessage-deflate')) {
  24902. this.#extensions.set('permessage-deflate', new PerMessageDeflate(extensions, options))
  24903. }
  24904. }
  24905. /**
  24906. * @param {Buffer} chunk
  24907. * @param {() => void} callback
  24908. */
  24909. _write (chunk, _, callback) {
  24910. this.#buffers.push(chunk)
  24911. this.#byteOffset += chunk.length
  24912. this.#loop = true
  24913. this.run(callback)
  24914. }
  24915. #validatePayloadLength () {
  24916. if (
  24917. this.#maxPayloadSize > 0 &&
  24918. !isControlFrame(this.#info.opcode) &&
  24919. this.#info.payloadLength + this.#fragmentsBytes > this.#maxPayloadSize
  24920. ) {
  24921. failWebsocketConnectionWithCode(this.ws, 1009, 'Payload size exceeds maximum allowed size')
  24922. return false
  24923. }
  24924. return true
  24925. }
  24926. /**
  24927. * Runs whenever a new chunk is received.
  24928. * Callback is called whenever there are no more chunks buffering,
  24929. * or not enough bytes are buffered to parse.
  24930. */
  24931. run (callback) {
  24932. while (this.#loop) {
  24933. if (this.#state === parserStates.INFO) {
  24934. // If there aren't enough bytes to parse the payload length, etc.
  24935. if (this.#byteOffset < 2) {
  24936. return callback()
  24937. }
  24938. const buffer = this.consume(2)
  24939. const fin = (buffer[0] & 0x80) !== 0
  24940. const opcode = buffer[0] & 0x0F
  24941. const masked = (buffer[1] & 0x80) === 0x80
  24942. const fragmented = !fin && opcode !== opcodes.CONTINUATION
  24943. const payloadLength = buffer[1] & 0x7F
  24944. const rsv1 = buffer[0] & 0x40
  24945. const rsv2 = buffer[0] & 0x20
  24946. const rsv3 = buffer[0] & 0x10
  24947. if (!isValidOpcode(opcode)) {
  24948. failWebsocketConnection(this.ws, 'Invalid opcode received')
  24949. return callback()
  24950. }
  24951. if (masked) {
  24952. failWebsocketConnection(this.ws, 'Frame cannot be masked')
  24953. return callback()
  24954. }
  24955. // MUST be 0 unless an extension is negotiated that defines meanings
  24956. // for non-zero values. If a nonzero value is received and none of
  24957. // the negotiated extensions defines the meaning of such a nonzero
  24958. // value, the receiving endpoint MUST _Fail the WebSocket
  24959. // Connection_.
  24960. // This document allocates the RSV1 bit of the WebSocket header for
  24961. // PMCEs and calls the bit the "Per-Message Compressed" bit. On a
  24962. // WebSocket connection where a PMCE is in use, this bit indicates
  24963. // whether a message is compressed or not.
  24964. if (rsv1 !== 0 && !this.#extensions.has('permessage-deflate')) {
  24965. failWebsocketConnection(this.ws, 'Expected RSV1 to be clear.')
  24966. return
  24967. }
  24968. if (rsv2 !== 0 || rsv3 !== 0) {
  24969. failWebsocketConnection(this.ws, 'RSV1, RSV2, RSV3 must be clear')
  24970. return
  24971. }
  24972. if (fragmented && !isTextBinaryFrame(opcode)) {
  24973. // Only text and binary frames can be fragmented
  24974. failWebsocketConnection(this.ws, 'Invalid frame type was fragmented.')
  24975. return
  24976. }
  24977. // If we are already parsing a text/binary frame and do not receive either
  24978. // a continuation frame or close frame, fail the connection.
  24979. if (isTextBinaryFrame(opcode) && this.#fragments.length > 0) {
  24980. failWebsocketConnection(this.ws, 'Expected continuation frame')
  24981. return
  24982. }
  24983. if (this.#info.fragmented && fragmented) {
  24984. // A fragmented frame can't be fragmented itself
  24985. failWebsocketConnection(this.ws, 'Fragmented frame exceeded 125 bytes.')
  24986. return
  24987. }
  24988. // "All control frames MUST have a payload length of 125 bytes or less
  24989. // and MUST NOT be fragmented."
  24990. if ((payloadLength > 125 || fragmented) && isControlFrame(opcode)) {
  24991. failWebsocketConnection(this.ws, 'Control frame either too large or fragmented')
  24992. return
  24993. }
  24994. if (isContinuationFrame(opcode) && this.#fragments.length === 0 && !this.#info.compressed) {
  24995. failWebsocketConnection(this.ws, 'Unexpected continuation frame')
  24996. return
  24997. }
  24998. if (payloadLength <= 125) {
  24999. this.#info.payloadLength = payloadLength
  25000. this.#state = parserStates.READ_DATA
  25001. if (!this.#validatePayloadLength()) {
  25002. return
  25003. }
  25004. } else if (payloadLength === 126) {
  25005. this.#state = parserStates.PAYLOADLENGTH_16
  25006. } else if (payloadLength === 127) {
  25007. this.#state = parserStates.PAYLOADLENGTH_64
  25008. }
  25009. if (isTextBinaryFrame(opcode)) {
  25010. this.#info.binaryType = opcode
  25011. this.#info.compressed = rsv1 !== 0
  25012. }
  25013. this.#info.opcode = opcode
  25014. this.#info.masked = masked
  25015. this.#info.fin = fin
  25016. this.#info.fragmented = fragmented
  25017. } else if (this.#state === parserStates.PAYLOADLENGTH_16) {
  25018. if (this.#byteOffset < 2) {
  25019. return callback()
  25020. }
  25021. const buffer = this.consume(2)
  25022. this.#info.payloadLength = buffer.readUInt16BE(0)
  25023. this.#state = parserStates.READ_DATA
  25024. if (!this.#validatePayloadLength()) {
  25025. return
  25026. }
  25027. } else if (this.#state === parserStates.PAYLOADLENGTH_64) {
  25028. if (this.#byteOffset < 8) {
  25029. return callback()
  25030. }
  25031. const buffer = this.consume(8)
  25032. const upper = buffer.readUInt32BE(0)
  25033. const lower = buffer.readUInt32BE(4)
  25034. // 2^31 is the maximum bytes an arraybuffer can contain
  25035. // on 32-bit systems. Although, on 64-bit systems, this is
  25036. // 2^53-1 bytes.
  25037. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length
  25038. // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/common/globals.h;drc=1946212ac0100668f14eb9e2843bdd846e510a1e;bpv=1;bpt=1;l=1275
  25039. // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/js-array-buffer.h;l=34;drc=1946212ac0100668f14eb9e2843bdd846e510a1e
  25040. if (upper !== 0 || lower > 2 ** 31 - 1) {
  25041. failWebsocketConnection(this.ws, 'Received payload length > 2^31 bytes.')
  25042. return
  25043. }
  25044. this.#info.payloadLength = lower
  25045. this.#state = parserStates.READ_DATA
  25046. if (!this.#validatePayloadLength()) {
  25047. return
  25048. }
  25049. } else if (this.#state === parserStates.READ_DATA) {
  25050. if (this.#byteOffset < this.#info.payloadLength) {
  25051. return callback()
  25052. }
  25053. const body = this.consume(this.#info.payloadLength)
  25054. if (isControlFrame(this.#info.opcode)) {
  25055. this.#loop = this.parseControlFrame(body)
  25056. this.#state = parserStates.INFO
  25057. } else {
  25058. if (!this.#info.compressed) {
  25059. if (!this.writeFragments(body)) {
  25060. return
  25061. }
  25062. if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
  25063. failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
  25064. return
  25065. }
  25066. // If the frame is not fragmented, a message has been received.
  25067. // If the frame is fragmented, it will terminate with a fin bit set
  25068. // and an opcode of 0 (continuation), therefore we handle that when
  25069. // parsing continuation frames, not here.
  25070. if (!this.#info.fragmented && this.#info.fin) {
  25071. websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments())
  25072. }
  25073. this.#state = parserStates.INFO
  25074. } else {
  25075. this.#extensions.get('permessage-deflate').decompress(
  25076. body,
  25077. this.#info.fin,
  25078. (error, data) => {
  25079. if (error) {
  25080. const code = error instanceof MessageSizeExceededError ? 1009 : 1007
  25081. failWebsocketConnectionWithCode(this.ws, code, error.message)
  25082. return
  25083. }
  25084. if (!this.writeFragments(data)) {
  25085. return
  25086. }
  25087. if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
  25088. failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
  25089. return
  25090. }
  25091. if (!this.#info.fin) {
  25092. this.#state = parserStates.INFO
  25093. this.#loop = true
  25094. this.run(callback)
  25095. return
  25096. }
  25097. websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments())
  25098. this.#loop = true
  25099. this.#state = parserStates.INFO
  25100. this.run(callback)
  25101. }
  25102. )
  25103. this.#loop = false
  25104. break
  25105. }
  25106. }
  25107. }
  25108. }
  25109. }
  25110. /**
  25111. * Take n bytes from the buffered Buffers
  25112. * @param {number} n
  25113. * @returns {Buffer}
  25114. */
  25115. consume (n) {
  25116. if (n > this.#byteOffset) {
  25117. throw new Error('Called consume() before buffers satiated.')
  25118. } else if (n === 0) {
  25119. return emptyBuffer
  25120. }
  25121. if (this.#buffers[0].length === n) {
  25122. this.#byteOffset -= this.#buffers[0].length
  25123. return this.#buffers.shift()
  25124. }
  25125. const buffer = Buffer.allocUnsafe(n)
  25126. let offset = 0
  25127. while (offset !== n) {
  25128. const next = this.#buffers[0]
  25129. const { length } = next
  25130. if (length + offset === n) {
  25131. buffer.set(this.#buffers.shift(), offset)
  25132. break
  25133. } else if (length + offset > n) {
  25134. buffer.set(next.subarray(0, n - offset), offset)
  25135. this.#buffers[0] = next.subarray(n - offset)
  25136. break
  25137. } else {
  25138. buffer.set(this.#buffers.shift(), offset)
  25139. offset += next.length
  25140. }
  25141. }
  25142. this.#byteOffset -= n
  25143. return buffer
  25144. }
  25145. writeFragments (fragment) {
  25146. if (
  25147. this.#maxFragments > 0 &&
  25148. this.#fragments.length === this.#maxFragments
  25149. ) {
  25150. failWebsocketConnectionWithCode(this.ws, 1008, 'Too many message fragments')
  25151. return false
  25152. }
  25153. this.#fragmentsBytes += fragment.length
  25154. this.#fragments.push(fragment)
  25155. return true
  25156. }
  25157. consumeFragments () {
  25158. const fragments = this.#fragments
  25159. if (fragments.length === 1) {
  25160. this.#fragmentsBytes = 0
  25161. return fragments.shift()
  25162. }
  25163. const output = Buffer.concat(fragments, this.#fragmentsBytes)
  25164. this.#fragments = []
  25165. this.#fragmentsBytes = 0
  25166. return output
  25167. }
  25168. parseCloseBody (data) {
  25169. assert(data.length !== 1)
  25170. // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5
  25171. /** @type {number|undefined} */
  25172. let code
  25173. if (data.length >= 2) {
  25174. // _The WebSocket Connection Close Code_ is
  25175. // defined as the status code (Section 7.4) contained in the first Close
  25176. // control frame received by the application
  25177. code = data.readUInt16BE(0)
  25178. }
  25179. if (code !== undefined && !isValidStatusCode(code)) {
  25180. return { code: 1002, reason: 'Invalid status code', error: true }
  25181. }
  25182. // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6
  25183. /** @type {Buffer} */
  25184. let reason = data.subarray(2)
  25185. // Remove BOM
  25186. if (reason[0] === 0xEF && reason[1] === 0xBB && reason[2] === 0xBF) {
  25187. reason = reason.subarray(3)
  25188. }
  25189. try {
  25190. reason = utf8Decode(reason)
  25191. } catch {
  25192. return { code: 1007, reason: 'Invalid UTF-8', error: true }
  25193. }
  25194. return { code, reason, error: false }
  25195. }
  25196. /**
  25197. * Parses control frames.
  25198. * @param {Buffer} body
  25199. */
  25200. parseControlFrame (body) {
  25201. const { opcode, payloadLength } = this.#info
  25202. if (opcode === opcodes.CLOSE) {
  25203. if (payloadLength === 1) {
  25204. failWebsocketConnection(this.ws, 'Received close frame with a 1-byte body.')
  25205. return false
  25206. }
  25207. this.#info.closeInfo = this.parseCloseBody(body)
  25208. if (this.#info.closeInfo.error) {
  25209. const { code, reason } = this.#info.closeInfo
  25210. closeWebSocketConnection(this.ws, code, reason, reason.length)
  25211. failWebsocketConnection(this.ws, reason)
  25212. return false
  25213. }
  25214. if (this.ws[kSentClose] !== sentCloseFrameState.SENT) {
  25215. // If an endpoint receives a Close frame and did not previously send a
  25216. // Close frame, the endpoint MUST send a Close frame in response. (When
  25217. // sending a Close frame in response, the endpoint typically echos the
  25218. // status code it received.)
  25219. let body = emptyBuffer
  25220. if (this.#info.closeInfo.code) {
  25221. body = Buffer.allocUnsafe(2)
  25222. body.writeUInt16BE(this.#info.closeInfo.code, 0)
  25223. }
  25224. const closeFrame = new WebsocketFrameSend(body)
  25225. this.ws[kResponse].socket.write(
  25226. closeFrame.createFrame(opcodes.CLOSE),
  25227. (err) => {
  25228. if (!err) {
  25229. this.ws[kSentClose] = sentCloseFrameState.SENT
  25230. }
  25231. }
  25232. )
  25233. }
  25234. // Upon either sending or receiving a Close control frame, it is said
  25235. // that _The WebSocket Closing Handshake is Started_ and that the
  25236. // WebSocket connection is in the CLOSING state.
  25237. this.ws[kReadyState] = states.CLOSING
  25238. this.ws[kReceivedClose] = true
  25239. return false
  25240. } else if (opcode === opcodes.PING) {
  25241. // Upon receipt of a Ping frame, an endpoint MUST send a Pong frame in
  25242. // response, unless it already received a Close frame.
  25243. // A Pong frame sent in response to a Ping frame must have identical
  25244. // "Application data"
  25245. if (!this.ws[kReceivedClose]) {
  25246. const frame = new WebsocketFrameSend(body)
  25247. this.ws[kResponse].socket.write(frame.createFrame(opcodes.PONG))
  25248. if (channels.ping.hasSubscribers) {
  25249. channels.ping.publish({
  25250. payload: body
  25251. })
  25252. }
  25253. }
  25254. } else if (opcode === opcodes.PONG) {
  25255. // A Pong frame MAY be sent unsolicited. This serves as a
  25256. // unidirectional heartbeat. A response to an unsolicited Pong frame is
  25257. // not expected.
  25258. if (channels.pong.hasSubscribers) {
  25259. channels.pong.publish({
  25260. payload: body
  25261. })
  25262. }
  25263. }
  25264. return true
  25265. }
  25266. get closingInfo () {
  25267. return this.#info.closeInfo
  25268. }
  25269. }
  25270. module.exports = {
  25271. ByteParser
  25272. }
  25273. /***/ }),
  25274. /***/ 3900:
  25275. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25276. const { WebsocketFrameSend } = __nccwpck_require__(3264)
  25277. const { opcodes, sendHints } = __nccwpck_require__(736)
  25278. const FixedQueue = __nccwpck_require__(4660)
  25279. /** @type {typeof Uint8Array} */
  25280. const FastBuffer = Buffer[Symbol.species]
  25281. /**
  25282. * @typedef {object} SendQueueNode
  25283. * @property {Promise<void> | null} promise
  25284. * @property {((...args: any[]) => any)} callback
  25285. * @property {Buffer | null} frame
  25286. */
  25287. class SendQueue {
  25288. /**
  25289. * @type {FixedQueue}
  25290. */
  25291. #queue = new FixedQueue()
  25292. /**
  25293. * @type {boolean}
  25294. */
  25295. #running = false
  25296. /** @type {import('node:net').Socket} */
  25297. #socket
  25298. constructor (socket) {
  25299. this.#socket = socket
  25300. }
  25301. add (item, cb, hint) {
  25302. if (hint !== sendHints.blob) {
  25303. const frame = createFrame(item, hint)
  25304. if (!this.#running) {
  25305. // fast-path
  25306. this.#socket.write(frame, cb)
  25307. } else {
  25308. /** @type {SendQueueNode} */
  25309. const node = {
  25310. promise: null,
  25311. callback: cb,
  25312. frame
  25313. }
  25314. this.#queue.push(node)
  25315. }
  25316. return
  25317. }
  25318. /** @type {SendQueueNode} */
  25319. const node = {
  25320. promise: item.arrayBuffer().then((ab) => {
  25321. node.promise = null
  25322. node.frame = createFrame(ab, hint)
  25323. }),
  25324. callback: cb,
  25325. frame: null
  25326. }
  25327. this.#queue.push(node)
  25328. if (!this.#running) {
  25329. this.#run()
  25330. }
  25331. }
  25332. async #run () {
  25333. this.#running = true
  25334. const queue = this.#queue
  25335. while (!queue.isEmpty()) {
  25336. const node = queue.shift()
  25337. // wait pending promise
  25338. if (node.promise !== null) {
  25339. await node.promise
  25340. }
  25341. // write
  25342. this.#socket.write(node.frame, node.callback)
  25343. // cleanup
  25344. node.callback = node.frame = null
  25345. }
  25346. this.#running = false
  25347. }
  25348. }
  25349. function createFrame (data, hint) {
  25350. return new WebsocketFrameSend(toBuffer(data, hint)).createFrame(hint === sendHints.string ? opcodes.TEXT : opcodes.BINARY)
  25351. }
  25352. function toBuffer (data, hint) {
  25353. switch (hint) {
  25354. case sendHints.string:
  25355. return Buffer.from(data)
  25356. case sendHints.arrayBuffer:
  25357. case sendHints.blob:
  25358. return new FastBuffer(data)
  25359. case sendHints.typedArray:
  25360. return new FastBuffer(data.buffer, data.byteOffset, data.byteLength)
  25361. }
  25362. }
  25363. module.exports = { SendQueue }
  25364. /***/ }),
  25365. /***/ 1216:
  25366. /***/ ((module) => {
  25367. module.exports = {
  25368. kWebSocketURL: Symbol('url'),
  25369. kReadyState: Symbol('ready state'),
  25370. kController: Symbol('controller'),
  25371. kResponse: Symbol('response'),
  25372. kBinaryType: Symbol('binary type'),
  25373. kSentClose: Symbol('sent close'),
  25374. kReceivedClose: Symbol('received close'),
  25375. kByteParser: Symbol('byte parser')
  25376. }
  25377. /***/ }),
  25378. /***/ 8625:
  25379. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25380. const { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = __nccwpck_require__(1216)
  25381. const { states, opcodes } = __nccwpck_require__(736)
  25382. const { ErrorEvent, createFastMessageEvent } = __nccwpck_require__(5188)
  25383. const { isUtf8 } = __nccwpck_require__(4573)
  25384. const { collectASequenceOfCodePointsFast, removeHTTPWhitespace } = __nccwpck_require__(1900)
  25385. /* globals Blob */
  25386. /**
  25387. * @param {import('./websocket').WebSocket} ws
  25388. * @returns {boolean}
  25389. */
  25390. function isConnecting (ws) {
  25391. // If the WebSocket connection is not yet established, and the connection
  25392. // is not yet closed, then the WebSocket connection is in the CONNECTING state.
  25393. return ws[kReadyState] === states.CONNECTING
  25394. }
  25395. /**
  25396. * @param {import('./websocket').WebSocket} ws
  25397. * @returns {boolean}
  25398. */
  25399. function isEstablished (ws) {
  25400. // If the server's response is validated as provided for above, it is
  25401. // said that _The WebSocket Connection is Established_ and that the
  25402. // WebSocket Connection is in the OPEN state.
  25403. return ws[kReadyState] === states.OPEN
  25404. }
  25405. /**
  25406. * @param {import('./websocket').WebSocket} ws
  25407. * @returns {boolean}
  25408. */
  25409. function isClosing (ws) {
  25410. // Upon either sending or receiving a Close control frame, it is said
  25411. // that _The WebSocket Closing Handshake is Started_ and that the
  25412. // WebSocket connection is in the CLOSING state.
  25413. return ws[kReadyState] === states.CLOSING
  25414. }
  25415. /**
  25416. * @param {import('./websocket').WebSocket} ws
  25417. * @returns {boolean}
  25418. */
  25419. function isClosed (ws) {
  25420. return ws[kReadyState] === states.CLOSED
  25421. }
  25422. /**
  25423. * @see https://dom.spec.whatwg.org/#concept-event-fire
  25424. * @param {string} e
  25425. * @param {EventTarget} target
  25426. * @param {(...args: ConstructorParameters<typeof Event>) => Event} eventFactory
  25427. * @param {EventInit | undefined} eventInitDict
  25428. */
  25429. function fireEvent (e, target, eventFactory = (type, init) => new Event(type, init), eventInitDict = {}) {
  25430. // 1. If eventConstructor is not given, then let eventConstructor be Event.
  25431. // 2. Let event be the result of creating an event given eventConstructor,
  25432. // in the relevant realm of target.
  25433. // 3. Initialize event’s type attribute to e.
  25434. const event = eventFactory(e, eventInitDict)
  25435. // 4. Initialize any other IDL attributes of event as described in the
  25436. // invocation of this algorithm.
  25437. // 5. Return the result of dispatching event at target, with legacy target
  25438. // override flag set if set.
  25439. target.dispatchEvent(event)
  25440. }
  25441. /**
  25442. * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol
  25443. * @param {import('./websocket').WebSocket} ws
  25444. * @param {number} type Opcode
  25445. * @param {Buffer} data application data
  25446. */
  25447. function websocketMessageReceived (ws, type, data) {
  25448. // 1. If ready state is not OPEN (1), then return.
  25449. if (ws[kReadyState] !== states.OPEN) {
  25450. return
  25451. }
  25452. // 2. Let dataForEvent be determined by switching on type and binary type:
  25453. let dataForEvent
  25454. if (type === opcodes.TEXT) {
  25455. // -> type indicates that the data is Text
  25456. // a new DOMString containing data
  25457. try {
  25458. dataForEvent = utf8Decode(data)
  25459. } catch {
  25460. failWebsocketConnection(ws, 'Received invalid UTF-8 in text frame.')
  25461. return
  25462. }
  25463. } else if (type === opcodes.BINARY) {
  25464. if (ws[kBinaryType] === 'blob') {
  25465. // -> type indicates that the data is Binary and binary type is "blob"
  25466. // a new Blob object, created in the relevant Realm of the WebSocket
  25467. // object, that represents data as its raw data
  25468. dataForEvent = new Blob([data])
  25469. } else {
  25470. // -> type indicates that the data is Binary and binary type is "arraybuffer"
  25471. // a new ArrayBuffer object, created in the relevant Realm of the
  25472. // WebSocket object, whose contents are data
  25473. dataForEvent = toArrayBuffer(data)
  25474. }
  25475. }
  25476. // 3. Fire an event named message at the WebSocket object, using MessageEvent,
  25477. // with the origin attribute initialized to the serialization of the WebSocket
  25478. // object’s url's origin, and the data attribute initialized to dataForEvent.
  25479. fireEvent('message', ws, createFastMessageEvent, {
  25480. origin: ws[kWebSocketURL].origin,
  25481. data: dataForEvent
  25482. })
  25483. }
  25484. function toArrayBuffer (buffer) {
  25485. if (buffer.byteLength === buffer.buffer.byteLength) {
  25486. return buffer.buffer
  25487. }
  25488. return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)
  25489. }
  25490. /**
  25491. * @see https://datatracker.ietf.org/doc/html/rfc6455
  25492. * @see https://datatracker.ietf.org/doc/html/rfc2616
  25493. * @see https://bugs.chromium.org/p/chromium/issues/detail?id=398407
  25494. * @param {string} protocol
  25495. */
  25496. function isValidSubprotocol (protocol) {
  25497. // If present, this value indicates one
  25498. // or more comma-separated subprotocol the client wishes to speak,
  25499. // ordered by preference. The elements that comprise this value
  25500. // MUST be non-empty strings with characters in the range U+0021 to
  25501. // U+007E not including separator characters as defined in
  25502. // [RFC2616] and MUST all be unique strings.
  25503. if (protocol.length === 0) {
  25504. return false
  25505. }
  25506. for (let i = 0; i < protocol.length; ++i) {
  25507. const code = protocol.charCodeAt(i)
  25508. if (
  25509. code < 0x21 || // CTL, contains SP (0x20) and HT (0x09)
  25510. code > 0x7E ||
  25511. code === 0x22 || // "
  25512. code === 0x28 || // (
  25513. code === 0x29 || // )
  25514. code === 0x2C || // ,
  25515. code === 0x2F || // /
  25516. code === 0x3A || // :
  25517. code === 0x3B || // ;
  25518. code === 0x3C || // <
  25519. code === 0x3D || // =
  25520. code === 0x3E || // >
  25521. code === 0x3F || // ?
  25522. code === 0x40 || // @
  25523. code === 0x5B || // [
  25524. code === 0x5C || // \
  25525. code === 0x5D || // ]
  25526. code === 0x7B || // {
  25527. code === 0x7D // }
  25528. ) {
  25529. return false
  25530. }
  25531. }
  25532. return true
  25533. }
  25534. /**
  25535. * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7-4
  25536. * @param {number} code
  25537. */
  25538. function isValidStatusCode (code) {
  25539. if (code >= 1000 && code < 1015) {
  25540. return (
  25541. code !== 1004 && // reserved
  25542. code !== 1005 && // "MUST NOT be set as a status code"
  25543. code !== 1006 // "MUST NOT be set as a status code"
  25544. )
  25545. }
  25546. return code >= 3000 && code <= 4999
  25547. }
  25548. /**
  25549. * @param {import('./websocket').WebSocket} ws
  25550. * @param {string|undefined} reason
  25551. */
  25552. function failWebsocketConnection (ws, reason) {
  25553. const { [kController]: controller, [kResponse]: response } = ws
  25554. controller.abort()
  25555. if (response?.socket && !response.socket.destroyed) {
  25556. response.socket.destroy()
  25557. }
  25558. if (reason) {
  25559. // TODO: process.nextTick
  25560. fireEvent('error', ws, (type, init) => new ErrorEvent(type, init), {
  25561. error: new Error(reason),
  25562. message: reason
  25563. })
  25564. }
  25565. }
  25566. /**
  25567. * @see https://datatracker.ietf.org/doc/html/rfc6455#section-5.5
  25568. * @param {number} opcode
  25569. */
  25570. function isControlFrame (opcode) {
  25571. return (
  25572. opcode === opcodes.CLOSE ||
  25573. opcode === opcodes.PING ||
  25574. opcode === opcodes.PONG
  25575. )
  25576. }
  25577. function isContinuationFrame (opcode) {
  25578. return opcode === opcodes.CONTINUATION
  25579. }
  25580. function isTextBinaryFrame (opcode) {
  25581. return opcode === opcodes.TEXT || opcode === opcodes.BINARY
  25582. }
  25583. function isValidOpcode (opcode) {
  25584. return isTextBinaryFrame(opcode) || isContinuationFrame(opcode) || isControlFrame(opcode)
  25585. }
  25586. /**
  25587. * Parses a Sec-WebSocket-Extensions header value.
  25588. * @param {string} extensions
  25589. * @returns {Map<string, string>}
  25590. */
  25591. // TODO(@Uzlopak, @KhafraDev): make compliant https://datatracker.ietf.org/doc/html/rfc6455#section-9.1
  25592. function parseExtensions (extensions) {
  25593. const position = { position: 0 }
  25594. const extensionList = new Map()
  25595. while (position.position < extensions.length) {
  25596. const pair = collectASequenceOfCodePointsFast(';', extensions, position)
  25597. const [name, value = ''] = pair.split('=')
  25598. extensionList.set(
  25599. removeHTTPWhitespace(name, true, false),
  25600. removeHTTPWhitespace(value, false, true)
  25601. )
  25602. position.position++
  25603. }
  25604. return extensionList
  25605. }
  25606. /**
  25607. * @see https://www.rfc-editor.org/rfc/rfc7692#section-7.1.2.2
  25608. * @description "client-max-window-bits = 1*DIGIT"
  25609. * @param {string} value
  25610. */
  25611. function isValidClientWindowBits (value) {
  25612. // Must have at least one character
  25613. if (value.length === 0) {
  25614. return false
  25615. }
  25616. // Check all characters are ASCII digits
  25617. for (let i = 0; i < value.length; i++) {
  25618. const byte = value.charCodeAt(i)
  25619. if (byte < 0x30 || byte > 0x39) {
  25620. return false
  25621. }
  25622. }
  25623. // Check numeric range: zlib requires windowBits in range 8-15
  25624. const num = Number.parseInt(value, 10)
  25625. return num >= 8 && num <= 15
  25626. }
  25627. // https://nodejs.org/api/intl.html#detecting-internationalization-support
  25628. const hasIntl = typeof process.versions.icu === 'string'
  25629. const fatalDecoder = hasIntl ? new TextDecoder('utf-8', { fatal: true }) : undefined
  25630. /**
  25631. * Converts a Buffer to utf-8, even on platforms without icu.
  25632. * @param {Buffer} buffer
  25633. */
  25634. const utf8Decode = hasIntl
  25635. ? fatalDecoder.decode.bind(fatalDecoder)
  25636. : function (buffer) {
  25637. if (isUtf8(buffer)) {
  25638. return buffer.toString('utf-8')
  25639. }
  25640. throw new TypeError('Invalid utf-8 received.')
  25641. }
  25642. module.exports = {
  25643. isConnecting,
  25644. isEstablished,
  25645. isClosing,
  25646. isClosed,
  25647. fireEvent,
  25648. isValidSubprotocol,
  25649. isValidStatusCode,
  25650. failWebsocketConnection,
  25651. websocketMessageReceived,
  25652. utf8Decode,
  25653. isControlFrame,
  25654. isContinuationFrame,
  25655. isTextBinaryFrame,
  25656. isValidOpcode,
  25657. parseExtensions,
  25658. isValidClientWindowBits
  25659. }
  25660. /***/ }),
  25661. /***/ 3726:
  25662. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25663. const { webidl } = __nccwpck_require__(5893)
  25664. const { URLSerializer } = __nccwpck_require__(1900)
  25665. const { environmentSettingsObject } = __nccwpck_require__(3168)
  25666. const { staticPropertyDescriptors, states, sentCloseFrameState, sendHints } = __nccwpck_require__(736)
  25667. const {
  25668. kWebSocketURL,
  25669. kReadyState,
  25670. kController,
  25671. kBinaryType,
  25672. kResponse,
  25673. kSentClose,
  25674. kByteParser
  25675. } = __nccwpck_require__(1216)
  25676. const {
  25677. isConnecting,
  25678. isEstablished,
  25679. isClosing,
  25680. isValidSubprotocol,
  25681. fireEvent
  25682. } = __nccwpck_require__(8625)
  25683. const { establishWebSocketConnection, closeWebSocketConnection } = __nccwpck_require__(6897)
  25684. const { ByteParser } = __nccwpck_require__(1652)
  25685. const { kEnumerableProperty, isBlobLike } = __nccwpck_require__(3440)
  25686. const { getGlobalDispatcher } = __nccwpck_require__(2581)
  25687. const { types } = __nccwpck_require__(7975)
  25688. const { ErrorEvent, CloseEvent } = __nccwpck_require__(5188)
  25689. const { SendQueue } = __nccwpck_require__(3900)
  25690. // https://websockets.spec.whatwg.org/#interface-definition
  25691. class WebSocket extends EventTarget {
  25692. #events = {
  25693. open: null,
  25694. error: null,
  25695. close: null,
  25696. message: null
  25697. }
  25698. #bufferedAmount = 0
  25699. #protocol = ''
  25700. #extensions = ''
  25701. /** @type {SendQueue} */
  25702. #sendQueue
  25703. /**
  25704. * @param {string} url
  25705. * @param {string|string[]} protocols
  25706. */
  25707. constructor (url, protocols = []) {
  25708. super()
  25709. webidl.util.markAsUncloneable(this)
  25710. const prefix = 'WebSocket constructor'
  25711. webidl.argumentLengthCheck(arguments, 1, prefix)
  25712. const options = webidl.converters['DOMString or sequence<DOMString> or WebSocketInit'](protocols, prefix, 'options')
  25713. url = webidl.converters.USVString(url, prefix, 'url')
  25714. protocols = options.protocols
  25715. // 1. Let baseURL be this's relevant settings object's API base URL.
  25716. const baseURL = environmentSettingsObject.settingsObject.baseUrl
  25717. // 1. Let urlRecord be the result of applying the URL parser to url with baseURL.
  25718. let urlRecord
  25719. try {
  25720. urlRecord = new URL(url, baseURL)
  25721. } catch (e) {
  25722. // 3. If urlRecord is failure, then throw a "SyntaxError" DOMException.
  25723. throw new DOMException(e, 'SyntaxError')
  25724. }
  25725. // 4. If urlRecord’s scheme is "http", then set urlRecord’s scheme to "ws".
  25726. if (urlRecord.protocol === 'http:') {
  25727. urlRecord.protocol = 'ws:'
  25728. } else if (urlRecord.protocol === 'https:') {
  25729. // 5. Otherwise, if urlRecord’s scheme is "https", set urlRecord’s scheme to "wss".
  25730. urlRecord.protocol = 'wss:'
  25731. }
  25732. // 6. If urlRecord’s scheme is not "ws" or "wss", then throw a "SyntaxError" DOMException.
  25733. if (urlRecord.protocol !== 'ws:' && urlRecord.protocol !== 'wss:') {
  25734. throw new DOMException(
  25735. `Expected a ws: or wss: protocol, got ${urlRecord.protocol}`,
  25736. 'SyntaxError'
  25737. )
  25738. }
  25739. // 7. If urlRecord’s fragment is non-null, then throw a "SyntaxError"
  25740. // DOMException.
  25741. if (urlRecord.hash || urlRecord.href.endsWith('#')) {
  25742. throw new DOMException('Got fragment', 'SyntaxError')
  25743. }
  25744. // 8. If protocols is a string, set protocols to a sequence consisting
  25745. // of just that string.
  25746. if (typeof protocols === 'string') {
  25747. protocols = [protocols]
  25748. }
  25749. // 9. If any of the values in protocols occur more than once or otherwise
  25750. // fail to match the requirements for elements that comprise the value
  25751. // of `Sec-WebSocket-Protocol` fields as defined by The WebSocket
  25752. // protocol, then throw a "SyntaxError" DOMException.
  25753. if (protocols.length !== new Set(protocols.map(p => p.toLowerCase())).size) {
  25754. throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError')
  25755. }
  25756. if (protocols.length > 0 && !protocols.every(p => isValidSubprotocol(p))) {
  25757. throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError')
  25758. }
  25759. // 10. Set this's url to urlRecord.
  25760. this[kWebSocketURL] = new URL(urlRecord.href)
  25761. // 11. Let client be this's relevant settings object.
  25762. const client = environmentSettingsObject.settingsObject
  25763. // 12. Run this step in parallel:
  25764. // 1. Establish a WebSocket connection given urlRecord, protocols,
  25765. // and client.
  25766. this[kController] = establishWebSocketConnection(
  25767. urlRecord,
  25768. protocols,
  25769. client,
  25770. this,
  25771. (response, extensions) => this.#onConnectionEstablished(response, extensions),
  25772. options
  25773. )
  25774. // Each WebSocket object has an associated ready state, which is a
  25775. // number representing the state of the connection. Initially it must
  25776. // be CONNECTING (0).
  25777. this[kReadyState] = WebSocket.CONNECTING
  25778. this[kSentClose] = sentCloseFrameState.NOT_SENT
  25779. // The extensions attribute must initially return the empty string.
  25780. // The protocol attribute must initially return the empty string.
  25781. // Each WebSocket object has an associated binary type, which is a
  25782. // BinaryType. Initially it must be "blob".
  25783. this[kBinaryType] = 'blob'
  25784. }
  25785. /**
  25786. * @see https://websockets.spec.whatwg.org/#dom-websocket-close
  25787. * @param {number|undefined} code
  25788. * @param {string|undefined} reason
  25789. */
  25790. close (code = undefined, reason = undefined) {
  25791. webidl.brandCheck(this, WebSocket)
  25792. const prefix = 'WebSocket.close'
  25793. if (code !== undefined) {
  25794. code = webidl.converters['unsigned short'](code, prefix, 'code', { clamp: true })
  25795. }
  25796. if (reason !== undefined) {
  25797. reason = webidl.converters.USVString(reason, prefix, 'reason')
  25798. }
  25799. // 1. If code is present, but is neither an integer equal to 1000 nor an
  25800. // integer in the range 3000 to 4999, inclusive, throw an
  25801. // "InvalidAccessError" DOMException.
  25802. if (code !== undefined) {
  25803. if (code !== 1000 && (code < 3000 || code > 4999)) {
  25804. throw new DOMException('invalid code', 'InvalidAccessError')
  25805. }
  25806. }
  25807. let reasonByteLength = 0
  25808. // 2. If reason is present, then run these substeps:
  25809. if (reason !== undefined) {
  25810. // 1. Let reasonBytes be the result of encoding reason.
  25811. // 2. If reasonBytes is longer than 123 bytes, then throw a
  25812. // "SyntaxError" DOMException.
  25813. reasonByteLength = Buffer.byteLength(reason)
  25814. if (reasonByteLength > 123) {
  25815. throw new DOMException(
  25816. `Reason must be less than 123 bytes; received ${reasonByteLength}`,
  25817. 'SyntaxError'
  25818. )
  25819. }
  25820. }
  25821. // 3. Run the first matching steps from the following list:
  25822. closeWebSocketConnection(this, code, reason, reasonByteLength)
  25823. }
  25824. /**
  25825. * @see https://websockets.spec.whatwg.org/#dom-websocket-send
  25826. * @param {NodeJS.TypedArray|ArrayBuffer|Blob|string} data
  25827. */
  25828. send (data) {
  25829. webidl.brandCheck(this, WebSocket)
  25830. const prefix = 'WebSocket.send'
  25831. webidl.argumentLengthCheck(arguments, 1, prefix)
  25832. data = webidl.converters.WebSocketSendData(data, prefix, 'data')
  25833. // 1. If this's ready state is CONNECTING, then throw an
  25834. // "InvalidStateError" DOMException.
  25835. if (isConnecting(this)) {
  25836. throw new DOMException('Sent before connected.', 'InvalidStateError')
  25837. }
  25838. // 2. Run the appropriate set of steps from the following list:
  25839. // https://datatracker.ietf.org/doc/html/rfc6455#section-6.1
  25840. // https://datatracker.ietf.org/doc/html/rfc6455#section-5.2
  25841. if (!isEstablished(this) || isClosing(this)) {
  25842. return
  25843. }
  25844. // If data is a string
  25845. if (typeof data === 'string') {
  25846. // If the WebSocket connection is established and the WebSocket
  25847. // closing handshake has not yet started, then the user agent
  25848. // must send a WebSocket Message comprised of the data argument
  25849. // using a text frame opcode; if the data cannot be sent, e.g.
  25850. // because it would need to be buffered but the buffer is full,
  25851. // the user agent must flag the WebSocket as full and then close
  25852. // the WebSocket connection. Any invocation of this method with a
  25853. // string argument that does not throw an exception must increase
  25854. // the bufferedAmount attribute by the number of bytes needed to
  25855. // express the argument as UTF-8.
  25856. const length = Buffer.byteLength(data)
  25857. this.#bufferedAmount += length
  25858. this.#sendQueue.add(data, () => {
  25859. this.#bufferedAmount -= length
  25860. }, sendHints.string)
  25861. } else if (types.isArrayBuffer(data)) {
  25862. // If the WebSocket connection is established, and the WebSocket
  25863. // closing handshake has not yet started, then the user agent must
  25864. // send a WebSocket Message comprised of data using a binary frame
  25865. // opcode; if the data cannot be sent, e.g. because it would need
  25866. // to be buffered but the buffer is full, the user agent must flag
  25867. // the WebSocket as full and then close the WebSocket connection.
  25868. // The data to be sent is the data stored in the buffer described
  25869. // by the ArrayBuffer object. Any invocation of this method with an
  25870. // ArrayBuffer argument that does not throw an exception must
  25871. // increase the bufferedAmount attribute by the length of the
  25872. // ArrayBuffer in bytes.
  25873. this.#bufferedAmount += data.byteLength
  25874. this.#sendQueue.add(data, () => {
  25875. this.#bufferedAmount -= data.byteLength
  25876. }, sendHints.arrayBuffer)
  25877. } else if (ArrayBuffer.isView(data)) {
  25878. // If the WebSocket connection is established, and the WebSocket
  25879. // closing handshake has not yet started, then the user agent must
  25880. // send a WebSocket Message comprised of data using a binary frame
  25881. // opcode; if the data cannot be sent, e.g. because it would need to
  25882. // be buffered but the buffer is full, the user agent must flag the
  25883. // WebSocket as full and then close the WebSocket connection. The
  25884. // data to be sent is the data stored in the section of the buffer
  25885. // described by the ArrayBuffer object that data references. Any
  25886. // invocation of this method with this kind of argument that does
  25887. // not throw an exception must increase the bufferedAmount attribute
  25888. // by the length of data’s buffer in bytes.
  25889. this.#bufferedAmount += data.byteLength
  25890. this.#sendQueue.add(data, () => {
  25891. this.#bufferedAmount -= data.byteLength
  25892. }, sendHints.typedArray)
  25893. } else if (isBlobLike(data)) {
  25894. // If the WebSocket connection is established, and the WebSocket
  25895. // closing handshake has not yet started, then the user agent must
  25896. // send a WebSocket Message comprised of data using a binary frame
  25897. // opcode; if the data cannot be sent, e.g. because it would need to
  25898. // be buffered but the buffer is full, the user agent must flag the
  25899. // WebSocket as full and then close the WebSocket connection. The data
  25900. // to be sent is the raw data represented by the Blob object. Any
  25901. // invocation of this method with a Blob argument that does not throw
  25902. // an exception must increase the bufferedAmount attribute by the size
  25903. // of the Blob object’s raw data, in bytes.
  25904. this.#bufferedAmount += data.size
  25905. this.#sendQueue.add(data, () => {
  25906. this.#bufferedAmount -= data.size
  25907. }, sendHints.blob)
  25908. }
  25909. }
  25910. get readyState () {
  25911. webidl.brandCheck(this, WebSocket)
  25912. // The readyState getter steps are to return this's ready state.
  25913. return this[kReadyState]
  25914. }
  25915. get bufferedAmount () {
  25916. webidl.brandCheck(this, WebSocket)
  25917. return this.#bufferedAmount
  25918. }
  25919. get url () {
  25920. webidl.brandCheck(this, WebSocket)
  25921. // The url getter steps are to return this's url, serialized.
  25922. return URLSerializer(this[kWebSocketURL])
  25923. }
  25924. get extensions () {
  25925. webidl.brandCheck(this, WebSocket)
  25926. return this.#extensions
  25927. }
  25928. get protocol () {
  25929. webidl.brandCheck(this, WebSocket)
  25930. return this.#protocol
  25931. }
  25932. get onopen () {
  25933. webidl.brandCheck(this, WebSocket)
  25934. return this.#events.open
  25935. }
  25936. set onopen (fn) {
  25937. webidl.brandCheck(this, WebSocket)
  25938. if (this.#events.open) {
  25939. this.removeEventListener('open', this.#events.open)
  25940. }
  25941. if (typeof fn === 'function') {
  25942. this.#events.open = fn
  25943. this.addEventListener('open', fn)
  25944. } else {
  25945. this.#events.open = null
  25946. }
  25947. }
  25948. get onerror () {
  25949. webidl.brandCheck(this, WebSocket)
  25950. return this.#events.error
  25951. }
  25952. set onerror (fn) {
  25953. webidl.brandCheck(this, WebSocket)
  25954. if (this.#events.error) {
  25955. this.removeEventListener('error', this.#events.error)
  25956. }
  25957. if (typeof fn === 'function') {
  25958. this.#events.error = fn
  25959. this.addEventListener('error', fn)
  25960. } else {
  25961. this.#events.error = null
  25962. }
  25963. }
  25964. get onclose () {
  25965. webidl.brandCheck(this, WebSocket)
  25966. return this.#events.close
  25967. }
  25968. set onclose (fn) {
  25969. webidl.brandCheck(this, WebSocket)
  25970. if (this.#events.close) {
  25971. this.removeEventListener('close', this.#events.close)
  25972. }
  25973. if (typeof fn === 'function') {
  25974. this.#events.close = fn
  25975. this.addEventListener('close', fn)
  25976. } else {
  25977. this.#events.close = null
  25978. }
  25979. }
  25980. get onmessage () {
  25981. webidl.brandCheck(this, WebSocket)
  25982. return this.#events.message
  25983. }
  25984. set onmessage (fn) {
  25985. webidl.brandCheck(this, WebSocket)
  25986. if (this.#events.message) {
  25987. this.removeEventListener('message', this.#events.message)
  25988. }
  25989. if (typeof fn === 'function') {
  25990. this.#events.message = fn
  25991. this.addEventListener('message', fn)
  25992. } else {
  25993. this.#events.message = null
  25994. }
  25995. }
  25996. get binaryType () {
  25997. webidl.brandCheck(this, WebSocket)
  25998. return this[kBinaryType]
  25999. }
  26000. set binaryType (type) {
  26001. webidl.brandCheck(this, WebSocket)
  26002. if (type !== 'blob' && type !== 'arraybuffer') {
  26003. this[kBinaryType] = 'blob'
  26004. } else {
  26005. this[kBinaryType] = type
  26006. }
  26007. }
  26008. /**
  26009. * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol
  26010. */
  26011. #onConnectionEstablished (response, parsedExtensions) {
  26012. // processResponse is called when the "response's header list has been received and initialized."
  26013. // once this happens, the connection is open
  26014. this[kResponse] = response
  26015. const webSocketOptions = this[kController]?.dispatcher?.webSocketOptions
  26016. const maxFragments = webSocketOptions?.maxFragments
  26017. const maxPayloadSize = webSocketOptions?.maxPayloadSize
  26018. const parser = new ByteParser(this, parsedExtensions, {
  26019. maxFragments,
  26020. maxPayloadSize
  26021. })
  26022. parser.on('drain', onParserDrain)
  26023. parser.on('error', onParserError.bind(this))
  26024. response.socket.ws = this
  26025. this[kByteParser] = parser
  26026. this.#sendQueue = new SendQueue(response.socket)
  26027. // 1. Change the ready state to OPEN (1).
  26028. this[kReadyState] = states.OPEN
  26029. // 2. Change the extensions attribute’s value to the extensions in use, if
  26030. // it is not the null value.
  26031. // https://datatracker.ietf.org/doc/html/rfc6455#section-9.1
  26032. const extensions = response.headersList.get('sec-websocket-extensions')
  26033. if (extensions !== null) {
  26034. this.#extensions = extensions
  26035. }
  26036. // 3. Change the protocol attribute’s value to the subprotocol in use, if
  26037. // it is not the null value.
  26038. // https://datatracker.ietf.org/doc/html/rfc6455#section-1.9
  26039. const protocol = response.headersList.get('sec-websocket-protocol')
  26040. if (protocol !== null) {
  26041. this.#protocol = protocol
  26042. }
  26043. // 4. Fire an event named open at the WebSocket object.
  26044. fireEvent('open', this)
  26045. }
  26046. }
  26047. // https://websockets.spec.whatwg.org/#dom-websocket-connecting
  26048. WebSocket.CONNECTING = WebSocket.prototype.CONNECTING = states.CONNECTING
  26049. // https://websockets.spec.whatwg.org/#dom-websocket-open
  26050. WebSocket.OPEN = WebSocket.prototype.OPEN = states.OPEN
  26051. // https://websockets.spec.whatwg.org/#dom-websocket-closing
  26052. WebSocket.CLOSING = WebSocket.prototype.CLOSING = states.CLOSING
  26053. // https://websockets.spec.whatwg.org/#dom-websocket-closed
  26054. WebSocket.CLOSED = WebSocket.prototype.CLOSED = states.CLOSED
  26055. Object.defineProperties(WebSocket.prototype, {
  26056. CONNECTING: staticPropertyDescriptors,
  26057. OPEN: staticPropertyDescriptors,
  26058. CLOSING: staticPropertyDescriptors,
  26059. CLOSED: staticPropertyDescriptors,
  26060. url: kEnumerableProperty,
  26061. readyState: kEnumerableProperty,
  26062. bufferedAmount: kEnumerableProperty,
  26063. onopen: kEnumerableProperty,
  26064. onerror: kEnumerableProperty,
  26065. onclose: kEnumerableProperty,
  26066. close: kEnumerableProperty,
  26067. onmessage: kEnumerableProperty,
  26068. binaryType: kEnumerableProperty,
  26069. send: kEnumerableProperty,
  26070. extensions: kEnumerableProperty,
  26071. protocol: kEnumerableProperty,
  26072. [Symbol.toStringTag]: {
  26073. value: 'WebSocket',
  26074. writable: false,
  26075. enumerable: false,
  26076. configurable: true
  26077. }
  26078. })
  26079. Object.defineProperties(WebSocket, {
  26080. CONNECTING: staticPropertyDescriptors,
  26081. OPEN: staticPropertyDescriptors,
  26082. CLOSING: staticPropertyDescriptors,
  26083. CLOSED: staticPropertyDescriptors
  26084. })
  26085. webidl.converters['sequence<DOMString>'] = webidl.sequenceConverter(
  26086. webidl.converters.DOMString
  26087. )
  26088. webidl.converters['DOMString or sequence<DOMString>'] = function (V, prefix, argument) {
  26089. if (webidl.util.Type(V) === 'Object' && Symbol.iterator in V) {
  26090. return webidl.converters['sequence<DOMString>'](V)
  26091. }
  26092. return webidl.converters.DOMString(V, prefix, argument)
  26093. }
  26094. // This implements the proposal made in https://github.com/whatwg/websockets/issues/42
  26095. webidl.converters.WebSocketInit = webidl.dictionaryConverter([
  26096. {
  26097. key: 'protocols',
  26098. converter: webidl.converters['DOMString or sequence<DOMString>'],
  26099. defaultValue: () => new Array(0)
  26100. },
  26101. {
  26102. key: 'dispatcher',
  26103. converter: webidl.converters.any,
  26104. defaultValue: () => getGlobalDispatcher()
  26105. },
  26106. {
  26107. key: 'headers',
  26108. converter: webidl.nullableConverter(webidl.converters.HeadersInit)
  26109. }
  26110. ])
  26111. webidl.converters['DOMString or sequence<DOMString> or WebSocketInit'] = function (V) {
  26112. if (webidl.util.Type(V) === 'Object' && !(Symbol.iterator in V)) {
  26113. return webidl.converters.WebSocketInit(V)
  26114. }
  26115. return { protocols: webidl.converters['DOMString or sequence<DOMString>'](V) }
  26116. }
  26117. webidl.converters.WebSocketSendData = function (V) {
  26118. if (webidl.util.Type(V) === 'Object') {
  26119. if (isBlobLike(V)) {
  26120. return webidl.converters.Blob(V, { strict: false })
  26121. }
  26122. if (ArrayBuffer.isView(V) || types.isArrayBuffer(V)) {
  26123. return webidl.converters.BufferSource(V)
  26124. }
  26125. }
  26126. return webidl.converters.USVString(V)
  26127. }
  26128. function onParserDrain () {
  26129. this.ws[kResponse].socket.resume()
  26130. }
  26131. function onParserError (err) {
  26132. let message
  26133. let code
  26134. if (err instanceof CloseEvent) {
  26135. message = err.reason
  26136. code = err.code
  26137. } else {
  26138. message = err.message
  26139. }
  26140. fireEvent('error', this, () => new ErrorEvent('error', { error: err, message }))
  26141. closeWebSocketConnection(this, code)
  26142. }
  26143. module.exports = {
  26144. WebSocket
  26145. }
  26146. /***/ }),
  26147. /***/ 2613:
  26148. /***/ ((module) => {
  26149. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("assert");
  26150. /***/ }),
  26151. /***/ 4434:
  26152. /***/ ((module) => {
  26153. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("events");
  26154. /***/ }),
  26155. /***/ 8611:
  26156. /***/ ((module) => {
  26157. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("http");
  26158. /***/ }),
  26159. /***/ 5692:
  26160. /***/ ((module) => {
  26161. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("https");
  26162. /***/ }),
  26163. /***/ 9278:
  26164. /***/ ((module) => {
  26165. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("net");
  26166. /***/ }),
  26167. /***/ 4589:
  26168. /***/ ((module) => {
  26169. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:assert");
  26170. /***/ }),
  26171. /***/ 6698:
  26172. /***/ ((module) => {
  26173. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:async_hooks");
  26174. /***/ }),
  26175. /***/ 4573:
  26176. /***/ ((module) => {
  26177. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:buffer");
  26178. /***/ }),
  26179. /***/ 7540:
  26180. /***/ ((module) => {
  26181. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:console");
  26182. /***/ }),
  26183. /***/ 7598:
  26184. /***/ ((module) => {
  26185. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:crypto");
  26186. /***/ }),
  26187. /***/ 3053:
  26188. /***/ ((module) => {
  26189. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:diagnostics_channel");
  26190. /***/ }),
  26191. /***/ 610:
  26192. /***/ ((module) => {
  26193. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:dns");
  26194. /***/ }),
  26195. /***/ 8474:
  26196. /***/ ((module) => {
  26197. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:events");
  26198. /***/ }),
  26199. /***/ 7067:
  26200. /***/ ((module) => {
  26201. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http");
  26202. /***/ }),
  26203. /***/ 2467:
  26204. /***/ ((module) => {
  26205. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http2");
  26206. /***/ }),
  26207. /***/ 7030:
  26208. /***/ ((module) => {
  26209. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:net");
  26210. /***/ }),
  26211. /***/ 643:
  26212. /***/ ((module) => {
  26213. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:perf_hooks");
  26214. /***/ }),
  26215. /***/ 1792:
  26216. /***/ ((module) => {
  26217. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:querystring");
  26218. /***/ }),
  26219. /***/ 7075:
  26220. /***/ ((module) => {
  26221. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream");
  26222. /***/ }),
  26223. /***/ 1692:
  26224. /***/ ((module) => {
  26225. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:tls");
  26226. /***/ }),
  26227. /***/ 3136:
  26228. /***/ ((module) => {
  26229. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:url");
  26230. /***/ }),
  26231. /***/ 7975:
  26232. /***/ ((module) => {
  26233. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:util");
  26234. /***/ }),
  26235. /***/ 3429:
  26236. /***/ ((module) => {
  26237. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:util/types");
  26238. /***/ }),
  26239. /***/ 5919:
  26240. /***/ ((module) => {
  26241. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:worker_threads");
  26242. /***/ }),
  26243. /***/ 8522:
  26244. /***/ ((module) => {
  26245. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:zlib");
  26246. /***/ }),
  26247. /***/ 3193:
  26248. /***/ ((module) => {
  26249. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("string_decoder");
  26250. /***/ }),
  26251. /***/ 4756:
  26252. /***/ ((module) => {
  26253. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("tls");
  26254. /***/ }),
  26255. /***/ 9023:
  26256. /***/ ((module) => {
  26257. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util");
  26258. /***/ }),
  26259. /***/ 4649:
  26260. /***/ ((__unused_webpack_module, exports) => {
  26261. var __webpack_unused_export__;
  26262. /*!
  26263. * content-type
  26264. * Copyright(c) 2015 Douglas Christopher Wilson
  26265. * MIT Licensed
  26266. */
  26267. __webpack_unused_export__ = ({ value: true });
  26268. __webpack_unused_export__ = format;
  26269. exports.qg = parse;
  26270. const TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
  26271. const TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
  26272. /**
  26273. * RegExp to match chars that must be quoted-pair in RFC 9110 sec 5.6.4
  26274. */
  26275. const QUOTE_REGEXP = /[\\"]/g;
  26276. /**
  26277. * RegExp to match type in RFC 9110 sec 8.3.1
  26278. *
  26279. * media-type = type "/" subtype
  26280. * type = token
  26281. * subtype = token
  26282. */
  26283. const TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
  26284. /**
  26285. * Null object perf optimization. Faster than `Object.create(null)` and `{ __proto__: null }`.
  26286. */
  26287. const NullObject = /* @__PURE__ */ (() => {
  26288. const C = function () { };
  26289. C.prototype = Object.create(null);
  26290. return C;
  26291. })();
  26292. /**
  26293. * Format an object into a `Content-Type` header.
  26294. */
  26295. function format(obj) {
  26296. const { type, parameters } = obj;
  26297. if (!type || !TYPE_REGEXP.test(type)) {
  26298. throw new TypeError(`Invalid type: ${type}`);
  26299. }
  26300. let result = type;
  26301. if (parameters) {
  26302. for (const param of Object.keys(parameters)) {
  26303. if (!TOKEN_REGEXP.test(param)) {
  26304. throw new TypeError(`Invalid parameter name: ${param}`);
  26305. }
  26306. result += `; ${param}=${qstring(parameters[param])}`;
  26307. }
  26308. }
  26309. return result;
  26310. }
  26311. /**
  26312. * Parse a `Content-Type` header.
  26313. */
  26314. function parse(header, options) {
  26315. const len = header.length;
  26316. let index = skipOWS(header, 0, len);
  26317. const valueStart = index;
  26318. index = skipValue(header, index, len);
  26319. const valueEnd = trailingOWS(header, valueStart, index);
  26320. const type = header.slice(valueStart, valueEnd).toLowerCase();
  26321. const parameters = options?.parameters === false
  26322. ? new NullObject()
  26323. : parseParameters(header, index, len);
  26324. return { type, parameters };
  26325. }
  26326. const SP = 32; // " "
  26327. const HTAB = 9; // "\t"
  26328. const SEMI = 59; // ";"
  26329. const EQ = 61; // "="
  26330. const DQUOTE = 34; // '"'
  26331. const BSLASH = 92; // "\\"
  26332. /**
  26333. * Parses the parameters of a `Content-Type` header starting at the given index.
  26334. */
  26335. function parseParameters(header, index, len) {
  26336. const parameters = new NullObject();
  26337. parameter: while (index < len) {
  26338. index = skipOWS(header, index + 1 /* Skip over ; */, len);
  26339. const keyStart = index;
  26340. while (index < len) {
  26341. const code = header.charCodeAt(index);
  26342. if (code === SEMI)
  26343. continue parameter;
  26344. if (code === EQ) {
  26345. const keyEnd = trailingOWS(header, keyStart, index);
  26346. const key = header.slice(keyStart, keyEnd).toLowerCase();
  26347. index = skipOWS(header, index + 1, len);
  26348. if (index < len && header.charCodeAt(index) === DQUOTE) {
  26349. index++;
  26350. let value = "";
  26351. while (index < len) {
  26352. const code = header.charCodeAt(index++);
  26353. if (code === DQUOTE) {
  26354. index = skipValue(header, index, len);
  26355. if (parameters[key] === undefined)
  26356. parameters[key] = value;
  26357. break;
  26358. }
  26359. if (code === BSLASH && index < len) {
  26360. value += header[index++];
  26361. continue;
  26362. }
  26363. value += String.fromCharCode(code);
  26364. }
  26365. continue parameter;
  26366. }
  26367. const valueStart = index;
  26368. index = skipValue(header, index, len);
  26369. if (parameters[key] === undefined) {
  26370. const valueEnd = trailingOWS(header, valueStart, index);
  26371. parameters[key] = header.slice(valueStart, valueEnd);
  26372. }
  26373. continue parameter;
  26374. }
  26375. index++;
  26376. }
  26377. }
  26378. return parameters;
  26379. }
  26380. /**
  26381. * Skip over characters until a semicolon.
  26382. */
  26383. function skipValue(str, index, len) {
  26384. while (index < len) {
  26385. const char = str.charCodeAt(index);
  26386. if (char === SEMI)
  26387. break;
  26388. index++;
  26389. }
  26390. return index;
  26391. }
  26392. /**
  26393. * Skip optional whitespace (OWS) in an HTTP header value.
  26394. *
  26395. * OWS is defined in RFC 9110 sec 5.6.3 as SP (" ") or HTAB ("\t").
  26396. */
  26397. function skipOWS(header, index, len) {
  26398. while (index < len) {
  26399. const char = header.charCodeAt(index);
  26400. if (char !== SP && char !== HTAB)
  26401. break;
  26402. index++;
  26403. }
  26404. return index;
  26405. }
  26406. /**
  26407. * Trim optional whitespace (OWS) from the end of a substring.
  26408. *
  26409. * OWS is defined in RFC 9110 sec 5.6.3 as SP (" ") or HTAB ("\t").
  26410. */
  26411. function trailingOWS(header, start, end) {
  26412. while (end > start) {
  26413. const char = header.charCodeAt(end - 1);
  26414. if (char !== SP && char !== HTAB)
  26415. break;
  26416. end--;
  26417. }
  26418. return end;
  26419. }
  26420. /**
  26421. * Serialize a parameter value.
  26422. */
  26423. function qstring(str) {
  26424. if (TOKEN_REGEXP.test(str))
  26425. return str;
  26426. if (TEXT_REGEXP.test(str))
  26427. return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
  26428. throw new TypeError(`Invalid parameter value: ${str}`);
  26429. }
  26430. //# sourceMappingURL=index.js.map
  26431. /***/ })
  26432. /******/ });
  26433. /************************************************************************/
  26434. /******/ // The module cache
  26435. /******/ var __webpack_module_cache__ = {};
  26436. /******/
  26437. /******/ // The require function
  26438. /******/ function __nccwpck_require__(moduleId) {
  26439. /******/ // Check if module is in cache
  26440. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  26441. /******/ if (cachedModule !== undefined) {
  26442. /******/ return cachedModule.exports;
  26443. /******/ }
  26444. /******/ // Create a new module (and put it into the cache)
  26445. /******/ var module = __webpack_module_cache__[moduleId] = {
  26446. /******/ // no module.id needed
  26447. /******/ // no module.loaded needed
  26448. /******/ exports: {}
  26449. /******/ };
  26450. /******/
  26451. /******/ // Execute the module function
  26452. /******/ var threw = true;
  26453. /******/ try {
  26454. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
  26455. /******/ threw = false;
  26456. /******/ } finally {
  26457. /******/ if(threw) delete __webpack_module_cache__[moduleId];
  26458. /******/ }
  26459. /******/
  26460. /******/ // Return the exports of the module
  26461. /******/ return module.exports;
  26462. /******/ }
  26463. /******/
  26464. /************************************************************************/
  26465. /******/ /* webpack/runtime/compat */
  26466. /******/
  26467. /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/";
  26468. /******/
  26469. /************************************************************************/
  26470. var __webpack_exports__ = {};
  26471. ;// CONCATENATED MODULE: external "os"
  26472. const external_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("os");
  26473. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/utils.js
  26474. // We use any as a valid input type
  26475. /* eslint-disable @typescript-eslint/no-explicit-any */
  26476. /**
  26477. * Sanitizes an input into a string so it can be passed into issueCommand safely
  26478. * @param input input to sanitize into a string
  26479. */
  26480. function utils_toCommandValue(input) {
  26481. if (input === null || input === undefined) {
  26482. return '';
  26483. }
  26484. else if (typeof input === 'string' || input instanceof String) {
  26485. return input;
  26486. }
  26487. return JSON.stringify(input);
  26488. }
  26489. /**
  26490. *
  26491. * @param annotationProperties
  26492. * @returns The command properties to send with the actual annotation command
  26493. * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
  26494. */
  26495. function utils_toCommandProperties(annotationProperties) {
  26496. if (!Object.keys(annotationProperties).length) {
  26497. return {};
  26498. }
  26499. return {
  26500. title: annotationProperties.title,
  26501. file: annotationProperties.file,
  26502. line: annotationProperties.startLine,
  26503. endLine: annotationProperties.endLine,
  26504. col: annotationProperties.startColumn,
  26505. endColumn: annotationProperties.endColumn
  26506. };
  26507. }
  26508. //# sourceMappingURL=utils.js.map
  26509. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/command.js
  26510. /**
  26511. * Issues a command to the GitHub Actions runner
  26512. *
  26513. * @param command - The command name to issue
  26514. * @param properties - Additional properties for the command (key-value pairs)
  26515. * @param message - The message to include with the command
  26516. * @remarks
  26517. * This function outputs a specially formatted string to stdout that the Actions
  26518. * runner interprets as a command. These commands can control workflow behavior,
  26519. * set outputs, create annotations, mask values, and more.
  26520. *
  26521. * Command Format:
  26522. * ::name key=value,key=value::message
  26523. *
  26524. * @example
  26525. * ```typescript
  26526. * // Issue a warning annotation
  26527. * issueCommand('warning', {}, 'This is a warning message');
  26528. * // Output: ::warning::This is a warning message
  26529. *
  26530. * // Set an environment variable
  26531. * issueCommand('set-env', { name: 'MY_VAR' }, 'some value');
  26532. * // Output: ::set-env name=MY_VAR::some value
  26533. *
  26534. * // Add a secret mask
  26535. * issueCommand('add-mask', {}, 'secretValue123');
  26536. * // Output: ::add-mask::secretValue123
  26537. * ```
  26538. *
  26539. * @internal
  26540. * This is an internal utility function that powers the public API functions
  26541. * such as setSecret, warning, error, and exportVariable.
  26542. */
  26543. function command_issueCommand(command, properties, message) {
  26544. const cmd = new Command(command, properties, message);
  26545. process.stdout.write(cmd.toString() + external_os_namespaceObject.EOL);
  26546. }
  26547. function command_issue(name, message = '') {
  26548. command_issueCommand(name, {}, message);
  26549. }
  26550. const CMD_STRING = '::';
  26551. class Command {
  26552. constructor(command, properties, message) {
  26553. if (!command) {
  26554. command = 'missing.command';
  26555. }
  26556. this.command = command;
  26557. this.properties = properties;
  26558. this.message = message;
  26559. }
  26560. toString() {
  26561. let cmdStr = CMD_STRING + this.command;
  26562. if (this.properties && Object.keys(this.properties).length > 0) {
  26563. cmdStr += ' ';
  26564. let first = true;
  26565. for (const key in this.properties) {
  26566. if (this.properties.hasOwnProperty(key)) {
  26567. const val = this.properties[key];
  26568. if (val) {
  26569. if (first) {
  26570. first = false;
  26571. }
  26572. else {
  26573. cmdStr += ',';
  26574. }
  26575. cmdStr += `${key}=${escapeProperty(val)}`;
  26576. }
  26577. }
  26578. }
  26579. }
  26580. cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
  26581. return cmdStr;
  26582. }
  26583. }
  26584. function escapeData(s) {
  26585. return utils_toCommandValue(s)
  26586. .replace(/%/g, '%25')
  26587. .replace(/\r/g, '%0D')
  26588. .replace(/\n/g, '%0A');
  26589. }
  26590. function escapeProperty(s) {
  26591. return utils_toCommandValue(s)
  26592. .replace(/%/g, '%25')
  26593. .replace(/\r/g, '%0D')
  26594. .replace(/\n/g, '%0A')
  26595. .replace(/:/g, '%3A')
  26596. .replace(/,/g, '%2C');
  26597. }
  26598. //# sourceMappingURL=command.js.map
  26599. ;// CONCATENATED MODULE: external "crypto"
  26600. const external_crypto_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("crypto");
  26601. ;// CONCATENATED MODULE: external "fs"
  26602. const external_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs");
  26603. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/file-command.js
  26604. // For internal use, subject to change.
  26605. // We use any as a valid input type
  26606. /* eslint-disable @typescript-eslint/no-explicit-any */
  26607. function file_command_issueFileCommand(command, message) {
  26608. const filePath = process.env[`GITHUB_${command}`];
  26609. if (!filePath) {
  26610. throw new Error(`Unable to find environment variable for file command ${command}`);
  26611. }
  26612. if (!external_fs_namespaceObject.existsSync(filePath)) {
  26613. throw new Error(`Missing file at path: ${filePath}`);
  26614. }
  26615. external_fs_namespaceObject.appendFileSync(filePath, `${utils_toCommandValue(message)}${external_os_namespaceObject.EOL}`, {
  26616. encoding: 'utf8'
  26617. });
  26618. }
  26619. function file_command_prepareKeyValueMessage(key, value) {
  26620. const delimiter = `ghadelimiter_${external_crypto_namespaceObject.randomUUID()}`;
  26621. const convertedValue = utils_toCommandValue(value);
  26622. // These should realistically never happen, but just in case someone finds a
  26623. // way to exploit uuid generation let's not allow keys or values that contain
  26624. // the delimiter.
  26625. if (key.includes(delimiter)) {
  26626. throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
  26627. }
  26628. if (convertedValue.includes(delimiter)) {
  26629. throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
  26630. }
  26631. return `${key}<<${delimiter}${external_os_namespaceObject.EOL}${convertedValue}${external_os_namespaceObject.EOL}${delimiter}`;
  26632. }
  26633. //# sourceMappingURL=file-command.js.map
  26634. ;// CONCATENATED MODULE: external "path"
  26635. const external_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("path");
  26636. // EXTERNAL MODULE: external "http"
  26637. var external_http_ = __nccwpck_require__(8611);
  26638. // EXTERNAL MODULE: external "https"
  26639. var external_https_ = __nccwpck_require__(5692);
  26640. ;// CONCATENATED MODULE: ./node_modules/@actions/http-client/lib/proxy.js
  26641. function getProxyUrl(reqUrl) {
  26642. const usingSsl = reqUrl.protocol === 'https:';
  26643. if (checkBypass(reqUrl)) {
  26644. return undefined;
  26645. }
  26646. const proxyVar = (() => {
  26647. if (usingSsl) {
  26648. return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
  26649. }
  26650. else {
  26651. return process.env['http_proxy'] || process.env['HTTP_PROXY'];
  26652. }
  26653. })();
  26654. if (proxyVar) {
  26655. try {
  26656. return new DecodedURL(proxyVar);
  26657. }
  26658. catch (_a) {
  26659. if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
  26660. return new DecodedURL(`http://${proxyVar}`);
  26661. }
  26662. }
  26663. else {
  26664. return undefined;
  26665. }
  26666. }
  26667. function checkBypass(reqUrl) {
  26668. if (!reqUrl.hostname) {
  26669. return false;
  26670. }
  26671. const reqHost = reqUrl.hostname;
  26672. if (isLoopbackAddress(reqHost)) {
  26673. return true;
  26674. }
  26675. const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
  26676. if (!noProxy) {
  26677. return false;
  26678. }
  26679. // Determine the request port
  26680. let reqPort;
  26681. if (reqUrl.port) {
  26682. reqPort = Number(reqUrl.port);
  26683. }
  26684. else if (reqUrl.protocol === 'http:') {
  26685. reqPort = 80;
  26686. }
  26687. else if (reqUrl.protocol === 'https:') {
  26688. reqPort = 443;
  26689. }
  26690. // Format the request hostname and hostname with port
  26691. const upperReqHosts = [reqUrl.hostname.toUpperCase()];
  26692. if (typeof reqPort === 'number') {
  26693. upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
  26694. }
  26695. // Compare request host against noproxy
  26696. for (const upperNoProxyItem of noProxy
  26697. .split(',')
  26698. .map(x => x.trim().toUpperCase())
  26699. .filter(x => x)) {
  26700. if (upperNoProxyItem === '*' ||
  26701. upperReqHosts.some(x => x === upperNoProxyItem ||
  26702. x.endsWith(`.${upperNoProxyItem}`) ||
  26703. (upperNoProxyItem.startsWith('.') &&
  26704. x.endsWith(`${upperNoProxyItem}`)))) {
  26705. return true;
  26706. }
  26707. }
  26708. return false;
  26709. }
  26710. function isLoopbackAddress(host) {
  26711. const hostLower = host.toLowerCase();
  26712. return (hostLower === 'localhost' ||
  26713. hostLower.startsWith('127.') ||
  26714. hostLower.startsWith('[::1]') ||
  26715. hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
  26716. }
  26717. class DecodedURL extends URL {
  26718. constructor(url, base) {
  26719. super(url, base);
  26720. this._decodedUsername = decodeURIComponent(super.username);
  26721. this._decodedPassword = decodeURIComponent(super.password);
  26722. }
  26723. get username() {
  26724. return this._decodedUsername;
  26725. }
  26726. get password() {
  26727. return this._decodedPassword;
  26728. }
  26729. }
  26730. //# sourceMappingURL=proxy.js.map
  26731. // EXTERNAL MODULE: ./node_modules/tunnel/index.js
  26732. var node_modules_tunnel = __nccwpck_require__(770);
  26733. // EXTERNAL MODULE: ./node_modules/undici/index.js
  26734. var undici = __nccwpck_require__(6752);
  26735. ;// CONCATENATED MODULE: ./node_modules/@actions/http-client/lib/index.js
  26736. /* eslint-disable @typescript-eslint/no-explicit-any */
  26737. var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  26738. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  26739. return new (P || (P = Promise))(function (resolve, reject) {
  26740. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  26741. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  26742. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  26743. step((generator = generator.apply(thisArg, _arguments || [])).next());
  26744. });
  26745. };
  26746. var HttpCodes;
  26747. (function (HttpCodes) {
  26748. HttpCodes[HttpCodes["OK"] = 200] = "OK";
  26749. HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
  26750. HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
  26751. HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
  26752. HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
  26753. HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
  26754. HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
  26755. HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
  26756. HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
  26757. HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
  26758. HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
  26759. HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
  26760. HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
  26761. HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
  26762. HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
  26763. HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
  26764. HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
  26765. HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
  26766. HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
  26767. HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
  26768. HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
  26769. HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
  26770. HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
  26771. HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
  26772. HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
  26773. HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
  26774. HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
  26775. })(HttpCodes || (HttpCodes = {}));
  26776. var Headers;
  26777. (function (Headers) {
  26778. Headers["Accept"] = "accept";
  26779. Headers["ContentType"] = "content-type";
  26780. })(Headers || (Headers = {}));
  26781. var MediaTypes;
  26782. (function (MediaTypes) {
  26783. MediaTypes["ApplicationJson"] = "application/json";
  26784. })(MediaTypes || (MediaTypes = {}));
  26785. /**
  26786. * Returns the proxy URL, depending upon the supplied url and proxy environment variables.
  26787. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
  26788. */
  26789. function lib_getProxyUrl(serverUrl) {
  26790. const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
  26791. return proxyUrl ? proxyUrl.href : '';
  26792. }
  26793. const HttpRedirectCodes = [
  26794. HttpCodes.MovedPermanently,
  26795. HttpCodes.ResourceMoved,
  26796. HttpCodes.SeeOther,
  26797. HttpCodes.TemporaryRedirect,
  26798. HttpCodes.PermanentRedirect
  26799. ];
  26800. const HttpResponseRetryCodes = [
  26801. HttpCodes.BadGateway,
  26802. HttpCodes.ServiceUnavailable,
  26803. HttpCodes.GatewayTimeout
  26804. ];
  26805. const RetryableHttpVerbs = (/* unused pure expression or super */ null && (['OPTIONS', 'GET', 'DELETE', 'HEAD']));
  26806. const ExponentialBackoffCeiling = 10;
  26807. const ExponentialBackoffTimeSlice = 5;
  26808. class HttpClientError extends Error {
  26809. constructor(message, statusCode) {
  26810. super(message);
  26811. this.name = 'HttpClientError';
  26812. this.statusCode = statusCode;
  26813. Object.setPrototypeOf(this, HttpClientError.prototype);
  26814. }
  26815. }
  26816. class HttpClientResponse {
  26817. constructor(message) {
  26818. this.message = message;
  26819. }
  26820. readBody() {
  26821. return __awaiter(this, void 0, void 0, function* () {
  26822. return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
  26823. let output = Buffer.alloc(0);
  26824. this.message.on('data', (chunk) => {
  26825. output = Buffer.concat([output, chunk]);
  26826. });
  26827. this.message.on('end', () => {
  26828. resolve(output.toString());
  26829. });
  26830. }));
  26831. });
  26832. }
  26833. readBodyBuffer() {
  26834. return __awaiter(this, void 0, void 0, function* () {
  26835. return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
  26836. const chunks = [];
  26837. this.message.on('data', (chunk) => {
  26838. chunks.push(chunk);
  26839. });
  26840. this.message.on('end', () => {
  26841. resolve(Buffer.concat(chunks));
  26842. });
  26843. }));
  26844. });
  26845. }
  26846. }
  26847. function isHttps(requestUrl) {
  26848. const parsedUrl = new URL(requestUrl);
  26849. return parsedUrl.protocol === 'https:';
  26850. }
  26851. class lib_HttpClient {
  26852. constructor(userAgent, handlers, requestOptions) {
  26853. this._ignoreSslError = false;
  26854. this._allowRedirects = true;
  26855. this._allowRedirectDowngrade = false;
  26856. this._maxRedirects = 50;
  26857. this._allowRetries = false;
  26858. this._maxRetries = 1;
  26859. this._keepAlive = false;
  26860. this._disposed = false;
  26861. this.userAgent = this._getUserAgentWithOrchestrationId(userAgent);
  26862. this.handlers = handlers || [];
  26863. this.requestOptions = requestOptions;
  26864. if (requestOptions) {
  26865. if (requestOptions.ignoreSslError != null) {
  26866. this._ignoreSslError = requestOptions.ignoreSslError;
  26867. }
  26868. this._socketTimeout = requestOptions.socketTimeout;
  26869. if (requestOptions.allowRedirects != null) {
  26870. this._allowRedirects = requestOptions.allowRedirects;
  26871. }
  26872. if (requestOptions.allowRedirectDowngrade != null) {
  26873. this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
  26874. }
  26875. if (requestOptions.maxRedirects != null) {
  26876. this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
  26877. }
  26878. if (requestOptions.keepAlive != null) {
  26879. this._keepAlive = requestOptions.keepAlive;
  26880. }
  26881. if (requestOptions.allowRetries != null) {
  26882. this._allowRetries = requestOptions.allowRetries;
  26883. }
  26884. if (requestOptions.maxRetries != null) {
  26885. this._maxRetries = requestOptions.maxRetries;
  26886. }
  26887. }
  26888. }
  26889. options(requestUrl, additionalHeaders) {
  26890. return __awaiter(this, void 0, void 0, function* () {
  26891. return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
  26892. });
  26893. }
  26894. get(requestUrl, additionalHeaders) {
  26895. return __awaiter(this, void 0, void 0, function* () {
  26896. return this.request('GET', requestUrl, null, additionalHeaders || {});
  26897. });
  26898. }
  26899. del(requestUrl, additionalHeaders) {
  26900. return __awaiter(this, void 0, void 0, function* () {
  26901. return this.request('DELETE', requestUrl, null, additionalHeaders || {});
  26902. });
  26903. }
  26904. post(requestUrl, data, additionalHeaders) {
  26905. return __awaiter(this, void 0, void 0, function* () {
  26906. return this.request('POST', requestUrl, data, additionalHeaders || {});
  26907. });
  26908. }
  26909. patch(requestUrl, data, additionalHeaders) {
  26910. return __awaiter(this, void 0, void 0, function* () {
  26911. return this.request('PATCH', requestUrl, data, additionalHeaders || {});
  26912. });
  26913. }
  26914. put(requestUrl, data, additionalHeaders) {
  26915. return __awaiter(this, void 0, void 0, function* () {
  26916. return this.request('PUT', requestUrl, data, additionalHeaders || {});
  26917. });
  26918. }
  26919. head(requestUrl, additionalHeaders) {
  26920. return __awaiter(this, void 0, void 0, function* () {
  26921. return this.request('HEAD', requestUrl, null, additionalHeaders || {});
  26922. });
  26923. }
  26924. sendStream(verb, requestUrl, stream, additionalHeaders) {
  26925. return __awaiter(this, void 0, void 0, function* () {
  26926. return this.request(verb, requestUrl, stream, additionalHeaders);
  26927. });
  26928. }
  26929. /**
  26930. * Gets a typed object from an endpoint
  26931. * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
  26932. */
  26933. getJson(requestUrl_1) {
  26934. return __awaiter(this, arguments, void 0, function* (requestUrl, additionalHeaders = {}) {
  26935. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  26936. const res = yield this.get(requestUrl, additionalHeaders);
  26937. return this._processResponse(res, this.requestOptions);
  26938. });
  26939. }
  26940. postJson(requestUrl_1, obj_1) {
  26941. return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
  26942. const data = JSON.stringify(obj, null, 2);
  26943. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  26944. additionalHeaders[Headers.ContentType] =
  26945. this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
  26946. const res = yield this.post(requestUrl, data, additionalHeaders);
  26947. return this._processResponse(res, this.requestOptions);
  26948. });
  26949. }
  26950. putJson(requestUrl_1, obj_1) {
  26951. return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
  26952. const data = JSON.stringify(obj, null, 2);
  26953. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  26954. additionalHeaders[Headers.ContentType] =
  26955. this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
  26956. const res = yield this.put(requestUrl, data, additionalHeaders);
  26957. return this._processResponse(res, this.requestOptions);
  26958. });
  26959. }
  26960. patchJson(requestUrl_1, obj_1) {
  26961. return __awaiter(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) {
  26962. const data = JSON.stringify(obj, null, 2);
  26963. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  26964. additionalHeaders[Headers.ContentType] =
  26965. this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson);
  26966. const res = yield this.patch(requestUrl, data, additionalHeaders);
  26967. return this._processResponse(res, this.requestOptions);
  26968. });
  26969. }
  26970. /**
  26971. * Makes a raw http request.
  26972. * All other methods such as get, post, patch, and request ultimately call this.
  26973. * Prefer get, del, post and patch
  26974. */
  26975. request(verb, requestUrl, data, headers) {
  26976. return __awaiter(this, void 0, void 0, function* () {
  26977. if (this._disposed) {
  26978. throw new Error('Client has already been disposed.');
  26979. }
  26980. const parsedUrl = new URL(requestUrl);
  26981. let info = this._prepareRequest(verb, parsedUrl, headers);
  26982. // Only perform retries on reads since writes may not be idempotent.
  26983. const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
  26984. ? this._maxRetries + 1
  26985. : 1;
  26986. let numTries = 0;
  26987. let response;
  26988. do {
  26989. response = yield this.requestRaw(info, data);
  26990. // Check if it's an authentication challenge
  26991. if (response &&
  26992. response.message &&
  26993. response.message.statusCode === HttpCodes.Unauthorized) {
  26994. let authenticationHandler;
  26995. for (const handler of this.handlers) {
  26996. if (handler.canHandleAuthentication(response)) {
  26997. authenticationHandler = handler;
  26998. break;
  26999. }
  27000. }
  27001. if (authenticationHandler) {
  27002. return authenticationHandler.handleAuthentication(this, info, data);
  27003. }
  27004. else {
  27005. // We have received an unauthorized response but have no handlers to handle it.
  27006. // Let the response return to the caller.
  27007. return response;
  27008. }
  27009. }
  27010. let redirectsRemaining = this._maxRedirects;
  27011. while (response.message.statusCode &&
  27012. HttpRedirectCodes.includes(response.message.statusCode) &&
  27013. this._allowRedirects &&
  27014. redirectsRemaining > 0) {
  27015. const redirectUrl = response.message.headers['location'];
  27016. if (!redirectUrl) {
  27017. // if there's no location to redirect to, we won't
  27018. break;
  27019. }
  27020. const parsedRedirectUrl = new URL(redirectUrl);
  27021. if (parsedUrl.protocol === 'https:' &&
  27022. parsedUrl.protocol !== parsedRedirectUrl.protocol &&
  27023. !this._allowRedirectDowngrade) {
  27024. 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.');
  27025. }
  27026. // we need to finish reading the response before reassigning response
  27027. // which will leak the open socket.
  27028. yield response.readBody();
  27029. // strip authorization header if redirected to a different hostname
  27030. if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
  27031. for (const header in headers) {
  27032. // header names are case insensitive
  27033. if (header.toLowerCase() === 'authorization') {
  27034. delete headers[header];
  27035. }
  27036. }
  27037. }
  27038. // let's make the request with the new redirectUrl
  27039. info = this._prepareRequest(verb, parsedRedirectUrl, headers);
  27040. response = yield this.requestRaw(info, data);
  27041. redirectsRemaining--;
  27042. }
  27043. if (!response.message.statusCode ||
  27044. !HttpResponseRetryCodes.includes(response.message.statusCode)) {
  27045. // If not a retry code, return immediately instead of retrying
  27046. return response;
  27047. }
  27048. numTries += 1;
  27049. if (numTries < maxTries) {
  27050. yield response.readBody();
  27051. yield this._performExponentialBackoff(numTries);
  27052. }
  27053. } while (numTries < maxTries);
  27054. return response;
  27055. });
  27056. }
  27057. /**
  27058. * Needs to be called if keepAlive is set to true in request options.
  27059. */
  27060. dispose() {
  27061. if (this._agent) {
  27062. this._agent.destroy();
  27063. }
  27064. this._disposed = true;
  27065. }
  27066. /**
  27067. * Raw request.
  27068. * @param info
  27069. * @param data
  27070. */
  27071. requestRaw(info, data) {
  27072. return __awaiter(this, void 0, void 0, function* () {
  27073. return new Promise((resolve, reject) => {
  27074. function callbackForResult(err, res) {
  27075. if (err) {
  27076. reject(err);
  27077. }
  27078. else if (!res) {
  27079. // If `err` is not passed, then `res` must be passed.
  27080. reject(new Error('Unknown error'));
  27081. }
  27082. else {
  27083. resolve(res);
  27084. }
  27085. }
  27086. this.requestRawWithCallback(info, data, callbackForResult);
  27087. });
  27088. });
  27089. }
  27090. /**
  27091. * Raw request with callback.
  27092. * @param info
  27093. * @param data
  27094. * @param onResult
  27095. */
  27096. requestRawWithCallback(info, data, onResult) {
  27097. if (typeof data === 'string') {
  27098. if (!info.options.headers) {
  27099. info.options.headers = {};
  27100. }
  27101. info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
  27102. }
  27103. let callbackCalled = false;
  27104. function handleResult(err, res) {
  27105. if (!callbackCalled) {
  27106. callbackCalled = true;
  27107. onResult(err, res);
  27108. }
  27109. }
  27110. const req = info.httpModule.request(info.options, (msg) => {
  27111. const res = new HttpClientResponse(msg);
  27112. handleResult(undefined, res);
  27113. });
  27114. let socket;
  27115. req.on('socket', sock => {
  27116. socket = sock;
  27117. });
  27118. // If we ever get disconnected, we want the socket to timeout eventually
  27119. req.setTimeout(this._socketTimeout || 3 * 60000, () => {
  27120. if (socket) {
  27121. socket.end();
  27122. }
  27123. handleResult(new Error(`Request timeout: ${info.options.path}`));
  27124. });
  27125. req.on('error', function (err) {
  27126. // err has statusCode property
  27127. // res should have headers
  27128. handleResult(err);
  27129. });
  27130. if (data && typeof data === 'string') {
  27131. req.write(data, 'utf8');
  27132. }
  27133. if (data && typeof data !== 'string') {
  27134. data.on('close', function () {
  27135. req.end();
  27136. });
  27137. data.pipe(req);
  27138. }
  27139. else {
  27140. req.end();
  27141. }
  27142. }
  27143. /**
  27144. * Gets an http agent. This function is useful when you need an http agent that handles
  27145. * routing through a proxy server - depending upon the url and proxy environment variables.
  27146. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
  27147. */
  27148. getAgent(serverUrl) {
  27149. const parsedUrl = new URL(serverUrl);
  27150. return this._getAgent(parsedUrl);
  27151. }
  27152. getAgentDispatcher(serverUrl) {
  27153. const parsedUrl = new URL(serverUrl);
  27154. const proxyUrl = pm.getProxyUrl(parsedUrl);
  27155. const useProxy = proxyUrl && proxyUrl.hostname;
  27156. if (!useProxy) {
  27157. return;
  27158. }
  27159. return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
  27160. }
  27161. _prepareRequest(method, requestUrl, headers) {
  27162. const info = {};
  27163. info.parsedUrl = requestUrl;
  27164. const usingSsl = info.parsedUrl.protocol === 'https:';
  27165. info.httpModule = usingSsl ? https : http;
  27166. const defaultPort = usingSsl ? 443 : 80;
  27167. info.options = {};
  27168. info.options.host = info.parsedUrl.hostname;
  27169. info.options.port = info.parsedUrl.port
  27170. ? parseInt(info.parsedUrl.port)
  27171. : defaultPort;
  27172. info.options.path =
  27173. (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
  27174. info.options.method = method;
  27175. info.options.headers = this._mergeHeaders(headers);
  27176. if (this.userAgent != null) {
  27177. info.options.headers['user-agent'] = this.userAgent;
  27178. }
  27179. info.options.agent = this._getAgent(info.parsedUrl);
  27180. // gives handlers an opportunity to participate
  27181. if (this.handlers) {
  27182. for (const handler of this.handlers) {
  27183. handler.prepareRequest(info.options);
  27184. }
  27185. }
  27186. return info;
  27187. }
  27188. _mergeHeaders(headers) {
  27189. if (this.requestOptions && this.requestOptions.headers) {
  27190. return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
  27191. }
  27192. return lowercaseKeys(headers || {});
  27193. }
  27194. /**
  27195. * Gets an existing header value or returns a default.
  27196. * Handles converting number header values to strings since HTTP headers must be strings.
  27197. * Note: This returns string | string[] since some headers can have multiple values.
  27198. * For headers that must always be a single string (like Content-Type), use the
  27199. * specialized _getExistingOrDefaultContentTypeHeader method instead.
  27200. */
  27201. _getExistingOrDefaultHeader(additionalHeaders, header, _default) {
  27202. let clientHeader;
  27203. if (this.requestOptions && this.requestOptions.headers) {
  27204. const headerValue = lowercaseKeys(this.requestOptions.headers)[header];
  27205. if (headerValue) {
  27206. clientHeader =
  27207. typeof headerValue === 'number' ? headerValue.toString() : headerValue;
  27208. }
  27209. }
  27210. const additionalValue = additionalHeaders[header];
  27211. if (additionalValue !== undefined) {
  27212. return typeof additionalValue === 'number'
  27213. ? additionalValue.toString()
  27214. : additionalValue;
  27215. }
  27216. if (clientHeader !== undefined) {
  27217. return clientHeader;
  27218. }
  27219. return _default;
  27220. }
  27221. /**
  27222. * Specialized version of _getExistingOrDefaultHeader for Content-Type header.
  27223. * Always returns a single string (not an array) since Content-Type should be a single value.
  27224. * Converts arrays to comma-separated strings and numbers to strings to ensure type safety.
  27225. * This was split from _getExistingOrDefaultHeader to provide stricter typing for callers
  27226. * that assign the result to places expecting a string (e.g., additionalHeaders[Headers.ContentType]).
  27227. */
  27228. _getExistingOrDefaultContentTypeHeader(additionalHeaders, _default) {
  27229. let clientHeader;
  27230. if (this.requestOptions && this.requestOptions.headers) {
  27231. const headerValue = lowercaseKeys(this.requestOptions.headers)[Headers.ContentType];
  27232. if (headerValue) {
  27233. if (typeof headerValue === 'number') {
  27234. clientHeader = String(headerValue);
  27235. }
  27236. else if (Array.isArray(headerValue)) {
  27237. clientHeader = headerValue.join(', ');
  27238. }
  27239. else {
  27240. clientHeader = headerValue;
  27241. }
  27242. }
  27243. }
  27244. const additionalValue = additionalHeaders[Headers.ContentType];
  27245. // Return the first non-undefined value, converting numbers or arrays to strings if necessary
  27246. if (additionalValue !== undefined) {
  27247. if (typeof additionalValue === 'number') {
  27248. return String(additionalValue);
  27249. }
  27250. else if (Array.isArray(additionalValue)) {
  27251. return additionalValue.join(', ');
  27252. }
  27253. else {
  27254. return additionalValue;
  27255. }
  27256. }
  27257. if (clientHeader !== undefined) {
  27258. return clientHeader;
  27259. }
  27260. return _default;
  27261. }
  27262. _getAgent(parsedUrl) {
  27263. let agent;
  27264. const proxyUrl = pm.getProxyUrl(parsedUrl);
  27265. const useProxy = proxyUrl && proxyUrl.hostname;
  27266. if (this._keepAlive && useProxy) {
  27267. agent = this._proxyAgent;
  27268. }
  27269. if (!useProxy) {
  27270. agent = this._agent;
  27271. }
  27272. // if agent is already assigned use that agent.
  27273. if (agent) {
  27274. return agent;
  27275. }
  27276. const usingSsl = parsedUrl.protocol === 'https:';
  27277. let maxSockets = 100;
  27278. if (this.requestOptions) {
  27279. maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
  27280. }
  27281. // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
  27282. if (proxyUrl && proxyUrl.hostname) {
  27283. const agentOptions = {
  27284. maxSockets,
  27285. keepAlive: this._keepAlive,
  27286. proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
  27287. proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
  27288. })), { host: proxyUrl.hostname, port: proxyUrl.port })
  27289. };
  27290. let tunnelAgent;
  27291. const overHttps = proxyUrl.protocol === 'https:';
  27292. if (usingSsl) {
  27293. tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
  27294. }
  27295. else {
  27296. tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
  27297. }
  27298. agent = tunnelAgent(agentOptions);
  27299. this._proxyAgent = agent;
  27300. }
  27301. // if tunneling agent isn't assigned create a new agent
  27302. if (!agent) {
  27303. const options = { keepAlive: this._keepAlive, maxSockets };
  27304. agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
  27305. this._agent = agent;
  27306. }
  27307. if (usingSsl && this._ignoreSslError) {
  27308. // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
  27309. // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
  27310. // we have to cast it to any and change it directly
  27311. agent.options = Object.assign(agent.options || {}, {
  27312. rejectUnauthorized: false
  27313. });
  27314. }
  27315. return agent;
  27316. }
  27317. _getProxyAgentDispatcher(parsedUrl, proxyUrl) {
  27318. let proxyAgent;
  27319. if (this._keepAlive) {
  27320. proxyAgent = this._proxyAgentDispatcher;
  27321. }
  27322. // if agent is already assigned use that agent.
  27323. if (proxyAgent) {
  27324. return proxyAgent;
  27325. }
  27326. const usingSsl = parsedUrl.protocol === 'https:';
  27327. proxyAgent = new ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
  27328. token: `Basic ${Buffer.from(`${proxyUrl.username}:${proxyUrl.password}`).toString('base64')}`
  27329. })));
  27330. this._proxyAgentDispatcher = proxyAgent;
  27331. if (usingSsl && this._ignoreSslError) {
  27332. // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
  27333. // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
  27334. // we have to cast it to any and change it directly
  27335. proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, {
  27336. rejectUnauthorized: false
  27337. });
  27338. }
  27339. return proxyAgent;
  27340. }
  27341. _getUserAgentWithOrchestrationId(userAgent) {
  27342. const baseUserAgent = userAgent || 'actions/http-client';
  27343. const orchId = process.env['ACTIONS_ORCHESTRATION_ID'];
  27344. if (orchId) {
  27345. // Sanitize the orchestration ID to ensure it contains only valid characters
  27346. // Valid characters: 0-9, a-z, _, -, .
  27347. const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
  27348. return `${baseUserAgent} actions_orchestration_id/${sanitizedId}`;
  27349. }
  27350. return baseUserAgent;
  27351. }
  27352. _performExponentialBackoff(retryNumber) {
  27353. return __awaiter(this, void 0, void 0, function* () {
  27354. retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
  27355. const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
  27356. return new Promise(resolve => setTimeout(() => resolve(), ms));
  27357. });
  27358. }
  27359. _processResponse(res, options) {
  27360. return __awaiter(this, void 0, void 0, function* () {
  27361. return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
  27362. const statusCode = res.message.statusCode || 0;
  27363. const response = {
  27364. statusCode,
  27365. result: null,
  27366. headers: {}
  27367. };
  27368. // not found leads to null obj returned
  27369. if (statusCode === HttpCodes.NotFound) {
  27370. resolve(response);
  27371. }
  27372. // get the result from the body
  27373. function dateTimeDeserializer(key, value) {
  27374. if (typeof value === 'string') {
  27375. const a = new Date(value);
  27376. if (!isNaN(a.valueOf())) {
  27377. return a;
  27378. }
  27379. }
  27380. return value;
  27381. }
  27382. let obj;
  27383. let contents;
  27384. try {
  27385. contents = yield res.readBody();
  27386. if (contents && contents.length > 0) {
  27387. if (options && options.deserializeDates) {
  27388. obj = JSON.parse(contents, dateTimeDeserializer);
  27389. }
  27390. else {
  27391. obj = JSON.parse(contents);
  27392. }
  27393. response.result = obj;
  27394. }
  27395. response.headers = res.message.headers;
  27396. }
  27397. catch (err) {
  27398. // Invalid resource (contents not json); leaving result obj null
  27399. }
  27400. // note that 3xx redirects are handled by the http layer.
  27401. if (statusCode > 299) {
  27402. let msg;
  27403. // if exception/error in body, attempt to get better error
  27404. if (obj && obj.message) {
  27405. msg = obj.message;
  27406. }
  27407. else if (contents && contents.length > 0) {
  27408. // it may be the case that the exception is in the body message as string
  27409. msg = contents;
  27410. }
  27411. else {
  27412. msg = `Failed request: (${statusCode})`;
  27413. }
  27414. const err = new HttpClientError(msg, statusCode);
  27415. err.result = response.result;
  27416. reject(err);
  27417. }
  27418. else {
  27419. resolve(response);
  27420. }
  27421. }));
  27422. });
  27423. }
  27424. }
  27425. const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
  27426. //# sourceMappingURL=index.js.map
  27427. ;// CONCATENATED MODULE: ./node_modules/@actions/http-client/lib/auth.js
  27428. var auth_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  27429. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  27430. return new (P || (P = Promise))(function (resolve, reject) {
  27431. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  27432. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  27433. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  27434. step((generator = generator.apply(thisArg, _arguments || [])).next());
  27435. });
  27436. };
  27437. class BasicCredentialHandler {
  27438. constructor(username, password) {
  27439. this.username = username;
  27440. this.password = password;
  27441. }
  27442. prepareRequest(options) {
  27443. if (!options.headers) {
  27444. throw Error('The request has no headers');
  27445. }
  27446. options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;
  27447. }
  27448. // This handler cannot handle 401
  27449. canHandleAuthentication() {
  27450. return false;
  27451. }
  27452. handleAuthentication() {
  27453. return auth_awaiter(this, void 0, void 0, function* () {
  27454. throw new Error('not implemented');
  27455. });
  27456. }
  27457. }
  27458. class auth_BearerCredentialHandler {
  27459. constructor(token) {
  27460. this.token = token;
  27461. }
  27462. // currently implements pre-authorization
  27463. // TODO: support preAuth = false where it hooks on 401
  27464. prepareRequest(options) {
  27465. if (!options.headers) {
  27466. throw Error('The request has no headers');
  27467. }
  27468. options.headers['Authorization'] = `Bearer ${this.token}`;
  27469. }
  27470. // This handler cannot handle 401
  27471. canHandleAuthentication() {
  27472. return false;
  27473. }
  27474. handleAuthentication() {
  27475. return auth_awaiter(this, void 0, void 0, function* () {
  27476. throw new Error('not implemented');
  27477. });
  27478. }
  27479. }
  27480. class PersonalAccessTokenCredentialHandler {
  27481. constructor(token) {
  27482. this.token = token;
  27483. }
  27484. // currently implements pre-authorization
  27485. // TODO: support preAuth = false where it hooks on 401
  27486. prepareRequest(options) {
  27487. if (!options.headers) {
  27488. throw Error('The request has no headers');
  27489. }
  27490. options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;
  27491. }
  27492. // This handler cannot handle 401
  27493. canHandleAuthentication() {
  27494. return false;
  27495. }
  27496. handleAuthentication() {
  27497. return auth_awaiter(this, void 0, void 0, function* () {
  27498. throw new Error('not implemented');
  27499. });
  27500. }
  27501. }
  27502. //# sourceMappingURL=auth.js.map
  27503. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/oidc-utils.js
  27504. var oidc_utils_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  27505. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  27506. return new (P || (P = Promise))(function (resolve, reject) {
  27507. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  27508. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  27509. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  27510. step((generator = generator.apply(thisArg, _arguments || [])).next());
  27511. });
  27512. };
  27513. class oidc_utils_OidcClient {
  27514. static createHttpClient(allowRetry = true, maxRetry = 10) {
  27515. const requestOptions = {
  27516. allowRetries: allowRetry,
  27517. maxRetries: maxRetry
  27518. };
  27519. return new HttpClient('actions/oidc-client', [new BearerCredentialHandler(oidc_utils_OidcClient.getRequestToken())], requestOptions);
  27520. }
  27521. static getRequestToken() {
  27522. const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
  27523. if (!token) {
  27524. throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
  27525. }
  27526. return token;
  27527. }
  27528. static getIDTokenUrl() {
  27529. const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
  27530. if (!runtimeUrl) {
  27531. throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
  27532. }
  27533. return runtimeUrl;
  27534. }
  27535. static getCall(id_token_url) {
  27536. return oidc_utils_awaiter(this, void 0, void 0, function* () {
  27537. var _a;
  27538. const httpclient = oidc_utils_OidcClient.createHttpClient();
  27539. const res = yield httpclient
  27540. .getJson(id_token_url)
  27541. .catch(error => {
  27542. throw new Error(`Failed to get ID Token. \n
  27543. Error Code : ${error.statusCode}\n
  27544. Error Message: ${error.message}`);
  27545. });
  27546. const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
  27547. if (!id_token) {
  27548. throw new Error('Response json body do not have ID Token field');
  27549. }
  27550. return id_token;
  27551. });
  27552. }
  27553. static getIDToken(audience) {
  27554. return oidc_utils_awaiter(this, void 0, void 0, function* () {
  27555. try {
  27556. // New ID Token is requested from action service
  27557. let id_token_url = oidc_utils_OidcClient.getIDTokenUrl();
  27558. if (audience) {
  27559. const encodedAudience = encodeURIComponent(audience);
  27560. id_token_url = `${id_token_url}&audience=${encodedAudience}`;
  27561. }
  27562. debug(`ID token url is ${id_token_url}`);
  27563. const id_token = yield oidc_utils_OidcClient.getCall(id_token_url);
  27564. setSecret(id_token);
  27565. return id_token;
  27566. }
  27567. catch (error) {
  27568. throw new Error(`Error message: ${error.message}`);
  27569. }
  27570. });
  27571. }
  27572. }
  27573. //# sourceMappingURL=oidc-utils.js.map
  27574. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/summary.js
  27575. var summary_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  27576. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  27577. return new (P || (P = Promise))(function (resolve, reject) {
  27578. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  27579. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  27580. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  27581. step((generator = generator.apply(thisArg, _arguments || [])).next());
  27582. });
  27583. };
  27584. const { access, appendFile, writeFile } = external_fs_namespaceObject.promises;
  27585. const SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
  27586. const SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
  27587. class Summary {
  27588. constructor() {
  27589. this._buffer = '';
  27590. }
  27591. /**
  27592. * Finds the summary file path from the environment, rejects if env var is not found or file does not exist
  27593. * Also checks r/w permissions.
  27594. *
  27595. * @returns step summary file path
  27596. */
  27597. filePath() {
  27598. return summary_awaiter(this, void 0, void 0, function* () {
  27599. if (this._filePath) {
  27600. return this._filePath;
  27601. }
  27602. const pathFromEnv = process.env[SUMMARY_ENV_VAR];
  27603. if (!pathFromEnv) {
  27604. throw new Error(`Unable to find environment variable for $${SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
  27605. }
  27606. try {
  27607. yield access(pathFromEnv, external_fs_namespaceObject.constants.R_OK | external_fs_namespaceObject.constants.W_OK);
  27608. }
  27609. catch (_a) {
  27610. throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
  27611. }
  27612. this._filePath = pathFromEnv;
  27613. return this._filePath;
  27614. });
  27615. }
  27616. /**
  27617. * Wraps content in an HTML tag, adding any HTML attributes
  27618. *
  27619. * @param {string} tag HTML tag to wrap
  27620. * @param {string | null} content content within the tag
  27621. * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
  27622. *
  27623. * @returns {string} content wrapped in HTML element
  27624. */
  27625. wrap(tag, content, attrs = {}) {
  27626. const htmlAttrs = Object.entries(attrs)
  27627. .map(([key, value]) => ` ${key}="${value}"`)
  27628. .join('');
  27629. if (!content) {
  27630. return `<${tag}${htmlAttrs}>`;
  27631. }
  27632. return `<${tag}${htmlAttrs}>${content}</${tag}>`;
  27633. }
  27634. /**
  27635. * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
  27636. *
  27637. * @param {SummaryWriteOptions} [options] (optional) options for write operation
  27638. *
  27639. * @returns {Promise<Summary>} summary instance
  27640. */
  27641. write(options) {
  27642. return summary_awaiter(this, void 0, void 0, function* () {
  27643. const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
  27644. const filePath = yield this.filePath();
  27645. const writeFunc = overwrite ? writeFile : appendFile;
  27646. yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
  27647. return this.emptyBuffer();
  27648. });
  27649. }
  27650. /**
  27651. * Clears the summary buffer and wipes the summary file
  27652. *
  27653. * @returns {Summary} summary instance
  27654. */
  27655. clear() {
  27656. return summary_awaiter(this, void 0, void 0, function* () {
  27657. return this.emptyBuffer().write({ overwrite: true });
  27658. });
  27659. }
  27660. /**
  27661. * Returns the current summary buffer as a string
  27662. *
  27663. * @returns {string} string of summary buffer
  27664. */
  27665. stringify() {
  27666. return this._buffer;
  27667. }
  27668. /**
  27669. * If the summary buffer is empty
  27670. *
  27671. * @returns {boolen} true if the buffer is empty
  27672. */
  27673. isEmptyBuffer() {
  27674. return this._buffer.length === 0;
  27675. }
  27676. /**
  27677. * Resets the summary buffer without writing to summary file
  27678. *
  27679. * @returns {Summary} summary instance
  27680. */
  27681. emptyBuffer() {
  27682. this._buffer = '';
  27683. return this;
  27684. }
  27685. /**
  27686. * Adds raw text to the summary buffer
  27687. *
  27688. * @param {string} text content to add
  27689. * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
  27690. *
  27691. * @returns {Summary} summary instance
  27692. */
  27693. addRaw(text, addEOL = false) {
  27694. this._buffer += text;
  27695. return addEOL ? this.addEOL() : this;
  27696. }
  27697. /**
  27698. * Adds the operating system-specific end-of-line marker to the buffer
  27699. *
  27700. * @returns {Summary} summary instance
  27701. */
  27702. addEOL() {
  27703. return this.addRaw(external_os_namespaceObject.EOL);
  27704. }
  27705. /**
  27706. * Adds an HTML codeblock to the summary buffer
  27707. *
  27708. * @param {string} code content to render within fenced code block
  27709. * @param {string} lang (optional) language to syntax highlight code
  27710. *
  27711. * @returns {Summary} summary instance
  27712. */
  27713. addCodeBlock(code, lang) {
  27714. const attrs = Object.assign({}, (lang && { lang }));
  27715. const element = this.wrap('pre', this.wrap('code', code), attrs);
  27716. return this.addRaw(element).addEOL();
  27717. }
  27718. /**
  27719. * Adds an HTML list to the summary buffer
  27720. *
  27721. * @param {string[]} items list of items to render
  27722. * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
  27723. *
  27724. * @returns {Summary} summary instance
  27725. */
  27726. addList(items, ordered = false) {
  27727. const tag = ordered ? 'ol' : 'ul';
  27728. const listItems = items.map(item => this.wrap('li', item)).join('');
  27729. const element = this.wrap(tag, listItems);
  27730. return this.addRaw(element).addEOL();
  27731. }
  27732. /**
  27733. * Adds an HTML table to the summary buffer
  27734. *
  27735. * @param {SummaryTableCell[]} rows table rows
  27736. *
  27737. * @returns {Summary} summary instance
  27738. */
  27739. addTable(rows) {
  27740. const tableBody = rows
  27741. .map(row => {
  27742. const cells = row
  27743. .map(cell => {
  27744. if (typeof cell === 'string') {
  27745. return this.wrap('td', cell);
  27746. }
  27747. const { header, data, colspan, rowspan } = cell;
  27748. const tag = header ? 'th' : 'td';
  27749. const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
  27750. return this.wrap(tag, data, attrs);
  27751. })
  27752. .join('');
  27753. return this.wrap('tr', cells);
  27754. })
  27755. .join('');
  27756. const element = this.wrap('table', tableBody);
  27757. return this.addRaw(element).addEOL();
  27758. }
  27759. /**
  27760. * Adds a collapsable HTML details element to the summary buffer
  27761. *
  27762. * @param {string} label text for the closed state
  27763. * @param {string} content collapsable content
  27764. *
  27765. * @returns {Summary} summary instance
  27766. */
  27767. addDetails(label, content) {
  27768. const element = this.wrap('details', this.wrap('summary', label) + content);
  27769. return this.addRaw(element).addEOL();
  27770. }
  27771. /**
  27772. * Adds an HTML image tag to the summary buffer
  27773. *
  27774. * @param {string} src path to the image you to embed
  27775. * @param {string} alt text description of the image
  27776. * @param {SummaryImageOptions} options (optional) addition image attributes
  27777. *
  27778. * @returns {Summary} summary instance
  27779. */
  27780. addImage(src, alt, options) {
  27781. const { width, height } = options || {};
  27782. const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
  27783. const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
  27784. return this.addRaw(element).addEOL();
  27785. }
  27786. /**
  27787. * Adds an HTML section heading element
  27788. *
  27789. * @param {string} text heading text
  27790. * @param {number | string} [level=1] (optional) the heading level, default: 1
  27791. *
  27792. * @returns {Summary} summary instance
  27793. */
  27794. addHeading(text, level) {
  27795. const tag = `h${level}`;
  27796. const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
  27797. ? tag
  27798. : 'h1';
  27799. const element = this.wrap(allowedTag, text);
  27800. return this.addRaw(element).addEOL();
  27801. }
  27802. /**
  27803. * Adds an HTML thematic break (<hr>) to the summary buffer
  27804. *
  27805. * @returns {Summary} summary instance
  27806. */
  27807. addSeparator() {
  27808. const element = this.wrap('hr', null);
  27809. return this.addRaw(element).addEOL();
  27810. }
  27811. /**
  27812. * Adds an HTML line break (<br>) to the summary buffer
  27813. *
  27814. * @returns {Summary} summary instance
  27815. */
  27816. addBreak() {
  27817. const element = this.wrap('br', null);
  27818. return this.addRaw(element).addEOL();
  27819. }
  27820. /**
  27821. * Adds an HTML blockquote to the summary buffer
  27822. *
  27823. * @param {string} text quote text
  27824. * @param {string} cite (optional) citation url
  27825. *
  27826. * @returns {Summary} summary instance
  27827. */
  27828. addQuote(text, cite) {
  27829. const attrs = Object.assign({}, (cite && { cite }));
  27830. const element = this.wrap('blockquote', text, attrs);
  27831. return this.addRaw(element).addEOL();
  27832. }
  27833. /**
  27834. * Adds an HTML anchor tag to the summary buffer
  27835. *
  27836. * @param {string} text link text/content
  27837. * @param {string} href hyperlink
  27838. *
  27839. * @returns {Summary} summary instance
  27840. */
  27841. addLink(text, href) {
  27842. const element = this.wrap('a', text, { href });
  27843. return this.addRaw(element).addEOL();
  27844. }
  27845. }
  27846. const _summary = new Summary();
  27847. /**
  27848. * @deprecated use `core.summary`
  27849. */
  27850. const markdownSummary = (/* unused pure expression or super */ null && (_summary));
  27851. const summary = (/* unused pure expression or super */ null && (_summary));
  27852. //# sourceMappingURL=summary.js.map
  27853. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/path-utils.js
  27854. /**
  27855. * toPosixPath converts the given path to the posix form. On Windows, \\ will be
  27856. * replaced with /.
  27857. *
  27858. * @param pth. Path to transform.
  27859. * @return string Posix path.
  27860. */
  27861. function toPosixPath(pth) {
  27862. return pth.replace(/[\\]/g, '/');
  27863. }
  27864. /**
  27865. * toWin32Path converts the given path to the win32 form. On Linux, / will be
  27866. * replaced with \\.
  27867. *
  27868. * @param pth. Path to transform.
  27869. * @return string Win32 path.
  27870. */
  27871. function toWin32Path(pth) {
  27872. return pth.replace(/[/]/g, '\\');
  27873. }
  27874. /**
  27875. * toPlatformPath converts the given path to a platform-specific path. It does
  27876. * this by replacing instances of / and \ with the platform-specific path
  27877. * separator.
  27878. *
  27879. * @param pth The path to platformize.
  27880. * @return string The platform-specific path.
  27881. */
  27882. function toPlatformPath(pth) {
  27883. return pth.replace(/[/\\]/g, path.sep);
  27884. }
  27885. //# sourceMappingURL=path-utils.js.map
  27886. // EXTERNAL MODULE: external "string_decoder"
  27887. var external_string_decoder_ = __nccwpck_require__(3193);
  27888. // EXTERNAL MODULE: external "events"
  27889. var external_events_ = __nccwpck_require__(4434);
  27890. ;// CONCATENATED MODULE: external "child_process"
  27891. const external_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("child_process");
  27892. // EXTERNAL MODULE: external "assert"
  27893. var external_assert_ = __nccwpck_require__(2613);
  27894. ;// CONCATENATED MODULE: ./node_modules/@actions/io/lib/io-util.js
  27895. var io_util_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  27896. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  27897. return new (P || (P = Promise))(function (resolve, reject) {
  27898. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  27899. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  27900. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  27901. step((generator = generator.apply(thisArg, _arguments || [])).next());
  27902. });
  27903. };
  27904. const { chmod, copyFile, lstat, mkdir, open: io_util_open, readdir, rename, rm, rmdir, stat, symlink, unlink } = external_fs_namespaceObject.promises;
  27905. // export const {open} = 'fs'
  27906. const IS_WINDOWS = process.platform === 'win32';
  27907. /**
  27908. * Custom implementation of readlink to ensure Windows junctions
  27909. * maintain trailing backslash for backward compatibility with Node.js < 24
  27910. *
  27911. * In Node.js 20, Windows junctions (directory symlinks) always returned paths
  27912. * with trailing backslashes. Node.js 24 removed this behavior, which breaks
  27913. * code that relied on this format for path operations.
  27914. *
  27915. * This implementation restores the Node 20 behavior by adding a trailing
  27916. * backslash to all junction results on Windows.
  27917. */
  27918. function readlink(fsPath) {
  27919. return io_util_awaiter(this, void 0, void 0, function* () {
  27920. const result = yield external_fs_namespaceObject.promises.readlink(fsPath);
  27921. // On Windows, restore Node 20 behavior: add trailing backslash to all results
  27922. // since junctions on Windows are always directory links
  27923. if (IS_WINDOWS && !result.endsWith('\\')) {
  27924. return `${result}\\`;
  27925. }
  27926. return result;
  27927. });
  27928. }
  27929. // See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
  27930. const UV_FS_O_EXLOCK = 0x10000000;
  27931. const READONLY = external_fs_namespaceObject.constants.O_RDONLY;
  27932. function exists(fsPath) {
  27933. return io_util_awaiter(this, void 0, void 0, function* () {
  27934. try {
  27935. yield stat(fsPath);
  27936. }
  27937. catch (err) {
  27938. if (err.code === 'ENOENT') {
  27939. return false;
  27940. }
  27941. throw err;
  27942. }
  27943. return true;
  27944. });
  27945. }
  27946. function isDirectory(fsPath_1) {
  27947. return io_util_awaiter(this, arguments, void 0, function* (fsPath, useStat = false) {
  27948. const stats = useStat ? yield stat(fsPath) : yield lstat(fsPath);
  27949. return stats.isDirectory();
  27950. });
  27951. }
  27952. /**
  27953. * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
  27954. * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
  27955. */
  27956. function isRooted(p) {
  27957. p = normalizeSeparators(p);
  27958. if (!p) {
  27959. throw new Error('isRooted() parameter "p" cannot be empty');
  27960. }
  27961. if (IS_WINDOWS) {
  27962. return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
  27963. ); // e.g. C: or C:\hello
  27964. }
  27965. return p.startsWith('/');
  27966. }
  27967. /**
  27968. * Best effort attempt to determine whether a file exists and is executable.
  27969. * @param filePath file path to check
  27970. * @param extensions additional file extensions to try
  27971. * @return if file exists and is executable, returns the file path. otherwise empty string.
  27972. */
  27973. function tryGetExecutablePath(filePath, extensions) {
  27974. return io_util_awaiter(this, void 0, void 0, function* () {
  27975. let stats = undefined;
  27976. try {
  27977. // test file exists
  27978. stats = yield stat(filePath);
  27979. }
  27980. catch (err) {
  27981. if (err.code !== 'ENOENT') {
  27982. // eslint-disable-next-line no-console
  27983. console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
  27984. }
  27985. }
  27986. if (stats && stats.isFile()) {
  27987. if (IS_WINDOWS) {
  27988. // on Windows, test for valid extension
  27989. const upperExt = external_path_namespaceObject.extname(filePath).toUpperCase();
  27990. if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
  27991. return filePath;
  27992. }
  27993. }
  27994. else {
  27995. if (isUnixExecutable(stats)) {
  27996. return filePath;
  27997. }
  27998. }
  27999. }
  28000. // try each extension
  28001. const originalFilePath = filePath;
  28002. for (const extension of extensions) {
  28003. filePath = originalFilePath + extension;
  28004. stats = undefined;
  28005. try {
  28006. stats = yield stat(filePath);
  28007. }
  28008. catch (err) {
  28009. if (err.code !== 'ENOENT') {
  28010. // eslint-disable-next-line no-console
  28011. console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
  28012. }
  28013. }
  28014. if (stats && stats.isFile()) {
  28015. if (IS_WINDOWS) {
  28016. // preserve the case of the actual file (since an extension was appended)
  28017. try {
  28018. const directory = external_path_namespaceObject.dirname(filePath);
  28019. const upperName = external_path_namespaceObject.basename(filePath).toUpperCase();
  28020. for (const actualName of yield readdir(directory)) {
  28021. if (upperName === actualName.toUpperCase()) {
  28022. filePath = external_path_namespaceObject.join(directory, actualName);
  28023. break;
  28024. }
  28025. }
  28026. }
  28027. catch (err) {
  28028. // eslint-disable-next-line no-console
  28029. console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
  28030. }
  28031. return filePath;
  28032. }
  28033. else {
  28034. if (isUnixExecutable(stats)) {
  28035. return filePath;
  28036. }
  28037. }
  28038. }
  28039. }
  28040. return '';
  28041. });
  28042. }
  28043. function normalizeSeparators(p) {
  28044. p = p || '';
  28045. if (IS_WINDOWS) {
  28046. // convert slashes on Windows
  28047. p = p.replace(/\//g, '\\');
  28048. // remove redundant slashes
  28049. return p.replace(/\\\\+/g, '\\');
  28050. }
  28051. // remove redundant slashes
  28052. return p.replace(/\/\/+/g, '/');
  28053. }
  28054. // on Mac/Linux, test the execute bit
  28055. // R W X R W X R W X
  28056. // 256 128 64 32 16 8 4 2 1
  28057. function isUnixExecutable(stats) {
  28058. return ((stats.mode & 1) > 0 ||
  28059. ((stats.mode & 8) > 0 &&
  28060. process.getgid !== undefined &&
  28061. stats.gid === process.getgid()) ||
  28062. ((stats.mode & 64) > 0 &&
  28063. process.getuid !== undefined &&
  28064. stats.uid === process.getuid()));
  28065. }
  28066. // Get the path of cmd.exe in windows
  28067. function getCmdPath() {
  28068. var _a;
  28069. return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
  28070. }
  28071. //# sourceMappingURL=io-util.js.map
  28072. ;// CONCATENATED MODULE: ./node_modules/@actions/io/lib/io.js
  28073. var io_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  28074. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  28075. return new (P || (P = Promise))(function (resolve, reject) {
  28076. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  28077. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  28078. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  28079. step((generator = generator.apply(thisArg, _arguments || [])).next());
  28080. });
  28081. };
  28082. /**
  28083. * Copies a file or folder.
  28084. * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
  28085. *
  28086. * @param source source path
  28087. * @param dest destination path
  28088. * @param options optional. See CopyOptions.
  28089. */
  28090. function io_cp(source_1, dest_1) {
  28091. return io_awaiter(this, arguments, void 0, function* (source, dest, options = {}) {
  28092. const { force, recursive, copySourceDirectory } = readCopyOptions(options);
  28093. const destStat = (yield exists(dest)) ? yield stat(dest) : null;
  28094. // Dest is an existing file, but not forcing
  28095. if (destStat && destStat.isFile() && !force) {
  28096. return;
  28097. }
  28098. // If dest is an existing directory, should copy inside.
  28099. const newDest = destStat && destStat.isDirectory() && copySourceDirectory
  28100. ? external_path_namespaceObject.join(dest, external_path_namespaceObject.basename(source))
  28101. : dest;
  28102. if (!(yield exists(source))) {
  28103. throw new Error(`no such file or directory: ${source}`);
  28104. }
  28105. const sourceStat = yield stat(source);
  28106. if (sourceStat.isDirectory()) {
  28107. if (!recursive) {
  28108. throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
  28109. }
  28110. else {
  28111. yield cpDirRecursive(source, newDest, 0, force);
  28112. }
  28113. }
  28114. else {
  28115. if (external_path_namespaceObject.relative(source, newDest) === '') {
  28116. // a file cannot be copied to itself
  28117. throw new Error(`'${newDest}' and '${source}' are the same file`);
  28118. }
  28119. yield io_copyFile(source, newDest, force);
  28120. }
  28121. });
  28122. }
  28123. /**
  28124. * Moves a path.
  28125. *
  28126. * @param source source path
  28127. * @param dest destination path
  28128. * @param options optional. See MoveOptions.
  28129. */
  28130. function mv(source_1, dest_1) {
  28131. return io_awaiter(this, arguments, void 0, function* (source, dest, options = {}) {
  28132. if (yield exists(dest)) {
  28133. let destExists = true;
  28134. if (yield isDirectory(dest)) {
  28135. // If dest is directory copy src into dest
  28136. dest = external_path_namespaceObject.join(dest, external_path_namespaceObject.basename(source));
  28137. destExists = yield exists(dest);
  28138. }
  28139. if (destExists) {
  28140. if (options.force == null || options.force) {
  28141. yield rmRF(dest);
  28142. }
  28143. else {
  28144. throw new Error('Destination already exists');
  28145. }
  28146. }
  28147. }
  28148. yield mkdirP(external_path_namespaceObject.dirname(dest));
  28149. yield rename(source, dest);
  28150. });
  28151. }
  28152. /**
  28153. * Remove a path recursively with force
  28154. *
  28155. * @param inputPath path to remove
  28156. */
  28157. function rmRF(inputPath) {
  28158. return io_awaiter(this, void 0, void 0, function* () {
  28159. if (IS_WINDOWS) {
  28160. // Check for invalid characters
  28161. // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
  28162. if (/[*"<>|]/.test(inputPath)) {
  28163. throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
  28164. }
  28165. }
  28166. try {
  28167. // note if path does not exist, error is silent
  28168. yield rm(inputPath, {
  28169. force: true,
  28170. maxRetries: 3,
  28171. recursive: true,
  28172. retryDelay: 300
  28173. });
  28174. }
  28175. catch (err) {
  28176. throw new Error(`File was unable to be removed ${err}`);
  28177. }
  28178. });
  28179. }
  28180. /**
  28181. * Make a directory. Creates the full path with folders in between
  28182. * Will throw if it fails
  28183. *
  28184. * @param fsPath path to create
  28185. * @returns Promise<void>
  28186. */
  28187. function mkdirP(fsPath) {
  28188. return io_awaiter(this, void 0, void 0, function* () {
  28189. (0,external_assert_.ok)(fsPath, 'a path argument must be provided');
  28190. yield mkdir(fsPath, { recursive: true });
  28191. });
  28192. }
  28193. /**
  28194. * Returns path of a tool had the tool actually been invoked. Resolves via paths.
  28195. * If you check and the tool does not exist, it will throw.
  28196. *
  28197. * @param tool name of the tool
  28198. * @param check whether to check if tool exists
  28199. * @returns Promise<string> path to tool
  28200. */
  28201. function which(tool, check) {
  28202. return io_awaiter(this, void 0, void 0, function* () {
  28203. if (!tool) {
  28204. throw new Error("parameter 'tool' is required");
  28205. }
  28206. // recursive when check=true
  28207. if (check) {
  28208. const result = yield which(tool, false);
  28209. if (!result) {
  28210. if (IS_WINDOWS) {
  28211. 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.`);
  28212. }
  28213. else {
  28214. 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.`);
  28215. }
  28216. }
  28217. return result;
  28218. }
  28219. const matches = yield findInPath(tool);
  28220. if (matches && matches.length > 0) {
  28221. return matches[0];
  28222. }
  28223. return '';
  28224. });
  28225. }
  28226. /**
  28227. * Returns a list of all occurrences of the given tool on the system path.
  28228. *
  28229. * @returns Promise<string[]> the paths of the tool
  28230. */
  28231. function findInPath(tool) {
  28232. return io_awaiter(this, void 0, void 0, function* () {
  28233. if (!tool) {
  28234. throw new Error("parameter 'tool' is required");
  28235. }
  28236. // build the list of extensions to try
  28237. const extensions = [];
  28238. if (IS_WINDOWS && process.env['PATHEXT']) {
  28239. for (const extension of process.env['PATHEXT'].split(external_path_namespaceObject.delimiter)) {
  28240. if (extension) {
  28241. extensions.push(extension);
  28242. }
  28243. }
  28244. }
  28245. // if it's rooted, return it if exists. otherwise return empty.
  28246. if (isRooted(tool)) {
  28247. const filePath = yield tryGetExecutablePath(tool, extensions);
  28248. if (filePath) {
  28249. return [filePath];
  28250. }
  28251. return [];
  28252. }
  28253. // if any path separators, return empty
  28254. if (tool.includes(external_path_namespaceObject.sep)) {
  28255. return [];
  28256. }
  28257. // build the list of directories
  28258. //
  28259. // Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
  28260. // it feels like we should not do this. Checking the current directory seems like more of a use
  28261. // case of a shell, and the which() function exposed by the toolkit should strive for consistency
  28262. // across platforms.
  28263. const directories = [];
  28264. if (process.env.PATH) {
  28265. for (const p of process.env.PATH.split(external_path_namespaceObject.delimiter)) {
  28266. if (p) {
  28267. directories.push(p);
  28268. }
  28269. }
  28270. }
  28271. // find all matches
  28272. const matches = [];
  28273. for (const directory of directories) {
  28274. const filePath = yield tryGetExecutablePath(external_path_namespaceObject.join(directory, tool), extensions);
  28275. if (filePath) {
  28276. matches.push(filePath);
  28277. }
  28278. }
  28279. return matches;
  28280. });
  28281. }
  28282. function readCopyOptions(options) {
  28283. const force = options.force == null ? true : options.force;
  28284. const recursive = Boolean(options.recursive);
  28285. const copySourceDirectory = options.copySourceDirectory == null
  28286. ? true
  28287. : Boolean(options.copySourceDirectory);
  28288. return { force, recursive, copySourceDirectory };
  28289. }
  28290. function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
  28291. return io_awaiter(this, void 0, void 0, function* () {
  28292. // Ensure there is not a run away recursive copy
  28293. if (currentDepth >= 255)
  28294. return;
  28295. currentDepth++;
  28296. yield mkdirP(destDir);
  28297. const files = yield readdir(sourceDir);
  28298. for (const fileName of files) {
  28299. const srcFile = `${sourceDir}/${fileName}`;
  28300. const destFile = `${destDir}/${fileName}`;
  28301. const srcFileStat = yield lstat(srcFile);
  28302. if (srcFileStat.isDirectory()) {
  28303. // Recurse
  28304. yield cpDirRecursive(srcFile, destFile, currentDepth, force);
  28305. }
  28306. else {
  28307. yield io_copyFile(srcFile, destFile, force);
  28308. }
  28309. }
  28310. // Change the mode for the newly created directory
  28311. yield chmod(destDir, (yield stat(sourceDir)).mode);
  28312. });
  28313. }
  28314. // Buffered file copy
  28315. function io_copyFile(srcFile, destFile, force) {
  28316. return io_awaiter(this, void 0, void 0, function* () {
  28317. if ((yield lstat(srcFile)).isSymbolicLink()) {
  28318. // unlink/re-link it
  28319. try {
  28320. yield lstat(destFile);
  28321. yield unlink(destFile);
  28322. }
  28323. catch (e) {
  28324. // Try to override file permission
  28325. if (e.code === 'EPERM') {
  28326. yield chmod(destFile, '0666');
  28327. yield unlink(destFile);
  28328. }
  28329. // other errors = it doesn't exist, no work to do
  28330. }
  28331. // Copy over symlink
  28332. const symlinkFull = yield readlink(srcFile);
  28333. yield symlink(symlinkFull, destFile, IS_WINDOWS ? 'junction' : null);
  28334. }
  28335. else if (!(yield exists(destFile)) || force) {
  28336. yield copyFile(srcFile, destFile);
  28337. }
  28338. });
  28339. }
  28340. //# sourceMappingURL=io.js.map
  28341. ;// CONCATENATED MODULE: external "timers"
  28342. const external_timers_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("timers");
  28343. ;// CONCATENATED MODULE: ./node_modules/@actions/exec/lib/toolrunner.js
  28344. var toolrunner_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  28345. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  28346. return new (P || (P = Promise))(function (resolve, reject) {
  28347. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  28348. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  28349. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  28350. step((generator = generator.apply(thisArg, _arguments || [])).next());
  28351. });
  28352. };
  28353. /* eslint-disable @typescript-eslint/unbound-method */
  28354. const toolrunner_IS_WINDOWS = process.platform === 'win32';
  28355. /*
  28356. * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
  28357. */
  28358. class ToolRunner extends external_events_.EventEmitter {
  28359. constructor(toolPath, args, options) {
  28360. super();
  28361. if (!toolPath) {
  28362. throw new Error("Parameter 'toolPath' cannot be null or empty.");
  28363. }
  28364. this.toolPath = toolPath;
  28365. this.args = args || [];
  28366. this.options = options || {};
  28367. }
  28368. _debug(message) {
  28369. if (this.options.listeners && this.options.listeners.debug) {
  28370. this.options.listeners.debug(message);
  28371. }
  28372. }
  28373. _getCommandString(options, noPrefix) {
  28374. const toolPath = this._getSpawnFileName();
  28375. const args = this._getSpawnArgs(options);
  28376. let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
  28377. if (toolrunner_IS_WINDOWS) {
  28378. // Windows + cmd file
  28379. if (this._isCmdFile()) {
  28380. cmd += toolPath;
  28381. for (const a of args) {
  28382. cmd += ` ${a}`;
  28383. }
  28384. }
  28385. // Windows + verbatim
  28386. else if (options.windowsVerbatimArguments) {
  28387. cmd += `"${toolPath}"`;
  28388. for (const a of args) {
  28389. cmd += ` ${a}`;
  28390. }
  28391. }
  28392. // Windows (regular)
  28393. else {
  28394. cmd += this._windowsQuoteCmdArg(toolPath);
  28395. for (const a of args) {
  28396. cmd += ` ${this._windowsQuoteCmdArg(a)}`;
  28397. }
  28398. }
  28399. }
  28400. else {
  28401. // OSX/Linux - this can likely be improved with some form of quoting.
  28402. // creating processes on Unix is fundamentally different than Windows.
  28403. // on Unix, execvp() takes an arg array.
  28404. cmd += toolPath;
  28405. for (const a of args) {
  28406. cmd += ` ${a}`;
  28407. }
  28408. }
  28409. return cmd;
  28410. }
  28411. _processLineBuffer(data, strBuffer, onLine) {
  28412. try {
  28413. let s = strBuffer + data.toString();
  28414. let n = s.indexOf(external_os_namespaceObject.EOL);
  28415. while (n > -1) {
  28416. const line = s.substring(0, n);
  28417. onLine(line);
  28418. // the rest of the string ...
  28419. s = s.substring(n + external_os_namespaceObject.EOL.length);
  28420. n = s.indexOf(external_os_namespaceObject.EOL);
  28421. }
  28422. return s;
  28423. }
  28424. catch (err) {
  28425. // streaming lines to console is best effort. Don't fail a build.
  28426. this._debug(`error processing line. Failed with error ${err}`);
  28427. return '';
  28428. }
  28429. }
  28430. _getSpawnFileName() {
  28431. if (toolrunner_IS_WINDOWS) {
  28432. if (this._isCmdFile()) {
  28433. return process.env['COMSPEC'] || 'cmd.exe';
  28434. }
  28435. }
  28436. return this.toolPath;
  28437. }
  28438. _getSpawnArgs(options) {
  28439. if (toolrunner_IS_WINDOWS) {
  28440. if (this._isCmdFile()) {
  28441. let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
  28442. for (const a of this.args) {
  28443. argline += ' ';
  28444. argline += options.windowsVerbatimArguments
  28445. ? a
  28446. : this._windowsQuoteCmdArg(a);
  28447. }
  28448. argline += '"';
  28449. return [argline];
  28450. }
  28451. }
  28452. return this.args;
  28453. }
  28454. _endsWith(str, end) {
  28455. return str.endsWith(end);
  28456. }
  28457. _isCmdFile() {
  28458. const upperToolPath = this.toolPath.toUpperCase();
  28459. return (this._endsWith(upperToolPath, '.CMD') ||
  28460. this._endsWith(upperToolPath, '.BAT'));
  28461. }
  28462. _windowsQuoteCmdArg(arg) {
  28463. // for .exe, apply the normal quoting rules that libuv applies
  28464. if (!this._isCmdFile()) {
  28465. return this._uvQuoteCmdArg(arg);
  28466. }
  28467. // otherwise apply quoting rules specific to the cmd.exe command line parser.
  28468. // the libuv rules are generic and are not designed specifically for cmd.exe
  28469. // command line parser.
  28470. //
  28471. // for a detailed description of the cmd.exe command line parser, refer to
  28472. // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
  28473. // need quotes for empty arg
  28474. if (!arg) {
  28475. return '""';
  28476. }
  28477. // determine whether the arg needs to be quoted
  28478. const cmdSpecialChars = [
  28479. ' ',
  28480. '\t',
  28481. '&',
  28482. '(',
  28483. ')',
  28484. '[',
  28485. ']',
  28486. '{',
  28487. '}',
  28488. '^',
  28489. '=',
  28490. ';',
  28491. '!',
  28492. "'",
  28493. '+',
  28494. ',',
  28495. '`',
  28496. '~',
  28497. '|',
  28498. '<',
  28499. '>',
  28500. '"'
  28501. ];
  28502. let needsQuotes = false;
  28503. for (const char of arg) {
  28504. if (cmdSpecialChars.some(x => x === char)) {
  28505. needsQuotes = true;
  28506. break;
  28507. }
  28508. }
  28509. // short-circuit if quotes not needed
  28510. if (!needsQuotes) {
  28511. return arg;
  28512. }
  28513. // the following quoting rules are very similar to the rules that by libuv applies.
  28514. //
  28515. // 1) wrap the string in quotes
  28516. //
  28517. // 2) double-up quotes - i.e. " => ""
  28518. //
  28519. // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
  28520. // doesn't work well with a cmd.exe command line.
  28521. //
  28522. // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
  28523. // for example, the command line:
  28524. // foo.exe "myarg:""my val"""
  28525. // is parsed by a .NET console app into an arg array:
  28526. // [ "myarg:\"my val\"" ]
  28527. // which is the same end result when applying libuv quoting rules. although the actual
  28528. // command line from libuv quoting rules would look like:
  28529. // foo.exe "myarg:\"my val\""
  28530. //
  28531. // 3) double-up slashes that precede a quote,
  28532. // e.g. hello \world => "hello \world"
  28533. // hello\"world => "hello\\""world"
  28534. // hello\\"world => "hello\\\\""world"
  28535. // hello world\ => "hello world\\"
  28536. //
  28537. // technically this is not required for a cmd.exe command line, or the batch argument parser.
  28538. // the reasons for including this as a .cmd quoting rule are:
  28539. //
  28540. // a) this is optimized for the scenario where the argument is passed from the .cmd file to an
  28541. // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
  28542. //
  28543. // b) it's what we've been doing previously (by deferring to node default behavior) and we
  28544. // haven't heard any complaints about that aspect.
  28545. //
  28546. // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
  28547. // escaped when used on the command line directly - even though within a .cmd file % can be escaped
  28548. // by using %%.
  28549. //
  28550. // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
  28551. // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
  28552. //
  28553. // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
  28554. // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
  28555. // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
  28556. // to an external program.
  28557. //
  28558. // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
  28559. // % can be escaped within a .cmd file.
  28560. let reverse = '"';
  28561. let quoteHit = true;
  28562. for (let i = arg.length; i > 0; i--) {
  28563. // walk the string in reverse
  28564. reverse += arg[i - 1];
  28565. if (quoteHit && arg[i - 1] === '\\') {
  28566. reverse += '\\'; // double the slash
  28567. }
  28568. else if (arg[i - 1] === '"') {
  28569. quoteHit = true;
  28570. reverse += '"'; // double the quote
  28571. }
  28572. else {
  28573. quoteHit = false;
  28574. }
  28575. }
  28576. reverse += '"';
  28577. return reverse.split('').reverse().join('');
  28578. }
  28579. _uvQuoteCmdArg(arg) {
  28580. // Tool runner wraps child_process.spawn() and needs to apply the same quoting as
  28581. // Node in certain cases where the undocumented spawn option windowsVerbatimArguments
  28582. // is used.
  28583. //
  28584. // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
  28585. // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
  28586. // pasting copyright notice from Node within this function:
  28587. //
  28588. // Copyright Joyent, Inc. and other Node contributors. All rights reserved.
  28589. //
  28590. // Permission is hereby granted, free of charge, to any person obtaining a copy
  28591. // of this software and associated documentation files (the "Software"), to
  28592. // deal in the Software without restriction, including without limitation the
  28593. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  28594. // sell copies of the Software, and to permit persons to whom the Software is
  28595. // furnished to do so, subject to the following conditions:
  28596. //
  28597. // The above copyright notice and this permission notice shall be included in
  28598. // all copies or substantial portions of the Software.
  28599. //
  28600. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28601. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  28602. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  28603. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  28604. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  28605. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  28606. // IN THE SOFTWARE.
  28607. if (!arg) {
  28608. // Need double quotation for empty argument
  28609. return '""';
  28610. }
  28611. if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
  28612. // No quotation needed
  28613. return arg;
  28614. }
  28615. if (!arg.includes('"') && !arg.includes('\\')) {
  28616. // No embedded double quotes or backslashes, so I can just wrap
  28617. // quote marks around the whole thing.
  28618. return `"${arg}"`;
  28619. }
  28620. // Expected input/output:
  28621. // input : hello"world
  28622. // output: "hello\"world"
  28623. // input : hello""world
  28624. // output: "hello\"\"world"
  28625. // input : hello\world
  28626. // output: hello\world
  28627. // input : hello\\world
  28628. // output: hello\\world
  28629. // input : hello\"world
  28630. // output: "hello\\\"world"
  28631. // input : hello\\"world
  28632. // output: "hello\\\\\"world"
  28633. // input : hello world\
  28634. // output: "hello world\\" - note the comment in libuv actually reads "hello world\"
  28635. // but it appears the comment is wrong, it should be "hello world\\"
  28636. let reverse = '"';
  28637. let quoteHit = true;
  28638. for (let i = arg.length; i > 0; i--) {
  28639. // walk the string in reverse
  28640. reverse += arg[i - 1];
  28641. if (quoteHit && arg[i - 1] === '\\') {
  28642. reverse += '\\';
  28643. }
  28644. else if (arg[i - 1] === '"') {
  28645. quoteHit = true;
  28646. reverse += '\\';
  28647. }
  28648. else {
  28649. quoteHit = false;
  28650. }
  28651. }
  28652. reverse += '"';
  28653. return reverse.split('').reverse().join('');
  28654. }
  28655. _cloneExecOptions(options) {
  28656. options = options || {};
  28657. const result = {
  28658. cwd: options.cwd || process.cwd(),
  28659. env: options.env || process.env,
  28660. silent: options.silent || false,
  28661. windowsVerbatimArguments: options.windowsVerbatimArguments || false,
  28662. failOnStdErr: options.failOnStdErr || false,
  28663. ignoreReturnCode: options.ignoreReturnCode || false,
  28664. delay: options.delay || 10000
  28665. };
  28666. result.outStream = options.outStream || process.stdout;
  28667. result.errStream = options.errStream || process.stderr;
  28668. return result;
  28669. }
  28670. _getSpawnOptions(options, toolPath) {
  28671. options = options || {};
  28672. const result = {};
  28673. result.cwd = options.cwd;
  28674. result.env = options.env;
  28675. result['windowsVerbatimArguments'] =
  28676. options.windowsVerbatimArguments || this._isCmdFile();
  28677. if (options.windowsVerbatimArguments) {
  28678. result.argv0 = `"${toolPath}"`;
  28679. }
  28680. return result;
  28681. }
  28682. /**
  28683. * Exec a tool.
  28684. * Output will be streamed to the live console.
  28685. * Returns promise with return code
  28686. *
  28687. * @param tool path to tool to exec
  28688. * @param options optional exec options. See ExecOptions
  28689. * @returns number
  28690. */
  28691. exec() {
  28692. return toolrunner_awaiter(this, void 0, void 0, function* () {
  28693. // root the tool path if it is unrooted and contains relative pathing
  28694. if (!isRooted(this.toolPath) &&
  28695. (this.toolPath.includes('/') ||
  28696. (toolrunner_IS_WINDOWS && this.toolPath.includes('\\')))) {
  28697. // prefer options.cwd if it is specified, however options.cwd may also need to be rooted
  28698. this.toolPath = external_path_namespaceObject.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath);
  28699. }
  28700. // if the tool is only a file name, then resolve it from the PATH
  28701. // otherwise verify it exists (add extension on Windows if necessary)
  28702. this.toolPath = yield which(this.toolPath, true);
  28703. return new Promise((resolve, reject) => toolrunner_awaiter(this, void 0, void 0, function* () {
  28704. this._debug(`exec tool: ${this.toolPath}`);
  28705. this._debug('arguments:');
  28706. for (const arg of this.args) {
  28707. this._debug(` ${arg}`);
  28708. }
  28709. const optionsNonNull = this._cloneExecOptions(this.options);
  28710. if (!optionsNonNull.silent && optionsNonNull.outStream) {
  28711. optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + external_os_namespaceObject.EOL);
  28712. }
  28713. const state = new ExecState(optionsNonNull, this.toolPath);
  28714. state.on('debug', (message) => {
  28715. this._debug(message);
  28716. });
  28717. if (this.options.cwd && !(yield exists(this.options.cwd))) {
  28718. return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
  28719. }
  28720. const fileName = this._getSpawnFileName();
  28721. const cp = external_child_process_namespaceObject.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
  28722. let stdbuffer = '';
  28723. if (cp.stdout) {
  28724. cp.stdout.on('data', (data) => {
  28725. if (this.options.listeners && this.options.listeners.stdout) {
  28726. this.options.listeners.stdout(data);
  28727. }
  28728. if (!optionsNonNull.silent && optionsNonNull.outStream) {
  28729. optionsNonNull.outStream.write(data);
  28730. }
  28731. stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
  28732. if (this.options.listeners && this.options.listeners.stdline) {
  28733. this.options.listeners.stdline(line);
  28734. }
  28735. });
  28736. });
  28737. }
  28738. let errbuffer = '';
  28739. if (cp.stderr) {
  28740. cp.stderr.on('data', (data) => {
  28741. state.processStderr = true;
  28742. if (this.options.listeners && this.options.listeners.stderr) {
  28743. this.options.listeners.stderr(data);
  28744. }
  28745. if (!optionsNonNull.silent &&
  28746. optionsNonNull.errStream &&
  28747. optionsNonNull.outStream) {
  28748. const s = optionsNonNull.failOnStdErr
  28749. ? optionsNonNull.errStream
  28750. : optionsNonNull.outStream;
  28751. s.write(data);
  28752. }
  28753. errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
  28754. if (this.options.listeners && this.options.listeners.errline) {
  28755. this.options.listeners.errline(line);
  28756. }
  28757. });
  28758. });
  28759. }
  28760. cp.on('error', (err) => {
  28761. state.processError = err.message;
  28762. state.processExited = true;
  28763. state.processClosed = true;
  28764. state.CheckComplete();
  28765. });
  28766. cp.on('exit', (code) => {
  28767. state.processExitCode = code;
  28768. state.processExited = true;
  28769. this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
  28770. state.CheckComplete();
  28771. });
  28772. cp.on('close', (code) => {
  28773. state.processExitCode = code;
  28774. state.processExited = true;
  28775. state.processClosed = true;
  28776. this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
  28777. state.CheckComplete();
  28778. });
  28779. state.on('done', (error, exitCode) => {
  28780. if (stdbuffer.length > 0) {
  28781. this.emit('stdline', stdbuffer);
  28782. }
  28783. if (errbuffer.length > 0) {
  28784. this.emit('errline', errbuffer);
  28785. }
  28786. cp.removeAllListeners();
  28787. if (error) {
  28788. reject(error);
  28789. }
  28790. else {
  28791. resolve(exitCode);
  28792. }
  28793. });
  28794. if (this.options.input) {
  28795. if (!cp.stdin) {
  28796. throw new Error('child process missing stdin');
  28797. }
  28798. cp.stdin.end(this.options.input);
  28799. }
  28800. }));
  28801. });
  28802. }
  28803. }
  28804. /**
  28805. * Convert an arg string to an array of args. Handles escaping
  28806. *
  28807. * @param argString string of arguments
  28808. * @returns string[] array of arguments
  28809. */
  28810. function argStringToArray(argString) {
  28811. const args = [];
  28812. let inQuotes = false;
  28813. let escaped = false;
  28814. let arg = '';
  28815. function append(c) {
  28816. // we only escape double quotes.
  28817. if (escaped && c !== '"') {
  28818. arg += '\\';
  28819. }
  28820. arg += c;
  28821. escaped = false;
  28822. }
  28823. for (let i = 0; i < argString.length; i++) {
  28824. const c = argString.charAt(i);
  28825. if (c === '"') {
  28826. if (!escaped) {
  28827. inQuotes = !inQuotes;
  28828. }
  28829. else {
  28830. append(c);
  28831. }
  28832. continue;
  28833. }
  28834. if (c === '\\' && escaped) {
  28835. append(c);
  28836. continue;
  28837. }
  28838. if (c === '\\' && inQuotes) {
  28839. escaped = true;
  28840. continue;
  28841. }
  28842. if (c === ' ' && !inQuotes) {
  28843. if (arg.length > 0) {
  28844. args.push(arg);
  28845. arg = '';
  28846. }
  28847. continue;
  28848. }
  28849. append(c);
  28850. }
  28851. if (arg.length > 0) {
  28852. args.push(arg.trim());
  28853. }
  28854. return args;
  28855. }
  28856. class ExecState extends external_events_.EventEmitter {
  28857. constructor(options, toolPath) {
  28858. super();
  28859. this.processClosed = false; // tracks whether the process has exited and stdio is closed
  28860. this.processError = '';
  28861. this.processExitCode = 0;
  28862. this.processExited = false; // tracks whether the process has exited
  28863. this.processStderr = false; // tracks whether stderr was written to
  28864. this.delay = 10000; // 10 seconds
  28865. this.done = false;
  28866. this.timeout = null;
  28867. if (!toolPath) {
  28868. throw new Error('toolPath must not be empty');
  28869. }
  28870. this.options = options;
  28871. this.toolPath = toolPath;
  28872. if (options.delay) {
  28873. this.delay = options.delay;
  28874. }
  28875. }
  28876. CheckComplete() {
  28877. if (this.done) {
  28878. return;
  28879. }
  28880. if (this.processClosed) {
  28881. this._setResult();
  28882. }
  28883. else if (this.processExited) {
  28884. this.timeout = (0,external_timers_namespaceObject.setTimeout)(ExecState.HandleTimeout, this.delay, this);
  28885. }
  28886. }
  28887. _debug(message) {
  28888. this.emit('debug', message);
  28889. }
  28890. _setResult() {
  28891. // determine whether there is an error
  28892. let error;
  28893. if (this.processExited) {
  28894. if (this.processError) {
  28895. 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}`);
  28896. }
  28897. else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
  28898. error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
  28899. }
  28900. else if (this.processStderr && this.options.failOnStdErr) {
  28901. error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
  28902. }
  28903. }
  28904. // clear the timeout
  28905. if (this.timeout) {
  28906. clearTimeout(this.timeout);
  28907. this.timeout = null;
  28908. }
  28909. this.done = true;
  28910. this.emit('done', error, this.processExitCode);
  28911. }
  28912. static HandleTimeout(state) {
  28913. if (state.done) {
  28914. return;
  28915. }
  28916. if (!state.processClosed && state.processExited) {
  28917. 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.`;
  28918. state._debug(message);
  28919. }
  28920. state._setResult();
  28921. }
  28922. }
  28923. //# sourceMappingURL=toolrunner.js.map
  28924. ;// CONCATENATED MODULE: ./node_modules/@actions/exec/lib/exec.js
  28925. var exec_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  28926. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  28927. return new (P || (P = Promise))(function (resolve, reject) {
  28928. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  28929. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  28930. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  28931. step((generator = generator.apply(thisArg, _arguments || [])).next());
  28932. });
  28933. };
  28934. /**
  28935. * Exec a command.
  28936. * Output will be streamed to the live console.
  28937. * Returns promise with return code
  28938. *
  28939. * @param commandLine command to execute (can include additional args). Must be correctly escaped.
  28940. * @param args optional arguments for tool. Escaping is handled by the lib.
  28941. * @param options optional exec options. See ExecOptions
  28942. * @returns Promise<number> exit code
  28943. */
  28944. function exec_exec(commandLine, args, options) {
  28945. return exec_awaiter(this, void 0, void 0, function* () {
  28946. const commandArgs = argStringToArray(commandLine);
  28947. if (commandArgs.length === 0) {
  28948. throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
  28949. }
  28950. // Path to tool to execute should be first arg
  28951. const toolPath = commandArgs[0];
  28952. args = commandArgs.slice(1).concat(args || []);
  28953. const runner = new ToolRunner(toolPath, args, options);
  28954. return runner.exec();
  28955. });
  28956. }
  28957. /**
  28958. * Exec a command and get the output.
  28959. * Output will be streamed to the live console.
  28960. * Returns promise with the exit code and collected stdout and stderr
  28961. *
  28962. * @param commandLine command to execute (can include additional args). Must be correctly escaped.
  28963. * @param args optional arguments for tool. Escaping is handled by the lib.
  28964. * @param options optional exec options. See ExecOptions
  28965. * @returns Promise<ExecOutput> exit code, stdout, and stderr
  28966. */
  28967. function getExecOutput(commandLine, args, options) {
  28968. return exec_awaiter(this, void 0, void 0, function* () {
  28969. var _a, _b;
  28970. let stdout = '';
  28971. let stderr = '';
  28972. //Using string decoder covers the case where a mult-byte character is split
  28973. const stdoutDecoder = new StringDecoder('utf8');
  28974. const stderrDecoder = new StringDecoder('utf8');
  28975. const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
  28976. const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
  28977. const stdErrListener = (data) => {
  28978. stderr += stderrDecoder.write(data);
  28979. if (originalStdErrListener) {
  28980. originalStdErrListener(data);
  28981. }
  28982. };
  28983. const stdOutListener = (data) => {
  28984. stdout += stdoutDecoder.write(data);
  28985. if (originalStdoutListener) {
  28986. originalStdoutListener(data);
  28987. }
  28988. };
  28989. const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
  28990. const exitCode = yield exec_exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
  28991. //flush any remaining characters
  28992. stdout += stdoutDecoder.end();
  28993. stderr += stderrDecoder.end();
  28994. return {
  28995. exitCode,
  28996. stdout,
  28997. stderr
  28998. };
  28999. });
  29000. }
  29001. //# sourceMappingURL=exec.js.map
  29002. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/platform.js
  29003. var platform_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  29004. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  29005. return new (P || (P = Promise))(function (resolve, reject) {
  29006. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  29007. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  29008. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  29009. step((generator = generator.apply(thisArg, _arguments || [])).next());
  29010. });
  29011. };
  29012. const getWindowsInfo = () => platform_awaiter(void 0, void 0, void 0, function* () {
  29013. const { stdout: version } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"', undefined, {
  29014. silent: true
  29015. });
  29016. const { stdout: name } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"', undefined, {
  29017. silent: true
  29018. });
  29019. return {
  29020. name: name.trim(),
  29021. version: version.trim()
  29022. };
  29023. });
  29024. const getMacOsInfo = () => platform_awaiter(void 0, void 0, void 0, function* () {
  29025. var _a, _b, _c, _d;
  29026. const { stdout } = yield exec.getExecOutput('sw_vers', undefined, {
  29027. silent: true
  29028. });
  29029. const version = (_b = (_a = stdout.match(/ProductVersion:\s*(.+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
  29030. const name = (_d = (_c = stdout.match(/ProductName:\s*(.+)/)) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '';
  29031. return {
  29032. name,
  29033. version
  29034. };
  29035. });
  29036. const getLinuxInfo = () => platform_awaiter(void 0, void 0, void 0, function* () {
  29037. const { stdout } = yield exec.getExecOutput('lsb_release', ['-i', '-r', '-s'], {
  29038. silent: true
  29039. });
  29040. const [name, version] = stdout.trim().split('\n');
  29041. return {
  29042. name,
  29043. version
  29044. };
  29045. });
  29046. const platform = external_os_namespaceObject.platform();
  29047. const arch = external_os_namespaceObject.arch();
  29048. const isWindows = platform === 'win32';
  29049. const isMacOS = platform === 'darwin';
  29050. const isLinux = platform === 'linux';
  29051. function getDetails() {
  29052. return platform_awaiter(this, void 0, void 0, function* () {
  29053. return Object.assign(Object.assign({}, (yield (isWindows
  29054. ? getWindowsInfo()
  29055. : isMacOS
  29056. ? getMacOsInfo()
  29057. : getLinuxInfo()))), { platform,
  29058. arch,
  29059. isWindows,
  29060. isMacOS,
  29061. isLinux });
  29062. });
  29063. }
  29064. //# sourceMappingURL=platform.js.map
  29065. ;// CONCATENATED MODULE: ./node_modules/@actions/core/lib/core.js
  29066. var core_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  29067. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  29068. return new (P || (P = Promise))(function (resolve, reject) {
  29069. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  29070. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  29071. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  29072. step((generator = generator.apply(thisArg, _arguments || [])).next());
  29073. });
  29074. };
  29075. /**
  29076. * The code to exit an action
  29077. */
  29078. var ExitCode;
  29079. (function (ExitCode) {
  29080. /**
  29081. * A code indicating that the action was successful
  29082. */
  29083. ExitCode[ExitCode["Success"] = 0] = "Success";
  29084. /**
  29085. * A code indicating that the action was a failure
  29086. */
  29087. ExitCode[ExitCode["Failure"] = 1] = "Failure";
  29088. })(ExitCode || (ExitCode = {}));
  29089. //-----------------------------------------------------------------------
  29090. // Variables
  29091. //-----------------------------------------------------------------------
  29092. /**
  29093. * Sets env variable for this action and future actions in the job
  29094. * @param name the name of the variable to set
  29095. * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
  29096. */
  29097. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  29098. function exportVariable(name, val) {
  29099. const convertedVal = toCommandValue(val);
  29100. process.env[name] = convertedVal;
  29101. const filePath = process.env['GITHUB_ENV'] || '';
  29102. if (filePath) {
  29103. return issueFileCommand('ENV', prepareKeyValueMessage(name, val));
  29104. }
  29105. issueCommand('set-env', { name }, convertedVal);
  29106. }
  29107. /**
  29108. * Registers a secret which will get masked from logs
  29109. *
  29110. * @param secret - Value of the secret to be masked
  29111. * @remarks
  29112. * This function instructs the Actions runner to mask the specified value in any
  29113. * logs produced during the workflow run. Once registered, the secret value will
  29114. * be replaced with asterisks (***) whenever it appears in console output, logs,
  29115. * or error messages.
  29116. *
  29117. * This is useful for protecting sensitive information such as:
  29118. * - API keys
  29119. * - Access tokens
  29120. * - Authentication credentials
  29121. * - URL parameters containing signatures (SAS tokens)
  29122. *
  29123. * Note that masking only affects future logs; any previous appearances of the
  29124. * secret in logs before calling this function will remain unmasked.
  29125. *
  29126. * @example
  29127. * ```typescript
  29128. * // Register an API token as a secret
  29129. * const apiToken = "abc123xyz456";
  29130. * setSecret(apiToken);
  29131. *
  29132. * // Now any logs containing this value will show *** instead
  29133. * console.log(`Using token: ${apiToken}`); // Outputs: "Using token: ***"
  29134. * ```
  29135. */
  29136. function core_setSecret(secret) {
  29137. command_issueCommand('add-mask', {}, secret);
  29138. }
  29139. /**
  29140. * Prepends inputPath to the PATH (for this action and future actions)
  29141. * @param inputPath
  29142. */
  29143. function addPath(inputPath) {
  29144. const filePath = process.env['GITHUB_PATH'] || '';
  29145. if (filePath) {
  29146. issueFileCommand('PATH', inputPath);
  29147. }
  29148. else {
  29149. issueCommand('add-path', {}, inputPath);
  29150. }
  29151. process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
  29152. }
  29153. /**
  29154. * Gets the value of an input.
  29155. * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
  29156. * Returns an empty string if the value is not defined.
  29157. *
  29158. * @param name name of the input to get
  29159. * @param options optional. See InputOptions.
  29160. * @returns string
  29161. */
  29162. function getInput(name, options) {
  29163. const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
  29164. if (options && options.required && !val) {
  29165. throw new Error(`Input required and not supplied: ${name}`);
  29166. }
  29167. if (options && options.trimWhitespace === false) {
  29168. return val;
  29169. }
  29170. return val.trim();
  29171. }
  29172. /**
  29173. * Gets the values of an multiline input. Each value is also trimmed.
  29174. *
  29175. * @param name name of the input to get
  29176. * @param options optional. See InputOptions.
  29177. * @returns string[]
  29178. *
  29179. */
  29180. function getMultilineInput(name, options) {
  29181. const inputs = getInput(name, options)
  29182. .split('\n')
  29183. .filter(x => x !== '');
  29184. if (options && options.trimWhitespace === false) {
  29185. return inputs;
  29186. }
  29187. return inputs.map(input => input.trim());
  29188. }
  29189. /**
  29190. * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
  29191. * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
  29192. * The return value is also in boolean type.
  29193. * ref: https://yaml.org/spec/1.2/spec.html#id2804923
  29194. *
  29195. * @param name name of the input to get
  29196. * @param options optional. See InputOptions.
  29197. * @returns boolean
  29198. */
  29199. function getBooleanInput(name, options) {
  29200. const trueValue = ['true', 'True', 'TRUE'];
  29201. const falseValue = ['false', 'False', 'FALSE'];
  29202. const val = getInput(name, options);
  29203. if (trueValue.includes(val))
  29204. return true;
  29205. if (falseValue.includes(val))
  29206. return false;
  29207. throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
  29208. `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
  29209. }
  29210. /**
  29211. * Sets the value of an output.
  29212. *
  29213. * @param name name of the output to set
  29214. * @param value value to store. Non-string values will be converted to a string via JSON.stringify
  29215. */
  29216. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  29217. function setOutput(name, value) {
  29218. const filePath = process.env['GITHUB_OUTPUT'] || '';
  29219. if (filePath) {
  29220. return file_command_issueFileCommand('OUTPUT', file_command_prepareKeyValueMessage(name, value));
  29221. }
  29222. process.stdout.write(external_os_namespaceObject.EOL);
  29223. command_issueCommand('set-output', { name }, utils_toCommandValue(value));
  29224. }
  29225. /**
  29226. * Enables or disables the echoing of commands into stdout for the rest of the step.
  29227. * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
  29228. *
  29229. */
  29230. function setCommandEcho(enabled) {
  29231. issue('echo', enabled ? 'on' : 'off');
  29232. }
  29233. //-----------------------------------------------------------------------
  29234. // Results
  29235. //-----------------------------------------------------------------------
  29236. /**
  29237. * Sets the action status to failed.
  29238. * When the action exits it will be with an exit code of 1
  29239. * @param message add error issue message
  29240. */
  29241. function setFailed(message) {
  29242. process.exitCode = ExitCode.Failure;
  29243. error(message);
  29244. }
  29245. //-----------------------------------------------------------------------
  29246. // Logging Commands
  29247. //-----------------------------------------------------------------------
  29248. /**
  29249. * Gets whether Actions Step Debug is on or not
  29250. */
  29251. function isDebug() {
  29252. return process.env['RUNNER_DEBUG'] === '1';
  29253. }
  29254. /**
  29255. * Writes debug message to user log
  29256. * @param message debug message
  29257. */
  29258. function core_debug(message) {
  29259. command_issueCommand('debug', {}, message);
  29260. }
  29261. /**
  29262. * Adds an error issue
  29263. * @param message error issue message. Errors will be converted to string via toString()
  29264. * @param properties optional properties to add to the annotation.
  29265. */
  29266. function error(message, properties = {}) {
  29267. command_issueCommand('error', utils_toCommandProperties(properties), message instanceof Error ? message.toString() : message);
  29268. }
  29269. /**
  29270. * Adds a warning issue
  29271. * @param message warning issue message. Errors will be converted to string via toString()
  29272. * @param properties optional properties to add to the annotation.
  29273. */
  29274. function warning(message, properties = {}) {
  29275. command_issueCommand('warning', utils_toCommandProperties(properties), message instanceof Error ? message.toString() : message);
  29276. }
  29277. /**
  29278. * Adds a notice issue
  29279. * @param message notice issue message. Errors will be converted to string via toString()
  29280. * @param properties optional properties to add to the annotation.
  29281. */
  29282. function notice(message, properties = {}) {
  29283. issueCommand('notice', toCommandProperties(properties), message instanceof Error ? message.toString() : message);
  29284. }
  29285. /**
  29286. * Writes info to log with console.log.
  29287. * @param message info message
  29288. */
  29289. function info(message) {
  29290. process.stdout.write(message + external_os_namespaceObject.EOL);
  29291. }
  29292. /**
  29293. * Begin an output group.
  29294. *
  29295. * Output until the next `groupEnd` will be foldable in this group
  29296. *
  29297. * @param name The name of the output group
  29298. */
  29299. function startGroup(name) {
  29300. command_issue('group', name);
  29301. }
  29302. /**
  29303. * End an output group.
  29304. */
  29305. function endGroup() {
  29306. command_issue('endgroup');
  29307. }
  29308. /**
  29309. * Wrap an asynchronous function call in a group.
  29310. *
  29311. * Returns the same type as the function itself.
  29312. *
  29313. * @param name The name of the group
  29314. * @param fn The function to wrap in the group
  29315. */
  29316. function group(name, fn) {
  29317. return core_awaiter(this, void 0, void 0, function* () {
  29318. startGroup(name);
  29319. let result;
  29320. try {
  29321. result = yield fn();
  29322. }
  29323. finally {
  29324. endGroup();
  29325. }
  29326. return result;
  29327. });
  29328. }
  29329. //-----------------------------------------------------------------------
  29330. // Wrapper action state
  29331. //-----------------------------------------------------------------------
  29332. /**
  29333. * Saves state for current action, the state can only be retrieved by this action's post job execution.
  29334. *
  29335. * @param name name of the state to store
  29336. * @param value value to store. Non-string values will be converted to a string via JSON.stringify
  29337. */
  29338. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  29339. function saveState(name, value) {
  29340. const filePath = process.env['GITHUB_STATE'] || '';
  29341. if (filePath) {
  29342. return file_command_issueFileCommand('STATE', file_command_prepareKeyValueMessage(name, value));
  29343. }
  29344. command_issueCommand('save-state', { name }, utils_toCommandValue(value));
  29345. }
  29346. /**
  29347. * Gets the value of an state set by this action's main execution.
  29348. *
  29349. * @param name name of the state to get
  29350. * @returns string
  29351. */
  29352. function getState(name) {
  29353. return process.env[`STATE_${name}`] || '';
  29354. }
  29355. function getIDToken(aud) {
  29356. return core_awaiter(this, void 0, void 0, function* () {
  29357. return yield OidcClient.getIDToken(aud);
  29358. });
  29359. }
  29360. /**
  29361. * Summary exports
  29362. */
  29363. /**
  29364. * @deprecated use core.summary
  29365. */
  29366. /**
  29367. * Path exports
  29368. */
  29369. /**
  29370. * Platform utilities exports
  29371. */
  29372. //# sourceMappingURL=core.js.map
  29373. ;// CONCATENATED MODULE: ./src/fs-helper.ts
  29374. function directoryExistsSync(path, required) {
  29375. if (!path) {
  29376. throw new Error("Arg 'path' must not be empty");
  29377. }
  29378. let stats;
  29379. try {
  29380. stats = external_fs_namespaceObject.statSync(path);
  29381. }
  29382. catch (error) {
  29383. if (error?.code === 'ENOENT') {
  29384. if (!required) {
  29385. return false;
  29386. }
  29387. throw new Error(`Directory '${path}' does not exist`);
  29388. }
  29389. throw new Error(`Encountered an error when checking whether path '${path}' exists: ${error?.message ?? error}`);
  29390. }
  29391. if (stats.isDirectory()) {
  29392. return true;
  29393. }
  29394. else if (!required) {
  29395. return false;
  29396. }
  29397. throw new Error(`Directory '${path}' does not exist`);
  29398. }
  29399. function existsSync(path) {
  29400. if (!path) {
  29401. throw new Error("Arg 'path' must not be empty");
  29402. }
  29403. try {
  29404. fs.statSync(path);
  29405. }
  29406. catch (error) {
  29407. if (error?.code === 'ENOENT') {
  29408. return false;
  29409. }
  29410. throw new Error(`Encountered an error when checking whether path '${path}' exists: ${error?.message ?? error}`);
  29411. }
  29412. return true;
  29413. }
  29414. function fileExistsSync(path) {
  29415. if (!path) {
  29416. throw new Error("Arg 'path' must not be empty");
  29417. }
  29418. let stats;
  29419. try {
  29420. stats = external_fs_namespaceObject.statSync(path);
  29421. }
  29422. catch (error) {
  29423. if (error?.code === 'ENOENT') {
  29424. return false;
  29425. }
  29426. throw new Error(`Encountered an error when checking whether path '${path}' exists: ${error?.message ?? error}`);
  29427. }
  29428. if (!stats.isDirectory()) {
  29429. return true;
  29430. }
  29431. return false;
  29432. }
  29433. ;// CONCATENATED MODULE: ./src/regexp-helper.ts
  29434. function regexp_helper_escape(value) {
  29435. return value.replace(/[^a-zA-Z0-9_]/g, x => {
  29436. return `\\${x}`;
  29437. });
  29438. }
  29439. ;// CONCATENATED MODULE: ./src/state-helper.ts
  29440. /**
  29441. * Indicates whether the POST action is running
  29442. */
  29443. const IsPost = !!getState('isPost');
  29444. /**
  29445. * The repository path for the POST action. The value is empty during the MAIN action.
  29446. */
  29447. const RepositoryPath = getState('repositoryPath');
  29448. /**
  29449. * The set-safe-directory for the POST action. The value is set if input: 'safe-directory' is set during the MAIN action.
  29450. */
  29451. const PostSetSafeDirectory = getState('setSafeDirectory') === 'true';
  29452. /**
  29453. * The SSH key path for the POST action. The value is empty during the MAIN action.
  29454. */
  29455. const SshKeyPath = getState('sshKeyPath');
  29456. /**
  29457. * The SSH known hosts path for the POST action. The value is empty during the MAIN action.
  29458. */
  29459. const SshKnownHostsPath = getState('sshKnownHostsPath');
  29460. /**
  29461. * Save the repository path so the POST action can retrieve the value.
  29462. */
  29463. function setRepositoryPath(repositoryPath) {
  29464. saveState('repositoryPath', repositoryPath);
  29465. }
  29466. /**
  29467. * Save the SSH key path so the POST action can retrieve the value.
  29468. */
  29469. function setSshKeyPath(sshKeyPath) {
  29470. saveState('sshKeyPath', sshKeyPath);
  29471. }
  29472. /**
  29473. * Save the SSH known hosts path so the POST action can retrieve the value.
  29474. */
  29475. function setSshKnownHostsPath(sshKnownHostsPath) {
  29476. saveState('sshKnownHostsPath', sshKnownHostsPath);
  29477. }
  29478. /**
  29479. * Save the set-safe-directory input so the POST action can retrieve the value.
  29480. */
  29481. function setSafeDirectory() {
  29482. saveState('setSafeDirectory', 'true');
  29483. }
  29484. // Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic.
  29485. // This is necessary since we don't have a separate entry point.
  29486. if (!IsPost) {
  29487. saveState('isPost', 'true');
  29488. }
  29489. ;// CONCATENATED MODULE: external "url"
  29490. const external_url_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("url");
  29491. ;// CONCATENATED MODULE: ./src/url-helper.ts
  29492. function getFetchUrl(settings) {
  29493. external_assert_.ok(settings.repositoryOwner, 'settings.repositoryOwner must be defined');
  29494. external_assert_.ok(settings.repositoryName, 'settings.repositoryName must be defined');
  29495. const serviceUrl = getServerUrl(settings.githubServerUrl);
  29496. const encodedOwner = encodeURIComponent(settings.repositoryOwner);
  29497. const encodedName = encodeURIComponent(settings.repositoryName);
  29498. if (settings.sshKey) {
  29499. const user = settings.sshUser.length > 0 ? settings.sshUser : 'git';
  29500. return `${user}@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
  29501. }
  29502. // "origin" is SCHEME://HOSTNAME[:PORT]
  29503. return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
  29504. }
  29505. function getServerUrl(url) {
  29506. let resolvedUrl = process.env['GITHUB_SERVER_URL'] || 'https://github.com';
  29507. if (hasContent(url, WhitespaceMode.Trim)) {
  29508. resolvedUrl = url;
  29509. }
  29510. return new external_url_namespaceObject.URL(resolvedUrl);
  29511. }
  29512. function getServerApiUrl(url) {
  29513. if (hasContent(url, WhitespaceMode.Trim)) {
  29514. let serverUrl = getServerUrl(url);
  29515. if (isGhes(url)) {
  29516. serverUrl.pathname = 'api/v3';
  29517. }
  29518. else {
  29519. serverUrl.hostname = 'api.' + serverUrl.hostname;
  29520. }
  29521. return pruneSuffix(serverUrl.toString(), '/');
  29522. }
  29523. return process.env['GITHUB_API_URL'] || 'https://api.github.com';
  29524. }
  29525. function isGhes(url) {
  29526. const ghUrl = new external_url_namespaceObject.URL(url || process.env['GITHUB_SERVER_URL'] || 'https://github.com');
  29527. const hostname = ghUrl.hostname.trimEnd().toUpperCase();
  29528. const isGitHubHost = hostname === 'GITHUB.COM';
  29529. const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
  29530. const isLocalHost = hostname.endsWith('.LOCALHOST');
  29531. return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
  29532. }
  29533. function pruneSuffix(text, suffix) {
  29534. if (hasContent(suffix, WhitespaceMode.Preserve) && text?.endsWith(suffix)) {
  29535. return text.substring(0, text.length - suffix.length);
  29536. }
  29537. return text;
  29538. }
  29539. var WhitespaceMode;
  29540. (function (WhitespaceMode) {
  29541. WhitespaceMode[WhitespaceMode["Trim"] = 0] = "Trim";
  29542. WhitespaceMode[WhitespaceMode["Preserve"] = 1] = "Preserve";
  29543. })(WhitespaceMode || (WhitespaceMode = {}));
  29544. function hasContent(text, whitespaceMode) {
  29545. let refinedText = text ?? '';
  29546. if (whitespaceMode == WhitespaceMode.Trim) {
  29547. refinedText = refinedText.trim();
  29548. }
  29549. return refinedText.length > 0;
  29550. }
  29551. ;// CONCATENATED MODULE: ./src/git-auth-helper.ts
  29552. const git_auth_helper_IS_WINDOWS = process.platform === 'win32';
  29553. const SSH_COMMAND_KEY = 'core.sshCommand';
  29554. function createAuthHelper(git, settings) {
  29555. return new GitAuthHelper(git, settings);
  29556. }
  29557. class GitAuthHelper {
  29558. git;
  29559. settings;
  29560. tokenConfigKey;
  29561. tokenConfigValue;
  29562. tokenPlaceholderConfigValue;
  29563. insteadOfKey;
  29564. insteadOfValues = [];
  29565. sshCommand = '';
  29566. sshKeyPath = '';
  29567. sshKnownHostsPath = '';
  29568. temporaryHomePath = '';
  29569. credentialsConfigPath = ''; // Path to separate credentials config file in RUNNER_TEMP
  29570. constructor(gitCommandManager, gitSourceSettings) {
  29571. this.git = gitCommandManager;
  29572. this.settings = gitSourceSettings || {};
  29573. // Token auth header
  29574. const serverUrl = getServerUrl(this.settings.githubServerUrl);
  29575. this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
  29576. const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
  29577. core_setSecret(basicCredential);
  29578. this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`;
  29579. this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`;
  29580. // Instead of SSH URL
  29581. this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf`; // "origin" is SCHEME://HOSTNAME[:PORT]
  29582. this.insteadOfValues.push(`git@${serverUrl.hostname}:`);
  29583. if (this.settings.workflowOrganizationId) {
  29584. this.insteadOfValues.push(`org-${this.settings.workflowOrganizationId}@github.com:`);
  29585. }
  29586. }
  29587. async configureAuth() {
  29588. // Remove possible previous values
  29589. await this.removeAuth();
  29590. // Configure new values
  29591. await this.configureSsh();
  29592. await this.configureToken();
  29593. }
  29594. async configureTempGlobalConfig() {
  29595. // Already setup global config
  29596. if (this.temporaryHomePath?.length > 0) {
  29597. return external_path_namespaceObject.join(this.temporaryHomePath, '.gitconfig');
  29598. }
  29599. // Create a temp home directory
  29600. const runnerTemp = process.env['RUNNER_TEMP'] || '';
  29601. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  29602. const uniqueId = (0,external_crypto_namespaceObject.randomUUID)();
  29603. this.temporaryHomePath = external_path_namespaceObject.join(runnerTemp, uniqueId);
  29604. await external_fs_namespaceObject.promises.mkdir(this.temporaryHomePath, { recursive: true });
  29605. // Copy the global git config
  29606. const gitConfigPath = external_path_namespaceObject.join(process.env['HOME'] || external_os_namespaceObject.homedir(), '.gitconfig');
  29607. const newGitConfigPath = external_path_namespaceObject.join(this.temporaryHomePath, '.gitconfig');
  29608. let configExists = false;
  29609. try {
  29610. await external_fs_namespaceObject.promises.stat(gitConfigPath);
  29611. configExists = true;
  29612. }
  29613. catch (err) {
  29614. if (err?.code !== 'ENOENT') {
  29615. throw err;
  29616. }
  29617. }
  29618. if (configExists) {
  29619. info(`Copying '${gitConfigPath}' to '${newGitConfigPath}'`);
  29620. await io_cp(gitConfigPath, newGitConfigPath);
  29621. }
  29622. else {
  29623. await external_fs_namespaceObject.promises.writeFile(newGitConfigPath, '');
  29624. }
  29625. // Override HOME
  29626. info(`Temporarily overriding HOME='${this.temporaryHomePath}' before making global git config changes`);
  29627. this.git.setEnvironmentVariable('HOME', this.temporaryHomePath);
  29628. return newGitConfigPath;
  29629. }
  29630. async configureGlobalAuth() {
  29631. // 'configureTempGlobalConfig' noops if already set, just returns the path
  29632. await this.configureTempGlobalConfig();
  29633. try {
  29634. // Configure the token
  29635. await this.configureToken(true);
  29636. // Configure HTTPS instead of SSH
  29637. await this.git.tryConfigUnset(this.insteadOfKey, true);
  29638. if (!this.settings.sshKey) {
  29639. for (const insteadOfValue of this.insteadOfValues) {
  29640. await this.git.config(this.insteadOfKey, insteadOfValue, true, // globalConfig?
  29641. true // add?
  29642. );
  29643. }
  29644. }
  29645. }
  29646. catch (err) {
  29647. // Unset in case somehow written to the real global config
  29648. info('Encountered an error when attempting to configure token. Attempting unconfigure.');
  29649. await this.git.tryConfigUnset(this.tokenConfigKey, true);
  29650. throw err;
  29651. }
  29652. }
  29653. async configureSubmoduleAuth() {
  29654. // Remove possible previous HTTPS instead of SSH
  29655. await this.removeSubmoduleGitConfig(this.insteadOfKey);
  29656. if (this.settings.persistCredentials) {
  29657. // Get the credentials config file path in RUNNER_TEMP
  29658. const credentialsConfigPath = this.getCredentialsConfigPath();
  29659. // Container credentials config path
  29660. const containerCredentialsPath = external_path_namespaceObject.posix.join('/github/runner_temp', external_path_namespaceObject.basename(credentialsConfigPath));
  29661. // Get submodule config file paths.
  29662. const configPaths = await this.git.getSubmoduleConfigPaths(this.settings.nestedSubmodules);
  29663. // For each submodule, configure includeIf entries pointing to the shared credentials file.
  29664. // Configure both host and container paths to support Docker container actions.
  29665. for (const configPath of configPaths) {
  29666. // Submodule Git directory
  29667. let submoduleGitDir = external_path_namespaceObject.dirname(configPath); // The config file is at .git/modules/submodule-name/config
  29668. submoduleGitDir = submoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  29669. // Configure host includeIf
  29670. await this.git.config(`includeIf.gitdir:${submoduleGitDir}.path`, credentialsConfigPath, false, // globalConfig?
  29671. false, // add?
  29672. configPath);
  29673. // Container submodule git directory
  29674. const githubWorkspace = process.env['GITHUB_WORKSPACE'];
  29675. external_assert_.ok(githubWorkspace, 'GITHUB_WORKSPACE is not defined');
  29676. let relativeSubmoduleGitDir = external_path_namespaceObject.relative(githubWorkspace, submoduleGitDir);
  29677. relativeSubmoduleGitDir = relativeSubmoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  29678. const containerSubmoduleGitDir = external_path_namespaceObject.posix.join('/github/workspace', relativeSubmoduleGitDir);
  29679. // Configure container includeIf
  29680. await this.git.config(`includeIf.gitdir:${containerSubmoduleGitDir}.path`, containerCredentialsPath, false, // globalConfig?
  29681. false, // add?
  29682. configPath);
  29683. }
  29684. if (this.settings.sshKey) {
  29685. // Configure core.sshCommand
  29686. await this.git.submoduleForeach(`git config --local '${SSH_COMMAND_KEY}' '${this.sshCommand}'`, this.settings.nestedSubmodules);
  29687. }
  29688. else {
  29689. // Configure HTTPS instead of SSH
  29690. for (const insteadOfValue of this.insteadOfValues) {
  29691. await this.git.submoduleForeach(`git config --local --add '${this.insteadOfKey}' '${insteadOfValue}'`, this.settings.nestedSubmodules);
  29692. }
  29693. }
  29694. }
  29695. }
  29696. async removeAuth() {
  29697. await this.removeSsh();
  29698. await this.removeToken();
  29699. }
  29700. async removeGlobalConfig() {
  29701. if (this.temporaryHomePath?.length > 0) {
  29702. core_debug(`Unsetting HOME override`);
  29703. this.git.removeEnvironmentVariable('HOME');
  29704. await rmRF(this.temporaryHomePath);
  29705. }
  29706. }
  29707. /**
  29708. * Configures SSH authentication by writing the SSH key and known hosts,
  29709. * and setting up the GIT_SSH_COMMAND environment variable.
  29710. */
  29711. async configureSsh() {
  29712. if (!this.settings.sshKey) {
  29713. return;
  29714. }
  29715. // Write key
  29716. const runnerTemp = process.env['RUNNER_TEMP'] || '';
  29717. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  29718. const uniqueId = (0,external_crypto_namespaceObject.randomUUID)();
  29719. this.sshKeyPath = external_path_namespaceObject.join(runnerTemp, uniqueId);
  29720. setSshKeyPath(this.sshKeyPath);
  29721. await external_fs_namespaceObject.promises.mkdir(runnerTemp, { recursive: true });
  29722. await external_fs_namespaceObject.promises.writeFile(this.sshKeyPath, this.settings.sshKey.trim() + '\n', { mode: 0o600 });
  29723. // Remove inherited permissions on Windows
  29724. if (git_auth_helper_IS_WINDOWS) {
  29725. const icacls = await which('icacls.exe');
  29726. await exec_exec(`"${icacls}" "${this.sshKeyPath}" /grant:r "${process.env['USERDOMAIN']}\\${process.env['USERNAME']}:F"`);
  29727. await exec_exec(`"${icacls}" "${this.sshKeyPath}" /inheritance:r`);
  29728. }
  29729. // Write known hosts
  29730. const userKnownHostsPath = external_path_namespaceObject.join(external_os_namespaceObject.homedir(), '.ssh', 'known_hosts');
  29731. let userKnownHosts = '';
  29732. try {
  29733. userKnownHosts = (await external_fs_namespaceObject.promises.readFile(userKnownHostsPath)).toString();
  29734. }
  29735. catch (err) {
  29736. if (err?.code !== 'ENOENT') {
  29737. throw err;
  29738. }
  29739. }
  29740. let knownHosts = '';
  29741. if (userKnownHosts) {
  29742. knownHosts += `# Begin from ${userKnownHostsPath}\n${userKnownHosts}\n# End from ${userKnownHostsPath}\n`;
  29743. }
  29744. if (this.settings.sshKnownHosts) {
  29745. knownHosts += `# Begin from input known hosts\n${this.settings.sshKnownHosts}\n# end from input known hosts\n`;
  29746. }
  29747. 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`;
  29748. this.sshKnownHostsPath = external_path_namespaceObject.join(runnerTemp, `${uniqueId}_known_hosts`);
  29749. setSshKnownHostsPath(this.sshKnownHostsPath);
  29750. await external_fs_namespaceObject.promises.writeFile(this.sshKnownHostsPath, knownHosts);
  29751. // Configure GIT_SSH_COMMAND
  29752. const sshPath = await which('ssh', true);
  29753. this.sshCommand = `"${sshPath}" -i "$RUNNER_TEMP/${external_path_namespaceObject.basename(this.sshKeyPath)}"`;
  29754. if (this.settings.sshStrict) {
  29755. this.sshCommand += ' -o StrictHostKeyChecking=yes -o CheckHostIP=no';
  29756. }
  29757. this.sshCommand += ` -o "UserKnownHostsFile=$RUNNER_TEMP/${external_path_namespaceObject.basename(this.sshKnownHostsPath)}"`;
  29758. info(`Temporarily overriding GIT_SSH_COMMAND=${this.sshCommand}`);
  29759. this.git.setEnvironmentVariable('GIT_SSH_COMMAND', this.sshCommand);
  29760. // Configure core.sshCommand
  29761. if (this.settings.persistCredentials) {
  29762. await this.git.config(SSH_COMMAND_KEY, this.sshCommand);
  29763. }
  29764. }
  29765. /**
  29766. * Configures token-based authentication by creating a credentials config file
  29767. * and setting up includeIf entries to reference it.
  29768. * @param globalConfig Whether to configure global config instead of local
  29769. */
  29770. async configureToken(globalConfig) {
  29771. // Get the credentials config file path in RUNNER_TEMP
  29772. const credentialsConfigPath = this.getCredentialsConfigPath();
  29773. // Write placeholder to the separate credentials config file using git config.
  29774. // This approach avoids the credential being captured by process creation audit events,
  29775. // which are commonly logged. For more information, refer to
  29776. // https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
  29777. await this.git.config(this.tokenConfigKey, this.tokenPlaceholderConfigValue, false, // globalConfig?
  29778. false, // add?
  29779. credentialsConfigPath);
  29780. // Replace the placeholder in the credentials config file
  29781. let content = (await external_fs_namespaceObject.promises.readFile(credentialsConfigPath)).toString();
  29782. const placeholderIndex = content.indexOf(this.tokenPlaceholderConfigValue);
  29783. if (placeholderIndex < 0 ||
  29784. placeholderIndex != content.lastIndexOf(this.tokenPlaceholderConfigValue)) {
  29785. throw new Error(`Unable to replace auth placeholder in ${credentialsConfigPath}`);
  29786. }
  29787. external_assert_.ok(this.tokenConfigValue, 'tokenConfigValue is not defined');
  29788. content = content.replace(this.tokenPlaceholderConfigValue, this.tokenConfigValue);
  29789. await external_fs_namespaceObject.promises.writeFile(credentialsConfigPath, content);
  29790. // Add include or includeIf to reference the credentials config
  29791. if (globalConfig) {
  29792. // Global config file is temporary
  29793. await this.git.config('include.path', credentialsConfigPath, true // globalConfig?
  29794. );
  29795. }
  29796. else {
  29797. // Host git directory
  29798. let gitDir = external_path_namespaceObject.join(this.git.getWorkingDirectory(), '.git');
  29799. gitDir = gitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  29800. // Configure host includeIf
  29801. const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`;
  29802. await this.git.config(hostIncludeKey, credentialsConfigPath);
  29803. // Configure host includeIf for worktrees
  29804. const hostWorktreeIncludeKey = `includeIf.gitdir:${gitDir}/worktrees/*.path`;
  29805. await this.git.config(hostWorktreeIncludeKey, credentialsConfigPath);
  29806. // Container git directory
  29807. const workingDirectory = this.git.getWorkingDirectory();
  29808. const githubWorkspace = process.env['GITHUB_WORKSPACE'];
  29809. external_assert_.ok(githubWorkspace, 'GITHUB_WORKSPACE is not defined');
  29810. let relativePath = external_path_namespaceObject.relative(githubWorkspace, workingDirectory);
  29811. relativePath = relativePath.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  29812. const containerGitDir = external_path_namespaceObject.posix.join('/github/workspace', relativePath, '.git');
  29813. // Container credentials config path
  29814. const containerCredentialsPath = external_path_namespaceObject.posix.join('/github/runner_temp', external_path_namespaceObject.basename(credentialsConfigPath));
  29815. // Configure container includeIf
  29816. const containerIncludeKey = `includeIf.gitdir:${containerGitDir}.path`;
  29817. await this.git.config(containerIncludeKey, containerCredentialsPath);
  29818. // Configure container includeIf for worktrees
  29819. const containerWorktreeIncludeKey = `includeIf.gitdir:${containerGitDir}/worktrees/*.path`;
  29820. await this.git.config(containerWorktreeIncludeKey, containerCredentialsPath);
  29821. }
  29822. }
  29823. /**
  29824. * Gets or creates the path to the credentials config file in RUNNER_TEMP.
  29825. * @returns The absolute path to the credentials config file
  29826. */
  29827. getCredentialsConfigPath() {
  29828. if (this.credentialsConfigPath) {
  29829. return this.credentialsConfigPath;
  29830. }
  29831. const runnerTemp = process.env['RUNNER_TEMP'] || '';
  29832. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  29833. // Create a unique filename for this checkout instance
  29834. const configFileName = `git-credentials-${(0,external_crypto_namespaceObject.randomUUID)()}.config`;
  29835. this.credentialsConfigPath = external_path_namespaceObject.join(runnerTemp, configFileName);
  29836. core_debug(`Credentials config path: ${this.credentialsConfigPath}`);
  29837. return this.credentialsConfigPath;
  29838. }
  29839. /**
  29840. * Removes SSH authentication configuration by cleaning up SSH keys,
  29841. * known hosts files, and SSH command configurations.
  29842. */
  29843. async removeSsh() {
  29844. // SSH key
  29845. const keyPath = this.sshKeyPath || SshKeyPath;
  29846. if (keyPath) {
  29847. try {
  29848. info(`Removing SSH key '${keyPath}'`);
  29849. await rmRF(keyPath);
  29850. }
  29851. catch (err) {
  29852. core_debug(`${err?.message ?? err}`);
  29853. warning(`Failed to remove SSH key '${keyPath}'`);
  29854. }
  29855. }
  29856. // SSH known hosts
  29857. const knownHostsPath = this.sshKnownHostsPath || SshKnownHostsPath;
  29858. if (knownHostsPath) {
  29859. try {
  29860. info(`Removing SSH known hosts '${knownHostsPath}'`);
  29861. await rmRF(knownHostsPath);
  29862. }
  29863. catch (err) {
  29864. core_debug(`${err?.message ?? err}`);
  29865. warning(`Failed to remove SSH known hosts '${knownHostsPath}'`);
  29866. }
  29867. }
  29868. // SSH command
  29869. info('Removing SSH command configuration');
  29870. await this.removeGitConfig(SSH_COMMAND_KEY);
  29871. await this.removeSubmoduleGitConfig(SSH_COMMAND_KEY);
  29872. }
  29873. /**
  29874. * Removes token-based authentication by cleaning up HTTP headers,
  29875. * includeIf entries, and credentials config files.
  29876. */
  29877. async removeToken() {
  29878. // Remove HTTP extra header
  29879. info('Removing HTTP extra header');
  29880. await this.removeGitConfig(this.tokenConfigKey);
  29881. await this.removeSubmoduleGitConfig(this.tokenConfigKey);
  29882. // Collect credentials config paths that need to be removed
  29883. const credentialsPaths = new Set();
  29884. // Remove includeIf entries that point to git-credentials-*.config files
  29885. info('Removing includeIf entries pointing to credentials config files');
  29886. const mainCredentialsPaths = await this.removeIncludeIfCredentials();
  29887. mainCredentialsPaths.forEach(path => credentialsPaths.add(path));
  29888. // Remove submodule includeIf entries that point to git-credentials-*.config files
  29889. const submoduleConfigPaths = await this.git.getSubmoduleConfigPaths(true);
  29890. for (const configPath of submoduleConfigPaths) {
  29891. const submoduleCredentialsPaths = await this.removeIncludeIfCredentials(configPath);
  29892. submoduleCredentialsPaths.forEach(path => credentialsPaths.add(path));
  29893. }
  29894. // Remove credentials config files
  29895. for (const credentialsPath of credentialsPaths) {
  29896. // Only remove credentials config files if they are under RUNNER_TEMP
  29897. const runnerTemp = process.env['RUNNER_TEMP'];
  29898. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  29899. if (credentialsPath.startsWith(runnerTemp)) {
  29900. try {
  29901. info(`Removing credentials config '${credentialsPath}'`);
  29902. await rmRF(credentialsPath);
  29903. }
  29904. catch (err) {
  29905. core_debug(`${err?.message ?? err}`);
  29906. warning(`Failed to remove credentials config '${credentialsPath}'`);
  29907. }
  29908. }
  29909. else {
  29910. core_debug(`Skipping removal of credentials config '${credentialsPath}' - not under RUNNER_TEMP`);
  29911. }
  29912. }
  29913. }
  29914. /**
  29915. * Removes a git config key from the local repository config.
  29916. * @param configKey The git config key to remove
  29917. */
  29918. async removeGitConfig(configKey) {
  29919. if ((await this.git.configExists(configKey)) &&
  29920. !(await this.git.tryConfigUnset(configKey))) {
  29921. // Load the config contents
  29922. warning(`Failed to remove '${configKey}' from the git config`);
  29923. }
  29924. }
  29925. /**
  29926. * Removes a git config key from all submodule configs.
  29927. * @param configKey The git config key to remove
  29928. */
  29929. async removeSubmoduleGitConfig(configKey) {
  29930. const pattern = regexp_helper_escape(configKey);
  29931. await this.git.submoduleForeach(
  29932. // Wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline.
  29933. `sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, true);
  29934. }
  29935. /**
  29936. * Removes includeIf entries that point to git-credentials-*.config files.
  29937. * @param configPath Optional path to a specific git config file to operate on
  29938. * @returns Array of unique credentials config file paths that were found and removed
  29939. */
  29940. async removeIncludeIfCredentials(configPath) {
  29941. const credentialsPaths = new Set();
  29942. try {
  29943. // Get all includeIf.gitdir keys
  29944. const keys = await this.git.tryGetConfigKeys('^includeIf\\.gitdir:', false, // globalConfig?
  29945. configPath);
  29946. for (const key of keys) {
  29947. // Get all values for this key
  29948. const values = await this.git.tryGetConfigValues(key, false, // globalConfig?
  29949. configPath);
  29950. if (values.length > 0) {
  29951. // Remove only values that match git-credentials-<uuid>.config pattern
  29952. for (const value of values) {
  29953. if (this.testCredentialsConfigPath(value)) {
  29954. credentialsPaths.add(value);
  29955. await this.git.tryConfigUnsetValue(key, value, false, configPath);
  29956. }
  29957. }
  29958. }
  29959. }
  29960. }
  29961. catch (err) {
  29962. // Ignore errors - this is cleanup code
  29963. if (configPath) {
  29964. core_debug(`Error during includeIf cleanup for ${configPath}: ${err}`);
  29965. }
  29966. else {
  29967. core_debug(`Error during includeIf cleanup: ${err}`);
  29968. }
  29969. }
  29970. return Array.from(credentialsPaths);
  29971. }
  29972. /**
  29973. * Tests if a path matches the git-credentials-*.config pattern.
  29974. * @param path The path to test
  29975. * @returns True if the path matches the credentials config pattern
  29976. */
  29977. testCredentialsConfigPath(path) {
  29978. return /git-credentials-[0-9a-f-]+\.config$/i.test(path);
  29979. }
  29980. }
  29981. ;// CONCATENATED MODULE: ./src/retry-helper.ts
  29982. const defaultMaxAttempts = 3;
  29983. const defaultMinSeconds = 10;
  29984. const defaultMaxSeconds = 20;
  29985. class retry_helper_RetryHelper {
  29986. maxAttempts;
  29987. minSeconds;
  29988. maxSeconds;
  29989. constructor(maxAttempts = defaultMaxAttempts, minSeconds = defaultMinSeconds, maxSeconds = defaultMaxSeconds) {
  29990. this.maxAttempts = maxAttempts;
  29991. this.minSeconds = Math.floor(minSeconds);
  29992. this.maxSeconds = Math.floor(maxSeconds);
  29993. if (this.minSeconds > this.maxSeconds) {
  29994. throw new Error('min seconds should be less than or equal to max seconds');
  29995. }
  29996. }
  29997. async execute(action) {
  29998. let attempt = 1;
  29999. while (attempt < this.maxAttempts) {
  30000. // Try
  30001. try {
  30002. return await action();
  30003. }
  30004. catch (err) {
  30005. info(err?.message);
  30006. }
  30007. // Sleep
  30008. const seconds = this.getSleepAmount();
  30009. info(`Waiting ${seconds} seconds before trying again`);
  30010. await this.sleep(seconds);
  30011. attempt++;
  30012. }
  30013. // Last attempt
  30014. return await action();
  30015. }
  30016. getSleepAmount() {
  30017. return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
  30018. this.minSeconds);
  30019. }
  30020. async sleep(seconds) {
  30021. return new Promise(resolve => setTimeout(resolve, seconds * 1000));
  30022. }
  30023. }
  30024. async function execute(action) {
  30025. const retryHelper = new retry_helper_RetryHelper();
  30026. return await retryHelper.execute(action);
  30027. }
  30028. ;// CONCATENATED MODULE: ./src/git-version.ts
  30029. class GitVersion {
  30030. major = NaN;
  30031. minor = NaN;
  30032. patch = NaN;
  30033. /**
  30034. * Used for comparing the version of git and git-lfs against the minimum required version
  30035. * @param version the version string, e.g. 1.2 or 1.2.3
  30036. */
  30037. constructor(version) {
  30038. if (version) {
  30039. const match = version.match(/^(\d+)\.(\d+)(\.(\d+))?$/);
  30040. if (match) {
  30041. this.major = Number(match[1]);
  30042. this.minor = Number(match[2]);
  30043. if (match[4]) {
  30044. this.patch = Number(match[4]);
  30045. }
  30046. }
  30047. }
  30048. }
  30049. /**
  30050. * Compares the instance against a minimum required version
  30051. * @param minimum Minimum version
  30052. */
  30053. checkMinimum(minimum) {
  30054. if (!minimum.isValid()) {
  30055. throw new Error('Arg minimum is not a valid version');
  30056. }
  30057. // Major is insufficient
  30058. if (this.major < minimum.major) {
  30059. return false;
  30060. }
  30061. // Major is equal
  30062. if (this.major === minimum.major) {
  30063. // Minor is insufficient
  30064. if (this.minor < minimum.minor) {
  30065. return false;
  30066. }
  30067. // Minor is equal
  30068. if (this.minor === minimum.minor) {
  30069. // Patch is insufficient
  30070. if (this.patch && this.patch < (minimum.patch || 0)) {
  30071. return false;
  30072. }
  30073. }
  30074. }
  30075. return true;
  30076. }
  30077. /**
  30078. * Indicates whether the instance was constructed from a valid version string
  30079. */
  30080. isValid() {
  30081. return !isNaN(this.major);
  30082. }
  30083. /**
  30084. * Returns the version as a string, e.g. 1.2 or 1.2.3
  30085. */
  30086. toString() {
  30087. let result = '';
  30088. if (this.isValid()) {
  30089. result = `${this.major}.${this.minor}`;
  30090. if (!isNaN(this.patch)) {
  30091. result += `.${this.patch}`;
  30092. }
  30093. }
  30094. return result;
  30095. }
  30096. }
  30097. ;// CONCATENATED MODULE: ./src/git-command-manager.ts
  30098. // Auth header not supported before 2.9
  30099. // Wire protocol v2 not supported before 2.18
  30100. // sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
  30101. const MinimumGitVersion = new GitVersion('2.18');
  30102. const MinimumGitSparseCheckoutVersion = new GitVersion('2.28');
  30103. async function createCommandManager(workingDirectory, lfs, doSparseCheckout) {
  30104. return await GitCommandManager.createCommandManager(workingDirectory, lfs, doSparseCheckout);
  30105. }
  30106. class GitCommandManager {
  30107. gitEnv = {
  30108. GIT_TERMINAL_PROMPT: '0', // Disable git prompt
  30109. GCM_INTERACTIVE: 'Never' // Disable prompting for git credential manager
  30110. };
  30111. gitPath = '';
  30112. lfs = false;
  30113. doSparseCheckout = false;
  30114. workingDirectory = '';
  30115. gitVersion = new GitVersion();
  30116. // Private constructor; use createCommandManager()
  30117. constructor() { }
  30118. async branchDelete(remote, branch) {
  30119. const args = ['branch', '--delete', '--force'];
  30120. if (remote) {
  30121. args.push('--remote');
  30122. }
  30123. args.push(branch);
  30124. await this.execGit(args);
  30125. }
  30126. async branchExists(remote, pattern) {
  30127. const args = ['branch', '--list'];
  30128. if (remote) {
  30129. args.push('--remote');
  30130. }
  30131. args.push(pattern);
  30132. const output = await this.execGit(args);
  30133. return !!output.stdout.trim();
  30134. }
  30135. async branchList(remote) {
  30136. const result = [];
  30137. // Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
  30138. // "branch --list" is more difficult when in a detached HEAD state.
  30139. // TODO(https://github.com/actions/checkout/issues/786): this implementation uses
  30140. // "rev-parse --symbolic-full-name" because there is a bug
  30141. // in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names. When
  30142. // 2.18 is no longer supported, we can switch back to --symbolic.
  30143. const args = ['rev-parse', '--symbolic-full-name'];
  30144. if (remote) {
  30145. args.push('--remotes=origin');
  30146. }
  30147. else {
  30148. args.push('--branches');
  30149. }
  30150. const stderr = [];
  30151. const errline = [];
  30152. const stdout = [];
  30153. const stdline = [];
  30154. const listeners = {
  30155. stderr: (data) => {
  30156. stderr.push(data.toString());
  30157. },
  30158. errline: (data) => {
  30159. errline.push(data.toString());
  30160. },
  30161. stdout: (data) => {
  30162. stdout.push(data.toString());
  30163. },
  30164. stdline: (data) => {
  30165. stdline.push(data.toString());
  30166. }
  30167. };
  30168. // Suppress the output in order to avoid flooding annotations with innocuous errors.
  30169. await this.execGit(args, false, true, listeners);
  30170. core_debug(`stderr callback is: ${stderr}`);
  30171. core_debug(`errline callback is: ${errline}`);
  30172. core_debug(`stdout callback is: ${stdout}`);
  30173. core_debug(`stdline callback is: ${stdline}`);
  30174. for (let branch of stdline) {
  30175. branch = branch.trim();
  30176. if (!branch) {
  30177. continue;
  30178. }
  30179. if (branch.startsWith('refs/heads/')) {
  30180. branch = branch.substring('refs/heads/'.length);
  30181. }
  30182. else if (branch.startsWith('refs/remotes/')) {
  30183. branch = branch.substring('refs/remotes/'.length);
  30184. }
  30185. result.push(branch);
  30186. }
  30187. return result;
  30188. }
  30189. async disableSparseCheckout() {
  30190. await this.execGit(['sparse-checkout', 'disable']);
  30191. // Disabling 'sparse-checkout` leaves behind an undesirable side-effect in config (even in a pristine environment).
  30192. await this.tryConfigUnset('extensions.worktreeConfig', false);
  30193. }
  30194. async sparseCheckout(sparseCheckout) {
  30195. await this.execGit(['sparse-checkout', 'set', ...sparseCheckout]);
  30196. }
  30197. async sparseCheckoutNonConeMode(sparseCheckout) {
  30198. await this.execGit(['config', 'core.sparseCheckout', 'true']);
  30199. const output = await this.execGit([
  30200. 'rev-parse',
  30201. '--git-path',
  30202. 'info/sparse-checkout'
  30203. ]);
  30204. const sparseCheckoutPath = external_path_namespaceObject.join(this.workingDirectory, output.stdout.trimRight());
  30205. await external_fs_namespaceObject.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
  30206. }
  30207. async checkout(ref, startPoint) {
  30208. const args = ['checkout', '--progress', '--force'];
  30209. if (startPoint) {
  30210. args.push('-B', ref, startPoint);
  30211. }
  30212. else {
  30213. args.push(ref);
  30214. }
  30215. await this.execGit(args);
  30216. }
  30217. async checkoutDetach() {
  30218. const args = ['checkout', '--detach'];
  30219. await this.execGit(args);
  30220. }
  30221. async config(configKey, configValue, globalConfig, add, configFile) {
  30222. const args = ['config'];
  30223. if (configFile) {
  30224. args.push('--file', configFile);
  30225. }
  30226. else {
  30227. args.push(globalConfig ? '--global' : '--local');
  30228. }
  30229. if (add) {
  30230. args.push('--add');
  30231. }
  30232. args.push(...[configKey, configValue]);
  30233. await this.execGit(args);
  30234. }
  30235. async configExists(configKey, globalConfig) {
  30236. const pattern = regexp_helper_escape(configKey);
  30237. const output = await this.execGit([
  30238. 'config',
  30239. globalConfig ? '--global' : '--local',
  30240. '--name-only',
  30241. '--get-regexp',
  30242. pattern
  30243. ], true);
  30244. return output.exitCode === 0;
  30245. }
  30246. async fetch(refSpec, options) {
  30247. const args = ['-c', 'protocol.version=2', 'fetch'];
  30248. // Always use --no-tags for explicit control over tag fetching
  30249. // Tags are fetched explicitly via refspec when needed
  30250. args.push('--no-tags');
  30251. args.push('--prune', '--no-recurse-submodules');
  30252. if (options.showProgress) {
  30253. args.push('--progress');
  30254. }
  30255. if (options.filter) {
  30256. args.push(`--filter=${options.filter}`);
  30257. }
  30258. if (options.fetchDepth && options.fetchDepth > 0) {
  30259. args.push(`--depth=${options.fetchDepth}`);
  30260. }
  30261. else if (fileExistsSync(external_path_namespaceObject.join(this.workingDirectory, '.git', 'shallow'))) {
  30262. args.push('--unshallow');
  30263. }
  30264. args.push('origin');
  30265. for (const arg of refSpec) {
  30266. args.push(arg);
  30267. }
  30268. const that = this;
  30269. await execute(async () => {
  30270. await that.execGit(args);
  30271. });
  30272. }
  30273. async getDefaultBranch(repositoryUrl) {
  30274. let output;
  30275. await execute(async () => {
  30276. output = await this.execGit([
  30277. 'ls-remote',
  30278. '--quiet',
  30279. '--exit-code',
  30280. '--symref',
  30281. repositoryUrl,
  30282. 'HEAD'
  30283. ]);
  30284. });
  30285. if (output) {
  30286. // Satisfy compiler, will always be set
  30287. for (let line of output.stdout.trim().split('\n')) {
  30288. line = line.trim();
  30289. if (line.startsWith('ref:') || line.endsWith('HEAD')) {
  30290. return line
  30291. .substr('ref:'.length, line.length - 'ref:'.length - 'HEAD'.length)
  30292. .trim();
  30293. }
  30294. }
  30295. }
  30296. throw new Error('Unexpected output when retrieving default branch');
  30297. }
  30298. async getSubmoduleConfigPaths(recursive) {
  30299. // Get submodule config file paths.
  30300. // Use `--show-origin` to get the config file path for each submodule.
  30301. const output = await this.submoduleForeach(`git config --local --show-origin --name-only --get-regexp remote.origin.url`, recursive);
  30302. // Extract config file paths from the output (lines starting with "file:").
  30303. const configPaths = output.match(/(?<=(^|\n)file:)[^\t]+(?=\tremote\.origin\.url)/g) || [];
  30304. return configPaths;
  30305. }
  30306. getWorkingDirectory() {
  30307. return this.workingDirectory;
  30308. }
  30309. async init(objectFormat) {
  30310. const args = ['init'];
  30311. if (objectFormat === 'sha256') {
  30312. args.push('--object-format=sha256');
  30313. }
  30314. args.push(this.workingDirectory);
  30315. await this.execGit(args);
  30316. }
  30317. async isDetached() {
  30318. // Note, "branch --show-current" would be simpler but isn't available until Git 2.22
  30319. const output = await this.execGit(['rev-parse', '--symbolic-full-name', '--verify', '--quiet', 'HEAD'], true);
  30320. return !output.stdout.trim().startsWith('refs/heads/');
  30321. }
  30322. async lfsFetch(ref) {
  30323. const args = ['lfs', 'fetch', 'origin', ref];
  30324. const that = this;
  30325. await execute(async () => {
  30326. await that.execGit(args);
  30327. });
  30328. }
  30329. async lfsInstall() {
  30330. await this.execGit(['lfs', 'install', '--local']);
  30331. }
  30332. async log1(format) {
  30333. const args = format ? ['log', '-1', format] : ['log', '-1'];
  30334. const silent = format ? false : true;
  30335. const output = await this.execGit(args, false, silent);
  30336. return output.stdout;
  30337. }
  30338. async remoteAdd(remoteName, remoteUrl) {
  30339. await this.execGit(['remote', 'add', remoteName, remoteUrl]);
  30340. }
  30341. removeEnvironmentVariable(name) {
  30342. delete this.gitEnv[name];
  30343. }
  30344. /**
  30345. * Resolves a ref to a SHA. For a branch or lightweight tag, the commit SHA is returned.
  30346. * For an annotated tag, the tag SHA is returned.
  30347. * @param {string} ref For example: 'refs/heads/main' or '/refs/tags/v1'
  30348. * @returns {Promise<string>}
  30349. */
  30350. async revParse(ref) {
  30351. const output = await this.execGit(['rev-parse', ref]);
  30352. return output.stdout.trim();
  30353. }
  30354. setEnvironmentVariable(name, value) {
  30355. this.gitEnv[name] = value;
  30356. }
  30357. async shaExists(sha) {
  30358. const args = ['rev-parse', '--verify', '--quiet', `${sha}^{object}`];
  30359. const output = await this.execGit(args, true);
  30360. return output.exitCode === 0;
  30361. }
  30362. async submoduleForeach(command, recursive) {
  30363. const args = ['submodule', 'foreach'];
  30364. if (recursive) {
  30365. args.push('--recursive');
  30366. }
  30367. args.push(command);
  30368. const output = await this.execGit(args);
  30369. return output.stdout;
  30370. }
  30371. async submoduleSync(recursive) {
  30372. const args = ['submodule', 'sync'];
  30373. if (recursive) {
  30374. args.push('--recursive');
  30375. }
  30376. await this.execGit(args);
  30377. }
  30378. async submoduleUpdate(fetchDepth, recursive) {
  30379. const args = ['-c', 'protocol.version=2'];
  30380. args.push('submodule', 'update', '--init', '--force');
  30381. if (fetchDepth > 0) {
  30382. args.push(`--depth=${fetchDepth}`);
  30383. }
  30384. if (recursive) {
  30385. args.push('--recursive');
  30386. }
  30387. await this.execGit(args);
  30388. }
  30389. async submoduleStatus() {
  30390. const output = await this.execGit(['submodule', 'status'], true);
  30391. core_debug(output.stdout);
  30392. return output.exitCode === 0;
  30393. }
  30394. async tagExists(pattern) {
  30395. const output = await this.execGit(['tag', '--list', pattern]);
  30396. return !!output.stdout.trim();
  30397. }
  30398. async tryClean() {
  30399. const output = await this.execGit(['clean', '-ffdx'], true);
  30400. return output.exitCode === 0;
  30401. }
  30402. async tryConfigUnset(configKey, globalConfig) {
  30403. const output = await this.execGit([
  30404. 'config',
  30405. globalConfig ? '--global' : '--local',
  30406. '--unset-all',
  30407. configKey
  30408. ], true);
  30409. return output.exitCode === 0;
  30410. }
  30411. async tryConfigUnsetValue(configKey, configValue, globalConfig, configFile) {
  30412. const args = ['config'];
  30413. if (configFile) {
  30414. args.push('--file', configFile);
  30415. }
  30416. else {
  30417. args.push(globalConfig ? '--global' : '--local');
  30418. }
  30419. args.push('--unset', configKey, configValue);
  30420. const output = await this.execGit(args, true);
  30421. return output.exitCode === 0;
  30422. }
  30423. async tryDisableAutomaticGarbageCollection() {
  30424. const output = await this.execGit(['config', '--local', 'gc.auto', '0'], true);
  30425. return output.exitCode === 0;
  30426. }
  30427. async tryGetFetchUrl() {
  30428. const output = await this.execGit(['config', '--local', '--get', 'remote.origin.url'], true);
  30429. if (output.exitCode !== 0) {
  30430. return '';
  30431. }
  30432. const stdout = output.stdout.trim();
  30433. if (stdout.includes('\n')) {
  30434. return '';
  30435. }
  30436. return stdout;
  30437. }
  30438. async tryGetConfigValues(configKey, globalConfig, configFile) {
  30439. const args = ['config'];
  30440. if (configFile) {
  30441. args.push('--file', configFile);
  30442. }
  30443. else {
  30444. args.push(globalConfig ? '--global' : '--local');
  30445. }
  30446. args.push('--get-all', configKey);
  30447. const output = await this.execGit(args, true);
  30448. if (output.exitCode !== 0) {
  30449. return [];
  30450. }
  30451. return output.stdout
  30452. .trim()
  30453. .split('\n')
  30454. .filter(value => value.trim());
  30455. }
  30456. async tryGetConfigKeys(pattern, globalConfig, configFile) {
  30457. const args = ['config'];
  30458. if (configFile) {
  30459. args.push('--file', configFile);
  30460. }
  30461. else {
  30462. args.push(globalConfig ? '--global' : '--local');
  30463. }
  30464. args.push('--name-only', '--get-regexp', pattern);
  30465. const output = await this.execGit(args, true);
  30466. if (output.exitCode !== 0) {
  30467. return [];
  30468. }
  30469. return output.stdout
  30470. .trim()
  30471. .split('\n')
  30472. .filter(key => key.trim());
  30473. }
  30474. async tryReset() {
  30475. const output = await this.execGit(['reset', '--hard', 'HEAD'], true);
  30476. return output.exitCode === 0;
  30477. }
  30478. async version() {
  30479. return this.gitVersion;
  30480. }
  30481. static async createCommandManager(workingDirectory, lfs, doSparseCheckout) {
  30482. const result = new GitCommandManager();
  30483. await result.initializeCommandManager(workingDirectory, lfs, doSparseCheckout);
  30484. return result;
  30485. }
  30486. async execGit(args, allowAllExitCodes = false, silent = false, customListeners = {}) {
  30487. directoryExistsSync(this.workingDirectory, true);
  30488. const result = new GitOutput();
  30489. const env = {};
  30490. for (const key of Object.keys(process.env)) {
  30491. env[key] = process.env[key];
  30492. }
  30493. for (const key of Object.keys(this.gitEnv)) {
  30494. env[key] = this.gitEnv[key];
  30495. }
  30496. const defaultListener = {
  30497. stdout: (data) => {
  30498. stdout.push(data.toString());
  30499. }
  30500. };
  30501. const mergedListeners = { ...defaultListener, ...customListeners };
  30502. const stdout = [];
  30503. const options = {
  30504. cwd: this.workingDirectory,
  30505. env,
  30506. silent,
  30507. ignoreReturnCode: allowAllExitCodes,
  30508. listeners: mergedListeners
  30509. };
  30510. result.exitCode = await exec_exec(`"${this.gitPath}"`, args, options);
  30511. result.stdout = stdout.join('');
  30512. core_debug(result.exitCode.toString());
  30513. core_debug(result.stdout);
  30514. return result;
  30515. }
  30516. async initializeCommandManager(workingDirectory, lfs, doSparseCheckout) {
  30517. this.workingDirectory = workingDirectory;
  30518. // Git-lfs will try to pull down assets if any of the local/user/system setting exist.
  30519. // If the user didn't enable `LFS` in their pipeline definition, disable LFS fetch/checkout.
  30520. this.lfs = lfs;
  30521. if (!this.lfs) {
  30522. this.gitEnv['GIT_LFS_SKIP_SMUDGE'] = '1';
  30523. }
  30524. this.gitPath = await which('git', true);
  30525. // Git version
  30526. core_debug('Getting git version');
  30527. this.gitVersion = new GitVersion();
  30528. let gitOutput = await this.execGit(['version']);
  30529. let stdout = gitOutput.stdout.trim();
  30530. if (!stdout.includes('\n')) {
  30531. const match = stdout.match(/\d+\.\d+(\.\d+)?/);
  30532. if (match) {
  30533. this.gitVersion = new GitVersion(match[0]);
  30534. }
  30535. }
  30536. if (!this.gitVersion.isValid()) {
  30537. throw new Error('Unable to determine git version');
  30538. }
  30539. // Minimum git version
  30540. if (!this.gitVersion.checkMinimum(MinimumGitVersion)) {
  30541. throw new Error(`Minimum required git version is ${MinimumGitVersion}. Your git ('${this.gitPath}') is ${this.gitVersion}`);
  30542. }
  30543. if (this.lfs) {
  30544. // Git-lfs version
  30545. core_debug('Getting git-lfs version');
  30546. let gitLfsVersion = new GitVersion();
  30547. const gitLfsPath = await which('git-lfs', true);
  30548. gitOutput = await this.execGit(['lfs', 'version']);
  30549. stdout = gitOutput.stdout.trim();
  30550. if (!stdout.includes('\n')) {
  30551. const match = stdout.match(/\d+\.\d+(\.\d+)?/);
  30552. if (match) {
  30553. gitLfsVersion = new GitVersion(match[0]);
  30554. }
  30555. }
  30556. if (!gitLfsVersion.isValid()) {
  30557. throw new Error('Unable to determine git-lfs version');
  30558. }
  30559. // Minimum git-lfs version
  30560. // Note:
  30561. // - Auth header not supported before 2.1
  30562. const minimumGitLfsVersion = new GitVersion('2.1');
  30563. if (!gitLfsVersion.checkMinimum(minimumGitLfsVersion)) {
  30564. throw new Error(`Minimum required git-lfs version is ${minimumGitLfsVersion}. Your git-lfs ('${gitLfsPath}') is ${gitLfsVersion}`);
  30565. }
  30566. }
  30567. this.doSparseCheckout = doSparseCheckout;
  30568. if (this.doSparseCheckout) {
  30569. if (!this.gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
  30570. throw new Error(`Minimum Git version required for sparse checkout is ${MinimumGitSparseCheckoutVersion}. Your git ('${this.gitPath}') is ${this.gitVersion}`);
  30571. }
  30572. }
  30573. // Set the user agent
  30574. let gitHttpUserAgent = `git/${this.gitVersion} (github-actions-checkout)`;
  30575. // Append orchestration ID if set
  30576. const orchId = process.env['ACTIONS_ORCHESTRATION_ID'];
  30577. if (orchId) {
  30578. // Sanitize the orchestration ID to ensure it contains only valid characters
  30579. // Valid characters: 0-9, a-z, _, -, .
  30580. const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
  30581. if (sanitizedId) {
  30582. gitHttpUserAgent = `${gitHttpUserAgent} actions_orchestration_id/${sanitizedId}`;
  30583. }
  30584. }
  30585. core_debug(`Set git useragent to: ${gitHttpUserAgent}`);
  30586. this.gitEnv['GIT_HTTP_USER_AGENT'] = gitHttpUserAgent;
  30587. }
  30588. }
  30589. class GitOutput {
  30590. stdout = '';
  30591. exitCode = 0;
  30592. }
  30593. ;// CONCATENATED MODULE: ./src/git-directory-helper.ts
  30594. async function prepareExistingDirectory(git, repositoryPath, repositoryUrl, clean, ref) {
  30595. external_assert_.ok(repositoryPath, 'Expected repositoryPath to be defined');
  30596. external_assert_.ok(repositoryUrl, 'Expected repositoryUrl to be defined');
  30597. // Indicates whether to delete the directory contents
  30598. let remove = false;
  30599. // Check whether using git or REST API
  30600. if (!git) {
  30601. remove = true;
  30602. }
  30603. // Fetch URL does not match
  30604. else if (!directoryExistsSync(external_path_namespaceObject.join(repositoryPath, '.git')) ||
  30605. repositoryUrl !== (await git.tryGetFetchUrl())) {
  30606. remove = true;
  30607. }
  30608. else {
  30609. // Delete any index.lock and shallow.lock left by a previously canceled run or crashed git process
  30610. const lockPaths = [
  30611. external_path_namespaceObject.join(repositoryPath, '.git', 'index.lock'),
  30612. external_path_namespaceObject.join(repositoryPath, '.git', 'shallow.lock')
  30613. ];
  30614. for (const lockPath of lockPaths) {
  30615. try {
  30616. await rmRF(lockPath);
  30617. }
  30618. catch (error) {
  30619. core_debug(`Unable to delete '${lockPath}'. ${error?.message ?? error}`);
  30620. }
  30621. }
  30622. try {
  30623. startGroup('Removing previously created refs, to avoid conflicts');
  30624. // Checkout detached HEAD
  30625. if (!(await git.isDetached())) {
  30626. await git.checkoutDetach();
  30627. }
  30628. // Remove all refs/heads/*
  30629. let branches = await git.branchList(false);
  30630. for (const branch of branches) {
  30631. await git.branchDelete(false, branch);
  30632. }
  30633. // Remove any conflicting refs/remotes/origin/*
  30634. // Example 1: Consider ref is refs/heads/foo and previously fetched refs/remotes/origin/foo/bar
  30635. // Example 2: Consider ref is refs/heads/foo/bar and previously fetched refs/remotes/origin/foo
  30636. if (ref) {
  30637. ref = ref.startsWith('refs/') ? ref : `refs/heads/${ref}`;
  30638. if (ref.startsWith('refs/heads/')) {
  30639. const upperName1 = ref.toUpperCase().substr('REFS/HEADS/'.length);
  30640. const upperName1Slash = `${upperName1}/`;
  30641. branches = await git.branchList(true);
  30642. for (const branch of branches) {
  30643. const upperName2 = branch.substr('origin/'.length).toUpperCase();
  30644. const upperName2Slash = `${upperName2}/`;
  30645. if (upperName1.startsWith(upperName2Slash) ||
  30646. upperName2.startsWith(upperName1Slash)) {
  30647. await git.branchDelete(true, branch);
  30648. }
  30649. }
  30650. }
  30651. }
  30652. endGroup();
  30653. // Check for submodules and delete any existing files if submodules are present
  30654. if (!(await git.submoduleStatus())) {
  30655. remove = true;
  30656. info('Bad Submodules found, removing existing files');
  30657. }
  30658. // Clean
  30659. if (clean) {
  30660. startGroup('Cleaning the repository');
  30661. if (!(await git.tryClean())) {
  30662. 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}'.`);
  30663. remove = true;
  30664. }
  30665. else if (!(await git.tryReset())) {
  30666. remove = true;
  30667. }
  30668. endGroup();
  30669. if (remove) {
  30670. warning(`Unable to clean or reset the repository. The repository will be recreated instead.`);
  30671. }
  30672. }
  30673. }
  30674. catch (error) {
  30675. warning(`Unable to prepare the existing repository. The repository will be recreated instead.`);
  30676. remove = true;
  30677. }
  30678. }
  30679. if (remove) {
  30680. // Delete the contents of the directory. Don't delete the directory itself
  30681. // since it might be the current working directory.
  30682. info(`Deleting the contents of '${repositoryPath}'`);
  30683. for (const file of await external_fs_namespaceObject.promises.readdir(repositoryPath)) {
  30684. await rmRF(external_path_namespaceObject.join(repositoryPath, file));
  30685. }
  30686. }
  30687. }
  30688. ;// CONCATENATED MODULE: ./node_modules/@actions/github/lib/context.js
  30689. class Context {
  30690. /**
  30691. * Hydrate the context from the environment
  30692. */
  30693. constructor() {
  30694. var _a, _b, _c;
  30695. this.payload = {};
  30696. if (process.env.GITHUB_EVENT_PATH) {
  30697. if ((0,external_fs_namespaceObject.existsSync)(process.env.GITHUB_EVENT_PATH)) {
  30698. this.payload = JSON.parse((0,external_fs_namespaceObject.readFileSync)(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
  30699. }
  30700. else {
  30701. const path = process.env.GITHUB_EVENT_PATH;
  30702. process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${external_os_namespaceObject.EOL}`);
  30703. }
  30704. }
  30705. this.eventName = process.env.GITHUB_EVENT_NAME;
  30706. this.sha = process.env.GITHUB_SHA;
  30707. this.ref = process.env.GITHUB_REF;
  30708. this.workflow = process.env.GITHUB_WORKFLOW;
  30709. this.action = process.env.GITHUB_ACTION;
  30710. this.actor = process.env.GITHUB_ACTOR;
  30711. this.job = process.env.GITHUB_JOB;
  30712. this.runAttempt = parseInt(process.env.GITHUB_RUN_ATTEMPT, 10);
  30713. this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
  30714. this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
  30715. this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
  30716. this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`;
  30717. this.graphqlUrl =
  30718. (_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`;
  30719. }
  30720. get issue() {
  30721. const payload = this.payload;
  30722. return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number });
  30723. }
  30724. get repo() {
  30725. if (process.env.GITHUB_REPOSITORY) {
  30726. const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
  30727. return { owner, repo };
  30728. }
  30729. if (this.payload.repository) {
  30730. return {
  30731. owner: this.payload.repository.owner.login,
  30732. repo: this.payload.repository.name
  30733. };
  30734. }
  30735. throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
  30736. }
  30737. }
  30738. //# sourceMappingURL=context.js.map
  30739. // EXTERNAL MODULE: ./node_modules/@actions/github/node_modules/@actions/http-client/lib/index.js
  30740. var lib = __nccwpck_require__(9659);
  30741. ;// CONCATENATED MODULE: ./node_modules/@actions/github/lib/internal/utils.js
  30742. var utils_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  30743. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  30744. return new (P || (P = Promise))(function (resolve, reject) {
  30745. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  30746. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  30747. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  30748. step((generator = generator.apply(thisArg, _arguments || [])).next());
  30749. });
  30750. };
  30751. function getAuthString(token, options) {
  30752. if (!token && !options.auth) {
  30753. throw new Error('Parameter token or opts.auth is required');
  30754. }
  30755. else if (token && options.auth) {
  30756. throw new Error('Parameters token and opts.auth may not both be specified');
  30757. }
  30758. return typeof options.auth === 'string' ? options.auth : `token ${token}`;
  30759. }
  30760. function getProxyAgent(destinationUrl) {
  30761. const hc = new lib.HttpClient();
  30762. return hc.getAgent(destinationUrl);
  30763. }
  30764. function getProxyAgentDispatcher(destinationUrl) {
  30765. const hc = new lib.HttpClient();
  30766. return hc.getAgentDispatcher(destinationUrl);
  30767. }
  30768. function getProxyFetch(destinationUrl) {
  30769. const httpDispatcher = getProxyAgentDispatcher(destinationUrl);
  30770. const proxyFetch = (url, opts) => utils_awaiter(this, void 0, void 0, function* () {
  30771. return (0,undici.fetch)(url, Object.assign(Object.assign({}, opts), { dispatcher: httpDispatcher }));
  30772. });
  30773. return proxyFetch;
  30774. }
  30775. function getApiBaseUrl() {
  30776. return process.env['GITHUB_API_URL'] || 'https://api.github.com';
  30777. }
  30778. function getUserAgentWithOrchestrationId(baseUserAgent) {
  30779. var _a;
  30780. const orchId = (_a = process.env['ACTIONS_ORCHESTRATION_ID']) === null || _a === void 0 ? void 0 : _a.trim();
  30781. if (orchId) {
  30782. const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
  30783. const tag = `actions_orchestration_id/${sanitizedId}`;
  30784. if (baseUserAgent === null || baseUserAgent === void 0 ? void 0 : baseUserAgent.includes(tag))
  30785. return baseUserAgent;
  30786. const ua = baseUserAgent ? `${baseUserAgent} ` : '';
  30787. return `${ua}${tag}`;
  30788. }
  30789. return baseUserAgent;
  30790. }
  30791. //# sourceMappingURL=utils.js.map
  30792. ;// CONCATENATED MODULE: ./node_modules/universal-user-agent/index.js
  30793. function getUserAgent() {
  30794. if (typeof navigator === "object" && "userAgent" in navigator) {
  30795. return navigator.userAgent;
  30796. }
  30797. if (typeof process === "object" && process.version !== undefined) {
  30798. return `Node.js/${process.version.substr(1)} (${process.platform}; ${
  30799. process.arch
  30800. })`;
  30801. }
  30802. return "<environment undetectable>";
  30803. }
  30804. ;// CONCATENATED MODULE: ./node_modules/before-after-hook/lib/register.js
  30805. // @ts-check
  30806. function register(state, name, method, options) {
  30807. if (typeof method !== "function") {
  30808. throw new Error("method for before hook must be a function");
  30809. }
  30810. if (!options) {
  30811. options = {};
  30812. }
  30813. if (Array.isArray(name)) {
  30814. return name.reverse().reduce((callback, name) => {
  30815. return register.bind(null, state, name, callback, options);
  30816. }, method)();
  30817. }
  30818. return Promise.resolve().then(() => {
  30819. if (!state.registry[name]) {
  30820. return method(options);
  30821. }
  30822. return state.registry[name].reduce((method, registered) => {
  30823. return registered.hook.bind(null, method, options);
  30824. }, method)();
  30825. });
  30826. }
  30827. ;// CONCATENATED MODULE: ./node_modules/before-after-hook/lib/add.js
  30828. // @ts-check
  30829. function addHook(state, kind, name, hook) {
  30830. const orig = hook;
  30831. if (!state.registry[name]) {
  30832. state.registry[name] = [];
  30833. }
  30834. if (kind === "before") {
  30835. hook = (method, options) => {
  30836. return Promise.resolve()
  30837. .then(orig.bind(null, options))
  30838. .then(method.bind(null, options));
  30839. };
  30840. }
  30841. if (kind === "after") {
  30842. hook = (method, options) => {
  30843. let result;
  30844. return Promise.resolve()
  30845. .then(method.bind(null, options))
  30846. .then((result_) => {
  30847. result = result_;
  30848. return orig(result, options);
  30849. })
  30850. .then(() => {
  30851. return result;
  30852. });
  30853. };
  30854. }
  30855. if (kind === "error") {
  30856. hook = (method, options) => {
  30857. return Promise.resolve()
  30858. .then(method.bind(null, options))
  30859. .catch((error) => {
  30860. return orig(error, options);
  30861. });
  30862. };
  30863. }
  30864. state.registry[name].push({
  30865. hook: hook,
  30866. orig: orig,
  30867. });
  30868. }
  30869. ;// CONCATENATED MODULE: ./node_modules/before-after-hook/lib/remove.js
  30870. // @ts-check
  30871. function removeHook(state, name, method) {
  30872. if (!state.registry[name]) {
  30873. return;
  30874. }
  30875. const index = state.registry[name]
  30876. .map((registered) => {
  30877. return registered.orig;
  30878. })
  30879. .indexOf(method);
  30880. if (index === -1) {
  30881. return;
  30882. }
  30883. state.registry[name].splice(index, 1);
  30884. }
  30885. ;// CONCATENATED MODULE: ./node_modules/before-after-hook/index.js
  30886. // @ts-check
  30887. // bind with array of arguments: https://stackoverflow.com/a/21792913
  30888. const bind = Function.bind;
  30889. const bindable = bind.bind(bind);
  30890. function bindApi(hook, state, name) {
  30891. const removeHookRef = bindable(removeHook, null).apply(
  30892. null,
  30893. name ? [state, name] : [state]
  30894. );
  30895. hook.api = { remove: removeHookRef };
  30896. hook.remove = removeHookRef;
  30897. ["before", "error", "after", "wrap"].forEach((kind) => {
  30898. const args = name ? [state, kind, name] : [state, kind];
  30899. hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args);
  30900. });
  30901. }
  30902. function Singular() {
  30903. const singularHookName = Symbol("Singular");
  30904. const singularHookState = {
  30905. registry: {},
  30906. };
  30907. const singularHook = register.bind(null, singularHookState, singularHookName);
  30908. bindApi(singularHook, singularHookState, singularHookName);
  30909. return singularHook;
  30910. }
  30911. function Collection() {
  30912. const state = {
  30913. registry: {},
  30914. };
  30915. const hook = register.bind(null, state);
  30916. bindApi(hook, state);
  30917. return hook;
  30918. }
  30919. /* harmony default export */ const before_after_hook = ({ Singular, Collection });
  30920. ;// CONCATENATED MODULE: ./node_modules/@octokit/endpoint/dist-bundle/index.js
  30921. // pkg/dist-src/defaults.js
  30922. // pkg/dist-src/version.js
  30923. var VERSION = "0.0.0-development";
  30924. // pkg/dist-src/defaults.js
  30925. var userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
  30926. var DEFAULTS = {
  30927. method: "GET",
  30928. baseUrl: "https://api.github.com",
  30929. headers: {
  30930. accept: "application/vnd.github.v3+json",
  30931. "user-agent": userAgent
  30932. },
  30933. mediaType: {
  30934. format: ""
  30935. }
  30936. };
  30937. // pkg/dist-src/util/lowercase-keys.js
  30938. function dist_bundle_lowercaseKeys(object) {
  30939. if (!object) {
  30940. return {};
  30941. }
  30942. return Object.keys(object).reduce((newObj, key) => {
  30943. newObj[key.toLowerCase()] = object[key];
  30944. return newObj;
  30945. }, {});
  30946. }
  30947. // pkg/dist-src/util/is-plain-object.js
  30948. function isPlainObject(value) {
  30949. if (typeof value !== "object" || value === null) return false;
  30950. if (Object.prototype.toString.call(value) !== "[object Object]") return false;
  30951. const proto = Object.getPrototypeOf(value);
  30952. if (proto === null) return true;
  30953. const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
  30954. return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
  30955. }
  30956. // pkg/dist-src/util/merge-deep.js
  30957. function mergeDeep(defaults, options) {
  30958. const result = Object.assign({}, defaults);
  30959. Object.keys(options).forEach((key) => {
  30960. if (isPlainObject(options[key])) {
  30961. if (!(key in defaults)) Object.assign(result, { [key]: options[key] });
  30962. else result[key] = mergeDeep(defaults[key], options[key]);
  30963. } else {
  30964. Object.assign(result, { [key]: options[key] });
  30965. }
  30966. });
  30967. return result;
  30968. }
  30969. // pkg/dist-src/util/remove-undefined-properties.js
  30970. function removeUndefinedProperties(obj) {
  30971. for (const key in obj) {
  30972. if (obj[key] === void 0) {
  30973. delete obj[key];
  30974. }
  30975. }
  30976. return obj;
  30977. }
  30978. // pkg/dist-src/merge.js
  30979. function merge(defaults, route, options) {
  30980. if (typeof route === "string") {
  30981. let [method, url] = route.split(" ");
  30982. options = Object.assign(url ? { method, url } : { url: method }, options);
  30983. } else {
  30984. options = Object.assign({}, route);
  30985. }
  30986. options.headers = dist_bundle_lowercaseKeys(options.headers);
  30987. removeUndefinedProperties(options);
  30988. removeUndefinedProperties(options.headers);
  30989. const mergedOptions = mergeDeep(defaults || {}, options);
  30990. if (options.url === "/graphql") {
  30991. if (defaults && defaults.mediaType.previews?.length) {
  30992. mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
  30993. (preview) => !mergedOptions.mediaType.previews.includes(preview)
  30994. ).concat(mergedOptions.mediaType.previews);
  30995. }
  30996. mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
  30997. }
  30998. return mergedOptions;
  30999. }
  31000. // pkg/dist-src/util/add-query-parameters.js
  31001. function addQueryParameters(url, parameters) {
  31002. const separator = /\?/.test(url) ? "&" : "?";
  31003. const names = Object.keys(parameters);
  31004. if (names.length === 0) {
  31005. return url;
  31006. }
  31007. return url + separator + names.map((name) => {
  31008. if (name === "q") {
  31009. return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
  31010. }
  31011. return `${name}=${encodeURIComponent(parameters[name])}`;
  31012. }).join("&");
  31013. }
  31014. // pkg/dist-src/util/extract-url-variable-names.js
  31015. var urlVariableRegex = /\{[^{}}]+\}/g;
  31016. function removeNonChars(variableName) {
  31017. return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
  31018. }
  31019. function extractUrlVariableNames(url) {
  31020. const matches = url.match(urlVariableRegex);
  31021. if (!matches) {
  31022. return [];
  31023. }
  31024. return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
  31025. }
  31026. // pkg/dist-src/util/omit.js
  31027. function omit(object, keysToOmit) {
  31028. const result = { __proto__: null };
  31029. for (const key of Object.keys(object)) {
  31030. if (keysToOmit.indexOf(key) === -1) {
  31031. result[key] = object[key];
  31032. }
  31033. }
  31034. return result;
  31035. }
  31036. // pkg/dist-src/util/url-template.js
  31037. function encodeReserved(str) {
  31038. return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
  31039. if (!/%[0-9A-Fa-f]/.test(part)) {
  31040. part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
  31041. }
  31042. return part;
  31043. }).join("");
  31044. }
  31045. function encodeUnreserved(str) {
  31046. return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
  31047. return "%" + c.charCodeAt(0).toString(16).toUpperCase();
  31048. });
  31049. }
  31050. function encodeValue(operator, value, key) {
  31051. value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
  31052. if (key) {
  31053. return encodeUnreserved(key) + "=" + value;
  31054. } else {
  31055. return value;
  31056. }
  31057. }
  31058. function isDefined(value) {
  31059. return value !== void 0 && value !== null;
  31060. }
  31061. function isKeyOperator(operator) {
  31062. return operator === ";" || operator === "&" || operator === "?";
  31063. }
  31064. function getValues(context, operator, key, modifier) {
  31065. var value = context[key], result = [];
  31066. if (isDefined(value) && value !== "") {
  31067. if (typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") {
  31068. value = value.toString();
  31069. if (modifier && modifier !== "*") {
  31070. value = value.substring(0, parseInt(modifier, 10));
  31071. }
  31072. result.push(
  31073. encodeValue(operator, value, isKeyOperator(operator) ? key : "")
  31074. );
  31075. } else {
  31076. if (modifier === "*") {
  31077. if (Array.isArray(value)) {
  31078. value.filter(isDefined).forEach(function(value2) {
  31079. result.push(
  31080. encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
  31081. );
  31082. });
  31083. } else {
  31084. Object.keys(value).forEach(function(k) {
  31085. if (isDefined(value[k])) {
  31086. result.push(encodeValue(operator, value[k], k));
  31087. }
  31088. });
  31089. }
  31090. } else {
  31091. const tmp = [];
  31092. if (Array.isArray(value)) {
  31093. value.filter(isDefined).forEach(function(value2) {
  31094. tmp.push(encodeValue(operator, value2));
  31095. });
  31096. } else {
  31097. Object.keys(value).forEach(function(k) {
  31098. if (isDefined(value[k])) {
  31099. tmp.push(encodeUnreserved(k));
  31100. tmp.push(encodeValue(operator, value[k].toString()));
  31101. }
  31102. });
  31103. }
  31104. if (isKeyOperator(operator)) {
  31105. result.push(encodeUnreserved(key) + "=" + tmp.join(","));
  31106. } else if (tmp.length !== 0) {
  31107. result.push(tmp.join(","));
  31108. }
  31109. }
  31110. }
  31111. } else {
  31112. if (operator === ";") {
  31113. if (isDefined(value)) {
  31114. result.push(encodeUnreserved(key));
  31115. }
  31116. } else if (value === "" && (operator === "&" || operator === "?")) {
  31117. result.push(encodeUnreserved(key) + "=");
  31118. } else if (value === "") {
  31119. result.push("");
  31120. }
  31121. }
  31122. return result;
  31123. }
  31124. function parseUrl(template) {
  31125. return {
  31126. expand: expand.bind(null, template)
  31127. };
  31128. }
  31129. function expand(template, context) {
  31130. var operators = ["+", "#", ".", "/", ";", "?", "&"];
  31131. template = template.replace(
  31132. /\{([^\{\}]+)\}|([^\{\}]+)/g,
  31133. function(_, expression, literal) {
  31134. if (expression) {
  31135. let operator = "";
  31136. const values = [];
  31137. if (operators.indexOf(expression.charAt(0)) !== -1) {
  31138. operator = expression.charAt(0);
  31139. expression = expression.substr(1);
  31140. }
  31141. expression.split(/,/g).forEach(function(variable) {
  31142. var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
  31143. values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
  31144. });
  31145. if (operator && operator !== "+") {
  31146. var separator = ",";
  31147. if (operator === "?") {
  31148. separator = "&";
  31149. } else if (operator !== "#") {
  31150. separator = operator;
  31151. }
  31152. return (values.length !== 0 ? operator : "") + values.join(separator);
  31153. } else {
  31154. return values.join(",");
  31155. }
  31156. } else {
  31157. return encodeReserved(literal);
  31158. }
  31159. }
  31160. );
  31161. if (template === "/") {
  31162. return template;
  31163. } else {
  31164. return template.replace(/\/$/, "");
  31165. }
  31166. }
  31167. // pkg/dist-src/parse.js
  31168. function parse(options) {
  31169. let method = options.method.toUpperCase();
  31170. let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
  31171. let headers = Object.assign({}, options.headers);
  31172. let body;
  31173. let parameters = omit(options, [
  31174. "method",
  31175. "baseUrl",
  31176. "url",
  31177. "headers",
  31178. "request",
  31179. "mediaType"
  31180. ]);
  31181. const urlVariableNames = extractUrlVariableNames(url);
  31182. url = parseUrl(url).expand(parameters);
  31183. if (!/^http/.test(url)) {
  31184. url = options.baseUrl + url;
  31185. }
  31186. const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
  31187. const remainingParameters = omit(parameters, omittedParameters);
  31188. const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
  31189. if (!isBinaryRequest) {
  31190. if (options.mediaType.format) {
  31191. headers.accept = headers.accept.split(/,/).map(
  31192. (format) => format.replace(
  31193. /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
  31194. `application/vnd$1$2.${options.mediaType.format}`
  31195. )
  31196. ).join(",");
  31197. }
  31198. if (url.endsWith("/graphql")) {
  31199. if (options.mediaType.previews?.length) {
  31200. const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
  31201. headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
  31202. const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
  31203. return `application/vnd.github.${preview}-preview${format}`;
  31204. }).join(",");
  31205. }
  31206. }
  31207. }
  31208. if (["GET", "HEAD"].includes(method)) {
  31209. url = addQueryParameters(url, remainingParameters);
  31210. } else {
  31211. if ("data" in remainingParameters) {
  31212. body = remainingParameters.data;
  31213. } else {
  31214. if (Object.keys(remainingParameters).length) {
  31215. body = remainingParameters;
  31216. }
  31217. }
  31218. }
  31219. if (!headers["content-type"] && typeof body !== "undefined") {
  31220. headers["content-type"] = "application/json; charset=utf-8";
  31221. }
  31222. if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
  31223. body = "";
  31224. }
  31225. return Object.assign(
  31226. { method, url, headers },
  31227. typeof body !== "undefined" ? { body } : null,
  31228. options.request ? { request: options.request } : null
  31229. );
  31230. }
  31231. // pkg/dist-src/endpoint-with-defaults.js
  31232. function endpointWithDefaults(defaults, route, options) {
  31233. return parse(merge(defaults, route, options));
  31234. }
  31235. // pkg/dist-src/with-defaults.js
  31236. function withDefaults(oldDefaults, newDefaults) {
  31237. const DEFAULTS2 = merge(oldDefaults, newDefaults);
  31238. const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2);
  31239. return Object.assign(endpoint2, {
  31240. DEFAULTS: DEFAULTS2,
  31241. defaults: withDefaults.bind(null, DEFAULTS2),
  31242. merge: merge.bind(null, DEFAULTS2),
  31243. parse
  31244. });
  31245. }
  31246. // pkg/dist-src/index.js
  31247. var endpoint = withDefaults(null, DEFAULTS);
  31248. // EXTERNAL MODULE: ./node_modules/content-type/dist/index.js
  31249. var dist = __nccwpck_require__(4649);
  31250. ;// CONCATENATED MODULE: ./node_modules/json-with-bigint/json-with-bigint.js
  31251. const intRegex = /^-?\d+$/;
  31252. const noiseValue = /^-?\d+n+$/; // Noise - strings that match the custom format before being converted to it
  31253. const originalStringify = JSON.stringify;
  31254. const originalParse = JSON.parse;
  31255. const customFormat = /^-?\d+n$/;
  31256. const bigIntsStringify = /([\[:])?"(-?\d+)n"($|([\\n]|\s)*(\s|[\\n])*[,\}\]])/g;
  31257. const noiseStringify =
  31258. /([\[:])?("-?\d+n+)n("$|"([\\n]|\s)*(\s|[\\n])*[,\}\]])/g;
  31259. /**
  31260. * @typedef {(this: any, key: string | number | undefined, value: any) => any} Replacer
  31261. * @typedef {(key: string | number | undefined, value: any, context?: { source: string }) => any} Reviver
  31262. */
  31263. /**
  31264. * Converts a JavaScript value to a JSON string.
  31265. *
  31266. * Supports serialization of BigInt values using two strategies:
  31267. * 1. Custom format "123n" → "123" (universal fallback)
  31268. * 2. Native JSON.rawJSON() (Node.js 22+, fastest) when available
  31269. *
  31270. * All other values are serialized exactly like native JSON.stringify().
  31271. *
  31272. * @param {*} value The value to convert to a JSON string.
  31273. * @param {Replacer | Array<string | number> | null} [replacer]
  31274. * A function that alters the behavior of the stringification process,
  31275. * or an array of strings/numbers to indicate properties to exclude.
  31276. * @param {string | number} [space]
  31277. * A string or number to specify indentation or pretty-printing.
  31278. * @returns {string} The JSON string representation.
  31279. */
  31280. const JSONStringify = (value, replacer, space) => {
  31281. if ("rawJSON" in JSON) {
  31282. return originalStringify(
  31283. value,
  31284. (key, value) => {
  31285. if (typeof value === "bigint") return JSON.rawJSON(value.toString());
  31286. if (typeof replacer === "function") return replacer(key, value);
  31287. if (Array.isArray(replacer) && replacer.includes(key)) return value;
  31288. return value;
  31289. },
  31290. space,
  31291. );
  31292. }
  31293. if (!value) return originalStringify(value, replacer, space);
  31294. const convertedToCustomJSON = originalStringify(
  31295. value,
  31296. (key, value) => {
  31297. const isNoise = typeof value === "string" && noiseValue.test(value);
  31298. if (isNoise) return value.toString() + "n"; // Mark noise values with additional "n" to offset the deletion of one "n" during the processing
  31299. if (typeof value === "bigint") return value.toString() + "n";
  31300. if (typeof replacer === "function") return replacer(key, value);
  31301. if (Array.isArray(replacer) && replacer.includes(key)) return value;
  31302. return value;
  31303. },
  31304. space,
  31305. );
  31306. const processedJSON = convertedToCustomJSON.replace(
  31307. bigIntsStringify,
  31308. "$1$2$3",
  31309. ); // Delete one "n" off the end of every BigInt value
  31310. const denoisedJSON = processedJSON.replace(noiseStringify, "$1$2$3"); // Remove one "n" off the end of every noisy string
  31311. return denoisedJSON;
  31312. };
  31313. const featureCache = new Map();
  31314. /**
  31315. * Detects if the current JSON.parse implementation supports the context.source feature.
  31316. *
  31317. * Uses toString() fingerprinting to cache results and automatically detect runtime
  31318. * replacements of JSON.parse (polyfills, mocks, etc.).
  31319. *
  31320. * @returns {boolean} true if context.source is supported, false otherwise.
  31321. */
  31322. const isContextSourceSupported = () => {
  31323. const parseFingerprint = JSON.parse.toString();
  31324. if (featureCache.has(parseFingerprint)) {
  31325. return featureCache.get(parseFingerprint);
  31326. }
  31327. try {
  31328. const result = JSON.parse(
  31329. "1",
  31330. (_, __, context) => !!context?.source && context.source === "1",
  31331. );
  31332. featureCache.set(parseFingerprint, result);
  31333. return result;
  31334. } catch {
  31335. featureCache.set(parseFingerprint, false);
  31336. return false;
  31337. }
  31338. };
  31339. /**
  31340. * Reviver function that converts custom-format BigInt strings back to BigInt values.
  31341. * Also handles "noise" strings that accidentally match the BigInt format.
  31342. *
  31343. * @param {string | number | undefined} key The object key.
  31344. * @param {*} value The value being parsed.
  31345. * @param {object} [context] Parse context (if supported by JSON.parse).
  31346. * @param {Reviver} [userReviver] User's custom reviver function.
  31347. * @returns {any} The transformed value.
  31348. */
  31349. const convertMarkedBigIntsReviver = (key, value, context, userReviver) => {
  31350. const isCustomFormatBigInt =
  31351. typeof value === "string" && customFormat.test(value);
  31352. if (isCustomFormatBigInt) return BigInt(value.slice(0, -1));
  31353. const isNoiseValue = typeof value === "string" && noiseValue.test(value);
  31354. if (isNoiseValue) return value.slice(0, -1);
  31355. if (typeof userReviver !== "function") return value;
  31356. return userReviver(key, value, context);
  31357. };
  31358. /**
  31359. * Fast JSON.parse implementation (~2x faster than classic fallback).
  31360. * Uses JSON.parse's context.source feature to detect integers and convert
  31361. * large numbers directly to BigInt without string manipulation.
  31362. *
  31363. * Does not support legacy custom format from v1 of this library.
  31364. *
  31365. * @param {string} text JSON string to parse.
  31366. * @param {Reviver} [reviver] Transform function to apply to each value.
  31367. * @returns {any} Parsed JavaScript value.
  31368. */
  31369. const JSONParseV2 = (text, reviver) => {
  31370. return JSON.parse(text, (key, value, context) => {
  31371. const isBigNumber =
  31372. typeof value === "number" &&
  31373. (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER);
  31374. const isInt = context && intRegex.test(context.source);
  31375. const isBigInt = isBigNumber && isInt;
  31376. if (isBigInt) return BigInt(context.source);
  31377. if (typeof reviver !== "function") return value;
  31378. return reviver(key, value, context);
  31379. });
  31380. };
  31381. const MAX_INT = Number.MAX_SAFE_INTEGER.toString();
  31382. const MAX_DIGITS = MAX_INT.length;
  31383. const stringsOrLargeNumbers =
  31384. /"(?:\\.|[^"])*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g;
  31385. const noiseValueWithQuotes = /^"-?\d+n+"$/; // Noise - strings that match the custom format before being converted to it
  31386. /**
  31387. * Converts a JSON string into a JavaScript value.
  31388. *
  31389. * Supports parsing of large integers using two strategies:
  31390. * 1. Classic fallback: Marks large numbers with "123n" format, then converts to BigInt
  31391. * 2. Fast path (JSONParseV2): Uses context.source feature (~2x faster) when available
  31392. *
  31393. * All other JSON values are parsed exactly like native JSON.parse().
  31394. *
  31395. * @param {string} text A valid JSON string.
  31396. * @param {Reviver} [reviver]
  31397. * A function that transforms the results. This function is called for each member
  31398. * of the object. If a member contains nested objects, the nested objects are
  31399. * transformed before the parent object is.
  31400. * @returns {any} The parsed JavaScript value.
  31401. * @throws {SyntaxError} If text is not valid JSON.
  31402. */
  31403. const JSONParse = (text, reviver) => {
  31404. if (!text) return originalParse(text, reviver);
  31405. if (isContextSourceSupported()) return JSONParseV2(text, reviver); // Shortcut to a faster (2x) and simpler version
  31406. // Find and mark big numbers with "n"
  31407. const serializedData = text.replace(
  31408. stringsOrLargeNumbers,
  31409. (text, digits, fractional, exponential) => {
  31410. const isString = text[0] === '"';
  31411. const isNoise = isString && noiseValueWithQuotes.test(text);
  31412. 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
  31413. const isFractionalOrExponential = fractional || exponential;
  31414. const isLessThanMaxSafeInt =
  31415. digits &&
  31416. (digits.length < MAX_DIGITS ||
  31417. (digits.length === MAX_DIGITS && digits <= MAX_INT)); // With a fixed number of digits, we can correctly use lexicographical comparison to do a numeric comparison
  31418. if (isString || isFractionalOrExponential || isLessThanMaxSafeInt)
  31419. return text;
  31420. return '"' + text + 'n"';
  31421. },
  31422. );
  31423. return originalParse(serializedData, (key, value, context) =>
  31424. convertMarkedBigIntsReviver(key, value, context, reviver),
  31425. );
  31426. };
  31427. ;// CONCATENATED MODULE: ./node_modules/@octokit/request-error/dist-src/index.js
  31428. class RequestError extends Error {
  31429. name;
  31430. /**
  31431. * http status code
  31432. */
  31433. status;
  31434. /**
  31435. * Request options that lead to the error.
  31436. */
  31437. request;
  31438. /**
  31439. * Response object if a response was received
  31440. */
  31441. response;
  31442. constructor(message, statusCode, options) {
  31443. super(message, { cause: options.cause });
  31444. this.name = "HttpError";
  31445. this.status = Number.parseInt(statusCode);
  31446. if (Number.isNaN(this.status)) {
  31447. this.status = 0;
  31448. }
  31449. /* v8 ignore else -- @preserve -- Bug with vitest coverage where it sees an else branch that doesn't exist */
  31450. if ("response" in options) {
  31451. this.response = options.response;
  31452. }
  31453. const requestCopy = Object.assign({}, options.request);
  31454. if (options.request.headers.authorization) {
  31455. requestCopy.headers = Object.assign({}, options.request.headers, {
  31456. authorization: options.request.headers.authorization.replace(
  31457. /(?<! ) .*$/,
  31458. " [REDACTED]"
  31459. )
  31460. });
  31461. }
  31462. requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
  31463. this.request = requestCopy;
  31464. }
  31465. }
  31466. ;// CONCATENATED MODULE: ./node_modules/@octokit/request/dist-bundle/index.js
  31467. // pkg/dist-src/index.js
  31468. // pkg/dist-src/defaults.js
  31469. // pkg/dist-src/version.js
  31470. var dist_bundle_VERSION = "10.0.10";
  31471. // pkg/dist-src/defaults.js
  31472. var defaults_default = {
  31473. headers: {
  31474. "user-agent": `octokit-request.js/${dist_bundle_VERSION} ${getUserAgent()}`
  31475. }
  31476. };
  31477. // pkg/dist-src/fetch-wrapper.js
  31478. // pkg/dist-src/is-plain-object.js
  31479. function dist_bundle_isPlainObject(value) {
  31480. if (typeof value !== "object" || value === null) return false;
  31481. if (Object.prototype.toString.call(value) !== "[object Object]") return false;
  31482. const proto = Object.getPrototypeOf(value);
  31483. if (proto === null) return true;
  31484. const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
  31485. return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
  31486. }
  31487. // pkg/dist-src/fetch-wrapper.js
  31488. var noop = () => "";
  31489. async function fetchWrapper(requestOptions) {
  31490. const fetch = requestOptions.request?.fetch || globalThis.fetch;
  31491. if (!fetch) {
  31492. throw new Error(
  31493. "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"
  31494. );
  31495. }
  31496. const log = requestOptions.request?.log || console;
  31497. const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
  31498. const body = dist_bundle_isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body) ? JSONStringify(requestOptions.body) : requestOptions.body;
  31499. const requestHeaders = Object.fromEntries(
  31500. Object.entries(requestOptions.headers).map(([name, value]) => [
  31501. name,
  31502. String(value)
  31503. ])
  31504. );
  31505. let fetchResponse;
  31506. try {
  31507. fetchResponse = await fetch(requestOptions.url, {
  31508. method: requestOptions.method,
  31509. body,
  31510. redirect: requestOptions.request?.redirect,
  31511. headers: requestHeaders,
  31512. signal: requestOptions.request?.signal,
  31513. // duplex must be set if request.body is ReadableStream or Async Iterables.
  31514. // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
  31515. ...requestOptions.body && { duplex: "half" }
  31516. });
  31517. } catch (error) {
  31518. let message = "Unknown Error";
  31519. if (error instanceof Error) {
  31520. if (error.name === "AbortError") {
  31521. error.status = 500;
  31522. throw error;
  31523. }
  31524. message = error.message;
  31525. if (error.name === "TypeError" && "cause" in error) {
  31526. if (error.cause instanceof Error) {
  31527. message = error.cause.message;
  31528. } else if (typeof error.cause === "string") {
  31529. message = error.cause;
  31530. }
  31531. }
  31532. }
  31533. const requestError = new RequestError(message, 500, {
  31534. request: requestOptions
  31535. });
  31536. requestError.cause = error;
  31537. throw requestError;
  31538. }
  31539. const status = fetchResponse.status;
  31540. const url = fetchResponse.url;
  31541. const responseHeaders = {};
  31542. for (const [key, value] of fetchResponse.headers) {
  31543. responseHeaders[key] = value;
  31544. }
  31545. const octokitResponse = {
  31546. url,
  31547. status,
  31548. headers: responseHeaders,
  31549. data: ""
  31550. };
  31551. if ("deprecation" in responseHeaders) {
  31552. const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
  31553. const deprecationLink = matches && matches.pop();
  31554. log.warn(
  31555. `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
  31556. );
  31557. }
  31558. if (status === 204 || status === 205) {
  31559. return octokitResponse;
  31560. }
  31561. if (requestOptions.method === "HEAD") {
  31562. if (status < 400) {
  31563. return octokitResponse;
  31564. }
  31565. throw new RequestError(fetchResponse.statusText, status, {
  31566. response: octokitResponse,
  31567. request: requestOptions
  31568. });
  31569. }
  31570. if (status === 304) {
  31571. octokitResponse.data = await getResponseData(fetchResponse);
  31572. throw new RequestError("Not modified", status, {
  31573. response: octokitResponse,
  31574. request: requestOptions
  31575. });
  31576. }
  31577. if (status >= 400) {
  31578. octokitResponse.data = await getResponseData(fetchResponse);
  31579. throw new RequestError(toErrorMessage(octokitResponse.data), status, {
  31580. response: octokitResponse,
  31581. request: requestOptions
  31582. });
  31583. }
  31584. octokitResponse.data = parseSuccessResponseBody ? await getResponseData(fetchResponse) : fetchResponse.body;
  31585. return octokitResponse;
  31586. }
  31587. async function getResponseData(response) {
  31588. const contentType = response.headers.get("content-type");
  31589. if (!contentType) {
  31590. return response.text().catch(noop);
  31591. }
  31592. const mimetype = (0,dist/* parse */.qg)(contentType);
  31593. if (isJSONResponse(mimetype)) {
  31594. let text = "";
  31595. try {
  31596. text = await response.text();
  31597. return JSONParse(text);
  31598. } catch (err) {
  31599. return text;
  31600. }
  31601. } else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") {
  31602. return response.text().catch(noop);
  31603. } else {
  31604. return response.arrayBuffer().catch(
  31605. /* v8 ignore next -- @preserve */
  31606. () => new ArrayBuffer(0)
  31607. );
  31608. }
  31609. }
  31610. function isJSONResponse(mimetype) {
  31611. return mimetype.type === "application/json" || mimetype.type === "application/scim+json";
  31612. }
  31613. function toErrorMessage(data) {
  31614. if (typeof data === "string") {
  31615. return data;
  31616. }
  31617. if (data instanceof ArrayBuffer) {
  31618. return "Unknown error";
  31619. }
  31620. if ("message" in data) {
  31621. const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
  31622. return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`;
  31623. }
  31624. return `Unknown error: ${JSON.stringify(data)}`;
  31625. }
  31626. // pkg/dist-src/with-defaults.js
  31627. function dist_bundle_withDefaults(oldEndpoint, newDefaults) {
  31628. const endpoint2 = oldEndpoint.defaults(newDefaults);
  31629. const newApi = function(route, parameters) {
  31630. const endpointOptions = endpoint2.merge(route, parameters);
  31631. if (!endpointOptions.request || !endpointOptions.request.hook) {
  31632. return fetchWrapper(endpoint2.parse(endpointOptions));
  31633. }
  31634. const request2 = (route2, parameters2) => {
  31635. return fetchWrapper(
  31636. endpoint2.parse(endpoint2.merge(route2, parameters2))
  31637. );
  31638. };
  31639. Object.assign(request2, {
  31640. endpoint: endpoint2,
  31641. defaults: dist_bundle_withDefaults.bind(null, endpoint2)
  31642. });
  31643. return endpointOptions.request.hook(request2, endpointOptions);
  31644. };
  31645. return Object.assign(newApi, {
  31646. endpoint: endpoint2,
  31647. defaults: dist_bundle_withDefaults.bind(null, endpoint2)
  31648. });
  31649. }
  31650. // pkg/dist-src/index.js
  31651. var request = dist_bundle_withDefaults(endpoint, defaults_default);
  31652. /* v8 ignore next -- @preserve */
  31653. /* v8 ignore else -- @preserve */
  31654. ;// CONCATENATED MODULE: ./node_modules/@octokit/graphql/dist-bundle/index.js
  31655. // pkg/dist-src/index.js
  31656. // pkg/dist-src/version.js
  31657. var graphql_dist_bundle_VERSION = "0.0.0-development";
  31658. // pkg/dist-src/with-defaults.js
  31659. // pkg/dist-src/graphql.js
  31660. // pkg/dist-src/error.js
  31661. function _buildMessageForResponseErrors(data) {
  31662. return `Request failed due to following response errors:
  31663. ` + data.errors.map((e) => ` - ${e.message}`).join("\n");
  31664. }
  31665. var GraphqlResponseError = class extends Error {
  31666. constructor(request2, headers, response) {
  31667. super(_buildMessageForResponseErrors(response));
  31668. this.request = request2;
  31669. this.headers = headers;
  31670. this.response = response;
  31671. this.errors = response.errors;
  31672. this.data = response.data;
  31673. if (Error.captureStackTrace) {
  31674. Error.captureStackTrace(this, this.constructor);
  31675. }
  31676. }
  31677. name = "GraphqlResponseError";
  31678. errors;
  31679. data;
  31680. };
  31681. // pkg/dist-src/graphql.js
  31682. var NON_VARIABLE_OPTIONS = [
  31683. "method",
  31684. "baseUrl",
  31685. "url",
  31686. "headers",
  31687. "request",
  31688. "query",
  31689. "mediaType",
  31690. "operationName"
  31691. ];
  31692. var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
  31693. var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
  31694. function graphql(request2, query, options) {
  31695. if (options) {
  31696. if (typeof query === "string" && "query" in options) {
  31697. return Promise.reject(
  31698. new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
  31699. );
  31700. }
  31701. for (const key in options) {
  31702. if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue;
  31703. return Promise.reject(
  31704. new Error(
  31705. `[@octokit/graphql] "${key}" cannot be used as variable name`
  31706. )
  31707. );
  31708. }
  31709. }
  31710. const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
  31711. const requestOptions = Object.keys(
  31712. parsedOptions
  31713. ).reduce((result, key) => {
  31714. if (NON_VARIABLE_OPTIONS.includes(key)) {
  31715. result[key] = parsedOptions[key];
  31716. return result;
  31717. }
  31718. if (!result.variables) {
  31719. result.variables = {};
  31720. }
  31721. result.variables[key] = parsedOptions[key];
  31722. return result;
  31723. }, {});
  31724. const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl;
  31725. if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
  31726. requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
  31727. }
  31728. return request2(requestOptions).then((response) => {
  31729. if (response.data.errors) {
  31730. const headers = {};
  31731. for (const key of Object.keys(response.headers)) {
  31732. headers[key] = response.headers[key];
  31733. }
  31734. throw new GraphqlResponseError(
  31735. requestOptions,
  31736. headers,
  31737. response.data
  31738. );
  31739. }
  31740. return response.data.data;
  31741. });
  31742. }
  31743. // pkg/dist-src/with-defaults.js
  31744. function graphql_dist_bundle_withDefaults(request2, newDefaults) {
  31745. const newRequest = request2.defaults(newDefaults);
  31746. const newApi = (query, options) => {
  31747. return graphql(newRequest, query, options);
  31748. };
  31749. return Object.assign(newApi, {
  31750. defaults: graphql_dist_bundle_withDefaults.bind(null, newRequest),
  31751. endpoint: newRequest.endpoint
  31752. });
  31753. }
  31754. // pkg/dist-src/index.js
  31755. var graphql2 = graphql_dist_bundle_withDefaults(request, {
  31756. headers: {
  31757. "user-agent": `octokit-graphql.js/${graphql_dist_bundle_VERSION} ${getUserAgent()}`
  31758. },
  31759. method: "POST",
  31760. url: "/graphql"
  31761. });
  31762. function withCustomRequest(customRequest) {
  31763. return graphql_dist_bundle_withDefaults(customRequest, {
  31764. method: "POST",
  31765. url: "/graphql"
  31766. });
  31767. }
  31768. ;// CONCATENATED MODULE: ./node_modules/@octokit/auth-token/dist-bundle/index.js
  31769. // pkg/dist-src/is-jwt.js
  31770. var b64url = "(?:[a-zA-Z0-9_-]+)";
  31771. var sep = "\\.";
  31772. var jwtRE = new RegExp(`^${b64url}${sep}${b64url}${sep}${b64url}$`);
  31773. var isJWT = jwtRE.test.bind(jwtRE);
  31774. // pkg/dist-src/auth.js
  31775. async function auth(token) {
  31776. const isApp = isJWT(token);
  31777. const isInstallation = token.startsWith("v1.") || token.startsWith("ghs_");
  31778. const isUserToServer = token.startsWith("ghu_");
  31779. const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
  31780. return {
  31781. type: "token",
  31782. token,
  31783. tokenType
  31784. };
  31785. }
  31786. // pkg/dist-src/with-authorization-prefix.js
  31787. function withAuthorizationPrefix(token) {
  31788. if (token.split(/\./).length === 3) {
  31789. return `bearer ${token}`;
  31790. }
  31791. return `token ${token}`;
  31792. }
  31793. // pkg/dist-src/hook.js
  31794. async function hook(token, request, route, parameters) {
  31795. const endpoint = request.endpoint.merge(
  31796. route,
  31797. parameters
  31798. );
  31799. endpoint.headers.authorization = withAuthorizationPrefix(token);
  31800. return request(endpoint);
  31801. }
  31802. // pkg/dist-src/index.js
  31803. var createTokenAuth = function createTokenAuth2(token) {
  31804. if (!token) {
  31805. throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
  31806. }
  31807. if (typeof token !== "string") {
  31808. throw new Error(
  31809. "[@octokit/auth-token] Token passed to createTokenAuth is not a string"
  31810. );
  31811. }
  31812. token = token.replace(/^(token|bearer) +/i, "");
  31813. return Object.assign(auth.bind(null, token), {
  31814. hook: hook.bind(null, token)
  31815. });
  31816. };
  31817. ;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/version.js
  31818. const version_VERSION = "7.0.6";
  31819. ;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/index.js
  31820. const dist_src_noop = () => {
  31821. };
  31822. const consoleWarn = console.warn.bind(console);
  31823. const consoleError = console.error.bind(console);
  31824. function createLogger(logger = {}) {
  31825. if (typeof logger.debug !== "function") {
  31826. logger.debug = dist_src_noop;
  31827. }
  31828. if (typeof logger.info !== "function") {
  31829. logger.info = dist_src_noop;
  31830. }
  31831. if (typeof logger.warn !== "function") {
  31832. logger.warn = consoleWarn;
  31833. }
  31834. if (typeof logger.error !== "function") {
  31835. logger.error = consoleError;
  31836. }
  31837. return logger;
  31838. }
  31839. const userAgentTrail = `octokit-core.js/${version_VERSION} ${getUserAgent()}`;
  31840. class Octokit {
  31841. static VERSION = version_VERSION;
  31842. static defaults(defaults) {
  31843. const OctokitWithDefaults = class extends this {
  31844. constructor(...args) {
  31845. const options = args[0] || {};
  31846. if (typeof defaults === "function") {
  31847. super(defaults(options));
  31848. return;
  31849. }
  31850. super(
  31851. Object.assign(
  31852. {},
  31853. defaults,
  31854. options,
  31855. options.userAgent && defaults.userAgent ? {
  31856. userAgent: `${options.userAgent} ${defaults.userAgent}`
  31857. } : null
  31858. )
  31859. );
  31860. }
  31861. };
  31862. return OctokitWithDefaults;
  31863. }
  31864. static plugins = [];
  31865. /**
  31866. * Attach a plugin (or many) to your Octokit instance.
  31867. *
  31868. * @example
  31869. * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
  31870. */
  31871. static plugin(...newPlugins) {
  31872. const currentPlugins = this.plugins;
  31873. const NewOctokit = class extends this {
  31874. static plugins = currentPlugins.concat(
  31875. newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
  31876. );
  31877. };
  31878. return NewOctokit;
  31879. }
  31880. constructor(options = {}) {
  31881. const hook = new before_after_hook.Collection();
  31882. const requestDefaults = {
  31883. baseUrl: request.endpoint.DEFAULTS.baseUrl,
  31884. headers: {},
  31885. request: Object.assign({}, options.request, {
  31886. // @ts-ignore internal usage only, no need to type
  31887. hook: hook.bind(null, "request")
  31888. }),
  31889. mediaType: {
  31890. previews: [],
  31891. format: ""
  31892. }
  31893. };
  31894. requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;
  31895. if (options.baseUrl) {
  31896. requestDefaults.baseUrl = options.baseUrl;
  31897. }
  31898. if (options.previews) {
  31899. requestDefaults.mediaType.previews = options.previews;
  31900. }
  31901. if (options.timeZone) {
  31902. requestDefaults.headers["time-zone"] = options.timeZone;
  31903. }
  31904. this.request = request.defaults(requestDefaults);
  31905. this.graphql = withCustomRequest(this.request).defaults(requestDefaults);
  31906. this.log = createLogger(options.log);
  31907. this.hook = hook;
  31908. if (!options.authStrategy) {
  31909. if (!options.auth) {
  31910. this.auth = async () => ({
  31911. type: "unauthenticated"
  31912. });
  31913. } else {
  31914. const auth = createTokenAuth(options.auth);
  31915. hook.wrap("request", auth.hook);
  31916. this.auth = auth;
  31917. }
  31918. } else {
  31919. const { authStrategy, ...otherOptions } = options;
  31920. const auth = authStrategy(
  31921. Object.assign(
  31922. {
  31923. request: this.request,
  31924. log: this.log,
  31925. // we pass the current octokit instance as well as its constructor options
  31926. // to allow for authentication strategies that return a new octokit instance
  31927. // that shares the same internal state as the current one. The original
  31928. // requirement for this was the "event-octokit" authentication strategy
  31929. // of https://github.com/probot/octokit-auth-probot.
  31930. octokit: this,
  31931. octokitOptions: otherOptions
  31932. },
  31933. options.auth
  31934. )
  31935. );
  31936. hook.wrap("request", auth.hook);
  31937. this.auth = auth;
  31938. }
  31939. const classConstructor = this.constructor;
  31940. for (let i = 0; i < classConstructor.plugins.length; ++i) {
  31941. Object.assign(this, classConstructor.plugins[i](this, options));
  31942. }
  31943. }
  31944. // assigned during constructor
  31945. request;
  31946. graphql;
  31947. log;
  31948. hook;
  31949. // TODO: type `octokit.auth` based on passed options.authStrategy
  31950. auth;
  31951. }
  31952. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js
  31953. const dist_src_version_VERSION = "17.0.0";
  31954. //# sourceMappingURL=version.js.map
  31955. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js
  31956. const Endpoints = {
  31957. actions: {
  31958. addCustomLabelsToSelfHostedRunnerForOrg: [
  31959. "POST /orgs/{org}/actions/runners/{runner_id}/labels"
  31960. ],
  31961. addCustomLabelsToSelfHostedRunnerForRepo: [
  31962. "POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  31963. ],
  31964. addRepoAccessToSelfHostedRunnerGroupInOrg: [
  31965. "PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id}"
  31966. ],
  31967. addSelectedRepoToOrgSecret: [
  31968. "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"
  31969. ],
  31970. addSelectedRepoToOrgVariable: [
  31971. "PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id}"
  31972. ],
  31973. approveWorkflowRun: [
  31974. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve"
  31975. ],
  31976. cancelWorkflowRun: [
  31977. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"
  31978. ],
  31979. createEnvironmentVariable: [
  31980. "POST /repos/{owner}/{repo}/environments/{environment_name}/variables"
  31981. ],
  31982. createHostedRunnerForOrg: ["POST /orgs/{org}/actions/hosted-runners"],
  31983. createOrUpdateEnvironmentSecret: [
  31984. "PUT /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
  31985. ],
  31986. createOrUpdateOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}"],
  31987. createOrUpdateRepoSecret: [
  31988. "PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}"
  31989. ],
  31990. createOrgVariable: ["POST /orgs/{org}/actions/variables"],
  31991. createRegistrationTokenForOrg: [
  31992. "POST /orgs/{org}/actions/runners/registration-token"
  31993. ],
  31994. createRegistrationTokenForRepo: [
  31995. "POST /repos/{owner}/{repo}/actions/runners/registration-token"
  31996. ],
  31997. createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"],
  31998. createRemoveTokenForRepo: [
  31999. "POST /repos/{owner}/{repo}/actions/runners/remove-token"
  32000. ],
  32001. createRepoVariable: ["POST /repos/{owner}/{repo}/actions/variables"],
  32002. createWorkflowDispatch: [
  32003. "POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"
  32004. ],
  32005. deleteActionsCacheById: [
  32006. "DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}"
  32007. ],
  32008. deleteActionsCacheByKey: [
  32009. "DELETE /repos/{owner}/{repo}/actions/caches{?key,ref}"
  32010. ],
  32011. deleteArtifact: [
  32012. "DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"
  32013. ],
  32014. deleteCustomImageFromOrg: [
  32015. "DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}"
  32016. ],
  32017. deleteCustomImageVersionFromOrg: [
  32018. "DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version}"
  32019. ],
  32020. deleteEnvironmentSecret: [
  32021. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
  32022. ],
  32023. deleteEnvironmentVariable: [
  32024. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
  32025. ],
  32026. deleteHostedRunnerForOrg: [
  32027. "DELETE /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
  32028. ],
  32029. deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"],
  32030. deleteOrgVariable: ["DELETE /orgs/{org}/actions/variables/{name}"],
  32031. deleteRepoSecret: [
  32032. "DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}"
  32033. ],
  32034. deleteRepoVariable: [
  32035. "DELETE /repos/{owner}/{repo}/actions/variables/{name}"
  32036. ],
  32037. deleteSelfHostedRunnerFromOrg: [
  32038. "DELETE /orgs/{org}/actions/runners/{runner_id}"
  32039. ],
  32040. deleteSelfHostedRunnerFromRepo: [
  32041. "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"
  32042. ],
  32043. deleteWorkflowRun: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}"],
  32044. deleteWorkflowRunLogs: [
  32045. "DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs"
  32046. ],
  32047. disableSelectedRepositoryGithubActionsOrganization: [
  32048. "DELETE /orgs/{org}/actions/permissions/repositories/{repository_id}"
  32049. ],
  32050. disableWorkflow: [
  32051. "PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable"
  32052. ],
  32053. downloadArtifact: [
  32054. "GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"
  32055. ],
  32056. downloadJobLogsForWorkflowRun: [
  32057. "GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"
  32058. ],
  32059. downloadWorkflowRunAttemptLogs: [
  32060. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs"
  32061. ],
  32062. downloadWorkflowRunLogs: [
  32063. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"
  32064. ],
  32065. enableSelectedRepositoryGithubActionsOrganization: [
  32066. "PUT /orgs/{org}/actions/permissions/repositories/{repository_id}"
  32067. ],
  32068. enableWorkflow: [
  32069. "PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable"
  32070. ],
  32071. forceCancelWorkflowRun: [
  32072. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel"
  32073. ],
  32074. generateRunnerJitconfigForOrg: [
  32075. "POST /orgs/{org}/actions/runners/generate-jitconfig"
  32076. ],
  32077. generateRunnerJitconfigForRepo: [
  32078. "POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig"
  32079. ],
  32080. getActionsCacheList: ["GET /repos/{owner}/{repo}/actions/caches"],
  32081. getActionsCacheUsage: ["GET /repos/{owner}/{repo}/actions/cache/usage"],
  32082. getActionsCacheUsageByRepoForOrg: [
  32083. "GET /orgs/{org}/actions/cache/usage-by-repository"
  32084. ],
  32085. getActionsCacheUsageForOrg: ["GET /orgs/{org}/actions/cache/usage"],
  32086. getAllowedActionsOrganization: [
  32087. "GET /orgs/{org}/actions/permissions/selected-actions"
  32088. ],
  32089. getAllowedActionsRepository: [
  32090. "GET /repos/{owner}/{repo}/actions/permissions/selected-actions"
  32091. ],
  32092. getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"],
  32093. getCustomImageForOrg: [
  32094. "GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}"
  32095. ],
  32096. getCustomImageVersionForOrg: [
  32097. "GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version}"
  32098. ],
  32099. getCustomOidcSubClaimForRepo: [
  32100. "GET /repos/{owner}/{repo}/actions/oidc/customization/sub"
  32101. ],
  32102. getEnvironmentPublicKey: [
  32103. "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/public-key"
  32104. ],
  32105. getEnvironmentSecret: [
  32106. "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
  32107. ],
  32108. getEnvironmentVariable: [
  32109. "GET /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
  32110. ],
  32111. getGithubActionsDefaultWorkflowPermissionsOrganization: [
  32112. "GET /orgs/{org}/actions/permissions/workflow"
  32113. ],
  32114. getGithubActionsDefaultWorkflowPermissionsRepository: [
  32115. "GET /repos/{owner}/{repo}/actions/permissions/workflow"
  32116. ],
  32117. getGithubActionsPermissionsOrganization: [
  32118. "GET /orgs/{org}/actions/permissions"
  32119. ],
  32120. getGithubActionsPermissionsRepository: [
  32121. "GET /repos/{owner}/{repo}/actions/permissions"
  32122. ],
  32123. getHostedRunnerForOrg: [
  32124. "GET /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
  32125. ],
  32126. getHostedRunnersGithubOwnedImagesForOrg: [
  32127. "GET /orgs/{org}/actions/hosted-runners/images/github-owned"
  32128. ],
  32129. getHostedRunnersLimitsForOrg: [
  32130. "GET /orgs/{org}/actions/hosted-runners/limits"
  32131. ],
  32132. getHostedRunnersMachineSpecsForOrg: [
  32133. "GET /orgs/{org}/actions/hosted-runners/machine-sizes"
  32134. ],
  32135. getHostedRunnersPartnerImagesForOrg: [
  32136. "GET /orgs/{org}/actions/hosted-runners/images/partner"
  32137. ],
  32138. getHostedRunnersPlatformsForOrg: [
  32139. "GET /orgs/{org}/actions/hosted-runners/platforms"
  32140. ],
  32141. getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"],
  32142. getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"],
  32143. getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"],
  32144. getOrgVariable: ["GET /orgs/{org}/actions/variables/{name}"],
  32145. getPendingDeploymentsForRun: [
  32146. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"
  32147. ],
  32148. getRepoPermissions: [
  32149. "GET /repos/{owner}/{repo}/actions/permissions",
  32150. {},
  32151. { renamed: ["actions", "getGithubActionsPermissionsRepository"] }
  32152. ],
  32153. getRepoPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"],
  32154. getRepoSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{secret_name}"],
  32155. getRepoVariable: ["GET /repos/{owner}/{repo}/actions/variables/{name}"],
  32156. getReviewsForRun: [
  32157. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals"
  32158. ],
  32159. getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"],
  32160. getSelfHostedRunnerForRepo: [
  32161. "GET /repos/{owner}/{repo}/actions/runners/{runner_id}"
  32162. ],
  32163. getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"],
  32164. getWorkflowAccessToRepository: [
  32165. "GET /repos/{owner}/{repo}/actions/permissions/access"
  32166. ],
  32167. getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"],
  32168. getWorkflowRunAttempt: [
  32169. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}"
  32170. ],
  32171. getWorkflowRunUsage: [
  32172. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"
  32173. ],
  32174. getWorkflowUsage: [
  32175. "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing"
  32176. ],
  32177. listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"],
  32178. listCustomImageVersionsForOrg: [
  32179. "GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions"
  32180. ],
  32181. listCustomImagesForOrg: [
  32182. "GET /orgs/{org}/actions/hosted-runners/images/custom"
  32183. ],
  32184. listEnvironmentSecrets: [
  32185. "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets"
  32186. ],
  32187. listEnvironmentVariables: [
  32188. "GET /repos/{owner}/{repo}/environments/{environment_name}/variables"
  32189. ],
  32190. listGithubHostedRunnersInGroupForOrg: [
  32191. "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/hosted-runners"
  32192. ],
  32193. listHostedRunnersForOrg: ["GET /orgs/{org}/actions/hosted-runners"],
  32194. listJobsForWorkflowRun: [
  32195. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"
  32196. ],
  32197. listJobsForWorkflowRunAttempt: [
  32198. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs"
  32199. ],
  32200. listLabelsForSelfHostedRunnerForOrg: [
  32201. "GET /orgs/{org}/actions/runners/{runner_id}/labels"
  32202. ],
  32203. listLabelsForSelfHostedRunnerForRepo: [
  32204. "GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  32205. ],
  32206. listOrgSecrets: ["GET /orgs/{org}/actions/secrets"],
  32207. listOrgVariables: ["GET /orgs/{org}/actions/variables"],
  32208. listRepoOrganizationSecrets: [
  32209. "GET /repos/{owner}/{repo}/actions/organization-secrets"
  32210. ],
  32211. listRepoOrganizationVariables: [
  32212. "GET /repos/{owner}/{repo}/actions/organization-variables"
  32213. ],
  32214. listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"],
  32215. listRepoVariables: ["GET /repos/{owner}/{repo}/actions/variables"],
  32216. listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"],
  32217. listRunnerApplicationsForOrg: ["GET /orgs/{org}/actions/runners/downloads"],
  32218. listRunnerApplicationsForRepo: [
  32219. "GET /repos/{owner}/{repo}/actions/runners/downloads"
  32220. ],
  32221. listSelectedReposForOrgSecret: [
  32222. "GET /orgs/{org}/actions/secrets/{secret_name}/repositories"
  32223. ],
  32224. listSelectedReposForOrgVariable: [
  32225. "GET /orgs/{org}/actions/variables/{name}/repositories"
  32226. ],
  32227. listSelectedRepositoriesEnabledGithubActionsOrganization: [
  32228. "GET /orgs/{org}/actions/permissions/repositories"
  32229. ],
  32230. listSelfHostedRunnersForOrg: ["GET /orgs/{org}/actions/runners"],
  32231. listSelfHostedRunnersForRepo: ["GET /repos/{owner}/{repo}/actions/runners"],
  32232. listWorkflowRunArtifacts: [
  32233. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"
  32234. ],
  32235. listWorkflowRuns: [
  32236. "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"
  32237. ],
  32238. listWorkflowRunsForRepo: ["GET /repos/{owner}/{repo}/actions/runs"],
  32239. reRunJobForWorkflowRun: [
  32240. "POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun"
  32241. ],
  32242. reRunWorkflow: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun"],
  32243. reRunWorkflowFailedJobs: [
  32244. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs"
  32245. ],
  32246. removeAllCustomLabelsFromSelfHostedRunnerForOrg: [
  32247. "DELETE /orgs/{org}/actions/runners/{runner_id}/labels"
  32248. ],
  32249. removeAllCustomLabelsFromSelfHostedRunnerForRepo: [
  32250. "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  32251. ],
  32252. removeCustomLabelFromSelfHostedRunnerForOrg: [
  32253. "DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name}"
  32254. ],
  32255. removeCustomLabelFromSelfHostedRunnerForRepo: [
  32256. "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name}"
  32257. ],
  32258. removeSelectedRepoFromOrgSecret: [
  32259. "DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"
  32260. ],
  32261. removeSelectedRepoFromOrgVariable: [
  32262. "DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id}"
  32263. ],
  32264. reviewCustomGatesForRun: [
  32265. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule"
  32266. ],
  32267. reviewPendingDeploymentsForRun: [
  32268. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"
  32269. ],
  32270. setAllowedActionsOrganization: [
  32271. "PUT /orgs/{org}/actions/permissions/selected-actions"
  32272. ],
  32273. setAllowedActionsRepository: [
  32274. "PUT /repos/{owner}/{repo}/actions/permissions/selected-actions"
  32275. ],
  32276. setCustomLabelsForSelfHostedRunnerForOrg: [
  32277. "PUT /orgs/{org}/actions/runners/{runner_id}/labels"
  32278. ],
  32279. setCustomLabelsForSelfHostedRunnerForRepo: [
  32280. "PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  32281. ],
  32282. setCustomOidcSubClaimForRepo: [
  32283. "PUT /repos/{owner}/{repo}/actions/oidc/customization/sub"
  32284. ],
  32285. setGithubActionsDefaultWorkflowPermissionsOrganization: [
  32286. "PUT /orgs/{org}/actions/permissions/workflow"
  32287. ],
  32288. setGithubActionsDefaultWorkflowPermissionsRepository: [
  32289. "PUT /repos/{owner}/{repo}/actions/permissions/workflow"
  32290. ],
  32291. setGithubActionsPermissionsOrganization: [
  32292. "PUT /orgs/{org}/actions/permissions"
  32293. ],
  32294. setGithubActionsPermissionsRepository: [
  32295. "PUT /repos/{owner}/{repo}/actions/permissions"
  32296. ],
  32297. setSelectedReposForOrgSecret: [
  32298. "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories"
  32299. ],
  32300. setSelectedReposForOrgVariable: [
  32301. "PUT /orgs/{org}/actions/variables/{name}/repositories"
  32302. ],
  32303. setSelectedRepositoriesEnabledGithubActionsOrganization: [
  32304. "PUT /orgs/{org}/actions/permissions/repositories"
  32305. ],
  32306. setWorkflowAccessToRepository: [
  32307. "PUT /repos/{owner}/{repo}/actions/permissions/access"
  32308. ],
  32309. updateEnvironmentVariable: [
  32310. "PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
  32311. ],
  32312. updateHostedRunnerForOrg: [
  32313. "PATCH /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
  32314. ],
  32315. updateOrgVariable: ["PATCH /orgs/{org}/actions/variables/{name}"],
  32316. updateRepoVariable: [
  32317. "PATCH /repos/{owner}/{repo}/actions/variables/{name}"
  32318. ]
  32319. },
  32320. activity: {
  32321. checkRepoIsStarredByAuthenticatedUser: ["GET /user/starred/{owner}/{repo}"],
  32322. deleteRepoSubscription: ["DELETE /repos/{owner}/{repo}/subscription"],
  32323. deleteThreadSubscription: [
  32324. "DELETE /notifications/threads/{thread_id}/subscription"
  32325. ],
  32326. getFeeds: ["GET /feeds"],
  32327. getRepoSubscription: ["GET /repos/{owner}/{repo}/subscription"],
  32328. getThread: ["GET /notifications/threads/{thread_id}"],
  32329. getThreadSubscriptionForAuthenticatedUser: [
  32330. "GET /notifications/threads/{thread_id}/subscription"
  32331. ],
  32332. listEventsForAuthenticatedUser: ["GET /users/{username}/events"],
  32333. listNotificationsForAuthenticatedUser: ["GET /notifications"],
  32334. listOrgEventsForAuthenticatedUser: [
  32335. "GET /users/{username}/events/orgs/{org}"
  32336. ],
  32337. listPublicEvents: ["GET /events"],
  32338. listPublicEventsForRepoNetwork: ["GET /networks/{owner}/{repo}/events"],
  32339. listPublicEventsForUser: ["GET /users/{username}/events/public"],
  32340. listPublicOrgEvents: ["GET /orgs/{org}/events"],
  32341. listReceivedEventsForUser: ["GET /users/{username}/received_events"],
  32342. listReceivedPublicEventsForUser: [
  32343. "GET /users/{username}/received_events/public"
  32344. ],
  32345. listRepoEvents: ["GET /repos/{owner}/{repo}/events"],
  32346. listRepoNotificationsForAuthenticatedUser: [
  32347. "GET /repos/{owner}/{repo}/notifications"
  32348. ],
  32349. listReposStarredByAuthenticatedUser: ["GET /user/starred"],
  32350. listReposStarredByUser: ["GET /users/{username}/starred"],
  32351. listReposWatchedByUser: ["GET /users/{username}/subscriptions"],
  32352. listStargazersForRepo: ["GET /repos/{owner}/{repo}/stargazers"],
  32353. listWatchedReposForAuthenticatedUser: ["GET /user/subscriptions"],
  32354. listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"],
  32355. markNotificationsAsRead: ["PUT /notifications"],
  32356. markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"],
  32357. markThreadAsDone: ["DELETE /notifications/threads/{thread_id}"],
  32358. markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"],
  32359. setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"],
  32360. setThreadSubscription: [
  32361. "PUT /notifications/threads/{thread_id}/subscription"
  32362. ],
  32363. starRepoForAuthenticatedUser: ["PUT /user/starred/{owner}/{repo}"],
  32364. unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
  32365. },
  32366. apps: {
  32367. addRepoToInstallation: [
  32368. "PUT /user/installations/{installation_id}/repositories/{repository_id}",
  32369. {},
  32370. { renamed: ["apps", "addRepoToInstallationForAuthenticatedUser"] }
  32371. ],
  32372. addRepoToInstallationForAuthenticatedUser: [
  32373. "PUT /user/installations/{installation_id}/repositories/{repository_id}"
  32374. ],
  32375. checkToken: ["POST /applications/{client_id}/token"],
  32376. createFromManifest: ["POST /app-manifests/{code}/conversions"],
  32377. createInstallationAccessToken: [
  32378. "POST /app/installations/{installation_id}/access_tokens"
  32379. ],
  32380. deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
  32381. deleteInstallation: ["DELETE /app/installations/{installation_id}"],
  32382. deleteToken: ["DELETE /applications/{client_id}/token"],
  32383. getAuthenticated: ["GET /app"],
  32384. getBySlug: ["GET /apps/{app_slug}"],
  32385. getInstallation: ["GET /app/installations/{installation_id}"],
  32386. getOrgInstallation: ["GET /orgs/{org}/installation"],
  32387. getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"],
  32388. getSubscriptionPlanForAccount: [
  32389. "GET /marketplace_listing/accounts/{account_id}"
  32390. ],
  32391. getSubscriptionPlanForAccountStubbed: [
  32392. "GET /marketplace_listing/stubbed/accounts/{account_id}"
  32393. ],
  32394. getUserInstallation: ["GET /users/{username}/installation"],
  32395. getWebhookConfigForApp: ["GET /app/hook/config"],
  32396. getWebhookDelivery: ["GET /app/hook/deliveries/{delivery_id}"],
  32397. listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
  32398. listAccountsForPlanStubbed: [
  32399. "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"
  32400. ],
  32401. listInstallationReposForAuthenticatedUser: [
  32402. "GET /user/installations/{installation_id}/repositories"
  32403. ],
  32404. listInstallationRequestsForAuthenticatedApp: [
  32405. "GET /app/installation-requests"
  32406. ],
  32407. listInstallations: ["GET /app/installations"],
  32408. listInstallationsForAuthenticatedUser: ["GET /user/installations"],
  32409. listPlans: ["GET /marketplace_listing/plans"],
  32410. listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
  32411. listReposAccessibleToInstallation: ["GET /installation/repositories"],
  32412. listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
  32413. listSubscriptionsForAuthenticatedUserStubbed: [
  32414. "GET /user/marketplace_purchases/stubbed"
  32415. ],
  32416. listWebhookDeliveries: ["GET /app/hook/deliveries"],
  32417. redeliverWebhookDelivery: [
  32418. "POST /app/hook/deliveries/{delivery_id}/attempts"
  32419. ],
  32420. removeRepoFromInstallation: [
  32421. "DELETE /user/installations/{installation_id}/repositories/{repository_id}",
  32422. {},
  32423. { renamed: ["apps", "removeRepoFromInstallationForAuthenticatedUser"] }
  32424. ],
  32425. removeRepoFromInstallationForAuthenticatedUser: [
  32426. "DELETE /user/installations/{installation_id}/repositories/{repository_id}"
  32427. ],
  32428. resetToken: ["PATCH /applications/{client_id}/token"],
  32429. revokeInstallationAccessToken: ["DELETE /installation/token"],
  32430. scopeToken: ["POST /applications/{client_id}/token/scoped"],
  32431. suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
  32432. unsuspendInstallation: [
  32433. "DELETE /app/installations/{installation_id}/suspended"
  32434. ],
  32435. updateWebhookConfigForApp: ["PATCH /app/hook/config"]
  32436. },
  32437. billing: {
  32438. getGithubActionsBillingOrg: ["GET /orgs/{org}/settings/billing/actions"],
  32439. getGithubActionsBillingUser: [
  32440. "GET /users/{username}/settings/billing/actions"
  32441. ],
  32442. getGithubBillingPremiumRequestUsageReportOrg: [
  32443. "GET /organizations/{org}/settings/billing/premium_request/usage"
  32444. ],
  32445. getGithubBillingPremiumRequestUsageReportUser: [
  32446. "GET /users/{username}/settings/billing/premium_request/usage"
  32447. ],
  32448. getGithubBillingUsageReportOrg: [
  32449. "GET /organizations/{org}/settings/billing/usage"
  32450. ],
  32451. getGithubBillingUsageReportUser: [
  32452. "GET /users/{username}/settings/billing/usage"
  32453. ],
  32454. getGithubPackagesBillingOrg: ["GET /orgs/{org}/settings/billing/packages"],
  32455. getGithubPackagesBillingUser: [
  32456. "GET /users/{username}/settings/billing/packages"
  32457. ],
  32458. getSharedStorageBillingOrg: [
  32459. "GET /orgs/{org}/settings/billing/shared-storage"
  32460. ],
  32461. getSharedStorageBillingUser: [
  32462. "GET /users/{username}/settings/billing/shared-storage"
  32463. ]
  32464. },
  32465. campaigns: {
  32466. createCampaign: ["POST /orgs/{org}/campaigns"],
  32467. deleteCampaign: ["DELETE /orgs/{org}/campaigns/{campaign_number}"],
  32468. getCampaignSummary: ["GET /orgs/{org}/campaigns/{campaign_number}"],
  32469. listOrgCampaigns: ["GET /orgs/{org}/campaigns"],
  32470. updateCampaign: ["PATCH /orgs/{org}/campaigns/{campaign_number}"]
  32471. },
  32472. checks: {
  32473. create: ["POST /repos/{owner}/{repo}/check-runs"],
  32474. createSuite: ["POST /repos/{owner}/{repo}/check-suites"],
  32475. get: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}"],
  32476. getSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}"],
  32477. listAnnotations: [
  32478. "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations"
  32479. ],
  32480. listForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-runs"],
  32481. listForSuite: [
  32482. "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs"
  32483. ],
  32484. listSuitesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-suites"],
  32485. rerequestRun: [
  32486. "POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest"
  32487. ],
  32488. rerequestSuite: [
  32489. "POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest"
  32490. ],
  32491. setSuitesPreferences: [
  32492. "PATCH /repos/{owner}/{repo}/check-suites/preferences"
  32493. ],
  32494. update: ["PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}"]
  32495. },
  32496. codeScanning: {
  32497. commitAutofix: [
  32498. "POST /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix/commits"
  32499. ],
  32500. createAutofix: [
  32501. "POST /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix"
  32502. ],
  32503. createVariantAnalysis: [
  32504. "POST /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses"
  32505. ],
  32506. deleteAnalysis: [
  32507. "DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}{?confirm_delete}"
  32508. ],
  32509. deleteCodeqlDatabase: [
  32510. "DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}"
  32511. ],
  32512. getAlert: [
  32513. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}",
  32514. {},
  32515. { renamedParameters: { alert_id: "alert_number" } }
  32516. ],
  32517. getAnalysis: [
  32518. "GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}"
  32519. ],
  32520. getAutofix: [
  32521. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix"
  32522. ],
  32523. getCodeqlDatabase: [
  32524. "GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}"
  32525. ],
  32526. getDefaultSetup: ["GET /repos/{owner}/{repo}/code-scanning/default-setup"],
  32527. getSarif: ["GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}"],
  32528. getVariantAnalysis: [
  32529. "GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}"
  32530. ],
  32531. getVariantAnalysisRepoTask: [
  32532. "GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}/repos/{repo_owner}/{repo_name}"
  32533. ],
  32534. listAlertInstances: [
  32535. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances"
  32536. ],
  32537. listAlertsForOrg: ["GET /orgs/{org}/code-scanning/alerts"],
  32538. listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
  32539. listAlertsInstances: [
  32540. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
  32541. {},
  32542. { renamed: ["codeScanning", "listAlertInstances"] }
  32543. ],
  32544. listCodeqlDatabases: [
  32545. "GET /repos/{owner}/{repo}/code-scanning/codeql/databases"
  32546. ],
  32547. listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"],
  32548. updateAlert: [
  32549. "PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"
  32550. ],
  32551. updateDefaultSetup: [
  32552. "PATCH /repos/{owner}/{repo}/code-scanning/default-setup"
  32553. ],
  32554. uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"]
  32555. },
  32556. codeSecurity: {
  32557. attachConfiguration: [
  32558. "POST /orgs/{org}/code-security/configurations/{configuration_id}/attach"
  32559. ],
  32560. attachEnterpriseConfiguration: [
  32561. "POST /enterprises/{enterprise}/code-security/configurations/{configuration_id}/attach"
  32562. ],
  32563. createConfiguration: ["POST /orgs/{org}/code-security/configurations"],
  32564. createConfigurationForEnterprise: [
  32565. "POST /enterprises/{enterprise}/code-security/configurations"
  32566. ],
  32567. deleteConfiguration: [
  32568. "DELETE /orgs/{org}/code-security/configurations/{configuration_id}"
  32569. ],
  32570. deleteConfigurationForEnterprise: [
  32571. "DELETE /enterprises/{enterprise}/code-security/configurations/{configuration_id}"
  32572. ],
  32573. detachConfiguration: [
  32574. "DELETE /orgs/{org}/code-security/configurations/detach"
  32575. ],
  32576. getConfiguration: [
  32577. "GET /orgs/{org}/code-security/configurations/{configuration_id}"
  32578. ],
  32579. getConfigurationForRepository: [
  32580. "GET /repos/{owner}/{repo}/code-security-configuration"
  32581. ],
  32582. getConfigurationsForEnterprise: [
  32583. "GET /enterprises/{enterprise}/code-security/configurations"
  32584. ],
  32585. getConfigurationsForOrg: ["GET /orgs/{org}/code-security/configurations"],
  32586. getDefaultConfigurations: [
  32587. "GET /orgs/{org}/code-security/configurations/defaults"
  32588. ],
  32589. getDefaultConfigurationsForEnterprise: [
  32590. "GET /enterprises/{enterprise}/code-security/configurations/defaults"
  32591. ],
  32592. getRepositoriesForConfiguration: [
  32593. "GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories"
  32594. ],
  32595. getRepositoriesForEnterpriseConfiguration: [
  32596. "GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories"
  32597. ],
  32598. getSingleConfigurationForEnterprise: [
  32599. "GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}"
  32600. ],
  32601. setConfigurationAsDefault: [
  32602. "PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults"
  32603. ],
  32604. setConfigurationAsDefaultForEnterprise: [
  32605. "PUT /enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults"
  32606. ],
  32607. updateConfiguration: [
  32608. "PATCH /orgs/{org}/code-security/configurations/{configuration_id}"
  32609. ],
  32610. updateEnterpriseConfiguration: [
  32611. "PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id}"
  32612. ]
  32613. },
  32614. codesOfConduct: {
  32615. getAllCodesOfConduct: ["GET /codes_of_conduct"],
  32616. getConductCode: ["GET /codes_of_conduct/{key}"]
  32617. },
  32618. codespaces: {
  32619. addRepositoryForSecretForAuthenticatedUser: [
  32620. "PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  32621. ],
  32622. addSelectedRepoToOrgSecret: [
  32623. "PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  32624. ],
  32625. checkPermissionsForDevcontainer: [
  32626. "GET /repos/{owner}/{repo}/codespaces/permissions_check"
  32627. ],
  32628. codespaceMachinesForAuthenticatedUser: [
  32629. "GET /user/codespaces/{codespace_name}/machines"
  32630. ],
  32631. createForAuthenticatedUser: ["POST /user/codespaces"],
  32632. createOrUpdateOrgSecret: [
  32633. "PUT /orgs/{org}/codespaces/secrets/{secret_name}"
  32634. ],
  32635. createOrUpdateRepoSecret: [
  32636. "PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
  32637. ],
  32638. createOrUpdateSecretForAuthenticatedUser: [
  32639. "PUT /user/codespaces/secrets/{secret_name}"
  32640. ],
  32641. createWithPrForAuthenticatedUser: [
  32642. "POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces"
  32643. ],
  32644. createWithRepoForAuthenticatedUser: [
  32645. "POST /repos/{owner}/{repo}/codespaces"
  32646. ],
  32647. deleteForAuthenticatedUser: ["DELETE /user/codespaces/{codespace_name}"],
  32648. deleteFromOrganization: [
  32649. "DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name}"
  32650. ],
  32651. deleteOrgSecret: ["DELETE /orgs/{org}/codespaces/secrets/{secret_name}"],
  32652. deleteRepoSecret: [
  32653. "DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
  32654. ],
  32655. deleteSecretForAuthenticatedUser: [
  32656. "DELETE /user/codespaces/secrets/{secret_name}"
  32657. ],
  32658. exportForAuthenticatedUser: [
  32659. "POST /user/codespaces/{codespace_name}/exports"
  32660. ],
  32661. getCodespacesForUserInOrg: [
  32662. "GET /orgs/{org}/members/{username}/codespaces"
  32663. ],
  32664. getExportDetailsForAuthenticatedUser: [
  32665. "GET /user/codespaces/{codespace_name}/exports/{export_id}"
  32666. ],
  32667. getForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}"],
  32668. getOrgPublicKey: ["GET /orgs/{org}/codespaces/secrets/public-key"],
  32669. getOrgSecret: ["GET /orgs/{org}/codespaces/secrets/{secret_name}"],
  32670. getPublicKeyForAuthenticatedUser: [
  32671. "GET /user/codespaces/secrets/public-key"
  32672. ],
  32673. getRepoPublicKey: [
  32674. "GET /repos/{owner}/{repo}/codespaces/secrets/public-key"
  32675. ],
  32676. getRepoSecret: [
  32677. "GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
  32678. ],
  32679. getSecretForAuthenticatedUser: [
  32680. "GET /user/codespaces/secrets/{secret_name}"
  32681. ],
  32682. listDevcontainersInRepositoryForAuthenticatedUser: [
  32683. "GET /repos/{owner}/{repo}/codespaces/devcontainers"
  32684. ],
  32685. listForAuthenticatedUser: ["GET /user/codespaces"],
  32686. listInOrganization: [
  32687. "GET /orgs/{org}/codespaces",
  32688. {},
  32689. { renamedParameters: { org_id: "org" } }
  32690. ],
  32691. listInRepositoryForAuthenticatedUser: [
  32692. "GET /repos/{owner}/{repo}/codespaces"
  32693. ],
  32694. listOrgSecrets: ["GET /orgs/{org}/codespaces/secrets"],
  32695. listRepoSecrets: ["GET /repos/{owner}/{repo}/codespaces/secrets"],
  32696. listRepositoriesForSecretForAuthenticatedUser: [
  32697. "GET /user/codespaces/secrets/{secret_name}/repositories"
  32698. ],
  32699. listSecretsForAuthenticatedUser: ["GET /user/codespaces/secrets"],
  32700. listSelectedReposForOrgSecret: [
  32701. "GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories"
  32702. ],
  32703. preFlightWithRepoForAuthenticatedUser: [
  32704. "GET /repos/{owner}/{repo}/codespaces/new"
  32705. ],
  32706. publishForAuthenticatedUser: [
  32707. "POST /user/codespaces/{codespace_name}/publish"
  32708. ],
  32709. removeRepositoryForSecretForAuthenticatedUser: [
  32710. "DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  32711. ],
  32712. removeSelectedRepoFromOrgSecret: [
  32713. "DELETE /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  32714. ],
  32715. repoMachinesForAuthenticatedUser: [
  32716. "GET /repos/{owner}/{repo}/codespaces/machines"
  32717. ],
  32718. setRepositoriesForSecretForAuthenticatedUser: [
  32719. "PUT /user/codespaces/secrets/{secret_name}/repositories"
  32720. ],
  32721. setSelectedReposForOrgSecret: [
  32722. "PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories"
  32723. ],
  32724. startForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/start"],
  32725. stopForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/stop"],
  32726. stopInOrganization: [
  32727. "POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop"
  32728. ],
  32729. updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"]
  32730. },
  32731. copilot: {
  32732. addCopilotSeatsForTeams: [
  32733. "POST /orgs/{org}/copilot/billing/selected_teams"
  32734. ],
  32735. addCopilotSeatsForUsers: [
  32736. "POST /orgs/{org}/copilot/billing/selected_users"
  32737. ],
  32738. cancelCopilotSeatAssignmentForTeams: [
  32739. "DELETE /orgs/{org}/copilot/billing/selected_teams"
  32740. ],
  32741. cancelCopilotSeatAssignmentForUsers: [
  32742. "DELETE /orgs/{org}/copilot/billing/selected_users"
  32743. ],
  32744. copilotMetricsForOrganization: ["GET /orgs/{org}/copilot/metrics"],
  32745. copilotMetricsForTeam: ["GET /orgs/{org}/team/{team_slug}/copilot/metrics"],
  32746. getCopilotOrganizationDetails: ["GET /orgs/{org}/copilot/billing"],
  32747. getCopilotSeatDetailsForUser: [
  32748. "GET /orgs/{org}/members/{username}/copilot"
  32749. ],
  32750. listCopilotSeats: ["GET /orgs/{org}/copilot/billing/seats"]
  32751. },
  32752. credentials: { revoke: ["POST /credentials/revoke"] },
  32753. dependabot: {
  32754. addSelectedRepoToOrgSecret: [
  32755. "PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"
  32756. ],
  32757. createOrUpdateOrgSecret: [
  32758. "PUT /orgs/{org}/dependabot/secrets/{secret_name}"
  32759. ],
  32760. createOrUpdateRepoSecret: [
  32761. "PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
  32762. ],
  32763. deleteOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}"],
  32764. deleteRepoSecret: [
  32765. "DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
  32766. ],
  32767. getAlert: ["GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number}"],
  32768. getOrgPublicKey: ["GET /orgs/{org}/dependabot/secrets/public-key"],
  32769. getOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}"],
  32770. getRepoPublicKey: [
  32771. "GET /repos/{owner}/{repo}/dependabot/secrets/public-key"
  32772. ],
  32773. getRepoSecret: [
  32774. "GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
  32775. ],
  32776. listAlertsForEnterprise: [
  32777. "GET /enterprises/{enterprise}/dependabot/alerts"
  32778. ],
  32779. listAlertsForOrg: ["GET /orgs/{org}/dependabot/alerts"],
  32780. listAlertsForRepo: ["GET /repos/{owner}/{repo}/dependabot/alerts"],
  32781. listOrgSecrets: ["GET /orgs/{org}/dependabot/secrets"],
  32782. listRepoSecrets: ["GET /repos/{owner}/{repo}/dependabot/secrets"],
  32783. listSelectedReposForOrgSecret: [
  32784. "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories"
  32785. ],
  32786. removeSelectedRepoFromOrgSecret: [
  32787. "DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"
  32788. ],
  32789. repositoryAccessForOrg: [
  32790. "GET /organizations/{org}/dependabot/repository-access"
  32791. ],
  32792. setRepositoryAccessDefaultLevel: [
  32793. "PUT /organizations/{org}/dependabot/repository-access/default-level"
  32794. ],
  32795. setSelectedReposForOrgSecret: [
  32796. "PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories"
  32797. ],
  32798. updateAlert: [
  32799. "PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number}"
  32800. ],
  32801. updateRepositoryAccessForOrg: [
  32802. "PATCH /organizations/{org}/dependabot/repository-access"
  32803. ]
  32804. },
  32805. dependencyGraph: {
  32806. createRepositorySnapshot: [
  32807. "POST /repos/{owner}/{repo}/dependency-graph/snapshots"
  32808. ],
  32809. diffRange: [
  32810. "GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}"
  32811. ],
  32812. exportSbom: ["GET /repos/{owner}/{repo}/dependency-graph/sbom"]
  32813. },
  32814. emojis: { get: ["GET /emojis"] },
  32815. enterpriseTeamMemberships: {
  32816. add: [
  32817. "PUT /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}"
  32818. ],
  32819. bulkAdd: [
  32820. "POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/add"
  32821. ],
  32822. bulkRemove: [
  32823. "POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/remove"
  32824. ],
  32825. get: [
  32826. "GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}"
  32827. ],
  32828. list: ["GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships"],
  32829. remove: [
  32830. "DELETE /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}"
  32831. ]
  32832. },
  32833. enterpriseTeamOrganizations: {
  32834. add: [
  32835. "PUT /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org}"
  32836. ],
  32837. bulkAdd: [
  32838. "POST /enterprises/{enterprise}/teams/{enterprise-team}/organizations/add"
  32839. ],
  32840. bulkRemove: [
  32841. "POST /enterprises/{enterprise}/teams/{enterprise-team}/organizations/remove"
  32842. ],
  32843. delete: [
  32844. "DELETE /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org}"
  32845. ],
  32846. getAssignment: [
  32847. "GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org}"
  32848. ],
  32849. getAssignments: [
  32850. "GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations"
  32851. ]
  32852. },
  32853. enterpriseTeams: {
  32854. create: ["POST /enterprises/{enterprise}/teams"],
  32855. delete: ["DELETE /enterprises/{enterprise}/teams/{team_slug}"],
  32856. get: ["GET /enterprises/{enterprise}/teams/{team_slug}"],
  32857. list: ["GET /enterprises/{enterprise}/teams"],
  32858. update: ["PATCH /enterprises/{enterprise}/teams/{team_slug}"]
  32859. },
  32860. gists: {
  32861. checkIsStarred: ["GET /gists/{gist_id}/star"],
  32862. create: ["POST /gists"],
  32863. createComment: ["POST /gists/{gist_id}/comments"],
  32864. delete: ["DELETE /gists/{gist_id}"],
  32865. deleteComment: ["DELETE /gists/{gist_id}/comments/{comment_id}"],
  32866. fork: ["POST /gists/{gist_id}/forks"],
  32867. get: ["GET /gists/{gist_id}"],
  32868. getComment: ["GET /gists/{gist_id}/comments/{comment_id}"],
  32869. getRevision: ["GET /gists/{gist_id}/{sha}"],
  32870. list: ["GET /gists"],
  32871. listComments: ["GET /gists/{gist_id}/comments"],
  32872. listCommits: ["GET /gists/{gist_id}/commits"],
  32873. listForUser: ["GET /users/{username}/gists"],
  32874. listForks: ["GET /gists/{gist_id}/forks"],
  32875. listPublic: ["GET /gists/public"],
  32876. listStarred: ["GET /gists/starred"],
  32877. star: ["PUT /gists/{gist_id}/star"],
  32878. unstar: ["DELETE /gists/{gist_id}/star"],
  32879. update: ["PATCH /gists/{gist_id}"],
  32880. updateComment: ["PATCH /gists/{gist_id}/comments/{comment_id}"]
  32881. },
  32882. git: {
  32883. createBlob: ["POST /repos/{owner}/{repo}/git/blobs"],
  32884. createCommit: ["POST /repos/{owner}/{repo}/git/commits"],
  32885. createRef: ["POST /repos/{owner}/{repo}/git/refs"],
  32886. createTag: ["POST /repos/{owner}/{repo}/git/tags"],
  32887. createTree: ["POST /repos/{owner}/{repo}/git/trees"],
  32888. deleteRef: ["DELETE /repos/{owner}/{repo}/git/refs/{ref}"],
  32889. getBlob: ["GET /repos/{owner}/{repo}/git/blobs/{file_sha}"],
  32890. getCommit: ["GET /repos/{owner}/{repo}/git/commits/{commit_sha}"],
  32891. getRef: ["GET /repos/{owner}/{repo}/git/ref/{ref}"],
  32892. getTag: ["GET /repos/{owner}/{repo}/git/tags/{tag_sha}"],
  32893. getTree: ["GET /repos/{owner}/{repo}/git/trees/{tree_sha}"],
  32894. listMatchingRefs: ["GET /repos/{owner}/{repo}/git/matching-refs/{ref}"],
  32895. updateRef: ["PATCH /repos/{owner}/{repo}/git/refs/{ref}"]
  32896. },
  32897. gitignore: {
  32898. getAllTemplates: ["GET /gitignore/templates"],
  32899. getTemplate: ["GET /gitignore/templates/{name}"]
  32900. },
  32901. hostedCompute: {
  32902. createNetworkConfigurationForOrg: [
  32903. "POST /orgs/{org}/settings/network-configurations"
  32904. ],
  32905. deleteNetworkConfigurationFromOrg: [
  32906. "DELETE /orgs/{org}/settings/network-configurations/{network_configuration_id}"
  32907. ],
  32908. getNetworkConfigurationForOrg: [
  32909. "GET /orgs/{org}/settings/network-configurations/{network_configuration_id}"
  32910. ],
  32911. getNetworkSettingsForOrg: [
  32912. "GET /orgs/{org}/settings/network-settings/{network_settings_id}"
  32913. ],
  32914. listNetworkConfigurationsForOrg: [
  32915. "GET /orgs/{org}/settings/network-configurations"
  32916. ],
  32917. updateNetworkConfigurationForOrg: [
  32918. "PATCH /orgs/{org}/settings/network-configurations/{network_configuration_id}"
  32919. ]
  32920. },
  32921. interactions: {
  32922. getRestrictionsForAuthenticatedUser: ["GET /user/interaction-limits"],
  32923. getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits"],
  32924. getRestrictionsForRepo: ["GET /repos/{owner}/{repo}/interaction-limits"],
  32925. getRestrictionsForYourPublicRepos: [
  32926. "GET /user/interaction-limits",
  32927. {},
  32928. { renamed: ["interactions", "getRestrictionsForAuthenticatedUser"] }
  32929. ],
  32930. removeRestrictionsForAuthenticatedUser: ["DELETE /user/interaction-limits"],
  32931. removeRestrictionsForOrg: ["DELETE /orgs/{org}/interaction-limits"],
  32932. removeRestrictionsForRepo: [
  32933. "DELETE /repos/{owner}/{repo}/interaction-limits"
  32934. ],
  32935. removeRestrictionsForYourPublicRepos: [
  32936. "DELETE /user/interaction-limits",
  32937. {},
  32938. { renamed: ["interactions", "removeRestrictionsForAuthenticatedUser"] }
  32939. ],
  32940. setRestrictionsForAuthenticatedUser: ["PUT /user/interaction-limits"],
  32941. setRestrictionsForOrg: ["PUT /orgs/{org}/interaction-limits"],
  32942. setRestrictionsForRepo: ["PUT /repos/{owner}/{repo}/interaction-limits"],
  32943. setRestrictionsForYourPublicRepos: [
  32944. "PUT /user/interaction-limits",
  32945. {},
  32946. { renamed: ["interactions", "setRestrictionsForAuthenticatedUser"] }
  32947. ]
  32948. },
  32949. issues: {
  32950. addAssignees: [
  32951. "POST /repos/{owner}/{repo}/issues/{issue_number}/assignees"
  32952. ],
  32953. addBlockedByDependency: [
  32954. "POST /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by"
  32955. ],
  32956. addLabels: ["POST /repos/{owner}/{repo}/issues/{issue_number}/labels"],
  32957. addSubIssue: [
  32958. "POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues"
  32959. ],
  32960. checkUserCanBeAssigned: ["GET /repos/{owner}/{repo}/assignees/{assignee}"],
  32961. checkUserCanBeAssignedToIssue: [
  32962. "GET /repos/{owner}/{repo}/issues/{issue_number}/assignees/{assignee}"
  32963. ],
  32964. create: ["POST /repos/{owner}/{repo}/issues"],
  32965. createComment: [
  32966. "POST /repos/{owner}/{repo}/issues/{issue_number}/comments"
  32967. ],
  32968. createLabel: ["POST /repos/{owner}/{repo}/labels"],
  32969. createMilestone: ["POST /repos/{owner}/{repo}/milestones"],
  32970. deleteComment: [
  32971. "DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}"
  32972. ],
  32973. deleteLabel: ["DELETE /repos/{owner}/{repo}/labels/{name}"],
  32974. deleteMilestone: [
  32975. "DELETE /repos/{owner}/{repo}/milestones/{milestone_number}"
  32976. ],
  32977. get: ["GET /repos/{owner}/{repo}/issues/{issue_number}"],
  32978. getComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}"],
  32979. getEvent: ["GET /repos/{owner}/{repo}/issues/events/{event_id}"],
  32980. getLabel: ["GET /repos/{owner}/{repo}/labels/{name}"],
  32981. getMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}"],
  32982. getParent: ["GET /repos/{owner}/{repo}/issues/{issue_number}/parent"],
  32983. list: ["GET /issues"],
  32984. listAssignees: ["GET /repos/{owner}/{repo}/assignees"],
  32985. listComments: ["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"],
  32986. listCommentsForRepo: ["GET /repos/{owner}/{repo}/issues/comments"],
  32987. listDependenciesBlockedBy: [
  32988. "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by"
  32989. ],
  32990. listDependenciesBlocking: [
  32991. "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking"
  32992. ],
  32993. listEvents: ["GET /repos/{owner}/{repo}/issues/{issue_number}/events"],
  32994. listEventsForRepo: ["GET /repos/{owner}/{repo}/issues/events"],
  32995. listEventsForTimeline: [
  32996. "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline"
  32997. ],
  32998. listForAuthenticatedUser: ["GET /user/issues"],
  32999. listForOrg: ["GET /orgs/{org}/issues"],
  33000. listForRepo: ["GET /repos/{owner}/{repo}/issues"],
  33001. listLabelsForMilestone: [
  33002. "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels"
  33003. ],
  33004. listLabelsForRepo: ["GET /repos/{owner}/{repo}/labels"],
  33005. listLabelsOnIssue: [
  33006. "GET /repos/{owner}/{repo}/issues/{issue_number}/labels"
  33007. ],
  33008. listMilestones: ["GET /repos/{owner}/{repo}/milestones"],
  33009. listSubIssues: [
  33010. "GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues"
  33011. ],
  33012. lock: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/lock"],
  33013. removeAllLabels: [
  33014. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels"
  33015. ],
  33016. removeAssignees: [
  33017. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees"
  33018. ],
  33019. removeDependencyBlockedBy: [
  33020. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by/{issue_id}"
  33021. ],
  33022. removeLabel: [
  33023. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}"
  33024. ],
  33025. removeSubIssue: [
  33026. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/sub_issue"
  33027. ],
  33028. reprioritizeSubIssue: [
  33029. "PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority"
  33030. ],
  33031. setLabels: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/labels"],
  33032. unlock: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock"],
  33033. update: ["PATCH /repos/{owner}/{repo}/issues/{issue_number}"],
  33034. updateComment: ["PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}"],
  33035. updateLabel: ["PATCH /repos/{owner}/{repo}/labels/{name}"],
  33036. updateMilestone: [
  33037. "PATCH /repos/{owner}/{repo}/milestones/{milestone_number}"
  33038. ]
  33039. },
  33040. licenses: {
  33041. get: ["GET /licenses/{license}"],
  33042. getAllCommonlyUsed: ["GET /licenses"],
  33043. getForRepo: ["GET /repos/{owner}/{repo}/license"]
  33044. },
  33045. markdown: {
  33046. render: ["POST /markdown"],
  33047. renderRaw: [
  33048. "POST /markdown/raw",
  33049. { headers: { "content-type": "text/plain; charset=utf-8" } }
  33050. ]
  33051. },
  33052. meta: {
  33053. get: ["GET /meta"],
  33054. getAllVersions: ["GET /versions"],
  33055. getOctocat: ["GET /octocat"],
  33056. getZen: ["GET /zen"],
  33057. root: ["GET /"]
  33058. },
  33059. migrations: {
  33060. deleteArchiveForAuthenticatedUser: [
  33061. "DELETE /user/migrations/{migration_id}/archive"
  33062. ],
  33063. deleteArchiveForOrg: [
  33064. "DELETE /orgs/{org}/migrations/{migration_id}/archive"
  33065. ],
  33066. downloadArchiveForOrg: [
  33067. "GET /orgs/{org}/migrations/{migration_id}/archive"
  33068. ],
  33069. getArchiveForAuthenticatedUser: [
  33070. "GET /user/migrations/{migration_id}/archive"
  33071. ],
  33072. getStatusForAuthenticatedUser: ["GET /user/migrations/{migration_id}"],
  33073. getStatusForOrg: ["GET /orgs/{org}/migrations/{migration_id}"],
  33074. listForAuthenticatedUser: ["GET /user/migrations"],
  33075. listForOrg: ["GET /orgs/{org}/migrations"],
  33076. listReposForAuthenticatedUser: [
  33077. "GET /user/migrations/{migration_id}/repositories"
  33078. ],
  33079. listReposForOrg: ["GET /orgs/{org}/migrations/{migration_id}/repositories"],
  33080. listReposForUser: [
  33081. "GET /user/migrations/{migration_id}/repositories",
  33082. {},
  33083. { renamed: ["migrations", "listReposForAuthenticatedUser"] }
  33084. ],
  33085. startForAuthenticatedUser: ["POST /user/migrations"],
  33086. startForOrg: ["POST /orgs/{org}/migrations"],
  33087. unlockRepoForAuthenticatedUser: [
  33088. "DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock"
  33089. ],
  33090. unlockRepoForOrg: [
  33091. "DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock"
  33092. ]
  33093. },
  33094. oidc: {
  33095. getOidcCustomSubTemplateForOrg: [
  33096. "GET /orgs/{org}/actions/oidc/customization/sub"
  33097. ],
  33098. updateOidcCustomSubTemplateForOrg: [
  33099. "PUT /orgs/{org}/actions/oidc/customization/sub"
  33100. ]
  33101. },
  33102. orgs: {
  33103. addSecurityManagerTeam: [
  33104. "PUT /orgs/{org}/security-managers/teams/{team_slug}",
  33105. {},
  33106. {
  33107. deprecated: "octokit.rest.orgs.addSecurityManagerTeam() is deprecated, see https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team"
  33108. }
  33109. ],
  33110. assignTeamToOrgRole: [
  33111. "PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
  33112. ],
  33113. assignUserToOrgRole: [
  33114. "PUT /orgs/{org}/organization-roles/users/{username}/{role_id}"
  33115. ],
  33116. blockUser: ["PUT /orgs/{org}/blocks/{username}"],
  33117. cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"],
  33118. checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"],
  33119. checkMembershipForUser: ["GET /orgs/{org}/members/{username}"],
  33120. checkPublicMembershipForUser: ["GET /orgs/{org}/public_members/{username}"],
  33121. convertMemberToOutsideCollaborator: [
  33122. "PUT /orgs/{org}/outside_collaborators/{username}"
  33123. ],
  33124. createArtifactStorageRecord: [
  33125. "POST /orgs/{org}/artifacts/metadata/storage-record"
  33126. ],
  33127. createInvitation: ["POST /orgs/{org}/invitations"],
  33128. createIssueType: ["POST /orgs/{org}/issue-types"],
  33129. createWebhook: ["POST /orgs/{org}/hooks"],
  33130. customPropertiesForOrgsCreateOrUpdateOrganizationValues: [
  33131. "PATCH /organizations/{org}/org-properties/values"
  33132. ],
  33133. customPropertiesForOrgsGetOrganizationValues: [
  33134. "GET /organizations/{org}/org-properties/values"
  33135. ],
  33136. customPropertiesForReposCreateOrUpdateOrganizationDefinition: [
  33137. "PUT /orgs/{org}/properties/schema/{custom_property_name}"
  33138. ],
  33139. customPropertiesForReposCreateOrUpdateOrganizationDefinitions: [
  33140. "PATCH /orgs/{org}/properties/schema"
  33141. ],
  33142. customPropertiesForReposCreateOrUpdateOrganizationValues: [
  33143. "PATCH /orgs/{org}/properties/values"
  33144. ],
  33145. customPropertiesForReposDeleteOrganizationDefinition: [
  33146. "DELETE /orgs/{org}/properties/schema/{custom_property_name}"
  33147. ],
  33148. customPropertiesForReposGetOrganizationDefinition: [
  33149. "GET /orgs/{org}/properties/schema/{custom_property_name}"
  33150. ],
  33151. customPropertiesForReposGetOrganizationDefinitions: [
  33152. "GET /orgs/{org}/properties/schema"
  33153. ],
  33154. customPropertiesForReposGetOrganizationValues: [
  33155. "GET /orgs/{org}/properties/values"
  33156. ],
  33157. delete: ["DELETE /orgs/{org}"],
  33158. deleteAttestationsBulk: ["POST /orgs/{org}/attestations/delete-request"],
  33159. deleteAttestationsById: [
  33160. "DELETE /orgs/{org}/attestations/{attestation_id}"
  33161. ],
  33162. deleteAttestationsBySubjectDigest: [
  33163. "DELETE /orgs/{org}/attestations/digest/{subject_digest}"
  33164. ],
  33165. deleteIssueType: ["DELETE /orgs/{org}/issue-types/{issue_type_id}"],
  33166. deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"],
  33167. disableSelectedRepositoryImmutableReleasesOrganization: [
  33168. "DELETE /orgs/{org}/settings/immutable-releases/repositories/{repository_id}"
  33169. ],
  33170. enableSelectedRepositoryImmutableReleasesOrganization: [
  33171. "PUT /orgs/{org}/settings/immutable-releases/repositories/{repository_id}"
  33172. ],
  33173. get: ["GET /orgs/{org}"],
  33174. getImmutableReleasesSettings: [
  33175. "GET /orgs/{org}/settings/immutable-releases"
  33176. ],
  33177. getImmutableReleasesSettingsRepositories: [
  33178. "GET /orgs/{org}/settings/immutable-releases/repositories"
  33179. ],
  33180. getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"],
  33181. getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
  33182. getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"],
  33183. getOrgRulesetHistory: ["GET /orgs/{org}/rulesets/{ruleset_id}/history"],
  33184. getOrgRulesetVersion: [
  33185. "GET /orgs/{org}/rulesets/{ruleset_id}/history/{version_id}"
  33186. ],
  33187. getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
  33188. getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"],
  33189. getWebhookDelivery: [
  33190. "GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}"
  33191. ],
  33192. list: ["GET /organizations"],
  33193. listAppInstallations: ["GET /orgs/{org}/installations"],
  33194. listArtifactStorageRecords: [
  33195. "GET /orgs/{org}/artifacts/{subject_digest}/metadata/storage-records"
  33196. ],
  33197. listAttestationRepositories: ["GET /orgs/{org}/attestations/repositories"],
  33198. listAttestations: ["GET /orgs/{org}/attestations/{subject_digest}"],
  33199. listAttestationsBulk: [
  33200. "POST /orgs/{org}/attestations/bulk-list{?per_page,before,after}"
  33201. ],
  33202. listBlockedUsers: ["GET /orgs/{org}/blocks"],
  33203. listFailedInvitations: ["GET /orgs/{org}/failed_invitations"],
  33204. listForAuthenticatedUser: ["GET /user/orgs"],
  33205. listForUser: ["GET /users/{username}/orgs"],
  33206. listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"],
  33207. listIssueTypes: ["GET /orgs/{org}/issue-types"],
  33208. listMembers: ["GET /orgs/{org}/members"],
  33209. listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"],
  33210. listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"],
  33211. listOrgRoleUsers: ["GET /orgs/{org}/organization-roles/{role_id}/users"],
  33212. listOrgRoles: ["GET /orgs/{org}/organization-roles"],
  33213. listOrganizationFineGrainedPermissions: [
  33214. "GET /orgs/{org}/organization-fine-grained-permissions"
  33215. ],
  33216. listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"],
  33217. listPatGrantRepositories: [
  33218. "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories"
  33219. ],
  33220. listPatGrantRequestRepositories: [
  33221. "GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories"
  33222. ],
  33223. listPatGrantRequests: ["GET /orgs/{org}/personal-access-token-requests"],
  33224. listPatGrants: ["GET /orgs/{org}/personal-access-tokens"],
  33225. listPendingInvitations: ["GET /orgs/{org}/invitations"],
  33226. listPublicMembers: ["GET /orgs/{org}/public_members"],
  33227. listSecurityManagerTeams: [
  33228. "GET /orgs/{org}/security-managers",
  33229. {},
  33230. {
  33231. deprecated: "octokit.rest.orgs.listSecurityManagerTeams() is deprecated, see https://docs.github.com/rest/orgs/security-managers#list-security-manager-teams"
  33232. }
  33233. ],
  33234. listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"],
  33235. listWebhooks: ["GET /orgs/{org}/hooks"],
  33236. pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"],
  33237. redeliverWebhookDelivery: [
  33238. "POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"
  33239. ],
  33240. removeMember: ["DELETE /orgs/{org}/members/{username}"],
  33241. removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"],
  33242. removeOutsideCollaborator: [
  33243. "DELETE /orgs/{org}/outside_collaborators/{username}"
  33244. ],
  33245. removePublicMembershipForAuthenticatedUser: [
  33246. "DELETE /orgs/{org}/public_members/{username}"
  33247. ],
  33248. removeSecurityManagerTeam: [
  33249. "DELETE /orgs/{org}/security-managers/teams/{team_slug}",
  33250. {},
  33251. {
  33252. deprecated: "octokit.rest.orgs.removeSecurityManagerTeam() is deprecated, see https://docs.github.com/rest/orgs/security-managers#remove-a-security-manager-team"
  33253. }
  33254. ],
  33255. reviewPatGrantRequest: [
  33256. "POST /orgs/{org}/personal-access-token-requests/{pat_request_id}"
  33257. ],
  33258. reviewPatGrantRequestsInBulk: [
  33259. "POST /orgs/{org}/personal-access-token-requests"
  33260. ],
  33261. revokeAllOrgRolesTeam: [
  33262. "DELETE /orgs/{org}/organization-roles/teams/{team_slug}"
  33263. ],
  33264. revokeAllOrgRolesUser: [
  33265. "DELETE /orgs/{org}/organization-roles/users/{username}"
  33266. ],
  33267. revokeOrgRoleTeam: [
  33268. "DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
  33269. ],
  33270. revokeOrgRoleUser: [
  33271. "DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}"
  33272. ],
  33273. setImmutableReleasesSettings: [
  33274. "PUT /orgs/{org}/settings/immutable-releases"
  33275. ],
  33276. setImmutableReleasesSettingsRepositories: [
  33277. "PUT /orgs/{org}/settings/immutable-releases/repositories"
  33278. ],
  33279. setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"],
  33280. setPublicMembershipForAuthenticatedUser: [
  33281. "PUT /orgs/{org}/public_members/{username}"
  33282. ],
  33283. unblockUser: ["DELETE /orgs/{org}/blocks/{username}"],
  33284. update: ["PATCH /orgs/{org}"],
  33285. updateIssueType: ["PUT /orgs/{org}/issue-types/{issue_type_id}"],
  33286. updateMembershipForAuthenticatedUser: [
  33287. "PATCH /user/memberships/orgs/{org}"
  33288. ],
  33289. updatePatAccess: ["POST /orgs/{org}/personal-access-tokens/{pat_id}"],
  33290. updatePatAccesses: ["POST /orgs/{org}/personal-access-tokens"],
  33291. updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"],
  33292. updateWebhookConfigForOrg: ["PATCH /orgs/{org}/hooks/{hook_id}/config"]
  33293. },
  33294. packages: {
  33295. deletePackageForAuthenticatedUser: [
  33296. "DELETE /user/packages/{package_type}/{package_name}"
  33297. ],
  33298. deletePackageForOrg: [
  33299. "DELETE /orgs/{org}/packages/{package_type}/{package_name}"
  33300. ],
  33301. deletePackageForUser: [
  33302. "DELETE /users/{username}/packages/{package_type}/{package_name}"
  33303. ],
  33304. deletePackageVersionForAuthenticatedUser: [
  33305. "DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33306. ],
  33307. deletePackageVersionForOrg: [
  33308. "DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33309. ],
  33310. deletePackageVersionForUser: [
  33311. "DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33312. ],
  33313. getAllPackageVersionsForAPackageOwnedByAnOrg: [
  33314. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
  33315. {},
  33316. { renamed: ["packages", "getAllPackageVersionsForPackageOwnedByOrg"] }
  33317. ],
  33318. getAllPackageVersionsForAPackageOwnedByTheAuthenticatedUser: [
  33319. "GET /user/packages/{package_type}/{package_name}/versions",
  33320. {},
  33321. {
  33322. renamed: [
  33323. "packages",
  33324. "getAllPackageVersionsForPackageOwnedByAuthenticatedUser"
  33325. ]
  33326. }
  33327. ],
  33328. getAllPackageVersionsForPackageOwnedByAuthenticatedUser: [
  33329. "GET /user/packages/{package_type}/{package_name}/versions"
  33330. ],
  33331. getAllPackageVersionsForPackageOwnedByOrg: [
  33332. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions"
  33333. ],
  33334. getAllPackageVersionsForPackageOwnedByUser: [
  33335. "GET /users/{username}/packages/{package_type}/{package_name}/versions"
  33336. ],
  33337. getPackageForAuthenticatedUser: [
  33338. "GET /user/packages/{package_type}/{package_name}"
  33339. ],
  33340. getPackageForOrganization: [
  33341. "GET /orgs/{org}/packages/{package_type}/{package_name}"
  33342. ],
  33343. getPackageForUser: [
  33344. "GET /users/{username}/packages/{package_type}/{package_name}"
  33345. ],
  33346. getPackageVersionForAuthenticatedUser: [
  33347. "GET /user/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33348. ],
  33349. getPackageVersionForOrganization: [
  33350. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33351. ],
  33352. getPackageVersionForUser: [
  33353. "GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  33354. ],
  33355. listDockerMigrationConflictingPackagesForAuthenticatedUser: [
  33356. "GET /user/docker/conflicts"
  33357. ],
  33358. listDockerMigrationConflictingPackagesForOrganization: [
  33359. "GET /orgs/{org}/docker/conflicts"
  33360. ],
  33361. listDockerMigrationConflictingPackagesForUser: [
  33362. "GET /users/{username}/docker/conflicts"
  33363. ],
  33364. listPackagesForAuthenticatedUser: ["GET /user/packages"],
  33365. listPackagesForOrganization: ["GET /orgs/{org}/packages"],
  33366. listPackagesForUser: ["GET /users/{username}/packages"],
  33367. restorePackageForAuthenticatedUser: [
  33368. "POST /user/packages/{package_type}/{package_name}/restore{?token}"
  33369. ],
  33370. restorePackageForOrg: [
  33371. "POST /orgs/{org}/packages/{package_type}/{package_name}/restore{?token}"
  33372. ],
  33373. restorePackageForUser: [
  33374. "POST /users/{username}/packages/{package_type}/{package_name}/restore{?token}"
  33375. ],
  33376. restorePackageVersionForAuthenticatedUser: [
  33377. "POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
  33378. ],
  33379. restorePackageVersionForOrg: [
  33380. "POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
  33381. ],
  33382. restorePackageVersionForUser: [
  33383. "POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
  33384. ]
  33385. },
  33386. privateRegistries: {
  33387. createOrgPrivateRegistry: ["POST /orgs/{org}/private-registries"],
  33388. deleteOrgPrivateRegistry: [
  33389. "DELETE /orgs/{org}/private-registries/{secret_name}"
  33390. ],
  33391. getOrgPrivateRegistry: ["GET /orgs/{org}/private-registries/{secret_name}"],
  33392. getOrgPublicKey: ["GET /orgs/{org}/private-registries/public-key"],
  33393. listOrgPrivateRegistries: ["GET /orgs/{org}/private-registries"],
  33394. updateOrgPrivateRegistry: [
  33395. "PATCH /orgs/{org}/private-registries/{secret_name}"
  33396. ]
  33397. },
  33398. projects: {
  33399. addItemForOrg: ["POST /orgs/{org}/projectsV2/{project_number}/items"],
  33400. addItemForUser: [
  33401. "POST /users/{username}/projectsV2/{project_number}/items"
  33402. ],
  33403. deleteItemForOrg: [
  33404. "DELETE /orgs/{org}/projectsV2/{project_number}/items/{item_id}"
  33405. ],
  33406. deleteItemForUser: [
  33407. "DELETE /users/{username}/projectsV2/{project_number}/items/{item_id}"
  33408. ],
  33409. getFieldForOrg: [
  33410. "GET /orgs/{org}/projectsV2/{project_number}/fields/{field_id}"
  33411. ],
  33412. getFieldForUser: [
  33413. "GET /users/{username}/projectsV2/{project_number}/fields/{field_id}"
  33414. ],
  33415. getForOrg: ["GET /orgs/{org}/projectsV2/{project_number}"],
  33416. getForUser: ["GET /users/{username}/projectsV2/{project_number}"],
  33417. getOrgItem: ["GET /orgs/{org}/projectsV2/{project_number}/items/{item_id}"],
  33418. getUserItem: [
  33419. "GET /users/{username}/projectsV2/{project_number}/items/{item_id}"
  33420. ],
  33421. listFieldsForOrg: ["GET /orgs/{org}/projectsV2/{project_number}/fields"],
  33422. listFieldsForUser: [
  33423. "GET /users/{username}/projectsV2/{project_number}/fields"
  33424. ],
  33425. listForOrg: ["GET /orgs/{org}/projectsV2"],
  33426. listForUser: ["GET /users/{username}/projectsV2"],
  33427. listItemsForOrg: ["GET /orgs/{org}/projectsV2/{project_number}/items"],
  33428. listItemsForUser: [
  33429. "GET /users/{username}/projectsV2/{project_number}/items"
  33430. ],
  33431. updateItemForOrg: [
  33432. "PATCH /orgs/{org}/projectsV2/{project_number}/items/{item_id}"
  33433. ],
  33434. updateItemForUser: [
  33435. "PATCH /users/{username}/projectsV2/{project_number}/items/{item_id}"
  33436. ]
  33437. },
  33438. pulls: {
  33439. checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"],
  33440. create: ["POST /repos/{owner}/{repo}/pulls"],
  33441. createReplyForReviewComment: [
  33442. "POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies"
  33443. ],
  33444. createReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews"],
  33445. createReviewComment: [
  33446. "POST /repos/{owner}/{repo}/pulls/{pull_number}/comments"
  33447. ],
  33448. deletePendingReview: [
  33449. "DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
  33450. ],
  33451. deleteReviewComment: [
  33452. "DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}"
  33453. ],
  33454. dismissReview: [
  33455. "PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals"
  33456. ],
  33457. get: ["GET /repos/{owner}/{repo}/pulls/{pull_number}"],
  33458. getReview: [
  33459. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
  33460. ],
  33461. getReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}"],
  33462. list: ["GET /repos/{owner}/{repo}/pulls"],
  33463. listCommentsForReview: [
  33464. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments"
  33465. ],
  33466. listCommits: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/commits"],
  33467. listFiles: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/files"],
  33468. listRequestedReviewers: [
  33469. "GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
  33470. ],
  33471. listReviewComments: [
  33472. "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments"
  33473. ],
  33474. listReviewCommentsForRepo: ["GET /repos/{owner}/{repo}/pulls/comments"],
  33475. listReviews: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews"],
  33476. merge: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge"],
  33477. removeRequestedReviewers: [
  33478. "DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
  33479. ],
  33480. requestReviewers: [
  33481. "POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
  33482. ],
  33483. submitReview: [
  33484. "POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events"
  33485. ],
  33486. update: ["PATCH /repos/{owner}/{repo}/pulls/{pull_number}"],
  33487. updateBranch: [
  33488. "PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch"
  33489. ],
  33490. updateReview: [
  33491. "PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
  33492. ],
  33493. updateReviewComment: [
  33494. "PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}"
  33495. ]
  33496. },
  33497. rateLimit: { get: ["GET /rate_limit"] },
  33498. reactions: {
  33499. createForCommitComment: [
  33500. "POST /repos/{owner}/{repo}/comments/{comment_id}/reactions"
  33501. ],
  33502. createForIssue: [
  33503. "POST /repos/{owner}/{repo}/issues/{issue_number}/reactions"
  33504. ],
  33505. createForIssueComment: [
  33506. "POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"
  33507. ],
  33508. createForPullRequestReviewComment: [
  33509. "POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"
  33510. ],
  33511. createForRelease: [
  33512. "POST /repos/{owner}/{repo}/releases/{release_id}/reactions"
  33513. ],
  33514. createForTeamDiscussionCommentInOrg: [
  33515. "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"
  33516. ],
  33517. createForTeamDiscussionInOrg: [
  33518. "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"
  33519. ],
  33520. deleteForCommitComment: [
  33521. "DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}"
  33522. ],
  33523. deleteForIssue: [
  33524. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}"
  33525. ],
  33526. deleteForIssueComment: [
  33527. "DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}"
  33528. ],
  33529. deleteForPullRequestComment: [
  33530. "DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}"
  33531. ],
  33532. deleteForRelease: [
  33533. "DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id}"
  33534. ],
  33535. deleteForTeamDiscussion: [
  33536. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}"
  33537. ],
  33538. deleteForTeamDiscussionComment: [
  33539. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}"
  33540. ],
  33541. listForCommitComment: [
  33542. "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions"
  33543. ],
  33544. listForIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/reactions"],
  33545. listForIssueComment: [
  33546. "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"
  33547. ],
  33548. listForPullRequestReviewComment: [
  33549. "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"
  33550. ],
  33551. listForRelease: [
  33552. "GET /repos/{owner}/{repo}/releases/{release_id}/reactions"
  33553. ],
  33554. listForTeamDiscussionCommentInOrg: [
  33555. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"
  33556. ],
  33557. listForTeamDiscussionInOrg: [
  33558. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"
  33559. ]
  33560. },
  33561. repos: {
  33562. acceptInvitation: [
  33563. "PATCH /user/repository_invitations/{invitation_id}",
  33564. {},
  33565. { renamed: ["repos", "acceptInvitationForAuthenticatedUser"] }
  33566. ],
  33567. acceptInvitationForAuthenticatedUser: [
  33568. "PATCH /user/repository_invitations/{invitation_id}"
  33569. ],
  33570. addAppAccessRestrictions: [
  33571. "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
  33572. {},
  33573. { mapToData: "apps" }
  33574. ],
  33575. addCollaborator: ["PUT /repos/{owner}/{repo}/collaborators/{username}"],
  33576. addStatusCheckContexts: [
  33577. "POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
  33578. {},
  33579. { mapToData: "contexts" }
  33580. ],
  33581. addTeamAccessRestrictions: [
  33582. "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
  33583. {},
  33584. { mapToData: "teams" }
  33585. ],
  33586. addUserAccessRestrictions: [
  33587. "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
  33588. {},
  33589. { mapToData: "users" }
  33590. ],
  33591. cancelPagesDeployment: [
  33592. "POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel"
  33593. ],
  33594. checkAutomatedSecurityFixes: [
  33595. "GET /repos/{owner}/{repo}/automated-security-fixes"
  33596. ],
  33597. checkCollaborator: ["GET /repos/{owner}/{repo}/collaborators/{username}"],
  33598. checkImmutableReleases: ["GET /repos/{owner}/{repo}/immutable-releases"],
  33599. checkPrivateVulnerabilityReporting: [
  33600. "GET /repos/{owner}/{repo}/private-vulnerability-reporting"
  33601. ],
  33602. checkVulnerabilityAlerts: [
  33603. "GET /repos/{owner}/{repo}/vulnerability-alerts"
  33604. ],
  33605. codeownersErrors: ["GET /repos/{owner}/{repo}/codeowners/errors"],
  33606. compareCommits: ["GET /repos/{owner}/{repo}/compare/{base}...{head}"],
  33607. compareCommitsWithBasehead: [
  33608. "GET /repos/{owner}/{repo}/compare/{basehead}"
  33609. ],
  33610. createAttestation: ["POST /repos/{owner}/{repo}/attestations"],
  33611. createAutolink: ["POST /repos/{owner}/{repo}/autolinks"],
  33612. createCommitComment: [
  33613. "POST /repos/{owner}/{repo}/commits/{commit_sha}/comments"
  33614. ],
  33615. createCommitSignatureProtection: [
  33616. "POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
  33617. ],
  33618. createCommitStatus: ["POST /repos/{owner}/{repo}/statuses/{sha}"],
  33619. createDeployKey: ["POST /repos/{owner}/{repo}/keys"],
  33620. createDeployment: ["POST /repos/{owner}/{repo}/deployments"],
  33621. createDeploymentBranchPolicy: [
  33622. "POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"
  33623. ],
  33624. createDeploymentProtectionRule: [
  33625. "POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"
  33626. ],
  33627. createDeploymentStatus: [
  33628. "POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"
  33629. ],
  33630. createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"],
  33631. createForAuthenticatedUser: ["POST /user/repos"],
  33632. createFork: ["POST /repos/{owner}/{repo}/forks"],
  33633. createInOrg: ["POST /orgs/{org}/repos"],
  33634. createOrUpdateEnvironment: [
  33635. "PUT /repos/{owner}/{repo}/environments/{environment_name}"
  33636. ],
  33637. createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"],
  33638. createOrgRuleset: ["POST /orgs/{org}/rulesets"],
  33639. createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployments"],
  33640. createPagesSite: ["POST /repos/{owner}/{repo}/pages"],
  33641. createRelease: ["POST /repos/{owner}/{repo}/releases"],
  33642. createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"],
  33643. createUsingTemplate: [
  33644. "POST /repos/{template_owner}/{template_repo}/generate"
  33645. ],
  33646. createWebhook: ["POST /repos/{owner}/{repo}/hooks"],
  33647. customPropertiesForReposCreateOrUpdateRepositoryValues: [
  33648. "PATCH /repos/{owner}/{repo}/properties/values"
  33649. ],
  33650. customPropertiesForReposGetRepositoryValues: [
  33651. "GET /repos/{owner}/{repo}/properties/values"
  33652. ],
  33653. declineInvitation: [
  33654. "DELETE /user/repository_invitations/{invitation_id}",
  33655. {},
  33656. { renamed: ["repos", "declineInvitationForAuthenticatedUser"] }
  33657. ],
  33658. declineInvitationForAuthenticatedUser: [
  33659. "DELETE /user/repository_invitations/{invitation_id}"
  33660. ],
  33661. delete: ["DELETE /repos/{owner}/{repo}"],
  33662. deleteAccessRestrictions: [
  33663. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"
  33664. ],
  33665. deleteAdminBranchProtection: [
  33666. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
  33667. ],
  33668. deleteAnEnvironment: [
  33669. "DELETE /repos/{owner}/{repo}/environments/{environment_name}"
  33670. ],
  33671. deleteAutolink: ["DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}"],
  33672. deleteBranchProtection: [
  33673. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection"
  33674. ],
  33675. deleteCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}"],
  33676. deleteCommitSignatureProtection: [
  33677. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
  33678. ],
  33679. deleteDeployKey: ["DELETE /repos/{owner}/{repo}/keys/{key_id}"],
  33680. deleteDeployment: [
  33681. "DELETE /repos/{owner}/{repo}/deployments/{deployment_id}"
  33682. ],
  33683. deleteDeploymentBranchPolicy: [
  33684. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
  33685. ],
  33686. deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"],
  33687. deleteInvitation: [
  33688. "DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"
  33689. ],
  33690. deleteOrgRuleset: ["DELETE /orgs/{org}/rulesets/{ruleset_id}"],
  33691. deletePagesSite: ["DELETE /repos/{owner}/{repo}/pages"],
  33692. deletePullRequestReviewProtection: [
  33693. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
  33694. ],
  33695. deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"],
  33696. deleteReleaseAsset: [
  33697. "DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"
  33698. ],
  33699. deleteRepoRuleset: ["DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
  33700. deleteWebhook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"],
  33701. disableAutomatedSecurityFixes: [
  33702. "DELETE /repos/{owner}/{repo}/automated-security-fixes"
  33703. ],
  33704. disableDeploymentProtectionRule: [
  33705. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"
  33706. ],
  33707. disableImmutableReleases: [
  33708. "DELETE /repos/{owner}/{repo}/immutable-releases"
  33709. ],
  33710. disablePrivateVulnerabilityReporting: [
  33711. "DELETE /repos/{owner}/{repo}/private-vulnerability-reporting"
  33712. ],
  33713. disableVulnerabilityAlerts: [
  33714. "DELETE /repos/{owner}/{repo}/vulnerability-alerts"
  33715. ],
  33716. downloadArchive: [
  33717. "GET /repos/{owner}/{repo}/zipball/{ref}",
  33718. {},
  33719. { renamed: ["repos", "downloadZipballArchive"] }
  33720. ],
  33721. downloadTarballArchive: ["GET /repos/{owner}/{repo}/tarball/{ref}"],
  33722. downloadZipballArchive: ["GET /repos/{owner}/{repo}/zipball/{ref}"],
  33723. enableAutomatedSecurityFixes: [
  33724. "PUT /repos/{owner}/{repo}/automated-security-fixes"
  33725. ],
  33726. enableImmutableReleases: ["PUT /repos/{owner}/{repo}/immutable-releases"],
  33727. enablePrivateVulnerabilityReporting: [
  33728. "PUT /repos/{owner}/{repo}/private-vulnerability-reporting"
  33729. ],
  33730. enableVulnerabilityAlerts: [
  33731. "PUT /repos/{owner}/{repo}/vulnerability-alerts"
  33732. ],
  33733. generateReleaseNotes: [
  33734. "POST /repos/{owner}/{repo}/releases/generate-notes"
  33735. ],
  33736. get: ["GET /repos/{owner}/{repo}"],
  33737. getAccessRestrictions: [
  33738. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"
  33739. ],
  33740. getAdminBranchProtection: [
  33741. "GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
  33742. ],
  33743. getAllDeploymentProtectionRules: [
  33744. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"
  33745. ],
  33746. getAllEnvironments: ["GET /repos/{owner}/{repo}/environments"],
  33747. getAllStatusCheckContexts: [
  33748. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"
  33749. ],
  33750. getAllTopics: ["GET /repos/{owner}/{repo}/topics"],
  33751. getAppsWithAccessToProtectedBranch: [
  33752. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"
  33753. ],
  33754. getAutolink: ["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"],
  33755. getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"],
  33756. getBranchProtection: [
  33757. "GET /repos/{owner}/{repo}/branches/{branch}/protection"
  33758. ],
  33759. getBranchRules: ["GET /repos/{owner}/{repo}/rules/branches/{branch}"],
  33760. getClones: ["GET /repos/{owner}/{repo}/traffic/clones"],
  33761. getCodeFrequencyStats: ["GET /repos/{owner}/{repo}/stats/code_frequency"],
  33762. getCollaboratorPermissionLevel: [
  33763. "GET /repos/{owner}/{repo}/collaborators/{username}/permission"
  33764. ],
  33765. getCombinedStatusForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/status"],
  33766. getCommit: ["GET /repos/{owner}/{repo}/commits/{ref}"],
  33767. getCommitActivityStats: ["GET /repos/{owner}/{repo}/stats/commit_activity"],
  33768. getCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}"],
  33769. getCommitSignatureProtection: [
  33770. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
  33771. ],
  33772. getCommunityProfileMetrics: ["GET /repos/{owner}/{repo}/community/profile"],
  33773. getContent: ["GET /repos/{owner}/{repo}/contents/{path}"],
  33774. getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"],
  33775. getCustomDeploymentProtectionRule: [
  33776. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"
  33777. ],
  33778. getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"],
  33779. getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"],
  33780. getDeploymentBranchPolicy: [
  33781. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
  33782. ],
  33783. getDeploymentStatus: [
  33784. "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}"
  33785. ],
  33786. getEnvironment: [
  33787. "GET /repos/{owner}/{repo}/environments/{environment_name}"
  33788. ],
  33789. getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"],
  33790. getLatestRelease: ["GET /repos/{owner}/{repo}/releases/latest"],
  33791. getOrgRuleSuite: ["GET /orgs/{org}/rulesets/rule-suites/{rule_suite_id}"],
  33792. getOrgRuleSuites: ["GET /orgs/{org}/rulesets/rule-suites"],
  33793. getOrgRuleset: ["GET /orgs/{org}/rulesets/{ruleset_id}"],
  33794. getOrgRulesets: ["GET /orgs/{org}/rulesets"],
  33795. getPages: ["GET /repos/{owner}/{repo}/pages"],
  33796. getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"],
  33797. getPagesDeployment: [
  33798. "GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}"
  33799. ],
  33800. getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"],
  33801. getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"],
  33802. getPullRequestReviewProtection: [
  33803. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
  33804. ],
  33805. getPunchCardStats: ["GET /repos/{owner}/{repo}/stats/punch_card"],
  33806. getReadme: ["GET /repos/{owner}/{repo}/readme"],
  33807. getReadmeInDirectory: ["GET /repos/{owner}/{repo}/readme/{dir}"],
  33808. getRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}"],
  33809. getReleaseAsset: ["GET /repos/{owner}/{repo}/releases/assets/{asset_id}"],
  33810. getReleaseByTag: ["GET /repos/{owner}/{repo}/releases/tags/{tag}"],
  33811. getRepoRuleSuite: [
  33812. "GET /repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id}"
  33813. ],
  33814. getRepoRuleSuites: ["GET /repos/{owner}/{repo}/rulesets/rule-suites"],
  33815. getRepoRuleset: ["GET /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
  33816. getRepoRulesetHistory: [
  33817. "GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history"
  33818. ],
  33819. getRepoRulesetVersion: [
  33820. "GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history/{version_id}"
  33821. ],
  33822. getRepoRulesets: ["GET /repos/{owner}/{repo}/rulesets"],
  33823. getStatusChecksProtection: [
  33824. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
  33825. ],
  33826. getTeamsWithAccessToProtectedBranch: [
  33827. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"
  33828. ],
  33829. getTopPaths: ["GET /repos/{owner}/{repo}/traffic/popular/paths"],
  33830. getTopReferrers: ["GET /repos/{owner}/{repo}/traffic/popular/referrers"],
  33831. getUsersWithAccessToProtectedBranch: [
  33832. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users"
  33833. ],
  33834. getViews: ["GET /repos/{owner}/{repo}/traffic/views"],
  33835. getWebhook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"],
  33836. getWebhookConfigForRepo: [
  33837. "GET /repos/{owner}/{repo}/hooks/{hook_id}/config"
  33838. ],
  33839. getWebhookDelivery: [
  33840. "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}"
  33841. ],
  33842. listActivities: ["GET /repos/{owner}/{repo}/activity"],
  33843. listAttestations: [
  33844. "GET /repos/{owner}/{repo}/attestations/{subject_digest}"
  33845. ],
  33846. listAutolinks: ["GET /repos/{owner}/{repo}/autolinks"],
  33847. listBranches: ["GET /repos/{owner}/{repo}/branches"],
  33848. listBranchesForHeadCommit: [
  33849. "GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head"
  33850. ],
  33851. listCollaborators: ["GET /repos/{owner}/{repo}/collaborators"],
  33852. listCommentsForCommit: [
  33853. "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments"
  33854. ],
  33855. listCommitCommentsForRepo: ["GET /repos/{owner}/{repo}/comments"],
  33856. listCommitStatusesForRef: [
  33857. "GET /repos/{owner}/{repo}/commits/{ref}/statuses"
  33858. ],
  33859. listCommits: ["GET /repos/{owner}/{repo}/commits"],
  33860. listContributors: ["GET /repos/{owner}/{repo}/contributors"],
  33861. listCustomDeploymentRuleIntegrations: [
  33862. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps"
  33863. ],
  33864. listDeployKeys: ["GET /repos/{owner}/{repo}/keys"],
  33865. listDeploymentBranchPolicies: [
  33866. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"
  33867. ],
  33868. listDeploymentStatuses: [
  33869. "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"
  33870. ],
  33871. listDeployments: ["GET /repos/{owner}/{repo}/deployments"],
  33872. listForAuthenticatedUser: ["GET /user/repos"],
  33873. listForOrg: ["GET /orgs/{org}/repos"],
  33874. listForUser: ["GET /users/{username}/repos"],
  33875. listForks: ["GET /repos/{owner}/{repo}/forks"],
  33876. listInvitations: ["GET /repos/{owner}/{repo}/invitations"],
  33877. listInvitationsForAuthenticatedUser: ["GET /user/repository_invitations"],
  33878. listLanguages: ["GET /repos/{owner}/{repo}/languages"],
  33879. listPagesBuilds: ["GET /repos/{owner}/{repo}/pages/builds"],
  33880. listPublic: ["GET /repositories"],
  33881. listPullRequestsAssociatedWithCommit: [
  33882. "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"
  33883. ],
  33884. listReleaseAssets: [
  33885. "GET /repos/{owner}/{repo}/releases/{release_id}/assets"
  33886. ],
  33887. listReleases: ["GET /repos/{owner}/{repo}/releases"],
  33888. listTags: ["GET /repos/{owner}/{repo}/tags"],
  33889. listTeams: ["GET /repos/{owner}/{repo}/teams"],
  33890. listWebhookDeliveries: [
  33891. "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries"
  33892. ],
  33893. listWebhooks: ["GET /repos/{owner}/{repo}/hooks"],
  33894. merge: ["POST /repos/{owner}/{repo}/merges"],
  33895. mergeUpstream: ["POST /repos/{owner}/{repo}/merge-upstream"],
  33896. pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"],
  33897. redeliverWebhookDelivery: [
  33898. "POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"
  33899. ],
  33900. removeAppAccessRestrictions: [
  33901. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
  33902. {},
  33903. { mapToData: "apps" }
  33904. ],
  33905. removeCollaborator: [
  33906. "DELETE /repos/{owner}/{repo}/collaborators/{username}"
  33907. ],
  33908. removeStatusCheckContexts: [
  33909. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
  33910. {},
  33911. { mapToData: "contexts" }
  33912. ],
  33913. removeStatusCheckProtection: [
  33914. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
  33915. ],
  33916. removeTeamAccessRestrictions: [
  33917. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
  33918. {},
  33919. { mapToData: "teams" }
  33920. ],
  33921. removeUserAccessRestrictions: [
  33922. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
  33923. {},
  33924. { mapToData: "users" }
  33925. ],
  33926. renameBranch: ["POST /repos/{owner}/{repo}/branches/{branch}/rename"],
  33927. replaceAllTopics: ["PUT /repos/{owner}/{repo}/topics"],
  33928. requestPagesBuild: ["POST /repos/{owner}/{repo}/pages/builds"],
  33929. setAdminBranchProtection: [
  33930. "POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
  33931. ],
  33932. setAppAccessRestrictions: [
  33933. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
  33934. {},
  33935. { mapToData: "apps" }
  33936. ],
  33937. setStatusCheckContexts: [
  33938. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
  33939. {},
  33940. { mapToData: "contexts" }
  33941. ],
  33942. setTeamAccessRestrictions: [
  33943. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
  33944. {},
  33945. { mapToData: "teams" }
  33946. ],
  33947. setUserAccessRestrictions: [
  33948. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
  33949. {},
  33950. { mapToData: "users" }
  33951. ],
  33952. testPushWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/tests"],
  33953. transfer: ["POST /repos/{owner}/{repo}/transfer"],
  33954. update: ["PATCH /repos/{owner}/{repo}"],
  33955. updateBranchProtection: [
  33956. "PUT /repos/{owner}/{repo}/branches/{branch}/protection"
  33957. ],
  33958. updateCommitComment: ["PATCH /repos/{owner}/{repo}/comments/{comment_id}"],
  33959. updateDeploymentBranchPolicy: [
  33960. "PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
  33961. ],
  33962. updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"],
  33963. updateInvitation: [
  33964. "PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"
  33965. ],
  33966. updateOrgRuleset: ["PUT /orgs/{org}/rulesets/{ruleset_id}"],
  33967. updatePullRequestReviewProtection: [
  33968. "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
  33969. ],
  33970. updateRelease: ["PATCH /repos/{owner}/{repo}/releases/{release_id}"],
  33971. updateReleaseAsset: [
  33972. "PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}"
  33973. ],
  33974. updateRepoRuleset: ["PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
  33975. updateStatusCheckPotection: [
  33976. "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks",
  33977. {},
  33978. { renamed: ["repos", "updateStatusCheckProtection"] }
  33979. ],
  33980. updateStatusCheckProtection: [
  33981. "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
  33982. ],
  33983. updateWebhook: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}"],
  33984. updateWebhookConfigForRepo: [
  33985. "PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config"
  33986. ],
  33987. uploadReleaseAsset: [
  33988. "POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}",
  33989. { baseUrl: "https://uploads.github.com" }
  33990. ]
  33991. },
  33992. search: {
  33993. code: ["GET /search/code"],
  33994. commits: ["GET /search/commits"],
  33995. issuesAndPullRequests: ["GET /search/issues"],
  33996. labels: ["GET /search/labels"],
  33997. repos: ["GET /search/repositories"],
  33998. topics: ["GET /search/topics"],
  33999. users: ["GET /search/users"]
  34000. },
  34001. secretScanning: {
  34002. createPushProtectionBypass: [
  34003. "POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses"
  34004. ],
  34005. getAlert: [
  34006. "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"
  34007. ],
  34008. getScanHistory: ["GET /repos/{owner}/{repo}/secret-scanning/scan-history"],
  34009. listAlertsForOrg: ["GET /orgs/{org}/secret-scanning/alerts"],
  34010. listAlertsForRepo: ["GET /repos/{owner}/{repo}/secret-scanning/alerts"],
  34011. listLocationsForAlert: [
  34012. "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations"
  34013. ],
  34014. listOrgPatternConfigs: [
  34015. "GET /orgs/{org}/secret-scanning/pattern-configurations"
  34016. ],
  34017. updateAlert: [
  34018. "PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"
  34019. ],
  34020. updateOrgPatternConfigs: [
  34021. "PATCH /orgs/{org}/secret-scanning/pattern-configurations"
  34022. ]
  34023. },
  34024. securityAdvisories: {
  34025. createFork: [
  34026. "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks"
  34027. ],
  34028. createPrivateVulnerabilityReport: [
  34029. "POST /repos/{owner}/{repo}/security-advisories/reports"
  34030. ],
  34031. createRepositoryAdvisory: [
  34032. "POST /repos/{owner}/{repo}/security-advisories"
  34033. ],
  34034. createRepositoryAdvisoryCveRequest: [
  34035. "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve"
  34036. ],
  34037. getGlobalAdvisory: ["GET /advisories/{ghsa_id}"],
  34038. getRepositoryAdvisory: [
  34039. "GET /repos/{owner}/{repo}/security-advisories/{ghsa_id}"
  34040. ],
  34041. listGlobalAdvisories: ["GET /advisories"],
  34042. listOrgRepositoryAdvisories: ["GET /orgs/{org}/security-advisories"],
  34043. listRepositoryAdvisories: ["GET /repos/{owner}/{repo}/security-advisories"],
  34044. updateRepositoryAdvisory: [
  34045. "PATCH /repos/{owner}/{repo}/security-advisories/{ghsa_id}"
  34046. ]
  34047. },
  34048. teams: {
  34049. addOrUpdateMembershipForUserInOrg: [
  34050. "PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"
  34051. ],
  34052. addOrUpdateRepoPermissionsInOrg: [
  34053. "PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
  34054. ],
  34055. checkPermissionsForRepoInOrg: [
  34056. "GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
  34057. ],
  34058. create: ["POST /orgs/{org}/teams"],
  34059. createDiscussionCommentInOrg: [
  34060. "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"
  34061. ],
  34062. createDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions"],
  34063. deleteDiscussionCommentInOrg: [
  34064. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
  34065. ],
  34066. deleteDiscussionInOrg: [
  34067. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
  34068. ],
  34069. deleteInOrg: ["DELETE /orgs/{org}/teams/{team_slug}"],
  34070. getByName: ["GET /orgs/{org}/teams/{team_slug}"],
  34071. getDiscussionCommentInOrg: [
  34072. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
  34073. ],
  34074. getDiscussionInOrg: [
  34075. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
  34076. ],
  34077. getMembershipForUserInOrg: [
  34078. "GET /orgs/{org}/teams/{team_slug}/memberships/{username}"
  34079. ],
  34080. list: ["GET /orgs/{org}/teams"],
  34081. listChildInOrg: ["GET /orgs/{org}/teams/{team_slug}/teams"],
  34082. listDiscussionCommentsInOrg: [
  34083. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"
  34084. ],
  34085. listDiscussionsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions"],
  34086. listForAuthenticatedUser: ["GET /user/teams"],
  34087. listMembersInOrg: ["GET /orgs/{org}/teams/{team_slug}/members"],
  34088. listPendingInvitationsInOrg: [
  34089. "GET /orgs/{org}/teams/{team_slug}/invitations"
  34090. ],
  34091. listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"],
  34092. removeMembershipForUserInOrg: [
  34093. "DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}"
  34094. ],
  34095. removeRepoInOrg: [
  34096. "DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
  34097. ],
  34098. updateDiscussionCommentInOrg: [
  34099. "PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
  34100. ],
  34101. updateDiscussionInOrg: [
  34102. "PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
  34103. ],
  34104. updateInOrg: ["PATCH /orgs/{org}/teams/{team_slug}"]
  34105. },
  34106. users: {
  34107. addEmailForAuthenticated: [
  34108. "POST /user/emails",
  34109. {},
  34110. { renamed: ["users", "addEmailForAuthenticatedUser"] }
  34111. ],
  34112. addEmailForAuthenticatedUser: ["POST /user/emails"],
  34113. addSocialAccountForAuthenticatedUser: ["POST /user/social_accounts"],
  34114. block: ["PUT /user/blocks/{username}"],
  34115. checkBlocked: ["GET /user/blocks/{username}"],
  34116. checkFollowingForUser: ["GET /users/{username}/following/{target_user}"],
  34117. checkPersonIsFollowedByAuthenticated: ["GET /user/following/{username}"],
  34118. createGpgKeyForAuthenticated: [
  34119. "POST /user/gpg_keys",
  34120. {},
  34121. { renamed: ["users", "createGpgKeyForAuthenticatedUser"] }
  34122. ],
  34123. createGpgKeyForAuthenticatedUser: ["POST /user/gpg_keys"],
  34124. createPublicSshKeyForAuthenticated: [
  34125. "POST /user/keys",
  34126. {},
  34127. { renamed: ["users", "createPublicSshKeyForAuthenticatedUser"] }
  34128. ],
  34129. createPublicSshKeyForAuthenticatedUser: ["POST /user/keys"],
  34130. createSshSigningKeyForAuthenticatedUser: ["POST /user/ssh_signing_keys"],
  34131. deleteAttestationsBulk: [
  34132. "POST /users/{username}/attestations/delete-request"
  34133. ],
  34134. deleteAttestationsById: [
  34135. "DELETE /users/{username}/attestations/{attestation_id}"
  34136. ],
  34137. deleteAttestationsBySubjectDigest: [
  34138. "DELETE /users/{username}/attestations/digest/{subject_digest}"
  34139. ],
  34140. deleteEmailForAuthenticated: [
  34141. "DELETE /user/emails",
  34142. {},
  34143. { renamed: ["users", "deleteEmailForAuthenticatedUser"] }
  34144. ],
  34145. deleteEmailForAuthenticatedUser: ["DELETE /user/emails"],
  34146. deleteGpgKeyForAuthenticated: [
  34147. "DELETE /user/gpg_keys/{gpg_key_id}",
  34148. {},
  34149. { renamed: ["users", "deleteGpgKeyForAuthenticatedUser"] }
  34150. ],
  34151. deleteGpgKeyForAuthenticatedUser: ["DELETE /user/gpg_keys/{gpg_key_id}"],
  34152. deletePublicSshKeyForAuthenticated: [
  34153. "DELETE /user/keys/{key_id}",
  34154. {},
  34155. { renamed: ["users", "deletePublicSshKeyForAuthenticatedUser"] }
  34156. ],
  34157. deletePublicSshKeyForAuthenticatedUser: ["DELETE /user/keys/{key_id}"],
  34158. deleteSocialAccountForAuthenticatedUser: ["DELETE /user/social_accounts"],
  34159. deleteSshSigningKeyForAuthenticatedUser: [
  34160. "DELETE /user/ssh_signing_keys/{ssh_signing_key_id}"
  34161. ],
  34162. follow: ["PUT /user/following/{username}"],
  34163. getAuthenticated: ["GET /user"],
  34164. getById: ["GET /user/{account_id}"],
  34165. getByUsername: ["GET /users/{username}"],
  34166. getContextForUser: ["GET /users/{username}/hovercard"],
  34167. getGpgKeyForAuthenticated: [
  34168. "GET /user/gpg_keys/{gpg_key_id}",
  34169. {},
  34170. { renamed: ["users", "getGpgKeyForAuthenticatedUser"] }
  34171. ],
  34172. getGpgKeyForAuthenticatedUser: ["GET /user/gpg_keys/{gpg_key_id}"],
  34173. getPublicSshKeyForAuthenticated: [
  34174. "GET /user/keys/{key_id}",
  34175. {},
  34176. { renamed: ["users", "getPublicSshKeyForAuthenticatedUser"] }
  34177. ],
  34178. getPublicSshKeyForAuthenticatedUser: ["GET /user/keys/{key_id}"],
  34179. getSshSigningKeyForAuthenticatedUser: [
  34180. "GET /user/ssh_signing_keys/{ssh_signing_key_id}"
  34181. ],
  34182. list: ["GET /users"],
  34183. listAttestations: ["GET /users/{username}/attestations/{subject_digest}"],
  34184. listAttestationsBulk: [
  34185. "POST /users/{username}/attestations/bulk-list{?per_page,before,after}"
  34186. ],
  34187. listBlockedByAuthenticated: [
  34188. "GET /user/blocks",
  34189. {},
  34190. { renamed: ["users", "listBlockedByAuthenticatedUser"] }
  34191. ],
  34192. listBlockedByAuthenticatedUser: ["GET /user/blocks"],
  34193. listEmailsForAuthenticated: [
  34194. "GET /user/emails",
  34195. {},
  34196. { renamed: ["users", "listEmailsForAuthenticatedUser"] }
  34197. ],
  34198. listEmailsForAuthenticatedUser: ["GET /user/emails"],
  34199. listFollowedByAuthenticated: [
  34200. "GET /user/following",
  34201. {},
  34202. { renamed: ["users", "listFollowedByAuthenticatedUser"] }
  34203. ],
  34204. listFollowedByAuthenticatedUser: ["GET /user/following"],
  34205. listFollowersForAuthenticatedUser: ["GET /user/followers"],
  34206. listFollowersForUser: ["GET /users/{username}/followers"],
  34207. listFollowingForUser: ["GET /users/{username}/following"],
  34208. listGpgKeysForAuthenticated: [
  34209. "GET /user/gpg_keys",
  34210. {},
  34211. { renamed: ["users", "listGpgKeysForAuthenticatedUser"] }
  34212. ],
  34213. listGpgKeysForAuthenticatedUser: ["GET /user/gpg_keys"],
  34214. listGpgKeysForUser: ["GET /users/{username}/gpg_keys"],
  34215. listPublicEmailsForAuthenticated: [
  34216. "GET /user/public_emails",
  34217. {},
  34218. { renamed: ["users", "listPublicEmailsForAuthenticatedUser"] }
  34219. ],
  34220. listPublicEmailsForAuthenticatedUser: ["GET /user/public_emails"],
  34221. listPublicKeysForUser: ["GET /users/{username}/keys"],
  34222. listPublicSshKeysForAuthenticated: [
  34223. "GET /user/keys",
  34224. {},
  34225. { renamed: ["users", "listPublicSshKeysForAuthenticatedUser"] }
  34226. ],
  34227. listPublicSshKeysForAuthenticatedUser: ["GET /user/keys"],
  34228. listSocialAccountsForAuthenticatedUser: ["GET /user/social_accounts"],
  34229. listSocialAccountsForUser: ["GET /users/{username}/social_accounts"],
  34230. listSshSigningKeysForAuthenticatedUser: ["GET /user/ssh_signing_keys"],
  34231. listSshSigningKeysForUser: ["GET /users/{username}/ssh_signing_keys"],
  34232. setPrimaryEmailVisibilityForAuthenticated: [
  34233. "PATCH /user/email/visibility",
  34234. {},
  34235. { renamed: ["users", "setPrimaryEmailVisibilityForAuthenticatedUser"] }
  34236. ],
  34237. setPrimaryEmailVisibilityForAuthenticatedUser: [
  34238. "PATCH /user/email/visibility"
  34239. ],
  34240. unblock: ["DELETE /user/blocks/{username}"],
  34241. unfollow: ["DELETE /user/following/{username}"],
  34242. updateAuthenticated: ["PATCH /user"]
  34243. }
  34244. };
  34245. var endpoints_default = Endpoints;
  34246. //# sourceMappingURL=endpoints.js.map
  34247. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js
  34248. const endpointMethodsMap = /* @__PURE__ */ new Map();
  34249. for (const [scope, endpoints] of Object.entries(endpoints_default)) {
  34250. for (const [methodName, endpoint] of Object.entries(endpoints)) {
  34251. const [route, defaults, decorations] = endpoint;
  34252. const [method, url] = route.split(/ /);
  34253. const endpointDefaults = Object.assign(
  34254. {
  34255. method,
  34256. url
  34257. },
  34258. defaults
  34259. );
  34260. if (!endpointMethodsMap.has(scope)) {
  34261. endpointMethodsMap.set(scope, /* @__PURE__ */ new Map());
  34262. }
  34263. endpointMethodsMap.get(scope).set(methodName, {
  34264. scope,
  34265. methodName,
  34266. endpointDefaults,
  34267. decorations
  34268. });
  34269. }
  34270. }
  34271. const handler = {
  34272. has({ scope }, methodName) {
  34273. return endpointMethodsMap.get(scope).has(methodName);
  34274. },
  34275. getOwnPropertyDescriptor(target, methodName) {
  34276. return {
  34277. value: this.get(target, methodName),
  34278. // ensures method is in the cache
  34279. configurable: true,
  34280. writable: true,
  34281. enumerable: true
  34282. };
  34283. },
  34284. defineProperty(target, methodName, descriptor) {
  34285. Object.defineProperty(target.cache, methodName, descriptor);
  34286. return true;
  34287. },
  34288. deleteProperty(target, methodName) {
  34289. delete target.cache[methodName];
  34290. return true;
  34291. },
  34292. ownKeys({ scope }) {
  34293. return [...endpointMethodsMap.get(scope).keys()];
  34294. },
  34295. set(target, methodName, value) {
  34296. return target.cache[methodName] = value;
  34297. },
  34298. get({ octokit, scope, cache }, methodName) {
  34299. if (cache[methodName]) {
  34300. return cache[methodName];
  34301. }
  34302. const method = endpointMethodsMap.get(scope).get(methodName);
  34303. if (!method) {
  34304. return void 0;
  34305. }
  34306. const { endpointDefaults, decorations } = method;
  34307. if (decorations) {
  34308. cache[methodName] = decorate(
  34309. octokit,
  34310. scope,
  34311. methodName,
  34312. endpointDefaults,
  34313. decorations
  34314. );
  34315. } else {
  34316. cache[methodName] = octokit.request.defaults(endpointDefaults);
  34317. }
  34318. return cache[methodName];
  34319. }
  34320. };
  34321. function endpointsToMethods(octokit) {
  34322. const newMethods = {};
  34323. for (const scope of endpointMethodsMap.keys()) {
  34324. newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler);
  34325. }
  34326. return newMethods;
  34327. }
  34328. function decorate(octokit, scope, methodName, defaults, decorations) {
  34329. const requestWithDefaults = octokit.request.defaults(defaults);
  34330. function withDecorations(...args) {
  34331. let options = requestWithDefaults.endpoint.merge(...args);
  34332. if (decorations.mapToData) {
  34333. options = Object.assign({}, options, {
  34334. data: options[decorations.mapToData],
  34335. [decorations.mapToData]: void 0
  34336. });
  34337. return requestWithDefaults(options);
  34338. }
  34339. if (decorations.renamed) {
  34340. const [newScope, newMethodName] = decorations.renamed;
  34341. octokit.log.warn(
  34342. `octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`
  34343. );
  34344. }
  34345. if (decorations.deprecated) {
  34346. octokit.log.warn(decorations.deprecated);
  34347. }
  34348. if (decorations.renamedParameters) {
  34349. const options2 = requestWithDefaults.endpoint.merge(...args);
  34350. for (const [name, alias] of Object.entries(
  34351. decorations.renamedParameters
  34352. )) {
  34353. if (name in options2) {
  34354. octokit.log.warn(
  34355. `"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`
  34356. );
  34357. if (!(alias in options2)) {
  34358. options2[alias] = options2[name];
  34359. }
  34360. delete options2[name];
  34361. }
  34362. }
  34363. return requestWithDefaults(options2);
  34364. }
  34365. return requestWithDefaults(...args);
  34366. }
  34367. return Object.assign(withDecorations, requestWithDefaults);
  34368. }
  34369. //# sourceMappingURL=endpoints-to-methods.js.map
  34370. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js
  34371. function restEndpointMethods(octokit) {
  34372. const api = endpointsToMethods(octokit);
  34373. return {
  34374. rest: api
  34375. };
  34376. }
  34377. restEndpointMethods.VERSION = dist_src_version_VERSION;
  34378. function legacyRestEndpointMethods(octokit) {
  34379. const api = endpointsToMethods(octokit);
  34380. return {
  34381. ...api,
  34382. rest: api
  34383. };
  34384. }
  34385. legacyRestEndpointMethods.VERSION = dist_src_version_VERSION;
  34386. //# sourceMappingURL=index.js.map
  34387. ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-paginate-rest/dist-bundle/index.js
  34388. // pkg/dist-src/version.js
  34389. var plugin_paginate_rest_dist_bundle_VERSION = "0.0.0-development";
  34390. // pkg/dist-src/normalize-paginated-list-response.js
  34391. function normalizePaginatedListResponse(response) {
  34392. if (!response.data) {
  34393. return {
  34394. ...response,
  34395. data: []
  34396. };
  34397. }
  34398. const responseNeedsNormalization = ("total_count" in response.data || "total_commits" in response.data) && !("url" in response.data);
  34399. if (!responseNeedsNormalization) return response;
  34400. const incompleteResults = response.data.incomplete_results;
  34401. const repositorySelection = response.data.repository_selection;
  34402. const totalCount = response.data.total_count;
  34403. const totalCommits = response.data.total_commits;
  34404. delete response.data.incomplete_results;
  34405. delete response.data.repository_selection;
  34406. delete response.data.total_count;
  34407. delete response.data.total_commits;
  34408. const namespaceKey = Object.keys(response.data)[0];
  34409. const data = response.data[namespaceKey];
  34410. response.data = data;
  34411. if (typeof incompleteResults !== "undefined") {
  34412. response.data.incomplete_results = incompleteResults;
  34413. }
  34414. if (typeof repositorySelection !== "undefined") {
  34415. response.data.repository_selection = repositorySelection;
  34416. }
  34417. response.data.total_count = totalCount;
  34418. response.data.total_commits = totalCommits;
  34419. return response;
  34420. }
  34421. // pkg/dist-src/iterator.js
  34422. function iterator(octokit, route, parameters) {
  34423. const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters);
  34424. const requestMethod = typeof route === "function" ? route : octokit.request;
  34425. const method = options.method;
  34426. const headers = options.headers;
  34427. let url = options.url;
  34428. return {
  34429. [Symbol.asyncIterator]: () => ({
  34430. async next() {
  34431. if (!url) return { done: true };
  34432. try {
  34433. const response = await requestMethod({ method, url, headers });
  34434. const normalizedResponse = normalizePaginatedListResponse(response);
  34435. url = ((normalizedResponse.headers.link || "").match(
  34436. /<([^<>]+)>;\s*rel="next"/
  34437. ) || [])[1];
  34438. if (!url && "total_commits" in normalizedResponse.data) {
  34439. const parsedUrl = new URL(normalizedResponse.url);
  34440. const params = parsedUrl.searchParams;
  34441. const page = parseInt(params.get("page") || "1", 10);
  34442. const per_page = parseInt(params.get("per_page") || "250", 10);
  34443. if (page * per_page < normalizedResponse.data.total_commits) {
  34444. params.set("page", String(page + 1));
  34445. url = parsedUrl.toString();
  34446. }
  34447. }
  34448. return { value: normalizedResponse };
  34449. } catch (error) {
  34450. if (error.status !== 409) throw error;
  34451. url = "";
  34452. return {
  34453. value: {
  34454. status: 200,
  34455. headers: {},
  34456. data: []
  34457. }
  34458. };
  34459. }
  34460. }
  34461. })
  34462. };
  34463. }
  34464. // pkg/dist-src/paginate.js
  34465. function paginate(octokit, route, parameters, mapFn) {
  34466. if (typeof parameters === "function") {
  34467. mapFn = parameters;
  34468. parameters = void 0;
  34469. }
  34470. return gather(
  34471. octokit,
  34472. [],
  34473. iterator(octokit, route, parameters)[Symbol.asyncIterator](),
  34474. mapFn
  34475. );
  34476. }
  34477. function gather(octokit, results, iterator2, mapFn) {
  34478. return iterator2.next().then((result) => {
  34479. if (result.done) {
  34480. return results;
  34481. }
  34482. let earlyExit = false;
  34483. function done() {
  34484. earlyExit = true;
  34485. }
  34486. results = results.concat(
  34487. mapFn ? mapFn(result.value, done) : result.value.data
  34488. );
  34489. if (earlyExit) {
  34490. return results;
  34491. }
  34492. return gather(octokit, results, iterator2, mapFn);
  34493. });
  34494. }
  34495. // pkg/dist-src/compose-paginate.js
  34496. var composePaginateRest = Object.assign(paginate, {
  34497. iterator
  34498. });
  34499. // pkg/dist-src/generated/paginating-endpoints.js
  34500. var paginatingEndpoints = (/* unused pure expression or super */ null && ([
  34501. "GET /advisories",
  34502. "GET /app/hook/deliveries",
  34503. "GET /app/installation-requests",
  34504. "GET /app/installations",
  34505. "GET /assignments/{assignment_id}/accepted_assignments",
  34506. "GET /classrooms",
  34507. "GET /classrooms/{classroom_id}/assignments",
  34508. "GET /enterprises/{enterprise}/code-security/configurations",
  34509. "GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories",
  34510. "GET /enterprises/{enterprise}/dependabot/alerts",
  34511. "GET /enterprises/{enterprise}/teams",
  34512. "GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships",
  34513. "GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations",
  34514. "GET /events",
  34515. "GET /gists",
  34516. "GET /gists/public",
  34517. "GET /gists/starred",
  34518. "GET /gists/{gist_id}/comments",
  34519. "GET /gists/{gist_id}/commits",
  34520. "GET /gists/{gist_id}/forks",
  34521. "GET /installation/repositories",
  34522. "GET /issues",
  34523. "GET /licenses",
  34524. "GET /marketplace_listing/plans",
  34525. "GET /marketplace_listing/plans/{plan_id}/accounts",
  34526. "GET /marketplace_listing/stubbed/plans",
  34527. "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts",
  34528. "GET /networks/{owner}/{repo}/events",
  34529. "GET /notifications",
  34530. "GET /organizations",
  34531. "GET /organizations/{org}/dependabot/repository-access",
  34532. "GET /orgs/{org}/actions/cache/usage-by-repository",
  34533. "GET /orgs/{org}/actions/hosted-runners",
  34534. "GET /orgs/{org}/actions/permissions/repositories",
  34535. "GET /orgs/{org}/actions/permissions/self-hosted-runners/repositories",
  34536. "GET /orgs/{org}/actions/runner-groups",
  34537. "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/hosted-runners",
  34538. "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories",
  34539. "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners",
  34540. "GET /orgs/{org}/actions/runners",
  34541. "GET /orgs/{org}/actions/secrets",
  34542. "GET /orgs/{org}/actions/secrets/{secret_name}/repositories",
  34543. "GET /orgs/{org}/actions/variables",
  34544. "GET /orgs/{org}/actions/variables/{name}/repositories",
  34545. "GET /orgs/{org}/attestations/repositories",
  34546. "GET /orgs/{org}/attestations/{subject_digest}",
  34547. "GET /orgs/{org}/blocks",
  34548. "GET /orgs/{org}/campaigns",
  34549. "GET /orgs/{org}/code-scanning/alerts",
  34550. "GET /orgs/{org}/code-security/configurations",
  34551. "GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories",
  34552. "GET /orgs/{org}/codespaces",
  34553. "GET /orgs/{org}/codespaces/secrets",
  34554. "GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories",
  34555. "GET /orgs/{org}/copilot/billing/seats",
  34556. "GET /orgs/{org}/copilot/metrics",
  34557. "GET /orgs/{org}/dependabot/alerts",
  34558. "GET /orgs/{org}/dependabot/secrets",
  34559. "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories",
  34560. "GET /orgs/{org}/events",
  34561. "GET /orgs/{org}/failed_invitations",
  34562. "GET /orgs/{org}/hooks",
  34563. "GET /orgs/{org}/hooks/{hook_id}/deliveries",
  34564. "GET /orgs/{org}/insights/api/route-stats/{actor_type}/{actor_id}",
  34565. "GET /orgs/{org}/insights/api/subject-stats",
  34566. "GET /orgs/{org}/insights/api/user-stats/{user_id}",
  34567. "GET /orgs/{org}/installations",
  34568. "GET /orgs/{org}/invitations",
  34569. "GET /orgs/{org}/invitations/{invitation_id}/teams",
  34570. "GET /orgs/{org}/issues",
  34571. "GET /orgs/{org}/members",
  34572. "GET /orgs/{org}/members/{username}/codespaces",
  34573. "GET /orgs/{org}/migrations",
  34574. "GET /orgs/{org}/migrations/{migration_id}/repositories",
  34575. "GET /orgs/{org}/organization-roles/{role_id}/teams",
  34576. "GET /orgs/{org}/organization-roles/{role_id}/users",
  34577. "GET /orgs/{org}/outside_collaborators",
  34578. "GET /orgs/{org}/packages",
  34579. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
  34580. "GET /orgs/{org}/personal-access-token-requests",
  34581. "GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories",
  34582. "GET /orgs/{org}/personal-access-tokens",
  34583. "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories",
  34584. "GET /orgs/{org}/private-registries",
  34585. "GET /orgs/{org}/projects",
  34586. "GET /orgs/{org}/projectsV2",
  34587. "GET /orgs/{org}/projectsV2/{project_number}/fields",
  34588. "GET /orgs/{org}/projectsV2/{project_number}/items",
  34589. "GET /orgs/{org}/properties/values",
  34590. "GET /orgs/{org}/public_members",
  34591. "GET /orgs/{org}/repos",
  34592. "GET /orgs/{org}/rulesets",
  34593. "GET /orgs/{org}/rulesets/rule-suites",
  34594. "GET /orgs/{org}/rulesets/{ruleset_id}/history",
  34595. "GET /orgs/{org}/secret-scanning/alerts",
  34596. "GET /orgs/{org}/security-advisories",
  34597. "GET /orgs/{org}/settings/immutable-releases/repositories",
  34598. "GET /orgs/{org}/settings/network-configurations",
  34599. "GET /orgs/{org}/team/{team_slug}/copilot/metrics",
  34600. "GET /orgs/{org}/teams",
  34601. "GET /orgs/{org}/teams/{team_slug}/discussions",
  34602. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments",
  34603. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions",
  34604. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions",
  34605. "GET /orgs/{org}/teams/{team_slug}/invitations",
  34606. "GET /orgs/{org}/teams/{team_slug}/members",
  34607. "GET /orgs/{org}/teams/{team_slug}/projects",
  34608. "GET /orgs/{org}/teams/{team_slug}/repos",
  34609. "GET /orgs/{org}/teams/{team_slug}/teams",
  34610. "GET /projects/{project_id}/collaborators",
  34611. "GET /repos/{owner}/{repo}/actions/artifacts",
  34612. "GET /repos/{owner}/{repo}/actions/caches",
  34613. "GET /repos/{owner}/{repo}/actions/organization-secrets",
  34614. "GET /repos/{owner}/{repo}/actions/organization-variables",
  34615. "GET /repos/{owner}/{repo}/actions/runners",
  34616. "GET /repos/{owner}/{repo}/actions/runs",
  34617. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts",
  34618. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs",
  34619. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs",
  34620. "GET /repos/{owner}/{repo}/actions/secrets",
  34621. "GET /repos/{owner}/{repo}/actions/variables",
  34622. "GET /repos/{owner}/{repo}/actions/workflows",
  34623. "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs",
  34624. "GET /repos/{owner}/{repo}/activity",
  34625. "GET /repos/{owner}/{repo}/assignees",
  34626. "GET /repos/{owner}/{repo}/attestations/{subject_digest}",
  34627. "GET /repos/{owner}/{repo}/branches",
  34628. "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations",
  34629. "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs",
  34630. "GET /repos/{owner}/{repo}/code-scanning/alerts",
  34631. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
  34632. "GET /repos/{owner}/{repo}/code-scanning/analyses",
  34633. "GET /repos/{owner}/{repo}/codespaces",
  34634. "GET /repos/{owner}/{repo}/codespaces/devcontainers",
  34635. "GET /repos/{owner}/{repo}/codespaces/secrets",
  34636. "GET /repos/{owner}/{repo}/collaborators",
  34637. "GET /repos/{owner}/{repo}/comments",
  34638. "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions",
  34639. "GET /repos/{owner}/{repo}/commits",
  34640. "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments",
  34641. "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls",
  34642. "GET /repos/{owner}/{repo}/commits/{ref}/check-runs",
  34643. "GET /repos/{owner}/{repo}/commits/{ref}/check-suites",
  34644. "GET /repos/{owner}/{repo}/commits/{ref}/status",
  34645. "GET /repos/{owner}/{repo}/commits/{ref}/statuses",
  34646. "GET /repos/{owner}/{repo}/compare/{basehead}",
  34647. "GET /repos/{owner}/{repo}/compare/{base}...{head}",
  34648. "GET /repos/{owner}/{repo}/contributors",
  34649. "GET /repos/{owner}/{repo}/dependabot/alerts",
  34650. "GET /repos/{owner}/{repo}/dependabot/secrets",
  34651. "GET /repos/{owner}/{repo}/deployments",
  34652. "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses",
  34653. "GET /repos/{owner}/{repo}/environments",
  34654. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies",
  34655. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps",
  34656. "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets",
  34657. "GET /repos/{owner}/{repo}/environments/{environment_name}/variables",
  34658. "GET /repos/{owner}/{repo}/events",
  34659. "GET /repos/{owner}/{repo}/forks",
  34660. "GET /repos/{owner}/{repo}/hooks",
  34661. "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries",
  34662. "GET /repos/{owner}/{repo}/invitations",
  34663. "GET /repos/{owner}/{repo}/issues",
  34664. "GET /repos/{owner}/{repo}/issues/comments",
  34665. "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions",
  34666. "GET /repos/{owner}/{repo}/issues/events",
  34667. "GET /repos/{owner}/{repo}/issues/{issue_number}/comments",
  34668. "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by",
  34669. "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking",
  34670. "GET /repos/{owner}/{repo}/issues/{issue_number}/events",
  34671. "GET /repos/{owner}/{repo}/issues/{issue_number}/labels",
  34672. "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions",
  34673. "GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues",
  34674. "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline",
  34675. "GET /repos/{owner}/{repo}/keys",
  34676. "GET /repos/{owner}/{repo}/labels",
  34677. "GET /repos/{owner}/{repo}/milestones",
  34678. "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels",
  34679. "GET /repos/{owner}/{repo}/notifications",
  34680. "GET /repos/{owner}/{repo}/pages/builds",
  34681. "GET /repos/{owner}/{repo}/projects",
  34682. "GET /repos/{owner}/{repo}/pulls",
  34683. "GET /repos/{owner}/{repo}/pulls/comments",
  34684. "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions",
  34685. "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments",
  34686. "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
  34687. "GET /repos/{owner}/{repo}/pulls/{pull_number}/files",
  34688. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews",
  34689. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments",
  34690. "GET /repos/{owner}/{repo}/releases",
  34691. "GET /repos/{owner}/{repo}/releases/{release_id}/assets",
  34692. "GET /repos/{owner}/{repo}/releases/{release_id}/reactions",
  34693. "GET /repos/{owner}/{repo}/rules/branches/{branch}",
  34694. "GET /repos/{owner}/{repo}/rulesets",
  34695. "GET /repos/{owner}/{repo}/rulesets/rule-suites",
  34696. "GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history",
  34697. "GET /repos/{owner}/{repo}/secret-scanning/alerts",
  34698. "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations",
  34699. "GET /repos/{owner}/{repo}/security-advisories",
  34700. "GET /repos/{owner}/{repo}/stargazers",
  34701. "GET /repos/{owner}/{repo}/subscribers",
  34702. "GET /repos/{owner}/{repo}/tags",
  34703. "GET /repos/{owner}/{repo}/teams",
  34704. "GET /repos/{owner}/{repo}/topics",
  34705. "GET /repositories",
  34706. "GET /search/code",
  34707. "GET /search/commits",
  34708. "GET /search/issues",
  34709. "GET /search/labels",
  34710. "GET /search/repositories",
  34711. "GET /search/topics",
  34712. "GET /search/users",
  34713. "GET /teams/{team_id}/discussions",
  34714. "GET /teams/{team_id}/discussions/{discussion_number}/comments",
  34715. "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions",
  34716. "GET /teams/{team_id}/discussions/{discussion_number}/reactions",
  34717. "GET /teams/{team_id}/invitations",
  34718. "GET /teams/{team_id}/members",
  34719. "GET /teams/{team_id}/projects",
  34720. "GET /teams/{team_id}/repos",
  34721. "GET /teams/{team_id}/teams",
  34722. "GET /user/blocks",
  34723. "GET /user/codespaces",
  34724. "GET /user/codespaces/secrets",
  34725. "GET /user/emails",
  34726. "GET /user/followers",
  34727. "GET /user/following",
  34728. "GET /user/gpg_keys",
  34729. "GET /user/installations",
  34730. "GET /user/installations/{installation_id}/repositories",
  34731. "GET /user/issues",
  34732. "GET /user/keys",
  34733. "GET /user/marketplace_purchases",
  34734. "GET /user/marketplace_purchases/stubbed",
  34735. "GET /user/memberships/orgs",
  34736. "GET /user/migrations",
  34737. "GET /user/migrations/{migration_id}/repositories",
  34738. "GET /user/orgs",
  34739. "GET /user/packages",
  34740. "GET /user/packages/{package_type}/{package_name}/versions",
  34741. "GET /user/public_emails",
  34742. "GET /user/repos",
  34743. "GET /user/repository_invitations",
  34744. "GET /user/social_accounts",
  34745. "GET /user/ssh_signing_keys",
  34746. "GET /user/starred",
  34747. "GET /user/subscriptions",
  34748. "GET /user/teams",
  34749. "GET /users",
  34750. "GET /users/{username}/attestations/{subject_digest}",
  34751. "GET /users/{username}/events",
  34752. "GET /users/{username}/events/orgs/{org}",
  34753. "GET /users/{username}/events/public",
  34754. "GET /users/{username}/followers",
  34755. "GET /users/{username}/following",
  34756. "GET /users/{username}/gists",
  34757. "GET /users/{username}/gpg_keys",
  34758. "GET /users/{username}/keys",
  34759. "GET /users/{username}/orgs",
  34760. "GET /users/{username}/packages",
  34761. "GET /users/{username}/projects",
  34762. "GET /users/{username}/projectsV2",
  34763. "GET /users/{username}/projectsV2/{project_number}/fields",
  34764. "GET /users/{username}/projectsV2/{project_number}/items",
  34765. "GET /users/{username}/received_events",
  34766. "GET /users/{username}/received_events/public",
  34767. "GET /users/{username}/repos",
  34768. "GET /users/{username}/social_accounts",
  34769. "GET /users/{username}/ssh_signing_keys",
  34770. "GET /users/{username}/starred",
  34771. "GET /users/{username}/subscriptions"
  34772. ]));
  34773. // pkg/dist-src/paginating-endpoints.js
  34774. function isPaginatingEndpoint(arg) {
  34775. if (typeof arg === "string") {
  34776. return paginatingEndpoints.includes(arg);
  34777. } else {
  34778. return false;
  34779. }
  34780. }
  34781. // pkg/dist-src/index.js
  34782. function paginateRest(octokit) {
  34783. return {
  34784. paginate: Object.assign(paginate.bind(null, octokit), {
  34785. iterator: iterator.bind(null, octokit)
  34786. })
  34787. };
  34788. }
  34789. paginateRest.VERSION = plugin_paginate_rest_dist_bundle_VERSION;
  34790. ;// CONCATENATED MODULE: ./node_modules/@actions/github/lib/utils.js
  34791. // octokit + plugins
  34792. const context = new Context();
  34793. const baseUrl = getApiBaseUrl();
  34794. const defaults = {
  34795. baseUrl,
  34796. request: {
  34797. agent: getProxyAgent(baseUrl),
  34798. fetch: getProxyFetch(baseUrl)
  34799. }
  34800. };
  34801. const GitHub = Octokit.plugin(restEndpointMethods, paginateRest).defaults(defaults);
  34802. /**
  34803. * Convience function to correctly format Octokit Options to pass into the constructor.
  34804. *
  34805. * @param token the repo PAT or GITHUB_TOKEN
  34806. * @param options other options to set
  34807. */
  34808. function getOctokitOptions(token, options) {
  34809. const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller
  34810. // Auth
  34811. const auth = getAuthString(token, opts);
  34812. if (auth) {
  34813. opts.auth = auth;
  34814. }
  34815. // Orchestration ID
  34816. const userAgent = getUserAgentWithOrchestrationId(opts.userAgent);
  34817. if (userAgent) {
  34818. opts.userAgent = userAgent;
  34819. }
  34820. return opts;
  34821. }
  34822. //# sourceMappingURL=utils.js.map
  34823. ;// CONCATENATED MODULE: ./node_modules/@actions/github/lib/github.js
  34824. const github_context = new Context();
  34825. /**
  34826. * Returns a hydrated octokit ready to use for GitHub Actions
  34827. *
  34828. * @param token the repo PAT or GITHUB_TOKEN
  34829. * @param options other options to set
  34830. */
  34831. function getOctokit(token, options, ...additionalPlugins) {
  34832. const GitHubWithPlugins = GitHub.plugin(...additionalPlugins);
  34833. return new GitHubWithPlugins(getOctokitOptions(token, options));
  34834. }
  34835. //# sourceMappingURL=github.js.map
  34836. // EXTERNAL MODULE: ./node_modules/@actions/tool-cache/node_modules/semver/index.js
  34837. var node_modules_semver = __nccwpck_require__(885);
  34838. ;// CONCATENATED MODULE: ./node_modules/@actions/tool-cache/lib/manifest.js
  34839. var manifest_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  34840. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  34841. return new (P || (P = Promise))(function (resolve, reject) {
  34842. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  34843. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  34844. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  34845. step((generator = generator.apply(thisArg, _arguments || [])).next());
  34846. });
  34847. };
  34848. // Internal object for testability (allows mocking in ESM)
  34849. const _internal = {
  34850. readLinuxVersionFile() {
  34851. const lsbReleaseFile = '/etc/lsb-release';
  34852. const osReleaseFile = '/etc/os-release';
  34853. let contents = '';
  34854. if (external_fs_namespaceObject.existsSync(lsbReleaseFile)) {
  34855. contents = external_fs_namespaceObject.readFileSync(lsbReleaseFile).toString();
  34856. }
  34857. else if (external_fs_namespaceObject.existsSync(osReleaseFile)) {
  34858. contents = external_fs_namespaceObject.readFileSync(osReleaseFile).toString();
  34859. }
  34860. return contents;
  34861. }
  34862. };
  34863. function _findMatch(versionSpec, stable, candidates, archFilter) {
  34864. return manifest_awaiter(this, void 0, void 0, function* () {
  34865. const platFilter = os.platform();
  34866. let result;
  34867. let match;
  34868. let file;
  34869. for (const candidate of candidates) {
  34870. const version = candidate.version;
  34871. debug(`check ${version} satisfies ${versionSpec}`);
  34872. if (semver.satisfies(version, versionSpec) &&
  34873. (!stable || candidate.stable === stable)) {
  34874. file = candidate.files.find(item => {
  34875. debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
  34876. let chk = item.arch === archFilter && item.platform === platFilter;
  34877. if (chk && item.platform_version) {
  34878. const osVersion = _getOsVersion();
  34879. if (osVersion === item.platform_version) {
  34880. chk = true;
  34881. }
  34882. else {
  34883. chk = semver.satisfies(osVersion, item.platform_version);
  34884. }
  34885. }
  34886. return chk;
  34887. });
  34888. if (file) {
  34889. debug(`matched ${candidate.version}`);
  34890. match = candidate;
  34891. break;
  34892. }
  34893. }
  34894. }
  34895. if (match && file) {
  34896. // clone since we're mutating the file list to be only the file that matches
  34897. result = Object.assign({}, match);
  34898. result.files = [file];
  34899. }
  34900. return result;
  34901. });
  34902. }
  34903. function _getOsVersion() {
  34904. // TODO: add windows and other linux, arm variants
  34905. // right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python)
  34906. const plat = os.platform();
  34907. let version = '';
  34908. if (plat === 'darwin') {
  34909. version = cp.execSync('sw_vers -productVersion').toString();
  34910. }
  34911. else if (plat === 'linux') {
  34912. // lsb_release process not in some containers, readfile
  34913. // Run cat /etc/lsb-release
  34914. // DISTRIB_ID=Ubuntu
  34915. // DISTRIB_RELEASE=18.04
  34916. // DISTRIB_CODENAME=bionic
  34917. // DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
  34918. const lsbContents = _internal.readLinuxVersionFile();
  34919. if (lsbContents) {
  34920. const lines = lsbContents.split('\n');
  34921. for (const line of lines) {
  34922. const parts = line.split('=');
  34923. if (parts.length === 2 &&
  34924. (parts[0].trim() === 'VERSION_ID' ||
  34925. parts[0].trim() === 'DISTRIB_RELEASE')) {
  34926. version = parts[1].trim().replace(/^"/, '').replace(/"$/, '');
  34927. break;
  34928. }
  34929. }
  34930. }
  34931. }
  34932. return version;
  34933. }
  34934. // Alias for backwards compatibility
  34935. function _readLinuxVersionFile() {
  34936. return _internal.readLinuxVersionFile();
  34937. }
  34938. //# sourceMappingURL=manifest.js.map
  34939. ;// CONCATENATED MODULE: external "stream"
  34940. const external_stream_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("stream");
  34941. // EXTERNAL MODULE: external "util"
  34942. var external_util_ = __nccwpck_require__(9023);
  34943. ;// CONCATENATED MODULE: ./node_modules/@actions/tool-cache/lib/retry-helper.js
  34944. var retry_helper_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  34945. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  34946. return new (P || (P = Promise))(function (resolve, reject) {
  34947. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  34948. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  34949. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  34950. step((generator = generator.apply(thisArg, _arguments || [])).next());
  34951. });
  34952. };
  34953. /**
  34954. * Internal class for retries
  34955. */
  34956. class lib_retry_helper_RetryHelper {
  34957. constructor(maxAttempts, minSeconds, maxSeconds) {
  34958. if (maxAttempts < 1) {
  34959. throw new Error('max attempts should be greater than or equal to 1');
  34960. }
  34961. this.maxAttempts = maxAttempts;
  34962. this.minSeconds = Math.floor(minSeconds);
  34963. this.maxSeconds = Math.floor(maxSeconds);
  34964. if (this.minSeconds > this.maxSeconds) {
  34965. throw new Error('min seconds should be less than or equal to max seconds');
  34966. }
  34967. }
  34968. execute(action, isRetryable) {
  34969. return retry_helper_awaiter(this, void 0, void 0, function* () {
  34970. let attempt = 1;
  34971. while (attempt < this.maxAttempts) {
  34972. // Try
  34973. try {
  34974. return yield action();
  34975. }
  34976. catch (err) {
  34977. if (isRetryable && !isRetryable(err)) {
  34978. throw err;
  34979. }
  34980. core.info(err.message);
  34981. }
  34982. // Sleep
  34983. const seconds = this.getSleepAmount();
  34984. core.info(`Waiting ${seconds} seconds before trying again`);
  34985. yield this.sleep(seconds);
  34986. attempt++;
  34987. }
  34988. // Last attempt
  34989. return yield action();
  34990. });
  34991. }
  34992. getSleepAmount() {
  34993. return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
  34994. this.minSeconds);
  34995. }
  34996. sleep(seconds) {
  34997. return retry_helper_awaiter(this, void 0, void 0, function* () {
  34998. return new Promise(resolve => setTimeout(resolve, seconds * 1000));
  34999. });
  35000. }
  35001. }
  35002. //# sourceMappingURL=retry-helper.js.map
  35003. ;// CONCATENATED MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js
  35004. var tool_cache_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
  35005. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  35006. return new (P || (P = Promise))(function (resolve, reject) {
  35007. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  35008. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  35009. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  35010. step((generator = generator.apply(thisArg, _arguments || [])).next());
  35011. });
  35012. };
  35013. class HTTPError extends Error {
  35014. constructor(httpStatusCode) {
  35015. super(`Unexpected HTTP response: ${httpStatusCode}`);
  35016. this.httpStatusCode = httpStatusCode;
  35017. Object.setPrototypeOf(this, new.target.prototype);
  35018. }
  35019. }
  35020. const tool_cache_IS_WINDOWS = process.platform === 'win32';
  35021. const IS_MAC = process.platform === 'darwin';
  35022. const tool_cache_userAgent = 'actions/tool-cache';
  35023. /**
  35024. * Download a tool from an url and stream it into a file
  35025. *
  35026. * @param url url of tool to download
  35027. * @param dest path to download tool
  35028. * @param auth authorization header
  35029. * @param headers other headers
  35030. * @returns path to downloaded tool
  35031. */
  35032. function downloadTool(url, dest, auth, headers) {
  35033. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35034. dest = dest || path.join(_getTempDirectory(), crypto.randomUUID());
  35035. yield io.mkdirP(path.dirname(dest));
  35036. core.debug(`Downloading ${url}`);
  35037. core.debug(`Destination ${dest}`);
  35038. const maxAttempts = 3;
  35039. const minSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 10);
  35040. const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
  35041. const retryHelper = new RetryHelper(maxAttempts, minSeconds, maxSeconds);
  35042. return yield retryHelper.execute(() => tool_cache_awaiter(this, void 0, void 0, function* () {
  35043. return yield downloadToolAttempt(url, dest || '', auth, headers);
  35044. }), (err) => {
  35045. if (err instanceof HTTPError && err.httpStatusCode) {
  35046. // Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
  35047. if (err.httpStatusCode < 500 &&
  35048. err.httpStatusCode !== 408 &&
  35049. err.httpStatusCode !== 429) {
  35050. return false;
  35051. }
  35052. }
  35053. // Otherwise retry
  35054. return true;
  35055. });
  35056. });
  35057. }
  35058. function downloadToolAttempt(url, dest, auth, headers) {
  35059. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35060. if (fs.existsSync(dest)) {
  35061. throw new Error(`Destination file path ${dest} already exists`);
  35062. }
  35063. // Get the response headers
  35064. const http = new httpm.HttpClient(tool_cache_userAgent, [], {
  35065. allowRetries: false
  35066. });
  35067. if (auth) {
  35068. core.debug('set auth');
  35069. if (headers === undefined) {
  35070. headers = {};
  35071. }
  35072. headers.authorization = auth;
  35073. }
  35074. const response = yield http.get(url, headers);
  35075. if (response.message.statusCode !== 200) {
  35076. const err = new HTTPError(response.message.statusCode);
  35077. core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
  35078. throw err;
  35079. }
  35080. // Download the response body
  35081. const pipeline = util.promisify(stream.pipeline);
  35082. const responseMessageFactory = _getGlobal('TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY', () => response.message);
  35083. const readStream = responseMessageFactory();
  35084. let succeeded = false;
  35085. try {
  35086. yield pipeline(readStream, fs.createWriteStream(dest));
  35087. core.debug('download complete');
  35088. succeeded = true;
  35089. return dest;
  35090. }
  35091. finally {
  35092. // Error, delete dest before retry
  35093. if (!succeeded) {
  35094. core.debug('download failed');
  35095. try {
  35096. yield io.rmRF(dest);
  35097. }
  35098. catch (err) {
  35099. core.debug(`Failed to delete '${dest}'. ${err.message}`);
  35100. }
  35101. }
  35102. }
  35103. });
  35104. }
  35105. /**
  35106. * Extract a .7z file
  35107. *
  35108. * @param file path to the .7z file
  35109. * @param dest destination directory. Optional.
  35110. * @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
  35111. * problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
  35112. * gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
  35113. * bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
  35114. * interface, it is smaller than the full command line interface, and it does support long paths. At the
  35115. * time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
  35116. * Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
  35117. * to 7zr.exe can be pass to this function.
  35118. * @returns path to the destination directory
  35119. */
  35120. function extract7z(file, dest, _7zPath) {
  35121. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35122. ok(tool_cache_IS_WINDOWS, 'extract7z() not supported on current OS');
  35123. ok(file, 'parameter "file" is required');
  35124. dest = yield _createExtractFolder(dest);
  35125. const originalCwd = process.cwd();
  35126. process.chdir(dest);
  35127. if (_7zPath) {
  35128. try {
  35129. const logLevel = core.isDebug() ? '-bb1' : '-bb0';
  35130. const args = [
  35131. 'x', // eXtract files with full paths
  35132. logLevel, // -bb[0-3] : set output log level
  35133. '-bd', // disable progress indicator
  35134. '-sccUTF-8', // set charset for for console input/output
  35135. file
  35136. ];
  35137. const options = {
  35138. silent: true
  35139. };
  35140. yield exec(`"${_7zPath}"`, args, options);
  35141. }
  35142. finally {
  35143. process.chdir(originalCwd);
  35144. }
  35145. }
  35146. else {
  35147. const escapedScript = path
  35148. .join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
  35149. .replace(/'/g, "''")
  35150. .replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
  35151. const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
  35152. const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
  35153. const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
  35154. const args = [
  35155. '-NoLogo',
  35156. '-Sta',
  35157. '-NoProfile',
  35158. '-NonInteractive',
  35159. '-ExecutionPolicy',
  35160. 'Unrestricted',
  35161. '-Command',
  35162. command
  35163. ];
  35164. const options = {
  35165. silent: true
  35166. };
  35167. try {
  35168. const powershellPath = yield io.which('powershell', true);
  35169. yield exec(`"${powershellPath}"`, args, options);
  35170. }
  35171. finally {
  35172. process.chdir(originalCwd);
  35173. }
  35174. }
  35175. return dest;
  35176. });
  35177. }
  35178. /**
  35179. * Extract a compressed tar archive
  35180. *
  35181. * @param file path to the tar
  35182. * @param dest destination directory. Optional.
  35183. * @param flags flags for the tar command to use for extraction. Defaults to 'xz' (extracting gzipped tars). Optional.
  35184. * @returns path to the destination directory
  35185. */
  35186. function extractTar(file_1, dest_1) {
  35187. return tool_cache_awaiter(this, arguments, void 0, function* (file, dest, flags = 'xz') {
  35188. if (!file) {
  35189. throw new Error("parameter 'file' is required");
  35190. }
  35191. // Create dest
  35192. dest = yield _createExtractFolder(dest);
  35193. // Determine whether GNU tar
  35194. core_debug('Checking tar --version');
  35195. let versionOutput = '';
  35196. yield exec_exec('tar --version', [], {
  35197. ignoreReturnCode: true,
  35198. silent: true,
  35199. listeners: {
  35200. stdout: (data) => (versionOutput += data.toString()),
  35201. stderr: (data) => (versionOutput += data.toString())
  35202. }
  35203. });
  35204. core_debug(versionOutput.trim());
  35205. const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR');
  35206. // Initialize args
  35207. let args;
  35208. if (flags instanceof Array) {
  35209. args = flags;
  35210. }
  35211. else {
  35212. args = [flags];
  35213. }
  35214. if (isDebug() && !flags.includes('v')) {
  35215. args.push('-v');
  35216. }
  35217. let destArg = dest;
  35218. let fileArg = file;
  35219. if (tool_cache_IS_WINDOWS && isGnuTar) {
  35220. args.push('--force-local');
  35221. destArg = dest.replace(/\\/g, '/');
  35222. // Technically only the dest needs to have `/` but for aesthetic consistency
  35223. // convert slashes in the file arg too.
  35224. fileArg = file.replace(/\\/g, '/');
  35225. }
  35226. if (isGnuTar) {
  35227. // Suppress warnings when using GNU tar to extract archives created by BSD tar
  35228. args.push('--warning=no-unknown-keyword');
  35229. args.push('--overwrite');
  35230. }
  35231. args.push('-C', destArg, '-f', fileArg);
  35232. yield exec_exec(`tar`, args);
  35233. return dest;
  35234. });
  35235. }
  35236. /**
  35237. * Extract a xar compatible archive
  35238. *
  35239. * @param file path to the archive
  35240. * @param dest destination directory. Optional.
  35241. * @param flags flags for the xar. Optional.
  35242. * @returns path to the destination directory
  35243. */
  35244. function extractXar(file_1, dest_1) {
  35245. return tool_cache_awaiter(this, arguments, void 0, function* (file, dest, flags = []) {
  35246. ok(IS_MAC, 'extractXar() not supported on current OS');
  35247. ok(file, 'parameter "file" is required');
  35248. dest = yield _createExtractFolder(dest);
  35249. let args;
  35250. if (flags instanceof Array) {
  35251. args = flags;
  35252. }
  35253. else {
  35254. args = [flags];
  35255. }
  35256. args.push('-x', '-C', dest, '-f', file);
  35257. if (core.isDebug()) {
  35258. args.push('-v');
  35259. }
  35260. const xarPath = yield io.which('xar', true);
  35261. yield exec(`"${xarPath}"`, _unique(args));
  35262. return dest;
  35263. });
  35264. }
  35265. /**
  35266. * Extract a zip
  35267. *
  35268. * @param file path to the zip
  35269. * @param dest destination directory. Optional.
  35270. * @returns path to the destination directory
  35271. */
  35272. function extractZip(file, dest) {
  35273. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35274. if (!file) {
  35275. throw new Error("parameter 'file' is required");
  35276. }
  35277. dest = yield _createExtractFolder(dest);
  35278. if (tool_cache_IS_WINDOWS) {
  35279. yield extractZipWin(file, dest);
  35280. }
  35281. else {
  35282. yield extractZipNix(file, dest);
  35283. }
  35284. return dest;
  35285. });
  35286. }
  35287. function extractZipWin(file, dest) {
  35288. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35289. // build the powershell command
  35290. const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
  35291. const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
  35292. const pwshPath = yield which('pwsh', false);
  35293. //To match the file overwrite behavior on nix systems, we use the overwrite = true flag for ExtractToDirectory
  35294. //and the -Force flag for Expand-Archive as a fallback
  35295. if (pwshPath) {
  35296. //attempt to use pwsh with ExtractToDirectory, if this fails attempt Expand-Archive
  35297. const pwshCommand = [
  35298. `$ErrorActionPreference = 'Stop' ;`,
  35299. `try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,
  35300. `try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`,
  35301. `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 $_ } } ;`
  35302. ].join(' ');
  35303. const args = [
  35304. '-NoLogo',
  35305. '-NoProfile',
  35306. '-NonInteractive',
  35307. '-ExecutionPolicy',
  35308. 'Unrestricted',
  35309. '-Command',
  35310. pwshCommand
  35311. ];
  35312. core_debug(`Using pwsh at path: ${pwshPath}`);
  35313. yield exec_exec(`"${pwshPath}"`, args);
  35314. }
  35315. else {
  35316. const powershellCommand = [
  35317. `$ErrorActionPreference = 'Stop' ;`,
  35318. `try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,
  35319. `if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`,
  35320. `else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`
  35321. ].join(' ');
  35322. const args = [
  35323. '-NoLogo',
  35324. '-Sta',
  35325. '-NoProfile',
  35326. '-NonInteractive',
  35327. '-ExecutionPolicy',
  35328. 'Unrestricted',
  35329. '-Command',
  35330. powershellCommand
  35331. ];
  35332. const powershellPath = yield which('powershell', true);
  35333. core_debug(`Using powershell at path: ${powershellPath}`);
  35334. yield exec_exec(`"${powershellPath}"`, args);
  35335. }
  35336. });
  35337. }
  35338. function extractZipNix(file, dest) {
  35339. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35340. const unzipPath = yield which('unzip', true);
  35341. const args = [file];
  35342. if (!isDebug()) {
  35343. args.unshift('-q');
  35344. }
  35345. args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
  35346. yield exec_exec(`"${unzipPath}"`, args, { cwd: dest });
  35347. });
  35348. }
  35349. /**
  35350. * Caches a directory and installs it into the tool cacheDir
  35351. *
  35352. * @param sourceDir the directory to cache into tools
  35353. * @param tool tool name
  35354. * @param version version of the tool. semver format
  35355. * @param arch architecture of the tool. Optional. Defaults to machine architecture
  35356. */
  35357. function cacheDir(sourceDir, tool, version, arch) {
  35358. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35359. version = semver.clean(version) || version;
  35360. arch = arch || os.arch();
  35361. core.debug(`Caching tool ${tool} ${version} ${arch}`);
  35362. core.debug(`source dir: ${sourceDir}`);
  35363. if (!fs.statSync(sourceDir).isDirectory()) {
  35364. throw new Error('sourceDir is not a directory');
  35365. }
  35366. // Create the tool dir
  35367. const destPath = yield _createToolPath(tool, version, arch);
  35368. // copy each child item. do not move. move can fail on Windows
  35369. // due to anti-virus software having an open handle on a file.
  35370. for (const itemName of fs.readdirSync(sourceDir)) {
  35371. const s = path.join(sourceDir, itemName);
  35372. yield io.cp(s, destPath, { recursive: true });
  35373. }
  35374. // write .complete
  35375. _completeToolPath(tool, version, arch);
  35376. return destPath;
  35377. });
  35378. }
  35379. /**
  35380. * Caches a downloaded file (GUID) and installs it
  35381. * into the tool cache with a given targetName
  35382. *
  35383. * @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
  35384. * @param targetFile the name of the file name in the tools directory
  35385. * @param tool tool name
  35386. * @param version version of the tool. semver format
  35387. * @param arch architecture of the tool. Optional. Defaults to machine architecture
  35388. */
  35389. function cacheFile(sourceFile, targetFile, tool, version, arch) {
  35390. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35391. version = semver.clean(version) || version;
  35392. arch = arch || os.arch();
  35393. core.debug(`Caching tool ${tool} ${version} ${arch}`);
  35394. core.debug(`source file: ${sourceFile}`);
  35395. if (!fs.statSync(sourceFile).isFile()) {
  35396. throw new Error('sourceFile is not a file');
  35397. }
  35398. // create the tool dir
  35399. const destFolder = yield _createToolPath(tool, version, arch);
  35400. // copy instead of move. move can fail on Windows due to
  35401. // anti-virus software having an open handle on a file.
  35402. const destPath = path.join(destFolder, targetFile);
  35403. core.debug(`destination file ${destPath}`);
  35404. yield io.cp(sourceFile, destPath);
  35405. // write .complete
  35406. _completeToolPath(tool, version, arch);
  35407. return destFolder;
  35408. });
  35409. }
  35410. /**
  35411. * Finds the path to a tool version in the local installed tool cache
  35412. *
  35413. * @param toolName name of the tool
  35414. * @param versionSpec version of the tool
  35415. * @param arch optional arch. defaults to arch of computer
  35416. */
  35417. function find(toolName, versionSpec, arch) {
  35418. if (!toolName) {
  35419. throw new Error('toolName parameter is required');
  35420. }
  35421. if (!versionSpec) {
  35422. throw new Error('versionSpec parameter is required');
  35423. }
  35424. arch = arch || os.arch();
  35425. // attempt to resolve an explicit version
  35426. if (!isExplicitVersion(versionSpec)) {
  35427. const localVersions = findAllVersions(toolName, arch);
  35428. const match = evaluateVersions(localVersions, versionSpec);
  35429. versionSpec = match;
  35430. }
  35431. // check for the explicit version in the cache
  35432. let toolPath = '';
  35433. if (versionSpec) {
  35434. versionSpec = semver.clean(versionSpec) || '';
  35435. const cachePath = path.join(_getCacheDirectory(), toolName, versionSpec, arch);
  35436. core.debug(`checking cache: ${cachePath}`);
  35437. if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
  35438. core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
  35439. toolPath = cachePath;
  35440. }
  35441. else {
  35442. core.debug('not found');
  35443. }
  35444. }
  35445. return toolPath;
  35446. }
  35447. /**
  35448. * Finds the paths to all versions of a tool that are installed in the local tool cache
  35449. *
  35450. * @param toolName name of the tool
  35451. * @param arch optional arch. defaults to arch of computer
  35452. */
  35453. function findAllVersions(toolName, arch) {
  35454. const versions = [];
  35455. arch = arch || os.arch();
  35456. const toolPath = path.join(_getCacheDirectory(), toolName);
  35457. if (fs.existsSync(toolPath)) {
  35458. const children = fs.readdirSync(toolPath);
  35459. for (const child of children) {
  35460. if (isExplicitVersion(child)) {
  35461. const fullPath = path.join(toolPath, child, arch || '');
  35462. if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
  35463. versions.push(child);
  35464. }
  35465. }
  35466. }
  35467. }
  35468. return versions;
  35469. }
  35470. function getManifestFromRepo(owner_1, repo_1, auth_1) {
  35471. return tool_cache_awaiter(this, arguments, void 0, function* (owner, repo, auth, branch = 'master') {
  35472. let releases = [];
  35473. const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`;
  35474. const http = new httpm.HttpClient('tool-cache');
  35475. const headers = {};
  35476. if (auth) {
  35477. core.debug('set auth');
  35478. headers.authorization = auth;
  35479. }
  35480. const response = yield http.getJson(treeUrl, headers);
  35481. if (!response.result) {
  35482. return releases;
  35483. }
  35484. let manifestUrl = '';
  35485. for (const item of response.result.tree) {
  35486. if (item.path === 'versions-manifest.json') {
  35487. manifestUrl = item.url;
  35488. break;
  35489. }
  35490. }
  35491. headers['accept'] = 'application/vnd.github.VERSION.raw';
  35492. let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody();
  35493. if (versionsRaw) {
  35494. // shouldn't be needed but protects against invalid json saved with BOM
  35495. versionsRaw = versionsRaw.replace(/^\uFEFF/, '');
  35496. try {
  35497. releases = JSON.parse(versionsRaw);
  35498. }
  35499. catch (_a) {
  35500. core.debug('Invalid json');
  35501. }
  35502. }
  35503. return releases;
  35504. });
  35505. }
  35506. function findFromManifest(versionSpec_1, stable_1, manifest_1) {
  35507. return tool_cache_awaiter(this, arguments, void 0, function* (versionSpec, stable, manifest, archFilter = os.arch()) {
  35508. // wrap the internal impl
  35509. const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter);
  35510. return match;
  35511. });
  35512. }
  35513. function _createExtractFolder(dest) {
  35514. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35515. if (!dest) {
  35516. // create a temp dir
  35517. dest = external_path_namespaceObject.join(_getTempDirectory(), external_crypto_namespaceObject.randomUUID());
  35518. }
  35519. yield mkdirP(dest);
  35520. return dest;
  35521. });
  35522. }
  35523. function _createToolPath(tool, version, arch) {
  35524. return tool_cache_awaiter(this, void 0, void 0, function* () {
  35525. const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
  35526. core.debug(`destination ${folderPath}`);
  35527. const markerPath = `${folderPath}.complete`;
  35528. yield io.rmRF(folderPath);
  35529. yield io.rmRF(markerPath);
  35530. yield io.mkdirP(folderPath);
  35531. return folderPath;
  35532. });
  35533. }
  35534. function _completeToolPath(tool, version, arch) {
  35535. const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
  35536. const markerPath = `${folderPath}.complete`;
  35537. fs.writeFileSync(markerPath, '');
  35538. core.debug('finished caching tool');
  35539. }
  35540. /**
  35541. * Check if version string is explicit
  35542. *
  35543. * @param versionSpec version string to check
  35544. */
  35545. function isExplicitVersion(versionSpec) {
  35546. const c = semver.clean(versionSpec) || '';
  35547. core.debug(`isExplicit: ${c}`);
  35548. const valid = semver.valid(c) != null;
  35549. core.debug(`explicit? ${valid}`);
  35550. return valid;
  35551. }
  35552. /**
  35553. * Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec`
  35554. *
  35555. * @param versions array of versions to evaluate
  35556. * @param versionSpec semantic version spec to satisfy
  35557. */
  35558. function evaluateVersions(versions, versionSpec) {
  35559. let version = '';
  35560. core.debug(`evaluating ${versions.length} versions`);
  35561. versions = versions.sort((a, b) => {
  35562. if (semver.gt(a, b)) {
  35563. return 1;
  35564. }
  35565. return -1;
  35566. });
  35567. for (let i = versions.length - 1; i >= 0; i--) {
  35568. const potential = versions[i];
  35569. const satisfied = semver.satisfies(potential, versionSpec);
  35570. if (satisfied) {
  35571. version = potential;
  35572. break;
  35573. }
  35574. }
  35575. if (version) {
  35576. core.debug(`matched: ${version}`);
  35577. }
  35578. else {
  35579. core.debug('match not found');
  35580. }
  35581. return version;
  35582. }
  35583. /**
  35584. * Gets RUNNER_TOOL_CACHE
  35585. */
  35586. function _getCacheDirectory() {
  35587. const cacheDirectory = process.env['RUNNER_TOOL_CACHE'] || '';
  35588. ok(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
  35589. return cacheDirectory;
  35590. }
  35591. /**
  35592. * Gets RUNNER_TEMP
  35593. */
  35594. function _getTempDirectory() {
  35595. const tempDirectory = process.env['RUNNER_TEMP'] || '';
  35596. (0,external_assert_.ok)(tempDirectory, 'Expected RUNNER_TEMP to be defined');
  35597. return tempDirectory;
  35598. }
  35599. /**
  35600. * Gets a global variable
  35601. */
  35602. function _getGlobal(key, defaultValue) {
  35603. /* eslint-disable @typescript-eslint/no-explicit-any */
  35604. const value = global[key];
  35605. /* eslint-enable @typescript-eslint/no-explicit-any */
  35606. return value !== undefined ? value : defaultValue;
  35607. }
  35608. /**
  35609. * Returns an array of unique values.
  35610. * @param values Values to make unique.
  35611. */
  35612. function _unique(values) {
  35613. return Array.from(new Set(values));
  35614. }
  35615. //# sourceMappingURL=tool-cache.js.map
  35616. ;// CONCATENATED MODULE: ./src/github-api-helper.ts
  35617. const github_api_helper_IS_WINDOWS = process.platform === 'win32';
  35618. async function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath, baseUrl) {
  35619. // Determine the default branch
  35620. if (!ref && !commit) {
  35621. info('Determining the default branch');
  35622. ref = await getDefaultBranch(authToken, owner, repo, baseUrl);
  35623. }
  35624. // Download the archive
  35625. let archiveData = await execute(async () => {
  35626. info('Downloading the archive');
  35627. return await downloadArchive(authToken, owner, repo, ref, commit, baseUrl);
  35628. });
  35629. // Write archive to disk
  35630. info('Writing archive to disk');
  35631. const uniqueId = (0,external_crypto_namespaceObject.randomUUID)();
  35632. const archivePath = github_api_helper_IS_WINDOWS
  35633. ? external_path_namespaceObject.join(repositoryPath, `${uniqueId}.zip`)
  35634. : external_path_namespaceObject.join(repositoryPath, `${uniqueId}.tar.gz`);
  35635. await external_fs_namespaceObject.promises.writeFile(archivePath, archiveData);
  35636. archiveData = Buffer.from(''); // Free memory
  35637. // Extract archive
  35638. info('Extracting the archive');
  35639. const extractPath = external_path_namespaceObject.join(repositoryPath, uniqueId);
  35640. await mkdirP(extractPath);
  35641. if (github_api_helper_IS_WINDOWS) {
  35642. await extractZip(archivePath, extractPath);
  35643. }
  35644. else {
  35645. await extractTar(archivePath, extractPath);
  35646. }
  35647. await rmRF(archivePath);
  35648. // Determine the path of the repository content. The archive contains
  35649. // a top-level folder and the repository content is inside.
  35650. const archiveFileNames = await external_fs_namespaceObject.promises.readdir(extractPath);
  35651. external_assert_.ok(archiveFileNames.length == 1, 'Expected exactly one directory inside archive');
  35652. const archiveVersion = archiveFileNames[0]; // The top-level folder name includes the short SHA
  35653. info(`Resolved version ${archiveVersion}`);
  35654. const tempRepositoryPath = external_path_namespaceObject.join(extractPath, archiveVersion);
  35655. // Move the files
  35656. for (const fileName of await external_fs_namespaceObject.promises.readdir(tempRepositoryPath)) {
  35657. const sourcePath = external_path_namespaceObject.join(tempRepositoryPath, fileName);
  35658. const targetPath = external_path_namespaceObject.join(repositoryPath, fileName);
  35659. if (github_api_helper_IS_WINDOWS) {
  35660. await io_cp(sourcePath, targetPath, { recursive: true }); // Copy on Windows (Windows Defender may have a lock)
  35661. }
  35662. else {
  35663. await mv(sourcePath, targetPath);
  35664. }
  35665. }
  35666. await rmRF(extractPath);
  35667. }
  35668. /**
  35669. * Looks up the default branch name
  35670. */
  35671. async function getDefaultBranch(authToken, owner, repo, baseUrl) {
  35672. return await execute(async () => {
  35673. info('Retrieving the default branch name');
  35674. const octokit = getOctokit(authToken, {
  35675. baseUrl: getServerApiUrl(baseUrl)
  35676. });
  35677. let result;
  35678. try {
  35679. // Get the default branch from the repo info
  35680. const response = await octokit.rest.repos.get({ owner, repo });
  35681. result = response.data.default_branch;
  35682. external_assert_.ok(result, 'default_branch cannot be empty');
  35683. }
  35684. catch (err) {
  35685. // Handle .wiki repo
  35686. if (err?.status === 404 &&
  35687. repo.toUpperCase().endsWith('.WIKI')) {
  35688. result = 'master';
  35689. }
  35690. // Otherwise error
  35691. else {
  35692. throw err;
  35693. }
  35694. }
  35695. // Print the default branch
  35696. info(`Default branch '${result}'`);
  35697. // Prefix with 'refs/heads'
  35698. if (!result.startsWith('refs/')) {
  35699. result = `refs/heads/${result}`;
  35700. }
  35701. return result;
  35702. });
  35703. }
  35704. async function tryGetRepositoryObjectFormat(authToken, owner, repo, baseUrl, commit) {
  35705. const commitFormat = getObjectFormat(commit);
  35706. if (commitFormat) {
  35707. return { format: commitFormat, succeeded: true };
  35708. }
  35709. try {
  35710. const octokit = getOctokit(authToken, {
  35711. baseUrl: getServerApiUrl(baseUrl)
  35712. });
  35713. const response = await octokit.request('GET /repos/{owner}/{repo}/hash-algorithm', { owner, repo });
  35714. const hashAlgorithm = response.data.hash_algorithm;
  35715. if (hashAlgorithm === 'sha256' || hashAlgorithm === 'sha1') {
  35716. return { format: hashAlgorithm, succeeded: true };
  35717. }
  35718. core_debug('Unable to determine repository object format from hash-algorithm endpoint');
  35719. return { format: '', succeeded: false };
  35720. }
  35721. catch (err) {
  35722. core_debug(`Unable to determine repository object format from hash-algorithm endpoint: ${err?.message ?? err}`);
  35723. return { format: '', succeeded: false };
  35724. }
  35725. }
  35726. function getObjectFormat(sha) {
  35727. if (/^[0-9a-fA-F]{64}$/.test(sha || '')) {
  35728. return 'sha256';
  35729. }
  35730. if (/^[0-9a-fA-F]{40}$/.test(sha || '')) {
  35731. return 'sha1';
  35732. }
  35733. return '';
  35734. }
  35735. async function downloadArchive(authToken, owner, repo, ref, commit, baseUrl) {
  35736. const octokit = getOctokit(authToken, {
  35737. baseUrl: getServerApiUrl(baseUrl)
  35738. });
  35739. const download = github_api_helper_IS_WINDOWS
  35740. ? octokit.rest.repos.downloadZipballArchive
  35741. : octokit.rest.repos.downloadTarballArchive;
  35742. const response = await download({
  35743. owner: owner,
  35744. repo: repo,
  35745. ref: commit || ref
  35746. });
  35747. return Buffer.from(response.data); // response.data is ArrayBuffer
  35748. }
  35749. ;// CONCATENATED MODULE: ./src/ref-helper.ts
  35750. const tagsRefSpec = '+refs/tags/*:refs/tags/*';
  35751. async function getCheckoutInfo(git, ref, commit) {
  35752. if (!git) {
  35753. throw new Error('Arg git cannot be empty');
  35754. }
  35755. if (!ref && !commit) {
  35756. throw new Error('Args ref and commit cannot both be empty');
  35757. }
  35758. const result = {};
  35759. const upperRef = (ref || '').toUpperCase();
  35760. // SHA only
  35761. if (!ref) {
  35762. result.ref = commit;
  35763. }
  35764. // refs/heads/
  35765. else if (upperRef.startsWith('REFS/HEADS/')) {
  35766. const branch = ref.substring('refs/heads/'.length);
  35767. result.ref = branch;
  35768. result.startPoint = `refs/remotes/origin/${branch}`;
  35769. }
  35770. // refs/pull/
  35771. else if (upperRef.startsWith('REFS/PULL/')) {
  35772. const branch = ref.substring('refs/pull/'.length);
  35773. result.ref = `refs/remotes/pull/${branch}`;
  35774. }
  35775. // refs/tags/
  35776. else if (upperRef.startsWith('REFS/TAGS/')) {
  35777. result.ref = ref;
  35778. }
  35779. // refs/
  35780. else if (upperRef.startsWith('REFS/')) {
  35781. result.ref = commit ? commit : ref;
  35782. }
  35783. // Unqualified ref, check for a matching branch or tag
  35784. else {
  35785. if (await git.branchExists(true, `origin/${ref}`)) {
  35786. result.ref = ref;
  35787. result.startPoint = `refs/remotes/origin/${ref}`;
  35788. }
  35789. else if (await git.tagExists(`${ref}`)) {
  35790. result.ref = `refs/tags/${ref}`;
  35791. }
  35792. else {
  35793. throw new Error(`A branch or tag with the name '${ref}' could not be found`);
  35794. }
  35795. }
  35796. return result;
  35797. }
  35798. function getRefSpecForAllHistory(ref, commit) {
  35799. const result = ['+refs/heads/*:refs/remotes/origin/*', tagsRefSpec];
  35800. if (ref && ref.toUpperCase().startsWith('REFS/PULL/')) {
  35801. const branch = ref.substring('refs/pull/'.length);
  35802. result.push(`+${commit || ref}:refs/remotes/pull/${branch}`);
  35803. }
  35804. return result;
  35805. }
  35806. function getRefSpec(ref, commit, fetchTags) {
  35807. if (!ref && !commit) {
  35808. throw new Error('Args ref and commit cannot both be empty');
  35809. }
  35810. const upperRef = (ref || '').toUpperCase();
  35811. const result = [];
  35812. // When fetchTags is true, always include the tags refspec
  35813. if (fetchTags) {
  35814. result.push(tagsRefSpec);
  35815. }
  35816. // SHA
  35817. if (commit) {
  35818. // refs/heads
  35819. if (upperRef.startsWith('REFS/HEADS/')) {
  35820. const branch = ref.substring('refs/heads/'.length);
  35821. result.push(`+${commit}:refs/remotes/origin/${branch}`);
  35822. }
  35823. // refs/pull/
  35824. else if (upperRef.startsWith('REFS/PULL/')) {
  35825. const branch = ref.substring('refs/pull/'.length);
  35826. result.push(`+${commit}:refs/remotes/pull/${branch}`);
  35827. }
  35828. // refs/tags/
  35829. else if (upperRef.startsWith('REFS/TAGS/')) {
  35830. if (!fetchTags) {
  35831. result.push(`+${ref}:${ref}`);
  35832. }
  35833. }
  35834. // Otherwise no destination ref
  35835. else {
  35836. result.push(commit);
  35837. }
  35838. }
  35839. // Unqualified ref, check for a matching branch or tag
  35840. else if (!upperRef.startsWith('REFS/')) {
  35841. result.push(`+refs/heads/${ref}*:refs/remotes/origin/${ref}*`);
  35842. if (!fetchTags) {
  35843. result.push(`+refs/tags/${ref}*:refs/tags/${ref}*`);
  35844. }
  35845. }
  35846. // refs/heads/
  35847. else if (upperRef.startsWith('REFS/HEADS/')) {
  35848. const branch = ref.substring('refs/heads/'.length);
  35849. result.push(`+${ref}:refs/remotes/origin/${branch}`);
  35850. }
  35851. // refs/pull/
  35852. else if (upperRef.startsWith('REFS/PULL/')) {
  35853. const branch = ref.substring('refs/pull/'.length);
  35854. result.push(`+${ref}:refs/remotes/pull/${branch}`);
  35855. }
  35856. // refs/tags/
  35857. else if (upperRef.startsWith('REFS/TAGS/')) {
  35858. if (!fetchTags) {
  35859. result.push(`+${ref}:${ref}`);
  35860. }
  35861. }
  35862. // Other refs
  35863. else {
  35864. result.push(`+${ref}:${ref}`);
  35865. }
  35866. return result;
  35867. }
  35868. /**
  35869. * Tests whether the initial fetch created the ref at the expected commit
  35870. */
  35871. async function testRef(git, ref, commit) {
  35872. if (!git) {
  35873. throw new Error('Arg git cannot be empty');
  35874. }
  35875. if (!ref && !commit) {
  35876. throw new Error('Args ref and commit cannot both be empty');
  35877. }
  35878. // No SHA? Nothing to test
  35879. if (!commit) {
  35880. return true;
  35881. }
  35882. // SHA only?
  35883. else if (!ref) {
  35884. return await git.shaExists(commit);
  35885. }
  35886. const upperRef = ref.toUpperCase();
  35887. // refs/heads/
  35888. if (upperRef.startsWith('REFS/HEADS/')) {
  35889. const branch = ref.substring('refs/heads/'.length);
  35890. return ((await git.branchExists(true, `origin/${branch}`)) &&
  35891. commit === (await git.revParse(`refs/remotes/origin/${branch}`)));
  35892. }
  35893. // refs/pull/
  35894. else if (upperRef.startsWith('REFS/PULL/')) {
  35895. // Assume matches because fetched using the commit
  35896. return true;
  35897. }
  35898. // refs/tags/
  35899. else if (upperRef.startsWith('REFS/TAGS/')) {
  35900. const tagName = ref.substring('refs/tags/'.length);
  35901. // Use ^{commit} to dereference annotated tags to their underlying commit
  35902. return ((await git.tagExists(tagName)) &&
  35903. commit === (await git.revParse(`${ref}^{commit}`)));
  35904. }
  35905. // Unexpected
  35906. else {
  35907. core_debug(`Unexpected ref format '${ref}' when testing ref info`);
  35908. return true;
  35909. }
  35910. }
  35911. async function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref, commit, baseUrl) {
  35912. try {
  35913. // GHES?
  35914. if (isGhes(baseUrl)) {
  35915. return;
  35916. }
  35917. // Auth token?
  35918. if (!token) {
  35919. return;
  35920. }
  35921. // Public PR synchronize, for workflow repo?
  35922. if (fromPayload('repository.private') !== false ||
  35923. github_context.eventName !== 'pull_request' ||
  35924. fromPayload('action') !== 'synchronize' ||
  35925. repositoryOwner !== github_context.repo.owner ||
  35926. repositoryName !== github_context.repo.repo ||
  35927. ref !== github_context.ref ||
  35928. !ref.startsWith('refs/pull/') ||
  35929. commit !== github_context.sha) {
  35930. return;
  35931. }
  35932. // Head SHA
  35933. const expectedHeadSha = fromPayload('after');
  35934. if (!expectedHeadSha) {
  35935. core_debug('Unable to determine head sha');
  35936. return;
  35937. }
  35938. // Base SHA
  35939. const expectedBaseSha = fromPayload('pull_request.base.sha');
  35940. if (!expectedBaseSha) {
  35941. core_debug('Unable to determine base sha');
  35942. return;
  35943. }
  35944. // Expected message?
  35945. const expectedMessage = `Merge ${expectedHeadSha} into ${expectedBaseSha}`;
  35946. if (commitInfo.indexOf(expectedMessage) >= 0) {
  35947. return;
  35948. }
  35949. // Extract details from message
  35950. const match = commitInfo.match(/Merge ([0-9a-f]{40}|[0-9a-f]{64}) into ([0-9a-f]{40}|[0-9a-f]{64})/);
  35951. if (!match) {
  35952. core_debug('Unexpected message format');
  35953. return;
  35954. }
  35955. // Post telemetry
  35956. const actualHeadSha = match[1];
  35957. if (actualHeadSha !== expectedHeadSha) {
  35958. core_debug(`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`);
  35959. const octokit = getOctokit(token, {
  35960. baseUrl: getServerApiUrl(baseUrl),
  35961. 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})`
  35962. });
  35963. await octokit.rest.repos.get({
  35964. owner: repositoryOwner,
  35965. repo: repositoryName
  35966. });
  35967. }
  35968. }
  35969. catch (err) {
  35970. core_debug(`Error when validating commit info: ${err?.stack ?? err}`);
  35971. }
  35972. }
  35973. function fromPayload(path) {
  35974. return ref_helper_select(github_context.payload, path);
  35975. }
  35976. function ref_helper_select(obj, path) {
  35977. if (!obj) {
  35978. return undefined;
  35979. }
  35980. const i = path.indexOf('.');
  35981. if (i < 0) {
  35982. return obj[path];
  35983. }
  35984. const key = path.substr(0, i);
  35985. return ref_helper_select(obj[key], path.substr(i + 1));
  35986. }
  35987. ;// CONCATENATED MODULE: ./src/git-source-provider.ts
  35988. async function getSource(settings) {
  35989. // Repository URL
  35990. info(`Syncing repository: ${settings.repositoryOwner}/${settings.repositoryName}`);
  35991. const repositoryUrl = getFetchUrl(settings);
  35992. // Remove conflicting file path
  35993. if (fileExistsSync(settings.repositoryPath)) {
  35994. await rmRF(settings.repositoryPath);
  35995. }
  35996. // Create directory
  35997. let isExisting = true;
  35998. if (!directoryExistsSync(settings.repositoryPath)) {
  35999. isExisting = false;
  36000. await mkdirP(settings.repositoryPath);
  36001. }
  36002. // Git command manager
  36003. startGroup('Getting Git version info');
  36004. const git = await getGitCommandManager(settings);
  36005. endGroup();
  36006. let authHelper = null;
  36007. try {
  36008. if (git) {
  36009. authHelper = createAuthHelper(git, settings);
  36010. if (settings.setSafeDirectory) {
  36011. // 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
  36012. // Otherwise all git commands we run in a container fail
  36013. await authHelper.configureTempGlobalConfig();
  36014. info(`Adding repository directory to the temporary git global config as a safe directory`);
  36015. await git
  36016. .config('safe.directory', settings.repositoryPath, true, true)
  36017. .catch(error => {
  36018. info(`Failed to initialize safe directory with error: ${error}`);
  36019. });
  36020. setSafeDirectory();
  36021. }
  36022. }
  36023. // Prepare existing directory, otherwise recreate
  36024. if (isExisting) {
  36025. await prepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean, settings.ref);
  36026. }
  36027. if (!git) {
  36028. // Downloading using REST API
  36029. info(`The repository will be downloaded using the GitHub REST API`);
  36030. info(`To create a local Git repository instead, add Git ${MinimumGitVersion} or higher to the PATH`);
  36031. if (settings.submodules) {
  36032. 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.`);
  36033. }
  36034. else if (settings.sshKey) {
  36035. 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.`);
  36036. }
  36037. await downloadRepository(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.repositoryPath, settings.githubServerUrl);
  36038. return;
  36039. }
  36040. // Save state for POST action
  36041. setRepositoryPath(settings.repositoryPath);
  36042. // Initialize the repository
  36043. if (!directoryExistsSync(external_path_namespaceObject.join(settings.repositoryPath, '.git'))) {
  36044. startGroup('Determining repository object format');
  36045. const objectFormatResult = await tryGetRepositoryObjectFormat(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.githubServerUrl, settings.commit);
  36046. const objectFormat = objectFormatResult.succeeded
  36047. ? objectFormatResult.format
  36048. : '';
  36049. if (objectFormat === 'sha256') {
  36050. info('Detected SHA-256 repository object format');
  36051. }
  36052. endGroup();
  36053. startGroup('Initializing the repository');
  36054. await git.init(objectFormat);
  36055. await git.remoteAdd('origin', repositoryUrl);
  36056. endGroup();
  36057. }
  36058. // Disable automatic garbage collection
  36059. startGroup('Disabling automatic garbage collection');
  36060. if (!(await git.tryDisableAutomaticGarbageCollection())) {
  36061. warning(`Unable to turn off git automatic garbage collection. The git fetch operation may trigger garbage collection and cause a delay.`);
  36062. }
  36063. endGroup();
  36064. // If we didn't initialize it above, do it now
  36065. if (!authHelper) {
  36066. authHelper = createAuthHelper(git, settings);
  36067. }
  36068. // Configure auth
  36069. startGroup('Setting up auth');
  36070. await authHelper.configureAuth();
  36071. endGroup();
  36072. // Determine the default branch
  36073. if (!settings.ref && !settings.commit) {
  36074. startGroup('Determining the default branch');
  36075. if (settings.sshKey) {
  36076. settings.ref = await git.getDefaultBranch(repositoryUrl);
  36077. }
  36078. else {
  36079. settings.ref = await getDefaultBranch(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.githubServerUrl);
  36080. }
  36081. endGroup();
  36082. }
  36083. // LFS install
  36084. if (settings.lfs) {
  36085. await git.lfsInstall();
  36086. }
  36087. // Fetch
  36088. startGroup('Fetching the repository');
  36089. const fetchOptions = {};
  36090. if (settings.filter) {
  36091. fetchOptions.filter = settings.filter;
  36092. }
  36093. else if (settings.sparseCheckout) {
  36094. fetchOptions.filter = 'blob:none';
  36095. }
  36096. if (settings.fetchDepth <= 0) {
  36097. // Fetch all branches and tags
  36098. let refSpec = getRefSpecForAllHistory(settings.ref, settings.commit);
  36099. await git.fetch(refSpec, fetchOptions);
  36100. // When all history is fetched, the ref we're interested in may have moved to a different
  36101. // commit (push or force push). If so, fetch again with a targeted refspec.
  36102. if (!(await testRef(git, settings.ref, settings.commit))) {
  36103. refSpec = getRefSpec(settings.ref, settings.commit);
  36104. await git.fetch(refSpec, fetchOptions);
  36105. // Verify the ref now matches. For branches, the targeted fetch above brings
  36106. // in the specific commit. For tags (fetched by ref), this will fail if
  36107. // the tag was moved after the workflow was triggered.
  36108. if (!(await testRef(git, settings.ref, settings.commit))) {
  36109. throw new Error(`The ref '${settings.ref}' does not point to the expected commit '${settings.commit}'. ` +
  36110. `The ref may have been updated after the workflow was triggered.`);
  36111. }
  36112. }
  36113. }
  36114. else {
  36115. fetchOptions.fetchDepth = settings.fetchDepth;
  36116. const refSpec = getRefSpec(settings.ref, settings.commit, settings.fetchTags);
  36117. await git.fetch(refSpec, fetchOptions);
  36118. // For tags, verify the ref still points to the expected commit.
  36119. // Tags are fetched by ref (not commit), so if a tag was moved after the
  36120. // workflow was triggered, we would silently check out the wrong commit.
  36121. if (!(await testRef(git, settings.ref, settings.commit))) {
  36122. throw new Error(`The ref '${settings.ref}' does not point to the expected commit '${settings.commit}'. ` +
  36123. `The ref may have been updated after the workflow was triggered.`);
  36124. }
  36125. }
  36126. endGroup();
  36127. // Checkout info
  36128. startGroup('Determining the checkout info');
  36129. const checkoutInfo = await getCheckoutInfo(git, settings.ref, settings.commit);
  36130. endGroup();
  36131. // LFS fetch
  36132. // Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time).
  36133. // Explicit lfs fetch will fetch lfs objects in parallel.
  36134. // For sparse checkouts, let `checkout` fetch the needed objects lazily.
  36135. if (settings.lfs && !settings.sparseCheckout) {
  36136. startGroup('Fetching LFS objects');
  36137. await git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref);
  36138. endGroup();
  36139. }
  36140. // Sparse checkout
  36141. if (!settings.sparseCheckout) {
  36142. let gitVersion = await git.version();
  36143. // no need to disable sparse-checkout if the installed git runtime doesn't even support it.
  36144. if (gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
  36145. await git.disableSparseCheckout();
  36146. }
  36147. }
  36148. else {
  36149. startGroup('Setting up sparse checkout');
  36150. if (settings.sparseCheckoutConeMode) {
  36151. await git.sparseCheckout(settings.sparseCheckout);
  36152. }
  36153. else {
  36154. await git.sparseCheckoutNonConeMode(settings.sparseCheckout);
  36155. }
  36156. endGroup();
  36157. }
  36158. // Checkout
  36159. startGroup('Checking out the ref');
  36160. await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint);
  36161. endGroup();
  36162. // Submodules
  36163. if (settings.submodules) {
  36164. // Temporarily override global config
  36165. startGroup('Setting up auth for fetching submodules');
  36166. await authHelper.configureGlobalAuth();
  36167. endGroup();
  36168. // Checkout submodules
  36169. startGroup('Fetching submodules');
  36170. await git.submoduleSync(settings.nestedSubmodules);
  36171. await git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules);
  36172. await git.submoduleForeach('git config --local gc.auto 0', settings.nestedSubmodules);
  36173. endGroup();
  36174. // Persist credentials
  36175. if (settings.persistCredentials) {
  36176. startGroup('Persisting credentials for submodules');
  36177. await authHelper.configureSubmoduleAuth();
  36178. endGroup();
  36179. }
  36180. }
  36181. // Get commit information
  36182. const commitInfo = await git.log1();
  36183. // Log commit sha
  36184. const commitSHA = await git.log1('--format=%H');
  36185. setOutput('commit', commitSHA.trim());
  36186. // Check for incorrect pull request merge commit
  36187. await checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.githubServerUrl);
  36188. }
  36189. finally {
  36190. // Remove auth
  36191. if (authHelper) {
  36192. if (!settings.persistCredentials) {
  36193. startGroup('Removing auth');
  36194. await authHelper.removeAuth();
  36195. endGroup();
  36196. }
  36197. authHelper.removeGlobalConfig();
  36198. }
  36199. }
  36200. }
  36201. async function cleanup(repositoryPath) {
  36202. // Repo exists?
  36203. if (!repositoryPath ||
  36204. !fileExistsSync(external_path_namespaceObject.join(repositoryPath, '.git', 'config'))) {
  36205. return;
  36206. }
  36207. let git;
  36208. try {
  36209. git = await createCommandManager(repositoryPath, false, false);
  36210. }
  36211. catch {
  36212. return;
  36213. }
  36214. // Remove auth
  36215. const authHelper = createAuthHelper(git);
  36216. try {
  36217. if (PostSetSafeDirectory) {
  36218. // 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
  36219. // Otherwise all git commands we run in a container fail
  36220. await authHelper.configureTempGlobalConfig();
  36221. info(`Adding repository directory to the temporary git global config as a safe directory`);
  36222. await git
  36223. .config('safe.directory', repositoryPath, true, true)
  36224. .catch(error => {
  36225. info(`Failed to initialize safe directory with error: ${error}`);
  36226. });
  36227. }
  36228. await authHelper.removeAuth();
  36229. }
  36230. finally {
  36231. await authHelper.removeGlobalConfig();
  36232. }
  36233. }
  36234. async function getGitCommandManager(settings) {
  36235. info(`Working directory is '${settings.repositoryPath}'`);
  36236. try {
  36237. return await createCommandManager(settings.repositoryPath, settings.lfs, settings.sparseCheckout != null);
  36238. }
  36239. catch (err) {
  36240. // Git is required for LFS
  36241. if (settings.lfs) {
  36242. throw err;
  36243. }
  36244. // Otherwise fallback to REST API
  36245. return undefined;
  36246. }
  36247. }
  36248. ;// CONCATENATED MODULE: ./src/unsafe-pr-checkout-helper.ts
  36249. const PR_REF_PATTERN = /^refs\/pull\/[0-9]+\/(?:head|merge)$/;
  36250. function assertSafePrCheckout(input) {
  36251. if (input.allowUnsafePrCheckout) {
  36252. return;
  36253. }
  36254. const eventName = github_context.eventName;
  36255. if (eventName !== 'pull_request_target' && eventName !== 'workflow_run') {
  36256. return;
  36257. }
  36258. const baseRepoId = fromPayload('repository.id');
  36259. if (typeof baseRepoId !== 'number') {
  36260. return;
  36261. }
  36262. let prHeadRepoId;
  36263. let prHeadRepoFullName;
  36264. const prShas = [];
  36265. if (eventName === 'pull_request_target') {
  36266. prHeadRepoId = fromPayload('pull_request.head.repo.id');
  36267. prHeadRepoFullName = fromPayload('pull_request.head.repo.full_name');
  36268. pushIfSha(prShas, fromPayload('pull_request.head.sha'));
  36269. pushIfSha(prShas, fromPayload('pull_request.merge_commit_sha'));
  36270. }
  36271. else {
  36272. const wrEvent = fromPayload('workflow_run.event');
  36273. if (typeof wrEvent !== 'string' || !wrEvent.startsWith('pull_request')) {
  36274. return;
  36275. }
  36276. prHeadRepoId = fromPayload('workflow_run.head_repository.id');
  36277. prHeadRepoFullName = fromPayload('workflow_run.head_repository.full_name');
  36278. pushIfSha(prShas, fromPayload('workflow_run.head_commit.id'));
  36279. // For `pull_request_target`-triggered workflow_run, `head_sha` is the base
  36280. // default branch SHA (not the PR head)
  36281. if (wrEvent !== 'pull_request_target') {
  36282. pushIfSha(prShas, fromPayload('workflow_run.head_sha'));
  36283. }
  36284. }
  36285. // (A) Fork PR?
  36286. if (typeof prHeadRepoId !== 'number' || prHeadRepoId === baseRepoId) {
  36287. return;
  36288. }
  36289. // (B) We cannot check for all fork PR refs so check to see
  36290. // if the resolved input points to the fork PR sha we have in the payload
  36291. const repositoryMatchesPrHead = typeof prHeadRepoFullName === 'string' &&
  36292. input.qualifiedRepository.toLowerCase() === prHeadRepoFullName.toLowerCase();
  36293. const refMatchesPullPattern = PR_REF_PATTERN.test(input.ref);
  36294. const commitMatchesPrHeadSha = !!input.commit && prShas.includes(input.commit.toLowerCase());
  36295. if (!repositoryMatchesPrHead &&
  36296. !refMatchesPullPattern &&
  36297. !commitMatchesPrHeadSha) {
  36298. return;
  36299. }
  36300. throw new Error(`Refusing to check out fork pull request code from a '${eventName}' workflow. ` +
  36301. `This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch ` +
  36302. `cache scope, and runner access. Fetching and executing a fork's code in that trusted ` +
  36303. `context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks ` +
  36304. `at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' ` +
  36305. `on the actions/checkout step.`);
  36306. }
  36307. function pushIfSha(target, value) {
  36308. if (typeof value === 'string' && value.length > 0) {
  36309. target.push(value.toLowerCase());
  36310. }
  36311. }
  36312. ;// CONCATENATED MODULE: ./src/workflow-context-helper.ts
  36313. /**
  36314. * Gets the organization ID of the running workflow or undefined if the value cannot be loaded from the GITHUB_EVENT_PATH
  36315. */
  36316. async function getOrganizationId() {
  36317. try {
  36318. const eventPath = process.env.GITHUB_EVENT_PATH;
  36319. if (!eventPath) {
  36320. core_debug(`GITHUB_EVENT_PATH is not defined`);
  36321. return;
  36322. }
  36323. const content = await external_fs_namespaceObject.promises.readFile(eventPath, { encoding: 'utf8' });
  36324. const event = JSON.parse(content);
  36325. const id = event?.repository?.owner?.id;
  36326. if (typeof id !== 'number') {
  36327. core_debug('Repository owner ID not found within GITHUB event info');
  36328. return;
  36329. }
  36330. return id;
  36331. }
  36332. catch (err) {
  36333. core_debug(`Unable to load organization ID from GITHUB_EVENT_PATH: ${err.message || err}`);
  36334. }
  36335. }
  36336. ;// CONCATENATED MODULE: ./src/input-helper.ts
  36337. async function getInputs() {
  36338. const result = {};
  36339. // GitHub workspace
  36340. let githubWorkspacePath = process.env['GITHUB_WORKSPACE'];
  36341. if (!githubWorkspacePath) {
  36342. throw new Error('GITHUB_WORKSPACE not defined');
  36343. }
  36344. githubWorkspacePath = external_path_namespaceObject.resolve(githubWorkspacePath);
  36345. core_debug(`GITHUB_WORKSPACE = '${githubWorkspacePath}'`);
  36346. directoryExistsSync(githubWorkspacePath, true);
  36347. // Qualified repository
  36348. const qualifiedRepository = getInput('repository') ||
  36349. `${github_context.repo.owner}/${github_context.repo.repo}`;
  36350. core_debug(`qualified repository = '${qualifiedRepository}'`);
  36351. const splitRepository = qualifiedRepository.split('/');
  36352. if (splitRepository.length !== 2 ||
  36353. !splitRepository[0] ||
  36354. !splitRepository[1]) {
  36355. throw new Error(`Invalid repository '${qualifiedRepository}'. Expected format {owner}/{repo}.`);
  36356. }
  36357. result.repositoryOwner = splitRepository[0];
  36358. result.repositoryName = splitRepository[1];
  36359. // Repository path
  36360. result.repositoryPath = getInput('path') || '.';
  36361. result.repositoryPath = external_path_namespaceObject.resolve(githubWorkspacePath, result.repositoryPath);
  36362. if (!(result.repositoryPath + external_path_namespaceObject.sep).startsWith(githubWorkspacePath + external_path_namespaceObject.sep)) {
  36363. throw new Error(`Repository path '${result.repositoryPath}' is not under '${githubWorkspacePath}'`);
  36364. }
  36365. // Workflow repository?
  36366. const isWorkflowRepository = qualifiedRepository.toUpperCase() ===
  36367. `${github_context.repo.owner}/${github_context.repo.repo}`.toUpperCase();
  36368. // Source branch, source version
  36369. result.ref = getInput('ref');
  36370. if (!result.ref) {
  36371. if (isWorkflowRepository) {
  36372. result.ref = github_context.ref;
  36373. result.commit = github_context.sha;
  36374. // Some events have an unqualifed ref. For example when a PR is merged (pull_request closed event),
  36375. // the ref is unqualifed like "main" instead of "refs/heads/main".
  36376. if (result.commit && result.ref && !result.ref.startsWith('refs/')) {
  36377. result.ref = `refs/heads/${result.ref}`;
  36378. }
  36379. }
  36380. }
  36381. // SHA?
  36382. else if (result.ref.match(/^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/)) {
  36383. result.commit = result.ref;
  36384. result.ref = '';
  36385. }
  36386. core_debug(`ref = '${result.ref}'`);
  36387. core_debug(`commit = '${result.commit}'`);
  36388. // Clean
  36389. result.clean = (getInput('clean') || 'true').toUpperCase() === 'TRUE';
  36390. core_debug(`clean = ${result.clean}`);
  36391. // Filter
  36392. const filter = getInput('filter');
  36393. if (filter) {
  36394. result.filter = filter;
  36395. }
  36396. core_debug(`filter = ${result.filter}`);
  36397. // Sparse checkout
  36398. const sparseCheckout = getMultilineInput('sparse-checkout');
  36399. if (sparseCheckout.length) {
  36400. result.sparseCheckout = sparseCheckout;
  36401. core_debug(`sparse checkout = ${result.sparseCheckout}`);
  36402. }
  36403. result.sparseCheckoutConeMode =
  36404. (getInput('sparse-checkout-cone-mode') || 'true').toUpperCase() ===
  36405. 'TRUE';
  36406. // Fetch depth
  36407. result.fetchDepth = Math.floor(Number(getInput('fetch-depth') || '1'));
  36408. if (isNaN(result.fetchDepth) || result.fetchDepth < 0) {
  36409. result.fetchDepth = 0;
  36410. }
  36411. core_debug(`fetch depth = ${result.fetchDepth}`);
  36412. // Fetch tags
  36413. result.fetchTags =
  36414. (getInput('fetch-tags') || 'false').toUpperCase() === 'TRUE';
  36415. core_debug(`fetch tags = ${result.fetchTags}`);
  36416. // Show fetch progress
  36417. result.showProgress =
  36418. (getInput('show-progress') || 'true').toUpperCase() === 'TRUE';
  36419. core_debug(`show progress = ${result.showProgress}`);
  36420. // LFS
  36421. result.lfs = (getInput('lfs') || 'false').toUpperCase() === 'TRUE';
  36422. core_debug(`lfs = ${result.lfs}`);
  36423. // Submodules
  36424. result.submodules = false;
  36425. result.nestedSubmodules = false;
  36426. const submodulesString = (getInput('submodules') || '').toUpperCase();
  36427. if (submodulesString == 'RECURSIVE') {
  36428. result.submodules = true;
  36429. result.nestedSubmodules = true;
  36430. }
  36431. else if (submodulesString == 'TRUE') {
  36432. result.submodules = true;
  36433. }
  36434. core_debug(`submodules = ${result.submodules}`);
  36435. core_debug(`recursive submodules = ${result.nestedSubmodules}`);
  36436. // Auth token
  36437. result.authToken = getInput('token', { required: true });
  36438. // SSH
  36439. result.sshKey = getInput('ssh-key');
  36440. result.sshKnownHosts = getInput('ssh-known-hosts');
  36441. result.sshStrict =
  36442. (getInput('ssh-strict') || 'true').toUpperCase() === 'TRUE';
  36443. result.sshUser = getInput('ssh-user');
  36444. // Persist credentials
  36445. result.persistCredentials =
  36446. (getInput('persist-credentials') || 'false').toUpperCase() === 'TRUE';
  36447. // Workflow organization ID
  36448. result.workflowOrganizationId =
  36449. await getOrganizationId();
  36450. // Set safe.directory in git global config.
  36451. result.setSafeDirectory =
  36452. (getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE';
  36453. // Determine the GitHub URL that the repository is being hosted from
  36454. result.githubServerUrl = getInput('github-server-url');
  36455. core_debug(`GitHub Host URL = ${result.githubServerUrl}`);
  36456. // Allow unsafe PR checkout (opt-in for pull_request_target / workflow_run fork PRs)
  36457. result.allowUnsafePrCheckout =
  36458. (getInput('allow-unsafe-pr-checkout') || 'false').toUpperCase() ===
  36459. 'TRUE';
  36460. core_debug(`allow unsafe PR checkout = ${result.allowUnsafePrCheckout}`);
  36461. assertSafePrCheckout({
  36462. qualifiedRepository,
  36463. ref: result.ref,
  36464. commit: result.commit,
  36465. allowUnsafePrCheckout: result.allowUnsafePrCheckout
  36466. });
  36467. return result;
  36468. }
  36469. ;// CONCATENATED MODULE: ./src/main.ts
  36470. const main_dirname = external_path_namespaceObject.dirname((0,external_url_namespaceObject.fileURLToPath)(import.meta.url));
  36471. async function run() {
  36472. try {
  36473. const sourceSettings = await getInputs();
  36474. try {
  36475. // Register problem matcher
  36476. info(`::add-matcher::${external_path_namespaceObject.join(main_dirname, 'problem-matcher.json')}`);
  36477. // Get sources
  36478. await getSource(sourceSettings);
  36479. setOutput('ref', sourceSettings.ref);
  36480. }
  36481. finally {
  36482. // Unregister problem matcher
  36483. info('::remove-matcher owner=checkout-git::');
  36484. }
  36485. }
  36486. catch (error) {
  36487. setFailed(`${error?.message ?? error}`);
  36488. }
  36489. }
  36490. async function main_cleanup() {
  36491. try {
  36492. await cleanup(RepositoryPath);
  36493. }
  36494. catch (error) {
  36495. warning(`${error?.message ?? error}`);
  36496. }
  36497. }
  36498. // Main
  36499. if (!IsPost) {
  36500. run();
  36501. }
  36502. // Post
  36503. else {
  36504. main_cleanup();
  36505. }