setup-cpp
Version:
Install all the tools required for building and testing C++/C projects.
7 lines • 346 kB
JavaScript
"use strict";const ye=require("../setup-cpp.js"),zg=require("url"),Ar=require("events"),we=require("assert"),DQ=require("net"),fi=require("http"),Xe=require("stream"),at=require("buffer"),Qe=require("util"),Kg=require("querystring"),jg=require("worker_threads"),$g=require("perf_hooks"),AB=require("tls");function eB(A,e){for(var r=0;r<e.length;r++){const Q=e[r];if(typeof Q!="string"&&!Array.isArray(Q)){for(const t in Q)if(t!=="default"&&!(t in A)){const E=Object.getOwnPropertyDescriptor(Q,t);E&&Object.defineProperty(A,t,E.get?E:{enumerable:!0,get:()=>Q[t]})}}}return Object.freeze(Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}))}var sr,iE;function vA(){return iE||(iE=1,sr={kClose:Symbol("close"),kDestroy:Symbol("destroy"),kDispatch:Symbol("dispatch"),kUrl:Symbol("url"),kWriting:Symbol("writing"),kResuming:Symbol("resuming"),kQueue:Symbol("queue"),kConnect:Symbol("connect"),kConnecting:Symbol("connecting"),kHeadersList:Symbol("headers list"),kKeepAliveDefaultTimeout:Symbol("default keep alive timeout"),kKeepAliveMaxTimeout:Symbol("max keep alive timeout"),kKeepAliveTimeoutThreshold:Symbol("keep alive timeout threshold"),kKeepAliveTimeoutValue:Symbol("keep alive timeout"),kKeepAlive:Symbol("keep alive"),kHeadersTimeout:Symbol("headers timeout"),kBodyTimeout:Symbol("body timeout"),kServerName:Symbol("server name"),kLocalAddress:Symbol("local address"),kHost:Symbol("host"),kNoRef:Symbol("no ref"),kBodyUsed:Symbol("used"),kRunning:Symbol("running"),kBlocking:Symbol("blocking"),kPending:Symbol("pending"),kSize:Symbol("size"),kBusy:Symbol("busy"),kQueued:Symbol("queued"),kFree:Symbol("free"),kConnected:Symbol("connected"),kClosed:Symbol("closed"),kNeedDrain:Symbol("need drain"),kReset:Symbol("reset"),kDestroyed:Symbol.for("nodejs.stream.destroyed"),kMaxHeadersSize:Symbol("max headers size"),kRunningIdx:Symbol("running index"),kPendingIdx:Symbol("pending index"),kError:Symbol("error"),kClients:Symbol("clients"),kClient:Symbol("client"),kParser:Symbol("parser"),kOnDestroyed:Symbol("destroy callbacks"),kPipelining:Symbol("pipelining"),kSocket:Symbol("socket"),kHostHeader:Symbol("host header"),kConnector:Symbol("connector"),kStrictContentLength:Symbol("strict content length"),kMaxRedirections:Symbol("maxRedirections"),kMaxRequests:Symbol("maxRequestsPerClient"),kProxy:Symbol("proxy agent options"),kCounter:Symbol("socket request counter"),kInterceptors:Symbol("dispatch interceptors"),kMaxResponseSize:Symbol("max response size"),kHTTP2Session:Symbol("http2Session"),kHTTP2SessionState:Symbol("http2Session state"),kHTTP2BuildRequest:Symbol("http2 build request"),kHTTP1BuildRequest:Symbol("http1 build request"),kHTTP2CopyHeaders:Symbol("http2 copy headers"),kHTTPConnVersion:Symbol("http connection version"),kRetryHandlerDefaultRetry:Symbol("retry agent default retry"),kConstruct:Symbol("constructable")}),sr}var ar,gE;function se(){if(gE)return ar;gE=1;class A extends Error{constructor(n){super(n),this.name="UndiciError",this.code="UND_ERR"}}class e extends A{constructor(n){super(n),Error.captureStackTrace(this,e),this.name="ConnectTimeoutError",this.message=n||"Connect Timeout Error",this.code="UND_ERR_CONNECT_TIMEOUT"}}class r extends A{constructor(n){super(n),Error.captureStackTrace(this,r),this.name="HeadersTimeoutError",this.message=n||"Headers Timeout Error",this.code="UND_ERR_HEADERS_TIMEOUT"}}class Q extends A{constructor(n){super(n),Error.captureStackTrace(this,Q),this.name="HeadersOverflowError",this.message=n||"Headers Overflow Error",this.code="UND_ERR_HEADERS_OVERFLOW"}}class t extends A{constructor(n){super(n),Error.captureStackTrace(this,t),this.name="BodyTimeoutError",this.message=n||"Body Timeout Error",this.code="UND_ERR_BODY_TIMEOUT"}}class E extends A{constructor(n,N,b,y){super(n),Error.captureStackTrace(this,E),this.name="ResponseStatusCodeError",this.message=n||"Response Status Code Error",this.code="UND_ERR_RESPONSE_STATUS_CODE",this.body=y,this.status=N,this.statusCode=N,this.headers=b}}class i extends A{constructor(n){super(n),Error.captureStackTrace(this,i),this.name="InvalidArgumentError",this.message=n||"Invalid Argument Error",this.code="UND_ERR_INVALID_ARG"}}class B extends A{constructor(n){super(n),Error.captureStackTrace(this,B),this.name="InvalidReturnValueError",this.message=n||"Invalid Return Value Error",this.code="UND_ERR_INVALID_RETURN_VALUE"}}class g extends A{constructor(n){super(n),Error.captureStackTrace(this,g),this.name="AbortError",this.message=n||"Request aborted",this.code="UND_ERR_ABORTED"}}class c extends A{constructor(n){super(n),Error.captureStackTrace(this,c),this.name="InformationalError",this.message=n||"Request information",this.code="UND_ERR_INFO"}}class o extends A{constructor(n){super(n),Error.captureStackTrace(this,o),this.name="RequestContentLengthMismatchError",this.message=n||"Request body length does not match content-length header",this.code="UND_ERR_REQ_CONTENT_LENGTH_MISMATCH"}}class h extends A{constructor(n){super(n),Error.captureStackTrace(this,h),this.name="ResponseContentLengthMismatchError",this.message=n||"Response body length does not match content-length header",this.code="UND_ERR_RES_CONTENT_LENGTH_MISMATCH"}}class I extends A{constructor(n){super(n),Error.captureStackTrace(this,I),this.name="ClientDestroyedError",this.message=n||"The client is destroyed",this.code="UND_ERR_DESTROYED"}}class R extends A{constructor(n){super(n),Error.captureStackTrace(this,R),this.name="ClientClosedError",this.message=n||"The client is closed",this.code="UND_ERR_CLOSED"}}class f extends A{constructor(n,N){super(n),Error.captureStackTrace(this,f),this.name="SocketError",this.message=n||"Socket error",this.code="UND_ERR_SOCKET",this.socket=N}}class C extends A{constructor(n){super(n),Error.captureStackTrace(this,C),this.name="NotSupportedError",this.message=n||"Not supported error",this.code="UND_ERR_NOT_SUPPORTED"}}class d extends A{constructor(n){super(n),Error.captureStackTrace(this,C),this.name="MissingUpstreamError",this.message=n||"No upstream has been added to the BalancedPool",this.code="UND_ERR_BPL_MISSING_UPSTREAM"}}class D extends Error{constructor(n,N,b){super(n),Error.captureStackTrace(this,D),this.name="HTTPParserError",this.code=N?`HPE_${N}`:void 0,this.data=b?b.toString():void 0}}class w extends A{constructor(n){super(n),Error.captureStackTrace(this,w),this.name="ResponseExceededMaxSizeError",this.message=n||"Response content exceeded max size",this.code="UND_ERR_RES_EXCEEDED_MAX_SIZE"}}class S extends A{constructor(n,N,{headers:b,data:y}){super(n),Error.captureStackTrace(this,S),this.name="RequestRetryError",this.message=n||"Request retry error",this.code="UND_ERR_REQ_RETRY",this.statusCode=N,this.data=y,this.headers=b}}return ar={HTTPParserError:D,UndiciError:A,HeadersTimeoutError:r,HeadersOverflowError:Q,BodyTimeoutError:t,RequestContentLengthMismatchError:o,ConnectTimeoutError:e,ResponseStatusCodeError:E,InvalidArgumentError:i,InvalidReturnValueError:B,RequestAbortedError:g,ClientDestroyedError:I,ClientClosedError:R,InformationalError:c,SocketError:f,NotSupportedError:C,ResponseContentLengthMismatchError:h,BalancedPoolMissingUpstreamError:d,ResponseExceededMaxSizeError:w,RequestRetryError:S},ar}var hr,BE;function tB(){if(BE)return hr;BE=1;const A=Ar;class e extends A{dispatch(){throw new Error("not implemented")}close(){throw new Error("not implemented")}destroy(){throw new Error("not implemented")}}return hr=e,hr}var cr,oE;function er(){if(oE)return cr;oE=1;const A=tB(),{ClientDestroyedError:e,ClientClosedError:r,InvalidArgumentError:Q}=se(),{kDestroy:t,kClose:E,kDispatch:i,kInterceptors:B}=vA(),g=Symbol("destroyed"),c=Symbol("closed"),o=Symbol("onDestroyed"),h=Symbol("onClosed"),I=Symbol("Intercepted Dispatch");class R extends A{constructor(){super(),this[g]=!1,this[o]=null,this[c]=!1,this[h]=[]}get destroyed(){return this[g]}get closed(){return this[c]}get interceptors(){return this[B]}set interceptors(C){if(C){for(let d=C.length-1;d>=0;d--)if(typeof this[B][d]!="function")throw new Q("interceptor must be an function")}this[B]=C}close(C){if(C===void 0)return new Promise((D,w)=>{this.close((S,m)=>S?w(S):D(m))});if(typeof C!="function")throw new Q("invalid callback");if(this[g]){queueMicrotask(()=>C(new e,null));return}if(this[c]){this[h]?this[h].push(C):queueMicrotask(()=>C(null,null));return}this[c]=!0,this[h].push(C);const d=()=>{const D=this[h];this[h]=null;for(let w=0;w<D.length;w++)D[w](null,null)};this[E]().then(()=>this.destroy()).then(()=>{queueMicrotask(d)})}destroy(C,d){if(typeof C=="function"&&(d=C,C=null),d===void 0)return new Promise((w,S)=>{this.destroy(C,(m,n)=>m?S(m):w(n))});if(typeof d!="function")throw new Q("invalid callback");if(this[g]){this[o]?this[o].push(d):queueMicrotask(()=>d(null,null));return}C||(C=new e),this[g]=!0,this[o]=this[o]||[],this[o].push(d);const D=()=>{const w=this[o];this[o]=null;for(let S=0;S<w.length;S++)w[S](null,null)};this[t](C).then(()=>{queueMicrotask(D)})}[I](C,d){if(!this[B]||this[B].length===0)return this[I]=this[i],this[i](C,d);let D=this[i].bind(this);for(let w=this[B].length-1;w>=0;w--)D=this[B][w](D);return this[I]=D,D(C,d)}dispatch(C,d){if(!d||typeof d!="object")throw new Q("handler must be an object");try{if(!C||typeof C!="object")throw new Q("opts must be an object.");if(this[g]||this[o])throw new e;if(this[c])throw new r;return this[I](C,d)}catch(D){if(typeof d.onError!="function")throw new Q("invalid onError method");return d.onError(D),!1}}}return cr=R,cr}var lr,nE;function rB(){if(nE)return lr;nE=1;const A=2048,e=A-1;class r{constructor(){this.bottom=0,this.top=0,this.list=new Array(A),this.next=null}isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&e)===this.bottom}push(t){this.list[this.top]=t,this.top=this.top+1&e}shift(){const t=this.list[this.bottom];return t===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&e,t)}}return lr=class{constructor(){this.head=this.tail=new r}isEmpty(){return this.head.isEmpty()}push(t){this.head.isFull()&&(this.head=this.head.next=new r),this.head.push(t)}shift(){const t=this.tail,E=t.shift();return t.isEmpty()&&t.next!==null&&(this.tail=t.next),E}},lr}var ur,CE;function QB(){if(CE)return ur;CE=1;const{kFree:A,kConnected:e,kPending:r,kQueued:Q,kRunning:t,kSize:E}=vA(),i=Symbol("pool");class B{constructor(c){this[i]=c}get connected(){return this[i][e]}get free(){return this[i][A]}get pending(){return this[i][r]}get queued(){return this[i][Q]}get running(){return this[i][t]}get size(){return this[i][E]}}return ur=B,ur}var fr,IE;function EB(){if(IE)return fr;IE=1;const A=er(),e=rB(),{kConnected:r,kSize:Q,kRunning:t,kPending:E,kQueued:i,kBusy:B,kFree:g,kUrl:c,kClose:o,kDestroy:h,kDispatch:I}=vA(),R=QB(),f=Symbol("clients"),C=Symbol("needDrain"),d=Symbol("queue"),D=Symbol("closed resolve"),w=Symbol("onDrain"),S=Symbol("onConnect"),m=Symbol("onDisconnect"),n=Symbol("onConnectionError"),N=Symbol("get dispatcher"),b=Symbol("add client"),y=Symbol("remove client"),p=Symbol("stats");class Y extends A{constructor(){super(),this[d]=new e,this[f]=[],this[i]=0;const U=this;this[w]=function(V,eA){const CA=U[d];let tA=!1;for(;!tA;){const X=CA.shift();if(!X)break;U[i]--,tA=!this.dispatch(X.opts,X.handler)}this[C]=tA,!this[C]&&U[C]&&(U[C]=!1,U.emit("drain",V,[U,...eA])),U[D]&&CA.isEmpty()&&Promise.all(U[f].map(X=>X.close())).then(U[D])},this[S]=(T,V)=>{U.emit("connect",T,[U,...V])},this[m]=(T,V,eA)=>{U.emit("disconnect",T,[U,...V],eA)},this[n]=(T,V,eA)=>{U.emit("connectionError",T,[U,...V],eA)},this[p]=new R(this)}get[B](){return this[C]}get[r](){return this[f].filter(U=>U[r]).length}get[g](){return this[f].filter(U=>U[r]&&!U[C]).length}get[E](){let U=this[i];for(const{[E]:T}of this[f])U+=T;return U}get[t](){let U=0;for(const{[t]:T}of this[f])U+=T;return U}get[Q](){let U=this[i];for(const{[Q]:T}of this[f])U+=T;return U}get stats(){return this[p]}async[o](){return this[d].isEmpty()?Promise.all(this[f].map(U=>U.close())):new Promise(U=>{this[D]=U})}async[h](U){for(;;){const T=this[d].shift();if(!T)break;T.handler.onError(U)}return Promise.all(this[f].map(T=>T.destroy(U)))}[I](U,T){const V=this[N]();return V?V.dispatch(U,T)||(V[C]=!0,this[C]=!this[N]()):(this[C]=!0,this[d].push({opts:U,handler:T}),this[i]++),!this[C]}[b](U){return U.on("drain",this[w]).on("connect",this[S]).on("disconnect",this[m]).on("connectionError",this[n]),this[f].push(U),this[C]&&process.nextTick(()=>{this[C]&&this[w](U[c],[this,U])}),this}[y](U){U.close(()=>{const T=this[f].indexOf(U);T!==-1&&this[f].splice(T,1)}),this[C]=this[f].some(T=>!T[C]&&T.closed!==!0&&T.destroyed!==!0)}}return fr={PoolBase:Y,kClients:f,kNeedDrain:C,kAddClient:b,kRemoveClient:y,kGetDispatcher:N},fr}var dr,sE;function iB(){if(sE)return dr;sE=1;const A={},e=["Accept","Accept-Encoding","Accept-Language","Accept-Ranges","Access-Control-Allow-Credentials","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Allow-Origin","Access-Control-Expose-Headers","Access-Control-Max-Age","Access-Control-Request-Headers","Access-Control-Request-Method","Age","Allow","Alt-Svc","Alt-Used","Authorization","Cache-Control","Clear-Site-Data","Connection","Content-Disposition","Content-Encoding","Content-Language","Content-Length","Content-Location","Content-Range","Content-Security-Policy","Content-Security-Policy-Report-Only","Content-Type","Cookie","Cross-Origin-Embedder-Policy","Cross-Origin-Opener-Policy","Cross-Origin-Resource-Policy","Date","Device-Memory","Downlink","ECT","ETag","Expect","Expect-CT","Expires","Forwarded","From","Host","If-Match","If-Modified-Since","If-None-Match","If-Range","If-Unmodified-Since","Keep-Alive","Last-Modified","Link","Location","Max-Forwards","Origin","Permissions-Policy","Pragma","Proxy-Authenticate","Proxy-Authorization","RTT","Range","Referer","Referrer-Policy","Refresh","Retry-After","Sec-WebSocket-Accept","Sec-WebSocket-Extensions","Sec-WebSocket-Key","Sec-WebSocket-Protocol","Sec-WebSocket-Version","Server","Server-Timing","Service-Worker-Allowed","Service-Worker-Navigation-Preload","Set-Cookie","SourceMap","Strict-Transport-Security","Supports-Loading-Mode","TE","Timing-Allow-Origin","Trailer","Transfer-Encoding","Upgrade","Upgrade-Insecure-Requests","User-Agent","Vary","Via","WWW-Authenticate","X-Content-Type-Options","X-DNS-Prefetch-Control","X-Frame-Options","X-Permitted-Cross-Domain-Policies","X-Powered-By","X-Requested-With","X-XSS-Protection"];for(let r=0;r<e.length;++r){const Q=e[r],t=Q.toLowerCase();A[Q]=A[t]=t}return Object.setPrototypeOf(A,null),dr={wellknownHeaderNames:e,headerNameLowerCasedRecord:A},dr}/**
* @license
* web-streams-polyfill v4.1.0
* Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
* This code is released under the MIT license.
* SPDX-License-Identifier: MIT
*/function Bt(){}function FA(A){return typeof A=="object"&&A!==null||typeof A=="function"}const di=Bt;function hA(A,e){try{Object.defineProperty(A,"name",{value:e,configurable:!0})}catch{}}const RQ=Promise,gB=Promise.resolve.bind(RQ),BB=Promise.prototype.then,oB=Promise.reject.bind(RQ),nB=gB;function bA(A){return new RQ(A)}function cA(A){return bA(e=>e(A))}function O(A){return oB(A)}function Ae(A,e,r){return BB.call(A,e,r)}function VA(A,e,r){Ae(Ae(A,e,r),void 0,di)}function Dr(A,e){VA(A,e)}function IQ(A,e){VA(A,void 0,e)}function Ce(A,e,r){return Ae(A,e,r)}function ze(A){Ae(A,void 0,di)}let Le=A=>{if(typeof queueMicrotask=="function")Le=queueMicrotask;else{const e=cA(void 0);Le=r=>Ae(e,r)}return Le(A)};function Ye(A,e,r){if(typeof A!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(A,e,r)}function ae(A,e,r){try{return cA(Ye(A,e,r))}catch(Q){return O(Q)}}class qA{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const r=this._back;let Q=r;r._elements.length===16383&&(Q={_elements:[],_next:void 0}),r._elements.push(e),Q!==r&&(this._back=Q,r._next=Q),++this._size}shift(){const e=this._front;let r=e;const Q=this._cursor;let t=Q+1;const E=e._elements,i=E[Q];return t===16384&&(r=e._next,t=0),--this._size,this._cursor=t,e!==r&&(this._front=r),E[Q]=void 0,i}forEach(e){let r=this._cursor,Q=this._front,t=Q._elements;for(;!(r===t.length&&Q._next===void 0||r===t.length&&(Q=Q._next,t=Q._elements,r=0,t.length===0));)e(t[r]),++r}peek(){const e=this._front,r=this._cursor;return e._elements[r]}}const Di=Symbol("[[AbortSteps]]"),Ri=Symbol("[[ErrorSteps]]"),yQ=Symbol("[[CancelSteps]]"),wQ=Symbol("[[PullSteps]]"),FQ=Symbol("[[ReleaseSteps]]");function yi(A,e){A._ownerReadableStream=e,e._reader=A,e._state==="readable"?sQ(A):e._state==="closed"?function(r){sQ(r),Fi(r)}(A):wi(A,e._storedError)}function NQ(A,e){return ZA(A._ownerReadableStream,e)}function ne(A){const e=A._ownerReadableStream;e._state==="readable"?SQ(A,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(r,Q){wi(r,Q)}(A,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._readableStreamController[FQ](),e._reader=void 0,A._ownerReadableStream=void 0}function Wt(A){return new TypeError("Cannot "+A+" a stream using a released reader")}function sQ(A){A._closedPromise=bA((e,r)=>{A._closedPromise_resolve=e,A._closedPromise_reject=r})}function wi(A,e){sQ(A),SQ(A,e)}function SQ(A,e){A._closedPromise_reject!==void 0&&(ze(A._closedPromise),A._closedPromise_reject(e),A._closedPromise_resolve=void 0,A._closedPromise_reject=void 0)}function Fi(A){A._closedPromise_resolve!==void 0&&(A._closedPromise_resolve(void 0),A._closedPromise_resolve=void 0,A._closedPromise_reject=void 0)}const aE=Number.isFinite||function(A){return typeof A=="number"&&isFinite(A)},CB=Math.trunc||function(A){return A<0?Math.ceil(A):Math.floor(A)};function ee(A,e){if(A!==void 0&&typeof(r=A)!="object"&&typeof r!="function")throw new TypeError(`${e} is not an object.`);var r}function PA(A,e){if(typeof A!="function")throw new TypeError(`${e} is not a function.`)}function Ni(A,e){if(!function(r){return typeof r=="object"&&r!==null||typeof r=="function"}(A))throw new TypeError(`${e} is not an object.`)}function Ie(A,e,r){if(A===void 0)throw new TypeError(`Parameter ${e} is required in '${r}'.`)}function aQ(A,e,r){if(A===void 0)throw new TypeError(`${e} is required in '${r}'.`)}function bQ(A){return Number(A)}function hE(A){return A===0?0:A}function kQ(A,e){const r=Number.MAX_SAFE_INTEGER;let Q=Number(A);if(Q=hE(Q),!aE(Q))throw new TypeError(`${e} is not a finite number`);if(Q=function(t){return hE(CB(t))}(Q),Q<0||Q>r)throw new TypeError(`${e} is outside the accepted range of 0 to ${r}, inclusive`);return aE(Q)&&Q!==0?Q:0}function UQ(A,e){if(!ce(A))throw new TypeError(`${e} is not a ReadableStream.`)}function We(A){return new le(A)}function Si(A,e){A._reader._readRequests.push(e)}function pQ(A,e,r){const Q=A._reader._readRequests.shift();r?Q._closeSteps():Q._chunkSteps(e)}function tr(A){return A._reader._readRequests.length}function bi(A){const e=A._reader;return e!==void 0&&!!De(e)}class le{constructor(e){if(Ie(e,1,"ReadableStreamDefaultReader"),UQ(e,"First parameter"),Re(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");yi(this,e),this._readRequests=new qA}get closed(){return De(this)?this._closedPromise:O(bt("closed"))}cancel(e=void 0){return De(this)?this._ownerReadableStream===void 0?O(Wt("cancel")):NQ(this,e):O(bt("cancel"))}read(){if(!De(this))return O(bt("read"));if(this._ownerReadableStream===void 0)return O(Wt("read from"));let e,r;const Q=bA((t,E)=>{e=t,r=E});return ot(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:t=>r(t)}),Q}releaseLock(){if(!De(this))throw bt("releaseLock");this._ownerReadableStream!==void 0&&function(e){ne(e);const r=new TypeError("Reader was released");ki(e,r)}(this)}}function De(A){return!!FA(A)&&!!Object.prototype.hasOwnProperty.call(A,"_readRequests")&&A instanceof le}function ot(A,e){const r=A._ownerReadableStream;r._disturbed=!0,r._state==="closed"?e._closeSteps():r._state==="errored"?e._errorSteps(r._storedError):r._readableStreamController[wQ](e)}function ki(A,e){const r=A._readRequests;A._readRequests=new qA,r.forEach(Q=>{Q._errorSteps(e)})}function bt(A){return new TypeError(`ReadableStreamDefaultReader.prototype.${A} can only be used on a ReadableStreamDefaultReader`)}var Rr,yr,wr;function Qt(A){return A.slice()}function Ui(A,e,r,Q,t){new Uint8Array(A).set(new Uint8Array(r,Q,t),e)}Object.defineProperties(le.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),hA(le.prototype.cancel,"cancel"),hA(le.prototype.read,"read"),hA(le.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(le.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let Me=A=>(Me=typeof A.transfer=="function"?e=>e.transfer():typeof structuredClone=="function"?e=>structuredClone(e,{transfer:[e]}):e=>e,Me(A)),Je=A=>(Je=typeof A.detached=="boolean"?e=>e.detached:e=>e.byteLength===0,Je(A));function pi(A,e,r){if(A.slice)return A.slice(e,r);const Q=r-e,t=new ArrayBuffer(Q);return Ui(t,0,A,e,Q),t}function Et(A,e){const r=A[e];if(r!=null){if(typeof r!="function")throw new TypeError(`${String(e)} is not a function`);return r}}function cE(A){try{const e=A.done,r=A.value;return Ae(nB(r),Q=>({done:e,value:Q}))}catch(e){return O(e)}}const ht=(wr=(Rr=Symbol.asyncIterator)!==null&&Rr!==void 0?Rr:(yr=Symbol.for)===null||yr===void 0?void 0:yr.call(Symbol,"Symbol.asyncIterator"))!==null&&wr!==void 0?wr:"@@asyncIterator";function mi(A,e="sync",r){if(r===void 0)if(e==="async"){if((r=Et(A,ht))===void 0)return function(t){const E={next(){let i;try{i=Li(t)}catch(B){return O(B)}return cE(i)},return(i){let B;try{const g=Et(t.iterator,"return");if(g===void 0)return cA({done:!0,value:i});B=Ye(g,t.iterator,[i])}catch(g){return O(g)}return FA(B)?cE(B):O(new TypeError("The iterator.return() method must return an object"))}};return{iterator:E,nextMethod:E.next,done:!1}}(mi(A,"sync",Et(A,Symbol.iterator)))}else r=Et(A,Symbol.iterator);if(r===void 0)throw new TypeError("The object is not iterable");const Q=Ye(r,A,[]);if(!FA(Q))throw new TypeError("The iterator method must return an object");return{iterator:Q,nextMethod:Q.next,done:!1}}function Li(A){const e=Ye(A.nextMethod,A.iterator,[]);if(!FA(e))throw new TypeError("The iterator.next() method must return an object");return e}class Yi{constructor(e,r){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=r}next(){const e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?Ce(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const r=()=>this._returnSteps(e);return this._ongoingPromise=this._ongoingPromise?Ce(this._ongoingPromise,r,r):r(),this._ongoingPromise}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;let r,Q;const t=bA((E,i)=>{r=E,Q=i});return ot(e,{_chunkSteps:E=>{this._ongoingPromise=void 0,Le(()=>r({value:E,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,ne(e),r({value:void 0,done:!0})},_errorSteps:E=>{this._ongoingPromise=void 0,this._isFinished=!0,ne(e),Q(E)}}),t}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const r=this._reader;if(!this._preventCancel){const Q=NQ(r,e);return ne(r),Ce(Q,()=>({value:e,done:!0}))}return ne(r),cA({value:e,done:!0})}}const Mi={next(){return lE(this)?this._asyncIteratorImpl.next():O(uE("next"))},return(A){return lE(this)?this._asyncIteratorImpl.return(A):O(uE("return"))},[ht](){return this}};function lE(A){if(!FA(A)||!Object.prototype.hasOwnProperty.call(A,"_asyncIteratorImpl"))return!1;try{return A._asyncIteratorImpl instanceof Yi}catch{return!1}}function uE(A){return new TypeError(`ReadableStreamAsyncIterator.${A} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(Mi,ht,{enumerable:!1});const Ji=Number.isNaN||function(A){return A!=A};function fE(A){const e=pi(A.buffer,A.byteOffset,A.byteOffset+A.byteLength);return new Uint8Array(e)}function hQ(A){const e=A._queue.shift();return A._queueTotalSize-=e.size,A._queueTotalSize<0&&(A._queueTotalSize=0),e.value}function mQ(A,e,r){if(typeof(Q=r)!="number"||Ji(Q)||Q<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var Q;A._queue.push({value:e,size:r}),A._queueTotalSize+=r}function Fe(A){A._queue=new qA,A._queueTotalSize=0}function Gi(A){return A===DataView}class pe{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Fr(this))throw Nr("view");return this._view}respond(e){if(!Fr(this))throw Nr("respond");if(Ie(e,1,"respond"),e=kQ(e,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(Je(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Ht(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!Fr(this))throw Nr("respondWithNewView");if(Ie(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(Je(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");Vt(this._associatedReadableByteStreamController,e)}}Object.defineProperties(pe.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),hA(pe.prototype.respond,"respond"),hA(pe.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(pe.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Be{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Ue(this))throw tt("byobRequest");return lQ(this)}get desiredSize(){if(!Ue(this))throw tt("desiredSize");return Zi(this)}close(){if(!Ue(this))throw tt("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if(e!=="readable")throw new TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);it(this)}enqueue(e){if(!Ue(this))throw tt("enqueue");if(Ie(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(e.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(e.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const r=this._controlledReadableByteStream._state;if(r!=="readable")throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`);Tt(this,e)}error(e=void 0){if(!Ue(this))throw tt("error");WA(this,e)}[yQ](e){Ti(this),Fe(this);const r=this._cancelAlgorithm(e);return rr(this),r}[wQ](e){const r=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Oi(this,e);const Q=this._autoAllocateChunkSize;if(Q!==void 0){let t;try{t=new ArrayBuffer(Q)}catch(i){return void e._errorSteps(i)}const E={buffer:t,bufferByteLength:Q,byteOffset:0,byteLength:Q,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(E)}Si(r,e),Te(this)}[FQ](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new qA,this._pendingPullIntos.push(e)}}}function Ue(A){return!!FA(A)&&!!Object.prototype.hasOwnProperty.call(A,"_controlledReadableByteStream")&&A instanceof Be}function Fr(A){return!!FA(A)&&!!Object.prototype.hasOwnProperty.call(A,"_associatedReadableByteStreamController")&&A instanceof pe}function Te(A){if(function(r){const Q=r._controlledReadableByteStream;return Q._state!=="readable"||r._closeRequested||!r._started?!1:!!(bi(Q)&&tr(Q)>0||YQ(Q)&&Ki(Q)>0||Zi(r)>0)}(A)){if(A._pulling)return void(A._pullAgain=!0);A._pulling=!0,VA(A._pullAlgorithm(),()=>(A._pulling=!1,A._pullAgain&&(A._pullAgain=!1,Te(A)),null),r=>(WA(A,r),null))}}function Ti(A){LQ(A),A._pendingPullIntos=new qA}function Hi(A,e){let r=!1;A._state==="closed"&&(r=!0);const Q=Vi(e);e.readerType==="default"?pQ(A,Q,r):function(t,E,i){const B=t._reader,g=B._readIntoRequests.shift();i?g._closeSteps(E):g._chunkSteps(E)}(A,Q,r)}function Jt(A,e){for(let r=0;r<e.length;++r)Hi(A,e[r])}function Vi(A){const e=A.bytesFilled,r=A.elementSize;return new A.viewConstructor(A.buffer,A.byteOffset,e/r)}function Gt(A,e,r,Q){A._queue.push({buffer:e,byteOffset:r,byteLength:Q}),A._queueTotalSize+=Q}function xi(A,e,r,Q){let t;try{t=pi(e,r,r+Q)}catch(E){throw WA(A,E),E}Gt(A,t,0,Q)}function _i(A,e){e.bytesFilled>0&&xi(A,e.buffer,e.byteOffset,e.bytesFilled),ve(A)}function Wi(A,e){const r=Math.min(A._queueTotalSize,e.byteLength-e.bytesFilled),Q=e.bytesFilled+r;let t=r,E=!1;const i=Q-Q%e.elementSize;i>=e.minimumFill&&(t=i-e.bytesFilled,E=!0);const B=A._queue;for(;t>0;){const g=B.peek(),c=Math.min(t,g.byteLength),o=e.byteOffset+e.bytesFilled;Ui(e.buffer,o,g.buffer,g.byteOffset,c),g.byteLength===c?B.shift():(g.byteOffset+=c,g.byteLength-=c),A._queueTotalSize-=c,vi(A,c,e),t-=c}return E}function vi(A,e,r){r.bytesFilled+=e}function qi(A){A._queueTotalSize===0&&A._closeRequested?(rr(A),ct(A._controlledReadableByteStream)):Te(A)}function LQ(A){A._byobRequest!==null&&(A._byobRequest._associatedReadableByteStreamController=void 0,A._byobRequest._view=null,A._byobRequest=null)}function cQ(A){const e=[];for(;A._pendingPullIntos.length>0&&A._queueTotalSize!==0;){const r=A._pendingPullIntos.peek();Wi(A,r)&&(ve(A),e.push(r))}return e}function IB(A,e,r,Q){const t=A._controlledReadableByteStream,E=e.constructor,i=function(I){return Gi(I)?1:I.BYTES_PER_ELEMENT}(E),{byteOffset:B,byteLength:g}=e,c=r*i;let o;try{o=Me(e.buffer)}catch(I){return void Q._errorSteps(I)}const h={buffer:o,bufferByteLength:o.byteLength,byteOffset:B,byteLength:g,bytesFilled:0,minimumFill:c,elementSize:i,viewConstructor:E,readerType:"byob"};if(A._pendingPullIntos.length>0)return A._pendingPullIntos.push(h),void dE(t,Q);if(t._state!=="closed"){if(A._queueTotalSize>0){if(Wi(A,h)){const I=Vi(h);return qi(A),void Q._chunkSteps(I)}if(A._closeRequested){const I=new TypeError("Insufficient bytes to fill elements in the given buffer");return WA(A,I),void Q._errorSteps(I)}}A._pendingPullIntos.push(h),dE(t,Q),Te(A)}else{const I=new E(h.buffer,h.byteOffset,0);Q._closeSteps(I)}}function Pi(A,e){const r=A._pendingPullIntos.peek();LQ(A),A._controlledReadableByteStream._state==="closed"?function(Q,t){t.readerType==="none"&&ve(Q);const E=Q._controlledReadableByteStream;if(YQ(E)){const i=[];for(let B=0;B<Ki(E);++B)i.push(ve(Q));Jt(E,i)}}(A,r):function(Q,t,E){if(vi(0,t,E),E.readerType==="none"){_i(Q,E);const g=cQ(Q);return void Jt(Q._controlledReadableByteStream,g)}if(E.bytesFilled<E.minimumFill)return;ve(Q);const i=E.bytesFilled%E.elementSize;if(i>0){const g=E.byteOffset+E.bytesFilled;xi(Q,E.buffer,g-i,i)}E.bytesFilled-=i;const B=cQ(Q);Hi(Q._controlledReadableByteStream,E),Jt(Q._controlledReadableByteStream,B)}(A,e,r),Te(A)}function ve(A){return A._pendingPullIntos.shift()}function rr(A){A._pullAlgorithm=void 0,A._cancelAlgorithm=void 0}function it(A){const e=A._controlledReadableByteStream;if(!A._closeRequested&&e._state==="readable")if(A._queueTotalSize>0)A._closeRequested=!0;else{if(A._pendingPullIntos.length>0){const r=A._pendingPullIntos.peek();if(r.bytesFilled%r.elementSize!=0){const Q=new TypeError("Insufficient bytes to fill elements in the given buffer");throw WA(A,Q),Q}}rr(A),ct(e)}}function Tt(A,e){const r=A._controlledReadableByteStream;if(A._closeRequested||r._state!=="readable")return;const{buffer:Q,byteOffset:t,byteLength:E}=e;if(Je(Q))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const i=Me(Q);if(A._pendingPullIntos.length>0){const B=A._pendingPullIntos.peek();if(Je(B.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");LQ(A),B.buffer=Me(B.buffer),B.readerType==="none"&&_i(A,B)}if(bi(r))(function(B){const g=B._controlledReadableByteStream._reader;for(;g._readRequests.length>0;){if(B._queueTotalSize===0)return;Oi(B,g._readRequests.shift())}})(A),tr(r)===0?Gt(A,i,t,E):(A._pendingPullIntos.length>0&&ve(A),pQ(r,new Uint8Array(i,t,E),!1));else if(YQ(r)){Gt(A,i,t,E);const B=cQ(A);Jt(A._controlledReadableByteStream,B)}else Gt(A,i,t,E);Te(A)}function WA(A,e){const r=A._controlledReadableByteStream;r._state==="readable"&&(Ti(A),Fe(A),rr(A),lg(r,e))}function Oi(A,e){const r=A._queue.shift();A._queueTotalSize-=r.byteLength,qi(A);const Q=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);e._chunkSteps(Q)}function lQ(A){if(A._byobRequest===null&&A._pendingPullIntos.length>0){const e=A._pendingPullIntos.peek(),r=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled),Q=Object.create(pe.prototype);(function(t,E,i){t._associatedReadableByteStreamController=E,t._view=i})(Q,A,r),A._byobRequest=Q}return A._byobRequest}function Zi(A){const e=A._controlledReadableByteStream._state;return e==="errored"?null:e==="closed"?0:A._strategyHWM-A._queueTotalSize}function Ht(A,e){const r=A._pendingPullIntos.peek();if(A._controlledReadableByteStream._state==="closed"){if(e!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(e===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+e>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=Me(r.buffer),Pi(A,e)}function Vt(A,e){const r=A._pendingPullIntos.peek();if(A._controlledReadableByteStream._state==="closed"){if(e.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(e.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==e.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==e.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+e.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const Q=e.byteLength;r.buffer=Me(e.buffer),Pi(A,Q)}function Xi(A,e,r,Q,t,E,i){e._controlledReadableByteStream=A,e._pullAgain=!1,e._pulling=!1,e._byobRequest=null,e._queue=e._queueTotalSize=void 0,Fe(e),e._closeRequested=!1,e._started=!1,e._strategyHWM=E,e._pullAlgorithm=Q,e._cancelAlgorithm=t,e._autoAllocateChunkSize=i,e._pendingPullIntos=new qA,A._readableStreamController=e,VA(cA(r()),()=>(e._started=!0,Te(e),null),B=>(WA(e,B),null))}function Nr(A){return new TypeError(`ReadableStreamBYOBRequest.prototype.${A} can only be used on a ReadableStreamBYOBRequest`)}function tt(A){return new TypeError(`ReadableByteStreamController.prototype.${A} can only be used on a ReadableByteStreamController`)}function sB(A,e){if((A=`${A}`)!="byob")throw new TypeError(`${e} '${A}' is not a valid enumeration value for ReadableStreamReaderMode`);return A}function zi(A){return new ue(A)}function dE(A,e){A._reader._readIntoRequests.push(e)}function Ki(A){return A._reader._readIntoRequests.length}function YQ(A){const e=A._reader;return e!==void 0&&!!me(e)}Object.defineProperties(Be.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),hA(Be.prototype.close,"close"),hA(Be.prototype.enqueue,"enqueue"),hA(Be.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Be.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class ue{constructor(e){if(Ie(e,1,"ReadableStreamBYOBReader"),UQ(e,"First parameter"),Re(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Ue(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");yi(this,e),this._readIntoRequests=new qA}get closed(){return me(this)?this._closedPromise:O(kt("closed"))}cancel(e=void 0){return me(this)?this._ownerReadableStream===void 0?O(Wt("cancel")):NQ(this,e):O(kt("cancel"))}read(e,r={}){if(!me(this))return O(kt("read"));if(!ArrayBuffer.isView(e))return O(new TypeError("view must be an array buffer view"));if(e.byteLength===0)return O(new TypeError("view must have non-zero byteLength"));if(e.buffer.byteLength===0)return O(new TypeError("view's buffer must have non-zero byteLength"));if(Je(e.buffer))return O(new TypeError("view's buffer has been detached"));let Q;try{Q=function(g,c){var o;return ee(g,c),{min:kQ((o=g==null?void 0:g.min)!==null&&o!==void 0?o:1,`${c} has member 'min' that`)}}(r,"options")}catch(g){return O(g)}const t=Q.min;if(t===0)return O(new TypeError("options.min must be greater than 0"));if(function(g){return Gi(g.constructor)}(e)){if(t>e.byteLength)return O(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(t>e.length)return O(new RangeError("options.min must be less than or equal to view's length"));if(this._ownerReadableStream===void 0)return O(Wt("read from"));let E,i;const B=bA((g,c)=>{E=g,i=c});return ji(this,e,t,{_chunkSteps:g=>E({value:g,done:!1}),_closeSteps:g=>E({value:g,done:!0}),_errorSteps:g=>i(g)}),B}releaseLock(){if(!me(this))throw kt("releaseLock");this._ownerReadableStream!==void 0&&function(e){ne(e);const r=new TypeError("Reader was released");$i(e,r)}(this)}}function me(A){return!!FA(A)&&!!Object.prototype.hasOwnProperty.call(A,"_readIntoRequests")&&A instanceof ue}function ji(A,e,r,Q){const t=A._ownerReadableStream;t._disturbed=!0,t._state==="errored"?Q._errorSteps(t._storedError):IB(t._readableStreamController,e,r,Q)}function $i(A,e){const r=A._readIntoRequests;A._readIntoRequests=new qA,r.forEach(Q=>{Q._errorSteps(e)})}function kt(A){return new TypeError(`ReadableStreamBYOBReader.prototype.${A} can only be used on a ReadableStreamBYOBReader`)}function nt(A,e){const{highWaterMark:r}=A;if(r===void 0)return e;if(Ji(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function vt(A){const{size:e}=A;return e||(()=>1)}function qt(A,e){ee(A,e);const r=A==null?void 0:A.highWaterMark,Q=A==null?void 0:A.size;return{highWaterMark:r===void 0?void 0:bQ(r),size:Q===void 0?void 0:aB(Q,`${e} has member 'size' that`)}}function aB(A,e){return PA(A,e),r=>bQ(A(r))}function hB(A,e,r){return PA(A,r),Q=>ae(A,e,[Q])}function cB(A,e,r){return PA(A,r),()=>ae(A,e,[])}function lB(A,e,r){return PA(A,r),Q=>Ye(A,e,[Q])}function uB(A,e,r){return PA(A,r),(Q,t)=>ae(A,e,[Q,t])}function Ag(A,e){if(!_e(A))throw new TypeError(`${e} is not a WritableStream.`)}Object.defineProperties(ue.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),hA(ue.prototype.cancel,"cancel"),hA(ue.prototype.read,"read"),hA(ue.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ue.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});class fe{constructor(e={},r={}){e===void 0?e=null:Ni(e,"First parameter");const Q=qt(r,"Second parameter"),t=function(i,B){ee(i,B);const g=i==null?void 0:i.abort,c=i==null?void 0:i.close,o=i==null?void 0:i.start,h=i==null?void 0:i.type,I=i==null?void 0:i.write;return{abort:g===void 0?void 0:hB(g,i,`${B} has member 'abort' that`),close:c===void 0?void 0:cB(c,i,`${B} has member 'close' that`),start:o===void 0?void 0:lB(o,i,`${B} has member 'start' that`),write:I===void 0?void 0:uB(I,i,`${B} has member 'write' that`),type:h}}(e,"First parameter");if(tg(this),t.type!==void 0)throw new RangeError("Invalid type is specified");const E=vt(Q);(function(i,B,g,c){const o=Object.create(Pe.prototype);let h,I,R,f;h=B.start!==void 0?()=>B.start(o):()=>{},I=B.write!==void 0?C=>B.write(C,o):()=>cA(void 0),R=B.close!==void 0?()=>B.close():()=>cA(void 0),f=B.abort!==void 0?C=>B.abort(C):()=>cA(void 0),og(i,o,h,I,R,f,g,c)})(this,t,nt(Q,1),E)}get locked(){if(!_e(this))throw pt("locked");return qe(this)}abort(e=void 0){return _e(this)?qe(this)?O(new TypeError("Cannot abort a stream that already has a writer")):Pt(this,e):O(pt("abort"))}close(){return _e(this)?qe(this)?O(new TypeError("Cannot close a stream that already has a writer")):te(this)?O(new TypeError("Cannot close an already-closing stream")):rg(this):O(pt("close"))}getWriter(){if(!_e(this))throw pt("getWriter");return eg(this)}}function eg(A){return new ge(A)}function tg(A){A._state="writable",A._storedError=void 0,A._writer=void 0,A._writableStreamController=void 0,A._writeRequests=new qA,A._inFlightWriteRequest=void 0,A._closeRequest=void 0,A._inFlightCloseRequest=void 0,A._pendingAbortRequest=void 0,A._backpressure=!1}function _e(A){return!!FA(A)&&!!Object.prototype.hasOwnProperty.call(A,"_writableStreamController")&&A instanceof fe}function qe(A){return A._writer!==void 0}function Pt(A,e){var r;if(A._state==="closed"||A._state==="errored")return cA(void 0);A._writableStreamController._abortReason=e,(r=A._writableStreamController._abortController)===null||r===void 0||r.abort(e);const Q=A._state;if(Q==="closed"||Q==="errored")return cA(void 0);if(A._pendingAbortRequest!==void 0)return A._pendingAbortRequest._promise;let t=!1;Q==="erroring"&&(t=!0,e=void 0);const E=bA((i,B)=>{A._pendingAbortRequest={_promise:void 0,_resolve:i,_reject:B,_reason:e,_wasAlreadyErroring:t}});return A._pendingAbortRequest._promise=E,t||MQ(A,e),E}function rg(A){const e=A._state;if(e==="closed"||e==="errored")return O(new TypeError(`The stream (in ${e} state) is not in the writable state and cannot be closed`));const r=bA((E,i)=>{const B={_resolve:E,_reject:i};A._closeRequest=B}),Q=A._writer;var t;return Q!==void 0&&A._backpressure&&e==="writable"&&VQ(Q),mQ(t=A._writableStreamController,Bg,0),Qr(t),r}function uQ(A,e){A._state!=="writable"?JQ(A):MQ(A,e)}function MQ(A,e){const r=A._writableStreamController;A._state="erroring",A._storedError=e;const Q=A._writer;Q!==void 0&&Eg(Q,e),!function(t){return!(t._inFlightWriteRequest===void 0&&t._inFlightCloseRequest===void 0)}(A)&&r._started&&JQ(A)}function JQ(A){A._state="errored",A._writableStreamController[Ri]();const e=A._storedError;if(A._writeRequests.forEach(Q=>{Q._reject(e)}),A._writeRequests=new qA,A._pendingAbortRequest===void 0)return void Ut(A);const r=A._pendingAbortRequest;if(A._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(e),void Ut(A);VA(A._writableStreamController[Di](r._reason),()=>(r._resolve(),Ut(A),null),Q=>(r._reject(Q),Ut(A),null))}function te(A){return A._closeRequest!==void 0||A._inFlightCloseRequest!==void 0}function Ut(A){A._closeRequest!==void 0&&(A._closeRequest._reject(A._storedError),A._closeRequest=void 0);const e=A._writer;e!==void 0&&HQ(e,A._storedError)}function GQ(A,e){const r=A._writer;r!==void 0&&e!==A._backpressure&&(e?function(Q){Er(Q)}(r):VQ(r)),A._backpressure=e}Object.defineProperties(fe.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),hA(fe.prototype.abort,"abort"),hA(fe.prototype.close,"close"),hA(fe.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(fe.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class ge{constructor(e){if(Ie(e,1,"WritableStreamDefaultWriter"),Ag(e,"First parameter"),qe(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const r=e._state;if(r==="writable")!te(e)&&e._backpressure?Er(this):DE(this),xt(this);else if(r==="erroring")fQ(this,e._storedError),xt(this);else if(r==="closed")DE(this),xt(Q=this),sg(Q);else{const t=e._storedError;fQ(this,t),Ig(this,t)}var Q}get closed(){return Se(this)?this._closedPromise:O(be("closed"))}get desiredSize(){if(!Se(this))throw be("desiredSize");if(this._ownerWritableStream===void 0)throw gt("desiredSize");return function(e){const r=e._ownerWritableStream,Q=r._state;return Q==="errored"||Q==="erroring"?null:Q==="closed"?0:ng(r._writableStreamController)}(this)}get ready(){return Se(this)?this._readyPromise:O(be("ready"))}abort(e=void 0){return Se(this)?this._ownerWritableStream===void 0?O(gt("abort")):function(r,Q){return Pt(r._ownerWritableStream,Q)}(this,e):O(be("abort"))}close(){if(!Se(this))return O(be("close"));const e=this._ownerWritableStream;return e===void 0?O(gt("close")):te(e)?O(new TypeError("Cannot close an already-closing stream")):Qg(this)}releaseLock(){if(!Se(this))throw be("releaseLock");this._ownerWritableStream!==void 0&&ig(this)}write(e=void 0){return Se(this)?this._ownerWritableStream===void 0?O(gt("write to")):gg(this,e):O(be("write"))}}function Se(A){return!!FA(A)&&!!Object.prototype.hasOwnProperty.call(A,"_ownerWritableStream")&&A instanceof ge}function Qg(A){return rg(A._ownerWritableStream)}function fB(A,e){A._closedPromiseState==="pending"?HQ(A,e):function(r,Q){Ig(r,Q)}(A,e)}function Eg(A,e){A._readyPromiseState==="pending"?ag(A,e):function(r,Q){fQ(r,Q)}(A,e)}function ig(A){const e=A._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Eg(A,r),fB(A,r),e._writer=void 0,A._ownerWritableStream=void 0}function gg(A,e){const r=A._ownerWritableStream,Q=r._writableStreamController,t=function(B,g){if(B._strategySizeAlgorithm===void 0)return 1;try{return B._strategySizeAlgorithm(g)}catch(c){return Ct(B,c),1}}(Q,e);if(r!==A._ownerWritableStream)return O(gt("write to"));const E=r._state;if(E==="errored")return O(r._storedError);if(te(r)||E==="closed")return O(new TypeError("The stream is closing or closed and cannot be written to"));if(E==="erroring")return O(r._storedError);const i=function(B){return bA((g,c)=>{const o={_resolve:g,_reject:c};B._writeRequests.push(o)})}(r);return function(B,g,c){try{mQ(B,g,c)}catch(h){return void Ct(B,h)}const o=B._controlledWritableStream;!te(o)&&o._state==="writable"&&GQ(o,TQ(B)),Qr(B)}(Q,e,t),i}Object.defineProperties(ge.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),hA(ge.prototype.abort,"abort"),hA(ge.prototype.close,"close"),hA(ge.prototype.releaseLock,"releaseLock"),hA(ge.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ge.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const Bg={};class Pe{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Sr(this))throw br("abortReason");return this._abortReason}get signal(){if(!Sr(this))throw br("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!Sr(this))throw br("error");this._controlledWritableStream._state==="writable"&&Cg(this,e)}[Di](e){const r=this._abortAlgorithm(e);return Ot(this),r}[Ri](){Fe(this)}}function Sr(A){return!!FA(A)&&!!Object.prototype.hasOwnProperty.call(A,"_controlledWritableStream")&&A instanceof Pe}function og(A,e,r,Q,t,E,i,B){e._controlledWritableStream=A,A._writableStreamController=e,e._queue=void 0,e._queueTotalSize=void 0,Fe(e),e._abortReason=void 0,e._abortController=function(){if(typeof AbortController=="function")return new AbortController}(),e._started=!1,e._strategySizeAlgorithm=B,e._strategyHWM=i,e._writeAlgorithm=Q,e._closeAlgorithm=t,e._abortAlgorithm=E;const g=TQ(e);GQ(A,g),VA(cA(r()),()=>(e._started=!0,Qr(e),null),c=>(e._started=!0,uQ(A,c),null))}function Ot(A){A._writeAlgorithm=void 0,A._closeAlgorithm=void 0,A._abortAlgorithm=void 0,A._strategySizeAlgorithm=void 0}function ng(A){return A._strategyHWM-A._queueTotalSize}function Qr(A){const e=A._controlledWritableStream;if(!A._started||e._inFlightWriteRequest!==void 0)return;if(e._state==="erroring")return void JQ(e);if(A._queue.length===0)return;const r=A._queue.peek().value;r===Bg?function(Q){const t=Q._controlledWritableStream;(function(i){i._inFlightCloseRequest=i._closeRequest,i._closeRequest=void 0})(t),hQ(Q);const E=Q._closeAlgorithm();Ot(Q),VA(E,()=>(function(i){i._inFlightCloseRequest._resolve(void 0),i._inFlightCloseRequest=void 0,i._state==="erroring"&&(i._storedError=void 0,i._pendingAbortRequest!==void 0&&(i._pendingAbortRequest._resolve(),i._pendingAbortRequest=void 0)),i._state="closed";const B=i._writer;B!==void 0&&sg(B)}(t),null),i=>(function(B,g){B._inFlightCloseRequest._reject(g),B._inFlightCloseRequest=void 0,B._pendingAbortRequest!==void 0&&(B._pendingAbortRequest._reject(g),B._pendingAbortRequest=void 0),uQ(B,g)}(t,i),null))}(A):function(Q,t){const E=Q._controlledWritableStream;(function(B){B._inFlightWriteRequest=B._writeRequests.shift()})(E);const i=Q._writeAlgorithm(t);VA(i,()=>{(function(g){g._inFlightWriteRequest._resolve(void 0),g._inFlightWriteRequest=void 0})(E);const B=E._state;if(hQ(Q),!te(E)&&B==="writable"){const g=TQ(Q);GQ(E,g)}return Qr(Q),null},B=>(E._state==="writable"&&Ot(Q),function(g,c){g._inFlightWriteRequest._reject(c),g._inFlightWriteRequest=void 0,uQ(g,c)}(E,B),null))}(A,r)}function Ct(A,e){A._controlledWritableStream._state==="writable"&&Cg(A,e)}function TQ(A){return ng(A)<=0}function Cg(A,e){const r=A._controlledWritableStream;Ot(A),MQ(r,e)}function pt(A){return new TypeError(`WritableStream.prototype.${A} can only be used on a WritableStream`)}function br(A)