diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 718572b..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 - -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index d21f315..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Release - -on: - release: - types: [published, edited] - -permissions: - contents: write - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.release.tag_name }} - - - uses: pnpm/action-setup@v2 - - uses: actions/setup-node@v3 - with: - cache: pnpm - cache-dependency-path: pnpm-lock.yaml - - - name: Build - run: pnpm install && pnpm build - - - uses: JasonEtco/build-and-tag-action@v2 - env: - GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 399c09f..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: "Test" - -on: - push: - branches: ["main"] - workflow_call: - workflow_dispatch: - -jobs: - test-cache: - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - uses: pnpm/action-setup@v2 - - uses: actions/setup-node@v3 - with: - cache: pnpm - cache-dependency-path: pnpm-lock.yaml - - - name: Build - run: pnpm install && pnpm build - - - name: Install Nix - uses: cachix/install-nix-action@v22 - - - name: Setup Attic Cache - uses: ./ - with: - endpoint: ${{ secrets.ATTIC_ENDPOINT }} - cache: ${{ secrets.ATTIC_CACHE }} - token: ${{ secrets.ATTIC_TOKEN }} - - - name: Build Nix Package - run: nix build --impure --show-trace -L .#test diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 5323301..0000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -.DS_Store - -node_modules/ - -# nix -.direnv/ -.envrc -result* diff --git a/.node-version b/.node-version deleted file mode 100644 index b6a7d89..0000000 --- a/.node-version +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 74833d3..0000000 --- a/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -.direnv/ -dist/ - -pnpm-lock.yaml diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 0c597d3..0000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "useTabs": true, - "printWidth": 120 -} diff --git a/LICENSE b/LICENSE deleted file mode 100644 index cc07165..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Ryan Cao - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 309095b..0000000 --- a/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# attic-action - -Cache Nix derivations with [Attic](https://github.com/zhaofengli/attic). - -## Usage - -Configure your attic instance with an endpoint, a cache, and a token that can read from and write to the cache. Then, add this step to a workflow job after Nix is installed: - -```yaml -- name: Setup Attic cache - uses: ryanccn/attic-action@v0 - with: - endpoint: ${{ secrets.ATTIC_ENDPOINT }} - cache: ${{ secrets.ATTIC_CACHE }} - token: ${{ secrets.ATTIC_TOKEN }} -``` - -## Inputs - -### `endpoint` - -The Attic endpoint. This is the URL without the cache name. - -### `cache` - -The name of the Attic cache. - -### `token` - -The authorization token to provide to Attic (**optional**). - -### `skip-push` - -Disable pushing new derivations to the cache automatically at the end of the job (**default is false**). - -This requires you to invoke `attic push ` with the paths you want to push to the cache manually. - -## Outputs - -None - -## License - -MIT diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..15b707a --- /dev/null +++ b/dist/index.js @@ -0,0 +1,29 @@ +"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __esm=(fn,res)=>function(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var require_utils=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/utils.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.toCommandProperties=exports.toCommandValue=void 0;function toCommandValue(input){return input==null?"":typeof input=="string"||input instanceof String?input:JSON.stringify(input)}exports.toCommandValue=toCommandValue;function toCommandProperties(annotationProperties){return Object.keys(annotationProperties).length?{title:annotationProperties.title,file:annotationProperties.file,line:annotationProperties.startLine,endLine:annotationProperties.endLine,col:annotationProperties.startColumn,endColumn:annotationProperties.endColumn}:{}}exports.toCommandProperties=toCommandProperties}});var require_command=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/command.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result};Object.defineProperty(exports,"__esModule",{value:!0});exports.issue=exports.issueCommand=void 0;var os=__importStar(require("os")),utils_1=require_utils();function issueCommand(command,properties,message){let cmd=new Command(command,properties,message);process.stdout.write(cmd.toString()+os.EOL)}exports.issueCommand=issueCommand;function issue(name,message=""){issueCommand(name,{},message)}exports.issue=issue;var CMD_STRING="::",Command=class{constructor(command,properties,message){command||(command="missing.command"),this.command=command,this.properties=properties,this.message=message}toString(){let cmdStr=CMD_STRING+this.command;if(this.properties&&Object.keys(this.properties).length>0){cmdStr+=" ";let first=!0;for(let key in this.properties)if(this.properties.hasOwnProperty(key)){let val=this.properties[key];val&&(first?first=!1:cmdStr+=",",cmdStr+=`${key}=${escapeProperty(val)}`)}}return cmdStr+=`${CMD_STRING}${escapeData(this.message)}`,cmdStr}};function escapeData(s2){return utils_1.toCommandValue(s2).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(s2){return utils_1.toCommandValue(s2).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}}});function rng(){return poolPtr>rnds8Pool.length-16&&(import_crypto.default.randomFillSync(rnds8Pool),poolPtr=0),rnds8Pool.slice(poolPtr,poolPtr+=16)}var import_crypto,rnds8Pool,poolPtr,init_rng=__esm({"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-node/rng.js"(){import_crypto=__toESM(require("crypto")),rnds8Pool=new Uint8Array(256),poolPtr=rnds8Pool.length}});var regex_default,init_regex=__esm({"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-node/regex.js"(){regex_default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i}});function validate(uuid){return typeof uuid=="string"&®ex_default.test(uuid)}var validate_default,init_validate=__esm({"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-node/validate.js"(){init_regex();validate_default=validate}});function stringify(arr,offset=0){let uuid=(byteToHex[arr[offset+0]]+byteToHex[arr[offset+1]]+byteToHex[arr[offset+2]]+byteToHex[arr[offset+3]]+"-"+byteToHex[arr[offset+4]]+byteToHex[arr[offset+5]]+"-"+byteToHex[arr[offset+6]]+byteToHex[arr[offset+7]]+"-"+byteToHex[arr[offset+8]]+byteToHex[arr[offset+9]]+"-"+byteToHex[arr[offset+10]]+byteToHex[arr[offset+11]]+byteToHex[arr[offset+12]]+byteToHex[arr[offset+13]]+byteToHex[arr[offset+14]]+byteToHex[arr[offset+15]]).toLowerCase();if(!validate_default(uuid))throw TypeError("Stringified UUID is invalid");return uuid}var byteToHex,stringify_default,init_stringify=__esm({"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-node/stringify.js"(){init_validate();byteToHex=[];for(let i2=0;i2<256;++i2)byteToHex.push((i2+256).toString(16).substr(1));stringify_default=stringify}});function v1(options,buf,offset){let i2=buf&&offset||0,b=buf||new Array(16);options=options||{};let node=options.node||_nodeId,clockseq=options.clockseq!==void 0?options.clockseq:_clockseq;if(node==null||clockseq==null){let seedBytes=options.random||(options.rng||rng)();node==null&&(node=_nodeId=[seedBytes[0]|1,seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),clockseq==null&&(clockseq=_clockseq=(seedBytes[6]<<8|seedBytes[7])&16383)}let msecs=options.msecs!==void 0?options.msecs:Date.now(),nsecs=options.nsecs!==void 0?options.nsecs:_lastNSecs+1,dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&options.clockseq===void 0&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&options.nsecs===void 0&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq,msecs+=122192928e5;let tl=((msecs&268435455)*1e4+nsecs)%4294967296;b[i2++]=tl>>>24&255,b[i2++]=tl>>>16&255,b[i2++]=tl>>>8&255,b[i2++]=tl&255;let tmh=msecs/4294967296*1e4&268435455;b[i2++]=tmh>>>8&255,b[i2++]=tmh&255,b[i2++]=tmh>>>24&15|16,b[i2++]=tmh>>>16&255,b[i2++]=clockseq>>>8|128,b[i2++]=clockseq&255;for(let n=0;n<6;++n)b[i2+n]=node[n];return buf||stringify_default(b)}var _nodeId,_clockseq,_lastMSecs,_lastNSecs,v1_default,init_v1=__esm({"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-node/v1.js"(){init_rng();init_stringify();_lastMSecs=0,_lastNSecs=0;v1_default=v1}});function parse(uuid){if(!validate_default(uuid))throw TypeError("Invalid UUID");let v,arr=new Uint8Array(16);return arr[0]=(v=parseInt(uuid.slice(0,8),16))>>>24,arr[1]=v>>>16&255,arr[2]=v>>>8&255,arr[3]=v&255,arr[4]=(v=parseInt(uuid.slice(9,13),16))>>>8,arr[5]=v&255,arr[6]=(v=parseInt(uuid.slice(14,18),16))>>>8,arr[7]=v&255,arr[8]=(v=parseInt(uuid.slice(19,23),16))>>>8,arr[9]=v&255,arr[10]=(v=parseInt(uuid.slice(24,36),16))/1099511627776&255,arr[11]=v/4294967296&255,arr[12]=v>>>24&255,arr[13]=v>>>16&255,arr[14]=v>>>8&255,arr[15]=v&255,arr}var parse_default,init_parse=__esm({"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-node/parse.js"(){init_validate();parse_default=parse}});function stringToBytes(str){str=unescape(encodeURIComponent(str));let bytes=[];for(let i2=0;i2nil_default,parse:()=>parse_default,stringify:()=>stringify_default,v1:()=>v1_default,v3:()=>v3_default,v4:()=>v4_default,v5:()=>v5_default,validate:()=>validate_default,version:()=>version_default});var init_esm_node=__esm({"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-node/index.js"(){init_v1();init_v3();init_v4();init_v5();init_nil();init_version();init_validate();init_stringify();init_parse()}});var require_file_command=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/file-command.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result};Object.defineProperty(exports,"__esModule",{value:!0});exports.prepareKeyValueMessage=exports.issueFileCommand=void 0;var fs=__importStar(require("fs")),os=__importStar(require("os")),uuid_1=(init_esm_node(),__toCommonJS(esm_node_exports)),utils_1=require_utils();function issueFileCommand(command,message){let filePath=process.env[`GITHUB_${command}`];if(!filePath)throw new Error(`Unable to find environment variable for file command ${command}`);if(!fs.existsSync(filePath))throw new Error(`Missing file at path: ${filePath}`);fs.appendFileSync(filePath,`${utils_1.toCommandValue(message)}${os.EOL}`,{encoding:"utf8"})}exports.issueFileCommand=issueFileCommand;function prepareKeyValueMessage(key,value){let delimiter=`ghadelimiter_${uuid_1.v4()}`,convertedValue=utils_1.toCommandValue(value);if(key.includes(delimiter))throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);if(convertedValue.includes(delimiter))throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);return`${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`}exports.prepareKeyValueMessage=prepareKeyValueMessage}});var require_proxy=__commonJS({"node_modules/.pnpm/@actions+http-client@2.1.0/node_modules/@actions/http-client/lib/proxy.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.checkBypass=exports.getProxyUrl=void 0;function getProxyUrl(reqUrl){let usingSsl=reqUrl.protocol==="https:";if(checkBypass(reqUrl))return;let proxyVar=(()=>usingSsl?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY)();if(proxyVar)return new URL(proxyVar)}exports.getProxyUrl=getProxyUrl;function checkBypass(reqUrl){if(!reqUrl.hostname)return!1;let reqHost=reqUrl.hostname;if(isLoopbackAddress(reqHost))return!0;let noProxy=process.env.no_proxy||process.env.NO_PROXY||"";if(!noProxy)return!1;let reqPort;reqUrl.port?reqPort=Number(reqUrl.port):reqUrl.protocol==="http:"?reqPort=80:reqUrl.protocol==="https:"&&(reqPort=443);let upperReqHosts=[reqUrl.hostname.toUpperCase()];typeof reqPort=="number"&&upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);for(let upperNoProxyItem of noProxy.split(",").map(x2=>x2.trim().toUpperCase()).filter(x2=>x2))if(upperNoProxyItem==="*"||upperReqHosts.some(x2=>x2===upperNoProxyItem||x2.endsWith(`.${upperNoProxyItem}`)||upperNoProxyItem.startsWith(".")&&x2.endsWith(`${upperNoProxyItem}`)))return!0;return!1}exports.checkBypass=checkBypass;function isLoopbackAddress(host){let hostLower=host.toLowerCase();return hostLower==="localhost"||hostLower.startsWith("127.")||hostLower.startsWith("[::1]")||hostLower.startsWith("[0:0:0:0:0:0:0:1]")}}});var require_tunnel=__commonJS({"node_modules/.pnpm/tunnel@0.0.6/node_modules/tunnel/lib/tunnel.js"(exports){"use strict";var net=require("net"),tls=require("tls"),http3=require("http"),https3=require("https"),events=require("events"),assert=require("assert"),util=require("util");exports.httpOverHttp=httpOverHttp;exports.httpsOverHttp=httpsOverHttp;exports.httpOverHttps=httpOverHttps;exports.httpsOverHttps=httpsOverHttps;function httpOverHttp(options){var agent=new TunnelingAgent(options);return agent.request=http3.request,agent}function httpsOverHttp(options){var agent=new TunnelingAgent(options);return agent.request=http3.request,agent.createSocket=createSecureSocket,agent.defaultPort=443,agent}function httpOverHttps(options){var agent=new TunnelingAgent(options);return agent.request=https3.request,agent}function httpsOverHttps(options){var agent=new TunnelingAgent(options);return agent.request=https3.request,agent.createSocket=createSecureSocket,agent.defaultPort=443,agent}function TunnelingAgent(options){var self2=this;self2.options=options||{},self2.proxyOptions=self2.options.proxy||{},self2.maxSockets=self2.options.maxSockets||http3.Agent.defaultMaxSockets,self2.requests=[],self2.sockets=[],self2.on("free",function(socket,host,port,localAddress){for(var options2=toOptions(host,port,localAddress),i2=0,len=self2.requests.length;i2=this.maxSockets){self2.requests.push(options);return}self2.createSocket(options,function(socket){socket.on("free",onFree),socket.on("close",onCloseOrRemove),socket.on("agentRemove",onCloseOrRemove),req.onSocket(socket);function onFree(){self2.emit("free",socket,options)}function onCloseOrRemove(err){self2.removeSocket(socket),socket.removeListener("free",onFree),socket.removeListener("close",onCloseOrRemove),socket.removeListener("agentRemove",onCloseOrRemove)}})};TunnelingAgent.prototype.createSocket=function(options,cb){var self2=this,placeholder={};self2.sockets.push(placeholder);var connectOptions=mergeOptions({},self2.proxyOptions,{method:"CONNECT",path:options.host+":"+options.port,agent:!1,headers:{host:options.host+":"+options.port}});options.localAddress&&(connectOptions.localAddress=options.localAddress),connectOptions.proxyAuth&&(connectOptions.headers=connectOptions.headers||{},connectOptions.headers["Proxy-Authorization"]="Basic "+new Buffer(connectOptions.proxyAuth).toString("base64")),debug("making CONNECT request");var connectReq=self2.request(connectOptions);connectReq.useChunkedEncodingByDefault=!1,connectReq.once("response",onResponse),connectReq.once("upgrade",onUpgrade),connectReq.once("connect",onConnect),connectReq.once("error",onError),connectReq.end();function onResponse(res){res.upgrade=!0}function onUpgrade(res,socket,head){process.nextTick(function(){onConnect(res,socket,head)})}function onConnect(res,socket,head){if(connectReq.removeAllListeners(),socket.removeAllListeners(),res.statusCode!==200){debug("tunneling socket could not be established, statusCode=%d",res.statusCode),socket.destroy();var error=new Error("tunneling socket could not be established, statusCode="+res.statusCode);error.code="ECONNRESET",options.request.emit("error",error),self2.removeSocket(placeholder);return}if(head.length>0){debug("got illegal response body from proxy"),socket.destroy();var error=new Error("got illegal response body from proxy");error.code="ECONNRESET",options.request.emit("error",error),self2.removeSocket(placeholder);return}return debug("tunneling connection has established"),self2.sockets[self2.sockets.indexOf(placeholder)]=socket,cb(socket)}function onError(cause){connectReq.removeAllListeners(),debug(`tunneling socket could not be established, cause=%s +`,cause.message,cause.stack);var error=new Error("tunneling socket could not be established, cause="+cause.message);error.code="ECONNRESET",options.request.emit("error",error),self2.removeSocket(placeholder)}};TunnelingAgent.prototype.removeSocket=function(socket){var pos=this.sockets.indexOf(socket);if(pos!==-1){this.sockets.splice(pos,1);var pending=this.requests.shift();pending&&this.createSocket(pending,function(socket2){pending.request.onSocket(socket2)})}};function createSecureSocket(options,cb){var self2=this;TunnelingAgent.prototype.createSocket.call(self2,options,function(socket){var hostHeader=options.request.getHeader("host"),tlsOptions=mergeOptions({},self2.options,{socket,servername:hostHeader?hostHeader.replace(/:.*$/,""):options.host}),secureSocket=tls.connect(0,tlsOptions);self2.sockets[self2.sockets.indexOf(socket)]=secureSocket,cb(secureSocket)})}function toOptions(host,port,localAddress){return typeof host=="string"?{host,port,localAddress}:host}function mergeOptions(target){for(var i2=1,len=arguments.length;i2__awaiter(this,void 0,void 0,function*(){let output=Buffer.alloc(0);this.message.on("data",chunk=>{output=Buffer.concat([output,chunk])}),this.message.on("end",()=>{resolve(output.toString())})}))})}};exports.HttpClientResponse=HttpClientResponse;function isHttps(requestUrl){return new URL(requestUrl).protocol==="https:"}exports.isHttps=isHttps;var HttpClient=class{constructor(userAgent,handlers,requestOptions){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=userAgent,this.handlers=handlers||[],this.requestOptions=requestOptions,requestOptions&&(requestOptions.ignoreSslError!=null&&(this._ignoreSslError=requestOptions.ignoreSslError),this._socketTimeout=requestOptions.socketTimeout,requestOptions.allowRedirects!=null&&(this._allowRedirects=requestOptions.allowRedirects),requestOptions.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=requestOptions.allowRedirectDowngrade),requestOptions.maxRedirects!=null&&(this._maxRedirects=Math.max(requestOptions.maxRedirects,0)),requestOptions.keepAlive!=null&&(this._keepAlive=requestOptions.keepAlive),requestOptions.allowRetries!=null&&(this._allowRetries=requestOptions.allowRetries),requestOptions.maxRetries!=null&&(this._maxRetries=requestOptions.maxRetries))}options(requestUrl,additionalHeaders){return __awaiter(this,void 0,void 0,function*(){return this.request("OPTIONS",requestUrl,null,additionalHeaders||{})})}get(requestUrl,additionalHeaders){return __awaiter(this,void 0,void 0,function*(){return this.request("GET",requestUrl,null,additionalHeaders||{})})}del(requestUrl,additionalHeaders){return __awaiter(this,void 0,void 0,function*(){return this.request("DELETE",requestUrl,null,additionalHeaders||{})})}post(requestUrl,data,additionalHeaders){return __awaiter(this,void 0,void 0,function*(){return this.request("POST",requestUrl,data,additionalHeaders||{})})}patch(requestUrl,data,additionalHeaders){return __awaiter(this,void 0,void 0,function*(){return this.request("PATCH",requestUrl,data,additionalHeaders||{})})}put(requestUrl,data,additionalHeaders){return __awaiter(this,void 0,void 0,function*(){return this.request("PUT",requestUrl,data,additionalHeaders||{})})}head(requestUrl,additionalHeaders){return __awaiter(this,void 0,void 0,function*(){return this.request("HEAD",requestUrl,null,additionalHeaders||{})})}sendStream(verb,requestUrl,stream,additionalHeaders){return __awaiter(this,void 0,void 0,function*(){return this.request(verb,requestUrl,stream,additionalHeaders)})}getJson(requestUrl,additionalHeaders={}){return __awaiter(this,void 0,void 0,function*(){additionalHeaders[Headers4.Accept]=this._getExistingOrDefaultHeader(additionalHeaders,Headers4.Accept,MediaTypes.ApplicationJson);let res=yield this.get(requestUrl,additionalHeaders);return this._processResponse(res,this.requestOptions)})}postJson(requestUrl,obj,additionalHeaders={}){return __awaiter(this,void 0,void 0,function*(){let data=JSON.stringify(obj,null,2);additionalHeaders[Headers4.Accept]=this._getExistingOrDefaultHeader(additionalHeaders,Headers4.Accept,MediaTypes.ApplicationJson),additionalHeaders[Headers4.ContentType]=this._getExistingOrDefaultHeader(additionalHeaders,Headers4.ContentType,MediaTypes.ApplicationJson);let res=yield this.post(requestUrl,data,additionalHeaders);return this._processResponse(res,this.requestOptions)})}putJson(requestUrl,obj,additionalHeaders={}){return __awaiter(this,void 0,void 0,function*(){let data=JSON.stringify(obj,null,2);additionalHeaders[Headers4.Accept]=this._getExistingOrDefaultHeader(additionalHeaders,Headers4.Accept,MediaTypes.ApplicationJson),additionalHeaders[Headers4.ContentType]=this._getExistingOrDefaultHeader(additionalHeaders,Headers4.ContentType,MediaTypes.ApplicationJson);let res=yield this.put(requestUrl,data,additionalHeaders);return this._processResponse(res,this.requestOptions)})}patchJson(requestUrl,obj,additionalHeaders={}){return __awaiter(this,void 0,void 0,function*(){let data=JSON.stringify(obj,null,2);additionalHeaders[Headers4.Accept]=this._getExistingOrDefaultHeader(additionalHeaders,Headers4.Accept,MediaTypes.ApplicationJson),additionalHeaders[Headers4.ContentType]=this._getExistingOrDefaultHeader(additionalHeaders,Headers4.ContentType,MediaTypes.ApplicationJson);let res=yield this.patch(requestUrl,data,additionalHeaders);return this._processResponse(res,this.requestOptions)})}request(verb,requestUrl,data,headers){return __awaiter(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");let parsedUrl=new URL(requestUrl),info4=this._prepareRequest(verb,parsedUrl,headers),maxTries=this._allowRetries&&RetryableHttpVerbs.includes(verb)?this._maxRetries+1:1,numTries=0,response;do{if(response=yield this.requestRaw(info4,data),response&&response.message&&response.message.statusCode===HttpCodes.Unauthorized){let authenticationHandler;for(let handler of this.handlers)if(handler.canHandleAuthentication(response)){authenticationHandler=handler;break}return authenticationHandler?authenticationHandler.handleAuthentication(this,info4,data):response}let redirectsRemaining=this._maxRedirects;for(;response.message.statusCode&&HttpRedirectCodes.includes(response.message.statusCode)&&this._allowRedirects&&redirectsRemaining>0;){let redirectUrl=response.message.headers.location;if(!redirectUrl)break;let parsedRedirectUrl=new URL(redirectUrl);if(parsedUrl.protocol==="https:"&&parsedUrl.protocol!==parsedRedirectUrl.protocol&&!this._allowRedirectDowngrade)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.");if(yield response.readBody(),parsedRedirectUrl.hostname!==parsedUrl.hostname)for(let header in headers)header.toLowerCase()==="authorization"&&delete headers[header];info4=this._prepareRequest(verb,parsedRedirectUrl,headers),response=yield this.requestRaw(info4,data),redirectsRemaining--}if(!response.message.statusCode||!HttpResponseRetryCodes.includes(response.message.statusCode))return response;numTries+=1,numTries{function callbackForResult(err,res){err?reject(err):res?resolve(res):reject(new Error("Unknown error"))}this.requestRawWithCallback(info4,data,callbackForResult)})})}requestRawWithCallback(info4,data,onResult){typeof data=="string"&&(info4.options.headers||(info4.options.headers={}),info4.options.headers["Content-Length"]=Buffer.byteLength(data,"utf8"));let callbackCalled=!1;function handleResult(err,res){callbackCalled||(callbackCalled=!0,onResult(err,res))}let req=info4.httpModule.request(info4.options,msg=>{let res=new HttpClientResponse(msg);handleResult(void 0,res)}),socket;req.on("socket",sock=>{socket=sock}),req.setTimeout(this._socketTimeout||3*6e4,()=>{socket&&socket.end(),handleResult(new Error(`Request timeout: ${info4.options.path}`))}),req.on("error",function(err){handleResult(err)}),data&&typeof data=="string"&&req.write(data,"utf8"),data&&typeof data!="string"?(data.on("close",function(){req.end()}),data.pipe(req)):req.end()}getAgent(serverUrl){let parsedUrl=new URL(serverUrl);return this._getAgent(parsedUrl)}_prepareRequest(method,requestUrl,headers){let info4={};info4.parsedUrl=requestUrl;let usingSsl=info4.parsedUrl.protocol==="https:";info4.httpModule=usingSsl?https3:http3;let defaultPort=usingSsl?443:80;if(info4.options={},info4.options.host=info4.parsedUrl.hostname,info4.options.port=info4.parsedUrl.port?parseInt(info4.parsedUrl.port):defaultPort,info4.options.path=(info4.parsedUrl.pathname||"")+(info4.parsedUrl.search||""),info4.options.method=method,info4.options.headers=this._mergeHeaders(headers),this.userAgent!=null&&(info4.options.headers["user-agent"]=this.userAgent),info4.options.agent=this._getAgent(info4.parsedUrl),this.handlers)for(let handler of this.handlers)handler.prepareRequest(info4.options);return info4}_mergeHeaders(headers){return this.requestOptions&&this.requestOptions.headers?Object.assign({},lowercaseKeys(this.requestOptions.headers),lowercaseKeys(headers||{})):lowercaseKeys(headers||{})}_getExistingOrDefaultHeader(additionalHeaders,header,_default){let clientHeader;return this.requestOptions&&this.requestOptions.headers&&(clientHeader=lowercaseKeys(this.requestOptions.headers)[header]),additionalHeaders[header]||clientHeader||_default}_getAgent(parsedUrl){let agent,proxyUrl=pm.getProxyUrl(parsedUrl),useProxy=proxyUrl&&proxyUrl.hostname;if(this._keepAlive&&useProxy&&(agent=this._proxyAgent),this._keepAlive&&!useProxy&&(agent=this._agent),agent)return agent;let usingSsl=parsedUrl.protocol==="https:",maxSockets=100;if(this.requestOptions&&(maxSockets=this.requestOptions.maxSockets||http3.globalAgent.maxSockets),proxyUrl&&proxyUrl.hostname){let agentOptions={maxSockets,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(proxyUrl.username||proxyUrl.password)&&{proxyAuth:`${proxyUrl.username}:${proxyUrl.password}`}),{host:proxyUrl.hostname,port:proxyUrl.port})},tunnelAgent,overHttps=proxyUrl.protocol==="https:";usingSsl?tunnelAgent=overHttps?tunnel.httpsOverHttps:tunnel.httpsOverHttp:tunnelAgent=overHttps?tunnel.httpOverHttps:tunnel.httpOverHttp,agent=tunnelAgent(agentOptions),this._proxyAgent=agent}if(this._keepAlive&&!agent){let options={keepAlive:this._keepAlive,maxSockets};agent=usingSsl?new https3.Agent(options):new http3.Agent(options),this._agent=agent}return agent||(agent=usingSsl?https3.globalAgent:http3.globalAgent),usingSsl&&this._ignoreSslError&&(agent.options=Object.assign(agent.options||{},{rejectUnauthorized:!1})),agent}_performExponentialBackoff(retryNumber){return __awaiter(this,void 0,void 0,function*(){retryNumber=Math.min(ExponentialBackoffCeiling,retryNumber);let ms=ExponentialBackoffTimeSlice*Math.pow(2,retryNumber);return new Promise(resolve=>setTimeout(()=>resolve(),ms))})}_processResponse(res,options){return __awaiter(this,void 0,void 0,function*(){return new Promise((resolve,reject)=>__awaiter(this,void 0,void 0,function*(){let statusCode=res.message.statusCode||0,response={statusCode,result:null,headers:{}};statusCode===HttpCodes.NotFound&&resolve(response);function dateTimeDeserializer(key,value){if(typeof value=="string"){let a=new Date(value);if(!isNaN(a.valueOf()))return a}return value}let obj,contents;try{contents=yield res.readBody(),contents&&contents.length>0&&(options&&options.deserializeDates?obj=JSON.parse(contents,dateTimeDeserializer):obj=JSON.parse(contents),response.result=obj),response.headers=res.message.headers}catch{}if(statusCode>299){let msg;obj&&obj.message?msg=obj.message:contents&&contents.length>0?msg=contents:msg=`Failed request: (${statusCode})`;let err=new HttpClientError(msg,statusCode);err.result=response.result,reject(err)}else resolve(response)}))})}};exports.HttpClient=HttpClient;var lowercaseKeys=obj=>Object.keys(obj).reduce((c,k)=>(c[k.toLowerCase()]=obj[k],c),{})}});var require_auth=__commonJS({"node_modules/.pnpm/@actions+http-client@2.1.0/node_modules/@actions/http-client/lib/auth.js"(exports){"use strict";var __awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0});exports.PersonalAccessTokenCredentialHandler=exports.BearerCredentialHandler=exports.BasicCredentialHandler=void 0;var BasicCredentialHandler=class{constructor(username,password){this.username=username,this.password=password}prepareRequest(options){if(!options.headers)throw Error("The request has no headers");options.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return __awaiter(this,void 0,void 0,function*(){throw new Error("not implemented")})}};exports.BasicCredentialHandler=BasicCredentialHandler;var BearerCredentialHandler=class{constructor(token){this.token=token}prepareRequest(options){if(!options.headers)throw Error("The request has no headers");options.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return __awaiter(this,void 0,void 0,function*(){throw new Error("not implemented")})}};exports.BearerCredentialHandler=BearerCredentialHandler;var PersonalAccessTokenCredentialHandler=class{constructor(token){this.token=token}prepareRequest(options){if(!options.headers)throw Error("The request has no headers");options.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return __awaiter(this,void 0,void 0,function*(){throw new Error("not implemented")})}};exports.PersonalAccessTokenCredentialHandler=PersonalAccessTokenCredentialHandler}});var require_oidc_utils=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/oidc-utils.js"(exports){"use strict";var __awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0});exports.OidcClient=void 0;var http_client_1=require_lib(),auth_1=require_auth(),core_1=require_core(),OidcClient=class _OidcClient{static createHttpClient(allowRetry=!0,maxRetry=10){let requestOptions={allowRetries:allowRetry,maxRetries:maxRetry};return new http_client_1.HttpClient("actions/oidc-client",[new auth_1.BearerCredentialHandler(_OidcClient.getRequestToken())],requestOptions)}static getRequestToken(){let token=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!token)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return token}static getIDTokenUrl(){let runtimeUrl=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!runtimeUrl)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return runtimeUrl}static getCall(id_token_url){var _a;return __awaiter(this,void 0,void 0,function*(){let id_token=(_a=(yield _OidcClient.createHttpClient().getJson(id_token_url).catch(error=>{throw new Error(`Failed to get ID Token. + + Error Code : ${error.statusCode} + + Error Message: ${error.result.message}`)})).result)===null||_a===void 0?void 0:_a.value;if(!id_token)throw new Error("Response json body do not have ID Token field");return id_token})}static getIDToken(audience){return __awaiter(this,void 0,void 0,function*(){try{let id_token_url=_OidcClient.getIDTokenUrl();if(audience){let encodedAudience=encodeURIComponent(audience);id_token_url=`${id_token_url}&audience=${encodedAudience}`}core_1.debug(`ID token url is ${id_token_url}`);let id_token=yield _OidcClient.getCall(id_token_url);return core_1.setSecret(id_token),id_token}catch(error){throw new Error(`Error message: ${error.message}`)}})}};exports.OidcClient=OidcClient}});var require_summary=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/summary.js"(exports){"use strict";var __awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0});exports.summary=exports.markdownSummary=exports.SUMMARY_DOCS_URL=exports.SUMMARY_ENV_VAR=void 0;var os_1=require("os"),fs_1=require("fs"),{access,appendFile,writeFile:writeFile2}=fs_1.promises;exports.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";exports.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var Summary=class{constructor(){this._buffer=""}filePath(){return __awaiter(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let pathFromEnv=process.env[exports.SUMMARY_ENV_VAR];if(!pathFromEnv)throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield access(pathFromEnv,fs_1.constants.R_OK|fs_1.constants.W_OK)}catch{throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`)}return this._filePath=pathFromEnv,this._filePath})}wrap(tag,content,attrs={}){let htmlAttrs=Object.entries(attrs).map(([key,value])=>` ${key}="${value}"`).join("");return content?`<${tag}${htmlAttrs}>${content}`:`<${tag}${htmlAttrs}>`}write(options){return __awaiter(this,void 0,void 0,function*(){let overwrite=!!options?.overwrite,filePath=yield this.filePath();return yield(overwrite?writeFile2:appendFile)(filePath,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return __awaiter(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(text,addEOL=!1){return this._buffer+=text,addEOL?this.addEOL():this}addEOL(){return this.addRaw(os_1.EOL)}addCodeBlock(code,lang){let attrs=Object.assign({},lang&&{lang}),element=this.wrap("pre",this.wrap("code",code),attrs);return this.addRaw(element).addEOL()}addList(items,ordered=!1){let tag=ordered?"ol":"ul",listItems=items.map(item=>this.wrap("li",item)).join(""),element=this.wrap(tag,listItems);return this.addRaw(element).addEOL()}addTable(rows){let tableBody=rows.map(row=>{let cells=row.map(cell=>{if(typeof cell=="string")return this.wrap("td",cell);let{header,data,colspan,rowspan}=cell,tag=header?"th":"td",attrs=Object.assign(Object.assign({},colspan&&{colspan}),rowspan&&{rowspan});return this.wrap(tag,data,attrs)}).join("");return this.wrap("tr",cells)}).join(""),element=this.wrap("table",tableBody);return this.addRaw(element).addEOL()}addDetails(label,content){let element=this.wrap("details",this.wrap("summary",label)+content);return this.addRaw(element).addEOL()}addImage(src,alt,options){let{width,height}=options||{},attrs=Object.assign(Object.assign({},width&&{width}),height&&{height}),element=this.wrap("img",null,Object.assign({src,alt},attrs));return this.addRaw(element).addEOL()}addHeading(text,level){let tag=`h${level}`,allowedTag=["h1","h2","h3","h4","h5","h6"].includes(tag)?tag:"h1",element=this.wrap(allowedTag,text);return this.addRaw(element).addEOL()}addSeparator(){let element=this.wrap("hr",null);return this.addRaw(element).addEOL()}addBreak(){let element=this.wrap("br",null);return this.addRaw(element).addEOL()}addQuote(text,cite){let attrs=Object.assign({},cite&&{cite}),element=this.wrap("blockquote",text,attrs);return this.addRaw(element).addEOL()}addLink(text,href){let element=this.wrap("a",text,{href});return this.addRaw(element).addEOL()}},_summary=new Summary;exports.markdownSummary=_summary;exports.summary=_summary}});var require_path_utils=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/path-utils.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result};Object.defineProperty(exports,"__esModule",{value:!0});exports.toPlatformPath=exports.toWin32Path=exports.toPosixPath=void 0;var path=__importStar(require("path"));function toPosixPath(pth){return pth.replace(/[\\]/g,"/")}exports.toPosixPath=toPosixPath;function toWin32Path(pth){return pth.replace(/[/]/g,"\\")}exports.toWin32Path=toWin32Path;function toPlatformPath(pth){return pth.replace(/[/\\]/g,path.sep)}exports.toPlatformPath=toPlatformPath}});var require_core=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/core.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0});exports.getIDToken=exports.getState=exports.saveState=exports.group=exports.endGroup=exports.startGroup=exports.info=exports.notice=exports.warning=exports.error=exports.debug=exports.isDebug=exports.setFailed=exports.setCommandEcho=exports.setOutput=exports.getBooleanInput=exports.getMultilineInput=exports.getInput=exports.addPath=exports.setSecret=exports.exportVariable=exports.ExitCode=void 0;var command_1=require_command(),file_command_1=require_file_command(),utils_1=require_utils(),os=__importStar(require("os")),path=__importStar(require("path")),oidc_utils_1=require_oidc_utils(),ExitCode;(function(ExitCode2){ExitCode2[ExitCode2.Success=0]="Success",ExitCode2[ExitCode2.Failure=1]="Failure"})(ExitCode=exports.ExitCode||(exports.ExitCode={}));function exportVariable(name,val){let convertedVal=utils_1.toCommandValue(val);if(process.env[name]=convertedVal,process.env.GITHUB_ENV||"")return file_command_1.issueFileCommand("ENV",file_command_1.prepareKeyValueMessage(name,val));command_1.issueCommand("set-env",{name},convertedVal)}exports.exportVariable=exportVariable;function setSecret(secret){command_1.issueCommand("add-mask",{},secret)}exports.setSecret=setSecret;function addPath(inputPath){process.env.GITHUB_PATH||""?file_command_1.issueFileCommand("PATH",inputPath):command_1.issueCommand("add-path",{},inputPath),process.env.PATH=`${inputPath}${path.delimiter}${process.env.PATH}`}exports.addPath=addPath;function getInput3(name,options){let val=process.env[`INPUT_${name.replace(/ /g,"_").toUpperCase()}`]||"";if(options&&options.required&&!val)throw new Error(`Input required and not supplied: ${name}`);return options&&options.trimWhitespace===!1?val:val.trim()}exports.getInput=getInput3;function getMultilineInput(name,options){let inputs=getInput3(name,options).split(` +`).filter(x2=>x2!=="");return options&&options.trimWhitespace===!1?inputs:inputs.map(input=>input.trim())}exports.getMultilineInput=getMultilineInput;function getBooleanInput(name,options){let trueValue=["true","True","TRUE"],falseValue=["false","False","FALSE"],val=getInput3(name,options);if(trueValue.includes(val))return!0;if(falseValue.includes(val))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} +Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}exports.getBooleanInput=getBooleanInput;function setOutput(name,value){if(process.env.GITHUB_OUTPUT||"")return file_command_1.issueFileCommand("OUTPUT",file_command_1.prepareKeyValueMessage(name,value));process.stdout.write(os.EOL),command_1.issueCommand("set-output",{name},utils_1.toCommandValue(value))}exports.setOutput=setOutput;function setCommandEcho(enabled){command_1.issue("echo",enabled?"on":"off")}exports.setCommandEcho=setCommandEcho;function setFailed4(message){process.exitCode=ExitCode.Failure,error(message)}exports.setFailed=setFailed4;function isDebug(){return process.env.RUNNER_DEBUG==="1"}exports.isDebug=isDebug;function debug(message){command_1.issueCommand("debug",{},message)}exports.debug=debug;function error(message,properties={}){command_1.issueCommand("error",utils_1.toCommandProperties(properties),message instanceof Error?message.toString():message)}exports.error=error;function warning(message,properties={}){command_1.issueCommand("warning",utils_1.toCommandProperties(properties),message instanceof Error?message.toString():message)}exports.warning=warning;function notice(message,properties={}){command_1.issueCommand("notice",utils_1.toCommandProperties(properties),message instanceof Error?message.toString():message)}exports.notice=notice;function info4(message){process.stdout.write(message+os.EOL)}exports.info=info4;function startGroup4(name){command_1.issue("group",name)}exports.startGroup=startGroup4;function endGroup4(){command_1.issue("endgroup")}exports.endGroup=endGroup4;function group(name,fn){return __awaiter(this,void 0,void 0,function*(){startGroup4(name);let result;try{result=yield fn()}finally{endGroup4()}return result})}exports.group=group;function saveState3(name,value){if(process.env.GITHUB_STATE||"")return file_command_1.issueFileCommand("STATE",file_command_1.prepareKeyValueMessage(name,value));command_1.issueCommand("save-state",{name},utils_1.toCommandValue(value))}exports.saveState=saveState3;function getState3(name){return process.env[`STATE_${name}`]||""}exports.getState=getState3;function getIDToken(aud){return __awaiter(this,void 0,void 0,function*(){return yield oidc_utils_1.OidcClient.getIDToken(aud)})}exports.getIDToken=getIDToken;var summary_1=require_summary();Object.defineProperty(exports,"summary",{enumerable:!0,get:function(){return summary_1.summary}});var summary_2=require_summary();Object.defineProperty(exports,"markdownSummary",{enumerable:!0,get:function(){return summary_2.markdownSummary}});var path_utils_1=require_path_utils();Object.defineProperty(exports,"toPosixPath",{enumerable:!0,get:function(){return path_utils_1.toPosixPath}});Object.defineProperty(exports,"toWin32Path",{enumerable:!0,get:function(){return path_utils_1.toWin32Path}});Object.defineProperty(exports,"toPlatformPath",{enumerable:!0,get:function(){return path_utils_1.toPlatformPath}})}});var require_io_util=__commonJS({"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},_a;Object.defineProperty(exports,"__esModule",{value:!0});exports.getCmdPath=exports.tryGetExecutablePath=exports.isRooted=exports.isDirectory=exports.exists=exports.READONLY=exports.UV_FS_O_EXLOCK=exports.IS_WINDOWS=exports.unlink=exports.symlink=exports.stat=exports.rmdir=exports.rm=exports.rename=exports.readlink=exports.readdir=exports.open=exports.mkdir=exports.lstat=exports.copyFile=exports.chmod=void 0;var fs=__importStar(require("fs")),path=__importStar(require("path"));_a=fs.promises,exports.chmod=_a.chmod,exports.copyFile=_a.copyFile,exports.lstat=_a.lstat,exports.mkdir=_a.mkdir,exports.open=_a.open,exports.readdir=_a.readdir,exports.readlink=_a.readlink,exports.rename=_a.rename,exports.rm=_a.rm,exports.rmdir=_a.rmdir,exports.stat=_a.stat,exports.symlink=_a.symlink,exports.unlink=_a.unlink;exports.IS_WINDOWS=process.platform==="win32";exports.UV_FS_O_EXLOCK=268435456;exports.READONLY=fs.constants.O_RDONLY;function exists(fsPath){return __awaiter(this,void 0,void 0,function*(){try{yield exports.stat(fsPath)}catch(err){if(err.code==="ENOENT")return!1;throw err}return!0})}exports.exists=exists;function isDirectory(fsPath,useStat=!1){return __awaiter(this,void 0,void 0,function*(){return(useStat?yield exports.stat(fsPath):yield exports.lstat(fsPath)).isDirectory()})}exports.isDirectory=isDirectory;function isRooted(p){if(p=normalizeSeparators(p),!p)throw new Error('isRooted() parameter "p" cannot be empty');return exports.IS_WINDOWS?p.startsWith("\\")||/^[A-Z]:/i.test(p):p.startsWith("/")}exports.isRooted=isRooted;function tryGetExecutablePath(filePath,extensions){return __awaiter(this,void 0,void 0,function*(){let stats;try{stats=yield exports.stat(filePath)}catch(err){err.code!=="ENOENT"&&console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`)}if(stats&&stats.isFile()){if(exports.IS_WINDOWS){let upperExt=path.extname(filePath).toUpperCase();if(extensions.some(validExt=>validExt.toUpperCase()===upperExt))return filePath}else if(isUnixExecutable(stats))return filePath}let originalFilePath=filePath;for(let extension of extensions){filePath=originalFilePath+extension,stats=void 0;try{stats=yield exports.stat(filePath)}catch(err){err.code!=="ENOENT"&&console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`)}if(stats&&stats.isFile()){if(exports.IS_WINDOWS){try{let directory=path.dirname(filePath),upperName=path.basename(filePath).toUpperCase();for(let actualName of yield exports.readdir(directory))if(upperName===actualName.toUpperCase()){filePath=path.join(directory,actualName);break}}catch(err){console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`)}return filePath}else if(isUnixExecutable(stats))return filePath}}return""})}exports.tryGetExecutablePath=tryGetExecutablePath;function normalizeSeparators(p){return p=p||"",exports.IS_WINDOWS?(p=p.replace(/\//g,"\\"),p.replace(/\\\\+/g,"\\")):p.replace(/\/\/+/g,"/")}function isUnixExecutable(stats){return(stats.mode&1)>0||(stats.mode&8)>0&&stats.gid===process.getgid()||(stats.mode&64)>0&&stats.uid===process.getuid()}function getCmdPath(){var _a2;return(_a2=process.env.COMSPEC)!==null&&_a2!==void 0?_a2:"cmd.exe"}exports.getCmdPath=getCmdPath}});var require_io=__commonJS({"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0});exports.findInPath=exports.which=exports.mkdirP=exports.rmRF=exports.mv=exports.cp=void 0;var assert_1=require("assert"),path=__importStar(require("path")),ioUtil=__importStar(require_io_util());function cp(source,dest,options={}){return __awaiter(this,void 0,void 0,function*(){let{force,recursive,copySourceDirectory}=readCopyOptions(options),destStat=(yield ioUtil.exists(dest))?yield ioUtil.stat(dest):null;if(destStat&&destStat.isFile()&&!force)return;let newDest=destStat&&destStat.isDirectory()&©SourceDirectory?path.join(dest,path.basename(source)):dest;if(!(yield ioUtil.exists(source)))throw new Error(`no such file or directory: ${source}`);if((yield ioUtil.stat(source)).isDirectory())if(recursive)yield cpDirRecursive(source,newDest,0,force);else throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);else{if(path.relative(source,newDest)==="")throw new Error(`'${newDest}' and '${source}' are the same file`);yield copyFile(source,newDest,force)}})}exports.cp=cp;function mv(source,dest,options={}){return __awaiter(this,void 0,void 0,function*(){if(yield ioUtil.exists(dest)){let destExists=!0;if((yield ioUtil.isDirectory(dest))&&(dest=path.join(dest,path.basename(source)),destExists=yield ioUtil.exists(dest)),destExists)if(options.force==null||options.force)yield rmRF(dest);else throw new Error("Destination already exists")}yield mkdirP(path.dirname(dest)),yield ioUtil.rename(source,dest)})}exports.mv=mv;function rmRF(inputPath){return __awaiter(this,void 0,void 0,function*(){if(ioUtil.IS_WINDOWS&&/[*"<>|]/.test(inputPath))throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');try{yield ioUtil.rm(inputPath,{force:!0,maxRetries:3,recursive:!0,retryDelay:300})}catch(err){throw new Error(`File was unable to be removed ${err}`)}})}exports.rmRF=rmRF;function mkdirP(fsPath){return __awaiter(this,void 0,void 0,function*(){assert_1.ok(fsPath,"a path argument must be provided"),yield ioUtil.mkdir(fsPath,{recursive:!0})})}exports.mkdirP=mkdirP;function which(tool,check){return __awaiter(this,void 0,void 0,function*(){if(!tool)throw new Error("parameter 'tool' is required");if(check){let result=yield which(tool,!1);if(!result)throw ioUtil.IS_WINDOWS?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.`):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.`);return result}let matches=yield findInPath(tool);return matches&&matches.length>0?matches[0]:""})}exports.which=which;function findInPath(tool){return __awaiter(this,void 0,void 0,function*(){if(!tool)throw new Error("parameter 'tool' is required");let extensions=[];if(ioUtil.IS_WINDOWS&&process.env.PATHEXT)for(let extension of process.env.PATHEXT.split(path.delimiter))extension&&extensions.push(extension);if(ioUtil.isRooted(tool)){let filePath=yield ioUtil.tryGetExecutablePath(tool,extensions);return filePath?[filePath]:[]}if(tool.includes(path.sep))return[];let directories=[];if(process.env.PATH)for(let p of process.env.PATH.split(path.delimiter))p&&directories.push(p);let matches=[];for(let directory of directories){let filePath=yield ioUtil.tryGetExecutablePath(path.join(directory,tool),extensions);filePath&&matches.push(filePath)}return matches})}exports.findInPath=findInPath;function readCopyOptions(options){let force=options.force==null?!0:options.force,recursive=!!options.recursive,copySourceDirectory=options.copySourceDirectory==null?!0:!!options.copySourceDirectory;return{force,recursive,copySourceDirectory}}function cpDirRecursive(sourceDir,destDir,currentDepth,force){return __awaiter(this,void 0,void 0,function*(){if(currentDepth>=255)return;currentDepth++,yield mkdirP(destDir);let files=yield ioUtil.readdir(sourceDir);for(let fileName of files){let srcFile=`${sourceDir}/${fileName}`,destFile=`${destDir}/${fileName}`;(yield ioUtil.lstat(srcFile)).isDirectory()?yield cpDirRecursive(srcFile,destFile,currentDepth,force):yield copyFile(srcFile,destFile,force)}yield ioUtil.chmod(destDir,(yield ioUtil.stat(sourceDir)).mode)})}function copyFile(srcFile,destFile,force){return __awaiter(this,void 0,void 0,function*(){if((yield ioUtil.lstat(srcFile)).isSymbolicLink()){try{yield ioUtil.lstat(destFile),yield ioUtil.unlink(destFile)}catch(e2){e2.code==="EPERM"&&(yield ioUtil.chmod(destFile,"0666"),yield ioUtil.unlink(destFile))}let symlinkFull=yield ioUtil.readlink(srcFile);yield ioUtil.symlink(symlinkFull,destFile,ioUtil.IS_WINDOWS?"junction":null)}else(!(yield ioUtil.exists(destFile))||force)&&(yield ioUtil.copyFile(srcFile,destFile))})}}});var require_toolrunner=__commonJS({"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/toolrunner.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0});exports.argStringToArray=exports.ToolRunner=void 0;var os=__importStar(require("os")),events=__importStar(require("events")),child=__importStar(require("child_process")),path=__importStar(require("path")),io=__importStar(require_io()),ioUtil=__importStar(require_io_util()),timers_1=require("timers"),IS_WINDOWS=process.platform==="win32",ToolRunner=class extends events.EventEmitter{constructor(toolPath,args,options){if(super(),!toolPath)throw new Error("Parameter 'toolPath' cannot be null or empty.");this.toolPath=toolPath,this.args=args||[],this.options=options||{}}_debug(message){this.options.listeners&&this.options.listeners.debug&&this.options.listeners.debug(message)}_getCommandString(options,noPrefix){let toolPath=this._getSpawnFileName(),args=this._getSpawnArgs(options),cmd=noPrefix?"":"[command]";if(IS_WINDOWS)if(this._isCmdFile()){cmd+=toolPath;for(let a of args)cmd+=` ${a}`}else if(options.windowsVerbatimArguments){cmd+=`"${toolPath}"`;for(let a of args)cmd+=` ${a}`}else{cmd+=this._windowsQuoteCmdArg(toolPath);for(let a of args)cmd+=` ${this._windowsQuoteCmdArg(a)}`}else{cmd+=toolPath;for(let a of args)cmd+=` ${a}`}return cmd}_processLineBuffer(data,strBuffer,onLine){try{let s2=strBuffer+data.toString(),n=s2.indexOf(os.EOL);for(;n>-1;){let line=s2.substring(0,n);onLine(line),s2=s2.substring(n+os.EOL.length),n=s2.indexOf(os.EOL)}return s2}catch(err){return this._debug(`error processing line. Failed with error ${err}`),""}}_getSpawnFileName(){return IS_WINDOWS&&this._isCmdFile()?process.env.COMSPEC||"cmd.exe":this.toolPath}_getSpawnArgs(options){if(IS_WINDOWS&&this._isCmdFile()){let argline=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(let a of this.args)argline+=" ",argline+=options.windowsVerbatimArguments?a:this._windowsQuoteCmdArg(a);return argline+='"',[argline]}return this.args}_endsWith(str,end){return str.endsWith(end)}_isCmdFile(){let upperToolPath=this.toolPath.toUpperCase();return this._endsWith(upperToolPath,".CMD")||this._endsWith(upperToolPath,".BAT")}_windowsQuoteCmdArg(arg){if(!this._isCmdFile())return this._uvQuoteCmdArg(arg);if(!arg)return'""';let cmdSpecialChars=[" "," ","&","(",")","[","]","{","}","^","=",";","!","'","+",",","`","~","|","<",">",'"'],needsQuotes=!1;for(let char of arg)if(cmdSpecialChars.some(x2=>x2===char)){needsQuotes=!0;break}if(!needsQuotes)return arg;let reverse='"',quoteHit=!0;for(let i2=arg.length;i2>0;i2--)reverse+=arg[i2-1],quoteHit&&arg[i2-1]==="\\"?reverse+="\\":arg[i2-1]==='"'?(quoteHit=!0,reverse+='"'):quoteHit=!1;return reverse+='"',reverse.split("").reverse().join("")}_uvQuoteCmdArg(arg){if(!arg)return'""';if(!arg.includes(" ")&&!arg.includes(" ")&&!arg.includes('"'))return arg;if(!arg.includes('"')&&!arg.includes("\\"))return`"${arg}"`;let reverse='"',quoteHit=!0;for(let i2=arg.length;i2>0;i2--)reverse+=arg[i2-1],quoteHit&&arg[i2-1]==="\\"?reverse+="\\":arg[i2-1]==='"'?(quoteHit=!0,reverse+="\\"):quoteHit=!1;return reverse+='"',reverse.split("").reverse().join("")}_cloneExecOptions(options){options=options||{};let result={cwd:options.cwd||process.cwd(),env:options.env||process.env,silent:options.silent||!1,windowsVerbatimArguments:options.windowsVerbatimArguments||!1,failOnStdErr:options.failOnStdErr||!1,ignoreReturnCode:options.ignoreReturnCode||!1,delay:options.delay||1e4};return result.outStream=options.outStream||process.stdout,result.errStream=options.errStream||process.stderr,result}_getSpawnOptions(options,toolPath){options=options||{};let result={};return result.cwd=options.cwd,result.env=options.env,result.windowsVerbatimArguments=options.windowsVerbatimArguments||this._isCmdFile(),options.windowsVerbatimArguments&&(result.argv0=`"${toolPath}"`),result}exec(){return __awaiter(this,void 0,void 0,function*(){return!ioUtil.isRooted(this.toolPath)&&(this.toolPath.includes("/")||IS_WINDOWS&&this.toolPath.includes("\\"))&&(this.toolPath=path.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath)),this.toolPath=yield io.which(this.toolPath,!0),new Promise((resolve,reject)=>__awaiter(this,void 0,void 0,function*(){this._debug(`exec tool: ${this.toolPath}`),this._debug("arguments:");for(let arg of this.args)this._debug(` ${arg}`);let optionsNonNull=this._cloneExecOptions(this.options);!optionsNonNull.silent&&optionsNonNull.outStream&&optionsNonNull.outStream.write(this._getCommandString(optionsNonNull)+os.EOL);let state=new ExecState(optionsNonNull,this.toolPath);if(state.on("debug",message=>{this._debug(message)}),this.options.cwd&&!(yield ioUtil.exists(this.options.cwd)))return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));let fileName=this._getSpawnFileName(),cp=child.spawn(fileName,this._getSpawnArgs(optionsNonNull),this._getSpawnOptions(this.options,fileName)),stdbuffer="";cp.stdout&&cp.stdout.on("data",data=>{this.options.listeners&&this.options.listeners.stdout&&this.options.listeners.stdout(data),!optionsNonNull.silent&&optionsNonNull.outStream&&optionsNonNull.outStream.write(data),stdbuffer=this._processLineBuffer(data,stdbuffer,line=>{this.options.listeners&&this.options.listeners.stdline&&this.options.listeners.stdline(line)})});let errbuffer="";if(cp.stderr&&cp.stderr.on("data",data=>{state.processStderr=!0,this.options.listeners&&this.options.listeners.stderr&&this.options.listeners.stderr(data),!optionsNonNull.silent&&optionsNonNull.errStream&&optionsNonNull.outStream&&(optionsNonNull.failOnStdErr?optionsNonNull.errStream:optionsNonNull.outStream).write(data),errbuffer=this._processLineBuffer(data,errbuffer,line=>{this.options.listeners&&this.options.listeners.errline&&this.options.listeners.errline(line)})}),cp.on("error",err=>{state.processError=err.message,state.processExited=!0,state.processClosed=!0,state.CheckComplete()}),cp.on("exit",code=>{state.processExitCode=code,state.processExited=!0,this._debug(`Exit code ${code} received from tool '${this.toolPath}'`),state.CheckComplete()}),cp.on("close",code=>{state.processExitCode=code,state.processExited=!0,state.processClosed=!0,this._debug(`STDIO streams have closed for tool '${this.toolPath}'`),state.CheckComplete()}),state.on("done",(error,exitCode)=>{stdbuffer.length>0&&this.emit("stdline",stdbuffer),errbuffer.length>0&&this.emit("errline",errbuffer),cp.removeAllListeners(),error?reject(error):resolve(exitCode)}),this.options.input){if(!cp.stdin)throw new Error("child process missing stdin");cp.stdin.end(this.options.input)}}))})}};exports.ToolRunner=ToolRunner;function argStringToArray(argString){let args=[],inQuotes=!1,escaped=!1,arg="";function append(c){escaped&&c!=='"'&&(arg+="\\"),arg+=c,escaped=!1}for(let i2=0;i20&&(args.push(arg),arg="");continue}append(c)}return arg.length>0&&args.push(arg.trim()),args}exports.argStringToArray=argStringToArray;var ExecState=class _ExecState extends events.EventEmitter{constructor(options,toolPath){if(super(),this.processClosed=!1,this.processError="",this.processExitCode=0,this.processExited=!1,this.processStderr=!1,this.delay=1e4,this.done=!1,this.timeout=null,!toolPath)throw new Error("toolPath must not be empty");this.options=options,this.toolPath=toolPath,options.delay&&(this.delay=options.delay)}CheckComplete(){this.done||(this.processClosed?this._setResult():this.processExited&&(this.timeout=timers_1.setTimeout(_ExecState.HandleTimeout,this.delay,this)))}_debug(message){this.emit("debug",message)}_setResult(){let error;this.processExited&&(this.processError?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}`):this.processExitCode!==0&&!this.options.ignoreReturnCode?error=new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`):this.processStderr&&this.options.failOnStdErr&&(error=new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`))),this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.done=!0,this.emit("done",error,this.processExitCode)}static HandleTimeout(state){if(!state.done){if(!state.processClosed&&state.processExited){let message=`The STDIO streams did not close within ${state.delay/1e3} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;state._debug(message)}state._setResult()}}}}});var require_exec=__commonJS({"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0});exports.getExecOutput=exports.exec=void 0;var string_decoder_1=require("string_decoder"),tr=__importStar(require_toolrunner());function exec5(commandLine,args,options){return __awaiter(this,void 0,void 0,function*(){let commandArgs=tr.argStringToArray(commandLine);if(commandArgs.length===0)throw new Error("Parameter 'commandLine' cannot be null or empty.");let toolPath=commandArgs[0];return args=commandArgs.slice(1).concat(args||[]),new tr.ToolRunner(toolPath,args,options).exec()})}exports.exec=exec5;function getExecOutput(commandLine,args,options){var _a,_b;return __awaiter(this,void 0,void 0,function*(){let stdout="",stderr="",stdoutDecoder=new string_decoder_1.StringDecoder("utf8"),stderrDecoder=new string_decoder_1.StringDecoder("utf8"),originalStdoutListener=(_a=options?.listeners)===null||_a===void 0?void 0:_a.stdout,originalStdErrListener=(_b=options?.listeners)===null||_b===void 0?void 0:_b.stderr,stdErrListener=data=>{stderr+=stderrDecoder.write(data),originalStdErrListener&&originalStdErrListener(data)},stdOutListener=data=>{stdout+=stdoutDecoder.write(data),originalStdoutListener&&originalStdoutListener(data)},listeners=Object.assign(Object.assign({},options?.listeners),{stdout:stdOutListener,stderr:stdErrListener}),exitCode=yield exec5(commandLine,args,Object.assign(Object.assign({},options),{listeners}));return stdout+=stdoutDecoder.end(),stderr+=stderrDecoder.end(),{exitCode,stdout,stderr}})}exports.getExecOutput=getExecOutput}});var multipart_parser_exports={};__export(multipart_parser_exports,{toFormData:()=>toFormData});function _fileName(headerValue){let m2=headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!m2)return;let match=m2[2]||m2[3]||"",filename=match.slice(match.lastIndexOf("\\")+1);return filename=filename.replace(/%22/g,'"'),filename=filename.replace(/&#(\d{4});/g,(m3,code)=>String.fromCharCode(code)),filename}async function toFormData(Body2,ct){if(!/multipart/i.test(ct))throw new TypeError("Failed to fetch");let m2=ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!m2)throw new TypeError("no or bad content-type header, no multipart boundary");let parser=new MultipartParser(m2[1]||m2[2]),headerField,headerValue,entryValue,entryName,contentType,filename,entryChunks=[],formData=new FormData,onPartData=ui8a=>{entryValue+=decoder.decode(ui8a,{stream:!0})},appendToFile=ui8a=>{entryChunks.push(ui8a)},appendFileToFormData=()=>{let file=new File$1(entryChunks,filename,{type:contentType});formData.append(entryName,file)},appendEntryToFormData=()=>{formData.append(entryName,entryValue)},decoder=new TextDecoder("utf-8");decoder.decode(),parser.onPartBegin=function(){parser.onPartData=onPartData,parser.onPartEnd=appendEntryToFormData,headerField="",headerValue="",entryValue="",entryName="",contentType="",filename=null,entryChunks.length=0},parser.onHeaderField=function(ui8a){headerField+=decoder.decode(ui8a,{stream:!0})},parser.onHeaderValue=function(ui8a){headerValue+=decoder.decode(ui8a,{stream:!0})},parser.onHeaderEnd=function(){if(headerValue+=decoder.decode(),headerField=headerField.toLowerCase(),headerField==="content-disposition"){let m3=headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);m3&&(entryName=m3[2]||m3[3]||""),filename=_fileName(headerValue),filename&&(parser.onPartData=appendToFile,parser.onPartEnd=appendFileToFormData)}else headerField==="content-type"&&(contentType=headerValue);headerValue="",headerField=""};for await(let chunk of Body2)parser.write(chunk);return parser.end(),formData}var s,S,f,F,LF,CR,SPACE,HYPHEN,COLON,A,Z,lower,noop,MultipartParser,init_multipart_parser=__esm({"node_modules/.pnpm/node-fetch-native@1.2.0/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs"(){init_node_fetch_native_d7878b77();s=0,S={START_BOUNDARY:s++,HEADER_FIELD_START:s++,HEADER_FIELD:s++,HEADER_VALUE_START:s++,HEADER_VALUE:s++,HEADER_VALUE_ALMOST_DONE:s++,HEADERS_ALMOST_DONE:s++,PART_DATA_START:s++,PART_DATA:s++,END:s++},f=1,F={PART_BOUNDARY:f,LAST_BOUNDARY:f*=2},LF=10,CR=13,SPACE=32,HYPHEN=45,COLON=58,A=97,Z=122,lower=c=>c|32,noop=()=>{},MultipartParser=class{constructor(boundary){this.index=0,this.flags=0,this.onHeaderEnd=noop,this.onHeaderField=noop,this.onHeadersEnd=noop,this.onHeaderValue=noop,this.onPartBegin=noop,this.onPartData=noop,this.onPartEnd=noop,this.boundaryChars={},boundary=`\r +--`+boundary;let ui8a=new Uint8Array(boundary.length);for(let i2=0;i2{this[name+"Mark"]=i2},clear=name=>{delete this[name+"Mark"]},callback=(callbackSymbol,start,end,ui8a)=>{(start===void 0||start!==end)&&this[callbackSymbol](ui8a&&ui8a.subarray(start,end))},dataCallback=(name,clear2)=>{let markSymbol=name+"Mark";markSymbol in this&&(clear2?(callback(name,this[markSymbol],i2,data),delete this[markSymbol]):(callback(name,this[markSymbol],data.length,data),this[markSymbol]=0))};for(i2=0;i2Z)return;break;case S.HEADER_VALUE_START:if(c===SPACE)break;mark("onHeaderValue"),state=S.HEADER_VALUE;case S.HEADER_VALUE:c===CR&&(dataCallback("onHeaderValue",!0),callback("onHeaderEnd"),state=S.HEADER_VALUE_ALMOST_DONE);break;case S.HEADER_VALUE_ALMOST_DONE:if(c!==LF)return;state=S.HEADER_FIELD_START;break;case S.HEADERS_ALMOST_DONE:if(c!==LF)return;callback("onHeadersEnd"),state=S.PART_DATA_START;break;case S.PART_DATA_START:state=S.PART_DATA,mark("onPartData");case S.PART_DATA:if(previousIndex=index,index===0){for(i2+=boundaryEnd;i20)lookbehind[index-1]=c;else if(previousIndex>0){let _lookbehind=new Uint8Array(lookbehind.buffer,lookbehind.byteOffset,lookbehind.byteLength);callback("onPartData",0,previousIndex,_lookbehind),previousIndex=0,mark("onPartData"),i2--}break;case S.END:break;default:throw new Error(`Unexpected state entered: ${state}`)}dataCallback("onHeaderField"),dataCallback("onHeaderValue"),dataCallback("onPartData"),this.index=index,this.state=state,this.flags=flags}end(){if(this.state===S.HEADER_FIELD_START&&this.index===0||this.state===S.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==S.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}}});function dataUriToBuffer(uri){if(!/^data:/i.test(uri))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');uri=uri.replace(/\r?\n/g,"");let firstComma=uri.indexOf(",");if(firstComma===-1||firstComma<=4)throw new TypeError("malformed data: URI");let meta=uri.substring(5,firstComma).split(";"),charset="",base64=!1,type=meta[0]||"text/plain",typeFull=type;for(let i2=1;i2`Symbol(${description})`;function noop2(){}function getGlobals(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof commonjsGlobal<"u")return commonjsGlobal}let globals=getGlobals();function typeIsObject(x2){return typeof x2=="object"&&x2!==null||typeof x2=="function"}let rethrowAssertionErrorRejection=noop2,originalPromise=Promise,originalPromiseThen=Promise.prototype.then,originalPromiseResolve=Promise.resolve.bind(originalPromise),originalPromiseReject=Promise.reject.bind(originalPromise);function newPromise(executor){return new originalPromise(executor)}function promiseResolvedWith(value){return originalPromiseResolve(value)}function promiseRejectedWith(reason){return originalPromiseReject(reason)}function PerformPromiseThen(promise,onFulfilled,onRejected){return originalPromiseThen.call(promise,onFulfilled,onRejected)}function uponPromise(promise,onFulfilled,onRejected){PerformPromiseThen(PerformPromiseThen(promise,onFulfilled,onRejected),void 0,rethrowAssertionErrorRejection)}function uponFulfillment(promise,onFulfilled){uponPromise(promise,onFulfilled)}function uponRejection(promise,onRejected){uponPromise(promise,void 0,onRejected)}function transformPromiseWith(promise,fulfillmentHandler,rejectionHandler){return PerformPromiseThen(promise,fulfillmentHandler,rejectionHandler)}function setPromiseIsHandledToTrue(promise){PerformPromiseThen(promise,void 0,rethrowAssertionErrorRejection)}let queueMicrotask=(()=>{let globalQueueMicrotask=globals&&globals.queueMicrotask;if(typeof globalQueueMicrotask=="function")return globalQueueMicrotask;let resolvedPromise=promiseResolvedWith(void 0);return fn=>PerformPromiseThen(resolvedPromise,fn)})();function reflectCall(F2,V,args){if(typeof F2!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(F2,V,args)}function promiseCall(F2,V,args){try{return promiseResolvedWith(reflectCall(F2,V,args))}catch(value){return promiseRejectedWith(value)}}let QUEUE_MAX_ARRAY_SIZE=16384;class SimpleQueue{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(element){let oldBack=this._back,newBack=oldBack;oldBack._elements.length===QUEUE_MAX_ARRAY_SIZE-1&&(newBack={_elements:[],_next:void 0}),oldBack._elements.push(element),newBack!==oldBack&&(this._back=newBack,oldBack._next=newBack),++this._size}shift(){let oldFront=this._front,newFront=oldFront,oldCursor=this._cursor,newCursor=oldCursor+1,elements=oldFront._elements,element=elements[oldCursor];return newCursor===QUEUE_MAX_ARRAY_SIZE&&(newFront=oldFront._next,newCursor=0),--this._size,this._cursor=newCursor,oldFront!==newFront&&(this._front=newFront),elements[oldCursor]=void 0,element}forEach(callback){let i2=this._cursor,node=this._front,elements=node._elements;for(;(i2!==elements.length||node._next!==void 0)&&!(i2===elements.length&&(node=node._next,elements=node._elements,i2=0,elements.length===0));)callback(elements[i2]),++i2}peek(){let front=this._front,cursor=this._cursor;return front._elements[cursor]}}function ReadableStreamReaderGenericInitialize(reader,stream){reader._ownerReadableStream=stream,stream._reader=reader,stream._state==="readable"?defaultReaderClosedPromiseInitialize(reader):stream._state==="closed"?defaultReaderClosedPromiseInitializeAsResolved(reader):defaultReaderClosedPromiseInitializeAsRejected(reader,stream._storedError)}function ReadableStreamReaderGenericCancel(reader,reason){let stream=reader._ownerReadableStream;return ReadableStreamCancel(stream,reason)}function ReadableStreamReaderGenericRelease(reader){reader._ownerReadableStream._state==="readable"?defaultReaderClosedPromiseReject(reader,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):defaultReaderClosedPromiseResetToRejected(reader,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),reader._ownerReadableStream._reader=void 0,reader._ownerReadableStream=void 0}function readerLockException(name){return new TypeError("Cannot "+name+" a stream using a released reader")}function defaultReaderClosedPromiseInitialize(reader){reader._closedPromise=newPromise((resolve,reject)=>{reader._closedPromise_resolve=resolve,reader._closedPromise_reject=reject})}function defaultReaderClosedPromiseInitializeAsRejected(reader,reason){defaultReaderClosedPromiseInitialize(reader),defaultReaderClosedPromiseReject(reader,reason)}function defaultReaderClosedPromiseInitializeAsResolved(reader){defaultReaderClosedPromiseInitialize(reader),defaultReaderClosedPromiseResolve(reader)}function defaultReaderClosedPromiseReject(reader,reason){reader._closedPromise_reject!==void 0&&(setPromiseIsHandledToTrue(reader._closedPromise),reader._closedPromise_reject(reason),reader._closedPromise_resolve=void 0,reader._closedPromise_reject=void 0)}function defaultReaderClosedPromiseResetToRejected(reader,reason){defaultReaderClosedPromiseInitializeAsRejected(reader,reason)}function defaultReaderClosedPromiseResolve(reader){reader._closedPromise_resolve!==void 0&&(reader._closedPromise_resolve(void 0),reader._closedPromise_resolve=void 0,reader._closedPromise_reject=void 0)}let AbortSteps=SymbolPolyfill("[[AbortSteps]]"),ErrorSteps=SymbolPolyfill("[[ErrorSteps]]"),CancelSteps=SymbolPolyfill("[[CancelSteps]]"),PullSteps=SymbolPolyfill("[[PullSteps]]"),NumberIsFinite=Number.isFinite||function(x2){return typeof x2=="number"&&isFinite(x2)},MathTrunc=Math.trunc||function(v){return v<0?Math.ceil(v):Math.floor(v)};function isDictionary(x2){return typeof x2=="object"||typeof x2=="function"}function assertDictionary(obj,context){if(obj!==void 0&&!isDictionary(obj))throw new TypeError(`${context} is not an object.`)}function assertFunction(x2,context){if(typeof x2!="function")throw new TypeError(`${context} is not a function.`)}function isObject2(x2){return typeof x2=="object"&&x2!==null||typeof x2=="function"}function assertObject(x2,context){if(!isObject2(x2))throw new TypeError(`${context} is not an object.`)}function assertRequiredArgument(x2,position,context){if(x2===void 0)throw new TypeError(`Parameter ${position} is required in '${context}'.`)}function assertRequiredField(x2,field,context){if(x2===void 0)throw new TypeError(`${field} is required in '${context}'.`)}function convertUnrestrictedDouble(value){return Number(value)}function censorNegativeZero(x2){return x2===0?0:x2}function integerPart(x2){return censorNegativeZero(MathTrunc(x2))}function convertUnsignedLongLongWithEnforceRange(value,context){let upperBound=Number.MAX_SAFE_INTEGER,x2=Number(value);if(x2=censorNegativeZero(x2),!NumberIsFinite(x2))throw new TypeError(`${context} is not a finite number`);if(x2=integerPart(x2),x2<0||x2>upperBound)throw new TypeError(`${context} is outside the accepted range of 0 to ${upperBound}, inclusive`);return!NumberIsFinite(x2)||x2===0?0:x2}function assertReadableStream(x2,context){if(!IsReadableStream(x2))throw new TypeError(`${context} is not a ReadableStream.`)}function AcquireReadableStreamDefaultReader(stream){return new ReadableStreamDefaultReader(stream)}function ReadableStreamAddReadRequest(stream,readRequest){stream._reader._readRequests.push(readRequest)}function ReadableStreamFulfillReadRequest(stream,chunk,done){let readRequest=stream._reader._readRequests.shift();done?readRequest._closeSteps():readRequest._chunkSteps(chunk)}function ReadableStreamGetNumReadRequests(stream){return stream._reader._readRequests.length}function ReadableStreamHasDefaultReader(stream){let reader=stream._reader;return!(reader===void 0||!IsReadableStreamDefaultReader(reader))}class ReadableStreamDefaultReader{constructor(stream){if(assertRequiredArgument(stream,1,"ReadableStreamDefaultReader"),assertReadableStream(stream,"First parameter"),IsReadableStreamLocked(stream))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ReadableStreamReaderGenericInitialize(this,stream),this._readRequests=new SimpleQueue}get closed(){return IsReadableStreamDefaultReader(this)?this._closedPromise:promiseRejectedWith(defaultReaderBrandCheckException("closed"))}cancel(reason=void 0){return IsReadableStreamDefaultReader(this)?this._ownerReadableStream===void 0?promiseRejectedWith(readerLockException("cancel")):ReadableStreamReaderGenericCancel(this,reason):promiseRejectedWith(defaultReaderBrandCheckException("cancel"))}read(){if(!IsReadableStreamDefaultReader(this))return promiseRejectedWith(defaultReaderBrandCheckException("read"));if(this._ownerReadableStream===void 0)return promiseRejectedWith(readerLockException("read from"));let resolvePromise,rejectPromise,promise=newPromise((resolve,reject)=>{resolvePromise=resolve,rejectPromise=reject});return ReadableStreamDefaultReaderRead(this,{_chunkSteps:chunk=>resolvePromise({value:chunk,done:!1}),_closeSteps:()=>resolvePromise({value:void 0,done:!0}),_errorSteps:e2=>rejectPromise(e2)}),promise}releaseLock(){if(!IsReadableStreamDefaultReader(this))throw defaultReaderBrandCheckException("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ReadableStreamReaderGenericRelease(this)}}}Object.defineProperties(ReadableStreamDefaultReader.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(ReadableStreamDefaultReader.prototype,SymbolPolyfill.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function IsReadableStreamDefaultReader(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_readRequests")?!1:x2 instanceof ReadableStreamDefaultReader}function ReadableStreamDefaultReaderRead(reader,readRequest){let stream=reader._ownerReadableStream;stream._disturbed=!0,stream._state==="closed"?readRequest._closeSteps():stream._state==="errored"?readRequest._errorSteps(stream._storedError):stream._readableStreamController[PullSteps](readRequest)}function defaultReaderBrandCheckException(name){return new TypeError(`ReadableStreamDefaultReader.prototype.${name} can only be used on a ReadableStreamDefaultReader`)}let AsyncIteratorPrototype=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class ReadableStreamAsyncIteratorImpl{constructor(reader,preventCancel){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=reader,this._preventCancel=preventCancel}next(){let nextSteps=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?transformPromiseWith(this._ongoingPromise,nextSteps,nextSteps):nextSteps(),this._ongoingPromise}return(value){let returnSteps=()=>this._returnSteps(value);return this._ongoingPromise?transformPromiseWith(this._ongoingPromise,returnSteps,returnSteps):returnSteps()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let reader=this._reader;if(reader._ownerReadableStream===void 0)return promiseRejectedWith(readerLockException("iterate"));let resolvePromise,rejectPromise,promise=newPromise((resolve,reject)=>{resolvePromise=resolve,rejectPromise=reject});return ReadableStreamDefaultReaderRead(reader,{_chunkSteps:chunk=>{this._ongoingPromise=void 0,queueMicrotask(()=>resolvePromise({value:chunk,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,ReadableStreamReaderGenericRelease(reader),resolvePromise({value:void 0,done:!0})},_errorSteps:reason=>{this._ongoingPromise=void 0,this._isFinished=!0,ReadableStreamReaderGenericRelease(reader),rejectPromise(reason)}}),promise}_returnSteps(value){if(this._isFinished)return Promise.resolve({value,done:!0});this._isFinished=!0;let reader=this._reader;if(reader._ownerReadableStream===void 0)return promiseRejectedWith(readerLockException("finish iterating"));if(!this._preventCancel){let result=ReadableStreamReaderGenericCancel(reader,value);return ReadableStreamReaderGenericRelease(reader),transformPromiseWith(result,()=>({value,done:!0}))}return ReadableStreamReaderGenericRelease(reader),promiseResolvedWith({value,done:!0})}}let ReadableStreamAsyncIteratorPrototype={next(){return IsReadableStreamAsyncIterator(this)?this._asyncIteratorImpl.next():promiseRejectedWith(streamAsyncIteratorBrandCheckException("next"))},return(value){return IsReadableStreamAsyncIterator(this)?this._asyncIteratorImpl.return(value):promiseRejectedWith(streamAsyncIteratorBrandCheckException("return"))}};AsyncIteratorPrototype!==void 0&&Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype,AsyncIteratorPrototype);function AcquireReadableStreamAsyncIterator(stream,preventCancel){let reader=AcquireReadableStreamDefaultReader(stream),impl=new ReadableStreamAsyncIteratorImpl(reader,preventCancel),iterator=Object.create(ReadableStreamAsyncIteratorPrototype);return iterator._asyncIteratorImpl=impl,iterator}function IsReadableStreamAsyncIterator(x2){if(!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_asyncIteratorImpl"))return!1;try{return x2._asyncIteratorImpl instanceof ReadableStreamAsyncIteratorImpl}catch{return!1}}function streamAsyncIteratorBrandCheckException(name){return new TypeError(`ReadableStreamAsyncIterator.${name} can only be used on a ReadableSteamAsyncIterator`)}let NumberIsNaN=Number.isNaN||function(x2){return x2!==x2};function CreateArrayFromList(elements){return elements.slice()}function CopyDataBlockBytes(dest,destOffset,src,srcOffset,n){new Uint8Array(dest).set(new Uint8Array(src,srcOffset,n),destOffset)}function TransferArrayBuffer(O){return O}function IsDetachedBuffer(O){return!1}function ArrayBufferSlice(buffer,begin,end){if(buffer.slice)return buffer.slice(begin,end);let length=end-begin,slice=new ArrayBuffer(length);return CopyDataBlockBytes(slice,0,buffer,begin,length),slice}function IsNonNegativeNumber(v){return!(typeof v!="number"||NumberIsNaN(v)||v<0)}function CloneAsUint8Array(O){let buffer=ArrayBufferSlice(O.buffer,O.byteOffset,O.byteOffset+O.byteLength);return new Uint8Array(buffer)}function DequeueValue(container){let pair=container._queue.shift();return container._queueTotalSize-=pair.size,container._queueTotalSize<0&&(container._queueTotalSize=0),pair.value}function EnqueueValueWithSize(container,value,size){if(!IsNonNegativeNumber(size)||size===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");container._queue.push({value,size}),container._queueTotalSize+=size}function PeekQueueValue(container){return container._queue.peek().value}function ResetQueue(container){container._queue=new SimpleQueue,container._queueTotalSize=0}class ReadableStreamBYOBRequest{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!IsReadableStreamBYOBRequest(this))throw byobRequestBrandCheckException("view");return this._view}respond(bytesWritten){if(!IsReadableStreamBYOBRequest(this))throw byobRequestBrandCheckException("respond");if(assertRequiredArgument(bytesWritten,1,"respond"),bytesWritten=convertUnsignedLongLongWithEnforceRange(bytesWritten,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");IsDetachedBuffer(this._view.buffer),ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController,bytesWritten)}respondWithNewView(view){if(!IsReadableStreamBYOBRequest(this))throw byobRequestBrandCheckException("respondWithNewView");if(assertRequiredArgument(view,1,"respondWithNewView"),!ArrayBuffer.isView(view))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");IsDetachedBuffer(view.buffer),ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController,view)}}Object.defineProperties(ReadableStreamBYOBRequest.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(ReadableStreamBYOBRequest.prototype,SymbolPolyfill.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class ReadableByteStreamController{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("byobRequest");return ReadableByteStreamControllerGetBYOBRequest(this)}get desiredSize(){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("desiredSize");return ReadableByteStreamControllerGetDesiredSize(this)}close(){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let state=this._controlledReadableByteStream._state;if(state!=="readable")throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be closed`);ReadableByteStreamControllerClose(this)}enqueue(chunk){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("enqueue");if(assertRequiredArgument(chunk,1,"enqueue"),!ArrayBuffer.isView(chunk))throw new TypeError("chunk must be an array buffer view");if(chunk.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(chunk.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");let state=this._controlledReadableByteStream._state;if(state!=="readable")throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be enqueued to`);ReadableByteStreamControllerEnqueue(this,chunk)}error(e2=void 0){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("error");ReadableByteStreamControllerError(this,e2)}[CancelSteps](reason){ReadableByteStreamControllerClearPendingPullIntos(this),ResetQueue(this);let result=this._cancelAlgorithm(reason);return ReadableByteStreamControllerClearAlgorithms(this),result}[PullSteps](readRequest){let stream=this._controlledReadableByteStream;if(this._queueTotalSize>0){let entry=this._queue.shift();this._queueTotalSize-=entry.byteLength,ReadableByteStreamControllerHandleQueueDrain(this);let view=new Uint8Array(entry.buffer,entry.byteOffset,entry.byteLength);readRequest._chunkSteps(view);return}let autoAllocateChunkSize=this._autoAllocateChunkSize;if(autoAllocateChunkSize!==void 0){let buffer;try{buffer=new ArrayBuffer(autoAllocateChunkSize)}catch(bufferE){readRequest._errorSteps(bufferE);return}let pullIntoDescriptor={buffer,bufferByteLength:autoAllocateChunkSize,byteOffset:0,byteLength:autoAllocateChunkSize,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(pullIntoDescriptor)}ReadableStreamAddReadRequest(stream,readRequest),ReadableByteStreamControllerCallPullIfNeeded(this)}}Object.defineProperties(ReadableByteStreamController.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(ReadableByteStreamController.prototype,SymbolPolyfill.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function IsReadableByteStreamController(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_controlledReadableByteStream")?!1:x2 instanceof ReadableByteStreamController}function IsReadableStreamBYOBRequest(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_associatedReadableByteStreamController")?!1:x2 instanceof ReadableStreamBYOBRequest}function ReadableByteStreamControllerCallPullIfNeeded(controller){if(!ReadableByteStreamControllerShouldCallPull(controller))return;if(controller._pulling){controller._pullAgain=!0;return}controller._pulling=!0;let pullPromise=controller._pullAlgorithm();uponPromise(pullPromise,()=>{controller._pulling=!1,controller._pullAgain&&(controller._pullAgain=!1,ReadableByteStreamControllerCallPullIfNeeded(controller))},e2=>{ReadableByteStreamControllerError(controller,e2)})}function ReadableByteStreamControllerClearPendingPullIntos(controller){ReadableByteStreamControllerInvalidateBYOBRequest(controller),controller._pendingPullIntos=new SimpleQueue}function ReadableByteStreamControllerCommitPullIntoDescriptor(stream,pullIntoDescriptor){let done=!1;stream._state==="closed"&&(done=!0);let filledView=ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);pullIntoDescriptor.readerType==="default"?ReadableStreamFulfillReadRequest(stream,filledView,done):ReadableStreamFulfillReadIntoRequest(stream,filledView,done)}function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor){let bytesFilled=pullIntoDescriptor.bytesFilled,elementSize=pullIntoDescriptor.elementSize;return new pullIntoDescriptor.viewConstructor(pullIntoDescriptor.buffer,pullIntoDescriptor.byteOffset,bytesFilled/elementSize)}function ReadableByteStreamControllerEnqueueChunkToQueue(controller,buffer,byteOffset,byteLength){controller._queue.push({buffer,byteOffset,byteLength}),controller._queueTotalSize+=byteLength}function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller,pullIntoDescriptor){let elementSize=pullIntoDescriptor.elementSize,currentAlignedBytes=pullIntoDescriptor.bytesFilled-pullIntoDescriptor.bytesFilled%elementSize,maxBytesToCopy=Math.min(controller._queueTotalSize,pullIntoDescriptor.byteLength-pullIntoDescriptor.bytesFilled),maxBytesFilled=pullIntoDescriptor.bytesFilled+maxBytesToCopy,maxAlignedBytes=maxBytesFilled-maxBytesFilled%elementSize,totalBytesToCopyRemaining=maxBytesToCopy,ready=!1;maxAlignedBytes>currentAlignedBytes&&(totalBytesToCopyRemaining=maxAlignedBytes-pullIntoDescriptor.bytesFilled,ready=!0);let queue=controller._queue;for(;totalBytesToCopyRemaining>0;){let headOfQueue=queue.peek(),bytesToCopy=Math.min(totalBytesToCopyRemaining,headOfQueue.byteLength),destStart=pullIntoDescriptor.byteOffset+pullIntoDescriptor.bytesFilled;CopyDataBlockBytes(pullIntoDescriptor.buffer,destStart,headOfQueue.buffer,headOfQueue.byteOffset,bytesToCopy),headOfQueue.byteLength===bytesToCopy?queue.shift():(headOfQueue.byteOffset+=bytesToCopy,headOfQueue.byteLength-=bytesToCopy),controller._queueTotalSize-=bytesToCopy,ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller,bytesToCopy,pullIntoDescriptor),totalBytesToCopyRemaining-=bytesToCopy}return ready}function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller,size,pullIntoDescriptor){pullIntoDescriptor.bytesFilled+=size}function ReadableByteStreamControllerHandleQueueDrain(controller){controller._queueTotalSize===0&&controller._closeRequested?(ReadableByteStreamControllerClearAlgorithms(controller),ReadableStreamClose(controller._controlledReadableByteStream)):ReadableByteStreamControllerCallPullIfNeeded(controller)}function ReadableByteStreamControllerInvalidateBYOBRequest(controller){controller._byobRequest!==null&&(controller._byobRequest._associatedReadableByteStreamController=void 0,controller._byobRequest._view=null,controller._byobRequest=null)}function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller){for(;controller._pendingPullIntos.length>0;){if(controller._queueTotalSize===0)return;let pullIntoDescriptor=controller._pendingPullIntos.peek();ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller,pullIntoDescriptor)&&(ReadableByteStreamControllerShiftPendingPullInto(controller),ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream,pullIntoDescriptor))}}function ReadableByteStreamControllerPullInto(controller,view,readIntoRequest){let stream=controller._controlledReadableByteStream,elementSize=1;view.constructor!==DataView&&(elementSize=view.constructor.BYTES_PER_ELEMENT);let ctor=view.constructor,buffer=view.buffer,pullIntoDescriptor={buffer,bufferByteLength:buffer.byteLength,byteOffset:view.byteOffset,byteLength:view.byteLength,bytesFilled:0,elementSize,viewConstructor:ctor,readerType:"byob"};if(controller._pendingPullIntos.length>0){controller._pendingPullIntos.push(pullIntoDescriptor),ReadableStreamAddReadIntoRequest(stream,readIntoRequest);return}if(stream._state==="closed"){let emptyView=new ctor(pullIntoDescriptor.buffer,pullIntoDescriptor.byteOffset,0);readIntoRequest._closeSteps(emptyView);return}if(controller._queueTotalSize>0){if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller,pullIntoDescriptor)){let filledView=ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);ReadableByteStreamControllerHandleQueueDrain(controller),readIntoRequest._chunkSteps(filledView);return}if(controller._closeRequested){let e2=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(controller,e2),readIntoRequest._errorSteps(e2);return}}controller._pendingPullIntos.push(pullIntoDescriptor),ReadableStreamAddReadIntoRequest(stream,readIntoRequest),ReadableByteStreamControllerCallPullIfNeeded(controller)}function ReadableByteStreamControllerRespondInClosedState(controller,firstDescriptor){let stream=controller._controlledReadableByteStream;if(ReadableStreamHasBYOBReader(stream))for(;ReadableStreamGetNumReadIntoRequests(stream)>0;){let pullIntoDescriptor=ReadableByteStreamControllerShiftPendingPullInto(controller);ReadableByteStreamControllerCommitPullIntoDescriptor(stream,pullIntoDescriptor)}}function ReadableByteStreamControllerRespondInReadableState(controller,bytesWritten,pullIntoDescriptor){if(ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller,bytesWritten,pullIntoDescriptor),pullIntoDescriptor.bytesFilled0){let end=pullIntoDescriptor.byteOffset+pullIntoDescriptor.bytesFilled,remainder=ArrayBufferSlice(pullIntoDescriptor.buffer,end-remainderSize,end);ReadableByteStreamControllerEnqueueChunkToQueue(controller,remainder,0,remainder.byteLength)}pullIntoDescriptor.bytesFilled-=remainderSize,ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream,pullIntoDescriptor),ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller)}function ReadableByteStreamControllerRespondInternal(controller,bytesWritten){let firstDescriptor=controller._pendingPullIntos.peek();ReadableByteStreamControllerInvalidateBYOBRequest(controller),controller._controlledReadableByteStream._state==="closed"?ReadableByteStreamControllerRespondInClosedState(controller):ReadableByteStreamControllerRespondInReadableState(controller,bytesWritten,firstDescriptor),ReadableByteStreamControllerCallPullIfNeeded(controller)}function ReadableByteStreamControllerShiftPendingPullInto(controller){return controller._pendingPullIntos.shift()}function ReadableByteStreamControllerShouldCallPull(controller){let stream=controller._controlledReadableByteStream;return stream._state!=="readable"||controller._closeRequested||!controller._started?!1:!!(ReadableStreamHasDefaultReader(stream)&&ReadableStreamGetNumReadRequests(stream)>0||ReadableStreamHasBYOBReader(stream)&&ReadableStreamGetNumReadIntoRequests(stream)>0||ReadableByteStreamControllerGetDesiredSize(controller)>0)}function ReadableByteStreamControllerClearAlgorithms(controller){controller._pullAlgorithm=void 0,controller._cancelAlgorithm=void 0}function ReadableByteStreamControllerClose(controller){let stream=controller._controlledReadableByteStream;if(!(controller._closeRequested||stream._state!=="readable")){if(controller._queueTotalSize>0){controller._closeRequested=!0;return}if(controller._pendingPullIntos.length>0&&controller._pendingPullIntos.peek().bytesFilled>0){let e2=new TypeError("Insufficient bytes to fill elements in the given buffer");throw ReadableByteStreamControllerError(controller,e2),e2}ReadableByteStreamControllerClearAlgorithms(controller),ReadableStreamClose(stream)}}function ReadableByteStreamControllerEnqueue(controller,chunk){let stream=controller._controlledReadableByteStream;if(controller._closeRequested||stream._state!=="readable")return;let buffer=chunk.buffer,byteOffset=chunk.byteOffset,byteLength=chunk.byteLength,transferredBuffer=buffer;if(controller._pendingPullIntos.length>0){let firstPendingPullInto=controller._pendingPullIntos.peek();IsDetachedBuffer(firstPendingPullInto.buffer),firstPendingPullInto.buffer=firstPendingPullInto.buffer}if(ReadableByteStreamControllerInvalidateBYOBRequest(controller),ReadableStreamHasDefaultReader(stream))if(ReadableStreamGetNumReadRequests(stream)===0)ReadableByteStreamControllerEnqueueChunkToQueue(controller,transferredBuffer,byteOffset,byteLength);else{controller._pendingPullIntos.length>0&&ReadableByteStreamControllerShiftPendingPullInto(controller);let transferredView=new Uint8Array(transferredBuffer,byteOffset,byteLength);ReadableStreamFulfillReadRequest(stream,transferredView,!1)}else ReadableStreamHasBYOBReader(stream)?(ReadableByteStreamControllerEnqueueChunkToQueue(controller,transferredBuffer,byteOffset,byteLength),ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller)):ReadableByteStreamControllerEnqueueChunkToQueue(controller,transferredBuffer,byteOffset,byteLength);ReadableByteStreamControllerCallPullIfNeeded(controller)}function ReadableByteStreamControllerError(controller,e2){let stream=controller._controlledReadableByteStream;stream._state==="readable"&&(ReadableByteStreamControllerClearPendingPullIntos(controller),ResetQueue(controller),ReadableByteStreamControllerClearAlgorithms(controller),ReadableStreamError(stream,e2))}function ReadableByteStreamControllerGetBYOBRequest(controller){if(controller._byobRequest===null&&controller._pendingPullIntos.length>0){let firstDescriptor=controller._pendingPullIntos.peek(),view=new Uint8Array(firstDescriptor.buffer,firstDescriptor.byteOffset+firstDescriptor.bytesFilled,firstDescriptor.byteLength-firstDescriptor.bytesFilled),byobRequest=Object.create(ReadableStreamBYOBRequest.prototype);SetUpReadableStreamBYOBRequest(byobRequest,controller,view),controller._byobRequest=byobRequest}return controller._byobRequest}function ReadableByteStreamControllerGetDesiredSize(controller){let state=controller._controlledReadableByteStream._state;return state==="errored"?null:state==="closed"?0:controller._strategyHWM-controller._queueTotalSize}function ReadableByteStreamControllerRespond(controller,bytesWritten){let firstDescriptor=controller._pendingPullIntos.peek();if(controller._controlledReadableByteStream._state==="closed"){if(bytesWritten!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(bytesWritten===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(firstDescriptor.bytesFilled+bytesWritten>firstDescriptor.byteLength)throw new RangeError("bytesWritten out of range")}firstDescriptor.buffer=firstDescriptor.buffer,ReadableByteStreamControllerRespondInternal(controller,bytesWritten)}function ReadableByteStreamControllerRespondWithNewView(controller,view){let firstDescriptor=controller._pendingPullIntos.peek();if(controller._controlledReadableByteStream._state==="closed"){if(view.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(view.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(firstDescriptor.byteOffset+firstDescriptor.bytesFilled!==view.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(firstDescriptor.bufferByteLength!==view.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(firstDescriptor.bytesFilled+view.byteLength>firstDescriptor.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let viewByteLength=view.byteLength;firstDescriptor.buffer=view.buffer,ReadableByteStreamControllerRespondInternal(controller,viewByteLength)}function SetUpReadableByteStreamController(stream,controller,startAlgorithm,pullAlgorithm,cancelAlgorithm,highWaterMark,autoAllocateChunkSize){controller._controlledReadableByteStream=stream,controller._pullAgain=!1,controller._pulling=!1,controller._byobRequest=null,controller._queue=controller._queueTotalSize=void 0,ResetQueue(controller),controller._closeRequested=!1,controller._started=!1,controller._strategyHWM=highWaterMark,controller._pullAlgorithm=pullAlgorithm,controller._cancelAlgorithm=cancelAlgorithm,controller._autoAllocateChunkSize=autoAllocateChunkSize,controller._pendingPullIntos=new SimpleQueue,stream._readableStreamController=controller;let startResult=startAlgorithm();uponPromise(promiseResolvedWith(startResult),()=>{controller._started=!0,ReadableByteStreamControllerCallPullIfNeeded(controller)},r3=>{ReadableByteStreamControllerError(controller,r3)})}function SetUpReadableByteStreamControllerFromUnderlyingSource(stream,underlyingByteSource,highWaterMark){let controller=Object.create(ReadableByteStreamController.prototype),startAlgorithm=()=>{},pullAlgorithm=()=>promiseResolvedWith(void 0),cancelAlgorithm=()=>promiseResolvedWith(void 0);underlyingByteSource.start!==void 0&&(startAlgorithm=()=>underlyingByteSource.start(controller)),underlyingByteSource.pull!==void 0&&(pullAlgorithm=()=>underlyingByteSource.pull(controller)),underlyingByteSource.cancel!==void 0&&(cancelAlgorithm=reason=>underlyingByteSource.cancel(reason));let autoAllocateChunkSize=underlyingByteSource.autoAllocateChunkSize;if(autoAllocateChunkSize===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");SetUpReadableByteStreamController(stream,controller,startAlgorithm,pullAlgorithm,cancelAlgorithm,highWaterMark,autoAllocateChunkSize)}function SetUpReadableStreamBYOBRequest(request,controller,view){request._associatedReadableByteStreamController=controller,request._view=view}function byobRequestBrandCheckException(name){return new TypeError(`ReadableStreamBYOBRequest.prototype.${name} can only be used on a ReadableStreamBYOBRequest`)}function byteStreamControllerBrandCheckException(name){return new TypeError(`ReadableByteStreamController.prototype.${name} can only be used on a ReadableByteStreamController`)}function AcquireReadableStreamBYOBReader(stream){return new ReadableStreamBYOBReader(stream)}function ReadableStreamAddReadIntoRequest(stream,readIntoRequest){stream._reader._readIntoRequests.push(readIntoRequest)}function ReadableStreamFulfillReadIntoRequest(stream,chunk,done){let readIntoRequest=stream._reader._readIntoRequests.shift();done?readIntoRequest._closeSteps(chunk):readIntoRequest._chunkSteps(chunk)}function ReadableStreamGetNumReadIntoRequests(stream){return stream._reader._readIntoRequests.length}function ReadableStreamHasBYOBReader(stream){let reader=stream._reader;return!(reader===void 0||!IsReadableStreamBYOBReader(reader))}class ReadableStreamBYOBReader{constructor(stream){if(assertRequiredArgument(stream,1,"ReadableStreamBYOBReader"),assertReadableStream(stream,"First parameter"),IsReadableStreamLocked(stream))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!IsReadableByteStreamController(stream._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ReadableStreamReaderGenericInitialize(this,stream),this._readIntoRequests=new SimpleQueue}get closed(){return IsReadableStreamBYOBReader(this)?this._closedPromise:promiseRejectedWith(byobReaderBrandCheckException("closed"))}cancel(reason=void 0){return IsReadableStreamBYOBReader(this)?this._ownerReadableStream===void 0?promiseRejectedWith(readerLockException("cancel")):ReadableStreamReaderGenericCancel(this,reason):promiseRejectedWith(byobReaderBrandCheckException("cancel"))}read(view){if(!IsReadableStreamBYOBReader(this))return promiseRejectedWith(byobReaderBrandCheckException("read"));if(!ArrayBuffer.isView(view))return promiseRejectedWith(new TypeError("view must be an array buffer view"));if(view.byteLength===0)return promiseRejectedWith(new TypeError("view must have non-zero byteLength"));if(view.buffer.byteLength===0)return promiseRejectedWith(new TypeError("view's buffer must have non-zero byteLength"));if(IsDetachedBuffer(view.buffer),this._ownerReadableStream===void 0)return promiseRejectedWith(readerLockException("read from"));let resolvePromise,rejectPromise,promise=newPromise((resolve,reject)=>{resolvePromise=resolve,rejectPromise=reject});return ReadableStreamBYOBReaderRead(this,view,{_chunkSteps:chunk=>resolvePromise({value:chunk,done:!1}),_closeSteps:chunk=>resolvePromise({value:chunk,done:!0}),_errorSteps:e2=>rejectPromise(e2)}),promise}releaseLock(){if(!IsReadableStreamBYOBReader(this))throw byobReaderBrandCheckException("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ReadableStreamReaderGenericRelease(this)}}}Object.defineProperties(ReadableStreamBYOBReader.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(ReadableStreamBYOBReader.prototype,SymbolPolyfill.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function IsReadableStreamBYOBReader(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_readIntoRequests")?!1:x2 instanceof ReadableStreamBYOBReader}function ReadableStreamBYOBReaderRead(reader,view,readIntoRequest){let stream=reader._ownerReadableStream;stream._disturbed=!0,stream._state==="errored"?readIntoRequest._errorSteps(stream._storedError):ReadableByteStreamControllerPullInto(stream._readableStreamController,view,readIntoRequest)}function byobReaderBrandCheckException(name){return new TypeError(`ReadableStreamBYOBReader.prototype.${name} can only be used on a ReadableStreamBYOBReader`)}function ExtractHighWaterMark(strategy,defaultHWM){let{highWaterMark}=strategy;if(highWaterMark===void 0)return defaultHWM;if(NumberIsNaN(highWaterMark)||highWaterMark<0)throw new RangeError("Invalid highWaterMark");return highWaterMark}function ExtractSizeAlgorithm(strategy){let{size}=strategy;return size||(()=>1)}function convertQueuingStrategy(init,context){assertDictionary(init,context);let highWaterMark=init?.highWaterMark,size=init?.size;return{highWaterMark:highWaterMark===void 0?void 0:convertUnrestrictedDouble(highWaterMark),size:size===void 0?void 0:convertQueuingStrategySize(size,`${context} has member 'size' that`)}}function convertQueuingStrategySize(fn,context){return assertFunction(fn,context),chunk=>convertUnrestrictedDouble(fn(chunk))}function convertUnderlyingSink(original,context){assertDictionary(original,context);let abort=original?.abort,close=original?.close,start=original?.start,type=original?.type,write=original?.write;return{abort:abort===void 0?void 0:convertUnderlyingSinkAbortCallback(abort,original,`${context} has member 'abort' that`),close:close===void 0?void 0:convertUnderlyingSinkCloseCallback(close,original,`${context} has member 'close' that`),start:start===void 0?void 0:convertUnderlyingSinkStartCallback(start,original,`${context} has member 'start' that`),write:write===void 0?void 0:convertUnderlyingSinkWriteCallback(write,original,`${context} has member 'write' that`),type}}function convertUnderlyingSinkAbortCallback(fn,original,context){return assertFunction(fn,context),reason=>promiseCall(fn,original,[reason])}function convertUnderlyingSinkCloseCallback(fn,original,context){return assertFunction(fn,context),()=>promiseCall(fn,original,[])}function convertUnderlyingSinkStartCallback(fn,original,context){return assertFunction(fn,context),controller=>reflectCall(fn,original,[controller])}function convertUnderlyingSinkWriteCallback(fn,original,context){return assertFunction(fn,context),(chunk,controller)=>promiseCall(fn,original,[chunk,controller])}function assertWritableStream(x2,context){if(!IsWritableStream(x2))throw new TypeError(`${context} is not a WritableStream.`)}function isAbortSignal2(value){if(typeof value!="object"||value===null)return!1;try{return typeof value.aborted=="boolean"}catch{return!1}}let supportsAbortController=typeof AbortController=="function";function createAbortController(){if(supportsAbortController)return new AbortController}class WritableStream{constructor(rawUnderlyingSink={},rawStrategy={}){rawUnderlyingSink===void 0?rawUnderlyingSink=null:assertObject(rawUnderlyingSink,"First parameter");let strategy=convertQueuingStrategy(rawStrategy,"Second parameter"),underlyingSink=convertUnderlyingSink(rawUnderlyingSink,"First parameter");if(InitializeWritableStream(this),underlyingSink.type!==void 0)throw new RangeError("Invalid type is specified");let sizeAlgorithm=ExtractSizeAlgorithm(strategy),highWaterMark=ExtractHighWaterMark(strategy,1);SetUpWritableStreamDefaultControllerFromUnderlyingSink(this,underlyingSink,highWaterMark,sizeAlgorithm)}get locked(){if(!IsWritableStream(this))throw streamBrandCheckException$2("locked");return IsWritableStreamLocked(this)}abort(reason=void 0){return IsWritableStream(this)?IsWritableStreamLocked(this)?promiseRejectedWith(new TypeError("Cannot abort a stream that already has a writer")):WritableStreamAbort(this,reason):promiseRejectedWith(streamBrandCheckException$2("abort"))}close(){return IsWritableStream(this)?IsWritableStreamLocked(this)?promiseRejectedWith(new TypeError("Cannot close a stream that already has a writer")):WritableStreamCloseQueuedOrInFlight(this)?promiseRejectedWith(new TypeError("Cannot close an already-closing stream")):WritableStreamClose(this):promiseRejectedWith(streamBrandCheckException$2("close"))}getWriter(){if(!IsWritableStream(this))throw streamBrandCheckException$2("getWriter");return AcquireWritableStreamDefaultWriter(this)}}Object.defineProperties(WritableStream.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(WritableStream.prototype,SymbolPolyfill.toStringTag,{value:"WritableStream",configurable:!0});function AcquireWritableStreamDefaultWriter(stream){return new WritableStreamDefaultWriter(stream)}function CreateWritableStream(startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,highWaterMark=1,sizeAlgorithm=()=>1){let stream=Object.create(WritableStream.prototype);InitializeWritableStream(stream);let controller=Object.create(WritableStreamDefaultController.prototype);return SetUpWritableStreamDefaultController(stream,controller,startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,highWaterMark,sizeAlgorithm),stream}function InitializeWritableStream(stream){stream._state="writable",stream._storedError=void 0,stream._writer=void 0,stream._writableStreamController=void 0,stream._writeRequests=new SimpleQueue,stream._inFlightWriteRequest=void 0,stream._closeRequest=void 0,stream._inFlightCloseRequest=void 0,stream._pendingAbortRequest=void 0,stream._backpressure=!1}function IsWritableStream(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_writableStreamController")?!1:x2 instanceof WritableStream}function IsWritableStreamLocked(stream){return stream._writer!==void 0}function WritableStreamAbort(stream,reason){var _a;if(stream._state==="closed"||stream._state==="errored")return promiseResolvedWith(void 0);stream._writableStreamController._abortReason=reason,(_a=stream._writableStreamController._abortController)===null||_a===void 0||_a.abort();let state=stream._state;if(state==="closed"||state==="errored")return promiseResolvedWith(void 0);if(stream._pendingAbortRequest!==void 0)return stream._pendingAbortRequest._promise;let wasAlreadyErroring=!1;state==="erroring"&&(wasAlreadyErroring=!0,reason=void 0);let promise=newPromise((resolve,reject)=>{stream._pendingAbortRequest={_promise:void 0,_resolve:resolve,_reject:reject,_reason:reason,_wasAlreadyErroring:wasAlreadyErroring}});return stream._pendingAbortRequest._promise=promise,wasAlreadyErroring||WritableStreamStartErroring(stream,reason),promise}function WritableStreamClose(stream){let state=stream._state;if(state==="closed"||state==="errored")return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`));let promise=newPromise((resolve,reject)=>{let closeRequest={_resolve:resolve,_reject:reject};stream._closeRequest=closeRequest}),writer=stream._writer;return writer!==void 0&&stream._backpressure&&state==="writable"&&defaultWriterReadyPromiseResolve(writer),WritableStreamDefaultControllerClose(stream._writableStreamController),promise}function WritableStreamAddWriteRequest(stream){return newPromise((resolve,reject)=>{let writeRequest={_resolve:resolve,_reject:reject};stream._writeRequests.push(writeRequest)})}function WritableStreamDealWithRejection(stream,error){if(stream._state==="writable"){WritableStreamStartErroring(stream,error);return}WritableStreamFinishErroring(stream)}function WritableStreamStartErroring(stream,reason){let controller=stream._writableStreamController;stream._state="erroring",stream._storedError=reason;let writer=stream._writer;writer!==void 0&&WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer,reason),!WritableStreamHasOperationMarkedInFlight(stream)&&controller._started&&WritableStreamFinishErroring(stream)}function WritableStreamFinishErroring(stream){stream._state="errored",stream._writableStreamController[ErrorSteps]();let storedError=stream._storedError;if(stream._writeRequests.forEach(writeRequest=>{writeRequest._reject(storedError)}),stream._writeRequests=new SimpleQueue,stream._pendingAbortRequest===void 0){WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);return}let abortRequest=stream._pendingAbortRequest;if(stream._pendingAbortRequest=void 0,abortRequest._wasAlreadyErroring){abortRequest._reject(storedError),WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);return}let promise=stream._writableStreamController[AbortSteps](abortRequest._reason);uponPromise(promise,()=>{abortRequest._resolve(),WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream)},reason=>{abortRequest._reject(reason),WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream)})}function WritableStreamFinishInFlightWrite(stream){stream._inFlightWriteRequest._resolve(void 0),stream._inFlightWriteRequest=void 0}function WritableStreamFinishInFlightWriteWithError(stream,error){stream._inFlightWriteRequest._reject(error),stream._inFlightWriteRequest=void 0,WritableStreamDealWithRejection(stream,error)}function WritableStreamFinishInFlightClose(stream){stream._inFlightCloseRequest._resolve(void 0),stream._inFlightCloseRequest=void 0,stream._state==="erroring"&&(stream._storedError=void 0,stream._pendingAbortRequest!==void 0&&(stream._pendingAbortRequest._resolve(),stream._pendingAbortRequest=void 0)),stream._state="closed";let writer=stream._writer;writer!==void 0&&defaultWriterClosedPromiseResolve(writer)}function WritableStreamFinishInFlightCloseWithError(stream,error){stream._inFlightCloseRequest._reject(error),stream._inFlightCloseRequest=void 0,stream._pendingAbortRequest!==void 0&&(stream._pendingAbortRequest._reject(error),stream._pendingAbortRequest=void 0),WritableStreamDealWithRejection(stream,error)}function WritableStreamCloseQueuedOrInFlight(stream){return!(stream._closeRequest===void 0&&stream._inFlightCloseRequest===void 0)}function WritableStreamHasOperationMarkedInFlight(stream){return!(stream._inFlightWriteRequest===void 0&&stream._inFlightCloseRequest===void 0)}function WritableStreamMarkCloseRequestInFlight(stream){stream._inFlightCloseRequest=stream._closeRequest,stream._closeRequest=void 0}function WritableStreamMarkFirstWriteRequestInFlight(stream){stream._inFlightWriteRequest=stream._writeRequests.shift()}function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream){stream._closeRequest!==void 0&&(stream._closeRequest._reject(stream._storedError),stream._closeRequest=void 0);let writer=stream._writer;writer!==void 0&&defaultWriterClosedPromiseReject(writer,stream._storedError)}function WritableStreamUpdateBackpressure(stream,backpressure){let writer=stream._writer;writer!==void 0&&backpressure!==stream._backpressure&&(backpressure?defaultWriterReadyPromiseReset(writer):defaultWriterReadyPromiseResolve(writer)),stream._backpressure=backpressure}class WritableStreamDefaultWriter{constructor(stream){if(assertRequiredArgument(stream,1,"WritableStreamDefaultWriter"),assertWritableStream(stream,"First parameter"),IsWritableStreamLocked(stream))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=stream,stream._writer=this;let state=stream._state;if(state==="writable")!WritableStreamCloseQueuedOrInFlight(stream)&&stream._backpressure?defaultWriterReadyPromiseInitialize(this):defaultWriterReadyPromiseInitializeAsResolved(this),defaultWriterClosedPromiseInitialize(this);else if(state==="erroring")defaultWriterReadyPromiseInitializeAsRejected(this,stream._storedError),defaultWriterClosedPromiseInitialize(this);else if(state==="closed")defaultWriterReadyPromiseInitializeAsResolved(this),defaultWriterClosedPromiseInitializeAsResolved(this);else{let storedError=stream._storedError;defaultWriterReadyPromiseInitializeAsRejected(this,storedError),defaultWriterClosedPromiseInitializeAsRejected(this,storedError)}}get closed(){return IsWritableStreamDefaultWriter(this)?this._closedPromise:promiseRejectedWith(defaultWriterBrandCheckException("closed"))}get desiredSize(){if(!IsWritableStreamDefaultWriter(this))throw defaultWriterBrandCheckException("desiredSize");if(this._ownerWritableStream===void 0)throw defaultWriterLockException("desiredSize");return WritableStreamDefaultWriterGetDesiredSize(this)}get ready(){return IsWritableStreamDefaultWriter(this)?this._readyPromise:promiseRejectedWith(defaultWriterBrandCheckException("ready"))}abort(reason=void 0){return IsWritableStreamDefaultWriter(this)?this._ownerWritableStream===void 0?promiseRejectedWith(defaultWriterLockException("abort")):WritableStreamDefaultWriterAbort(this,reason):promiseRejectedWith(defaultWriterBrandCheckException("abort"))}close(){if(!IsWritableStreamDefaultWriter(this))return promiseRejectedWith(defaultWriterBrandCheckException("close"));let stream=this._ownerWritableStream;return stream===void 0?promiseRejectedWith(defaultWriterLockException("close")):WritableStreamCloseQueuedOrInFlight(stream)?promiseRejectedWith(new TypeError("Cannot close an already-closing stream")):WritableStreamDefaultWriterClose(this)}releaseLock(){if(!IsWritableStreamDefaultWriter(this))throw defaultWriterBrandCheckException("releaseLock");this._ownerWritableStream!==void 0&&WritableStreamDefaultWriterRelease(this)}write(chunk=void 0){return IsWritableStreamDefaultWriter(this)?this._ownerWritableStream===void 0?promiseRejectedWith(defaultWriterLockException("write to")):WritableStreamDefaultWriterWrite(this,chunk):promiseRejectedWith(defaultWriterBrandCheckException("write"))}}Object.defineProperties(WritableStreamDefaultWriter.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(WritableStreamDefaultWriter.prototype,SymbolPolyfill.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function IsWritableStreamDefaultWriter(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_ownerWritableStream")?!1:x2 instanceof WritableStreamDefaultWriter}function WritableStreamDefaultWriterAbort(writer,reason){let stream=writer._ownerWritableStream;return WritableStreamAbort(stream,reason)}function WritableStreamDefaultWriterClose(writer){let stream=writer._ownerWritableStream;return WritableStreamClose(stream)}function WritableStreamDefaultWriterCloseWithErrorPropagation(writer){let stream=writer._ownerWritableStream,state=stream._state;return WritableStreamCloseQueuedOrInFlight(stream)||state==="closed"?promiseResolvedWith(void 0):state==="errored"?promiseRejectedWith(stream._storedError):WritableStreamDefaultWriterClose(writer)}function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer,error){writer._closedPromiseState==="pending"?defaultWriterClosedPromiseReject(writer,error):defaultWriterClosedPromiseResetToRejected(writer,error)}function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer,error){writer._readyPromiseState==="pending"?defaultWriterReadyPromiseReject(writer,error):defaultWriterReadyPromiseResetToRejected(writer,error)}function WritableStreamDefaultWriterGetDesiredSize(writer){let stream=writer._ownerWritableStream,state=stream._state;return state==="errored"||state==="erroring"?null:state==="closed"?0:WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController)}function WritableStreamDefaultWriterRelease(writer){let stream=writer._ownerWritableStream,releasedError=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer,releasedError),WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer,releasedError),stream._writer=void 0,writer._ownerWritableStream=void 0}function WritableStreamDefaultWriterWrite(writer,chunk){let stream=writer._ownerWritableStream,controller=stream._writableStreamController,chunkSize=WritableStreamDefaultControllerGetChunkSize(controller,chunk);if(stream!==writer._ownerWritableStream)return promiseRejectedWith(defaultWriterLockException("write to"));let state=stream._state;if(state==="errored")return promiseRejectedWith(stream._storedError);if(WritableStreamCloseQueuedOrInFlight(stream)||state==="closed")return promiseRejectedWith(new TypeError("The stream is closing or closed and cannot be written to"));if(state==="erroring")return promiseRejectedWith(stream._storedError);let promise=WritableStreamAddWriteRequest(stream);return WritableStreamDefaultControllerWrite(controller,chunk,chunkSize),promise}let closeSentinel={};class WritableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!IsWritableStreamDefaultController(this))throw defaultControllerBrandCheckException$2("abortReason");return this._abortReason}get signal(){if(!IsWritableStreamDefaultController(this))throw defaultControllerBrandCheckException$2("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e2=void 0){if(!IsWritableStreamDefaultController(this))throw defaultControllerBrandCheckException$2("error");this._controlledWritableStream._state==="writable"&&WritableStreamDefaultControllerError(this,e2)}[AbortSteps](reason){let result=this._abortAlgorithm(reason);return WritableStreamDefaultControllerClearAlgorithms(this),result}[ErrorSteps](){ResetQueue(this)}}Object.defineProperties(WritableStreamDefaultController.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(WritableStreamDefaultController.prototype,SymbolPolyfill.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function IsWritableStreamDefaultController(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_controlledWritableStream")?!1:x2 instanceof WritableStreamDefaultController}function SetUpWritableStreamDefaultController(stream,controller,startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,highWaterMark,sizeAlgorithm){controller._controlledWritableStream=stream,stream._writableStreamController=controller,controller._queue=void 0,controller._queueTotalSize=void 0,ResetQueue(controller),controller._abortReason=void 0,controller._abortController=createAbortController(),controller._started=!1,controller._strategySizeAlgorithm=sizeAlgorithm,controller._strategyHWM=highWaterMark,controller._writeAlgorithm=writeAlgorithm,controller._closeAlgorithm=closeAlgorithm,controller._abortAlgorithm=abortAlgorithm;let backpressure=WritableStreamDefaultControllerGetBackpressure(controller);WritableStreamUpdateBackpressure(stream,backpressure);let startResult=startAlgorithm(),startPromise=promiseResolvedWith(startResult);uponPromise(startPromise,()=>{controller._started=!0,WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller)},r3=>{controller._started=!0,WritableStreamDealWithRejection(stream,r3)})}function SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream,underlyingSink,highWaterMark,sizeAlgorithm){let controller=Object.create(WritableStreamDefaultController.prototype),startAlgorithm=()=>{},writeAlgorithm=()=>promiseResolvedWith(void 0),closeAlgorithm=()=>promiseResolvedWith(void 0),abortAlgorithm=()=>promiseResolvedWith(void 0);underlyingSink.start!==void 0&&(startAlgorithm=()=>underlyingSink.start(controller)),underlyingSink.write!==void 0&&(writeAlgorithm=chunk=>underlyingSink.write(chunk,controller)),underlyingSink.close!==void 0&&(closeAlgorithm=()=>underlyingSink.close()),underlyingSink.abort!==void 0&&(abortAlgorithm=reason=>underlyingSink.abort(reason)),SetUpWritableStreamDefaultController(stream,controller,startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,highWaterMark,sizeAlgorithm)}function WritableStreamDefaultControllerClearAlgorithms(controller){controller._writeAlgorithm=void 0,controller._closeAlgorithm=void 0,controller._abortAlgorithm=void 0,controller._strategySizeAlgorithm=void 0}function WritableStreamDefaultControllerClose(controller){EnqueueValueWithSize(controller,closeSentinel,0),WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller)}function WritableStreamDefaultControllerGetChunkSize(controller,chunk){try{return controller._strategySizeAlgorithm(chunk)}catch(chunkSizeE){return WritableStreamDefaultControllerErrorIfNeeded(controller,chunkSizeE),1}}function WritableStreamDefaultControllerGetDesiredSize(controller){return controller._strategyHWM-controller._queueTotalSize}function WritableStreamDefaultControllerWrite(controller,chunk,chunkSize){try{EnqueueValueWithSize(controller,chunk,chunkSize)}catch(enqueueE){WritableStreamDefaultControllerErrorIfNeeded(controller,enqueueE);return}let stream=controller._controlledWritableStream;if(!WritableStreamCloseQueuedOrInFlight(stream)&&stream._state==="writable"){let backpressure=WritableStreamDefaultControllerGetBackpressure(controller);WritableStreamUpdateBackpressure(stream,backpressure)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller)}function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller){let stream=controller._controlledWritableStream;if(!controller._started||stream._inFlightWriteRequest!==void 0)return;if(stream._state==="erroring"){WritableStreamFinishErroring(stream);return}if(controller._queue.length===0)return;let value=PeekQueueValue(controller);value===closeSentinel?WritableStreamDefaultControllerProcessClose(controller):WritableStreamDefaultControllerProcessWrite(controller,value)}function WritableStreamDefaultControllerErrorIfNeeded(controller,error){controller._controlledWritableStream._state==="writable"&&WritableStreamDefaultControllerError(controller,error)}function WritableStreamDefaultControllerProcessClose(controller){let stream=controller._controlledWritableStream;WritableStreamMarkCloseRequestInFlight(stream),DequeueValue(controller);let sinkClosePromise=controller._closeAlgorithm();WritableStreamDefaultControllerClearAlgorithms(controller),uponPromise(sinkClosePromise,()=>{WritableStreamFinishInFlightClose(stream)},reason=>{WritableStreamFinishInFlightCloseWithError(stream,reason)})}function WritableStreamDefaultControllerProcessWrite(controller,chunk){let stream=controller._controlledWritableStream;WritableStreamMarkFirstWriteRequestInFlight(stream);let sinkWritePromise=controller._writeAlgorithm(chunk);uponPromise(sinkWritePromise,()=>{WritableStreamFinishInFlightWrite(stream);let state=stream._state;if(DequeueValue(controller),!WritableStreamCloseQueuedOrInFlight(stream)&&state==="writable"){let backpressure=WritableStreamDefaultControllerGetBackpressure(controller);WritableStreamUpdateBackpressure(stream,backpressure)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller)},reason=>{stream._state==="writable"&&WritableStreamDefaultControllerClearAlgorithms(controller),WritableStreamFinishInFlightWriteWithError(stream,reason)})}function WritableStreamDefaultControllerGetBackpressure(controller){return WritableStreamDefaultControllerGetDesiredSize(controller)<=0}function WritableStreamDefaultControllerError(controller,error){let stream=controller._controlledWritableStream;WritableStreamDefaultControllerClearAlgorithms(controller),WritableStreamStartErroring(stream,error)}function streamBrandCheckException$2(name){return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`)}function defaultControllerBrandCheckException$2(name){return new TypeError(`WritableStreamDefaultController.prototype.${name} can only be used on a WritableStreamDefaultController`)}function defaultWriterBrandCheckException(name){return new TypeError(`WritableStreamDefaultWriter.prototype.${name} can only be used on a WritableStreamDefaultWriter`)}function defaultWriterLockException(name){return new TypeError("Cannot "+name+" a stream using a released writer")}function defaultWriterClosedPromiseInitialize(writer){writer._closedPromise=newPromise((resolve,reject)=>{writer._closedPromise_resolve=resolve,writer._closedPromise_reject=reject,writer._closedPromiseState="pending"})}function defaultWriterClosedPromiseInitializeAsRejected(writer,reason){defaultWriterClosedPromiseInitialize(writer),defaultWriterClosedPromiseReject(writer,reason)}function defaultWriterClosedPromiseInitializeAsResolved(writer){defaultWriterClosedPromiseInitialize(writer),defaultWriterClosedPromiseResolve(writer)}function defaultWriterClosedPromiseReject(writer,reason){writer._closedPromise_reject!==void 0&&(setPromiseIsHandledToTrue(writer._closedPromise),writer._closedPromise_reject(reason),writer._closedPromise_resolve=void 0,writer._closedPromise_reject=void 0,writer._closedPromiseState="rejected")}function defaultWriterClosedPromiseResetToRejected(writer,reason){defaultWriterClosedPromiseInitializeAsRejected(writer,reason)}function defaultWriterClosedPromiseResolve(writer){writer._closedPromise_resolve!==void 0&&(writer._closedPromise_resolve(void 0),writer._closedPromise_resolve=void 0,writer._closedPromise_reject=void 0,writer._closedPromiseState="resolved")}function defaultWriterReadyPromiseInitialize(writer){writer._readyPromise=newPromise((resolve,reject)=>{writer._readyPromise_resolve=resolve,writer._readyPromise_reject=reject}),writer._readyPromiseState="pending"}function defaultWriterReadyPromiseInitializeAsRejected(writer,reason){defaultWriterReadyPromiseInitialize(writer),defaultWriterReadyPromiseReject(writer,reason)}function defaultWriterReadyPromiseInitializeAsResolved(writer){defaultWriterReadyPromiseInitialize(writer),defaultWriterReadyPromiseResolve(writer)}function defaultWriterReadyPromiseReject(writer,reason){writer._readyPromise_reject!==void 0&&(setPromiseIsHandledToTrue(writer._readyPromise),writer._readyPromise_reject(reason),writer._readyPromise_resolve=void 0,writer._readyPromise_reject=void 0,writer._readyPromiseState="rejected")}function defaultWriterReadyPromiseReset(writer){defaultWriterReadyPromiseInitialize(writer)}function defaultWriterReadyPromiseResetToRejected(writer,reason){defaultWriterReadyPromiseInitializeAsRejected(writer,reason)}function defaultWriterReadyPromiseResolve(writer){writer._readyPromise_resolve!==void 0&&(writer._readyPromise_resolve(void 0),writer._readyPromise_resolve=void 0,writer._readyPromise_reject=void 0,writer._readyPromiseState="fulfilled")}let NativeDOMException=typeof DOMException<"u"?DOMException:void 0;function isDOMExceptionConstructor(ctor){if(!(typeof ctor=="function"||typeof ctor=="object"))return!1;try{return new ctor,!0}catch{return!1}}function createDOMExceptionPolyfill(){let ctor=function(message,name){this.message=message||"",this.name=name||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return ctor.prototype=Object.create(Error.prototype),Object.defineProperty(ctor.prototype,"constructor",{value:ctor,writable:!0,configurable:!0}),ctor}let DOMException$12=isDOMExceptionConstructor(NativeDOMException)?NativeDOMException:createDOMExceptionPolyfill();function ReadableStreamPipeTo(source,dest,preventClose,preventAbort,preventCancel,signal){let reader=AcquireReadableStreamDefaultReader(source),writer=AcquireWritableStreamDefaultWriter(dest);source._disturbed=!0;let shuttingDown=!1,currentWrite=promiseResolvedWith(void 0);return newPromise((resolve,reject)=>{let abortAlgorithm;if(signal!==void 0){if(abortAlgorithm=()=>{let error=new DOMException$12("Aborted","AbortError"),actions=[];preventAbort||actions.push(()=>dest._state==="writable"?WritableStreamAbort(dest,error):promiseResolvedWith(void 0)),preventCancel||actions.push(()=>source._state==="readable"?ReadableStreamCancel(source,error):promiseResolvedWith(void 0)),shutdownWithAction(()=>Promise.all(actions.map(action=>action())),!0,error)},signal.aborted){abortAlgorithm();return}signal.addEventListener("abort",abortAlgorithm)}function pipeLoop(){return newPromise((resolveLoop,rejectLoop)=>{function next(done){done?resolveLoop():PerformPromiseThen(pipeStep(),next,rejectLoop)}next(!1)})}function pipeStep(){return shuttingDown?promiseResolvedWith(!0):PerformPromiseThen(writer._readyPromise,()=>newPromise((resolveRead,rejectRead)=>{ReadableStreamDefaultReaderRead(reader,{_chunkSteps:chunk=>{currentWrite=PerformPromiseThen(WritableStreamDefaultWriterWrite(writer,chunk),void 0,noop2),resolveRead(!1)},_closeSteps:()=>resolveRead(!0),_errorSteps:rejectRead})}))}if(isOrBecomesErrored(source,reader._closedPromise,storedError=>{preventAbort?shutdown(!0,storedError):shutdownWithAction(()=>WritableStreamAbort(dest,storedError),!0,storedError)}),isOrBecomesErrored(dest,writer._closedPromise,storedError=>{preventCancel?shutdown(!0,storedError):shutdownWithAction(()=>ReadableStreamCancel(source,storedError),!0,storedError)}),isOrBecomesClosed(source,reader._closedPromise,()=>{preventClose?shutdown():shutdownWithAction(()=>WritableStreamDefaultWriterCloseWithErrorPropagation(writer))}),WritableStreamCloseQueuedOrInFlight(dest)||dest._state==="closed"){let destClosed=new TypeError("the destination writable stream closed before all data could be piped to it");preventCancel?shutdown(!0,destClosed):shutdownWithAction(()=>ReadableStreamCancel(source,destClosed),!0,destClosed)}setPromiseIsHandledToTrue(pipeLoop());function waitForWritesToFinish(){let oldCurrentWrite=currentWrite;return PerformPromiseThen(currentWrite,()=>oldCurrentWrite!==currentWrite?waitForWritesToFinish():void 0)}function isOrBecomesErrored(stream,promise,action){stream._state==="errored"?action(stream._storedError):uponRejection(promise,action)}function isOrBecomesClosed(stream,promise,action){stream._state==="closed"?action():uponFulfillment(promise,action)}function shutdownWithAction(action,originalIsError,originalError){if(shuttingDown)return;shuttingDown=!0,dest._state==="writable"&&!WritableStreamCloseQueuedOrInFlight(dest)?uponFulfillment(waitForWritesToFinish(),doTheRest):doTheRest();function doTheRest(){uponPromise(action(),()=>finalize(originalIsError,originalError),newError=>finalize(!0,newError))}}function shutdown(isError,error){shuttingDown||(shuttingDown=!0,dest._state==="writable"&&!WritableStreamCloseQueuedOrInFlight(dest)?uponFulfillment(waitForWritesToFinish(),()=>finalize(isError,error)):finalize(isError,error))}function finalize(isError,error){WritableStreamDefaultWriterRelease(writer),ReadableStreamReaderGenericRelease(reader),signal!==void 0&&signal.removeEventListener("abort",abortAlgorithm),isError?reject(error):resolve(void 0)}})}class ReadableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("desiredSize");return ReadableStreamDefaultControllerGetDesiredSize(this)}close(){if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("close");if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("The stream is not in a state that permits close");ReadableStreamDefaultControllerClose(this)}enqueue(chunk=void 0){if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("enqueue");if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("The stream is not in a state that permits enqueue");return ReadableStreamDefaultControllerEnqueue(this,chunk)}error(e2=void 0){if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("error");ReadableStreamDefaultControllerError(this,e2)}[CancelSteps](reason){ResetQueue(this);let result=this._cancelAlgorithm(reason);return ReadableStreamDefaultControllerClearAlgorithms(this),result}[PullSteps](readRequest){let stream=this._controlledReadableStream;if(this._queue.length>0){let chunk=DequeueValue(this);this._closeRequested&&this._queue.length===0?(ReadableStreamDefaultControllerClearAlgorithms(this),ReadableStreamClose(stream)):ReadableStreamDefaultControllerCallPullIfNeeded(this),readRequest._chunkSteps(chunk)}else ReadableStreamAddReadRequest(stream,readRequest),ReadableStreamDefaultControllerCallPullIfNeeded(this)}}Object.defineProperties(ReadableStreamDefaultController.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(ReadableStreamDefaultController.prototype,SymbolPolyfill.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function IsReadableStreamDefaultController(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_controlledReadableStream")?!1:x2 instanceof ReadableStreamDefaultController}function ReadableStreamDefaultControllerCallPullIfNeeded(controller){if(!ReadableStreamDefaultControllerShouldCallPull(controller))return;if(controller._pulling){controller._pullAgain=!0;return}controller._pulling=!0;let pullPromise=controller._pullAlgorithm();uponPromise(pullPromise,()=>{controller._pulling=!1,controller._pullAgain&&(controller._pullAgain=!1,ReadableStreamDefaultControllerCallPullIfNeeded(controller))},e2=>{ReadableStreamDefaultControllerError(controller,e2)})}function ReadableStreamDefaultControllerShouldCallPull(controller){let stream=controller._controlledReadableStream;return!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)||!controller._started?!1:!!(IsReadableStreamLocked(stream)&&ReadableStreamGetNumReadRequests(stream)>0||ReadableStreamDefaultControllerGetDesiredSize(controller)>0)}function ReadableStreamDefaultControllerClearAlgorithms(controller){controller._pullAlgorithm=void 0,controller._cancelAlgorithm=void 0,controller._strategySizeAlgorithm=void 0}function ReadableStreamDefaultControllerClose(controller){if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller))return;let stream=controller._controlledReadableStream;controller._closeRequested=!0,controller._queue.length===0&&(ReadableStreamDefaultControllerClearAlgorithms(controller),ReadableStreamClose(stream))}function ReadableStreamDefaultControllerEnqueue(controller,chunk){if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller))return;let stream=controller._controlledReadableStream;if(IsReadableStreamLocked(stream)&&ReadableStreamGetNumReadRequests(stream)>0)ReadableStreamFulfillReadRequest(stream,chunk,!1);else{let chunkSize;try{chunkSize=controller._strategySizeAlgorithm(chunk)}catch(chunkSizeE){throw ReadableStreamDefaultControllerError(controller,chunkSizeE),chunkSizeE}try{EnqueueValueWithSize(controller,chunk,chunkSize)}catch(enqueueE){throw ReadableStreamDefaultControllerError(controller,enqueueE),enqueueE}}ReadableStreamDefaultControllerCallPullIfNeeded(controller)}function ReadableStreamDefaultControllerError(controller,e2){let stream=controller._controlledReadableStream;stream._state==="readable"&&(ResetQueue(controller),ReadableStreamDefaultControllerClearAlgorithms(controller),ReadableStreamError(stream,e2))}function ReadableStreamDefaultControllerGetDesiredSize(controller){let state=controller._controlledReadableStream._state;return state==="errored"?null:state==="closed"?0:controller._strategyHWM-controller._queueTotalSize}function ReadableStreamDefaultControllerHasBackpressure(controller){return!ReadableStreamDefaultControllerShouldCallPull(controller)}function ReadableStreamDefaultControllerCanCloseOrEnqueue(controller){let state=controller._controlledReadableStream._state;return!controller._closeRequested&&state==="readable"}function SetUpReadableStreamDefaultController(stream,controller,startAlgorithm,pullAlgorithm,cancelAlgorithm,highWaterMark,sizeAlgorithm){controller._controlledReadableStream=stream,controller._queue=void 0,controller._queueTotalSize=void 0,ResetQueue(controller),controller._started=!1,controller._closeRequested=!1,controller._pullAgain=!1,controller._pulling=!1,controller._strategySizeAlgorithm=sizeAlgorithm,controller._strategyHWM=highWaterMark,controller._pullAlgorithm=pullAlgorithm,controller._cancelAlgorithm=cancelAlgorithm,stream._readableStreamController=controller;let startResult=startAlgorithm();uponPromise(promiseResolvedWith(startResult),()=>{controller._started=!0,ReadableStreamDefaultControllerCallPullIfNeeded(controller)},r3=>{ReadableStreamDefaultControllerError(controller,r3)})}function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream,underlyingSource,highWaterMark,sizeAlgorithm){let controller=Object.create(ReadableStreamDefaultController.prototype),startAlgorithm=()=>{},pullAlgorithm=()=>promiseResolvedWith(void 0),cancelAlgorithm=()=>promiseResolvedWith(void 0);underlyingSource.start!==void 0&&(startAlgorithm=()=>underlyingSource.start(controller)),underlyingSource.pull!==void 0&&(pullAlgorithm=()=>underlyingSource.pull(controller)),underlyingSource.cancel!==void 0&&(cancelAlgorithm=reason=>underlyingSource.cancel(reason)),SetUpReadableStreamDefaultController(stream,controller,startAlgorithm,pullAlgorithm,cancelAlgorithm,highWaterMark,sizeAlgorithm)}function defaultControllerBrandCheckException$1(name){return new TypeError(`ReadableStreamDefaultController.prototype.${name} can only be used on a ReadableStreamDefaultController`)}function ReadableStreamTee(stream,cloneForBranch2){return IsReadableByteStreamController(stream._readableStreamController)?ReadableByteStreamTee(stream):ReadableStreamDefaultTee(stream)}function ReadableStreamDefaultTee(stream,cloneForBranch2){let reader=AcquireReadableStreamDefaultReader(stream),reading=!1,readAgain=!1,canceled1=!1,canceled2=!1,reason1,reason2,branch1,branch2,resolveCancelPromise,cancelPromise=newPromise(resolve=>{resolveCancelPromise=resolve});function pullAlgorithm(){return reading?(readAgain=!0,promiseResolvedWith(void 0)):(reading=!0,ReadableStreamDefaultReaderRead(reader,{_chunkSteps:chunk=>{queueMicrotask(()=>{readAgain=!1;let chunk1=chunk,chunk2=chunk;canceled1||ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController,chunk1),canceled2||ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController,chunk2),reading=!1,readAgain&&pullAlgorithm()})},_closeSteps:()=>{reading=!1,canceled1||ReadableStreamDefaultControllerClose(branch1._readableStreamController),canceled2||ReadableStreamDefaultControllerClose(branch2._readableStreamController),(!canceled1||!canceled2)&&resolveCancelPromise(void 0)},_errorSteps:()=>{reading=!1}}),promiseResolvedWith(void 0))}function cancel1Algorithm(reason){if(canceled1=!0,reason1=reason,canceled2){let compositeReason=CreateArrayFromList([reason1,reason2]),cancelResult=ReadableStreamCancel(stream,compositeReason);resolveCancelPromise(cancelResult)}return cancelPromise}function cancel2Algorithm(reason){if(canceled2=!0,reason2=reason,canceled1){let compositeReason=CreateArrayFromList([reason1,reason2]),cancelResult=ReadableStreamCancel(stream,compositeReason);resolveCancelPromise(cancelResult)}return cancelPromise}function startAlgorithm(){}return branch1=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel1Algorithm),branch2=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel2Algorithm),uponRejection(reader._closedPromise,r3=>{ReadableStreamDefaultControllerError(branch1._readableStreamController,r3),ReadableStreamDefaultControllerError(branch2._readableStreamController,r3),(!canceled1||!canceled2)&&resolveCancelPromise(void 0)}),[branch1,branch2]}function ReadableByteStreamTee(stream){let reader=AcquireReadableStreamDefaultReader(stream),reading=!1,readAgainForBranch1=!1,readAgainForBranch2=!1,canceled1=!1,canceled2=!1,reason1,reason2,branch1,branch2,resolveCancelPromise,cancelPromise=newPromise(resolve=>{resolveCancelPromise=resolve});function forwardReaderError(thisReader){uponRejection(thisReader._closedPromise,r3=>{thisReader===reader&&(ReadableByteStreamControllerError(branch1._readableStreamController,r3),ReadableByteStreamControllerError(branch2._readableStreamController,r3),(!canceled1||!canceled2)&&resolveCancelPromise(void 0))})}function pullWithDefaultReader(){IsReadableStreamBYOBReader(reader)&&(ReadableStreamReaderGenericRelease(reader),reader=AcquireReadableStreamDefaultReader(stream),forwardReaderError(reader)),ReadableStreamDefaultReaderRead(reader,{_chunkSteps:chunk=>{queueMicrotask(()=>{readAgainForBranch1=!1,readAgainForBranch2=!1;let chunk1=chunk,chunk2=chunk;if(!canceled1&&!canceled2)try{chunk2=CloneAsUint8Array(chunk)}catch(cloneE){ReadableByteStreamControllerError(branch1._readableStreamController,cloneE),ReadableByteStreamControllerError(branch2._readableStreamController,cloneE),resolveCancelPromise(ReadableStreamCancel(stream,cloneE));return}canceled1||ReadableByteStreamControllerEnqueue(branch1._readableStreamController,chunk1),canceled2||ReadableByteStreamControllerEnqueue(branch2._readableStreamController,chunk2),reading=!1,readAgainForBranch1?pull1Algorithm():readAgainForBranch2&&pull2Algorithm()})},_closeSteps:()=>{reading=!1,canceled1||ReadableByteStreamControllerClose(branch1._readableStreamController),canceled2||ReadableByteStreamControllerClose(branch2._readableStreamController),branch1._readableStreamController._pendingPullIntos.length>0&&ReadableByteStreamControllerRespond(branch1._readableStreamController,0),branch2._readableStreamController._pendingPullIntos.length>0&&ReadableByteStreamControllerRespond(branch2._readableStreamController,0),(!canceled1||!canceled2)&&resolveCancelPromise(void 0)},_errorSteps:()=>{reading=!1}})}function pullWithBYOBReader(view,forBranch2){IsReadableStreamDefaultReader(reader)&&(ReadableStreamReaderGenericRelease(reader),reader=AcquireReadableStreamBYOBReader(stream),forwardReaderError(reader));let byobBranch=forBranch2?branch2:branch1,otherBranch=forBranch2?branch1:branch2;ReadableStreamBYOBReaderRead(reader,view,{_chunkSteps:chunk=>{queueMicrotask(()=>{readAgainForBranch1=!1,readAgainForBranch2=!1;let byobCanceled=forBranch2?canceled2:canceled1;if(forBranch2?canceled1:canceled2)byobCanceled||ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController,chunk);else{let clonedChunk;try{clonedChunk=CloneAsUint8Array(chunk)}catch(cloneE){ReadableByteStreamControllerError(byobBranch._readableStreamController,cloneE),ReadableByteStreamControllerError(otherBranch._readableStreamController,cloneE),resolveCancelPromise(ReadableStreamCancel(stream,cloneE));return}byobCanceled||ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController,chunk),ReadableByteStreamControllerEnqueue(otherBranch._readableStreamController,clonedChunk)}reading=!1,readAgainForBranch1?pull1Algorithm():readAgainForBranch2&&pull2Algorithm()})},_closeSteps:chunk=>{reading=!1;let byobCanceled=forBranch2?canceled2:canceled1,otherCanceled=forBranch2?canceled1:canceled2;byobCanceled||ReadableByteStreamControllerClose(byobBranch._readableStreamController),otherCanceled||ReadableByteStreamControllerClose(otherBranch._readableStreamController),chunk!==void 0&&(byobCanceled||ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController,chunk),!otherCanceled&&otherBranch._readableStreamController._pendingPullIntos.length>0&&ReadableByteStreamControllerRespond(otherBranch._readableStreamController,0)),(!byobCanceled||!otherCanceled)&&resolveCancelPromise(void 0)},_errorSteps:()=>{reading=!1}})}function pull1Algorithm(){if(reading)return readAgainForBranch1=!0,promiseResolvedWith(void 0);reading=!0;let byobRequest=ReadableByteStreamControllerGetBYOBRequest(branch1._readableStreamController);return byobRequest===null?pullWithDefaultReader():pullWithBYOBReader(byobRequest._view,!1),promiseResolvedWith(void 0)}function pull2Algorithm(){if(reading)return readAgainForBranch2=!0,promiseResolvedWith(void 0);reading=!0;let byobRequest=ReadableByteStreamControllerGetBYOBRequest(branch2._readableStreamController);return byobRequest===null?pullWithDefaultReader():pullWithBYOBReader(byobRequest._view,!0),promiseResolvedWith(void 0)}function cancel1Algorithm(reason){if(canceled1=!0,reason1=reason,canceled2){let compositeReason=CreateArrayFromList([reason1,reason2]),cancelResult=ReadableStreamCancel(stream,compositeReason);resolveCancelPromise(cancelResult)}return cancelPromise}function cancel2Algorithm(reason){if(canceled2=!0,reason2=reason,canceled1){let compositeReason=CreateArrayFromList([reason1,reason2]),cancelResult=ReadableStreamCancel(stream,compositeReason);resolveCancelPromise(cancelResult)}return cancelPromise}function startAlgorithm(){}return branch1=CreateReadableByteStream(startAlgorithm,pull1Algorithm,cancel1Algorithm),branch2=CreateReadableByteStream(startAlgorithm,pull2Algorithm,cancel2Algorithm),forwardReaderError(reader),[branch1,branch2]}function convertUnderlyingDefaultOrByteSource(source,context){assertDictionary(source,context);let original=source,autoAllocateChunkSize=original?.autoAllocateChunkSize,cancel=original?.cancel,pull=original?.pull,start=original?.start,type=original?.type;return{autoAllocateChunkSize:autoAllocateChunkSize===void 0?void 0:convertUnsignedLongLongWithEnforceRange(autoAllocateChunkSize,`${context} has member 'autoAllocateChunkSize' that`),cancel:cancel===void 0?void 0:convertUnderlyingSourceCancelCallback(cancel,original,`${context} has member 'cancel' that`),pull:pull===void 0?void 0:convertUnderlyingSourcePullCallback(pull,original,`${context} has member 'pull' that`),start:start===void 0?void 0:convertUnderlyingSourceStartCallback(start,original,`${context} has member 'start' that`),type:type===void 0?void 0:convertReadableStreamType(type,`${context} has member 'type' that`)}}function convertUnderlyingSourceCancelCallback(fn,original,context){return assertFunction(fn,context),reason=>promiseCall(fn,original,[reason])}function convertUnderlyingSourcePullCallback(fn,original,context){return assertFunction(fn,context),controller=>promiseCall(fn,original,[controller])}function convertUnderlyingSourceStartCallback(fn,original,context){return assertFunction(fn,context),controller=>reflectCall(fn,original,[controller])}function convertReadableStreamType(type,context){if(type=`${type}`,type!=="bytes")throw new TypeError(`${context} '${type}' is not a valid enumeration value for ReadableStreamType`);return type}function convertReaderOptions(options,context){assertDictionary(options,context);let mode=options?.mode;return{mode:mode===void 0?void 0:convertReadableStreamReaderMode(mode,`${context} has member 'mode' that`)}}function convertReadableStreamReaderMode(mode,context){if(mode=`${mode}`,mode!=="byob")throw new TypeError(`${context} '${mode}' is not a valid enumeration value for ReadableStreamReaderMode`);return mode}function convertIteratorOptions(options,context){return assertDictionary(options,context),{preventCancel:!!options?.preventCancel}}function convertPipeOptions(options,context){assertDictionary(options,context);let preventAbort=options?.preventAbort,preventCancel=options?.preventCancel,preventClose=options?.preventClose,signal=options?.signal;return signal!==void 0&&assertAbortSignal(signal,`${context} has member 'signal' that`),{preventAbort:!!preventAbort,preventCancel:!!preventCancel,preventClose:!!preventClose,signal}}function assertAbortSignal(signal,context){if(!isAbortSignal2(signal))throw new TypeError(`${context} is not an AbortSignal.`)}function convertReadableWritablePair(pair,context){assertDictionary(pair,context);let readable=pair?.readable;assertRequiredField(readable,"readable","ReadableWritablePair"),assertReadableStream(readable,`${context} has member 'readable' that`);let writable=pair?.writable;return assertRequiredField(writable,"writable","ReadableWritablePair"),assertWritableStream(writable,`${context} has member 'writable' that`),{readable,writable}}class ReadableStream2{constructor(rawUnderlyingSource={},rawStrategy={}){rawUnderlyingSource===void 0?rawUnderlyingSource=null:assertObject(rawUnderlyingSource,"First parameter");let strategy=convertQueuingStrategy(rawStrategy,"Second parameter"),underlyingSource=convertUnderlyingDefaultOrByteSource(rawUnderlyingSource,"First parameter");if(InitializeReadableStream(this),underlyingSource.type==="bytes"){if(strategy.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let highWaterMark=ExtractHighWaterMark(strategy,0);SetUpReadableByteStreamControllerFromUnderlyingSource(this,underlyingSource,highWaterMark)}else{let sizeAlgorithm=ExtractSizeAlgorithm(strategy),highWaterMark=ExtractHighWaterMark(strategy,1);SetUpReadableStreamDefaultControllerFromUnderlyingSource(this,underlyingSource,highWaterMark,sizeAlgorithm)}}get locked(){if(!IsReadableStream(this))throw streamBrandCheckException$1("locked");return IsReadableStreamLocked(this)}cancel(reason=void 0){return IsReadableStream(this)?IsReadableStreamLocked(this)?promiseRejectedWith(new TypeError("Cannot cancel a stream that already has a reader")):ReadableStreamCancel(this,reason):promiseRejectedWith(streamBrandCheckException$1("cancel"))}getReader(rawOptions=void 0){if(!IsReadableStream(this))throw streamBrandCheckException$1("getReader");return convertReaderOptions(rawOptions,"First parameter").mode===void 0?AcquireReadableStreamDefaultReader(this):AcquireReadableStreamBYOBReader(this)}pipeThrough(rawTransform,rawOptions={}){if(!IsReadableStream(this))throw streamBrandCheckException$1("pipeThrough");assertRequiredArgument(rawTransform,1,"pipeThrough");let transform=convertReadableWritablePair(rawTransform,"First parameter"),options=convertPipeOptions(rawOptions,"Second parameter");if(IsReadableStreamLocked(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(IsWritableStreamLocked(transform.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let promise=ReadableStreamPipeTo(this,transform.writable,options.preventClose,options.preventAbort,options.preventCancel,options.signal);return setPromiseIsHandledToTrue(promise),transform.readable}pipeTo(destination,rawOptions={}){if(!IsReadableStream(this))return promiseRejectedWith(streamBrandCheckException$1("pipeTo"));if(destination===void 0)return promiseRejectedWith("Parameter 1 is required in 'pipeTo'.");if(!IsWritableStream(destination))return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let options;try{options=convertPipeOptions(rawOptions,"Second parameter")}catch(e2){return promiseRejectedWith(e2)}return IsReadableStreamLocked(this)?promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):IsWritableStreamLocked(destination)?promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):ReadableStreamPipeTo(this,destination,options.preventClose,options.preventAbort,options.preventCancel,options.signal)}tee(){if(!IsReadableStream(this))throw streamBrandCheckException$1("tee");let branches=ReadableStreamTee(this);return CreateArrayFromList(branches)}values(rawOptions=void 0){if(!IsReadableStream(this))throw streamBrandCheckException$1("values");let options=convertIteratorOptions(rawOptions,"First parameter");return AcquireReadableStreamAsyncIterator(this,options.preventCancel)}}Object.defineProperties(ReadableStream2.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(ReadableStream2.prototype,SymbolPolyfill.toStringTag,{value:"ReadableStream",configurable:!0}),typeof SymbolPolyfill.asyncIterator=="symbol"&&Object.defineProperty(ReadableStream2.prototype,SymbolPolyfill.asyncIterator,{value:ReadableStream2.prototype.values,writable:!0,configurable:!0});function CreateReadableStream(startAlgorithm,pullAlgorithm,cancelAlgorithm,highWaterMark=1,sizeAlgorithm=()=>1){let stream=Object.create(ReadableStream2.prototype);InitializeReadableStream(stream);let controller=Object.create(ReadableStreamDefaultController.prototype);return SetUpReadableStreamDefaultController(stream,controller,startAlgorithm,pullAlgorithm,cancelAlgorithm,highWaterMark,sizeAlgorithm),stream}function CreateReadableByteStream(startAlgorithm,pullAlgorithm,cancelAlgorithm){let stream=Object.create(ReadableStream2.prototype);InitializeReadableStream(stream);let controller=Object.create(ReadableByteStreamController.prototype);return SetUpReadableByteStreamController(stream,controller,startAlgorithm,pullAlgorithm,cancelAlgorithm,0,void 0),stream}function InitializeReadableStream(stream){stream._state="readable",stream._reader=void 0,stream._storedError=void 0,stream._disturbed=!1}function IsReadableStream(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_readableStreamController")?!1:x2 instanceof ReadableStream2}function IsReadableStreamLocked(stream){return stream._reader!==void 0}function ReadableStreamCancel(stream,reason){if(stream._disturbed=!0,stream._state==="closed")return promiseResolvedWith(void 0);if(stream._state==="errored")return promiseRejectedWith(stream._storedError);ReadableStreamClose(stream);let reader=stream._reader;reader!==void 0&&IsReadableStreamBYOBReader(reader)&&(reader._readIntoRequests.forEach(readIntoRequest=>{readIntoRequest._closeSteps(void 0)}),reader._readIntoRequests=new SimpleQueue);let sourceCancelPromise=stream._readableStreamController[CancelSteps](reason);return transformPromiseWith(sourceCancelPromise,noop2)}function ReadableStreamClose(stream){stream._state="closed";let reader=stream._reader;reader!==void 0&&(defaultReaderClosedPromiseResolve(reader),IsReadableStreamDefaultReader(reader)&&(reader._readRequests.forEach(readRequest=>{readRequest._closeSteps()}),reader._readRequests=new SimpleQueue))}function ReadableStreamError(stream,e2){stream._state="errored",stream._storedError=e2;let reader=stream._reader;reader!==void 0&&(defaultReaderClosedPromiseReject(reader,e2),IsReadableStreamDefaultReader(reader)?(reader._readRequests.forEach(readRequest=>{readRequest._errorSteps(e2)}),reader._readRequests=new SimpleQueue):(reader._readIntoRequests.forEach(readIntoRequest=>{readIntoRequest._errorSteps(e2)}),reader._readIntoRequests=new SimpleQueue))}function streamBrandCheckException$1(name){return new TypeError(`ReadableStream.prototype.${name} can only be used on a ReadableStream`)}function convertQueuingStrategyInit(init,context){assertDictionary(init,context);let highWaterMark=init?.highWaterMark;return assertRequiredField(highWaterMark,"highWaterMark","QueuingStrategyInit"),{highWaterMark:convertUnrestrictedDouble(highWaterMark)}}let byteLengthSizeFunction=chunk=>chunk.byteLength;try{Object.defineProperty(byteLengthSizeFunction,"name",{value:"size",configurable:!0})}catch{}class ByteLengthQueuingStrategy{constructor(options){assertRequiredArgument(options,1,"ByteLengthQueuingStrategy"),options=convertQueuingStrategyInit(options,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=options.highWaterMark}get highWaterMark(){if(!IsByteLengthQueuingStrategy(this))throw byteLengthBrandCheckException("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!IsByteLengthQueuingStrategy(this))throw byteLengthBrandCheckException("size");return byteLengthSizeFunction}}Object.defineProperties(ByteLengthQueuingStrategy.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(ByteLengthQueuingStrategy.prototype,SymbolPolyfill.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function byteLengthBrandCheckException(name){return new TypeError(`ByteLengthQueuingStrategy.prototype.${name} can only be used on a ByteLengthQueuingStrategy`)}function IsByteLengthQueuingStrategy(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_byteLengthQueuingStrategyHighWaterMark")?!1:x2 instanceof ByteLengthQueuingStrategy}let countSizeFunction=()=>1;try{Object.defineProperty(countSizeFunction,"name",{value:"size",configurable:!0})}catch{}class CountQueuingStrategy{constructor(options){assertRequiredArgument(options,1,"CountQueuingStrategy"),options=convertQueuingStrategyInit(options,"First parameter"),this._countQueuingStrategyHighWaterMark=options.highWaterMark}get highWaterMark(){if(!IsCountQueuingStrategy(this))throw countBrandCheckException("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!IsCountQueuingStrategy(this))throw countBrandCheckException("size");return countSizeFunction}}Object.defineProperties(CountQueuingStrategy.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(CountQueuingStrategy.prototype,SymbolPolyfill.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function countBrandCheckException(name){return new TypeError(`CountQueuingStrategy.prototype.${name} can only be used on a CountQueuingStrategy`)}function IsCountQueuingStrategy(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_countQueuingStrategyHighWaterMark")?!1:x2 instanceof CountQueuingStrategy}function convertTransformer(original,context){assertDictionary(original,context);let flush=original?.flush,readableType=original?.readableType,start=original?.start,transform=original?.transform,writableType=original?.writableType;return{flush:flush===void 0?void 0:convertTransformerFlushCallback(flush,original,`${context} has member 'flush' that`),readableType,start:start===void 0?void 0:convertTransformerStartCallback(start,original,`${context} has member 'start' that`),transform:transform===void 0?void 0:convertTransformerTransformCallback(transform,original,`${context} has member 'transform' that`),writableType}}function convertTransformerFlushCallback(fn,original,context){return assertFunction(fn,context),controller=>promiseCall(fn,original,[controller])}function convertTransformerStartCallback(fn,original,context){return assertFunction(fn,context),controller=>reflectCall(fn,original,[controller])}function convertTransformerTransformCallback(fn,original,context){return assertFunction(fn,context),(chunk,controller)=>promiseCall(fn,original,[chunk,controller])}class TransformStream{constructor(rawTransformer={},rawWritableStrategy={},rawReadableStrategy={}){rawTransformer===void 0&&(rawTransformer=null);let writableStrategy=convertQueuingStrategy(rawWritableStrategy,"Second parameter"),readableStrategy=convertQueuingStrategy(rawReadableStrategy,"Third parameter"),transformer=convertTransformer(rawTransformer,"First parameter");if(transformer.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(transformer.writableType!==void 0)throw new RangeError("Invalid writableType specified");let readableHighWaterMark=ExtractHighWaterMark(readableStrategy,0),readableSizeAlgorithm=ExtractSizeAlgorithm(readableStrategy),writableHighWaterMark=ExtractHighWaterMark(writableStrategy,1),writableSizeAlgorithm=ExtractSizeAlgorithm(writableStrategy),startPromise_resolve,startPromise=newPromise(resolve=>{startPromise_resolve=resolve});InitializeTransformStream(this,startPromise,writableHighWaterMark,writableSizeAlgorithm,readableHighWaterMark,readableSizeAlgorithm),SetUpTransformStreamDefaultControllerFromTransformer(this,transformer),transformer.start!==void 0?startPromise_resolve(transformer.start(this._transformStreamController)):startPromise_resolve(void 0)}get readable(){if(!IsTransformStream(this))throw streamBrandCheckException("readable");return this._readable}get writable(){if(!IsTransformStream(this))throw streamBrandCheckException("writable");return this._writable}}Object.defineProperties(TransformStream.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(TransformStream.prototype,SymbolPolyfill.toStringTag,{value:"TransformStream",configurable:!0});function InitializeTransformStream(stream,startPromise,writableHighWaterMark,writableSizeAlgorithm,readableHighWaterMark,readableSizeAlgorithm){function startAlgorithm(){return startPromise}function writeAlgorithm(chunk){return TransformStreamDefaultSinkWriteAlgorithm(stream,chunk)}function abortAlgorithm(reason){return TransformStreamDefaultSinkAbortAlgorithm(stream,reason)}function closeAlgorithm(){return TransformStreamDefaultSinkCloseAlgorithm(stream)}stream._writable=CreateWritableStream(startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,writableHighWaterMark,writableSizeAlgorithm);function pullAlgorithm(){return TransformStreamDefaultSourcePullAlgorithm(stream)}function cancelAlgorithm(reason){return TransformStreamErrorWritableAndUnblockWrite(stream,reason),promiseResolvedWith(void 0)}stream._readable=CreateReadableStream(startAlgorithm,pullAlgorithm,cancelAlgorithm,readableHighWaterMark,readableSizeAlgorithm),stream._backpressure=void 0,stream._backpressureChangePromise=void 0,stream._backpressureChangePromise_resolve=void 0,TransformStreamSetBackpressure(stream,!0),stream._transformStreamController=void 0}function IsTransformStream(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_transformStreamController")?!1:x2 instanceof TransformStream}function TransformStreamError(stream,e2){ReadableStreamDefaultControllerError(stream._readable._readableStreamController,e2),TransformStreamErrorWritableAndUnblockWrite(stream,e2)}function TransformStreamErrorWritableAndUnblockWrite(stream,e2){TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController),WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController,e2),stream._backpressure&&TransformStreamSetBackpressure(stream,!1)}function TransformStreamSetBackpressure(stream,backpressure){stream._backpressureChangePromise!==void 0&&stream._backpressureChangePromise_resolve(),stream._backpressureChangePromise=newPromise(resolve=>{stream._backpressureChangePromise_resolve=resolve}),stream._backpressure=backpressure}class TransformStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("desiredSize");let readableController=this._controlledTransformStream._readable._readableStreamController;return ReadableStreamDefaultControllerGetDesiredSize(readableController)}enqueue(chunk=void 0){if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("enqueue");TransformStreamDefaultControllerEnqueue(this,chunk)}error(reason=void 0){if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("error");TransformStreamDefaultControllerError(this,reason)}terminate(){if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("terminate");TransformStreamDefaultControllerTerminate(this)}}Object.defineProperties(TransformStreamDefaultController.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof SymbolPolyfill.toStringTag=="symbol"&&Object.defineProperty(TransformStreamDefaultController.prototype,SymbolPolyfill.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function IsTransformStreamDefaultController(x2){return!typeIsObject(x2)||!Object.prototype.hasOwnProperty.call(x2,"_controlledTransformStream")?!1:x2 instanceof TransformStreamDefaultController}function SetUpTransformStreamDefaultController(stream,controller,transformAlgorithm,flushAlgorithm){controller._controlledTransformStream=stream,stream._transformStreamController=controller,controller._transformAlgorithm=transformAlgorithm,controller._flushAlgorithm=flushAlgorithm}function SetUpTransformStreamDefaultControllerFromTransformer(stream,transformer){let controller=Object.create(TransformStreamDefaultController.prototype),transformAlgorithm=chunk=>{try{return TransformStreamDefaultControllerEnqueue(controller,chunk),promiseResolvedWith(void 0)}catch(transformResultE){return promiseRejectedWith(transformResultE)}},flushAlgorithm=()=>promiseResolvedWith(void 0);transformer.transform!==void 0&&(transformAlgorithm=chunk=>transformer.transform(chunk,controller)),transformer.flush!==void 0&&(flushAlgorithm=()=>transformer.flush(controller)),SetUpTransformStreamDefaultController(stream,controller,transformAlgorithm,flushAlgorithm)}function TransformStreamDefaultControllerClearAlgorithms(controller){controller._transformAlgorithm=void 0,controller._flushAlgorithm=void 0}function TransformStreamDefaultControllerEnqueue(controller,chunk){let stream=controller._controlledTransformStream,readableController=stream._readable._readableStreamController;if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController))throw new TypeError("Readable side is not in a state that permits enqueue");try{ReadableStreamDefaultControllerEnqueue(readableController,chunk)}catch(e2){throw TransformStreamErrorWritableAndUnblockWrite(stream,e2),stream._readable._storedError}ReadableStreamDefaultControllerHasBackpressure(readableController)!==stream._backpressure&&TransformStreamSetBackpressure(stream,!0)}function TransformStreamDefaultControllerError(controller,e2){TransformStreamError(controller._controlledTransformStream,e2)}function TransformStreamDefaultControllerPerformTransform(controller,chunk){let transformPromise=controller._transformAlgorithm(chunk);return transformPromiseWith(transformPromise,void 0,r3=>{throw TransformStreamError(controller._controlledTransformStream,r3),r3})}function TransformStreamDefaultControllerTerminate(controller){let stream=controller._controlledTransformStream,readableController=stream._readable._readableStreamController;ReadableStreamDefaultControllerClose(readableController);let error=new TypeError("TransformStream terminated");TransformStreamErrorWritableAndUnblockWrite(stream,error)}function TransformStreamDefaultSinkWriteAlgorithm(stream,chunk){let controller=stream._transformStreamController;if(stream._backpressure){let backpressureChangePromise=stream._backpressureChangePromise;return transformPromiseWith(backpressureChangePromise,()=>{let writable=stream._writable;if(writable._state==="erroring")throw writable._storedError;return TransformStreamDefaultControllerPerformTransform(controller,chunk)})}return TransformStreamDefaultControllerPerformTransform(controller,chunk)}function TransformStreamDefaultSinkAbortAlgorithm(stream,reason){return TransformStreamError(stream,reason),promiseResolvedWith(void 0)}function TransformStreamDefaultSinkCloseAlgorithm(stream){let readable=stream._readable,controller=stream._transformStreamController,flushPromise=controller._flushAlgorithm();return TransformStreamDefaultControllerClearAlgorithms(controller),transformPromiseWith(flushPromise,()=>{if(readable._state==="errored")throw readable._storedError;ReadableStreamDefaultControllerClose(readable._readableStreamController)},r3=>{throw TransformStreamError(stream,r3),readable._storedError})}function TransformStreamDefaultSourcePullAlgorithm(stream){return TransformStreamSetBackpressure(stream,!1),stream._backpressureChangePromise}function defaultControllerBrandCheckException(name){return new TypeError(`TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`)}function streamBrandCheckException(name){return new TypeError(`TransformStream.prototype.${name} can only be used on a TransformStream`)}exports2.ByteLengthQueuingStrategy=ByteLengthQueuingStrategy,exports2.CountQueuingStrategy=CountQueuingStrategy,exports2.ReadableByteStreamController=ReadableByteStreamController,exports2.ReadableStream=ReadableStream2,exports2.ReadableStreamBYOBReader=ReadableStreamBYOBReader,exports2.ReadableStreamBYOBRequest=ReadableStreamBYOBRequest,exports2.ReadableStreamDefaultController=ReadableStreamDefaultController,exports2.ReadableStreamDefaultReader=ReadableStreamDefaultReader,exports2.TransformStream=TransformStream,exports2.TransformStreamDefaultController=TransformStreamDefaultController,exports2.WritableStream=WritableStream,exports2.WritableStreamDefaultController=WritableStreamDefaultController,exports2.WritableStreamDefaultWriter=WritableStreamDefaultWriter,Object.defineProperty(exports2,"__esModule",{value:!0})})}(ponyfill_es2018,ponyfill_es2018.exports)),ponyfill_es2018.exports}async function*toIterator(parts,clone2=!0){for(let part of parts)if("stream"in part)yield*part.stream();else if(ArrayBuffer.isView(part))if(clone2){let position=part.byteOffset,end=part.byteOffset+part.byteLength;for(;position!==end;){let size=Math.min(end-position,POOL_SIZE),chunk=part.buffer.slice(position,position+size);position+=chunk.byteLength,yield new Uint8Array(chunk)}}else yield part;else{let position=0,b=part;for(;position!==b.size;){let buffer=await b.slice(position,Math.min(b.size,position+POOL_SIZE)).arrayBuffer();position+=buffer.byteLength,yield new Uint8Array(buffer)}}}function formDataToBlob(F2,B=_Blob$1){var b=`${r()}${r()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),c=[],p=`--${b}\r +Content-Disposition: form-data; name="`;return F2.forEach((v,n)=>typeof v=="string"?c.push(p+e(n)+`"\r +\r +${v.replace(/\r(?!\n)|(?0&&accumBytes+chunk.length>data.size){let error=new FetchError(`content size at ${data.url} over limit: ${data.size}`,"max-size");throw body.destroy(error),error}accumBytes+=chunk.length,accum.push(chunk)}}catch(error){throw error instanceof FetchBaseError?error:new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`,"system",error)}if(body.readableEnded===!0||body._readableState.ended===!0)try{return accum.every(c=>typeof c=="string")?import_node_buffer.Buffer.from(accum.join("")):import_node_buffer.Buffer.concat(accum,accumBytes)}catch(error){throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`,"system",error)}else throw new FetchError(`Premature close of server response while trying to fetch ${data.url}`)}function fromRawHeaders(headers=[]){return new Headers(headers.reduce((result,value,index,array)=>(index%2===0&&result.push(array.slice(index,index+2)),result),[]).filter(([name,value])=>{try{return validateHeaderName(name),validateHeaderValue(name,String(value)),!0}catch{return!1}}))}function stripURLForUseAsAReferrer(url,originOnly=!1){return url==null||(url=new URL(url),/^(about|blob|data):$/.test(url.protocol))?"no-referrer":(url.username="",url.password="",url.hash="",originOnly&&(url.pathname="",url.search=""),url)}function validateReferrerPolicy(referrerPolicy){if(!ReferrerPolicy.has(referrerPolicy))throw new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);return referrerPolicy}function isOriginPotentiallyTrustworthy(url){if(/^(http|ws)s:$/.test(url.protocol))return!0;let hostIp=url.host.replace(/(^\[)|(]$)/g,""),hostIPVersion=(0,import_node_net.isIP)(hostIp);return hostIPVersion===4&&/^127\./.test(hostIp)||hostIPVersion===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)?!0:url.host==="localhost"||url.host.endsWith(".localhost")?!1:url.protocol==="file:"}function isUrlPotentiallyTrustworthy(url){return/^about:(blank|srcdoc)$/.test(url)||url.protocol==="data:"||/^(blob|filesystem):$/.test(url.protocol)?!0:isOriginPotentiallyTrustworthy(url)}function determineRequestsReferrer(request,{referrerURLCallback,referrerOriginCallback}={}){if(request.referrer==="no-referrer"||request.referrerPolicy==="")return null;let policy=request.referrerPolicy;if(request.referrer==="about:client")return"no-referrer";let referrerSource=request.referrer,referrerURL=stripURLForUseAsAReferrer(referrerSource),referrerOrigin=stripURLForUseAsAReferrer(referrerSource,!0);referrerURL.toString().length>4096&&(referrerURL=referrerOrigin),referrerURLCallback&&(referrerURL=referrerURLCallback(referrerURL)),referrerOriginCallback&&(referrerOrigin=referrerOriginCallback(referrerOrigin));let currentURL=new URL(request.url);switch(policy){case"no-referrer":return"no-referrer";case"origin":return referrerOrigin;case"unsafe-url":return referrerURL;case"strict-origin":return isUrlPotentiallyTrustworthy(referrerURL)&&!isUrlPotentiallyTrustworthy(currentURL)?"no-referrer":referrerOrigin.toString();case"strict-origin-when-cross-origin":return referrerURL.origin===currentURL.origin?referrerURL:isUrlPotentiallyTrustworthy(referrerURL)&&!isUrlPotentiallyTrustworthy(currentURL)?"no-referrer":referrerOrigin;case"same-origin":return referrerURL.origin===currentURL.origin?referrerURL:"no-referrer";case"origin-when-cross-origin":return referrerURL.origin===currentURL.origin?referrerURL:referrerOrigin;case"no-referrer-when-downgrade":return isUrlPotentiallyTrustworthy(referrerURL)&&!isUrlPotentiallyTrustworthy(currentURL)?"no-referrer":referrerURL;default:throw new TypeError(`Invalid referrerPolicy: ${policy}`)}}function parseReferrerPolicyFromHeader(headers){let policyTokens=(headers.get("referrer-policy")||"").split(/[,\s]+/),policy="";for(let token of policyTokens)token&&ReferrerPolicy.has(token)&&(policy=token);return policy}async function fetch(url,options_){return new Promise((resolve,reject)=>{let request=new Request(url,options_),{parsedURL,options}=getNodeRequestOptions(request);if(!supportedSchemas.has(parsedURL.protocol))throw new TypeError(`node-fetch cannot load ${url}. URL scheme "${parsedURL.protocol.replace(/:$/,"")}" is not supported.`);if(parsedURL.protocol==="data:"){let data=dataUriToBuffer(request.url),response2=new Response(data,{headers:{"Content-Type":data.typeFull}});resolve(response2);return}let send=(parsedURL.protocol==="https:"?import_node_https.default:import_node_http.default).request,{signal}=request,response=null,abort=()=>{let error=new AbortError("The operation was aborted.");reject(error),request.body&&request.body instanceof import_node_stream.default.Readable&&request.body.destroy(error),!(!response||!response.body)&&response.body.emit("error",error)};if(signal&&signal.aborted){abort();return}let abortAndFinalize=()=>{abort(),finalize()},request_=send(parsedURL.toString(),options);signal&&signal.addEventListener("abort",abortAndFinalize);let finalize=()=>{request_.abort(),signal&&signal.removeEventListener("abort",abortAndFinalize)};request_.on("error",error=>{reject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`,"system",error)),finalize()}),fixResponseChunkedTransferBadEnding(request_,error=>{response&&response.body&&response.body.destroy(error)}),process.version<"v14"&&request_.on("socket",s2=>{let endedWithEventsCount;s2.prependListener("end",()=>{endedWithEventsCount=s2._eventsCount}),s2.prependListener("close",hadError=>{if(response&&endedWithEventsCount{request_.setTimeout(0);let headers=fromRawHeaders(response_.rawHeaders);if(isRedirect(response_.statusCode)){let location=headers.get("Location"),locationURL=null;try{locationURL=location===null?null:new URL(location,request.url)}catch{if(request.redirect!=="manual"){reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`,"invalid-redirect")),finalize();return}}switch(request.redirect){case"error":reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`,"no-redirect")),finalize();return;case"manual":break;case"follow":{if(locationURL===null)break;if(request.counter>=request.follow){reject(new FetchError(`maximum redirect reached at: ${request.url}`,"max-redirect")),finalize();return}let requestOptions={headers:new Headers(request.headers),follow:request.follow,counter:request.counter+1,agent:request.agent,compress:request.compress,method:request.method,body:clone(request),signal:request.signal,size:request.size,referrer:request.referrer,referrerPolicy:request.referrerPolicy};if(!isDomainOrSubdomain(request.url,locationURL)||!isSameProtocol(request.url,locationURL))for(let name of["authorization","www-authenticate","cookie","cookie2"])requestOptions.headers.delete(name);if(response_.statusCode!==303&&request.body&&options_.body instanceof import_node_stream.default.Readable){reject(new FetchError("Cannot follow redirect with body being a readable stream","unsupported-redirect")),finalize();return}(response_.statusCode===303||(response_.statusCode===301||response_.statusCode===302)&&request.method==="POST")&&(requestOptions.method="GET",requestOptions.body=void 0,requestOptions.headers.delete("content-length"));let responseReferrerPolicy=parseReferrerPolicyFromHeader(headers);responseReferrerPolicy&&(requestOptions.referrerPolicy=responseReferrerPolicy),resolve(fetch(new Request(locationURL,requestOptions))),finalize();return}default:return reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`))}}signal&&response_.once("end",()=>{signal.removeEventListener("abort",abortAndFinalize)});let body=(0,import_node_stream.pipeline)(response_,new import_node_stream.PassThrough,error=>{error&&reject(error)});process.version<"v12.10"&&response_.on("aborted",abortAndFinalize);let responseOptions={url:request.url,status:response_.statusCode,statusText:response_.statusMessage,headers,size:request.size,counter:request.counter,highWaterMark:request.highWaterMark},codings=headers.get("Content-Encoding");if(!request.compress||request.method==="HEAD"||codings===null||response_.statusCode===204||response_.statusCode===304){response=new Response(body,responseOptions),resolve(response);return}let zlibOptions={flush:import_node_zlib.default.Z_SYNC_FLUSH,finishFlush:import_node_zlib.default.Z_SYNC_FLUSH};if(codings==="gzip"||codings==="x-gzip"){body=(0,import_node_stream.pipeline)(body,import_node_zlib.default.createGunzip(zlibOptions),error=>{error&&reject(error)}),response=new Response(body,responseOptions),resolve(response);return}if(codings==="deflate"||codings==="x-deflate"){let raw=(0,import_node_stream.pipeline)(response_,new import_node_stream.PassThrough,error=>{error&&reject(error)});raw.once("data",chunk=>{(chunk[0]&15)===8?body=(0,import_node_stream.pipeline)(body,import_node_zlib.default.createInflate(),error=>{error&&reject(error)}):body=(0,import_node_stream.pipeline)(body,import_node_zlib.default.createInflateRaw(),error=>{error&&reject(error)}),response=new Response(body,responseOptions),resolve(response)}),raw.once("end",()=>{response||(response=new Response(body,responseOptions),resolve(response))});return}if(codings==="br"){body=(0,import_node_stream.pipeline)(body,import_node_zlib.default.createBrotliDecompress(),error=>{error&&reject(error)}),response=new Response(body,responseOptions),resolve(response);return}response=new Response(body,responseOptions),resolve(response)}),writeToStream(request_,request).catch(reject)})}function fixResponseChunkedTransferBadEnding(request,errorCallback){let LAST_CHUNK=import_node_buffer.Buffer.from(`0\r +\r +`),isChunkedTransfer=!1,properLastChunkReceived=!1,previousChunk;request.on("response",response=>{let{headers}=response;isChunkedTransfer=headers["transfer-encoding"]==="chunked"&&!headers["content-length"]}),request.on("socket",socket=>{let onSocketClose=()=>{if(isChunkedTransfer&&!properLastChunkReceived){let error=new Error("Premature close");error.code="ERR_STREAM_PREMATURE_CLOSE",errorCallback(error)}},onData=buf=>{properLastChunkReceived=import_node_buffer.Buffer.compare(buf.slice(-5),LAST_CHUNK)===0,!properLastChunkReceived&&previousChunk&&(properLastChunkReceived=import_node_buffer.Buffer.compare(previousChunk.slice(-3),LAST_CHUNK.slice(0,3))===0&&import_node_buffer.Buffer.compare(buf.slice(-2),LAST_CHUNK.slice(3))===0),previousChunk=buf};socket.prependListener("close",onSocketClose),socket.on("data",onData),request.on("close",()=>{socket.removeListener("close",onSocketClose),socket.removeListener("data",onData)})})}function pd(event){let retv=privateData.get(event);return console.assert(retv!=null,"'this' is expected an Event object, but got",event),retv}function setCancelFlag(data){if(data.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",data.passiveListener);return}data.event.cancelable&&(data.canceled=!0,typeof data.event.preventDefault=="function"&&data.event.preventDefault())}function Event(eventTarget,event){privateData.set(this,{eventTarget,event,eventPhase:2,currentTarget:eventTarget,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:event.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let keys=Object.keys(event);for(let i2=0;i20){let types2=new Array(arguments.length);for(let i2=0;i2{},Object.assign(globalThis,require("node:stream/web")),process2.emitWarning=emitWarning}catch(error){throw process2.emitWarning=emitWarning,error}}catch{Object.assign(globalThis,requirePonyfill_es2018())}try{let{Blob:Blob4}=require("buffer");Blob4&&!Blob4.prototype.stream&&(Blob4.prototype.stream=function(params){let position=0,blob=this;return new ReadableStream({type:"bytes",async pull(ctrl){let buffer=await blob.slice(position,Math.min(blob.size,position+POOL_SIZE$1)).arrayBuffer();position+=buffer.byteLength,ctrl.enqueue(new Uint8Array(buffer)),position===blob.size&&ctrl.close()}})})}catch{}POOL_SIZE=65536;_Blob=class Blob{#parts=[];#type="";#size=0;#endings="transparent";constructor(blobParts=[],options={}){if(typeof blobParts!="object"||blobParts===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof blobParts[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof options!="object"&&typeof options!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");options===null&&(options={});let encoder=new TextEncoder;for(let element of blobParts){let part;ArrayBuffer.isView(element)?part=new Uint8Array(element.buffer.slice(element.byteOffset,element.byteOffset+element.byteLength)):element instanceof ArrayBuffer?part=new Uint8Array(element.slice(0)):element instanceof Blob?part=element:part=encoder.encode(`${element}`),this.#size+=ArrayBuffer.isView(part)?part.byteLength:part.size,this.#parts.push(part)}this.#endings=`${options.endings===void 0?"transparent":options.endings}`;let type=options.type===void 0?"":String(options.type);this.#type=/^[\x20-\x7E]*$/.test(type)?type:""}get size(){return this.#size}get type(){return this.#type}async text(){let decoder=new TextDecoder,str="";for await(let part of toIterator(this.#parts,!1))str+=decoder.decode(part,{stream:!0});return str+=decoder.decode(),str}async arrayBuffer(){let data=new Uint8Array(this.size),offset=0;for await(let chunk of toIterator(this.#parts,!1))data.set(chunk,offset),offset+=chunk.length;return data.buffer}stream(){let it=toIterator(this.#parts,!0);return new globalThis.ReadableStream({type:"bytes",async pull(ctrl){let chunk=await it.next();chunk.done?ctrl.close():ctrl.enqueue(chunk.value)},async cancel(){await it.return()}})}slice(start=0,end=this.size,type=""){let{size}=this,relativeStart=start<0?Math.max(size+start,0):Math.min(start,size),relativeEnd=end<0?Math.max(size+end,0):Math.min(end,size),span=Math.max(relativeEnd-relativeStart,0),parts=this.#parts,blobParts=[],added=0;for(let part of parts){if(added>=span)break;let size2=ArrayBuffer.isView(part)?part.byteLength:part.size;if(relativeStart&&size2<=relativeStart)relativeStart-=size2,relativeEnd-=size2;else{let chunk;ArrayBuffer.isView(part)?(chunk=part.subarray(relativeStart,Math.min(size2,relativeEnd)),added+=chunk.byteLength):(chunk=part.slice(relativeStart,Math.min(size2,relativeEnd)),added+=chunk.size),relativeEnd-=size2,blobParts.push(chunk),relativeStart=0}}let blob=new Blob([],{type:String(type).toLowerCase()});return blob.#size=span,blob.#parts=blobParts,blob}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](object){return object&&typeof object=="object"&&typeof object.constructor=="function"&&(typeof object.stream=="function"||typeof object.arrayBuffer=="function")&&/^(Blob|File)$/.test(object[Symbol.toStringTag])}};Object.defineProperties(_Blob.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});Blob2=_Blob,_Blob$1=Blob2,_File=class extends _Blob$1{#lastModified=0;#name="";constructor(fileBits,fileName,options={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(fileBits,options),options===null&&(options={});let lastModified=options.lastModified===void 0?Date.now():Number(options.lastModified);Number.isNaN(lastModified)||(this.#lastModified=lastModified),this.#name=String(fileName)}get name(){return this.#name}get lastModified(){return this.#lastModified}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](object){return!!object&&object instanceof _Blob$1&&/^(File)$/.test(object[Symbol.toStringTag])}},File2=_File,File$1=File2;({toStringTag:t,iterator:i,hasInstance:h}=Symbol),r=Math.random,m="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),f2=(a,b,c)=>(a+="",/^(Blob|File)$/.test(b&&b[t])?[(c=c!==void 0?c+"":b[t]=="File"?b.name:"blob",a),b.name!==c||b[t]=="blob"?new File$1([b],c,b):b]:[a,b+""]),e=(c,f3)=>(f3?c:c.replace(/\r?\n|\r/g,`\r +`)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),x=(n,a,e2)=>{if(a.lengthtypeof o[m2]!="function")}append(...a){x("append",arguments,2),this.#d.push(f2(...a))}delete(a){x("delete",arguments,1),a+="",this.#d=this.#d.filter(([b])=>b!==a)}get(a){x("get",arguments,1),a+="";for(var b=this.#d,l=b.length,c=0;cc[0]===a&&b.push(c[1])),b}has(a){return x("has",arguments,1),a+="",this.#d.some(b=>b[0]===a)}forEach(a,b){x("forEach",arguments,1);for(var[c,d]of this)a.call(b,d,c,this)}set(...a){x("set",arguments,2);var b=[],c=!0;a=f2(...a),this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)}),c&&b.push(a),this.#d=b}*entries(){yield*this.#d}*keys(){for(var[a]of this)yield a}*values(){for(var[,a]of this)yield a}};FetchBaseError=class extends Error{constructor(message,type){super(message),Error.captureStackTrace(this,this.constructor),this.type=type}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}},FetchError=class extends FetchBaseError{constructor(message,type,systemError){super(message,type),systemError&&(this.code=this.errno=systemError.code,this.erroredSysCall=systemError.syscall)}},NAME=Symbol.toStringTag,isURLSearchParameters=object=>typeof object=="object"&&typeof object.append=="function"&&typeof object.delete=="function"&&typeof object.get=="function"&&typeof object.getAll=="function"&&typeof object.has=="function"&&typeof object.set=="function"&&typeof object.sort=="function"&&object[NAME]==="URLSearchParams",isBlob=object=>object&&typeof object=="object"&&typeof object.arrayBuffer=="function"&&typeof object.type=="string"&&typeof object.stream=="function"&&typeof object.constructor=="function"&&/^(Blob|File)$/.test(object[NAME]),isAbortSignal=object=>typeof object=="object"&&(object[NAME]==="AbortSignal"||object[NAME]==="EventTarget"),isDomainOrSubdomain=(destination,original)=>{let orig=new URL(original).hostname,dest=new URL(destination).hostname;return orig===dest||orig.endsWith(`.${dest}`)},isSameProtocol=(destination,original)=>{let orig=new URL(original).protocol,dest=new URL(destination).protocol;return orig===dest},pipeline=(0,import_node_util.promisify)(import_node_stream.default.pipeline),INTERNALS$2=Symbol("Body internals"),Body=class{constructor(body,{size=0}={}){let boundary=null;body===null?body=null:isURLSearchParameters(body)?body=import_node_buffer.Buffer.from(body.toString()):isBlob(body)||import_node_buffer.Buffer.isBuffer(body)||(import_node_util.types.isAnyArrayBuffer(body)?body=import_node_buffer.Buffer.from(body):ArrayBuffer.isView(body)?body=import_node_buffer.Buffer.from(body.buffer,body.byteOffset,body.byteLength):body instanceof import_node_stream.default||(body instanceof FormData?(body=formDataToBlob(body),boundary=body.type.split("=")[1]):body=import_node_buffer.Buffer.from(String(body))));let stream=body;import_node_buffer.Buffer.isBuffer(body)?stream=import_node_stream.default.Readable.from(body):isBlob(body)&&(stream=import_node_stream.default.Readable.from(body.stream())),this[INTERNALS$2]={body,stream,boundary,disturbed:!1,error:null},this.size=size,body instanceof import_node_stream.default&&body.on("error",error_=>{let error=error_ instanceof FetchBaseError?error_:new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`,"system",error_);this[INTERNALS$2].error=error})}get body(){return this[INTERNALS$2].stream}get bodyUsed(){return this[INTERNALS$2].disturbed}async arrayBuffer(){let{buffer,byteOffset,byteLength}=await consumeBody(this);return buffer.slice(byteOffset,byteOffset+byteLength)}async formData(){let ct=this.headers.get("content-type");if(ct.startsWith("application/x-www-form-urlencoded")){let formData=new FormData,parameters=new URLSearchParams(await this.text());for(let[name,value]of parameters)formData.append(name,value);return formData}let{toFormData:toFormData2}=await Promise.resolve().then(()=>(init_multipart_parser(),multipart_parser_exports));return toFormData2(this.body,ct)}async blob(){let ct=this.headers&&this.headers.get("content-type")||this[INTERNALS$2].body&&this[INTERNALS$2].body.type||"",buf=await this.arrayBuffer();return new _Blob$1([buf],{type:ct})}async json(){let text=await this.text();return JSON.parse(text)}async text(){let buffer=await consumeBody(this);return new TextDecoder().decode(buffer)}buffer(){return consumeBody(this)}};Body.prototype.buffer=(0,import_node_util.deprecate)(Body.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Body.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,import_node_util.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});clone=(instance,highWaterMark)=>{let p1,p2,{body}=instance[INTERNALS$2];if(instance.bodyUsed)throw new Error("cannot clone body after it is used");return body instanceof import_node_stream.default&&typeof body.getBoundary!="function"&&(p1=new import_node_stream.PassThrough({highWaterMark}),p2=new import_node_stream.PassThrough({highWaterMark}),body.pipe(p1),body.pipe(p2),instance[INTERNALS$2].stream=p1,body=p2),body},getNonSpecFormDataBoundary=(0,import_node_util.deprecate)(body=>body.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),extractContentType=(body,request)=>body===null?null:typeof body=="string"?"text/plain;charset=UTF-8":isURLSearchParameters(body)?"application/x-www-form-urlencoded;charset=UTF-8":isBlob(body)?body.type||null:import_node_buffer.Buffer.isBuffer(body)||import_node_util.types.isAnyArrayBuffer(body)||ArrayBuffer.isView(body)?null:body instanceof FormData?`multipart/form-data; boundary=${request[INTERNALS$2].boundary}`:body&&typeof body.getBoundary=="function"?`multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`:body instanceof import_node_stream.default?null:"text/plain;charset=UTF-8",getTotalBytes=request=>{let{body}=request[INTERNALS$2];return body===null?0:isBlob(body)?body.size:import_node_buffer.Buffer.isBuffer(body)?body.length:body&&typeof body.getLengthSync=="function"&&body.hasKnownLength&&body.hasKnownLength()?body.getLengthSync():null},writeToStream=async(dest,{body})=>{body===null?dest.end():await pipeline(body,dest)},validateHeaderName=typeof import_node_http.default.validateHeaderName=="function"?import_node_http.default.validateHeaderName:name=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)){let error=new TypeError(`Header name must be a valid HTTP token [${name}]`);throw Object.defineProperty(error,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),error}},validateHeaderValue=typeof import_node_http.default.validateHeaderValue=="function"?import_node_http.default.validateHeaderValue:(name,value)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)){let error=new TypeError(`Invalid character in header content ["${name}"]`);throw Object.defineProperty(error,"code",{value:"ERR_INVALID_CHAR"}),error}},Headers=class _Headers extends URLSearchParams{constructor(init){let result=[];if(init instanceof _Headers){let raw=init.raw();for(let[name,values]of Object.entries(raw))result.push(...values.map(value=>[name,value]))}else if(init!=null)if(typeof init=="object"&&!import_node_util.types.isBoxedPrimitive(init)){let method=init[Symbol.iterator];if(method==null)result.push(...Object.entries(init));else{if(typeof method!="function")throw new TypeError("Header pairs must be iterable");result=[...init].map(pair=>{if(typeof pair!="object"||import_node_util.types.isBoxedPrimitive(pair))throw new TypeError("Each header pair must be an iterable object");return[...pair]}).map(pair=>{if(pair.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...pair]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence> or record)");return result=result.length>0?result.map(([name,value])=>(validateHeaderName(name),validateHeaderValue(name,String(value)),[String(name).toLowerCase(),String(value)])):void 0,super(result),new Proxy(this,{get(target,p,receiver){switch(p){case"append":case"set":return(name,value)=>(validateHeaderName(name),validateHeaderValue(name,String(value)),URLSearchParams.prototype[p].call(target,String(name).toLowerCase(),String(value)));case"delete":case"has":case"getAll":return name=>(validateHeaderName(name),URLSearchParams.prototype[p].call(target,String(name).toLowerCase()));case"keys":return()=>(target.sort(),new Set(URLSearchParams.prototype.keys.call(target)).keys());default:return Reflect.get(target,p,receiver)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(name){let values=this.getAll(name);if(values.length===0)return null;let value=values.join(", ");return/^content-encoding$/i.test(name)&&(value=value.toLowerCase()),value}forEach(callback,thisArg=void 0){for(let name of this.keys())Reflect.apply(callback,thisArg,[this.get(name),name,this])}*values(){for(let name of this.keys())yield this.get(name)}*entries(){for(let name of this.keys())yield[name,this.get(name)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((result,key)=>(result[key]=this.getAll(key),result),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((result,key)=>{let values=this.getAll(key);return key==="host"?result[key]=values[0]:result[key]=values.length>1?values:values[0],result},{})}};Object.defineProperties(Headers.prototype,["get","entries","forEach","values"].reduce((result,property)=>(result[property]={enumerable:!0},result),{}));redirectStatus=new Set([301,302,303,307,308]),isRedirect=code=>redirectStatus.has(code),INTERNALS$1=Symbol("Response internals"),Response=class _Response extends Body{constructor(body=null,options={}){super(body,options);let status=options.status!=null?options.status:200,headers=new Headers(options.headers);if(body!==null&&!headers.has("Content-Type")){let contentType=extractContentType(body,this);contentType&&headers.append("Content-Type",contentType)}this[INTERNALS$1]={type:"default",url:options.url,status,statusText:options.statusText||"",headers,counter:options.counter,highWaterMark:options.highWaterMark}}get type(){return this[INTERNALS$1].type}get url(){return this[INTERNALS$1].url||""}get status(){return this[INTERNALS$1].status}get ok(){return this[INTERNALS$1].status>=200&&this[INTERNALS$1].status<300}get redirected(){return this[INTERNALS$1].counter>0}get statusText(){return this[INTERNALS$1].statusText}get headers(){return this[INTERNALS$1].headers}get highWaterMark(){return this[INTERNALS$1].highWaterMark}clone(){return new _Response(clone(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(url,status=302){if(!isRedirect(status))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new _Response(null,{headers:{location:new URL(url).toString()},status})}static error(){let response=new _Response(null,{status:0,statusText:""});return response[INTERNALS$1].type="error",response}static json(data=void 0,init={}){let body=JSON.stringify(data);if(body===void 0)throw new TypeError("data is not JSON serializable");let headers=new Headers(init&&init.headers);return headers.has("content-type")||headers.set("content-type","application/json"),new _Response(body,{...init,headers})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Response.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});getSearch=parsedURL=>{if(parsedURL.search)return parsedURL.search;let lastOffset=parsedURL.href.length-1,hash=parsedURL.hash||(parsedURL.href[lastOffset]==="#"?"#":"");return parsedURL.href[lastOffset-hash.length]==="?"?"?":""};ReferrerPolicy=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),DEFAULT_REFERRER_POLICY="strict-origin-when-cross-origin";INTERNALS=Symbol("Request internals"),isRequest=object=>typeof object=="object"&&typeof object[INTERNALS]=="object",doBadDataWarn=(0,import_node_util.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Request=class _Request extends Body{constructor(input,init={}){let parsedURL;if(isRequest(input)?parsedURL=new URL(input.url):(parsedURL=new URL(input),input={}),parsedURL.username!==""||parsedURL.password!=="")throw new TypeError(`${parsedURL} is an url with embedded credentials.`);let method=init.method||input.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(method)&&(method=method.toUpperCase()),!isRequest(init)&&"data"in init&&doBadDataWarn(),(init.body!=null||isRequest(input)&&input.body!==null)&&(method==="GET"||method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let inputBody=init.body?init.body:isRequest(input)&&input.body!==null?clone(input):null;super(inputBody,{size:init.size||input.size||0});let headers=new Headers(init.headers||input.headers||{});if(inputBody!==null&&!headers.has("Content-Type")){let contentType=extractContentType(inputBody,this);contentType&&headers.set("Content-Type",contentType)}let signal=isRequest(input)?input.signal:null;if("signal"in init&&(signal=init.signal),signal!=null&&!isAbortSignal(signal))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let referrer=init.referrer==null?input.referrer:init.referrer;if(referrer==="")referrer="no-referrer";else if(referrer){let parsedReferrer=new URL(referrer);referrer=/^about:(\/\/)?client$/.test(parsedReferrer)?"client":parsedReferrer}else referrer=void 0;this[INTERNALS]={method,redirect:init.redirect||input.redirect||"follow",headers,parsedURL,signal,referrer},this.follow=init.follow===void 0?input.follow===void 0?20:input.follow:init.follow,this.compress=init.compress===void 0?input.compress===void 0?!0:input.compress:init.compress,this.counter=init.counter||input.counter||0,this.agent=init.agent||input.agent,this.highWaterMark=init.highWaterMark||input.highWaterMark||16384,this.insecureHTTPParser=init.insecureHTTPParser||input.insecureHTTPParser||!1,this.referrerPolicy=init.referrerPolicy||input.referrerPolicy||""}get method(){return this[INTERNALS].method}get url(){return(0,import_node_url.format)(this[INTERNALS].parsedURL)}get headers(){return this[INTERNALS].headers}get redirect(){return this[INTERNALS].redirect}get signal(){return this[INTERNALS].signal}get referrer(){if(this[INTERNALS].referrer==="no-referrer")return"";if(this[INTERNALS].referrer==="client")return"about:client";if(this[INTERNALS].referrer)return this[INTERNALS].referrer.toString()}get referrerPolicy(){return this[INTERNALS].referrerPolicy}set referrerPolicy(referrerPolicy){this[INTERNALS].referrerPolicy=validateReferrerPolicy(referrerPolicy)}clone(){return new _Request(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Request.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});getNodeRequestOptions=request=>{let{parsedURL}=request[INTERNALS],headers=new Headers(request[INTERNALS].headers);headers.has("Accept")||headers.set("Accept","*/*");let contentLengthValue=null;if(request.body===null&&/^(post|put)$/i.test(request.method)&&(contentLengthValue="0"),request.body!==null){let totalBytes=getTotalBytes(request);typeof totalBytes=="number"&&!Number.isNaN(totalBytes)&&(contentLengthValue=String(totalBytes))}contentLengthValue&&headers.set("Content-Length",contentLengthValue),request.referrerPolicy===""&&(request.referrerPolicy=DEFAULT_REFERRER_POLICY),request.referrer&&request.referrer!=="no-referrer"?request[INTERNALS].referrer=determineRequestsReferrer(request):request[INTERNALS].referrer="no-referrer",request[INTERNALS].referrer instanceof URL&&headers.set("Referer",request.referrer),headers.has("User-Agent")||headers.set("User-Agent","node-fetch"),request.compress&&!headers.has("Accept-Encoding")&&headers.set("Accept-Encoding","gzip, deflate, br");let{agent}=request;typeof agent=="function"&&(agent=agent(parsedURL)),!headers.has("Connection")&&!agent&&headers.set("Connection","close");let search=getSearch(parsedURL),options={path:parsedURL.pathname+search,method:request.method,headers:headers[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:request.insecureHTTPParser,agent};return{parsedURL,options}},AbortError=class extends FetchBaseError{constructor(message,type="aborted"){super(message,type)}};if(!globalThis.DOMException)try{let{MessageChannel}=require("worker_threads"),port=new MessageChannel().port1,ab=new ArrayBuffer;port.postMessage(ab,[ab,ab])}catch(err){err.constructor.name==="DOMException"&&(globalThis.DOMException=err.constructor)}nodeDomexception=globalThis.DOMException,DOMException$1=getDefaultExportFromCjs(nodeDomexception),supportedSchemas=new Set(["data:","http:","https:"]);privateData=new WeakMap,wrappers=new WeakMap;Event.prototype={get type(){return pd(this).event.type},get target(){return pd(this).eventTarget},get currentTarget(){return pd(this).currentTarget},composedPath(){let currentTarget=pd(this).currentTarget;return currentTarget==null?[]:[currentTarget]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return pd(this).eventPhase},stopPropagation(){let data=pd(this);data.stopped=!0,typeof data.event.stopPropagation=="function"&&data.event.stopPropagation()},stopImmediatePropagation(){let data=pd(this);data.stopped=!0,data.immediateStopped=!0,typeof data.event.stopImmediatePropagation=="function"&&data.event.stopImmediatePropagation()},get bubbles(){return!!pd(this).event.bubbles},get cancelable(){return!!pd(this).event.cancelable},preventDefault(){setCancelFlag(pd(this))},get defaultPrevented(){return pd(this).canceled},get composed(){return!!pd(this).event.composed},get timeStamp(){return pd(this).timeStamp},get srcElement(){return pd(this).eventTarget},get cancelBubble(){return pd(this).stopped},set cancelBubble(value){if(!value)return;let data=pd(this);data.stopped=!0,typeof data.event.cancelBubble=="boolean"&&(data.event.cancelBubble=!0)},get returnValue(){return!pd(this).canceled},set returnValue(value){value||setCancelFlag(pd(this))},initEvent(){}};Object.defineProperty(Event.prototype,"constructor",{value:Event,configurable:!0,writable:!0});typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(Event.prototype,window.Event.prototype),wrappers.set(window.Event.prototype,Event));listenersMap=new WeakMap,CAPTURE=1,BUBBLE=2,ATTRIBUTE=3;EventTarget.prototype={addEventListener(eventName,listener,options){if(listener==null)return;if(typeof listener!="function"&&!isObject(listener))throw new TypeError("'listener' should be a function or an object.");let listeners=getListeners(this),optionsIsObj=isObject(options),listenerType=(optionsIsObj?!!options.capture:!!options)?CAPTURE:BUBBLE,newNode={listener,listenerType,passive:optionsIsObj&&!!options.passive,once:optionsIsObj&&!!options.once,next:null},node=listeners.get(eventName);if(node===void 0){listeners.set(eventName,newNode);return}let prev=null;for(;node!=null;){if(node.listener===listener&&node.listenerType===listenerType)return;prev=node,node=node.next}prev.next=newNode},removeEventListener(eventName,listener,options){if(listener==null)return;let listeners=getListeners(this),listenerType=(isObject(options)?!!options.capture:!!options)?CAPTURE:BUBBLE,prev=null,node=listeners.get(eventName);for(;node!=null;){if(node.listener===listener&&node.listenerType===listenerType){prev!==null?prev.next=node.next:node.next!==null?listeners.set(eventName,node.next):listeners.delete(eventName);return}prev=node,node=node.next}},dispatchEvent(event){if(event==null||typeof event.type!="string")throw new TypeError('"event.type" should be a string.');let listeners=getListeners(this),eventName=event.type,node=listeners.get(eventName);if(node==null)return!0;let wrappedEvent=wrapEvent(this,event),prev=null;for(;node!=null;){if(node.once?prev!==null?prev.next=node.next:node.next!==null?listeners.set(eventName,node.next):listeners.delete(eventName):prev=node,setPassiveListener(wrappedEvent,node.passive?node.listener:null),typeof node.listener=="function")try{node.listener.call(this,wrappedEvent)}catch(err){typeof console<"u"&&typeof console.error=="function"&&console.error(err)}else node.listenerType!==ATTRIBUTE&&typeof node.listener.handleEvent=="function"&&node.listener.handleEvent(wrappedEvent);if(isStopped(wrappedEvent))break;node=node.next}return setPassiveListener(wrappedEvent,null),setEventPhase(wrappedEvent,0),setCurrentTarget(wrappedEvent,null),!wrappedEvent.defaultPrevented}};Object.defineProperty(EventTarget.prototype,"constructor",{value:EventTarget,configurable:!0,writable:!0});typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(EventTarget.prototype,window.EventTarget.prototype);AbortSignal=class extends EventTarget{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let aborted=abortedFlags.get(this);if(typeof aborted!="boolean")throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return aborted}};defineEventAttribute(AbortSignal.prototype,"abort");abortedFlags=new WeakMap;Object.defineProperties(AbortSignal.prototype,{aborted:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(AbortSignal.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});AbortController$1=class{constructor(){signals.set(this,createAbortSignal())}get signal(){return getSignal(this)}abort(){abortSignal(getSignal(this))}},signals=new WeakMap;Object.defineProperties(AbortController$1.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(AbortController$1.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"})}});var core=__toESM(require_core()),import_exec=__toESM(require_exec());var import_node_http2=__toESM(require("node:http"),1),import_node_https2=__toESM(require("node:https"),1);init_node_fetch_native_d7878b77();init_node_fetch_native_d7878b77();var import_node_fs=require("node:fs");init_node_fetch_native_d7878b77();var{stat}=import_node_fs.promises;var BlobDataItem=class _BlobDataItem{#path;#start;constructor(options){this.#path=options.path,this.#start=options.start,this.size=options.size,this.lastModified=options.lastModified}slice(start,end){return new _BlobDataItem({path:this.#path,lastModified:this.lastModified,size:end-start,start:this.#start+start})}async*stream(){let{mtimeMs}=await stat(this.#path);if(mtimeMs>this.lastModified)throw new DOMException$1("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*(0,import_node_fs.createReadStream)(this.#path,{start:this.#start,end:this.#start+this.size-1})}get[Symbol.toStringTag](){return"Blob"}};var _forceNodeFetch=typeof process!==void 0&&typeof process.env!==void 0&&process.env.FORCE_NODE_FETCH;function _getFetch(){return!_forceNodeFetch&&globalThis.fetch?globalThis.fetch:fetch}var fetch2=_getFetch(),Blob3=!_forceNodeFetch&&globalThis.Blob||_Blob$1,File3=!_forceNodeFetch&&globalThis.File||File$1,FormData3=!_forceNodeFetch&&globalThis.FormData||FormData,Headers2=!_forceNodeFetch&&globalThis.Headers||Headers,Request2=!_forceNodeFetch&&globalThis.Request||Request,Response2=!_forceNodeFetch&&globalThis.Response||Response,AbortController3=!_forceNodeFetch&&globalThis.AbortController||AbortController$1;var suspectProtoRx=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,suspectConstructorRx=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,JsonSigRx=/^\s*["[{]|^\s*-?\d[\d.]{0,14}\s*$/;function jsonParseTransform(key,value){if(key==="__proto__"||key==="constructor"&&value&&typeof value=="object"&&"prototype"in value){warnKeyDropped(key);return}return value}function warnKeyDropped(key){console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`)}function destr(value,options={}){if(typeof value!="string")return value;let _value=value.trim();if(value[0]==='"'&&value[value.length-1]==='"')return _value.slice(1,-1);let _lval=_value.toLowerCase();if(_lval==="true")return!0;if(_lval==="false")return!1;if(_lval!=="undefined"){if(_lval==="null")return null;if(_lval==="nan")return Number.NaN;if(_lval==="infinity")return Number.POSITIVE_INFINITY;if(_lval==="-infinity")return Number.NEGATIVE_INFINITY;if(!JsonSigRx.test(value)){if(options.strict)throw new SyntaxError("[destr] Invalid JSON");return value}try{if(suspectProtoRx.test(value)||suspectConstructorRx.test(value)){if(options.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(value,jsonParseTransform)}return JSON.parse(value)}catch(error){if(options.strict)throw error;return value}}}var r2=String.fromCharCode;var HASH_RE=/#/g,AMPERSAND_RE=/&/g;var EQUAL_RE=/=/g;var PLUS_RE=/\+/g,ENC_CARET_RE=/%5e/gi,ENC_BACKTICK_RE=/%60/gi;var ENC_PIPE_RE=/%7c/gi;var ENC_SPACE_RE=/%20/gi;function encode(text){return encodeURI(""+text).replace(ENC_PIPE_RE,"|")}function encodeQueryValue(input){return encode(typeof input=="string"?input:JSON.stringify(input)).replace(PLUS_RE,"%2B").replace(ENC_SPACE_RE,"+").replace(HASH_RE,"%23").replace(AMPERSAND_RE,"%26").replace(ENC_BACKTICK_RE,"`").replace(ENC_CARET_RE,"^")}function encodeQueryKey(text){return encodeQueryValue(text).replace(EQUAL_RE,"%3D")}function decode(text=""){try{return decodeURIComponent(""+text)}catch{return""+text}}function decodeQueryValue(text){return decode(text.replace(PLUS_RE," "))}function parseQuery(parametersString=""){let object={};parametersString[0]==="?"&&(parametersString=parametersString.slice(1));for(let parameter of parametersString.split("&")){let s2=parameter.match(/([^=]+)=?(.*)/)||[];if(s2.length<2)continue;let key=decode(s2[1]);if(key==="__proto__"||key==="constructor")continue;let value=decodeQueryValue(s2[2]||"");typeof object[key]<"u"?Array.isArray(object[key])?object[key].push(value):object[key]=[object[key],value]:object[key]=value}return object}function encodeQueryItem(key,value){return(typeof value=="number"||typeof value=="boolean")&&(value=String(value)),value?Array.isArray(value)?value.map(_value=>`${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&"):`${encodeQueryKey(key)}=${encodeQueryValue(value)}`:encodeQueryKey(key)}function stringifyQuery(query){return Object.keys(query).filter(k=>query[k]!==void 0).map(k=>encodeQueryItem(k,query[k])).join("&")}var PROTOCOL_STRICT_REGEX=/^\w{2,}:([/\\]{1,2})/,PROTOCOL_REGEX=/^\w{2,}:([/\\]{2})?/,PROTOCOL_RELATIVE_REGEX=/^([/\\]\s*){2,}[^/\\]/;function hasProtocol(inputString,opts={}){return typeof opts=="boolean"&&(opts={acceptRelative:opts}),opts.strict?PROTOCOL_STRICT_REGEX.test(inputString):PROTOCOL_REGEX.test(inputString)||(opts.acceptRelative?PROTOCOL_RELATIVE_REGEX.test(inputString):!1)}var TRAILING_SLASH_RE=/\/$|\/\?/;function hasTrailingSlash(input="",queryParameters=!1){return queryParameters?TRAILING_SLASH_RE.test(input):input.endsWith("/")}function withoutTrailingSlash(input="",queryParameters=!1){if(!queryParameters)return(hasTrailingSlash(input)?input.slice(0,-1):input)||"/";if(!hasTrailingSlash(input,!0))return input||"/";let[s0,...s2]=input.split("?");return(s0.slice(0,-1)||"/")+(s2.length>0?`?${s2.join("?")}`:"")}function withTrailingSlash(input="",queryParameters=!1){if(!queryParameters)return input.endsWith("/")?input:input+"/";if(hasTrailingSlash(input,!0))return input||"/";let[s0,...s2]=input.split("?");return s0+"/"+(s2.length>0?`?${s2.join("?")}`:"")}function hasLeadingSlash(input=""){return input.startsWith("/")}function withoutLeadingSlash(input=""){return(hasLeadingSlash(input)?input.slice(1):input)||"/"}function withBase(input,base){if(isEmptyURL(base)||hasProtocol(input))return input;let _base=withoutTrailingSlash(base);return input.startsWith(_base)?input:joinURL(_base,input)}function withQuery(input,query){let parsed=parseURL(input),mergedQuery={...parseQuery(parsed.search),...query};return parsed.search=stringifyQuery(mergedQuery),stringifyParsedURL(parsed)}function isEmptyURL(url){return!url||url==="/"}function isNonEmptyURL(url){return url&&url!=="/"}function joinURL(base,...input){let url=base||"";for(let index of input.filter(url2=>isNonEmptyURL(url2)))url=url?withTrailingSlash(url)+withoutLeadingSlash(index):index;return url}function parseURL(input="",defaultProto){if(!hasProtocol(input,{acceptRelative:!0}))return defaultProto?parseURL(defaultProto+input):parsePath(input);let[protocol="",auth,hostAndPath=""]=(input.replace(/\\/g,"/").match(/([^/:]+:)?\/\/([^/@]+@)?(.*)/)||[]).splice(1),[host="",path=""]=(hostAndPath.match(/([^#/?]*)(.*)?/)||[]).splice(1),{pathname,search,hash}=parsePath(path.replace(/\/(?=[A-Za-z]:)/,""));return{protocol,auth:auth?auth.slice(0,Math.max(0,auth.length-1)):"",host,pathname,search,hash}}function parsePath(input=""){let[pathname="",search="",hash=""]=(input.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname,search,hash}}function stringifyParsedURL(parsed){let fullpath=parsed.pathname+(parsed.search?(parsed.search.startsWith("?")?"":"?")+parsed.search:"")+parsed.hash;return parsed.protocol?parsed.protocol+"//"+(parsed.auth?parsed.auth+"@":"")+parsed.host+fullpath:fullpath}var FetchError2=class extends Error{constructor(){super(...arguments),this.name="FetchError"}};function createFetchError(request,error,response){let message="";error&&(message=error.message),request&&response?message=`${message} (${response.status} ${response.statusText} (${request.toString()}))`:request&&(message=`${message} (${request.toString()})`);let fetchError=new FetchError2(message);return Object.defineProperty(fetchError,"request",{get(){return request}}),Object.defineProperty(fetchError,"response",{get(){return response}}),Object.defineProperty(fetchError,"data",{get(){return response&&response._data}}),Object.defineProperty(fetchError,"status",{get(){return response&&response.status}}),Object.defineProperty(fetchError,"statusText",{get(){return response&&response.statusText}}),Object.defineProperty(fetchError,"statusCode",{get(){return response&&response.status}}),Object.defineProperty(fetchError,"statusMessage",{get(){return response&&response.statusText}}),fetchError}var payloadMethods=new Set(Object.freeze(["PATCH","POST","PUT","DELETE"]));function isPayloadMethod(method="GET"){return payloadMethods.has(method.toUpperCase())}function isJSONSerializable(value){if(value===void 0)return!1;let t2=typeof value;return t2==="string"||t2==="number"||t2==="boolean"||t2===null?!0:t2!=="object"?!1:Array.isArray(value)?!0:value.constructor&&value.constructor.name==="Object"||typeof value.toJSON=="function"}var textTypes=new Set(["image/svg","application/xml","application/xhtml","application/html"]),JSON_RE=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function detectResponseType(_contentType=""){if(!_contentType)return"json";let contentType=_contentType.split(";").shift()||"";return JSON_RE.test(contentType)?"json":textTypes.has(contentType)||contentType.startsWith("text/")?"text":"blob"}function mergeFetchOptions(input,defaults,Headers4=globalThis.Headers){let merged={...defaults,...input};if(defaults?.params&&input?.params&&(merged.params={...defaults?.params,...input?.params}),defaults?.query&&input?.query&&(merged.query={...defaults?.query,...input?.query}),defaults?.headers&&input?.headers){merged.headers=new Headers4(defaults?.headers||{});for(let[key,value]of new Headers4(input?.headers||{}))merged.headers.set(key,value)}return merged}var retryStatusCodes=new Set([408,409,425,429,500,502,503,504]);function createFetch(globalOptions){let{fetch:fetch4,Headers:Headers4}=globalOptions;function onError(context){let isAbort=context.error&&context.error.name==="AbortError"||!1;if(context.options.retry!==!1&&!isAbort){let retries;typeof context.options.retry=="number"?retries=context.options.retry:retries=isPayloadMethod(context.options.method)?0:1;let responseCode=context.response&&context.response.status||500;if(retries>0&&retryStatusCodes.has(responseCode))return $fetchRaw(context.request,{...context.options,retry:retries-1})}let error=createFetchError(context.request,context.error,context.response);throw Error.captureStackTrace&&Error.captureStackTrace(error,$fetchRaw),error}let $fetchRaw=async function(_request,_options={}){let context={request:_request,options:mergeFetchOptions(_options,globalOptions.defaults,Headers4),response:void 0,error:void 0};context.options.onRequest&&await context.options.onRequest(context),typeof context.request=="string"&&(context.options.baseURL&&(context.request=withBase(context.request,context.options.baseURL)),(context.options.query||context.options.params)&&(context.request=withQuery(context.request,{...context.options.params,...context.options.query})),context.options.body&&isPayloadMethod(context.options.method)&&isJSONSerializable(context.options.body)&&(context.options.body=typeof context.options.body=="string"?context.options.body:JSON.stringify(context.options.body),context.options.headers=new Headers4(context.options.headers||{}),context.options.headers.has("content-type")||context.options.headers.set("content-type","application/json"),context.options.headers.has("accept")||context.options.headers.set("accept","application/json")));try{context.response=await fetch4(context.request,context.options)}catch(error){return context.error=error,context.options.onRequestError&&await context.options.onRequestError(context),await onError(context)}let responseType=(context.options.parseResponse?"json":context.options.responseType)||detectResponseType(context.response.headers.get("content-type")||"");if(responseType==="json"){let data=await context.response.text(),parseFunction=context.options.parseResponse||destr;context.response._data=parseFunction(data)}else responseType==="stream"?context.response._data=context.response.body:context.response._data=await context.response[responseType]();return context.options.onResponse&&await context.options.onResponse(context),!context.options.ignoreResponseError&&context.response.status>=400&&context.response.status<600?(context.options.onResponseError&&await context.options.onResponseError(context),await onError(context)):context.response},$fetch=async function(request,options){return(await $fetchRaw(request,options))._data};return $fetch.raw=$fetchRaw,$fetch.native=fetch4,$fetch.create=(defaultOptions={})=>createFetch({...globalOptions,defaults:{...globalOptions.defaults,...defaultOptions}}),$fetch}function createNodeFetch(){if(!JSON.parse(process.env.FETCH_KEEP_ALIVE||"false"))return fetch2;let agentOptions={keepAlive:!0},httpAgent=new import_node_http2.default.Agent(agentOptions),httpsAgent=new import_node_https2.default.Agent(agentOptions),nodeFetchOptions={agent(parsedURL){return parsedURL.protocol==="http:"?httpAgent:httpsAgent}};return function(input,init){return fetch2(input,{...nodeFetchOptions,...init})}}var fetch3=globalThis.fetch||createNodeFetch(),Headers3=globalThis.Headers||Headers2,ofetch=createFetch({fetch:fetch3,Headers:Headers3});var import_promises=require("node:fs/promises"),import_node_os=require("node:os"),import_node_path=require("node:path"),install=async()=>{core.startGroup("Install attic"),core.info("Installing attic");let installScript=await fetch3("https://raw.githubusercontent.com/zhaofengli/attic/main/.github/install-attic-ci.sh").then(r3=>(r3.ok||(core.setFailed(`Action failed with error: ${r3.statusText}`),core.endGroup(),process.exit(1)),r3.text()));try{let installScriptPath=(0,import_node_path.join)((0,import_node_os.tmpdir)(),"install-attic-ci.sh");await(0,import_promises.writeFile)(installScriptPath,installScript),core.info("Running install script"),await(0,import_exec.exec)("bash",[installScriptPath])}catch(e2){core.setFailed(`Action failed with error: ${e2}`)}core.endGroup()};var core2=__toESM(require_core()),import_exec3=__toESM(require_exec());var import_exec2=__toESM(require_exec()),import_node_stream2=require("node:stream"),StringStream=class extends import_node_stream2.Writable{chunks=[];_write(chunk,_enc,next){this.chunks.push(Buffer.from(chunk)),next()}string(){return Buffer.concat(this.chunks).toString("utf-8")}},getStorePaths=async()=>{let outStream=new StringStream;return await(0,import_exec2.exec)("nix",["path-info","--all"],{outStream}),outStream.string().split(` +`).filter(Boolean)};var configure=async()=>{core2.startGroup("Configure attic");try{let endpoint=core2.getInput("endpoint"),cache=core2.getInput("cache"),token=core2.getInput("token");core2.info("Logging in to attic cache"),await(0,import_exec3.exec)("attic",["login","--set-default",cache,endpoint,token]),core2.info("Collecting store paths before build");let paths=await getStorePaths();core2.saveState("initial-paths",JSON.stringify(paths))}catch(e2){core2.setFailed(`Action failed with error: ${e2}`)}core2.endGroup()};var core3=__toESM(require_core()),import_exec4=__toESM(require_exec());var arraySplit=split;function split(arr,n){if(!Array.isArray(arr))throw new Error("expected an array for the first argument");if(n!=null&&typeof n!="number")throw new Error("expected a number or null/undefined for the second argument");n=n??arr.length;for(var len=arr.length,groups=[],i2=0;i2{core3.startGroup("Push to Attic");try{if(core3.getInput("skip-push")==="true")core3.info("Pushing to cache is disabled by skip-push");else{let cache=core3.getInput("cache");core3.info("Pushing to cache");let oldPaths=JSON.parse(core3.getState("initial-paths")),addedPaths=(await getStorePaths()).filter(p=>!oldPaths.includes(p)).filter(p=>!p.endsWith(".drv")&&!p.endsWith(".drv.chroot")&&!p.endsWith(".check")&&!p.endsWith(".lock")),splitAddedPaths=arraySplit(addedPaths,25);for(let addedPaths2 of splitAddedPaths)await(0,import_exec4.exec)("attic",["push",cache,...addedPaths2])}}catch(e2){core3.setFailed(`Action failed with error: ${e2}`)}core3.endGroup()};var import_core=__toESM(require_core()),isPost=!!(0,import_core.getState)("isPost"),main=async()=>{await install(),await configure()};isPost?push():((0,import_core.saveState)("isPost",!0),main()); +/*! Bundled license information: + +node-fetch-native/dist/shared/node-fetch-native.d7878b77.mjs: + (*! fetch-blob. MIT License. Jimmy Wärting *) + (*! formdata-polyfill. MIT License. Jimmy Wärting *) + (*! node-domexception. MIT License. Jimmy Wärting *) +*/ diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 3de746d..0000000 --- a/flake.lock +++ /dev/null @@ -1,26 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1689850295, - "narHash": "sha256-fUYf6WdQlhd2H+3aR8jST5dhFH1d0eE22aes8fNIfyk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5df4d78d54f7a34e9ea1f84a22b4fd9baebc68d0", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 988133f..0000000 --- a/flake.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - description = "Github Action for caching Nix derivations with attic"; - - inputs = { - nixpkgs.url = "nixpkgs/nixos-unstable"; - }; - - outputs = {nixpkgs, ...}: let - mkSystems = sys: builtins.map (arch: "${arch}-${sys}") ["x86_64" "aarch64"]; - systems = - mkSystems "linux" - ++ mkSystems "darwin"; - - forAllSystems = nixpkgs.lib.genAttrs systems; - nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); - - forEachSystem = fn: - forAllSystems (s: fn nixpkgsFor.${s}); - in { - devShells = forEachSystem (pkgs: { - default = pkgs.mkShell { - packages = with pkgs; [ - actionlint - nodePackages.pnpm - ]; - }; - }); - - formatter = forEachSystem (p: p.alejandra); - - packages = forEachSystem (p: let - time = toString builtins.currentTime; - test = p.runCommand "test-${time}" {} '' - echo ${time} > $out - ''; - in { - inherit test; - default = test; - }); - }; -} diff --git a/package.json b/package.json deleted file mode 100644 index 52ec843..0000000 --- a/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "@ryanccn/attic-action", - "main": "dist/index.js", - "description": "Cache Nix derivations with attic", - "scripts": { - "build": "esbuild src/index.ts --outdir=dist --platform=node --format=cjs --bundle --minify-whitespace --minify-syntax", - "format": "prettier --write ." - }, - "author": "Ryan Cao ", - "license": "MIT", - "dependencies": { - "@actions/core": "^1.10.0", - "@actions/exec": "^1.1.1", - "just-split": "^3.2.0", - "ofetch": "^1.1.1" - }, - "devDependencies": { - "@types/node": "^16.18.38", - "esbuild": "^0.18.14", - "prettier": "3.0.0", - "typescript": "^5.1.6" - }, - "packageManager": "pnpm@8.6.9" -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml deleted file mode 100644 index 6c5fd51..0000000 --- a/pnpm-lock.yaml +++ /dev/null @@ -1,336 +0,0 @@ -lockfileVersion: '6.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -dependencies: - '@actions/core': - specifier: ^1.10.0 - version: 1.10.0 - '@actions/exec': - specifier: ^1.1.1 - version: 1.1.1 - just-split: - specifier: ^3.2.0 - version: 3.2.0 - ofetch: - specifier: ^1.1.1 - version: 1.1.1 - -devDependencies: - '@types/node': - specifier: ^16.18.38 - version: 16.18.38 - esbuild: - specifier: ^0.18.14 - version: 0.18.14 - prettier: - specifier: 3.0.0 - version: 3.0.0 - typescript: - specifier: ^5.1.6 - version: 5.1.6 - -packages: - - /@actions/core@1.10.0: - resolution: {integrity: sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==} - dependencies: - '@actions/http-client': 2.1.0 - uuid: 8.3.2 - dev: false - - /@actions/exec@1.1.1: - resolution: {integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==} - dependencies: - '@actions/io': 1.1.3 - dev: false - - /@actions/http-client@2.1.0: - resolution: {integrity: sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==} - dependencies: - tunnel: 0.0.6 - dev: false - - /@actions/io@1.1.3: - resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==} - dev: false - - /@esbuild/android-arm64@0.18.14: - resolution: {integrity: sha512-rZ2v+Luba5/3D6l8kofWgTnqE+qsC/L5MleKIKFyllHTKHrNBMqeRCnZI1BtRx8B24xMYxeU32iIddRQqMsOsg==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/android-arm@0.18.14: - resolution: {integrity: sha512-blODaaL+lngG5bdK/t4qZcQvq2BBqrABmYwqPPcS5VRxrCSGHb9R/rA3fqxh7R18I7WU4KKv+NYkt22FDfalcg==} - engines: {node: '>=12'} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/android-x64@0.18.14: - resolution: {integrity: sha512-qSwh8y38QKl+1Iqg+YhvCVYlSk3dVLk9N88VO71U4FUjtiSFylMWK3Ugr8GC6eTkkP4Tc83dVppt2n8vIdlSGg==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-arm64@0.18.14: - resolution: {integrity: sha512-9Hl2D2PBeDYZiNbnRKRWuxwHa9v5ssWBBjisXFkVcSP5cZqzZRFBUWEQuqBHO4+PKx4q4wgHoWtfQ1S7rUqJ2Q==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-x64@0.18.14: - resolution: {integrity: sha512-ZnI3Dg4ElQ6tlv82qLc/UNHtFsgZSKZ7KjsUNAo1BF1SoYDjkGKHJyCrYyWjFecmXpvvG/KJ9A/oe0H12odPLQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/freebsd-arm64@0.18.14: - resolution: {integrity: sha512-h3OqR80Da4oQCIa37zl8tU5MwHQ7qgPV0oVScPfKJK21fSRZEhLE4IIVpmcOxfAVmqjU6NDxcxhYaM8aDIGRLw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/freebsd-x64@0.18.14: - resolution: {integrity: sha512-ha4BX+S6CZG4BoH9tOZTrFIYC1DH13UTCRHzFc3GWX74nz3h/N6MPF3tuR3XlsNjMFUazGgm35MPW5tHkn2lzQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm64@0.18.14: - resolution: {integrity: sha512-IXORRe22In7U65NZCzjwAUc03nn8SDIzWCnfzJ6t/8AvGx5zBkcLfknI+0P+hhuftufJBmIXxdSTbzWc8X/V4w==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm@0.18.14: - resolution: {integrity: sha512-5+7vehI1iqru5WRtJyU2XvTOvTGURw3OZxe3YTdE9muNNIdmKAVmSHpB3Vw2LazJk2ifEdIMt/wTWnVe5V98Kg==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ia32@0.18.14: - resolution: {integrity: sha512-BfHlMa0nibwpjG+VXbOoqJDmFde4UK2gnW351SQ2Zd4t1N3zNdmUEqRkw/srC1Sa1DRBE88Dbwg4JgWCbNz/FQ==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-loong64@0.18.14: - resolution: {integrity: sha512-j2/Ex++DRUWIAaUDprXd3JevzGtZ4/d7VKz+AYDoHZ3HjJzCyYBub9CU1wwIXN+viOP0b4VR3RhGClsvyt/xSw==} - engines: {node: '>=12'} - cpu: [loong64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-mips64el@0.18.14: - resolution: {integrity: sha512-qn2+nc+ZCrJmiicoAnJXJJkZWt8Nwswgu1crY7N+PBR8ChBHh89XRxj38UU6Dkthl2yCVO9jWuafZ24muzDC/A==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ppc64@0.18.14: - resolution: {integrity: sha512-aGzXzd+djqeEC5IRkDKt3kWzvXoXC6K6GyYKxd+wsFJ2VQYnOWE954qV2tvy5/aaNrmgPTb52cSCHFE+Z7Z0yg==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-riscv64@0.18.14: - resolution: {integrity: sha512-8C6vWbfr0ygbAiMFLS6OPz0BHvApkT2gCboOGV76YrYw+sD/MQJzyITNsjZWDXJwPu9tjrFQOVG7zijRzBCnLw==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-s390x@0.18.14: - resolution: {integrity: sha512-G/Lf9iu8sRMM60OVGOh94ZW2nIStksEcITkXdkD09/T6QFD/o+g0+9WVyR/jajIb3A0LvBJ670tBnGe1GgXMgw==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-x64@0.18.14: - resolution: {integrity: sha512-TBgStYBQaa3EGhgqIDM+ECnkreb0wkcKqL7H6m+XPcGUoU4dO7dqewfbm0mWEQYH3kzFHrzjOFNpSAVzDZRSJw==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/netbsd-x64@0.18.14: - resolution: {integrity: sha512-stvCcjyCQR2lMTroqNhAbvROqRjxPEq0oQ380YdXxA81TaRJEucH/PzJ/qsEtsHgXlWFW6Ryr/X15vxQiyRXVg==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/openbsd-x64@0.18.14: - resolution: {integrity: sha512-apAOJF14CIsN5ht1PA57PboEMsNV70j3FUdxLmA2liZ20gEQnfTG5QU0FhENo5nwbTqCB2O3WDsXAihfODjHYw==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/sunos-x64@0.18.14: - resolution: {integrity: sha512-fYRaaS8mDgZcGybPn2MQbn1ZNZx+UXFSUoS5Hd2oEnlsyUcr/l3c6RnXf1bLDRKKdLRSabTmyCy7VLQ7VhGdOQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-arm64@0.18.14: - resolution: {integrity: sha512-1c44RcxKEJPrVj62XdmYhxXaU/V7auELCmnD+Ri+UCt+AGxTvzxl9uauQhrFso8gj6ZV1DaORV0sT9XSHOAk8Q==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-ia32@0.18.14: - resolution: {integrity: sha512-EXAFttrdAxZkFQmpvcAQ2bywlWUsONp/9c2lcfvPUhu8vXBBenCXpoq9YkUvVP639ld3YGiYx0YUQ6/VQz3Maw==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-x64@0.18.14: - resolution: {integrity: sha512-K0QjGbcskx+gY+qp3v4/940qg8JitpXbdxFhRDA1aYoNaPff88+aEwoq45aqJ+ogpxQxmU0ZTjgnrQD/w8iiUg==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@types/node@16.18.38: - resolution: {integrity: sha512-6sfo1qTulpVbkxECP+AVrHV9OoJqhzCsfTNp5NIG+enM4HyM3HvZCO798WShIXBN0+QtDIcutJCjsVYnQP5rIQ==} - dev: true - - /destr@2.0.0: - resolution: {integrity: sha512-FJ9RDpf3GicEBvzI3jxc2XhHzbqD8p4ANw/1kPsFBfTvP1b7Gn/Lg1vO7R9J4IVgoMbyUmFrFGZafJ1hPZpvlg==} - dev: false - - /esbuild@0.18.14: - resolution: {integrity: sha512-uNPj5oHPYmj+ZhSQeYQVFZ+hAlJZbAGOmmILWIqrGvPVlNLbyOvU5Bu6Woi8G8nskcx0vwY0iFoMPrzT86Ko+w==} - engines: {node: '>=12'} - hasBin: true - requiresBuild: true - optionalDependencies: - '@esbuild/android-arm': 0.18.14 - '@esbuild/android-arm64': 0.18.14 - '@esbuild/android-x64': 0.18.14 - '@esbuild/darwin-arm64': 0.18.14 - '@esbuild/darwin-x64': 0.18.14 - '@esbuild/freebsd-arm64': 0.18.14 - '@esbuild/freebsd-x64': 0.18.14 - '@esbuild/linux-arm': 0.18.14 - '@esbuild/linux-arm64': 0.18.14 - '@esbuild/linux-ia32': 0.18.14 - '@esbuild/linux-loong64': 0.18.14 - '@esbuild/linux-mips64el': 0.18.14 - '@esbuild/linux-ppc64': 0.18.14 - '@esbuild/linux-riscv64': 0.18.14 - '@esbuild/linux-s390x': 0.18.14 - '@esbuild/linux-x64': 0.18.14 - '@esbuild/netbsd-x64': 0.18.14 - '@esbuild/openbsd-x64': 0.18.14 - '@esbuild/sunos-x64': 0.18.14 - '@esbuild/win32-arm64': 0.18.14 - '@esbuild/win32-ia32': 0.18.14 - '@esbuild/win32-x64': 0.18.14 - dev: true - - /just-split@3.2.0: - resolution: {integrity: sha512-hh57dN5koTBkmg3T6gBFISVVaW5bgZ6Ct1W5KODD5M7hQJKqGzTKkfMwOil8MBxyztLQEjh/v6UGXE8cP5tnqQ==} - dev: false - - /node-fetch-native@1.2.0: - resolution: {integrity: sha512-5IAMBTl9p6PaAjYCnMv5FmqIF6GcZnawAVnzaCG0rX2aYZJ4CxEkZNtVPuTRug7fL7wyM5BQYTlAzcyMPi6oTQ==} - dev: false - - /ofetch@1.1.1: - resolution: {integrity: sha512-SSMoktrp9SNLi20BWfB/BnnKcL0RDigXThD/mZBeQxkIRv1xrd9183MtLdsqRYLYSqW0eTr5t8w8MqjNhvoOQQ==} - dependencies: - destr: 2.0.0 - node-fetch-native: 1.2.0 - ufo: 1.1.2 - dev: false - - /prettier@3.0.0: - resolution: {integrity: sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==} - engines: {node: '>=14'} - hasBin: true - dev: true - - /tunnel@0.0.6: - resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} - engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} - dev: false - - /typescript@5.1.6: - resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} - engines: {node: '>=14.17'} - hasBin: true - dev: true - - /ufo@1.1.2: - resolution: {integrity: sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==} - dev: false - - /uuid@8.3.2: - resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} - hasBin: true - dev: false diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index b40f47a..0000000 --- a/src/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { install } from "./stages/install"; -import { configure } from "./stages/configure"; -import { push } from "./stages/push"; -import { getState, saveState } from "@actions/core"; - -const isPost = !!getState("isPost"); - -const main = async () => { - await install(); - await configure(); -}; - -if (!isPost) { - saveState("isPost", true); - main(); -} else { - push(); -} diff --git a/src/stages/configure.ts b/src/stages/configure.ts deleted file mode 100644 index 4929748..0000000 --- a/src/stages/configure.ts +++ /dev/null @@ -1,24 +0,0 @@ -import * as core from "@actions/core"; -import { exec } from "@actions/exec"; -import { getStorePaths } from "../utils"; - -export const configure = async () => { - core.startGroup("Configure attic"); - - try { - const endpoint = core.getInput("endpoint"); - const cache = core.getInput("cache"); - const token = core.getInput("token"); - - core.info("Logging in to attic cache"); - await exec("attic", ["login", "--set-default", cache, endpoint, token]); - - core.info("Collecting store paths before build"); - const paths = await getStorePaths(); - core.saveState("initial-paths", JSON.stringify(paths)); - } catch (e) { - core.setFailed(`Action failed with error: ${e}`); - } - - core.endGroup(); -}; diff --git a/src/stages/install.ts b/src/stages/install.ts deleted file mode 100644 index a37f0ce..0000000 --- a/src/stages/install.ts +++ /dev/null @@ -1,36 +0,0 @@ -import * as core from "@actions/core"; -import { exec } from "@actions/exec"; -import { fetch } from "ofetch"; - -import { writeFile } from "node:fs/promises"; -import { tmpdir } from "node:os"; -import { join } from "node:path"; - -export const install = async () => { - core.startGroup("Install attic"); - - core.info("Installing attic"); - const installScript = await fetch( - "https://raw.githubusercontent.com/zhaofengli/attic/main/.github/install-attic-ci.sh", - ).then((r) => { - if (!r.ok) { - core.setFailed(`Action failed with error: ${r.statusText}`); - core.endGroup(); - process.exit(1); - } - - return r.text(); - }); - - try { - const installScriptPath = join(tmpdir(), "install-attic-ci.sh"); - - await writeFile(installScriptPath, installScript); - core.info("Running install script"); - await exec("bash", [installScriptPath]); - } catch (e) { - core.setFailed(`Action failed with error: ${e}`); - } - - core.endGroup(); -}; diff --git a/src/stages/push.ts b/src/stages/push.ts deleted file mode 100644 index f911bb5..0000000 --- a/src/stages/push.ts +++ /dev/null @@ -1,36 +0,0 @@ -import * as core from "@actions/core"; -import { exec } from "@actions/exec"; - -import splitArray from "just-split"; -import { getStorePaths } from "../utils"; - -export const push = async () => { - core.startGroup("Push to Attic"); - - try { - const skipPush = core.getInput("skip-push"); - if (skipPush === "true") { - core.info("Pushing to cache is disabled by skip-push"); - } else { - const cache = core.getInput("cache"); - - core.info("Pushing to cache"); - const oldPaths = JSON.parse(core.getState("initial-paths")) as string[]; - const newPaths = await getStorePaths(); - const addedPaths = newPaths - .filter((p) => !oldPaths.includes(p)) - .filter( - (p) => !p.endsWith(".drv") && !p.endsWith(".drv.chroot") && !p.endsWith(".check") && !p.endsWith(".lock"), - ); - - const splitAddedPaths = splitArray(addedPaths, 25); - for (const addedPaths of splitAddedPaths) { - await exec("attic", ["push", cache, ...addedPaths]); - } - } - } catch (e) { - core.setFailed(`Action failed with error: ${e}`); - } - - core.endGroup(); -}; diff --git a/src/utils.ts b/src/utils.ts deleted file mode 100644 index a38183a..0000000 --- a/src/utils.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { exec } from "@actions/exec"; -import { Writable } from "node:stream"; - -class StringStream extends Writable { - chunks: Buffer[] = []; - - _write(chunk: WithImplicitCoercion, _enc: unknown, next: () => unknown) { - this.chunks.push(Buffer.from(chunk)); - next(); - } - - string() { - return Buffer.concat(this.chunks).toString("utf-8"); - } -} - -export const getStorePaths = async () => { - const outStream = new StringStream(); - await exec("nix", ["path-info", "--all"], { outStream }); - const paths = outStream.string().split("\n").filter(Boolean); - - return paths; -}; diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 1226785..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "downlevelIteration": true, - "module": "esnext", - "target": "esnext", - "moduleResolution": "node", - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "isolatedModules": true, - "skipLibCheck": true, - "noEmit": true - }, - "include": ["**/*.ts"], - "exclude": ["node_modules", "**/node_modules/*"] -}