Files
setup-docker-action/dist/index.js

18 lines
894 KiB
JavaScript
Raw Normal View History

2023-12-18 10:41:22 +01:00
require('./sourcemap-register.js');(()=>{var e={7351:function(e,t,r){"use strict";var A=this&&this.__createBinding||(Object.create?function(e,t,r,A){if(A===undefined)A=r;Object.defineProperty(e,A,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,A){if(A===undefined)A=r;e[A]=t[r]});var s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))A(t,e,r);s(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.issue=t.issueCommand=void 0;const o=n(r(2037));const i=r(5278);function issueCommand(e,t,r){const A=new Command(e,t,r);process.stdout.write(A.toString()+o.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const a="::";class Command{constructor(e,t,r){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=r}toString(){let e=a+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const r in this.properties){if(this.properties.hasOwnProperty(r)){const A=this.properties[r];if(A){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(A)}`}}}}e+=`${a}${escapeData(this.message)}`;return e}}function escapeData(e){return i.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return i.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},2186:function(e,t,r){"use strict";var A=this&&this.__createBinding||(Object.create?function(e,t,r,A){if(A===undefined)A=r;Object.defineProperty(e,A,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,A){if(A===undefined)A=r;e[A]=t[r]});var s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))A(t,e,r);s(t,e);return t};var o=this&&this.__awaiter||function(e,t,r,A){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(A.next(e))}catch(e){s(e)}}function rejected(e){try{step(A["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((A=A.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:true});t.getIDToken=t.getState=t.saveState=t.group=t.endGroup=t.startGroup=t.info=t.notice=t.warning=t.error=t.debug=t.isDebug=t.setFailed=t.setCommandEcho=t.setOutput=t.getBooleanInput=t.getMultilineInput=t.getInput=t.addPath=t.setSecret=t.exportVariable=t.ExitCode=void 0;const i=r(7351);const a=r(717);const c=r(5278);const l=n(r(2037));const u=n(r(1017));const g=r(8041);var h;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(h=t.ExitCode||(t.ExitCode={}));function exportVariable(e,t){const r=c.toCommandValue(t);process.env[e]=r;const A=process.env["GITHUB_ENV"]||"";if(A){return a.issueFileCommand("ENV",a.prepareKeyValueMessage(e,t))}i.issueCommand("set-env",{name:e},r)}t.exportVariable=exportVariable;function setSecret(e){i.issueCommand("add-mask",{},e)}t.setSecret=setSecret;function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){a.issueFileCommand("PATH",e)}else{i.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${u.delimiter}${process.env["PATH"]}`}t.addPath=addPath;function getInput(e,t){const r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r){throw new Error(`Input required and not supplied: ${e}`)}if(t&&t.trimWhitespace===false){return r}return r.trim()}t.getInput=getInput;function getMultilineInput(e,t){const r=getInput(e,t).split("\n").filter((e=>e!==""));if(t&&t.trimWhitespace===false){return r}return r.map((e=>e.trim()))}t.getM
2023-03-02 14:00:16 +01:00
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
2023-12-18 10:41:22 +01:00
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,r;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;r=t.prototype;if(isObject(r)===false)return false;if(r.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},3973:(e,t,r)=>{e.exports=minimatch;minimatch.Minimatch=Minimatch;var A=function(){try{return r(1017)}catch(e){}}()||{sep:"/"};minimatch.sep=A.sep;var s=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={};var n=r(3717);var o={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};var i="[^/]";var a=i+"*?";var c="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var l="(?:(?!(?:\\/|^)\\.).)*?";var u=charSet("().*{}+?[]^$\\!");function charSet(e){return e.split("").reduce((function(e,t){e[t]=true;return e}),{})}var g=/\/+/;minimatch.filter=filter;function filter(e,t){t=t||{};return function(r,A,s){return minimatch(r,e,t)}}function ext(e,t){t=t||{};var r={};Object.keys(e).forEach((function(t){r[t]=e[t]}));Object.keys(t).forEach((function(e){r[e]=t[e]}));return r}minimatch.defaults=function(e){if(!e||typeof e!=="object"||!Object.keys(e).length){return minimatch}var t=minimatch;var r=function minimatch(r,A,s){return t(r,A,ext(e,s))};r.Minimatch=function Minimatch(r,A){return new t.Minimatch(r,ext(e,A))};r.Minimatch.defaults=function defaults(r){return t.defaults(ext(e,r)).Minimatch};r.filter=function filter(r,A){return t.filter(r,ext(e,A))};r.defaults=function defaults(r){return t.defaults(ext(e,r))};r.makeRe=function makeRe(r,A){return t.makeRe(r,ext(e,A))};r.braceExpand=function braceExpand(r,A){return t.braceExpand(r,ext(e,A))};r.match=function(r,A,s){return t.match(r,A,ext(e,s))};return r};Minimatch.defaults=function(e){return minimatch.defaults(e).Minimatch};function minimatch(e,t,r){assertValidPattern(t);if(!r)r={};if(!r.nocomment&&t.charAt(0)==="#"){return false}return new Minimatch(t,r).match(e)}function Minimatch(e,t){if(!(this instanceof Minimatch)){return new Minimatch(e,t)}assertValidPattern(e);if(!t)t={};e=e.trim();if(!t.allowWindowsEscape&&A.sep!=="/"){e=e.split(A.sep).join("/")}this.options=t;this.set=[];this.pattern=e;this.regexp=null;this.negate=false;this.comment=false;this.empty=false;this.partial=!!t.partial;this.make()}Minimatch.prototype.debug=function(){};Minimatch.prototype.make=make;function make(){var e=this.pattern;var t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=true;return}if(!e){this.empty=true;return}this.parseNegate();var r=this.globSet=this.braceExpand();if(t.debug)this.debug=function debug(){console.error.apply(console,arguments)};this.debug(this.pattern,r);r=this.globParts=r.map((function(e){return e.split(g)}));this.debug(this.pattern,r);r=r.map((function(e,t,r){return e.map(this.parse,this)}),this);this.debug(this.pattern,r);r=r.filter((function(e){return e.indexOf(false)===-1}));this.debug(this.pattern,r);this.set=r}Minimatch.prototype.parseNegate=parseNegate;function parseNegate(){var e=this.pattern;var t=false;var r=this.options;var A=0;if(r.nonegate)return;for(var s=0,n=e.length;s<n&&e.charAt(s)==="!";s++){t=!t;A++}if(A)this.pattern=e.substr(A);this.negate=t}minimatch.braceExpand=function(e,t){return braceExpand(e,t)};Minimatch.prototype.braceExpand=braceExpand;function braceExpand(e,t){if(!t){if(this instanceof Minimatch){t=this.options}else{t={}}}e=typeof e==="undefined"?this.pattern:e;assertValidPattern(e);if(t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)){return[e]}return n(e)}var h=1024*64;var assertValidPattern=function(e){if(typeof e!=="string"){throw new TypeError("invalid pattern")}if(e.length>h){throw new TypeError("pattern is too long")}};Minimatch.prototype.parse=parse;var d={};function parse(e,t){assertValidPattern(e);var r=this.options;if(e==="**"){if(!r.noglobstar)return s;else e="*"}if(e==="")return"";var A="";var n=!!r.nocase;var c=false;var l=[];var g=[];var h;var E=false;var p=-1;var C=-1;var Q=e.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)
2023-03-02 14:00:16 +01:00
/*!
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/
2023-12-18 10:41:22 +01:00
const A=r(7147);const s=r(2037);const n=r(1017);const o=r(6113);const i={fs:A.constants,os:s.constants};const a=r(4959);const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",l=/XXXXXX/,u=3,g=(i.O_CREAT||i.fs.O_CREAT)|(i.O_EXCL||i.fs.O_EXCL)|(i.O_RDWR||i.fs.O_RDWR),h=s.platform()==="win32",d=i.EBADF||i.os.errno.EBADF,E=i.ENOENT||i.os.errno.ENOENT,p=448,C=384,Q="exit",I=[],B=A.rmdirSync.bind(A),m=a.sync;let y=false;function tmpName(e,t){const r=_parseArguments(e,t),s=r[0],n=r[1];try{_assertAndSanitizeOptions(s)}catch(e){return n(e)}let o=s.tries;(function _getUniqueName(){try{const e=_generateTmpName(s);A.stat(e,(function(t){if(!t){if(o-- >0)return _getUniqueName();return n(new Error("Could not get a unique tmp filename, max tries reached "+e))}n(null,e)}))}catch(e){n(e)}})()}function tmpNameSync(e){const t=_parseArguments(e),r=t[0];_assertAndSanitizeOptions(r);let s=r.tries;do{const e=_generateTmpName(r);try{A.statSync(e)}catch(t){return e}}while(s-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(e,t){const r=_parseArguments(e,t),s=r[0],n=r[1];tmpName(s,(function _tmpNameCreated(e,t){if(e)return n(e);A.open(t,g,s.mode||C,(function _fileCreated(e,r){if(e)return n(e);if(s.discardDescriptor){return A.close(r,(function _discardCallback(e){return n(e,t,undefined,_prepareTmpFileRemoveCallback(t,-1,s,false))}))}else{const e=s.discardDescriptor||s.detachDescriptor;n(null,t,r,_prepareTmpFileRemoveCallback(t,e?-1:r,s,false))}}))}))}function fileSync(e){const t=_parseArguments(e),r=t[0];const s=r.discardDescriptor||r.detachDescriptor;const n=tmpNameSync(r);var o=A.openSync(n,g,r.mode||C);if(r.discardDescriptor){A.closeSync(o);o=undefined}return{name:n,fd:o,removeCallback:_prepareTmpFileRemoveCallback(n,s?-1:o,r,true)}}function dir(e,t){const r=_parseArguments(e,t),s=r[0],n=r[1];tmpName(s,(function _tmpNameCreated(e,t){if(e)return n(e);A.mkdir(t,s.mode||p,(function _dirCreated(e){if(e)return n(e);n(null,t,_prepareTmpDirRemoveCallback(t,s,false))}))}))}function dirSync(e){const t=_parseArguments(e),r=t[0];const s=tmpNameSync(r);A.mkdirSync(s,r.mode||p);return{name:s,removeCallback:_prepareTmpDirRemoveCallback(s,r,true)}}function _removeFileAsync(e,t){const _handler=function(e){if(e&&!_isENOENT(e)){return t(e)}t()};if(0<=e[0])A.close(e[0],(function(){A.unlink(e[1],_handler)}));else A.unlink(e[1],_handler)}function _removeFileSync(e){let t=null;try{if(0<=e[0])A.closeSync(e[0])}catch(e){if(!_isEBADF(e)&&!_isENOENT(e))throw e}finally{try{A.unlinkSync(e[1])}catch(e){if(!_isENOENT(e))t=e}}if(t!==null){throw t}}function _prepareTmpFileRemoveCallback(e,t,r,A){const s=_prepareRemoveCallback(_removeFileSync,[t,e],A);const n=_prepareRemoveCallback(_removeFileAsync,[t,e],A,s);if(!r.keep)I.unshift(s);return A?s:n}function _prepareTmpDirRemoveCallback(e,t,r){const s=t.unsafeCleanup?a:A.rmdir.bind(A);const n=t.unsafeCleanup?m:B;const o=_prepareRemoveCallback(n,e,r);const i=_prepareRemoveCallback(s,e,r,o);if(!t.keep)I.unshift(o);return r?o:i}function _prepareRemoveCallback(e,t,r,A){let s=false;return function _cleanupCallback(n){if(!s){const o=A||_cleanupCallback;const i=I.indexOf(o);if(i>=0)I.splice(i,1);s=true;if(r||e===B||e===m){return e(t)}else{return e(t,n||function(){})}}}}function _garbageCollector(){if(!y)return;while(I.length){try{I[0]()}catch(e){}}}function _randomChars(e){let t=[],r=null;try{r=o.randomBytes(e)}catch(t){r=o.pseudoRandomBytes(e)}for(var A=0;A<e;A++){t.push(c[r[A]%c.length])}return t.join("")}function _isBlank(e){return e===null||_isUndefined(e)||!e.trim()}function _isUndefined(e){return typeof e==="undefined"}function _parseArguments(e,t){if(typeof e==="function"){return[{},e]}if(_isUndefined(e)){return[{},t]}const r={};for(const t of Object.getOwnPropertyNames(e)){r[t]=e[t]}return[r,t]}function _generateTmpName(e){const t=e.tmpdir;if(!_isUndefined(e.name))return n.join(t,e.dir,e.name);if(!_isUndefined(e.template))return n.join(t,e.dir,e.template).replace(l,_randomChars(6));const r=[e.prefix?e.prefix:"tmp","-",process.pid,"-",_randomChars(12),e.postfix?"-"+e.po
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=e=>e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=e=>e.replace(/\r?\n|\r/g,"\r\n");const A=new TextEncoder;const s=[];const n=new Uint8Array([13,10]);u=0;let o=false;for(const[t,i]of e){if(typeof i==="string"){const e=A.encode(r+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(i)}\r\n`);s.push(e);u+=e.byteLength}else{const e=A.encode(`${r}; name="${escape(normalizeLinefeeds(t))}"`+(i.name?`; filename="${escape(i.name)}"`:"")+"\r\n"+`Content-Type: ${i.type||"application/octet-stream"}\r\n\r\n`);s.push(e,i,n);if(typeof i.size==="number"){u+=e.byteLength+i.size+n.byteLength}else{o=true}}}const i=A.encode(`--${t}--`);s.push(i);u+=i.byteLength;if(o){u=null}l=e;c=async function*(){for(const e of s){if(e.stream){yield*e.stream()}else{yield e}}};g="multipart/form-data; boundary="+t}else if(o(e)){l=e;u=e.size;if(e.type){g=e.type}}else if(typeof e[Symbol.asyncIterator]==="function"){if(t){throw new TypeError("keepalive")}if(s.isDisturbed(e)||e.locked){throw new TypeError("Response body object should not be disturbed or locked")}A=e instanceof k?e:n(e)}if(typeof l==="string"||s.isBuffer(l)){u=Buffer.byteLength(l)}if(c!=null){let t;A=new k({async start(){t=c(e)[Symbol.asyncIterator]()},async pull(e){const{value:r,done:s}=await t.next();if(s){queueMicrotask((()=>{e.close()}))}else{if(!B(A)){e.enqueue(new Uint8Array(r))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const h={stream:A,source:l,length:u};return[h,g]}function safelyExtractBody(e,t=false){if(!k){k=r(5356).ReadableStream}if(e instanceof k){I(!s.isDisturbed(e),"The body has already been consumed.");I(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,r]=e.stream.tee();const A=E(r,{transfer:[r]});const[,s]=A.tee();e.stream=t;return{stream:s,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(m(e)){yield e}else{const t=e.stream;if(s.isDisturbed(t)){throw new TypeError("The body has already been consumed.")}if(t.locked){throw new TypeError("The stream is locked.")}t[Q]=true;yield*t}}}function throwIfAborted(e){if(e.aborted){throw new d("The operation was aborted.","AbortError")}}function bodyMixinMethods(e){const t={blob(){return specConsumeBody(this,(e=>{let t=bodyMimeType(this);if(t==="failure"){t=""}else if(t){t=R(t)}return new p([e],{type:t})}),e)},arrayBuffer(){return specConsumeBody(this,(e=>new Uint8Array(e).buffer),e)},text(){return specConsumeBody(this,utf8DecodeBytes,e)},json(){return specConsumeBody(this,parseJSONFromBytes,e)},async formData(){h.brandCheck(this,e);throwIfAborted(this[g]);const t=this.headers.get("Content-Type");if(/multipart\/form-data/.test(t)){const e={};for(const[t,r]of this.headers)e[t.toLowerCase()]=r;const t=new u;let r;try{r=new A({headers:e,preservePath:true})}catch(e){throw new d(`${e}`,"AbortError")}r.on("field",((e,r)=>{t.append(e,r)}));r.on("file",((e,r,A,s,n)=>{const o=[];if(s==="base64"||s.toLowerCase()==="base64"){let s="";r.on("data",(e=>{s+=e.toString().replace(/[\r\n]/gm,"");const t=s.length-s.length%4;o.push(Buffer.from(s.slice(0,t),"base64"));s=s.slice(t)}));r.on("end",(()=>{o.push(Buffer.from(s,"base64"));t.append(e,new v(o,A,{type:n}))}))}else{r.on("data",(e=>{o.push(e)}));r.on("end",(()=>{t.append(e,new v(o,A,{type:n}))}))}}));const s=new Promise(((e,t)=>{r.on("finish",e);r.on("error",(e=>t(new TypeError(e))))}));if(this.body!==null)for await(const e of consumeBody(this[g].body))r.write(e);r.end();await s;return t}else if(/application\/x-www-form-urlencoded/.test(t)){let e;try{let t="";const r=new TextDecoder("utf-8",{ignoreBOM:true});for await(const e of consumeBody(this[g].body)){if(!m(e)){throw new TypeError("Expected Uint8Array chunk")}t+=r.decode(e,{stream:true})}t+=r.decode();e=new URLSearchParams(t)}catch(e){throw Object.assign(new TypeError,{cause:e})}const t=new u;for(const[r,A]of e){t.append(r,A)}return t}else{await Promise.resolve();throwIfAborted(this[g]);thro
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */n[s-4]=this.maskKey[0];n[s-3]=this.maskKey[1];n[s-2]=this.maskKey[2];n[s-1]=this.maskKey[3];n[1]=r;if(r===126){n.writeUInt16BE(t,2)}else if(r===127){n[2]=n[3]=0;n.writeUIntBE(t,4,6)}n[1]|=128;for(let e=0;e<t;e++){n[s+e]=this.frameData[e]^this.maskKey[e%4]}return n}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},1688:(e,t,r)=>{"use strict";const{Writable:A}=r(2781);const s=r(7643);const{parserStates:n,opcodes:o,states:i,emptyBuffer:a}=r(9188);const{kReadyState:c,kSentClose:l,kResponse:u,kReceivedClose:g}=r(7578);const{isValidStatusCode:h,failWebsocketConnection:d,websocketMessageReceived:E}=r(5515);const{WebsocketFrameSend:p}=r(5444);const C={};C.ping=s.channel("undici:websocket:ping");C.pong=s.channel("undici:websocket:pong");class ByteParser extends A{#o=[];#i=0;#a=n.INFO;#c={};#l=[];constructor(e){super();this.ws=e}_write(e,t,r){this.#o.push(e);this.#i+=e.length;this.run(r)}run(e){while(true){if(this.#a===n.INFO){if(this.#i<2){return e()}const t=this.consume(2);this.#c.fin=(t[0]&128)!==0;this.#c.opcode=t[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==o.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==o.BINARY&&this.#c.opcode!==o.TEXT){d(this.ws,"Invalid frame type was fragmented.");return}const r=t[1]&127;if(r<=125){this.#c.payloadLength=r;this.#a=n.READ_DATA}else if(r===126){this.#a=n.PAYLOADLENGTH_16}else if(r===127){this.#a=n.PAYLOADLENGTH_64}if(this.#c.fragmented&&r>125){d(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===o.PING||this.#c.opcode===o.PONG||this.#c.opcode===o.CLOSE)&&r>125){d(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===o.CLOSE){if(r===1){d(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(r);this.#c.closeInfo=this.parseCloseBody(false,e);if(!this.ws[l]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#c.closeInfo.code,0);const t=new p(e);this.ws[u].socket.write(t.createFrame(o.CLOSE),(e=>{if(!e){this.ws[l]=true}}))}this.ws[c]=i.CLOSING;this.ws[g]=true;this.end();return}else if(this.#c.opcode===o.PING){const t=this.consume(r);if(!this.ws[g]){const e=new p(t);this.ws[u].socket.write(e.createFrame(o.PONG));if(C.ping.hasSubscribers){C.ping.publish({payload:t})}}this.#a=n.INFO;if(this.#i>0){continue}else{e();return}}else if(this.#c.opcode===o.PONG){const t=this.consume(r);if(C.pong.hasSubscribers){C.pong.publish({payload:t})}if(this.#i>0){continue}else{e();return}}}else if(this.#a===n.PAYLOADLENGTH_16){if(this.#i<2){return e()}const t=this.consume(2);this.#c.payloadLength=t.readUInt16BE(0);this.#a=n.READ_DATA}else if(this.#a===n.PAYLOADLENGTH_64){if(this.#i<8){return e()}const t=this.consume(8);const r=t.readUInt32BE(0);if(r>2**31-1){d(this.ws,"Received payload length > 2^31 bytes.");return}const A=t.readUInt32BE(4);this.#c.payloadLength=(r<<8)+A;this.#a=n.READ_DATA}else if(this.#a===n.READ_DATA){if(this.#i<this.#c.payloadLength){return e()}else if(this.#i>=this.#c.payloadLength){const e=this.consume(this.#c.payloadLength);this.#l.push(e);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===o.CONTINUATION){const e=Buffer.concat(this.#l);E(this.ws,this.#c.originalOpcode,e);this.#c={};this.#l.length=0}this.#a=n.INFO}}if(this.#i>0){continue}else{e();break}}}consume(e){if(e>this.#i){return null}else if(e===0){return a}if(this.#o[0].length===e){this.#i-=this.#o[0].length;return this.#o.shift()}const t=Buffer.allocUnsafe(e);let r=0;while(r!==e){const A=this.#o[0];const{length:s}=A;if(s+r===e){t.set(this.#o.shift(),r);break}else if(s+r>e){t.set(A.subarray(0,e-r),r);this.#o[0]=A.subarray(e-r);break}else{t.set(this.#o.shift(),r);r+=A.length}}this.#i-=e;return t}parseCloseBody(e,t){let r;if(t.length>=2){r=t.readUInt16BE(0)}if(e){if(!h(r)){return null}return{code:r}}let A=t.subarray(2);if(A[0]===239&&A[1]===187&&A[2]===191){A=A.subarray(3)}if(r!==undefined&&!h(r)){return null}try{A=new TextDecoder("utf-8",{fatal:true}).decode(A)}catch{return null}return{code:r,reason:A}}get closingIn
2023-03-02 14:00:16 +01:00
//# sourceMappingURL=index.js.map