diff --git a/dist/index.js b/dist/index.js index 1ded0b9..953d39a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3992,16 +3992,16 @@ var require_util = __commonJS({ } } __name(convertIterableToBuffer, "convertIterableToBuffer"); - var ReadableStream; + var ReadableStream2; function ReadableStreamFrom(iterable) { - if (!ReadableStream) { - ReadableStream = require("stream/web").ReadableStream; + if (!ReadableStream2) { + ReadableStream2 = require("stream/web").ReadableStream; } - if (ReadableStream.from) { - return ReadableStream.from(convertIterableToBuffer(iterable)); + if (ReadableStream2.from) { + return ReadableStream2.from(convertIterableToBuffer(iterable)); } let iterator; - return new ReadableStream( + return new ReadableStream2( { async start() { iterator = iterable[Symbol.asyncIterator](); @@ -4346,12 +4346,12 @@ var require_PartStream = __commonJS({ "node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js"(exports2, module2) { "use strict"; var inherits = require("node:util").inherits; - var ReadableStream = require("node:stream").Readable; + var ReadableStream2 = require("node:stream").Readable; function PartStream(opts) { - ReadableStream.call(this, opts); + ReadableStream2.call(this, opts); } __name(PartStream, "PartStream"); - inherits(PartStream, ReadableStream); + inherits(PartStream, ReadableStream2); PartStream.prototype._read = function(n) { }; module2.exports = PartStream; @@ -6933,12 +6933,12 @@ var require_util2 = __commonJS({ } } __name(fullyReadBody, "fullyReadBody"); - var ReadableStream = globalThis.ReadableStream; + var ReadableStream2 = globalThis.ReadableStream; function isReadableStreamLike(stream) { - if (!ReadableStream) { - ReadableStream = require("stream/web").ReadableStream; + if (!ReadableStream2) { + ReadableStream2 = require("stream/web").ReadableStream; } - return stream instanceof ReadableStream || stream[Symbol.toStringTag] === "ReadableStream" && typeof stream.tee === "function"; + return stream instanceof ReadableStream2 || stream[Symbol.toStringTag] === "ReadableStream" && typeof stream.tee === "function"; } __name(isReadableStreamLike, "isReadableStreamLike"); var MAXIMUM_ARGUMENT_LENGTH = 65535; @@ -7943,7 +7943,7 @@ var require_formdata = __commonJS({ var { webidl } = require_webidl(); var { Blob: Blob2, File: NativeFile } = require("buffer"); var File = NativeFile ?? UndiciFile; - var FormData = class _FormData { + var FormData2 = class _FormData { static { __name(this, "FormData"); } @@ -8063,8 +8063,8 @@ var require_formdata = __commonJS({ } } }; - FormData.prototype[Symbol.iterator] = FormData.prototype.entries; - Object.defineProperties(FormData.prototype, { + FormData2.prototype[Symbol.iterator] = FormData2.prototype.entries; + Object.defineProperties(FormData2.prototype, { [Symbol.toStringTag]: { value: "FormData", configurable: true @@ -8089,7 +8089,7 @@ var require_formdata = __commonJS({ return { name, value }; } __name(makeEntry, "makeEntry"); - module2.exports = { FormData }; + module2.exports = { FormData: FormData2 }; } }); @@ -8107,7 +8107,7 @@ var require_body = __commonJS({ createDeferredPromise, fullyReadBody } = require_util2(); - var { FormData } = require_formdata(); + var { FormData: FormData2 } = require_formdata(); var { kState } = require_symbols2(); var { webidl } = require_webidl(); var { DOMException: DOMException2, structuredClone } = require_constants2(); @@ -8118,21 +8118,21 @@ var require_body = __commonJS({ var { isUint8Array, isArrayBuffer } = require("util/types"); var { File: UndiciFile } = require_file(); var { parseMIMEType, serializeAMimeType } = require_dataURL(); - var ReadableStream = globalThis.ReadableStream; + var ReadableStream2 = globalThis.ReadableStream; var File = NativeFile ?? UndiciFile; var textEncoder = new TextEncoder(); var textDecoder = new TextDecoder(); function extractBody(object, keepalive = false) { - if (!ReadableStream) { - ReadableStream = require("stream/web").ReadableStream; + if (!ReadableStream2) { + ReadableStream2 = require("stream/web").ReadableStream; } let stream = null; - if (object instanceof ReadableStream) { + if (object instanceof ReadableStream2) { stream = object; } else if (isBlobLike(object)) { stream = object.stream(); } else { - stream = new ReadableStream({ + stream = new ReadableStream2({ async pull(controller) { controller.enqueue( typeof source === "string" ? textEncoder.encode(source) : source @@ -8222,14 +8222,14 @@ Content-Type: ${value.type || "application/octet-stream"}\r "Response body object should not be disturbed or locked" ); } - stream = object instanceof ReadableStream ? object : ReadableStreamFrom(object); + stream = object instanceof ReadableStream2 ? object : ReadableStreamFrom(object); } if (typeof source === "string" || util.isBuffer(source)) { length = Buffer.byteLength(source); } if (action != null) { let iterator; - stream = new ReadableStream({ + stream = new ReadableStream2({ async start() { iterator = action(object)[Symbol.asyncIterator](); }, @@ -8257,10 +8257,10 @@ Content-Type: ${value.type || "application/octet-stream"}\r } __name(extractBody, "extractBody"); function safelyExtractBody(object, keepalive = false) { - if (!ReadableStream) { - ReadableStream = require("stream/web").ReadableStream; + if (!ReadableStream2) { + ReadableStream2 = require("stream/web").ReadableStream; } - if (object instanceof ReadableStream) { + if (object instanceof ReadableStream2) { assert(!util.isDisturbed(object), "The body has already been consumed."); assert(!object.locked, "The stream is locked."); } @@ -8335,7 +8335,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r const headers = {}; for (const [key, value] of this.headers) headers[key.toLowerCase()] = value; - const responseFormData = new FormData(); + const responseFormData = new FormData2(); let busboy; try { busboy = new Busboy({ @@ -8397,7 +8397,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r } catch (err) { throw Object.assign(new TypeError(), { cause: err }); } - const formData = new FormData(); + const formData = new FormData2(); for (const [name, value] of entries) { formData.append(name, value); } @@ -8510,7 +8510,7 @@ var require_request = __commonJS({ channels.trailers = { hasSubscribers: false }; channels.error = { hasSubscribers: false }; } - var Request = class _Request { + var Request2 = class _Request { static { __name(this, "Request"); } @@ -8859,7 +8859,7 @@ var require_request = __commonJS({ } } __name(processHeader, "processHeader"); - module2.exports = Request; + module2.exports = Request2; } }); @@ -9755,7 +9755,7 @@ var require_client = __commonJS({ var { pipeline } = require("stream"); var util = require_util(); var timers = require_timers(); - var Request = require_request(); + var Request2 = require_request(); var DispatcherBase = require_dispatcher_base(); var { RequestContentLengthMismatchError, @@ -10038,7 +10038,7 @@ var require_client = __commonJS({ } [kDispatch](opts, handler) { const origin = opts.origin || this[kUrl].origin; - const request = this[kHTTPConnVersion] === "h2" ? Request[kHTTP2BuildRequest](origin, opts, handler) : Request[kHTTP1BuildRequest](origin, opts, handler); + const request = this[kHTTPConnVersion] === "h2" ? Request2[kHTTP2BuildRequest](origin, opts, handler) : Request2[kHTTP1BuildRequest](origin, opts, handler); this[kQueue].push(request); if (this[kResuming]) { } else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) { @@ -11012,7 +11012,7 @@ upgrade: ${upgrade}\r const { body, method, path: path2, host, upgrade, expectContinue, signal, headers: reqHeaders } = request; let headers; if (typeof reqHeaders === "string") - headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()); + headers = Request2[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; if (upgrade) { @@ -15017,15 +15017,15 @@ var require_response = __commonJS({ } = require_constants2(); var { kState, kHeaders, kGuard, kRealm } = require_symbols2(); var { webidl } = require_webidl(); - var { FormData } = require_formdata(); + var { FormData: FormData2 } = require_formdata(); var { getGlobalOrigin } = require_global(); var { URLSerializer } = require_dataURL(); var { kHeadersList, kConstruct } = require_symbols(); var assert = require("assert"); var { types } = require("util"); - var ReadableStream = globalThis.ReadableStream || require("stream/web").ReadableStream; + var ReadableStream2 = globalThis.ReadableStream || require("stream/web").ReadableStream; var textEncoder = new TextEncoder("utf-8"); - var Response = class _Response { + var Response2 = class _Response { static { __name(this, "Response"); } @@ -15170,8 +15170,8 @@ var require_response = __commonJS({ return clonedResponseObject; } }; - mixinBody(Response); - Object.defineProperties(Response.prototype, { + mixinBody(Response2); + Object.defineProperties(Response2.prototype, { type: kEnumerableProperty, url: kEnumerableProperty, status: kEnumerableProperty, @@ -15187,7 +15187,7 @@ var require_response = __commonJS({ configurable: true } }); - Object.defineProperties(Response, { + Object.defineProperties(Response2, { json: kEnumerableProperty, redirect: kEnumerableProperty, error: kEnumerableProperty @@ -15320,10 +15320,10 @@ var require_response = __commonJS({ } __name(initializeResponse, "initializeResponse"); webidl.converters.ReadableStream = webidl.interfaceConverter( - ReadableStream + ReadableStream2 ); webidl.converters.FormData = webidl.interfaceConverter( - FormData + FormData2 ); webidl.converters.URLSearchParams = webidl.interfaceConverter( URLSearchParams @@ -15347,7 +15347,7 @@ var require_response = __commonJS({ return webidl.converters.DOMString(V); }; webidl.converters.BodyInit = function(V) { - if (V instanceof ReadableStream) { + if (V instanceof ReadableStream2) { return webidl.converters.ReadableStream(V); } if (V?.[Symbol.asyncIterator]) { @@ -15376,7 +15376,7 @@ var require_response = __commonJS({ makeResponse, makeAppropriateNetworkError, filterResponse, - Response, + Response: Response2, cloneResponse }; } @@ -15420,7 +15420,7 @@ var require_request2 = __commonJS({ var requestFinalizer = new FinalizationRegistry(({ signal, abort }) => { signal.removeEventListener("abort", abort); }); - var Request = class _Request { + var Request2 = class _Request { static { __name(this, "Request"); } @@ -15852,7 +15852,7 @@ var require_request2 = __commonJS({ return clonedRequestObject; } }; - mixinBody(Request); + mixinBody(Request2); function makeRequest(init) { const request = { method: "GET", @@ -15905,7 +15905,7 @@ var require_request2 = __commonJS({ return newRequest; } __name(cloneRequest, "cloneRequest"); - Object.defineProperties(Request.prototype, { + Object.defineProperties(Request2.prototype, { method: kEnumerableProperty, url: kEnumerableProperty, headers: kEnumerableProperty, @@ -15932,13 +15932,13 @@ var require_request2 = __commonJS({ } }); webidl.converters.Request = webidl.interfaceConverter( - Request + Request2 ); webidl.converters.RequestInfo = function(V) { if (typeof V === "string") { return webidl.converters.USVString(V); } - if (V instanceof Request) { + if (V instanceof Request2) { return webidl.converters.Request(V); } return webidl.converters.USVString(V); @@ -16022,7 +16022,7 @@ var require_request2 = __commonJS({ allowedValues: requestDuplex } ]); - module2.exports = { Request, makeRequest }; + module2.exports = { Request: Request2, makeRequest }; } }); @@ -16031,14 +16031,14 @@ var require_fetch = __commonJS({ "node_modules/undici/lib/fetch/index.js"(exports2, module2) { "use strict"; var { - Response, + Response: Response2, makeNetworkError, makeAppropriateNetworkError, filterResponse, makeResponse } = require_response(); var { Headers } = require_headers(); - var { Request, makeRequest } = require_request2(); + var { Request: Request2, makeRequest } = require_request2(); var zlib = require("zlib"); var { bytesMatch, @@ -16092,7 +16092,7 @@ var require_fetch = __commonJS({ var { STATUS_CODES } = require("http"); var GET_OR_HEAD = ["GET", "HEAD"]; var resolveObjectURL; - var ReadableStream = globalThis.ReadableStream; + var ReadableStream2 = globalThis.ReadableStream; var Fetch = class extends EE { static { __name(this, "Fetch"); @@ -16127,12 +16127,12 @@ var require_fetch = __commonJS({ this.emit("terminated", error); } }; - function fetch(input, init = {}) { + function fetch2(input, init = {}) { webidl.argumentLengthCheck(arguments, 1, { header: "globalThis.fetch" }); const p = createDeferredPromise(); let requestObject; try { - requestObject = new Request(input, init); + requestObject = new Request2(input, init); } catch (e) { p.reject(e); return p.promise; @@ -16174,7 +16174,7 @@ var require_fetch = __commonJS({ ); return Promise.resolve(); } - responseObject = new Response(); + responseObject = new Response2(); responseObject[kState] = response; responseObject[kRealm] = relevantRealm; responseObject[kHeaders][kHeadersList] = response.headersList; @@ -16191,7 +16191,7 @@ var require_fetch = __commonJS({ }); return p.promise; } - __name(fetch, "fetch"); + __name(fetch2, "fetch"); function finalizeAndReportTiming(response, initiatorType = "other") { if (response.type === "error" && response.aborted) { return; @@ -16854,10 +16854,10 @@ var require_fetch = __commonJS({ const cancelAlgorithm = /* @__PURE__ */ __name((reason) => { fetchParams.controller.abort(reason); }, "cancelAlgorithm"); - if (!ReadableStream) { - ReadableStream = require("stream/web").ReadableStream; + if (!ReadableStream2) { + ReadableStream2 = require("stream/web").ReadableStream; } - const stream = new ReadableStream( + const stream = new ReadableStream2( { async start(controller) { fetchParams.controller.controller = controller; @@ -17072,7 +17072,7 @@ var require_fetch = __commonJS({ } __name(httpNetworkFetch, "httpNetworkFetch"); module2.exports = { - fetch, + fetch: fetch2, Fetch, fetching, finalizeAndReportTiming @@ -17961,8 +17961,8 @@ var require_cache = __commonJS({ var { kEnumerableProperty, isDisturbed } = require_util(); var { kHeadersList } = require_symbols(); var { webidl } = require_webidl(); - var { Response, cloneResponse } = require_response(); - var { Request } = require_request2(); + var { Response: Response2, cloneResponse } = require_response(); + var { Request: Request2 } = require_request2(); var { kState, kHeaders, kGuard, kRealm } = require_symbols2(); var { fetching } = require_fetch(); var { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = require_util2(); @@ -18001,13 +18001,13 @@ var require_cache = __commonJS({ options = webidl.converters.CacheQueryOptions(options); let r = null; if (request !== void 0) { - if (request instanceof Request) { + if (request instanceof Request2) { r = request[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } } else if (typeof request === "string") { - r = new Request(request)[kState]; + r = new Request2(request)[kState]; } } const responses = []; @@ -18023,7 +18023,7 @@ var require_cache = __commonJS({ } const responseList = []; for (const response of responses) { - const responseObject = new Response(response.body?.source ?? null); + const responseObject = new Response2(response.body?.source ?? null); const body = responseObject[kState].body; responseObject[kState] = response; responseObject[kState].body = body; @@ -18061,7 +18061,7 @@ var require_cache = __commonJS({ } const fetchControllers = []; for (const request of requests) { - const r = new Request(request)[kState]; + const r = new Request2(request)[kState]; if (!urlIsHttpHttpsScheme(r.url)) { throw webidl.errors.exception({ header: "Cache.addAll", @@ -18145,10 +18145,10 @@ var require_cache = __commonJS({ request = webidl.converters.RequestInfo(request); response = webidl.converters.Response(response); let innerRequest = null; - if (request instanceof Request) { + if (request instanceof Request2) { innerRequest = request[kState]; } else { - innerRequest = new Request(request)[kState]; + innerRequest = new Request2(request)[kState]; } if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { throw webidl.errors.exception({ @@ -18225,14 +18225,14 @@ var require_cache = __commonJS({ request = webidl.converters.RequestInfo(request); options = webidl.converters.CacheQueryOptions(options); let r = null; - if (request instanceof Request) { + if (request instanceof Request2) { r = request[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return false; } } else { assert(typeof request === "string"); - r = new Request(request)[kState]; + r = new Request2(request)[kState]; } const operations = []; const operation = { @@ -18271,13 +18271,13 @@ var require_cache = __commonJS({ options = webidl.converters.CacheQueryOptions(options); let r = null; if (request !== void 0) { - if (request instanceof Request) { + if (request instanceof Request2) { r = request[kState]; if (r.method !== "GET" && !options.ignoreMethod) { return []; } } else if (typeof request === "string") { - r = new Request(request)[kState]; + r = new Request2(request)[kState]; } } const promise = createDeferredPromise(); @@ -18295,7 +18295,7 @@ var require_cache = __commonJS({ queueMicrotask(() => { const requestList = []; for (const request2 of requests) { - const requestObject = new Request("https://a"); + const requestObject = new Request2("https://a"); requestObject[kState] = request2; requestObject[kHeaders][kHeadersList] = request2.headersList; requestObject[kHeaders][kGuard] = "immutable"; @@ -18479,7 +18479,7 @@ var require_cache = __commonJS({ converter: webidl.converters.DOMString } ]); - webidl.converters.Response = webidl.interfaceConverter(Response); + webidl.converters.Response = webidl.interfaceConverter(Response2); webidl.converters["sequence"] = webidl.sequenceConverter( webidl.converters.RequestInfo ); @@ -20411,7 +20411,7 @@ var require_undici = __commonJS({ module2.exports.getGlobalDispatcher = getGlobalDispatcher; if (util.nodeMajor > 16 || util.nodeMajor === 16 && util.nodeMinor >= 8) { let fetchImpl = null; - module2.exports.fetch = /* @__PURE__ */ __name(async function fetch(resource) { + module2.exports.fetch = /* @__PURE__ */ __name(async function fetch2(resource) { if (!fetchImpl) { fetchImpl = require_fetch().fetch; } @@ -43282,11 +43282,11 @@ var require_form_data = __commonJS({ var mime = require_mime_types(); var asynckit = require_asynckit(); var populate = require_populate(); - module2.exports = FormData; - util.inherits(FormData, CombinedStream); - function FormData(options) { - if (!(this instanceof FormData)) { - return new FormData(options); + module2.exports = FormData2; + util.inherits(FormData2, CombinedStream); + function FormData2(options) { + if (!(this instanceof FormData2)) { + return new FormData2(options); } this._overheadLength = 0; this._valueLength = 0; @@ -43297,10 +43297,10 @@ var require_form_data = __commonJS({ this[option] = options[option]; } } - __name(FormData, "FormData"); - FormData.LINE_BREAK = "\r\n"; - FormData.DEFAULT_CONTENT_TYPE = "application/octet-stream"; - FormData.prototype.append = function(field, value, options) { + __name(FormData2, "FormData"); + FormData2.LINE_BREAK = "\r\n"; + FormData2.DEFAULT_CONTENT_TYPE = "application/octet-stream"; + FormData2.prototype.append = function(field, value, options) { options = options || {}; if (typeof options == "string") { options = { filename: options }; @@ -43320,7 +43320,7 @@ var require_form_data = __commonJS({ append(footer); this._trackLength(header, value, options); }; - FormData.prototype._trackLength = function(header, value, options) { + FormData2.prototype._trackLength = function(header, value, options) { var valueLength = 0; if (options.knownLength != null) { valueLength += +options.knownLength; @@ -43330,7 +43330,7 @@ var require_form_data = __commonJS({ valueLength = Buffer.byteLength(value); } this._valueLength += valueLength; - this._overheadLength += Buffer.byteLength(header) + FormData.LINE_BREAK.length; + this._overheadLength += Buffer.byteLength(header) + FormData2.LINE_BREAK.length; if (!value || !value.path && !(value.readable && value.hasOwnProperty("httpVersion")) && !(value instanceof Stream)) { return; } @@ -43338,7 +43338,7 @@ var require_form_data = __commonJS({ this._valuesToMeasure.push(value); } }; - FormData.prototype._lengthRetriever = function(value, callback) { + FormData2.prototype._lengthRetriever = function(value, callback) { if (value.hasOwnProperty("fd")) { if (value.end != void 0 && value.end != Infinity && value.start != void 0) { callback(null, value.end + 1 - (value.start ? value.start : 0)); @@ -43365,7 +43365,7 @@ var require_form_data = __commonJS({ callback("Unknown stream"); } }; - FormData.prototype._multiPartHeader = function(field, value, options) { + FormData2.prototype._multiPartHeader = function(field, value, options) { if (typeof options.header == "string") { return options.header; } @@ -43393,12 +43393,12 @@ var require_form_data = __commonJS({ header = [header]; } if (header.length) { - contents += prop + ": " + header.join("; ") + FormData.LINE_BREAK; + contents += prop + ": " + header.join("; ") + FormData2.LINE_BREAK; } } - return "--" + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; + return "--" + this.getBoundary() + FormData2.LINE_BREAK + contents + FormData2.LINE_BREAK; }; - FormData.prototype._getContentDisposition = function(value, options) { + FormData2.prototype._getContentDisposition = function(value, options) { var filename, contentDisposition; if (typeof options.filepath === "string") { filename = path2.normalize(options.filepath).replace(/\\/g, "/"); @@ -43412,7 +43412,7 @@ var require_form_data = __commonJS({ } return contentDisposition; }; - FormData.prototype._getContentType = function(value, options) { + FormData2.prototype._getContentType = function(value, options) { var contentType = options.contentType; if (!contentType && value.name) { contentType = mime.lookup(value.name); @@ -43427,13 +43427,13 @@ var require_form_data = __commonJS({ contentType = mime.lookup(options.filepath || options.filename); } if (!contentType && typeof value == "object") { - contentType = FormData.DEFAULT_CONTENT_TYPE; + contentType = FormData2.DEFAULT_CONTENT_TYPE; } return contentType; }; - FormData.prototype._multiPartFooter = function() { + FormData2.prototype._multiPartFooter = function() { return function(next) { - var footer = FormData.LINE_BREAK; + var footer = FormData2.LINE_BREAK; var lastPart = this._streams.length === 0; if (lastPart) { footer += this._lastBoundary(); @@ -43441,10 +43441,10 @@ var require_form_data = __commonJS({ next(footer); }.bind(this); }; - FormData.prototype._lastBoundary = function() { - return "--" + this.getBoundary() + "--" + FormData.LINE_BREAK; + FormData2.prototype._lastBoundary = function() { + return "--" + this.getBoundary() + "--" + FormData2.LINE_BREAK; }; - FormData.prototype.getHeaders = function(userHeaders) { + FormData2.prototype.getHeaders = function(userHeaders) { var header; var formHeaders = { "content-type": "multipart/form-data; boundary=" + this.getBoundary() @@ -43456,16 +43456,16 @@ var require_form_data = __commonJS({ } return formHeaders; }; - FormData.prototype.setBoundary = function(boundary) { + FormData2.prototype.setBoundary = function(boundary) { this._boundary = boundary; }; - FormData.prototype.getBoundary = function() { + FormData2.prototype.getBoundary = function() { if (!this._boundary) { this._generateBoundary(); } return this._boundary; }; - FormData.prototype.getBuffer = function() { + FormData2.prototype.getBuffer = function() { var dataBuffer = new Buffer.alloc(0); var boundary = this.getBoundary(); for (var i = 0, len = this._streams.length; i < len; i++) { @@ -43476,20 +43476,20 @@ var require_form_data = __commonJS({ dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]); } if (typeof this._streams[i] !== "string" || this._streams[i].substring(2, boundary.length + 2) !== boundary) { - dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData.LINE_BREAK)]); + dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData2.LINE_BREAK)]); } } } return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]); }; - FormData.prototype._generateBoundary = function() { + FormData2.prototype._generateBoundary = function() { var boundary = "--------------------------"; for (var i = 0; i < 24; i++) { boundary += Math.floor(Math.random() * 10).toString(16); } this._boundary = boundary; }; - FormData.prototype.getLengthSync = function() { + FormData2.prototype.getLengthSync = function() { var knownLength = this._overheadLength + this._valueLength; if (this._streams.length) { knownLength += this._lastBoundary().length; @@ -43499,14 +43499,14 @@ var require_form_data = __commonJS({ } return knownLength; }; - FormData.prototype.hasKnownLength = function() { + FormData2.prototype.hasKnownLength = function() { var hasKnownLength = true; if (this._valuesToMeasure.length) { hasKnownLength = false; } return hasKnownLength; }; - FormData.prototype.getLength = function(cb) { + FormData2.prototype.getLength = function(cb) { var knownLength = this._overheadLength + this._valueLength; if (this._streams.length) { knownLength += this._lastBoundary().length; @@ -43526,7 +43526,7 @@ var require_form_data = __commonJS({ cb(null, knownLength); }); }; - FormData.prototype.submit = function(params, cb) { + FormData2.prototype.submit = function(params, cb) { var request, options, defaults = { method: "post" }; if (typeof params == "string") { params = parseUrl(params); @@ -43571,14 +43571,14 @@ var require_form_data = __commonJS({ }.bind(this)); return request; }; - FormData.prototype._error = function(err) { + FormData2.prototype._error = function(err) { if (!this.error) { this.error = err; this.pause(); this.emit("error", err); } }; - FormData.prototype.toString = function() { + FormData2.prototype.toString = function() { return "[object FormData]"; }; } @@ -46191,7 +46191,7 @@ var require_lib4 = __commonJS({ __name(createHeadersLenient, "createHeadersLenient"); var INTERNALS$1 = Symbol("Response internals"); var STATUS_CODES = http.STATUS_CODES; - var Response = class _Response { + var Response2 = class _Response { static { __name(this, "Response"); } @@ -46252,8 +46252,8 @@ var require_lib4 = __commonJS({ }); } }; - Body.mixIn(Response.prototype); - Object.defineProperties(Response.prototype, { + Body.mixIn(Response2.prototype); + Object.defineProperties(Response2.prototype, { url: { enumerable: true }, status: { enumerable: true }, ok: { enumerable: true }, @@ -46262,7 +46262,7 @@ var require_lib4 = __commonJS({ headers: { enumerable: true }, clone: { enumerable: true } }); - Object.defineProperty(Response.prototype, Symbol.toStringTag, { + Object.defineProperty(Response2.prototype, Symbol.toStringTag, { value: "Response", writable: false, enumerable: false, @@ -46289,7 +46289,7 @@ var require_lib4 = __commonJS({ return !!(proto && proto.constructor.name === "AbortSignal"); } __name(isAbortSignal, "isAbortSignal"); - var Request = class _Request { + var Request2 = class _Request { static { __name(this, "Request"); } @@ -46365,14 +46365,14 @@ var require_lib4 = __commonJS({ return new _Request(this); } }; - Body.mixIn(Request.prototype); - Object.defineProperty(Request.prototype, Symbol.toStringTag, { + Body.mixIn(Request2.prototype); + Object.defineProperty(Request2.prototype, Symbol.toStringTag, { value: "Request", writable: false, enumerable: false, configurable: true }); - Object.defineProperties(Request.prototype, { + Object.defineProperties(Request2.prototype, { method: { enumerable: true }, url: { enumerable: true }, headers: { enumerable: true }, @@ -46447,13 +46447,13 @@ var require_lib4 = __commonJS({ const dest = new URL$1(destination).protocol; return orig === dest; }, "isSameProtocol"); - function fetch(url, opts) { - if (!fetch.Promise) { + function fetch2(url, opts) { + if (!fetch2.Promise) { throw new Error("native promise missing, set fetch.Promise to your favorite alternative"); } - Body.Promise = fetch.Promise; - return new fetch.Promise(function(resolve, reject) { - const request = new Request(url, opts); + Body.Promise = fetch2.Promise; + return new fetch2.Promise(function(resolve, reject) { + const request = new Request2(url, opts); const options = getNodeRequestOptions(request); const send = (options.protocol === "https:" ? https : http).request; const signal = request.signal; @@ -46526,7 +46526,7 @@ var require_lib4 = __commonJS({ req.on("response", function(res) { clearTimeout(reqTimeout); const headers = createHeadersLenient(res.headers); - if (fetch.isRedirect(res.statusCode)) { + if (fetch2.isRedirect(res.statusCode)) { const location = headers.get("Location"); let locationURL = null; try { @@ -46588,7 +46588,7 @@ var require_lib4 = __commonJS({ requestOpts.body = void 0; requestOpts.headers.delete("content-length"); } - resolve(fetch(new Request(locationURL, requestOpts))); + resolve(fetch2(new Request2(locationURL, requestOpts))); finalize(); return; } @@ -46609,7 +46609,7 @@ var require_lib4 = __commonJS({ }; const codings = headers.get("Content-Encoding"); if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); + response = new Response2(body, response_options); resolve(response); return; } @@ -46619,7 +46619,7 @@ var require_lib4 = __commonJS({ }; if (codings == "gzip" || codings == "x-gzip") { body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); + response = new Response2(body, response_options); resolve(response); return; } @@ -46631,12 +46631,12 @@ var require_lib4 = __commonJS({ } else { body = body.pipe(zlib.createInflateRaw()); } - response = new Response(body, response_options); + response = new Response2(body, response_options); resolve(response); }); raw.on("end", function() { if (!response) { - response = new Response(body, response_options); + response = new Response2(body, response_options); resolve(response); } }); @@ -46644,17 +46644,17 @@ var require_lib4 = __commonJS({ } if (codings == "br" && typeof zlib.createBrotliDecompress === "function") { body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); + response = new Response2(body, response_options); resolve(response); return; } - response = new Response(body, response_options); + response = new Response2(body, response_options); resolve(response); }); writeToStream(req, request); }); } - __name(fetch, "fetch"); + __name(fetch2, "fetch"); function fixResponseChunkedTransferBadEnding(request, errorCallback) { let socket; request.on("socket", function(s) { @@ -46684,16 +46684,16 @@ var require_lib4 = __commonJS({ } } __name(destroyStream, "destroyStream"); - fetch.isRedirect = function(code) { + fetch2.isRedirect = function(code) { return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; }; - fetch.Promise = global.Promise; - module2.exports = exports2 = fetch; + fetch2.Promise = global.Promise; + module2.exports = exports2 = fetch2; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.default = exports2; exports2.Headers = Headers; - exports2.Request = Request; - exports2.Response = Response; + exports2.Request = Request2; + exports2.Response = Response2; exports2.FetchError = FetchError; exports2.AbortError = AbortError; } @@ -46725,7 +46725,7 @@ var init_platform = __esm({ var VERSION; var init_version3 = __esm({ "node_modules/@opentelemetry/api/build/esm/version.js"() { - VERSION = "1.8.0"; + VERSION = "1.9.0"; } }); @@ -47325,7 +47325,7 @@ var init_consoleLogger = __esm({ function createNoopMeter() { return NOOP_METER; } -var __extends2, NoopMeter, NoopMetric, NoopCounterMetric, NoopUpDownCounterMetric, NoopHistogramMetric, NoopObservableMetric, NoopObservableCounterMetric, NoopObservableGaugeMetric, NoopObservableUpDownCounterMetric, NOOP_METER, NOOP_COUNTER_METRIC, NOOP_HISTOGRAM_METRIC, NOOP_UP_DOWN_COUNTER_METRIC, NOOP_OBSERVABLE_COUNTER_METRIC, NOOP_OBSERVABLE_GAUGE_METRIC, NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC; +var __extends2, NoopMeter, NoopMetric, NoopCounterMetric, NoopUpDownCounterMetric, NoopGaugeMetric, NoopHistogramMetric, NoopObservableMetric, NoopObservableCounterMetric, NoopObservableGaugeMetric, NoopObservableUpDownCounterMetric, NOOP_METER, NOOP_COUNTER_METRIC, NOOP_GAUGE_METRIC, NOOP_HISTOGRAM_METRIC, NOOP_UP_DOWN_COUNTER_METRIC, NOOP_OBSERVABLE_COUNTER_METRIC, NOOP_OBSERVABLE_GAUGE_METRIC, NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC; var init_NoopMeter = __esm({ "node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js"() { __extends2 = /* @__PURE__ */ function() { @@ -47355,6 +47355,9 @@ var init_NoopMeter = __esm({ function NoopMeter2() { } __name(NoopMeter2, "NoopMeter"); + NoopMeter2.prototype.createGauge = function(_name, _options) { + return NOOP_GAUGE_METRIC; + }; NoopMeter2.prototype.createHistogram = function(_name, _options) { return NOOP_HISTOGRAM_METRIC; }; @@ -47408,6 +47411,17 @@ var init_NoopMeter = __esm({ }; return NoopUpDownCounterMetric2; }(NoopMetric); + NoopGaugeMetric = /** @class */ + function(_super) { + __extends2(NoopGaugeMetric2, _super); + function NoopGaugeMetric2() { + return _super !== null && _super.apply(this, arguments) || this; + } + __name(NoopGaugeMetric2, "NoopGaugeMetric"); + NoopGaugeMetric2.prototype.record = function(_value, _attributes) { + }; + return NoopGaugeMetric2; + }(NoopMetric); NoopHistogramMetric = /** @class */ function(_super) { __extends2(NoopHistogramMetric2, _super); @@ -47459,6 +47473,7 @@ var init_NoopMeter = __esm({ }(NoopObservableMetric); NOOP_METER = new NoopMeter(); NOOP_COUNTER_METRIC = new NoopCounterMetric(); + NOOP_GAUGE_METRIC = new NoopGaugeMetric(); NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric(); NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric(); NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric(); @@ -47707,6 +47722,12 @@ var init_NonRecordingSpan = __esm({ NonRecordingSpan2.prototype.addEvent = function(_name, _attributes) { return this; }; + NonRecordingSpan2.prototype.addLink = function(_link) { + return this; + }; + NonRecordingSpan2.prototype.addLinks = function(_links) { + return this; + }; NonRecordingSpan2.prototype.setStatus = function(_status) { return this; }; @@ -48551,7 +48572,7 @@ var require_dist7 = __commonJS({ var abortController = require_dist5(); var tunnel = require_tunnel2(); var stream = require("stream"); - var FormData = require_form_data(); + var FormData2 = require_form_data(); var node_fetch = require_lib4(); var coreTracing = require_dist6(); function _interopDefaultLegacy(e) { @@ -48584,7 +48605,7 @@ var require_dist7 = __commonJS({ var http__namespace = /* @__PURE__ */ _interopNamespace(http); var https__namespace = /* @__PURE__ */ _interopNamespace(https); var tunnel__namespace = /* @__PURE__ */ _interopNamespace(tunnel); - var FormData__default = /* @__PURE__ */ _interopDefaultLegacy(FormData); + var FormData__default = /* @__PURE__ */ _interopDefaultLegacy(FormData2); var node_fetch__default = /* @__PURE__ */ _interopDefaultLegacy(node_fetch); function getHeaderKey(headerName) { return headerName.toLowerCase(); @@ -77733,193 +77754,5407 @@ var require_requestUtils = __commonJS({ step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.retryHttpClientResponse = exports2.retryTypedResponse = exports2.retry = exports2.isRetryableStatusCode = exports2.isServerErrorStatusCode = exports2.isSuccessStatusCode = void 0; - var core = __importStar2(require_core()); - var http_client_1 = require_lib(); - var constants_1 = require_constants6(); - function isSuccessStatusCode(statusCode) { - if (!statusCode) { - return false; - } - return statusCode >= 200 && statusCode < 300; - } - __name(isSuccessStatusCode, "isSuccessStatusCode"); - exports2.isSuccessStatusCode = isSuccessStatusCode; - function isServerErrorStatusCode(statusCode) { - if (!statusCode) { - return true; - } - return statusCode >= 500; - } - __name(isServerErrorStatusCode, "isServerErrorStatusCode"); - exports2.isServerErrorStatusCode = isServerErrorStatusCode; - function isRetryableStatusCode(statusCode) { - if (!statusCode) { - return false; - } - const retryableStatusCodes = [ - http_client_1.HttpCodes.BadGateway, - http_client_1.HttpCodes.ServiceUnavailable, - http_client_1.HttpCodes.GatewayTimeout - ]; - return retryableStatusCodes.includes(statusCode); - } - __name(isRetryableStatusCode, "isRetryableStatusCode"); - exports2.isRetryableStatusCode = isRetryableStatusCode; - function sleep(milliseconds) { - return __awaiter2(this, void 0, void 0, function* () { - return new Promise((resolve) => setTimeout(resolve, milliseconds)); - }); - } - __name(sleep, "sleep"); - function retry(name, method, getStatusCode, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay, onError = void 0) { - return __awaiter2(this, void 0, void 0, function* () { - let errorMessage = ""; - let attempt = 1; - while (attempt <= maxAttempts) { - let response = void 0; - let statusCode = void 0; - let isRetryable = false; - try { - response = yield method(); - } catch (error) { - if (onError) { - response = onError(error); - } - isRetryable = true; - errorMessage = error.message; - } - if (response) { - statusCode = getStatusCode(response); - if (!isServerErrorStatusCode(statusCode)) { - return response; - } - } - if (statusCode) { - isRetryable = isRetryableStatusCode(statusCode); - errorMessage = `Cache service responded with ${statusCode}`; - } - core.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`); - if (!isRetryable) { - core.debug(`${name} - Error is not retryable`); - break; - } - yield sleep(delay); - attempt++; - } - throw Error(`${name} failed: ${errorMessage}`); - }); - } - __name(retry, "retry"); - exports2.retry = retry; - function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) { - return __awaiter2(this, void 0, void 0, function* () { - return yield retry( - name, - method, - (response) => response.statusCode, - maxAttempts, - delay, - // If the error object contains the statusCode property, extract it and return - // an TypedResponse so it can be processed by the retry logic. - (error) => { - core.debug(`Error occurred during ${name}: ${JSON.stringify(error)}`); - if (error instanceof http_client_1.HttpClientError) { - return { - statusCode: error.statusCode, - result: null, - headers: {}, - error - }; - } else { - return void 0; - } - } - ); - }); - } - __name(retryTypedResponse, "retryTypedResponse"); - exports2.retryTypedResponse = retryTypedResponse; - function retryHttpClientResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) { - return __awaiter2(this, void 0, void 0, function* () { - return yield retry(name, method, (response) => response.message.statusCode, maxAttempts, delay); - }); - } - __name(retryHttpClientResponse, "retryHttpClientResponse"); - exports2.retryHttpClientResponse = retryHttpClientResponse; - } -}); - -// node_modules/@actions/cache/lib/internal/downloadUtils.js -var require_downloadUtils = __commonJS({ - "node_modules/@actions/cache/lib/internal/downloadUtils.js"(exports2) { - "use strict"; - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding2(result, mod, k); - } - __setModuleDefault2(result, mod); - return result; - }; - var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - __name(adopt, "adopt"); - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - __name(fulfilled, "fulfilled"); - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - __name(rejected, "rejected"); - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - __name(step, "step"); - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.retryHttpClientResponse = exports2.retryTypedResponse = exports2.retry = exports2.isRetryableStatusCode = exports2.isServerErrorStatusCode = exports2.isSuccessStatusCode = void 0; + var core = __importStar2(require_core()); + var http_client_1 = require_lib(); + var constants_1 = require_constants6(); + function isSuccessStatusCode(statusCode) { + if (!statusCode) { + return false; + } + return statusCode >= 200 && statusCode < 300; + } + __name(isSuccessStatusCode, "isSuccessStatusCode"); + exports2.isSuccessStatusCode = isSuccessStatusCode; + function isServerErrorStatusCode(statusCode) { + if (!statusCode) { + return true; + } + return statusCode >= 500; + } + __name(isServerErrorStatusCode, "isServerErrorStatusCode"); + exports2.isServerErrorStatusCode = isServerErrorStatusCode; + function isRetryableStatusCode(statusCode) { + if (!statusCode) { + return false; + } + const retryableStatusCodes = [ + http_client_1.HttpCodes.BadGateway, + http_client_1.HttpCodes.ServiceUnavailable, + http_client_1.HttpCodes.GatewayTimeout + ]; + return retryableStatusCodes.includes(statusCode); + } + __name(isRetryableStatusCode, "isRetryableStatusCode"); + exports2.isRetryableStatusCode = isRetryableStatusCode; + function sleep(milliseconds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve) => setTimeout(resolve, milliseconds)); + }); + } + __name(sleep, "sleep"); + function retry(name, method, getStatusCode, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay, onError = void 0) { + return __awaiter2(this, void 0, void 0, function* () { + let errorMessage = ""; + let attempt = 1; + while (attempt <= maxAttempts) { + let response = void 0; + let statusCode = void 0; + let isRetryable = false; + try { + response = yield method(); + } catch (error) { + if (onError) { + response = onError(error); + } + isRetryable = true; + errorMessage = error.message; + } + if (response) { + statusCode = getStatusCode(response); + if (!isServerErrorStatusCode(statusCode)) { + return response; + } + } + if (statusCode) { + isRetryable = isRetryableStatusCode(statusCode); + errorMessage = `Cache service responded with ${statusCode}`; + } + core.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`); + if (!isRetryable) { + core.debug(`${name} - Error is not retryable`); + break; + } + yield sleep(delay); + attempt++; + } + throw Error(`${name} failed: ${errorMessage}`); + }); + } + __name(retry, "retry"); + exports2.retry = retry; + function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) { + return __awaiter2(this, void 0, void 0, function* () { + return yield retry( + name, + method, + (response) => response.statusCode, + maxAttempts, + delay, + // If the error object contains the statusCode property, extract it and return + // an TypedResponse so it can be processed by the retry logic. + (error) => { + core.debug(`Error occurred during ${name}: ${JSON.stringify(error)}`); + if (error instanceof http_client_1.HttpClientError) { + return { + statusCode: error.statusCode, + result: null, + headers: {}, + error + }; + } else { + return void 0; + } + } + ); + }); + } + __name(retryTypedResponse, "retryTypedResponse"); + exports2.retryTypedResponse = retryTypedResponse; + function retryHttpClientResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) { + return __awaiter2(this, void 0, void 0, function* () { + return yield retry(name, method, (response) => response.message.statusCode, maxAttempts, delay); + }); + } + __name(retryHttpClientResponse, "retryHttpClientResponse"); + exports2.retryHttpClientResponse = retryHttpClientResponse; + } +}); + +// node_modules/is-retry-allowed/index.js +var require_is_retry_allowed = __commonJS({ + "node_modules/is-retry-allowed/index.js"(exports2, module2) { + "use strict"; + var denyList = /* @__PURE__ */ new Set([ + "ENOTFOUND", + "ENETUNREACH", + // SSL errors from https://github.com/nodejs/node/blob/fc8e3e2cdc521978351de257030db0076d79e0ab/src/crypto/crypto_common.cc#L301-L328 + "UNABLE_TO_GET_ISSUER_CERT", + "UNABLE_TO_GET_CRL", + "UNABLE_TO_DECRYPT_CERT_SIGNATURE", + "UNABLE_TO_DECRYPT_CRL_SIGNATURE", + "UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY", + "CERT_SIGNATURE_FAILURE", + "CRL_SIGNATURE_FAILURE", + "CERT_NOT_YET_VALID", + "CERT_HAS_EXPIRED", + "CRL_NOT_YET_VALID", + "CRL_HAS_EXPIRED", + "ERROR_IN_CERT_NOT_BEFORE_FIELD", + "ERROR_IN_CERT_NOT_AFTER_FIELD", + "ERROR_IN_CRL_LAST_UPDATE_FIELD", + "ERROR_IN_CRL_NEXT_UPDATE_FIELD", + "OUT_OF_MEM", + "DEPTH_ZERO_SELF_SIGNED_CERT", + "SELF_SIGNED_CERT_IN_CHAIN", + "UNABLE_TO_GET_ISSUER_CERT_LOCALLY", + "UNABLE_TO_VERIFY_LEAF_SIGNATURE", + "CERT_CHAIN_TOO_LONG", + "CERT_REVOKED", + "INVALID_CA", + "PATH_LENGTH_EXCEEDED", + "INVALID_PURPOSE", + "CERT_UNTRUSTED", + "CERT_REJECTED", + "HOSTNAME_MISMATCH" + ]); + module2.exports = (error) => !denyList.has(error && error.code); + } +}); + +// node_modules/axios-retry/dist/cjs/index.js +var require_cjs = __commonJS({ + "node_modules/axios-retry/dist/cjs/index.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + __name(adopt, "adopt"); + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + __name(fulfilled, "fulfilled"); + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + __name(rejected, "rejected"); + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + __name(step, "step"); + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DEFAULT_OPTIONS = exports2.exponentialDelay = exports2.retryAfter = exports2.isNetworkOrIdempotentRequestError = exports2.isIdempotentRequestError = exports2.isSafeRequestError = exports2.isRetryableError = exports2.isNetworkError = exports2.namespace = void 0; + var is_retry_allowed_1 = __importDefault2(require_is_retry_allowed()); + exports2.namespace = "axios-retry"; + function isNetworkError(error) { + const CODE_EXCLUDE_LIST = ["ERR_CANCELED", "ECONNABORTED"]; + if (error.response) { + return false; + } + if (!error.code) { + return false; + } + if (CODE_EXCLUDE_LIST.includes(error.code)) { + return false; + } + return (0, is_retry_allowed_1.default)(error); + } + __name(isNetworkError, "isNetworkError"); + exports2.isNetworkError = isNetworkError; + var SAFE_HTTP_METHODS = ["get", "head", "options"]; + var IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(["put", "delete"]); + function isRetryableError(error) { + return error.code !== "ECONNABORTED" && (!error.response || error.response.status === 429 || error.response.status >= 500 && error.response.status <= 599); + } + __name(isRetryableError, "isRetryableError"); + exports2.isRetryableError = isRetryableError; + function isSafeRequestError(error) { + var _a; + if (!((_a = error.config) === null || _a === void 0 ? void 0 : _a.method)) { + return false; + } + return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1; + } + __name(isSafeRequestError, "isSafeRequestError"); + exports2.isSafeRequestError = isSafeRequestError; + function isIdempotentRequestError(error) { + var _a; + if (!((_a = error.config) === null || _a === void 0 ? void 0 : _a.method)) { + return false; + } + return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1; + } + __name(isIdempotentRequestError, "isIdempotentRequestError"); + exports2.isIdempotentRequestError = isIdempotentRequestError; + function isNetworkOrIdempotentRequestError(error) { + return isNetworkError(error) || isIdempotentRequestError(error); + } + __name(isNetworkOrIdempotentRequestError, "isNetworkOrIdempotentRequestError"); + exports2.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError; + function retryAfter(error = void 0) { + var _a; + const retryAfterHeader = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.headers["retry-after"]; + if (!retryAfterHeader) { + return 0; + } + let retryAfterMs = (Number(retryAfterHeader) || 0) * 1e3; + if (retryAfterMs === 0) { + retryAfterMs = (new Date(retryAfterHeader).valueOf() || 0) - Date.now(); + } + return Math.max(0, retryAfterMs); + } + __name(retryAfter, "retryAfter"); + exports2.retryAfter = retryAfter; + function noDelay(_retryNumber = 0, error = void 0) { + return Math.max(0, retryAfter(error)); + } + __name(noDelay, "noDelay"); + function exponentialDelay(retryNumber = 0, error = void 0, delayFactor = 100) { + const calculatedDelay = Math.pow(2, retryNumber) * delayFactor; + const delay = Math.max(calculatedDelay, retryAfter(error)); + const randomSum = delay * 0.2 * Math.random(); + return delay + randomSum; + } + __name(exponentialDelay, "exponentialDelay"); + exports2.exponentialDelay = exponentialDelay; + exports2.DEFAULT_OPTIONS = { + retries: 3, + retryCondition: isNetworkOrIdempotentRequestError, + retryDelay: noDelay, + shouldResetTimeout: false, + onRetry: () => { + }, + onMaxRetryTimesExceeded: () => { + }, + validateResponse: null + }; + function getRequestOptions(config, defaultOptions) { + return Object.assign(Object.assign(Object.assign({}, exports2.DEFAULT_OPTIONS), defaultOptions), config[exports2.namespace]); + } + __name(getRequestOptions, "getRequestOptions"); + function setCurrentState(config, defaultOptions) { + const currentState = getRequestOptions(config, defaultOptions || {}); + currentState.retryCount = currentState.retryCount || 0; + currentState.lastRequestTime = currentState.lastRequestTime || Date.now(); + config[exports2.namespace] = currentState; + return currentState; + } + __name(setCurrentState, "setCurrentState"); + function fixConfig(axiosInstance, config) { + if (axiosInstance.defaults.agent === config.agent) { + delete config.agent; + } + if (axiosInstance.defaults.httpAgent === config.httpAgent) { + delete config.httpAgent; + } + if (axiosInstance.defaults.httpsAgent === config.httpsAgent) { + delete config.httpsAgent; + } + } + __name(fixConfig, "fixConfig"); + function shouldRetry(currentState, error) { + return __awaiter2(this, void 0, void 0, function* () { + const { retries, retryCondition } = currentState; + const shouldRetryOrPromise = (currentState.retryCount || 0) < retries && retryCondition(error); + if (typeof shouldRetryOrPromise === "object") { + try { + const shouldRetryPromiseResult = yield shouldRetryOrPromise; + return shouldRetryPromiseResult !== false; + } catch (_err) { + return false; + } + } + return shouldRetryOrPromise; + }); + } + __name(shouldRetry, "shouldRetry"); + function handleRetry(axiosInstance, currentState, error, config) { + var _a; + return __awaiter2(this, void 0, void 0, function* () { + currentState.retryCount += 1; + const { retryDelay, shouldResetTimeout, onRetry } = currentState; + const delay = retryDelay(currentState.retryCount, error); + fixConfig(axiosInstance, config); + if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) { + const lastRequestDuration = Date.now() - currentState.lastRequestTime; + const timeout = config.timeout - lastRequestDuration - delay; + if (timeout <= 0) { + return Promise.reject(error); + } + config.timeout = timeout; + } + config.transformRequest = [(data) => data]; + yield onRetry(currentState.retryCount, error, config); + if ((_a = config.signal) === null || _a === void 0 ? void 0 : _a.aborted) { + return Promise.resolve(axiosInstance(config)); + } + return new Promise((resolve, reject) => { + var _a2; + const timeout = setTimeout(() => resolve(axiosInstance(config)), delay); + if ((_a2 = config.signal) === null || _a2 === void 0 ? void 0 : _a2.addEventListener) { + config.signal.addEventListener("abort", () => { + clearTimeout(timeout); + resolve(axiosInstance(config)); + }, { once: true }); + } + }); + }); + } + __name(handleRetry, "handleRetry"); + function handleMaxRetryTimesExceeded(currentState, error) { + return __awaiter2(this, void 0, void 0, function* () { + if (currentState.retryCount >= currentState.retries) + yield currentState.onMaxRetryTimesExceeded(error, currentState.retryCount); + }); + } + __name(handleMaxRetryTimesExceeded, "handleMaxRetryTimesExceeded"); + var axiosRetry = /* @__PURE__ */ __name((axiosInstance, defaultOptions) => { + const requestInterceptorId = axiosInstance.interceptors.request.use((config) => { + var _a; + setCurrentState(config, defaultOptions); + if ((_a = config[exports2.namespace]) === null || _a === void 0 ? void 0 : _a.validateResponse) { + config.validateStatus = () => false; + } + return config; + }); + const responseInterceptorId = axiosInstance.interceptors.response.use(null, (error) => __awaiter2(void 0, void 0, void 0, function* () { + var _a; + const { config } = error; + if (!config) { + return Promise.reject(error); + } + const currentState = setCurrentState(config, defaultOptions); + if (error.response && ((_a = currentState.validateResponse) === null || _a === void 0 ? void 0 : _a.call(currentState, error.response))) { + return error.response; + } + if (yield shouldRetry(currentState, error)) { + return handleRetry(axiosInstance, currentState, error, config); + } + yield handleMaxRetryTimesExceeded(currentState, error); + return Promise.reject(error); + })); + return { requestInterceptorId, responseInterceptorId }; + }, "axiosRetry"); + axiosRetry.isNetworkError = isNetworkError; + axiosRetry.isSafeRequestError = isSafeRequestError; + axiosRetry.isIdempotentRequestError = isIdempotentRequestError; + axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError; + axiosRetry.exponentialDelay = exponentialDelay; + axiosRetry.isRetryableError = isRetryableError; + exports2.default = axiosRetry; + } +}); + +// node_modules/axios/node_modules/form-data/lib/populate.js +var require_populate2 = __commonJS({ + "node_modules/axios/node_modules/form-data/lib/populate.js"(exports2, module2) { + module2.exports = function(dst, src) { + Object.keys(src).forEach(function(prop) { + dst[prop] = dst[prop] || src[prop]; + }); + return dst; + }; + } +}); + +// node_modules/axios/node_modules/form-data/lib/form_data.js +var require_form_data2 = __commonJS({ + "node_modules/axios/node_modules/form-data/lib/form_data.js"(exports2, module2) { + var CombinedStream = require_combined_stream(); + var util = require("util"); + var path2 = require("path"); + var http = require("http"); + var https = require("https"); + var parseUrl = require("url").parse; + var fs = require("fs"); + var Stream = require("stream").Stream; + var mime = require_mime_types(); + var asynckit = require_asynckit(); + var populate = require_populate2(); + module2.exports = FormData2; + util.inherits(FormData2, CombinedStream); + function FormData2(options) { + if (!(this instanceof FormData2)) { + return new FormData2(options); + } + this._overheadLength = 0; + this._valueLength = 0; + this._valuesToMeasure = []; + CombinedStream.call(this); + options = options || {}; + for (var option in options) { + this[option] = options[option]; + } + } + __name(FormData2, "FormData"); + FormData2.LINE_BREAK = "\r\n"; + FormData2.DEFAULT_CONTENT_TYPE = "application/octet-stream"; + FormData2.prototype.append = function(field, value, options) { + options = options || {}; + if (typeof options == "string") { + options = { filename: options }; + } + var append = CombinedStream.prototype.append.bind(this); + if (typeof value == "number") { + value = "" + value; + } + if (util.isArray(value)) { + this._error(new Error("Arrays are not supported.")); + return; + } + var header = this._multiPartHeader(field, value, options); + var footer = this._multiPartFooter(); + append(header); + append(value); + append(footer); + this._trackLength(header, value, options); + }; + FormData2.prototype._trackLength = function(header, value, options) { + var valueLength = 0; + if (options.knownLength != null) { + valueLength += +options.knownLength; + } else if (Buffer.isBuffer(value)) { + valueLength = value.length; + } else if (typeof value === "string") { + valueLength = Buffer.byteLength(value); + } + this._valueLength += valueLength; + this._overheadLength += Buffer.byteLength(header) + FormData2.LINE_BREAK.length; + if (!value || !value.path && !(value.readable && value.hasOwnProperty("httpVersion")) && !(value instanceof Stream)) { + return; + } + if (!options.knownLength) { + this._valuesToMeasure.push(value); + } + }; + FormData2.prototype._lengthRetriever = function(value, callback) { + if (value.hasOwnProperty("fd")) { + if (value.end != void 0 && value.end != Infinity && value.start != void 0) { + callback(null, value.end + 1 - (value.start ? value.start : 0)); + } else { + fs.stat(value.path, function(err, stat) { + var fileSize; + if (err) { + callback(err); + return; + } + fileSize = stat.size - (value.start ? value.start : 0); + callback(null, fileSize); + }); + } + } else if (value.hasOwnProperty("httpVersion")) { + callback(null, +value.headers["content-length"]); + } else if (value.hasOwnProperty("httpModule")) { + value.on("response", function(response) { + value.pause(); + callback(null, +response.headers["content-length"]); + }); + value.resume(); + } else { + callback("Unknown stream"); + } + }; + FormData2.prototype._multiPartHeader = function(field, value, options) { + if (typeof options.header == "string") { + return options.header; + } + var contentDisposition = this._getContentDisposition(value, options); + var contentType = this._getContentType(value, options); + var contents = ""; + var headers = { + // add custom disposition as third element or keep it two elements if not + "Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []), + // if no content type. allow it to be empty array + "Content-Type": [].concat(contentType || []) + }; + if (typeof options.header == "object") { + populate(headers, options.header); + } + var header; + for (var prop in headers) { + if (!headers.hasOwnProperty(prop)) + continue; + header = headers[prop]; + if (header == null) { + continue; + } + if (!Array.isArray(header)) { + header = [header]; + } + if (header.length) { + contents += prop + ": " + header.join("; ") + FormData2.LINE_BREAK; + } + } + return "--" + this.getBoundary() + FormData2.LINE_BREAK + contents + FormData2.LINE_BREAK; + }; + FormData2.prototype._getContentDisposition = function(value, options) { + var filename, contentDisposition; + if (typeof options.filepath === "string") { + filename = path2.normalize(options.filepath).replace(/\\/g, "/"); + } else if (options.filename || value.name || value.path) { + filename = path2.basename(options.filename || value.name || value.path); + } else if (value.readable && value.hasOwnProperty("httpVersion")) { + filename = path2.basename(value.client._httpMessage.path || ""); + } + if (filename) { + contentDisposition = 'filename="' + filename + '"'; + } + return contentDisposition; + }; + FormData2.prototype._getContentType = function(value, options) { + var contentType = options.contentType; + if (!contentType && value.name) { + contentType = mime.lookup(value.name); + } + if (!contentType && value.path) { + contentType = mime.lookup(value.path); + } + if (!contentType && value.readable && value.hasOwnProperty("httpVersion")) { + contentType = value.headers["content-type"]; + } + if (!contentType && (options.filepath || options.filename)) { + contentType = mime.lookup(options.filepath || options.filename); + } + if (!contentType && typeof value == "object") { + contentType = FormData2.DEFAULT_CONTENT_TYPE; + } + return contentType; + }; + FormData2.prototype._multiPartFooter = function() { + return function(next) { + var footer = FormData2.LINE_BREAK; + var lastPart = this._streams.length === 0; + if (lastPart) { + footer += this._lastBoundary(); + } + next(footer); + }.bind(this); + }; + FormData2.prototype._lastBoundary = function() { + return "--" + this.getBoundary() + "--" + FormData2.LINE_BREAK; + }; + FormData2.prototype.getHeaders = function(userHeaders) { + var header; + var formHeaders = { + "content-type": "multipart/form-data; boundary=" + this.getBoundary() + }; + for (header in userHeaders) { + if (userHeaders.hasOwnProperty(header)) { + formHeaders[header.toLowerCase()] = userHeaders[header]; + } + } + return formHeaders; + }; + FormData2.prototype.setBoundary = function(boundary) { + this._boundary = boundary; + }; + FormData2.prototype.getBoundary = function() { + if (!this._boundary) { + this._generateBoundary(); + } + return this._boundary; + }; + FormData2.prototype.getBuffer = function() { + var dataBuffer = new Buffer.alloc(0); + var boundary = this.getBoundary(); + for (var i = 0, len = this._streams.length; i < len; i++) { + if (typeof this._streams[i] !== "function") { + if (Buffer.isBuffer(this._streams[i])) { + dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]); + } else { + dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]); + } + if (typeof this._streams[i] !== "string" || this._streams[i].substring(2, boundary.length + 2) !== boundary) { + dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData2.LINE_BREAK)]); + } + } + } + return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]); + }; + FormData2.prototype._generateBoundary = function() { + var boundary = "--------------------------"; + for (var i = 0; i < 24; i++) { + boundary += Math.floor(Math.random() * 10).toString(16); + } + this._boundary = boundary; + }; + FormData2.prototype.getLengthSync = function() { + var knownLength = this._overheadLength + this._valueLength; + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + if (!this.hasKnownLength()) { + this._error(new Error("Cannot calculate proper length in synchronous way.")); + } + return knownLength; + }; + FormData2.prototype.hasKnownLength = function() { + var hasKnownLength = true; + if (this._valuesToMeasure.length) { + hasKnownLength = false; + } + return hasKnownLength; + }; + FormData2.prototype.getLength = function(cb) { + var knownLength = this._overheadLength + this._valueLength; + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + if (!this._valuesToMeasure.length) { + process.nextTick(cb.bind(this, null, knownLength)); + return; + } + asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) { + if (err) { + cb(err); + return; + } + values.forEach(function(length) { + knownLength += length; + }); + cb(null, knownLength); + }); + }; + FormData2.prototype.submit = function(params, cb) { + var request, options, defaults = { method: "post" }; + if (typeof params == "string") { + params = parseUrl(params); + options = populate({ + port: params.port, + path: params.pathname, + host: params.hostname, + protocol: params.protocol + }, defaults); + } else { + options = populate(params, defaults); + if (!options.port) { + options.port = options.protocol == "https:" ? 443 : 80; + } + } + options.headers = this.getHeaders(params.headers); + if (options.protocol == "https:") { + request = https.request(options); + } else { + request = http.request(options); + } + this.getLength(function(err, length) { + if (err && err !== "Unknown stream") { + this._error(err); + return; + } + if (length) { + request.setHeader("Content-Length", length); + } + this.pipe(request); + if (cb) { + var onResponse; + var callback = /* @__PURE__ */ __name(function(error, responce) { + request.removeListener("error", callback); + request.removeListener("response", onResponse); + return cb.call(this, error, responce); + }, "callback"); + onResponse = callback.bind(this, null); + request.on("error", callback); + request.on("response", onResponse); + } + }.bind(this)); + return request; + }; + FormData2.prototype._error = function(err) { + if (!this.error) { + this.error = err; + this.pause(); + this.emit("error", err); + } + }; + FormData2.prototype.toString = function() { + return "[object FormData]"; + }; + } +}); + +// node_modules/proxy-from-env/index.js +var require_proxy_from_env = __commonJS({ + "node_modules/proxy-from-env/index.js"(exports2) { + "use strict"; + var parseUrl = require("url").parse; + var DEFAULT_PORTS = { + ftp: 21, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443 + }; + var stringEndsWith = String.prototype.endsWith || function(s) { + return s.length <= this.length && this.indexOf(s, this.length - s.length) !== -1; + }; + function getProxyForUrl(url) { + var parsedUrl = typeof url === "string" ? parseUrl(url) : url || {}; + var proto = parsedUrl.protocol; + var hostname = parsedUrl.host; + var port = parsedUrl.port; + if (typeof hostname !== "string" || !hostname || typeof proto !== "string") { + return ""; + } + proto = proto.split(":", 1)[0]; + hostname = hostname.replace(/:\d*$/, ""); + port = parseInt(port) || DEFAULT_PORTS[proto] || 0; + if (!shouldProxy(hostname, port)) { + return ""; + } + var proxy = getEnv("npm_config_" + proto + "_proxy") || getEnv(proto + "_proxy") || getEnv("npm_config_proxy") || getEnv("all_proxy"); + if (proxy && proxy.indexOf("://") === -1) { + proxy = proto + "://" + proxy; + } + return proxy; + } + __name(getProxyForUrl, "getProxyForUrl"); + function shouldProxy(hostname, port) { + var NO_PROXY = (getEnv("npm_config_no_proxy") || getEnv("no_proxy")).toLowerCase(); + if (!NO_PROXY) { + return true; + } + if (NO_PROXY === "*") { + return false; + } + return NO_PROXY.split(/[,\s]/).every(function(proxy) { + if (!proxy) { + return true; + } + var parsedProxy = proxy.match(/^(.+):(\d+)$/); + var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy; + var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0; + if (parsedProxyPort && parsedProxyPort !== port) { + return true; + } + if (!/^[.*]/.test(parsedProxyHostname)) { + return hostname !== parsedProxyHostname; + } + if (parsedProxyHostname.charAt(0) === "*") { + parsedProxyHostname = parsedProxyHostname.slice(1); + } + return !stringEndsWith.call(hostname, parsedProxyHostname); + }); + } + __name(shouldProxy, "shouldProxy"); + function getEnv(key) { + return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || ""; + } + __name(getEnv, "getEnv"); + exports2.getProxyForUrl = getProxyForUrl; + } +}); + +// node_modules/ms/index.js +var require_ms = __commonJS({ + "node_modules/ms/index.js"(exports2, module2) { + var s = 1e3; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + module2.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === "string" && val.length > 0) { + return parse3(val); + } else if (type === "number" && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) + ); + }; + function parse3(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || "ms").toLowerCase(); + switch (type) { + case "years": + case "year": + case "yrs": + case "yr": + case "y": + return n * y; + case "weeks": + case "week": + case "w": + return n * w; + case "days": + case "day": + case "d": + return n * d; + case "hours": + case "hour": + case "hrs": + case "hr": + case "h": + return n * h; + case "minutes": + case "minute": + case "mins": + case "min": + case "m": + return n * m; + case "seconds": + case "second": + case "secs": + case "sec": + case "s": + return n * s; + case "milliseconds": + case "millisecond": + case "msecs": + case "msec": + case "ms": + return n; + default: + return void 0; + } + } + __name(parse3, "parse"); + function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + "d"; + } + if (msAbs >= h) { + return Math.round(ms / h) + "h"; + } + if (msAbs >= m) { + return Math.round(ms / m) + "m"; + } + if (msAbs >= s) { + return Math.round(ms / s) + "s"; + } + return ms + "ms"; + } + __name(fmtShort, "fmtShort"); + function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, "day"); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, "hour"); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, "minute"); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, "second"); + } + return ms + " ms"; + } + __name(fmtLong, "fmtLong"); + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + " " + name + (isPlural ? "s" : ""); + } + __name(plural, "plural"); + } +}); + +// node_modules/debug/src/common.js +var require_common = __commonJS({ + "node_modules/debug/src/common.js"(exports2, module2) { + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require_ms(); + createDebug.destroy = destroy; + Object.keys(env).forEach((key) => { + createDebug[key] = env[key]; + }); + createDebug.names = []; + createDebug.skips = []; + createDebug.formatters = {}; + function selectColor(namespace) { + let hash = 0; + for (let i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; + } + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + __name(selectColor, "selectColor"); + createDebug.selectColor = selectColor; + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + function debug(...args) { + if (!debug.enabled) { + return; + } + const self2 = debug; + const curr = Number(/* @__PURE__ */ new Date()); + const ms = curr - (prevTime || curr); + self2.diff = ms; + self2.prev = prevTime; + self2.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + if (typeof args[0] !== "string") { + args.unshift("%O"); + } + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + if (match === "%%") { + return "%"; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === "function") { + const val = args[index]; + match = formatter.call(self2, val); + args.splice(index, 1); + index--; + } + return match; + }); + createDebug.formatArgs.call(self2, args); + const logFn = self2.log || createDebug.log; + logFn.apply(self2, args); + } + __name(debug, "debug"); + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; + Object.defineProperty(debug, "enabled", { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + return enabledCache; + }, + set: (v) => { + enableOverride = v; + } + }); + if (typeof createDebug.init === "function") { + createDebug.init(debug); + } + return debug; + } + __name(createDebug, "createDebug"); + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + __name(extend, "extend"); + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + createDebug.names = []; + createDebug.skips = []; + let i; + const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); + const len = split.length; + for (i = 0; i < len; i++) { + if (!split[i]) { + continue; + } + namespaces = split[i].replace(/\*/g, ".*?"); + if (namespaces[0] === "-") { + createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$")); + } else { + createDebug.names.push(new RegExp("^" + namespaces + "$")); + } + } + } + __name(enable, "enable"); + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace) + ].join(","); + createDebug.enable(""); + return namespaces; + } + __name(disable, "disable"); + function enabled(name) { + if (name[name.length - 1] === "*") { + return true; + } + let i; + let len; + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + return false; + } + __name(enabled, "enabled"); + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*"); + } + __name(toNamespace, "toNamespace"); + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + __name(coerce, "coerce"); + function destroy() { + console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); + } + __name(destroy, "destroy"); + createDebug.enable(createDebug.load()); + return createDebug; + } + __name(setup, "setup"); + module2.exports = setup; + } +}); + +// node_modules/debug/src/browser.js +var require_browser = __commonJS({ + "node_modules/debug/src/browser.js"(exports2, module2) { + exports2.formatArgs = formatArgs; + exports2.save = save; + exports2.load = load; + exports2.useColors = useColors; + exports2.storage = localstorage(); + exports2.destroy = /* @__PURE__ */ (() => { + let warned = false; + return () => { + if (!warned) { + warned = true; + console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); + } + }; + })(); + exports2.colors = [ + "#0000CC", + "#0000FF", + "#0033CC", + "#0033FF", + "#0066CC", + "#0066FF", + "#0099CC", + "#0099FF", + "#00CC00", + "#00CC33", + "#00CC66", + "#00CC99", + "#00CCCC", + "#00CCFF", + "#3300CC", + "#3300FF", + "#3333CC", + "#3333FF", + "#3366CC", + "#3366FF", + "#3399CC", + "#3399FF", + "#33CC00", + "#33CC33", + "#33CC66", + "#33CC99", + "#33CCCC", + "#33CCFF", + "#6600CC", + "#6600FF", + "#6633CC", + "#6633FF", + "#66CC00", + "#66CC33", + "#9900CC", + "#9900FF", + "#9933CC", + "#9933FF", + "#99CC00", + "#99CC33", + "#CC0000", + "#CC0033", + "#CC0066", + "#CC0099", + "#CC00CC", + "#CC00FF", + "#CC3300", + "#CC3333", + "#CC3366", + "#CC3399", + "#CC33CC", + "#CC33FF", + "#CC6600", + "#CC6633", + "#CC9900", + "#CC9933", + "#CCCC00", + "#CCCC33", + "#FF0000", + "#FF0033", + "#FF0066", + "#FF0099", + "#FF00CC", + "#FF00FF", + "#FF3300", + "#FF3333", + "#FF3366", + "#FF3399", + "#FF33CC", + "#FF33FF", + "#FF6600", + "#FF6633", + "#FF9900", + "#FF9933", + "#FFCC00", + "#FFCC33" + ]; + function useColors() { + if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { + return true; + } + if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + __name(useColors, "useColors"); + function formatArgs(args) { + args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff); + if (!this.useColors) { + return; + } + const c = "color: " + this.color; + args.splice(1, 0, c, "color: inherit"); + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, (match) => { + if (match === "%%") { + return; + } + index++; + if (match === "%c") { + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + __name(formatArgs, "formatArgs"); + exports2.log = console.debug || console.log || (() => { + }); + function save(namespaces) { + try { + if (namespaces) { + exports2.storage.setItem("debug", namespaces); + } else { + exports2.storage.removeItem("debug"); + } + } catch (error) { + } + } + __name(save, "save"); + function load() { + let r; + try { + r = exports2.storage.getItem("debug"); + } catch (error) { + } + if (!r && typeof process !== "undefined" && "env" in process) { + r = process.env.DEBUG; + } + return r; + } + __name(load, "load"); + function localstorage() { + try { + return localStorage; + } catch (error) { + } + } + __name(localstorage, "localstorage"); + module2.exports = require_common()(exports2); + var { formatters } = module2.exports; + formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (error) { + return "[UnexpectedJSONParseError]: " + error.message; + } + }; + } +}); + +// node_modules/has-flag/index.js +var require_has_flag = __commonJS({ + "node_modules/has-flag/index.js"(exports2, module2) { + "use strict"; + module2.exports = (flag, argv = process.argv) => { + const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--"; + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf("--"); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); + }; + } +}); + +// node_modules/supports-color/index.js +var require_supports_color = __commonJS({ + "node_modules/supports-color/index.js"(exports2, module2) { + "use strict"; + var os2 = require("os"); + var tty = require("tty"); + var hasFlag = require_has_flag(); + var { env } = process; + var forceColor; + if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) { + forceColor = 0; + } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) { + forceColor = 1; + } + if ("FORCE_COLOR" in env) { + if (env.FORCE_COLOR === "true") { + forceColor = 1; + } else if (env.FORCE_COLOR === "false") { + forceColor = 0; + } else { + forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); + } + } + function translateLevel(level) { + if (level === 0) { + return false; + } + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; + } + __name(translateLevel, "translateLevel"); + function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { + return 0; + } + if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) { + return 3; + } + if (hasFlag("color=256")) { + return 2; + } + if (haveStream && !streamIsTTY && forceColor === void 0) { + return 0; + } + const min = forceColor || 0; + if (env.TERM === "dumb") { + return min; + } + if (process.platform === "win32") { + const osRelease = os2.release().split("."); + if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + return 1; + } + if ("CI" in env) { + if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") { + return 1; + } + return min; + } + if ("TEAMCITY_VERSION" in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + if (env.COLORTERM === "truecolor") { + return 3; + } + if ("TERM_PROGRAM" in env) { + const version3 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10); + switch (env.TERM_PROGRAM) { + case "iTerm.app": + return version3 >= 3 ? 3 : 2; + case "Apple_Terminal": + return 2; + } + } + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + if ("COLORTERM" in env) { + return 1; + } + return min; + } + __name(supportsColor, "supportsColor"); + function getSupportLevel(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); + } + __name(getSupportLevel, "getSupportLevel"); + module2.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) + }; + } +}); + +// node_modules/debug/src/node.js +var require_node = __commonJS({ + "node_modules/debug/src/node.js"(exports2, module2) { + var tty = require("tty"); + var util = require("util"); + exports2.init = init; + exports2.log = log; + exports2.formatArgs = formatArgs; + exports2.save = save; + exports2.load = load; + exports2.useColors = useColors; + exports2.destroy = util.deprecate( + () => { + }, + "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`." + ); + exports2.colors = [6, 2, 3, 4, 5, 1]; + try { + const supportsColor = require_supports_color(); + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports2.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } + } catch (error) { + } + exports2.inspectOpts = Object.keys(process.env).filter((key) => { + return /^debug_/i.test(key); + }).reduce((obj, key) => { + const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === "null") { + val = null; + } else { + val = Number(val); + } + obj[prop] = val; + return obj; + }, {}); + function useColors() { + return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(process.stderr.fd); + } + __name(useColors, "useColors"); + function formatArgs(args) { + const { namespace: name, useColors: useColors2 } = this; + if (useColors2) { + const c = this.color; + const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c); + const prefix = ` ${colorCode};1m${name} \x1B[0m`; + args[0] = prefix + args[0].split("\n").join("\n" + prefix); + args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m"); + } else { + args[0] = getDate() + name + " " + args[0]; + } + } + __name(formatArgs, "formatArgs"); + function getDate() { + if (exports2.inspectOpts.hideDate) { + return ""; + } + return (/* @__PURE__ */ new Date()).toISOString() + " "; + } + __name(getDate, "getDate"); + function log(...args) { + return process.stderr.write(util.format(...args) + "\n"); + } + __name(log, "log"); + function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + delete process.env.DEBUG; + } + } + __name(save, "save"); + function load() { + return process.env.DEBUG; + } + __name(load, "load"); + function init(debug) { + debug.inspectOpts = {}; + const keys = Object.keys(exports2.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]]; + } + } + __name(init, "init"); + module2.exports = require_common()(exports2); + var { formatters } = module2.exports; + formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" "); + }; + formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); + }; + } +}); + +// node_modules/debug/src/index.js +var require_src = __commonJS({ + "node_modules/debug/src/index.js"(exports2, module2) { + if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) { + module2.exports = require_browser(); + } else { + module2.exports = require_node(); + } + } +}); + +// node_modules/follow-redirects/debug.js +var require_debug2 = __commonJS({ + "node_modules/follow-redirects/debug.js"(exports2, module2) { + var debug; + module2.exports = function() { + if (!debug) { + try { + debug = require_src()("follow-redirects"); + } catch (error) { + } + if (typeof debug !== "function") { + debug = /* @__PURE__ */ __name(function() { + }, "debug"); + } + } + debug.apply(null, arguments); + }; + } +}); + +// node_modules/follow-redirects/index.js +var require_follow_redirects = __commonJS({ + "node_modules/follow-redirects/index.js"(exports2, module2) { + var url = require("url"); + var URL4 = url.URL; + var http = require("http"); + var https = require("https"); + var Writable = require("stream").Writable; + var assert = require("assert"); + var debug = require_debug2(); + var useNativeURL = false; + try { + assert(new URL4()); + } catch (error) { + useNativeURL = error.code === "ERR_INVALID_URL"; + } + var preservedUrlFields = [ + "auth", + "host", + "hostname", + "href", + "path", + "pathname", + "port", + "protocol", + "query", + "search", + "hash" + ]; + var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; + var eventHandlers = /* @__PURE__ */ Object.create(null); + events.forEach(function(event) { + eventHandlers[event] = function(arg1, arg2, arg3) { + this._redirectable.emit(event, arg1, arg2, arg3); + }; + }); + var InvalidUrlError = createErrorType( + "ERR_INVALID_URL", + "Invalid URL", + TypeError + ); + var RedirectionError = createErrorType( + "ERR_FR_REDIRECTION_FAILURE", + "Redirected request failed" + ); + var TooManyRedirectsError = createErrorType( + "ERR_FR_TOO_MANY_REDIRECTS", + "Maximum number of redirects exceeded", + RedirectionError + ); + var MaxBodyLengthExceededError = createErrorType( + "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", + "Request body larger than maxBodyLength limit" + ); + var WriteAfterEndError = createErrorType( + "ERR_STREAM_WRITE_AFTER_END", + "write after end" + ); + var destroy = Writable.prototype.destroy || noop; + function RedirectableRequest(options, responseCallback) { + Writable.call(this); + this._sanitizeOptions(options); + this._options = options; + this._ended = false; + this._ending = false; + this._redirectCount = 0; + this._redirects = []; + this._requestBodyLength = 0; + this._requestBodyBuffers = []; + if (responseCallback) { + this.on("response", responseCallback); + } + var self2 = this; + this._onNativeResponse = function(response) { + try { + self2._processResponse(response); + } catch (cause) { + self2.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause })); + } + }; + this._performRequest(); + } + __name(RedirectableRequest, "RedirectableRequest"); + RedirectableRequest.prototype = Object.create(Writable.prototype); + RedirectableRequest.prototype.abort = function() { + destroyRequest(this._currentRequest); + this._currentRequest.abort(); + this.emit("abort"); + }; + RedirectableRequest.prototype.destroy = function(error) { + destroyRequest(this._currentRequest, error); + destroy.call(this, error); + return this; + }; + RedirectableRequest.prototype.write = function(data, encoding, callback) { + if (this._ending) { + throw new WriteAfterEndError(); + } + if (!isString(data) && !isBuffer(data)) { + throw new TypeError("data should be a string, Buffer or Uint8Array"); + } + if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + if (data.length === 0) { + if (callback) { + callback(); + } + return; + } + if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { + this._requestBodyLength += data.length; + this._requestBodyBuffers.push({ data, encoding }); + this._currentRequest.write(data, encoding, callback); + } else { + this.emit("error", new MaxBodyLengthExceededError()); + this.abort(); + } + }; + RedirectableRequest.prototype.end = function(data, encoding, callback) { + if (isFunction(data)) { + callback = data; + data = encoding = null; + } else if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + if (!data) { + this._ended = this._ending = true; + this._currentRequest.end(null, null, callback); + } else { + var self2 = this; + var currentRequest = this._currentRequest; + this.write(data, encoding, function() { + self2._ended = true; + currentRequest.end(null, null, callback); + }); + this._ending = true; + } + }; + RedirectableRequest.prototype.setHeader = function(name, value) { + this._options.headers[name] = value; + this._currentRequest.setHeader(name, value); + }; + RedirectableRequest.prototype.removeHeader = function(name) { + delete this._options.headers[name]; + this._currentRequest.removeHeader(name); + }; + RedirectableRequest.prototype.setTimeout = function(msecs, callback) { + var self2 = this; + function destroyOnTimeout(socket) { + socket.setTimeout(msecs); + socket.removeListener("timeout", socket.destroy); + socket.addListener("timeout", socket.destroy); + } + __name(destroyOnTimeout, "destroyOnTimeout"); + function startTimer(socket) { + if (self2._timeout) { + clearTimeout(self2._timeout); + } + self2._timeout = setTimeout(function() { + self2.emit("timeout"); + clearTimer(); + }, msecs); + destroyOnTimeout(socket); + } + __name(startTimer, "startTimer"); + function clearTimer() { + if (self2._timeout) { + clearTimeout(self2._timeout); + self2._timeout = null; + } + self2.removeListener("abort", clearTimer); + self2.removeListener("error", clearTimer); + self2.removeListener("response", clearTimer); + self2.removeListener("close", clearTimer); + if (callback) { + self2.removeListener("timeout", callback); + } + if (!self2.socket) { + self2._currentRequest.removeListener("socket", startTimer); + } + } + __name(clearTimer, "clearTimer"); + if (callback) { + this.on("timeout", callback); + } + if (this.socket) { + startTimer(this.socket); + } else { + this._currentRequest.once("socket", startTimer); + } + this.on("socket", destroyOnTimeout); + this.on("abort", clearTimer); + this.on("error", clearTimer); + this.on("response", clearTimer); + this.on("close", clearTimer); + return this; + }; + [ + "flushHeaders", + "getHeader", + "setNoDelay", + "setSocketKeepAlive" + ].forEach(function(method) { + RedirectableRequest.prototype[method] = function(a, b) { + return this._currentRequest[method](a, b); + }; + }); + ["aborted", "connection", "socket"].forEach(function(property) { + Object.defineProperty(RedirectableRequest.prototype, property, { + get: function() { + return this._currentRequest[property]; + } + }); + }); + RedirectableRequest.prototype._sanitizeOptions = function(options) { + if (!options.headers) { + options.headers = {}; + } + if (options.host) { + if (!options.hostname) { + options.hostname = options.host; + } + delete options.host; + } + if (!options.pathname && options.path) { + var searchPos = options.path.indexOf("?"); + if (searchPos < 0) { + options.pathname = options.path; + } else { + options.pathname = options.path.substring(0, searchPos); + options.search = options.path.substring(searchPos); + } + } + }; + RedirectableRequest.prototype._performRequest = function() { + var protocol = this._options.protocol; + var nativeProtocol = this._options.nativeProtocols[protocol]; + if (!nativeProtocol) { + throw new TypeError("Unsupported protocol " + protocol); + } + if (this._options.agents) { + var scheme = protocol.slice(0, -1); + this._options.agent = this._options.agents[scheme]; + } + var request = this._currentRequest = nativeProtocol.request(this._options, this._onNativeResponse); + request._redirectable = this; + for (var event of events) { + request.on(event, eventHandlers[event]); + } + this._currentUrl = /^\//.test(this._options.path) ? url.format(this._options) : ( + // When making a request to a proxy, […] + // a client MUST send the target URI in absolute-form […]. + this._options.path + ); + if (this._isRedirect) { + var i = 0; + var self2 = this; + var buffers = this._requestBodyBuffers; + (/* @__PURE__ */ __name(function writeNext(error) { + if (request === self2._currentRequest) { + if (error) { + self2.emit("error", error); + } else if (i < buffers.length) { + var buffer = buffers[i++]; + if (!request.finished) { + request.write(buffer.data, buffer.encoding, writeNext); + } + } else if (self2._ended) { + request.end(); + } + } + }, "writeNext"))(); + } + }; + RedirectableRequest.prototype._processResponse = function(response) { + var statusCode = response.statusCode; + if (this._options.trackRedirects) { + this._redirects.push({ + url: this._currentUrl, + headers: response.headers, + statusCode + }); + } + var location = response.headers.location; + if (!location || this._options.followRedirects === false || statusCode < 300 || statusCode >= 400) { + response.responseUrl = this._currentUrl; + response.redirects = this._redirects; + this.emit("response", response); + this._requestBodyBuffers = []; + return; + } + destroyRequest(this._currentRequest); + response.destroy(); + if (++this._redirectCount > this._options.maxRedirects) { + throw new TooManyRedirectsError(); + } + var requestHeaders; + var beforeRedirect = this._options.beforeRedirect; + if (beforeRedirect) { + requestHeaders = Object.assign({ + // The Host header was set by nativeProtocol.request + Host: response.req.getHeader("host") + }, this._options.headers); + } + var method = this._options.method; + if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || // RFC7231§6.4.4: The 303 (See Other) status code indicates that + // the server is redirecting the user agent to a different resource […] + // A user agent can perform a retrieval request targeting that URI + // (a GET or HEAD request if using HTTP) […] + statusCode === 303 && !/^(?:GET|HEAD)$/.test(this._options.method)) { + this._options.method = "GET"; + this._requestBodyBuffers = []; + removeMatchingHeaders(/^content-/i, this._options.headers); + } + var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers); + var currentUrlParts = parseUrl(this._currentUrl); + var currentHost = currentHostHeader || currentUrlParts.host; + var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url.format(Object.assign(currentUrlParts, { host: currentHost })); + var redirectUrl = resolveUrl(location, currentUrl); + debug("redirecting to", redirectUrl.href); + this._isRedirect = true; + spreadUrlObject(redirectUrl, this._options); + if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) { + removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers); + } + if (isFunction(beforeRedirect)) { + var responseDetails = { + headers: response.headers, + statusCode + }; + var requestDetails = { + url: currentUrl, + method, + headers: requestHeaders + }; + beforeRedirect(this._options, responseDetails, requestDetails); + this._sanitizeOptions(this._options); + } + this._performRequest(); + }; + function wrap(protocols) { + var exports3 = { + maxRedirects: 21, + maxBodyLength: 10 * 1024 * 1024 + }; + var nativeProtocols = {}; + Object.keys(protocols).forEach(function(scheme) { + var protocol = scheme + ":"; + var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; + var wrappedProtocol = exports3[scheme] = Object.create(nativeProtocol); + function request(input, options, callback) { + if (isURL(input)) { + input = spreadUrlObject(input); + } else if (isString(input)) { + input = spreadUrlObject(parseUrl(input)); + } else { + callback = options; + options = validateUrl(input); + input = { protocol }; + } + if (isFunction(options)) { + callback = options; + options = null; + } + options = Object.assign({ + maxRedirects: exports3.maxRedirects, + maxBodyLength: exports3.maxBodyLength + }, input, options); + options.nativeProtocols = nativeProtocols; + if (!isString(options.host) && !isString(options.hostname)) { + options.hostname = "::1"; + } + assert.equal(options.protocol, protocol, "protocol mismatch"); + debug("options", options); + return new RedirectableRequest(options, callback); + } + __name(request, "request"); + function get(input, options, callback) { + var wrappedRequest = wrappedProtocol.request(input, options, callback); + wrappedRequest.end(); + return wrappedRequest; + } + __name(get, "get"); + Object.defineProperties(wrappedProtocol, { + request: { value: request, configurable: true, enumerable: true, writable: true }, + get: { value: get, configurable: true, enumerable: true, writable: true } + }); + }); + return exports3; + } + __name(wrap, "wrap"); + function noop() { + } + __name(noop, "noop"); + function parseUrl(input) { + var parsed; + if (useNativeURL) { + parsed = new URL4(input); + } else { + parsed = validateUrl(url.parse(input)); + if (!isString(parsed.protocol)) { + throw new InvalidUrlError({ input }); + } + } + return parsed; + } + __name(parseUrl, "parseUrl"); + function resolveUrl(relative, base) { + return useNativeURL ? new URL4(relative, base) : parseUrl(url.resolve(base, relative)); + } + __name(resolveUrl, "resolveUrl"); + function validateUrl(input) { + if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) { + throw new InvalidUrlError({ input: input.href || input }); + } + if (/^\[/.test(input.host) && !/^\[[:0-9a-f]+\](:\d+)?$/i.test(input.host)) { + throw new InvalidUrlError({ input: input.href || input }); + } + return input; + } + __name(validateUrl, "validateUrl"); + function spreadUrlObject(urlObject, target) { + var spread = target || {}; + for (var key of preservedUrlFields) { + spread[key] = urlObject[key]; + } + if (spread.hostname.startsWith("[")) { + spread.hostname = spread.hostname.slice(1, -1); + } + if (spread.port !== "") { + spread.port = Number(spread.port); + } + spread.path = spread.search ? spread.pathname + spread.search : spread.pathname; + return spread; + } + __name(spreadUrlObject, "spreadUrlObject"); + function removeMatchingHeaders(regex, headers) { + var lastValue; + for (var header in headers) { + if (regex.test(header)) { + lastValue = headers[header]; + delete headers[header]; + } + } + return lastValue === null || typeof lastValue === "undefined" ? void 0 : String(lastValue).trim(); + } + __name(removeMatchingHeaders, "removeMatchingHeaders"); + function createErrorType(code, message, baseClass) { + function CustomError(properties) { + Error.captureStackTrace(this, this.constructor); + Object.assign(this, properties || {}); + this.code = code; + this.message = this.cause ? message + ": " + this.cause.message : message; + } + __name(CustomError, "CustomError"); + CustomError.prototype = new (baseClass || Error)(); + Object.defineProperties(CustomError.prototype, { + constructor: { + value: CustomError, + enumerable: false + }, + name: { + value: "Error [" + code + "]", + enumerable: false + } + }); + return CustomError; + } + __name(createErrorType, "createErrorType"); + function destroyRequest(request, error) { + for (var event of events) { + request.removeListener(event, eventHandlers[event]); + } + request.on("error", noop); + request.destroy(error); + } + __name(destroyRequest, "destroyRequest"); + function isSubdomain(subdomain, domain) { + assert(isString(subdomain) && isString(domain)); + var dot = subdomain.length - domain.length - 1; + return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); + } + __name(isSubdomain, "isSubdomain"); + function isString(value) { + return typeof value === "string" || value instanceof String; + } + __name(isString, "isString"); + function isFunction(value) { + return typeof value === "function"; + } + __name(isFunction, "isFunction"); + function isBuffer(value) { + return typeof value === "object" && "length" in value; + } + __name(isBuffer, "isBuffer"); + function isURL(value) { + return URL4 && value instanceof URL4; + } + __name(isURL, "isURL"); + module2.exports = wrap({ http, https }); + module2.exports.wrap = wrap; + } +}); + +// node_modules/axios/dist/node/axios.cjs +var require_axios = __commonJS({ + "node_modules/axios/dist/node/axios.cjs"(exports2, module2) { + "use strict"; + var FormData$1 = require_form_data2(); + var url = require("url"); + var proxyFromEnv = require_proxy_from_env(); + var http = require("http"); + var https = require("https"); + var util = require("util"); + var followRedirects = require_follow_redirects(); + var zlib = require("zlib"); + var stream = require("stream"); + var events = require("events"); + function _interopDefaultLegacy(e) { + return e && typeof e === "object" && "default" in e ? e : { "default": e }; + } + __name(_interopDefaultLegacy, "_interopDefaultLegacy"); + var FormData__default = /* @__PURE__ */ _interopDefaultLegacy(FormData$1); + var url__default = /* @__PURE__ */ _interopDefaultLegacy(url); + var http__default = /* @__PURE__ */ _interopDefaultLegacy(http); + var https__default = /* @__PURE__ */ _interopDefaultLegacy(https); + var util__default = /* @__PURE__ */ _interopDefaultLegacy(util); + var followRedirects__default = /* @__PURE__ */ _interopDefaultLegacy(followRedirects); + var zlib__default = /* @__PURE__ */ _interopDefaultLegacy(zlib); + var stream__default = /* @__PURE__ */ _interopDefaultLegacy(stream); + function bind(fn, thisArg) { + return /* @__PURE__ */ __name(function wrap() { + return fn.apply(thisArg, arguments); + }, "wrap"); + } + __name(bind, "bind"); + var { toString } = Object.prototype; + var { getPrototypeOf } = Object; + var kindOf = /* @__PURE__ */ ((cache2) => (thing) => { + const str = toString.call(thing); + return cache2[str] || (cache2[str] = str.slice(8, -1).toLowerCase()); + })(/* @__PURE__ */ Object.create(null)); + var kindOfTest = /* @__PURE__ */ __name((type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type; + }, "kindOfTest"); + var typeOfTest = /* @__PURE__ */ __name((type) => (thing) => typeof thing === type, "typeOfTest"); + var { isArray } = Array; + var isUndefined = typeOfTest("undefined"); + function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); + } + __name(isBuffer, "isBuffer"); + var isArrayBuffer = kindOfTest("ArrayBuffer"); + function isArrayBufferView(val) { + let result; + if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { + result = ArrayBuffer.isView(val); + } else { + result = val && val.buffer && isArrayBuffer(val.buffer); + } + return result; + } + __name(isArrayBufferView, "isArrayBufferView"); + var isString = typeOfTest("string"); + var isFunction = typeOfTest("function"); + var isNumber = typeOfTest("number"); + var isObject = /* @__PURE__ */ __name((thing) => thing !== null && typeof thing === "object", "isObject"); + var isBoolean = /* @__PURE__ */ __name((thing) => thing === true || thing === false, "isBoolean"); + var isPlainObject = /* @__PURE__ */ __name((val) => { + if (kindOf(val) !== "object") { + return false; + } + const prototype2 = getPrototypeOf(val); + return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); + }, "isPlainObject"); + var isDate = kindOfTest("Date"); + var isFile = kindOfTest("File"); + var isBlob = kindOfTest("Blob"); + var isFileList = kindOfTest("FileList"); + var isStream = /* @__PURE__ */ __name((val) => isObject(val) && isFunction(val.pipe), "isStream"); + var isFormData = /* @__PURE__ */ __name((thing) => { + let kind; + return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance + kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]")); + }, "isFormData"); + var isURLSearchParams = kindOfTest("URLSearchParams"); + var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest); + var trim = /* @__PURE__ */ __name((str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), "trim"); + function forEach(obj, fn, { allOwnKeys = false } = {}) { + if (obj === null || typeof obj === "undefined") { + return; + } + let i; + let l; + if (typeof obj !== "object") { + obj = [obj]; + } + if (isArray(obj)) { + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } + } + __name(forEach, "forEach"); + function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; + } + __name(findKey, "findKey"); + var _global2 = (() => { + if (typeof globalThis !== "undefined") + return globalThis; + return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global; + })(); + var isContextDefined = /* @__PURE__ */ __name((context2) => !isUndefined(context2) && context2 !== _global2, "isContextDefined"); + function merge() { + const { caseless } = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = /* @__PURE__ */ __name((val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }, "assignValue"); + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; + } + __name(merge, "merge"); + var extend = /* @__PURE__ */ __name((a, b, thisArg, { allOwnKeys } = {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, { allOwnKeys }); + return a; + }, "extend"); + var stripBOM = /* @__PURE__ */ __name((content) => { + if (content.charCodeAt(0) === 65279) { + content = content.slice(1); + } + return content; + }, "stripBOM"); + var inherits = /* @__PURE__ */ __name((constructor, superConstructor, props, descriptors2) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors2); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, "super", { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); + }, "inherits"); + var toFlatObject = /* @__PURE__ */ __name((sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + destObj = destObj || {}; + if (sourceObj == null) + return destObj; + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + return destObj; + }, "toFlatObject"); + var endsWith = /* @__PURE__ */ __name((str, searchString, position) => { + str = String(str); + if (position === void 0 || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + }, "endsWith"); + var toArray = /* @__PURE__ */ __name((thing) => { + if (!thing) + return null; + if (isArray(thing)) + return thing; + let i = thing.length; + if (!isNumber(i)) + return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; + }, "toArray"); + var isTypedArray = /* @__PURE__ */ ((TypedArray) => { + return (thing) => { + return TypedArray && thing instanceof TypedArray; + }; + })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array)); + var forEachEntry = /* @__PURE__ */ __name((obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + const iterator = generator.call(obj); + let result; + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } + }, "forEachEntry"); + var matchAll = /* @__PURE__ */ __name((regExp, str) => { + let matches; + const arr = []; + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + return arr; + }, "matchAll"); + var isHTMLForm = kindOfTest("HTMLFormElement"); + var toCamelCase = /* @__PURE__ */ __name((str) => { + return str.toLowerCase().replace( + /[-_\s]([a-z\d])(\w*)/g, + /* @__PURE__ */ __name(function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + }, "replacer") + ); + }, "toCamelCase"); + var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype); + var isRegExp = kindOfTest("RegExp"); + var reduceDescriptors = /* @__PURE__ */ __name((obj, reducer) => { + const descriptors2 = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + forEach(descriptors2, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + Object.defineProperties(obj, reducedDescriptors); + }, "reduceDescriptors"); + var freezeMethods = /* @__PURE__ */ __name((obj) => { + reduceDescriptors(obj, (descriptor, name) => { + if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) { + return false; + } + const value = obj[name]; + if (!isFunction(value)) + return; + descriptor.enumerable = false; + if ("writable" in descriptor) { + descriptor.writable = false; + return; + } + if (!descriptor.set) { + descriptor.set = () => { + throw Error("Can not rewrite read-only method '" + name + "'"); + }; + } + }); + }, "freezeMethods"); + var toObjectSet = /* @__PURE__ */ __name((arrayOrString, delimiter) => { + const obj = {}; + const define = /* @__PURE__ */ __name((arr) => { + arr.forEach((value) => { + obj[value] = true; + }); + }, "define"); + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + return obj; + }, "toObjectSet"); + var noop = /* @__PURE__ */ __name(() => { + }, "noop"); + var toFiniteNumber = /* @__PURE__ */ __name((value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; + }, "toFiniteNumber"); + var ALPHA = "abcdefghijklmnopqrstuvwxyz"; + var DIGIT = "0123456789"; + var ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT + }; + var generateString = /* @__PURE__ */ __name((size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ""; + const { length } = alphabet; + while (size--) { + str += alphabet[Math.random() * length | 0]; + } + return str; + }, "generateString"); + function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]); + } + __name(isSpecCompliantForm, "isSpecCompliantForm"); + var toJSONObject = /* @__PURE__ */ __name((obj) => { + const stack = new Array(10); + const visit = /* @__PURE__ */ __name((source, i) => { + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + if (!("toJSON" in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + stack[i] = void 0; + return target; + } + } + return source; + }, "visit"); + return visit(obj, 0); + }, "toJSONObject"); + var isAsyncFn = kindOfTest("AsyncFunction"); + var isThenable = /* @__PURE__ */ __name((thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch), "isThenable"); + var utils$1 = { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, + // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global2, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable + }; + function AxiosError(message, code, config, request, response) { + Error.call(this); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = new Error().stack; + } + this.message = message; + this.name = "AxiosError"; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); + } + __name(AxiosError, "AxiosError"); + utils$1.inherits(AxiosError, Error, { + toJSON: /* @__PURE__ */ __name(function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils$1.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + }, "toJSON") + }); + var prototype$1 = AxiosError.prototype; + var descriptors = {}; + [ + "ERR_BAD_OPTION_VALUE", + "ERR_BAD_OPTION", + "ECONNABORTED", + "ETIMEDOUT", + "ERR_NETWORK", + "ERR_FR_TOO_MANY_REDIRECTS", + "ERR_DEPRECATED", + "ERR_BAD_RESPONSE", + "ERR_BAD_REQUEST", + "ERR_CANCELED", + "ERR_NOT_SUPPORT", + "ERR_INVALID_URL" + // eslint-disable-next-line func-names + ].forEach((code) => { + descriptors[code] = { value: code }; + }); + Object.defineProperties(AxiosError, descriptors); + Object.defineProperty(prototype$1, "isAxiosError", { value: true }); + AxiosError.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype$1); + utils$1.toFlatObject(error, axiosError, /* @__PURE__ */ __name(function filter(obj) { + return obj !== Error.prototype; + }, "filter"), (prop) => { + return prop !== "isAxiosError"; + }); + AxiosError.call(axiosError, error.message, code, config, request, response); + axiosError.cause = error; + axiosError.name = error.name; + customProps && Object.assign(axiosError, customProps); + return axiosError; + }; + function isVisitable(thing) { + return utils$1.isPlainObject(thing) || utils$1.isArray(thing); + } + __name(isVisitable, "isVisitable"); + function removeBrackets(key) { + return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key; + } + __name(removeBrackets, "removeBrackets"); + function renderKey(path2, key, dots) { + if (!path2) + return key; + return path2.concat(key).map(/* @__PURE__ */ __name(function each(token, i) { + token = removeBrackets(token); + return !dots && i ? "[" + token + "]" : token; + }, "each")).join(dots ? "." : ""); + } + __name(renderKey, "renderKey"); + function isFlatArray(arr) { + return utils$1.isArray(arr) && !arr.some(isVisitable); + } + __name(isFlatArray, "isFlatArray"); + var predicates = utils$1.toFlatObject(utils$1, {}, null, /* @__PURE__ */ __name(function filter(prop) { + return /^is[A-Z]/.test(prop); + }, "filter")); + function toFormData(obj, formData, options) { + if (!utils$1.isObject(obj)) { + throw new TypeError("target must be an object"); + } + formData = formData || new (FormData__default["default"] || FormData)(); + options = utils$1.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, /* @__PURE__ */ __name(function defined(option, source) { + return !utils$1.isUndefined(source[option]); + }, "defined")); + const metaTokens = options.metaTokens; + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== "undefined" && Blob; + const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); + if (!utils$1.isFunction(visitor)) { + throw new TypeError("visitor must be a function"); + } + function convertValue(value) { + if (value === null) + return ""; + if (utils$1.isDate(value)) { + return value.toISOString(); + } + if (!useBlob && utils$1.isBlob(value)) { + throw new AxiosError("Blob is not supported. Use a Buffer instead."); + } + if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { + return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value); + } + return value; + } + __name(convertValue, "convertValue"); + function defaultVisitor(value, key, path2) { + let arr = value; + if (value && !path2 && typeof value === "object") { + if (utils$1.endsWith(key, "{}")) { + key = metaTokens ? key : key.slice(0, -2); + value = JSON.stringify(value); + } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) { + key = removeBrackets(key); + arr.forEach(/* @__PURE__ */ __name(function each(el, index) { + !(utils$1.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]", + convertValue(el) + ); + }, "each")); + return false; + } + } + if (isVisitable(value)) { + return true; + } + formData.append(renderKey(path2, key, dots), convertValue(value)); + return false; + } + __name(defaultVisitor, "defaultVisitor"); + const stack = []; + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + function build(value, path2) { + if (utils$1.isUndefined(value)) + return; + if (stack.indexOf(value) !== -1) { + throw Error("Circular reference detected in " + path2.join(".")); + } + stack.push(value); + utils$1.forEach(value, /* @__PURE__ */ __name(function each(el, key) { + const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( + formData, + el, + utils$1.isString(key) ? key.trim() : key, + path2, + exposedHelpers + ); + if (result === true) { + build(el, path2 ? path2.concat(key) : [key]); + } + }, "each")); + stack.pop(); + } + __name(build, "build"); + if (!utils$1.isObject(obj)) { + throw new TypeError("data must be an object"); + } + build(obj); + return formData; + } + __name(toFormData, "toFormData"); + function encode$1(str) { + const charMap = { + "!": "%21", + "'": "%27", + "(": "%28", + ")": "%29", + "~": "%7E", + "%20": "+", + "%00": "\0" + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, /* @__PURE__ */ __name(function replacer(match) { + return charMap[match]; + }, "replacer")); + } + __name(encode$1, "encode$1"); + function AxiosURLSearchParams(params, options) { + this._pairs = []; + params && toFormData(params, this, options); + } + __name(AxiosURLSearchParams, "AxiosURLSearchParams"); + var prototype = AxiosURLSearchParams.prototype; + prototype.append = /* @__PURE__ */ __name(function append(name, value) { + this._pairs.push([name, value]); + }, "append"); + prototype.toString = /* @__PURE__ */ __name(function toString2(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode$1); + } : encode$1; + return this._pairs.map(/* @__PURE__ */ __name(function each(pair) { + return _encode(pair[0]) + "=" + _encode(pair[1]); + }, "each"), "").join("&"); + }, "toString"); + function encode(val) { + return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); + } + __name(encode, "encode"); + function buildURL(url2, params, options) { + if (!params) { + return url2; + } + const _encode = options && options.encode || encode; + const serializeFn = options && options.serialize; + let serializedParams; + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode); + } + if (serializedParams) { + const hashmarkIndex = url2.indexOf("#"); + if (hashmarkIndex !== -1) { + url2 = url2.slice(0, hashmarkIndex); + } + url2 += (url2.indexOf("?") === -1 ? "?" : "&") + serializedParams; + } + return url2; + } + __name(buildURL, "buildURL"); + var InterceptorManager = class { + static { + __name(this, "InterceptorManager"); + } + constructor() { + this.handlers = []; + } + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils$1.forEach(this.handlers, /* @__PURE__ */ __name(function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }, "forEachHandler")); + } + }; + var InterceptorManager$1 = InterceptorManager; + var transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false + }; + var URLSearchParams2 = url__default["default"].URLSearchParams; + var platform$1 = { + isNode: true, + classes: { + URLSearchParams: URLSearchParams2, + FormData: FormData__default["default"], + Blob: typeof Blob !== "undefined" && Blob || null + }, + protocols: ["http", "https", "file", "data"] + }; + var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined"; + var hasStandardBrowserEnv = ((product) => { + return hasBrowserEnv && ["ReactNative", "NativeScript", "NS"].indexOf(product) < 0; + })(typeof navigator !== "undefined" && navigator.product); + var hasStandardBrowserWebWorkerEnv = (() => { + return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && typeof self.importScripts === "function"; + })(); + var origin = hasBrowserEnv && window.location.href || "http://localhost"; + var utils = /* @__PURE__ */ Object.freeze({ + __proto__: null, + hasBrowserEnv, + hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv, + origin + }); + var platform = { + ...utils, + ...platform$1 + }; + function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path2, helpers) { + if (platform.isNode && utils$1.isBuffer(value)) { + this.append(key, value.toString("base64")); + return false; + } + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); + } + __name(toURLEncodedForm, "toURLEncodedForm"); + function parsePropPath(name) { + return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => { + return match[0] === "[]" ? "" : match[1] || match[0]; + }); + } + __name(parsePropPath, "parsePropPath"); + function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; + } + __name(arrayToObject, "arrayToObject"); + function formDataToJSON(formData) { + function buildPath(path2, value, target, index) { + let name = path2[index++]; + if (name === "__proto__") + return true; + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path2.length; + name = !name && utils$1.isArray(target) ? target.length : name; + if (isLast) { + if (utils$1.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + return !isNumericKey; + } + if (!target[name] || !utils$1.isObject(target[name])) { + target[name] = []; + } + const result = buildPath(path2, value, target[name], index); + if (result && utils$1.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + return !isNumericKey; + } + __name(buildPath, "buildPath"); + if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { + const obj = {}; + utils$1.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + return obj; + } + return null; + } + __name(formDataToJSON, "formDataToJSON"); + function stringifySafely(rawValue, parser, encoder) { + if (utils$1.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils$1.trim(rawValue); + } catch (e) { + if (e.name !== "SyntaxError") { + throw e; + } + } + } + return (encoder || JSON.stringify)(rawValue); + } + __name(stringifySafely, "stringifySafely"); + var defaults = { + transitional: transitionalDefaults, + adapter: ["xhr", "http", "fetch"], + transformRequest: [/* @__PURE__ */ __name(function transformRequest(data, headers) { + const contentType = headers.getContentType() || ""; + const hasJSONContentType = contentType.indexOf("application/json") > -1; + const isObjectPayload = utils$1.isObject(data); + if (isObjectPayload && utils$1.isHTMLForm(data)) { + data = new FormData(data); + } + const isFormData2 = utils$1.isFormData(data); + if (isFormData2) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) { + return data; + } + if (utils$1.isArrayBufferView(data)) { + return data.buffer; + } + if (utils$1.isURLSearchParams(data)) { + headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false); + return data.toString(); + } + let isFileList2; + if (isObjectPayload) { + if (contentType.indexOf("application/x-www-form-urlencoded") > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) { + const _FormData = this.env && this.env.FormData; + return toFormData( + isFileList2 ? { "files[]": data } : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + if (isObjectPayload || hasJSONContentType) { + headers.setContentType("application/json", false); + return stringifySafely(data); + } + return data; + }, "transformRequest")], + transformResponse: [/* @__PURE__ */ __name(function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === "json"; + if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { + return data; + } + if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === "SyntaxError") { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + return data; + }, "transformResponse")], + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + xsrfCookieName: "XSRF-TOKEN", + xsrfHeaderName: "X-XSRF-TOKEN", + maxContentLength: -1, + maxBodyLength: -1, + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + validateStatus: /* @__PURE__ */ __name(function validateStatus(status) { + return status >= 200 && status < 300; + }, "validateStatus"), + headers: { + common: { + "Accept": "application/json, text/plain, */*", + "Content-Type": void 0 + } + } + }; + utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => { + defaults.headers[method] = {}; + }); + var defaults$1 = defaults; + var ignoreDuplicateOf = utils$1.toObjectSet([ + "age", + "authorization", + "content-length", + "content-type", + "etag", + "expires", + "from", + "host", + "if-modified-since", + "if-unmodified-since", + "last-modified", + "location", + "max-forwards", + "proxy-authorization", + "referer", + "retry-after", + "user-agent" + ]); + var parseHeaders = /* @__PURE__ */ __name((rawHeaders) => { + const parsed = {}; + let key; + let val; + let i; + rawHeaders && rawHeaders.split("\n").forEach(/* @__PURE__ */ __name(function parser(line) { + i = line.indexOf(":"); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + if (!key || parsed[key] && ignoreDuplicateOf[key]) { + return; + } + if (key === "set-cookie") { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ", " + val : val; + } + }, "parser")); + return parsed; + }, "parseHeaders"); + var $internals = Symbol("internals"); + function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); + } + __name(normalizeHeader, "normalizeHeader"); + function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); + } + __name(normalizeValue, "normalizeValue"); + function parseTokens(str) { + const tokens = /* @__PURE__ */ Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + while (match = tokensRE.exec(str)) { + tokens[match[1]] = match[2]; + } + return tokens; + } + __name(parseTokens, "parseTokens"); + var isValidHeaderName = /* @__PURE__ */ __name((str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()), "isValidHeaderName"); + function matchHeaderValue(context2, value, header, filter, isHeaderNameFilter) { + if (utils$1.isFunction(filter)) { + return filter.call(this, value, header); + } + if (isHeaderNameFilter) { + value = header; + } + if (!utils$1.isString(value)) + return; + if (utils$1.isString(filter)) { + return value.indexOf(filter) !== -1; + } + if (utils$1.isRegExp(filter)) { + return filter.test(value); + } + } + __name(matchHeaderValue, "matchHeaderValue"); + function formatHeader(header) { + return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); + } + __name(formatHeader, "formatHeader"); + function buildAccessors(obj, header) { + const accessorName = utils$1.toCamelCase(" " + header); + ["get", "set", "has"].forEach((methodName) => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); + } + __name(buildAccessors, "buildAccessors"); + var AxiosHeaders = class { + static { + __name(this, "AxiosHeaders"); + } + constructor(headers) { + headers && this.set(headers); + } + set(header, valueOrRewrite, rewrite) { + const self2 = this; + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + if (!lHeader) { + throw new Error("header name must be a non-empty string"); + } + const key = utils$1.findKey(self2, lHeader); + if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) { + self2[key || _header] = normalizeValue(_value); + } + } + __name(setHeader, "setHeader"); + const setHeaders = /* @__PURE__ */ __name((headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)), "setHeaders"); + if (utils$1.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils$1.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + return this; + } + get(header, parser) { + header = normalizeHeader(header); + if (header) { + const key = utils$1.findKey(this, header); + if (key) { + const value = this[key]; + if (!parser) { + return value; + } + if (parser === true) { + return parseTokens(value); + } + if (utils$1.isFunction(parser)) { + return parser.call(this, value, key); + } + if (utils$1.isRegExp(parser)) { + return parser.exec(value); + } + throw new TypeError("parser must be boolean|regexp|function"); + } + } + } + has(header, matcher) { + header = normalizeHeader(header); + if (header) { + const key = utils$1.findKey(this, header); + return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + return false; + } + delete(header, matcher) { + const self2 = this; + let deleted = false; + function deleteHeader(_header) { + _header = normalizeHeader(_header); + if (_header) { + const key = utils$1.findKey(self2, _header); + if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) { + delete self2[key]; + deleted = true; + } + } + } + __name(deleteHeader, "deleteHeader"); + if (utils$1.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + return deleted; + } + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + while (i--) { + const key = keys[i]; + if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + return deleted; + } + normalize(format) { + const self2 = this; + const headers = {}; + utils$1.forEach(this, (value, header) => { + const key = utils$1.findKey(headers, header); + if (key) { + self2[key] = normalizeValue(value); + delete self2[header]; + return; + } + const normalized = format ? formatHeader(header) : String(header).trim(); + if (normalized !== header) { + delete self2[header]; + } + self2[normalized] = normalizeValue(value); + headers[normalized] = true; + }); + return this; + } + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + toJSON(asStrings) { + const obj = /* @__PURE__ */ Object.create(null); + utils$1.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value); + }); + return obj; + } + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n"); + } + get [Symbol.toStringTag]() { + return "AxiosHeaders"; + } + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + static concat(first, ...targets) { + const computed = new this(first); + targets.forEach((target) => computed.set(target)); + return computed; + } + static accessor(header) { + const internals = this[$internals] = this[$internals] = { + accessors: {} + }; + const accessors = internals.accessors; + const prototype2 = this.prototype; + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + if (!accessors[lHeader]) { + buildAccessors(prototype2, _header); + accessors[lHeader] = true; + } + } + __name(defineAccessor, "defineAccessor"); + utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + return this; + } + }; + AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); + utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + }; + }); + utils$1.freezeMethods(AxiosHeaders); + var AxiosHeaders$1 = AxiosHeaders; + function transformData(fns, response) { + const config = this || defaults$1; + const context2 = response || config; + const headers = AxiosHeaders$1.from(context2.headers); + let data = context2.data; + utils$1.forEach(fns, /* @__PURE__ */ __name(function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : void 0); + }, "transform")); + headers.normalize(); + return data; + } + __name(transformData, "transformData"); + function isCancel(value) { + return !!(value && value.__CANCEL__); + } + __name(isCancel, "isCancel"); + function CanceledError(message, config, request) { + AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request); + this.name = "CanceledError"; + } + __name(CanceledError, "CanceledError"); + utils$1.inherits(CanceledError, AxiosError, { + __CANCEL__: true + }); + function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError( + "Request failed with status code " + response.status, + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } + } + __name(settle, "settle"); + function isAbsoluteURL(url2) { + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2); + } + __name(isAbsoluteURL, "isAbsoluteURL"); + function combineURLs(baseURL, relativeURL) { + return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL; + } + __name(combineURLs, "combineURLs"); + function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; + } + __name(buildFullPath, "buildFullPath"); + var VERSION2 = "1.7.2"; + function parseProtocol(url2) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2); + return match && match[1] || ""; + } + __name(parseProtocol, "parseProtocol"); + var DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/; + function fromDataURI(uri, asBlob, options) { + const _Blob = options && options.Blob || platform.classes.Blob; + const protocol = parseProtocol(uri); + if (asBlob === void 0 && _Blob) { + asBlob = true; + } + if (protocol === "data") { + uri = protocol.length ? uri.slice(protocol.length + 1) : uri; + const match = DATA_URL_PATTERN.exec(uri); + if (!match) { + throw new AxiosError("Invalid URL", AxiosError.ERR_INVALID_URL); + } + const mime = match[1]; + const isBase64 = match[2]; + const body = match[3]; + const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? "base64" : "utf8"); + if (asBlob) { + if (!_Blob) { + throw new AxiosError("Blob is not supported", AxiosError.ERR_NOT_SUPPORT); + } + return new _Blob([buffer], { type: mime }); + } + return buffer; + } + throw new AxiosError("Unsupported protocol " + protocol, AxiosError.ERR_NOT_SUPPORT); + } + __name(fromDataURI, "fromDataURI"); + function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1e3 / freq; + let timer = null; + return /* @__PURE__ */ __name(function throttled() { + const force = this === true; + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, arguments); + }, threshold - (now - timestamp)); + } + }, "throttled"); + } + __name(throttle, "throttle"); + function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + min = min !== void 0 ? min : 1e3; + return /* @__PURE__ */ __name(function push(chunkLength) { + const now = Date.now(); + const startedAt = timestamps[tail]; + if (!firstSampleTS) { + firstSampleTS = now; + } + bytes[head] = chunkLength; + timestamps[head] = now; + let i = tail; + let bytesCount = 0; + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + head = (head + 1) % samplesCount; + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + if (now - firstSampleTS < min) { + return; + } + const passed = startedAt && now - startedAt; + return passed ? Math.round(bytesCount * 1e3 / passed) : void 0; + }, "push"); + } + __name(speedometer, "speedometer"); + var kInternals = Symbol("internals"); + var AxiosTransformStream = class extends stream__default["default"].Transform { + static { + __name(this, "AxiosTransformStream"); + } + constructor(options) { + options = utils$1.toFlatObject(options, { + maxRate: 0, + chunkSize: 64 * 1024, + minChunkSize: 100, + timeWindow: 500, + ticksRate: 2, + samplesCount: 15 + }, null, (prop, source) => { + return !utils$1.isUndefined(source[prop]); + }); + super({ + readableHighWaterMark: options.chunkSize + }); + const self2 = this; + const internals = this[kInternals] = { + length: options.length, + timeWindow: options.timeWindow, + ticksRate: options.ticksRate, + chunkSize: options.chunkSize, + maxRate: options.maxRate, + minChunkSize: options.minChunkSize, + bytesSeen: 0, + isCaptured: false, + notifiedBytesLoaded: 0, + ts: Date.now(), + bytes: 0, + onReadCallback: null + }; + const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow); + this.on("newListener", (event) => { + if (event === "progress") { + if (!internals.isCaptured) { + internals.isCaptured = true; + } + } + }); + let bytesNotified = 0; + internals.updateProgress = throttle(/* @__PURE__ */ __name(function throttledHandler() { + const totalBytes = internals.length; + const bytesTransferred = internals.bytesSeen; + const progressBytes = bytesTransferred - bytesNotified; + if (!progressBytes || self2.destroyed) + return; + const rate = _speedometer(progressBytes); + bytesNotified = bytesTransferred; + process.nextTick(() => { + self2.emit("progress", { + loaded: bytesTransferred, + total: totalBytes, + progress: totalBytes ? bytesTransferred / totalBytes : void 0, + bytes: progressBytes, + rate: rate ? rate : void 0, + estimated: rate && totalBytes && bytesTransferred <= totalBytes ? (totalBytes - bytesTransferred) / rate : void 0, + lengthComputable: totalBytes != null + }); + }); + }, "throttledHandler"), internals.ticksRate); + const onFinish = /* @__PURE__ */ __name(() => { + internals.updateProgress.call(true); + }, "onFinish"); + this.once("end", onFinish); + this.once("error", onFinish); + } + _read(size) { + const internals = this[kInternals]; + if (internals.onReadCallback) { + internals.onReadCallback(); + } + return super._read(size); + } + _transform(chunk, encoding, callback) { + const self2 = this; + const internals = this[kInternals]; + const maxRate = internals.maxRate; + const readableHighWaterMark = this.readableHighWaterMark; + const timeWindow = internals.timeWindow; + const divider = 1e3 / timeWindow; + const bytesThreshold = maxRate / divider; + const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0; + function pushChunk(_chunk, _callback) { + const bytes = Buffer.byteLength(_chunk); + internals.bytesSeen += bytes; + internals.bytes += bytes; + if (internals.isCaptured) { + internals.updateProgress(); + } + if (self2.push(_chunk)) { + process.nextTick(_callback); + } else { + internals.onReadCallback = () => { + internals.onReadCallback = null; + process.nextTick(_callback); + }; + } + } + __name(pushChunk, "pushChunk"); + const transformChunk = /* @__PURE__ */ __name((_chunk, _callback) => { + const chunkSize = Buffer.byteLength(_chunk); + let chunkRemainder = null; + let maxChunkSize = readableHighWaterMark; + let bytesLeft; + let passed = 0; + if (maxRate) { + const now = Date.now(); + if (!internals.ts || (passed = now - internals.ts) >= timeWindow) { + internals.ts = now; + bytesLeft = bytesThreshold - internals.bytes; + internals.bytes = bytesLeft < 0 ? -bytesLeft : 0; + passed = 0; + } + bytesLeft = bytesThreshold - internals.bytes; + } + if (maxRate) { + if (bytesLeft <= 0) { + return setTimeout(() => { + _callback(null, _chunk); + }, timeWindow - passed); + } + if (bytesLeft < maxChunkSize) { + maxChunkSize = bytesLeft; + } + } + if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) { + chunkRemainder = _chunk.subarray(maxChunkSize); + _chunk = _chunk.subarray(0, maxChunkSize); + } + pushChunk(_chunk, chunkRemainder ? () => { + process.nextTick(_callback, null, chunkRemainder); + } : _callback); + }, "transformChunk"); + transformChunk(chunk, /* @__PURE__ */ __name(function transformNextChunk(err, _chunk) { + if (err) { + return callback(err); + } + if (_chunk) { + transformChunk(_chunk, transformNextChunk); + } else { + callback(null); + } + }, "transformNextChunk")); + } + setLength(length) { + this[kInternals].length = +length; + return this; + } + }; + var AxiosTransformStream$1 = AxiosTransformStream; + var { asyncIterator } = Symbol; + var readBlob = /* @__PURE__ */ __name(async function* (blob) { + if (blob.stream) { + yield* blob.stream(); + } else if (blob.arrayBuffer) { + yield await blob.arrayBuffer(); + } else if (blob[asyncIterator]) { + yield* blob[asyncIterator](); + } else { + yield blob; + } + }, "readBlob"); + var readBlob$1 = readBlob; + var BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + "-_"; + var textEncoder = new util.TextEncoder(); + var CRLF = "\r\n"; + var CRLF_BYTES = textEncoder.encode(CRLF); + var CRLF_BYTES_COUNT = 2; + var FormDataPart = class { + static { + __name(this, "FormDataPart"); + } + constructor(name, value) { + const { escapeName } = this.constructor; + const isStringValue = utils$1.isString(value); + let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ""}${CRLF}`; + if (isStringValue) { + value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF)); + } else { + headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`; + } + this.headers = textEncoder.encode(headers + CRLF); + this.contentLength = isStringValue ? value.byteLength : value.size; + this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT; + this.name = name; + this.value = value; + } + async *encode() { + yield this.headers; + const { value } = this; + if (utils$1.isTypedArray(value)) { + yield value; + } else { + yield* readBlob$1(value); + } + yield CRLF_BYTES; + } + static escapeName(name) { + return String(name).replace(/[\r\n"]/g, (match) => ({ + "\r": "%0D", + "\n": "%0A", + '"': "%22" + })[match]); + } + }; + var formDataToStream = /* @__PURE__ */ __name((form, headersHandler, options) => { + const { + tag = "form-data-boundary", + size = 25, + boundary = tag + "-" + utils$1.generateString(size, BOUNDARY_ALPHABET) + } = options || {}; + if (!utils$1.isFormData(form)) { + throw TypeError("FormData instance required"); + } + if (boundary.length < 1 || boundary.length > 70) { + throw Error("boundary must be 10-70 characters long"); + } + const boundaryBytes = textEncoder.encode("--" + boundary + CRLF); + const footerBytes = textEncoder.encode("--" + boundary + "--" + CRLF + CRLF); + let contentLength = footerBytes.byteLength; + const parts = Array.from(form.entries()).map(([name, value]) => { + const part = new FormDataPart(name, value); + contentLength += part.size; + return part; + }); + contentLength += boundaryBytes.byteLength * parts.length; + contentLength = utils$1.toFiniteNumber(contentLength); + const computedHeaders = { + "Content-Type": `multipart/form-data; boundary=${boundary}` + }; + if (Number.isFinite(contentLength)) { + computedHeaders["Content-Length"] = contentLength; + } + headersHandler && headersHandler(computedHeaders); + return stream.Readable.from(async function* () { + for (const part of parts) { + yield boundaryBytes; + yield* part.encode(); + } + yield footerBytes; + }()); + }, "formDataToStream"); + var formDataToStream$1 = formDataToStream; + var ZlibHeaderTransformStream = class extends stream__default["default"].Transform { + static { + __name(this, "ZlibHeaderTransformStream"); + } + __transform(chunk, encoding, callback) { + this.push(chunk); + callback(); + } + _transform(chunk, encoding, callback) { + if (chunk.length !== 0) { + this._transform = this.__transform; + if (chunk[0] !== 120) { + const header = Buffer.alloc(2); + header[0] = 120; + header[1] = 156; + this.push(header, encoding); + } + } + this.__transform(chunk, encoding, callback); + } + }; + var ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream; + var callbackify = /* @__PURE__ */ __name((fn, reducer) => { + return utils$1.isAsyncFn(fn) ? function(...args) { + const cb = args.pop(); + fn.apply(this, args).then((value) => { + try { + reducer ? cb(null, ...reducer(value)) : cb(null, value); + } catch (err) { + cb(err); + } + }, cb); + } : fn; + }, "callbackify"); + var callbackify$1 = callbackify; + var zlibOptions = { + flush: zlib__default["default"].constants.Z_SYNC_FLUSH, + finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH + }; + var brotliOptions = { + flush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH, + finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH + }; + var isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress); + var { http: httpFollow, https: httpsFollow } = followRedirects__default["default"]; + var isHttps = /https:?/; + var supportedProtocols = platform.protocols.map((protocol) => { + return protocol + ":"; + }); + function dispatchBeforeRedirect(options, responseDetails) { + if (options.beforeRedirects.proxy) { + options.beforeRedirects.proxy(options); + } + if (options.beforeRedirects.config) { + options.beforeRedirects.config(options, responseDetails); + } + } + __name(dispatchBeforeRedirect, "dispatchBeforeRedirect"); + function setProxy(options, configProxy, location) { + let proxy = configProxy; + if (!proxy && proxy !== false) { + const proxyUrl = proxyFromEnv.getProxyForUrl(location); + if (proxyUrl) { + proxy = new URL(proxyUrl); + } + } + if (proxy) { + if (proxy.username) { + proxy.auth = (proxy.username || "") + ":" + (proxy.password || ""); + } + if (proxy.auth) { + if (proxy.auth.username || proxy.auth.password) { + proxy.auth = (proxy.auth.username || "") + ":" + (proxy.auth.password || ""); + } + const base64 = Buffer.from(proxy.auth, "utf8").toString("base64"); + options.headers["Proxy-Authorization"] = "Basic " + base64; + } + options.headers.host = options.hostname + (options.port ? ":" + options.port : ""); + const proxyHost = proxy.hostname || proxy.host; + options.hostname = proxyHost; + options.host = proxyHost; + options.port = proxy.port; + options.path = location; + if (proxy.protocol) { + options.protocol = proxy.protocol.includes(":") ? proxy.protocol : `${proxy.protocol}:`; + } + } + options.beforeRedirects.proxy = /* @__PURE__ */ __name(function beforeRedirect(redirectOptions) { + setProxy(redirectOptions, configProxy, redirectOptions.href); + }, "beforeRedirect"); + } + __name(setProxy, "setProxy"); + var isHttpAdapterSupported = typeof process !== "undefined" && utils$1.kindOf(process) === "process"; + var wrapAsync = /* @__PURE__ */ __name((asyncExecutor) => { + return new Promise((resolve, reject) => { + let onDone; + let isDone; + const done = /* @__PURE__ */ __name((value, isRejected) => { + if (isDone) + return; + isDone = true; + onDone && onDone(value, isRejected); + }, "done"); + const _resolve = /* @__PURE__ */ __name((value) => { + done(value); + resolve(value); + }, "_resolve"); + const _reject = /* @__PURE__ */ __name((reason) => { + done(reason, true); + reject(reason); + }, "_reject"); + asyncExecutor(_resolve, _reject, (onDoneHandler) => onDone = onDoneHandler).catch(_reject); + }); + }, "wrapAsync"); + var resolveFamily = /* @__PURE__ */ __name(({ address, family }) => { + if (!utils$1.isString(address)) { + throw TypeError("address must be a string"); + } + return { + address, + family: family || (address.indexOf(".") < 0 ? 6 : 4) + }; + }, "resolveFamily"); + var buildAddressEntry = /* @__PURE__ */ __name((address, family) => resolveFamily(utils$1.isObject(address) ? address : { address, family }), "buildAddressEntry"); + var httpAdapter = isHttpAdapterSupported && /* @__PURE__ */ __name(function httpAdapter2(config) { + return wrapAsync(/* @__PURE__ */ __name(async function dispatchHttpRequest(resolve, reject, onDone) { + let { data, lookup, family } = config; + const { responseType, responseEncoding } = config; + const method = config.method.toUpperCase(); + let isDone; + let rejected = false; + let req; + if (lookup) { + const _lookup = callbackify$1(lookup, (value) => utils$1.isArray(value) ? value : [value]); + lookup = /* @__PURE__ */ __name((hostname, opt, cb) => { + _lookup(hostname, opt, (err, arg0, arg1) => { + if (err) { + return cb(err); + } + const addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)]; + opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family); + }); + }, "lookup"); + } + const emitter = new events.EventEmitter(); + const onFinished = /* @__PURE__ */ __name(() => { + if (config.cancelToken) { + config.cancelToken.unsubscribe(abort); + } + if (config.signal) { + config.signal.removeEventListener("abort", abort); + } + emitter.removeAllListeners(); + }, "onFinished"); + onDone((value, isRejected) => { + isDone = true; + if (isRejected) { + rejected = true; + onFinished(); + } + }); + function abort(reason) { + emitter.emit("abort", !reason || reason.type ? new CanceledError(null, config, req) : reason); + } + __name(abort, "abort"); + emitter.once("abort", reject); + if (config.cancelToken || config.signal) { + config.cancelToken && config.cancelToken.subscribe(abort); + if (config.signal) { + config.signal.aborted ? abort() : config.signal.addEventListener("abort", abort); + } + } + const fullPath = buildFullPath(config.baseURL, config.url); + const parsed = new URL(fullPath, "http://localhost"); + const protocol = parsed.protocol || supportedProtocols[0]; + if (protocol === "data:") { + let convertedData; + if (method !== "GET") { + return settle(resolve, reject, { + status: 405, + statusText: "method not allowed", + headers: {}, + config + }); + } + try { + convertedData = fromDataURI(config.url, responseType === "blob", { + Blob: config.env && config.env.Blob + }); + } catch (err) { + throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config); + } + if (responseType === "text") { + convertedData = convertedData.toString(responseEncoding); + if (!responseEncoding || responseEncoding === "utf8") { + convertedData = utils$1.stripBOM(convertedData); + } + } else if (responseType === "stream") { + convertedData = stream__default["default"].Readable.from(convertedData); + } + return settle(resolve, reject, { + data: convertedData, + status: 200, + statusText: "OK", + headers: new AxiosHeaders$1(), + config + }); + } + if (supportedProtocols.indexOf(protocol) === -1) { + return reject(new AxiosError( + "Unsupported protocol " + protocol, + AxiosError.ERR_BAD_REQUEST, + config + )); + } + const headers = AxiosHeaders$1.from(config.headers).normalize(); + headers.set("User-Agent", "axios/" + VERSION2, false); + const onDownloadProgress = config.onDownloadProgress; + const onUploadProgress = config.onUploadProgress; + const maxRate = config.maxRate; + let maxUploadRate = void 0; + let maxDownloadRate = void 0; + if (utils$1.isSpecCompliantForm(data)) { + const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i); + data = formDataToStream$1(data, (formHeaders) => { + headers.set(formHeaders); + }, { + tag: `axios-${VERSION2}-boundary`, + boundary: userBoundary && userBoundary[1] || void 0 + }); + } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) { + headers.set(data.getHeaders()); + if (!headers.hasContentLength()) { + try { + const knownLength = await util__default["default"].promisify(data.getLength).call(data); + Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength); + } catch (e) { + } + } + } else if (utils$1.isBlob(data)) { + data.size && headers.setContentType(data.type || "application/octet-stream"); + headers.setContentLength(data.size || 0); + data = stream__default["default"].Readable.from(readBlob$1(data)); + } else if (data && !utils$1.isStream(data)) { + if (Buffer.isBuffer(data)) + ; + else if (utils$1.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils$1.isString(data)) { + data = Buffer.from(data, "utf-8"); + } else { + return reject(new AxiosError( + "Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream", + AxiosError.ERR_BAD_REQUEST, + config + )); + } + headers.setContentLength(data.length, false); + if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) { + return reject(new AxiosError( + "Request body larger than maxBodyLength limit", + AxiosError.ERR_BAD_REQUEST, + config + )); + } + } + const contentLength = utils$1.toFiniteNumber(headers.getContentLength()); + if (utils$1.isArray(maxRate)) { + maxUploadRate = maxRate[0]; + maxDownloadRate = maxRate[1]; + } else { + maxUploadRate = maxDownloadRate = maxRate; + } + if (data && (onUploadProgress || maxUploadRate)) { + if (!utils$1.isStream(data)) { + data = stream__default["default"].Readable.from(data, { objectMode: false }); + } + data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({ + length: contentLength, + maxRate: utils$1.toFiniteNumber(maxUploadRate) + })], utils$1.noop); + onUploadProgress && data.on("progress", (progress) => { + onUploadProgress(Object.assign(progress, { + upload: true + })); + }); + } + let auth = void 0; + if (config.auth) { + const username = config.auth.username || ""; + const password = config.auth.password || ""; + auth = username + ":" + password; + } + if (!auth && parsed.username) { + const urlUsername = parsed.username; + const urlPassword = parsed.password; + auth = urlUsername + ":" + urlPassword; + } + auth && headers.delete("authorization"); + let path2; + try { + path2 = buildURL( + parsed.pathname + parsed.search, + config.params, + config.paramsSerializer + ).replace(/^\?/, ""); + } catch (err) { + const customErr = new Error(err.message); + customErr.config = config; + customErr.url = config.url; + customErr.exists = true; + return reject(customErr); + } + headers.set( + "Accept-Encoding", + "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""), + false + ); + const options = { + path: path2, + method, + headers: headers.toJSON(), + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth, + protocol, + family, + beforeRedirect: dispatchBeforeRedirect, + beforeRedirects: {} + }; + !utils$1.isUndefined(lookup) && (options.lookup = lookup); + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + setProxy(options, config.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path); + } + let transport; + const isHttpsRequest = isHttps.test(options.protocol); + options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsRequest ? https__default["default"] : http__default["default"]; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + if (config.beforeRedirect) { + options.beforeRedirects.config = config.beforeRedirect; + } + transport = isHttpsRequest ? httpsFollow : httpFollow; + } + if (config.maxBodyLength > -1) { + options.maxBodyLength = config.maxBodyLength; + } else { + options.maxBodyLength = Infinity; + } + if (config.insecureHTTPParser) { + options.insecureHTTPParser = config.insecureHTTPParser; + } + req = transport.request(options, /* @__PURE__ */ __name(function handleResponse(res) { + if (req.destroyed) + return; + const streams = [res]; + const responseLength = +res.headers["content-length"]; + if (onDownloadProgress) { + const transformStream = new AxiosTransformStream$1({ + length: utils$1.toFiniteNumber(responseLength), + maxRate: utils$1.toFiniteNumber(maxDownloadRate) + }); + onDownloadProgress && transformStream.on("progress", (progress) => { + onDownloadProgress(Object.assign(progress, { + download: true + })); + }); + streams.push(transformStream); + } + let responseStream = res; + const lastRequest = res.req || req; + if (config.decompress !== false && res.headers["content-encoding"]) { + if (method === "HEAD" || res.statusCode === 204) { + delete res.headers["content-encoding"]; + } + switch ((res.headers["content-encoding"] || "").toLowerCase()) { + case "gzip": + case "x-gzip": + case "compress": + case "x-compress": + streams.push(zlib__default["default"].createUnzip(zlibOptions)); + delete res.headers["content-encoding"]; + break; + case "deflate": + streams.push(new ZlibHeaderTransformStream$1()); + streams.push(zlib__default["default"].createUnzip(zlibOptions)); + delete res.headers["content-encoding"]; + break; + case "br": + if (isBrotliSupported) { + streams.push(zlib__default["default"].createBrotliDecompress(brotliOptions)); + delete res.headers["content-encoding"]; + } + } + } + responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils$1.noop) : streams[0]; + const offListeners = stream__default["default"].finished(responseStream, () => { + offListeners(); + onFinished(); + }); + const response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: new AxiosHeaders$1(res.headers), + config, + request: lastRequest + }; + if (responseType === "stream") { + response.data = responseStream; + settle(resolve, reject, response); + } else { + const responseBuffer = []; + let totalResponseBytes = 0; + responseStream.on("data", /* @__PURE__ */ __name(function handleStreamData(chunk) { + responseBuffer.push(chunk); + totalResponseBytes += chunk.length; + if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { + rejected = true; + responseStream.destroy(); + reject(new AxiosError( + "maxContentLength size of " + config.maxContentLength + " exceeded", + AxiosError.ERR_BAD_RESPONSE, + config, + lastRequest + )); + } + }, "handleStreamData")); + responseStream.on("aborted", /* @__PURE__ */ __name(function handlerStreamAborted() { + if (rejected) { + return; + } + const err = new AxiosError( + "maxContentLength size of " + config.maxContentLength + " exceeded", + AxiosError.ERR_BAD_RESPONSE, + config, + lastRequest + ); + responseStream.destroy(err); + reject(err); + }, "handlerStreamAborted")); + responseStream.on("error", /* @__PURE__ */ __name(function handleStreamError(err) { + if (req.destroyed) + return; + reject(AxiosError.from(err, null, config, lastRequest)); + }, "handleStreamError")); + responseStream.on("end", /* @__PURE__ */ __name(function handleStreamEnd() { + try { + let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer); + if (responseType !== "arraybuffer") { + responseData = responseData.toString(responseEncoding); + if (!responseEncoding || responseEncoding === "utf8") { + responseData = utils$1.stripBOM(responseData); + } + } + response.data = responseData; + } catch (err) { + return reject(AxiosError.from(err, null, config, response.request, response)); + } + settle(resolve, reject, response); + }, "handleStreamEnd")); + } + emitter.once("abort", (err) => { + if (!responseStream.destroyed) { + responseStream.emit("error", err); + responseStream.destroy(); + } + }); + }, "handleResponse")); + emitter.once("abort", (err) => { + reject(err); + req.destroy(err); + }); + req.on("error", /* @__PURE__ */ __name(function handleRequestError(err) { + reject(AxiosError.from(err, null, config, req)); + }, "handleRequestError")); + req.on("socket", /* @__PURE__ */ __name(function handleRequestSocket(socket) { + socket.setKeepAlive(true, 1e3 * 60); + }, "handleRequestSocket")); + if (config.timeout) { + const timeout = parseInt(config.timeout, 10); + if (Number.isNaN(timeout)) { + reject(new AxiosError( + "error trying to parse `config.timeout` to int", + AxiosError.ERR_BAD_OPTION_VALUE, + config, + req + )); + return; + } + req.setTimeout(timeout, /* @__PURE__ */ __name(function handleRequestTimeout() { + if (isDone) + return; + let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded"; + const transitional = config.transitional || transitionalDefaults; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + config, + req + )); + abort(); + }, "handleRequestTimeout")); + } + if (utils$1.isStream(data)) { + let ended = false; + let errored = false; + data.on("end", () => { + ended = true; + }); + data.once("error", (err) => { + errored = true; + req.destroy(err); + }); + data.on("close", () => { + if (!ended && !errored) { + abort(new CanceledError("Request stream has been aborted", config, req)); + } + }); + data.pipe(req); + } else { + req.end(data); + } + }, "dispatchHttpRequest")); + }, "httpAdapter"); + var progressEventReducer = /* @__PURE__ */ __name((listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + return throttle((e) => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : void 0; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + bytesNotified = loaded; + const data = { + loaded, + total, + progress: total ? loaded / total : void 0, + bytes: progressBytes, + rate: rate ? rate : void 0, + estimated: rate && total && inRange ? (total - loaded) / rate : void 0, + event: e, + lengthComputable: total != null + }; + data[isDownloadStream ? "download" : "upload"] = true; + listener(data); + }, freq); + }, "progressEventReducer"); + var isURLSameOrigin = platform.hasStandardBrowserEnv ? ( + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + (/* @__PURE__ */ __name(function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement("a"); + let originURL; + function resolveURL(url2) { + let href = url2; + if (msie) { + urlParsingNode.setAttribute("href", href); + href = urlParsingNode.href; + } + urlParsingNode.setAttribute("href", href); + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "", + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "", + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "", + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname + }; + } + __name(resolveURL, "resolveURL"); + originURL = resolveURL(window.location.href); + return /* @__PURE__ */ __name(function isURLSameOrigin2(requestURL) { + const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL; + return parsed.protocol === originURL.protocol && parsed.host === originURL.host; + }, "isURLSameOrigin"); + }, "standardBrowserEnv"))() + ) : ( + // Non standard browser envs (web workers, react-native) lack needed support. + (/* @__PURE__ */ __name(function nonStandardBrowserEnv() { + return /* @__PURE__ */ __name(function isURLSameOrigin2() { + return true; + }, "isURLSameOrigin"); + }, "nonStandardBrowserEnv"))() + ); + var cookies = platform.hasStandardBrowserEnv ? ( + // Standard browser envs support document.cookie + { + write(name, value, expires, path2, domain, secure) { + const cookie = [name + "=" + encodeURIComponent(value)]; + utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString()); + utils$1.isString(path2) && cookie.push("path=" + path2); + utils$1.isString(domain) && cookie.push("domain=" + domain); + secure === true && cookie.push("secure"); + document.cookie = cookie.join("; "); + }, + read(name) { + const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)")); + return match ? decodeURIComponent(match[3]) : null; + }, + remove(name) { + this.write(name, "", Date.now() - 864e5); + } + } + ) : ( + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() { + }, + read() { + return null; + }, + remove() { + } + } + ); + var headersToObject = /* @__PURE__ */ __name((thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing, "headersToObject"); + function mergeConfig(config1, config2) { + config2 = config2 || {}; + const config = {}; + function getMergedValue(target, source, caseless) { + if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { + return utils$1.merge.call({ caseless }, target, source); + } else if (utils$1.isPlainObject(source)) { + return utils$1.merge({}, source); + } else if (utils$1.isArray(source)) { + return source.slice(); + } + return source; + } + __name(getMergedValue, "getMergedValue"); + function mergeDeepProperties(a, b, caseless) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(void 0, a, caseless); + } + } + __name(mergeDeepProperties, "mergeDeepProperties"); + function valueFromConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(void 0, b); + } + } + __name(valueFromConfig2, "valueFromConfig2"); + function defaultToConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(void 0, b); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(void 0, a); + } + } + __name(defaultToConfig2, "defaultToConfig2"); + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(void 0, a); + } + } + __name(mergeDirectKeys, "mergeDirectKeys"); + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), /* @__PURE__ */ __name(function computeConfigValue(prop) { + const merge2 = mergeMap[prop] || mergeDeepProperties; + const configValue = merge2(config1[prop], config2[prop], prop); + utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue); + }, "computeConfigValue")); + return config; + } + __name(mergeConfig, "mergeConfig"); + var resolveConfig = /* @__PURE__ */ __name((config) => { + const newConfig = mergeConfig({}, config); + let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig; + newConfig.headers = headers = AxiosHeaders$1.from(headers); + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + if (auth) { + headers.set( + "Authorization", + "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")) + ); + } + let contentType; + if (utils$1.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(void 0); + } else if ((contentType = headers.getContentType()) !== false) { + const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : []; + headers.setContentType([type || "multipart/form-data", ...tokens].join("; ")); + } + } + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) { + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + return newConfig; + }, "resolveConfig"); + var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined"; + var xhrAdapter = isXHRAdapterSupported && function(config) { + return new Promise(/* @__PURE__ */ __name(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); + let { responseType } = _config; + let onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + if (_config.signal) { + _config.signal.removeEventListener("abort", onCanceled); + } + } + __name(done, "done"); + let request = new XMLHttpRequest(); + request.open(_config.method.toUpperCase(), _config.url, true); + request.timeout = _config.timeout; + function onloadend() { + if (!request) { + return; + } + const responseHeaders = AxiosHeaders$1.from( + "getAllResponseHeaders" in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + settle(/* @__PURE__ */ __name(function _resolve(value) { + resolve(value); + done(); + }, "_resolve"), /* @__PURE__ */ __name(function _reject(err) { + reject(err); + done(); + }, "_reject"), response); + request = null; + } + __name(onloadend, "onloadend"); + if ("onloadend" in request) { + request.onloadend = onloadend; + } else { + request.onreadystatechange = /* @__PURE__ */ __name(function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) { + return; + } + setTimeout(onloadend); + }, "handleLoad"); + } + request.onabort = /* @__PURE__ */ __name(function handleAbort() { + if (!request) { + return; + } + reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, _config, request)); + request = null; + }, "handleAbort"); + request.onerror = /* @__PURE__ */ __name(function handleError() { + reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, _config, request)); + request = null; + }, "handleError"); + request.ontimeout = /* @__PURE__ */ __name(function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded"; + const transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + _config, + request + )); + request = null; + }, "handleTimeout"); + requestData === void 0 && requestHeaders.setContentType(null); + if ("setRequestHeader" in request) { + utils$1.forEach(requestHeaders.toJSON(), /* @__PURE__ */ __name(function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }, "setRequestHeader")); + } + if (!utils$1.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + if (responseType && responseType !== "json") { + request.responseType = _config.responseType; + } + if (typeof _config.onDownloadProgress === "function") { + request.addEventListener("progress", progressEventReducer(_config.onDownloadProgress, true)); + } + if (typeof _config.onUploadProgress === "function" && request.upload) { + request.upload.addEventListener("progress", progressEventReducer(_config.onUploadProgress)); + } + if (_config.cancelToken || _config.signal) { + onCanceled = /* @__PURE__ */ __name((cancel) => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }, "onCanceled"); + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled); + } + } + const protocol = parseProtocol(_config.url); + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config)); + return; + } + request.send(requestData || null); + }, "dispatchXhrRequest")); + }; + var composeSignals = /* @__PURE__ */ __name((signals, timeout) => { + let controller = new AbortController(); + let aborted; + const onabort = /* @__PURE__ */ __name(function(cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); + } + }, "onabort"); + let timer = timeout && setTimeout(() => { + onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT)); + }, timeout); + const unsubscribe = /* @__PURE__ */ __name(() => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach((signal2) => { + signal2 && (signal2.removeEventListener ? signal2.removeEventListener("abort", onabort) : signal2.unsubscribe(onabort)); + }); + signals = null; + } + }, "unsubscribe"); + signals.forEach((signal2) => signal2 && signal2.addEventListener && signal2.addEventListener("abort", onabort)); + const { signal } = controller; + signal.unsubscribe = unsubscribe; + return [signal, () => { + timer && clearTimeout(timer); + timer = null; + }]; + }, "composeSignals"); + var composeSignals$1 = composeSignals; + var streamChunk = /* @__PURE__ */ __name(function* (chunk, chunkSize) { + let len = chunk.byteLength; + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + let pos = 0; + let end; + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } + }, "streamChunk"); + var readBytes = /* @__PURE__ */ __name(async function* (iterable, chunkSize, encode2) { + for await (const chunk of iterable) { + yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : await encode2(String(chunk)), chunkSize); + } + }, "readBytes"); + var trackStream = /* @__PURE__ */ __name((stream2, chunkSize, onProgress, onFinish, encode2) => { + const iterator = readBytes(stream2, chunkSize, encode2); + let bytes = 0; + return new ReadableStream({ + type: "bytes", + async pull(controller) { + const { done, value } = await iterator.next(); + if (done) { + controller.close(); + onFinish(); + return; + } + let len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + }, + cancel(reason) { + onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }); + }, "trackStream"); + var fetchProgressDecorator = /* @__PURE__ */ __name((total, fn) => { + const lengthComputable = total != null; + return (loaded) => setTimeout(() => fn({ + lengthComputable, + total, + loaded + })); + }, "fetchProgressDecorator"); + var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function"; + var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function"; + var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer())); + var supportsRequestStream = isReadableStreamSupported && (() => { + let duplexAccessed = false; + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: "POST", + get duplex() { + duplexAccessed = true; + return "half"; + } + }).headers.has("Content-Type"); + return duplexAccessed && !hasContentType; + })(); + var DEFAULT_CHUNK_SIZE = 64 * 1024; + var supportsResponseStream = isReadableStreamSupported && !!(() => { + try { + return utils$1.isReadableStream(new Response("").body); + } catch (err) { + } + })(); + var resolvers = { + stream: supportsResponseStream && ((res) => res.body) + }; + isFetchSupported && ((res) => { + ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => { + !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => { + throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config); + }); + }); + })(new Response()); + var getBodyLength = /* @__PURE__ */ __name(async (body) => { + if (body == null) { + return 0; + } + if (utils$1.isBlob(body)) { + return body.size; + } + if (utils$1.isSpecCompliantForm(body)) { + return (await new Request(body).arrayBuffer()).byteLength; + } + if (utils$1.isArrayBufferView(body)) { + return body.byteLength; + } + if (utils$1.isURLSearchParams(body)) { + body = body + ""; + } + if (utils$1.isString(body)) { + return (await encodeText(body)).byteLength; + } + }, "getBodyLength"); + var resolveBodyLength = /* @__PURE__ */ __name(async (headers, body) => { + const length = utils$1.toFiniteNumber(headers.getContentLength()); + return length == null ? getBodyLength(body) : length; + }, "resolveBodyLength"); + var fetchAdapter = isFetchSupported && (async (config) => { + let { + url: url2, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = "same-origin", + fetchOptions + } = resolveConfig(config); + responseType = responseType ? (responseType + "").toLowerCase() : "text"; + let [composedSignal, stopTimeout] = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : []; + let finished, request; + const onFinish = /* @__PURE__ */ __name(() => { + !finished && setTimeout(() => { + composedSignal && composedSignal.unsubscribe(); + }); + finished = true; + }, "onFinish"); + let requestContentLength; + try { + if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) { + let _request = new Request(url2, { + method: "POST", + body: data, + duplex: "half" + }); + let contentTypeHeader; + if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) { + headers.setContentType(contentTypeHeader); + } + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator( + requestContentLength, + progressEventReducer(onUploadProgress) + ), null, encodeText); + } + } + if (!utils$1.isString(withCredentials)) { + withCredentials = withCredentials ? "cors" : "omit"; + } + request = new Request(url2, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials + }); + let response = await fetch(request); + const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response"); + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + const options = {}; + ["status", "statusText", "headers"].forEach((prop) => { + options[prop] = response[prop]; + }); + const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length")); + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator( + responseContentLength, + progressEventReducer(onDownloadProgress, true) + ), isStreamResponse && onFinish, encodeText), + options + ); + } + responseType = responseType || "text"; + let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config); + !isStreamResponse && onFinish(); + stopTimeout && stopTimeout(); + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders$1.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }); + }); + } catch (err) { + onFinish(); + if (err && err.name === "TypeError" && /fetch/i.test(err.message)) { + throw Object.assign( + new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ); + } + throw AxiosError.from(err, err && err.code, config, request); + } + }); + var knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter + }; + utils$1.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, "name", { value }); + } catch (e) { + } + Object.defineProperty(fn, "adapterName", { value }); + } + }); + var renderReason = /* @__PURE__ */ __name((reason) => `- ${reason}`, "renderReason"); + var isResolvedHandle = /* @__PURE__ */ __name((adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false, "isResolvedHandle"); + var adapters = { + getAdapter: (adapters2) => { + adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2]; + const { length } = adapters2; + let nameOrAdapter; + let adapter; + const rejectedReasons = {}; + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters2[i]; + let id; + adapter = nameOrAdapter; + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + if (adapter === void 0) { + throw new AxiosError(`Unknown adapter '${id}'`); + } + } + if (adapter) { + break; + } + rejectedReasons[id || "#" + i] = adapter; + } + if (!adapter) { + const reasons = Object.entries(rejectedReasons).map( + ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build") + ); + let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified"; + throw new AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + "ERR_NOT_SUPPORT" + ); + } + return adapter; + }, + adapters: knownAdapters + }; + function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } + } + __name(throwIfCancellationRequested, "throwIfCancellationRequested"); + function dispatchRequest(config) { + throwIfCancellationRequested(config); + config.headers = AxiosHeaders$1.from(config.headers); + config.data = transformData.call( + config, + config.transformRequest + ); + if (["post", "put", "patch"].indexOf(config.method) !== -1) { + config.headers.setContentType("application/x-www-form-urlencoded", false); + } + const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + return adapter(config).then(/* @__PURE__ */ __name(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + response.data = transformData.call( + config, + config.transformResponse, + response + ); + response.headers = AxiosHeaders$1.from(response.headers); + return response; + }, "onAdapterResolution"), /* @__PURE__ */ __name(function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders$1.from(reason.response.headers); + } + } + return Promise.reject(reason); + }, "onAdapterRejection")); + } + __name(dispatchRequest, "dispatchRequest"); + var validators$1 = {}; + ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => { + validators$1[type] = /* @__PURE__ */ __name(function validator2(thing) { + return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type; + }, "validator"); + }); + var deprecatedWarnings = {}; + validators$1.transitional = /* @__PURE__ */ __name(function transitional(validator2, version3, message) { + function formatMessage(opt, desc) { + return "[Axios v" + VERSION2 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : ""); + } + __name(formatMessage, "formatMessage"); + return (value, opt, opts) => { + if (validator2 === false) { + throw new AxiosError( + formatMessage(opt, " has been removed" + (version3 ? " in " + version3 : "")), + AxiosError.ERR_DEPRECATED + ); + } + if (version3 && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + console.warn( + formatMessage( + opt, + " has been deprecated since v" + version3 + " and will be removed in the near future" + ) + ); + } + return validator2 ? validator2(value, opt, opts) : true; + }; + }, "transitional"); + function assertOptions(options, schema, allowUnknown) { + if (typeof options !== "object") { + throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator2 = schema[opt]; + if (validator2) { + const value = options[opt]; + const result = value === void 0 || validator2(value, opt, options); + if (result !== true) { + throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION); + } + } + } + __name(assertOptions, "assertOptions"); + var validator = { + assertOptions, + validators: validators$1 + }; + var validators = validator.validators; + var Axios = class { + static { + __name(this, "Axios"); + } + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error(); + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : ""; + try { + if (!err.stack) { + err.stack = stack; + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) { + err.stack += "\n" + stack; + } + } catch (e) { + } + } + throw err; + } + } + _request(configOrUrl, config) { + if (typeof configOrUrl === "string") { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + config = mergeConfig(this.defaults, config); + const { transitional, paramsSerializer, headers } = config; + if (transitional !== void 0) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + if (paramsSerializer != null) { + if (utils$1.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + config.method = (config.method || this.defaults.method || "get").toLowerCase(); + let contextHeaders = headers && utils$1.merge( + headers.common, + headers[config.method] + ); + headers && utils$1.forEach( + ["delete", "get", "head", "post", "put", "patch", "common"], + (method) => { + delete headers[method]; + } + ); + config.headers = AxiosHeaders$1.concat(contextHeaders, headers); + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(/* @__PURE__ */ __name(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) { + return; + } + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }, "unshiftRequestInterceptors")); + const responseInterceptorChain = []; + this.interceptors.response.forEach(/* @__PURE__ */ __name(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }, "pushResponseInterceptors")); + let promise; + let i = 0; + let len; + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), void 0]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + promise = Promise.resolve(config); + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + return promise; + } + len = requestInterceptorChain.length; + let newConfig = config; + i = 0; + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + i = 0; + len = responseInterceptorChain.length; + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + return promise; + } + getUri(config) { + config = mergeConfig(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } + }; + utils$1.forEach(["delete", "get", "head", "options"], /* @__PURE__ */ __name(function forEachMethodNoData(method) { + Axios.prototype[method] = function(url2, config) { + return this.request(mergeConfig(config || {}, { + method, + url: url2, + data: (config || {}).data + })); + }; + }, "forEachMethodNoData")); + utils$1.forEach(["post", "put", "patch"], /* @__PURE__ */ __name(function forEachMethodWithData(method) { + function generateHTTPMethod(isForm) { + return /* @__PURE__ */ __name(function httpMethod(url2, data, config) { + return this.request(mergeConfig(config || {}, { + method, + headers: isForm ? { + "Content-Type": "multipart/form-data" + } : {}, + url: url2, + data + })); + }, "httpMethod"); + } + __name(generateHTTPMethod, "generateHTTPMethod"); + Axios.prototype[method] = generateHTTPMethod(); + Axios.prototype[method + "Form"] = generateHTTPMethod(true); + }, "forEachMethodWithData")); + var Axios$1 = Axios; + var CancelToken = class _CancelToken { + static { + __name(this, "CancelToken"); + } + constructor(executor) { + if (typeof executor !== "function") { + throw new TypeError("executor must be a function."); + } + let resolvePromise; + this.promise = new Promise(/* @__PURE__ */ __name(function promiseExecutor(resolve) { + resolvePromise = resolve; + }, "promiseExecutor")); + const token = this; + this.promise.then((cancel) => { + if (!token._listeners) + return; + let i = token._listeners.length; + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + this.promise.then = (onfulfilled) => { + let _resolve; + const promise = new Promise((resolve) => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + promise.cancel = /* @__PURE__ */ __name(function reject() { + token.unsubscribe(_resolve); + }, "reject"); + return promise; + }; + executor(/* @__PURE__ */ __name(function cancel(message, config, request) { + if (token.reason) { + return; + } + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }, "cancel")); + } + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + /** + * Subscribe to the cancel signal + */ + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + /** + * Unsubscribe from the cancel signal + */ + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new _CancelToken(/* @__PURE__ */ __name(function executor(c) { + cancel = c; + }, "executor")); + return { + token, + cancel + }; + } + }; + var CancelToken$1 = CancelToken; + function spread(callback) { + return /* @__PURE__ */ __name(function wrap(arr) { + return callback.apply(null, arr); + }, "wrap"); + } + __name(spread, "spread"); + function isAxiosError(payload) { + return utils$1.isObject(payload) && payload.isAxiosError === true; + } + __name(isAxiosError, "isAxiosError"); + var HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511 + }; + Object.entries(HttpStatusCode).forEach(([key, value]) => { + HttpStatusCode[value] = key; + }); + var HttpStatusCode$1 = HttpStatusCode; + function createInstance(defaultConfig) { + const context2 = new Axios$1(defaultConfig); + const instance = bind(Axios$1.prototype.request, context2); + utils$1.extend(instance, Axios$1.prototype, context2, { allOwnKeys: true }); + utils$1.extend(instance, context2, null, { allOwnKeys: true }); + instance.create = /* @__PURE__ */ __name(function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }, "create"); + return instance; + } + __name(createInstance, "createInstance"); + var axios = createInstance(defaults$1); + axios.Axios = Axios$1; + axios.CanceledError = CanceledError; + axios.CancelToken = CancelToken$1; + axios.isCancel = isCancel; + axios.VERSION = VERSION2; + axios.toFormData = toFormData; + axios.AxiosError = AxiosError; + axios.Cancel = axios.CanceledError; + axios.all = /* @__PURE__ */ __name(function all(promises) { + return Promise.all(promises); + }, "all"); + axios.spread = spread; + axios.isAxiosError = isAxiosError; + axios.mergeConfig = mergeConfig; + axios.AxiosHeaders = AxiosHeaders$1; + axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + axios.getAdapter = adapters.getAdapter; + axios.HttpStatusCode = HttpStatusCode$1; + axios.default = axios; + module2.exports = axios; + } +}); + +// node_modules/@actions/cache/lib/internal/downloadUtils.js +var require_downloadUtils = __commonJS({ + "node_modules/@actions/cache/lib/internal/downloadUtils.js"(exports2) { + "use strict"; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding2(result, mod, k); + } + __setModuleDefault2(result, mod); + return result; + }; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + __name(adopt, "adopt"); + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + __name(fulfilled, "fulfilled"); + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + __name(rejected, "rejected"); + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + __name(step, "step"); + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.downloadCacheStorageSDK = exports2.downloadCacheHttpClientConcurrent = exports2.downloadCacheHttpClient = exports2.DownloadProgress = void 0; + exports2.downloadCacheStorageSDK = exports2.downloadCacheHttpClientConcurrent = exports2.downloadCacheHttpClient = exports2.downloadCacheAxiosMultiPart = exports2.DownloadProgress = void 0; var core = __importStar2(require_core()); var http_client_1 = require_lib(); var storage_blob_1 = require_dist10(); @@ -77930,6 +83165,9 @@ var require_downloadUtils = __commonJS({ var constants_1 = require_constants6(); var requestUtils_1 = require_requestUtils(); var abort_controller_1 = require_dist5(); + var axios_retry_1 = __importDefault2(require_cjs()); + var axios_1 = __importDefault2(require_axios()); + var cacheHttpClient_1 = require_cacheHttpClient(); function pipeResponseToStream(response, output, progress) { return __awaiter2(this, void 0, void 0, function* () { const pipeline = util.promisify(stream.pipeline); @@ -77946,6 +83184,18 @@ var require_downloadUtils = __commonJS({ }); } __name(pipeResponseToStream, "pipeResponseToStream"); + function reportStall() { + return __awaiter2(this, void 0, void 0, function* () { + try { + core.debug("Reporting stall to api.blacksmith.sh"); + const httpClient = (0, cacheHttpClient_1.createHttpClient)(); + yield promiseWithTimeout(1e4, httpClient.postJson((0, cacheHttpClient_1.getCacheApiUrl)("report-stall"), {})); + } catch (error) { + core.warning("Failed to report failure to api.blacksmith.sh"); + } + }); + } + __name(reportStall, "reportStall"); var DownloadProgress = class { static { __name(this, "DownloadProgress"); @@ -77957,6 +83207,7 @@ var require_downloadUtils = __commonJS({ this.segmentOffset = 0; this.receivedBytes = 0; this.displayedComplete = false; + this.highWaterTime = 0; this.startTime = Date.now(); } /** @@ -78014,6 +83265,7 @@ var require_downloadUtils = __commonJS({ */ onProgress() { return (progress) => { + this.highWaterTime = Date.now(); this.setReceivedBytes(progress.loadedBytes); }; } @@ -78045,9 +83297,103 @@ var require_downloadUtils = __commonJS({ } }; exports2.DownloadProgress = DownloadProgress; + function downloadCacheAxiosMultiPart(archiveLocation, archivePath) { + return __awaiter2(this, void 0, void 0, function* () { + const CONCURRENCY = 10; + core.info(`Downloading with ${CONCURRENCY} concurrent requests`); + const fdesc = yield fs.promises.open(archivePath, "w+"); + yield fdesc.chmod(420); + let progressLogger; + (0, axios_retry_1.default)(axios_1.default, { + retries: 3, + // No retry delay for axios-retry. + shouldResetTimeout: true, + retryCondition: (error) => { + var _a; + return ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) !== 404; + } + }); + try { + core.debug(`Downloading from ${archiveLocation} to ${archivePath}`); + const metadataResponse = yield axios_1.default.get(archiveLocation, { + headers: { Range: "bytes=0-1" } + }); + const contentRangeHeader = metadataResponse.headers["content-range"]; + if (!contentRangeHeader) { + throw new Error("Content-Range is not defined; unable to determine file size"); + } + const fileSize = parseInt(contentRangeHeader.split("/")[1]); + if (isNaN(fileSize)) { + throw new Error(`Content-Range is not a number; unable to determine file size: ${contentRangeHeader}`); + } + core.info(`Cached file size: ${fileSize}`); + yield fdesc.truncate(fileSize); + yield fdesc.sync(); + yield fdesc.close(); + progressLogger = new DownloadProgress(fileSize); + progressLogger.startDisplayTimer(); + core.info(`Downloading ${archivePath}`); + const chunkSize = Math.ceil(fileSize / CONCURRENCY); + const chunkRanges = []; + const fileDescriptors = []; + for (let i = 0; i < CONCURRENCY; i++) { + const start = i * chunkSize; + const end = i === CONCURRENCY - 1 ? fileSize - 1 : (i + 1) * chunkSize - 1; + chunkRanges.push(`bytes=${start}-${end}`); + fileDescriptors.push(yield fs.promises.open(archivePath, "r+")); + } + const downloads = chunkRanges.map((range, index) => __awaiter2(this, void 0, void 0, function* () { + core.debug(`Downloading range: ${range}`); + const response = yield axios_1.default.get(archiveLocation, { + headers: { Range: range }, + responseType: "stream" + }); + const reportProgress = new stream.Transform({ + transform(chunk, _encoding, callback) { + if (progressLogger) { + progressLogger.setReceivedBytes(progressLogger.getTransferredBytes() + chunk.length); + } + this.push(chunk); + callback(); + } + }); + const chunkFileDesc = fileDescriptors[index]; + try { + const finished = util.promisify(stream.finished); + const writer = fs.createWriteStream(archivePath, { + fd: chunkFileDesc.fd, + start: parseInt(range.split("=")[1].split("-")[0]), + autoClose: false + }); + yield response.data.pipe(reportProgress).pipe(writer); + yield finished(writer); + } catch (err) { + core.warning(`Range ${range} failed to download: ${err.message}`); + throw err; + } finally { + if (chunkFileDesc) { + try { + yield chunkFileDesc.close(); + } catch (err) { + core.warning(`Failed to close file descriptor: ${err}`); + } + } + } + })); + yield Promise.all(downloads); + } catch (err) { + core.warning(`Failed to download cache: ${err.message}`); + throw err; + } finally { + progressLogger === null || progressLogger === void 0 ? void 0 : progressLogger.stopDisplayTimer(true); + } + }); + } + __name(downloadCacheAxiosMultiPart, "downloadCacheAxiosMultiPart"); + exports2.downloadCacheAxiosMultiPart = downloadCacheAxiosMultiPart; function downloadCacheHttpClient(archiveLocation, archivePath) { return __awaiter2(this, void 0, void 0, function* () { - const CONCURRENCY = 8; + const CONCURRENCY = 1; const fdesc = yield fs.promises.open(archivePath, "w+"); yield fdesc.chmod(420); let progressLogger; @@ -78106,6 +83452,7 @@ var require_downloadUtils = __commonJS({ } finally { progressLogger === null || progressLogger === void 0 ? void 0 : progressLogger.stopDisplayTimer(); try { + yield new Promise((resolve) => setTimeout(resolve, 1e3)); yield fdesc.close(); } catch (err) { core.warning(`Failed to close file descriptor: ${err}`); @@ -78118,26 +83465,41 @@ var require_downloadUtils = __commonJS({ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options) { var _a; return __awaiter2(this, void 0, void 0, function* () { - const archiveDescriptor = yield fs.promises.open(archivePath, "w"); + core.info("Downloading from cache using Blacksmith Actions http-client"); + const archiveDescriptor = yield fs.promises.open(archivePath, "w+"); + yield archiveDescriptor.chmod(420); core.debug(`Downloading from ${archiveLocation} to ${archivePath}`); const httpClient = new http_client_1.HttpClient("actions/cache", void 0, { socketTimeout: options.timeoutInMs, keepAlive: true }); + let progress; + const stallTimeout = setTimeout(() => { + reportStall(); + }, 3e5); + stallTimeout.unref(); try { - const res = yield (0, requestUtils_1.retryHttpClientResponse)("downloadCacheMetadata", () => __awaiter2(this, void 0, void 0, function* () { - return yield httpClient.request("HEAD", archiveLocation, null, {}); + const metadataResponse = yield (0, requestUtils_1.retryHttpClientResponse)("downloadCache", () => __awaiter2(this, void 0, void 0, function* () { + return httpClient.get(archiveLocation, { + Range: "bytes=0-1" + }); })); - const lengthHeader = res.message.headers["content-length"]; - if (lengthHeader === void 0 || lengthHeader === null) { - throw new Error("Content-Length not found on blob response"); + metadataResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => { + metadataResponse.message.destroy(); + core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`); + }); + const contentRangeHeader = metadataResponse.message.headers["content-range"]; + if (!contentRangeHeader) { + throw new Error("Content-Range is not defined; unable to determine file size"); } - const length = parseInt(lengthHeader); - if (Number.isNaN(length)) { - throw new Error(`Could not interpret Content-Length: ${length}`); + const length = parseInt(contentRangeHeader.split("/")[1]); + if (isNaN(length)) { + throw new Error(`Content-Range is not a number; unable to determine file size: ${contentRangeHeader}`); } + progress = new DownloadProgress(length); + progress.startDisplayTimer(); const downloads = []; - const blockSize = 4 * 1024 * 1024; + const blockSize = 2 * 1024 * 1024; for (let offset = 0; offset < length; offset += blockSize) { const count = Math.min(blockSize, length - offset); downloads.push({ @@ -78150,14 +83512,15 @@ var require_downloadUtils = __commonJS({ downloads.reverse(); let actives = 0; let bytesDownloaded = 0; - const progress = new DownloadProgress(length); - progress.startDisplayTimer(); const progressFn = progress.onProgress(); const activeDownloads = []; let nextDownload; const waitAndWrite = /* @__PURE__ */ __name(() => __awaiter2(this, void 0, void 0, function* () { const segment = yield Promise.race(Object.values(activeDownloads)); - yield archiveDescriptor.write(segment.buffer, 0, segment.count, segment.offset); + const result = yield promiseWithTimeout(1e4, archiveDescriptor.write(segment.buffer, 0, segment.count, segment.offset)); + if (result === "timeout") { + throw new Error("Unable to download from cache using Blacksmith Actions http-client"); + } actives--; delete activeDownloads[segment.offset]; bytesDownloaded += segment.count; @@ -78166,7 +83529,7 @@ var require_downloadUtils = __commonJS({ while (nextDownload = downloads.pop()) { activeDownloads[nextDownload.offset] = nextDownload.promiseGetter(); actives++; - if (actives >= ((_a = options.downloadConcurrency) !== null && _a !== void 0 ? _a : 10)) { + if (actives >= ((_a = options.downloadConcurrency) !== null && _a !== void 0 ? _a : 12)) { yield waitAndWrite(); } } @@ -78174,6 +83537,10 @@ var require_downloadUtils = __commonJS({ yield waitAndWrite(); } } finally { + if (progress) { + progress.stopDisplayTimer(); + } + clearTimeout(stallTimeout); httpClient.dispose(); yield archiveDescriptor.close(); } @@ -78187,7 +83554,7 @@ var require_downloadUtils = __commonJS({ let failures = 0; while (true) { try { - const timeout = 3e4; + const timeout = 15e3; const result = yield promiseWithTimeout(timeout, downloadSegment(httpClient, archiveLocation, offset, count)); if (typeof result === "string") { throw new Error("downloadSegmentRetry failed due to timeout"); @@ -78198,6 +83565,8 @@ var require_downloadUtils = __commonJS({ throw err; } failures++; + yield new Promise((resolve) => setTimeout(resolve, Math.random() * 300)); + core.info(`Retrying download segment ${offset} of ${count} (${failures} of ${retries})`); } } }); @@ -78454,7 +83823,7 @@ var require_cacheHttpClient = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.reserveCache = exports2.downloadCache = exports2.getCacheEntry = exports2.getCacheVersion = void 0; + exports2.saveCache = exports2.reserveCache = exports2.downloadCache = exports2.getCacheEntry = exports2.getCacheVersion = exports2.createHttpClient = exports2.getCacheApiUrl = void 0; var core = __importStar2(require_core()); var http_client_1 = require_lib(); var auth_1 = require_auth(); @@ -78476,6 +83845,7 @@ var require_cacheHttpClient = __commonJS({ return url; } __name(getCacheApiUrl, "getCacheApiUrl"); + exports2.getCacheApiUrl = getCacheApiUrl; function createAcceptHeader(type, apiVersion) { return `${type};api-version=${apiVersion}`; } @@ -78497,6 +83867,7 @@ var require_cacheHttpClient = __commonJS({ return new http_client_1.HttpClient("useblacksmith/cache", [bearerCredentialHandler], getRequestOptions()); } __name(createHttpClient, "createHttpClient"); + exports2.createHttpClient = createHttpClient; function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { const components = paths; if (compressionMethod) { @@ -78573,7 +83944,7 @@ Other caches with similar key:`); yield (0, downloadUtils_1.downloadCacheHttpClient)(archiveLocation, archivePath); } } else { - yield (0, downloadUtils_1.downloadCacheHttpClient)(archiveLocation, archivePath); + yield (0, downloadUtils_1.downloadCacheHttpClientConcurrent)(archiveLocation, archivePath, downloadOptions); } }); } @@ -78815,7 +84186,7 @@ var require_tar = __commonJS({ args.push("--posix", "-cf", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "--exclude", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "--files-from", constants_1.ManifestFilename); break; case "extract": - args.push("-xf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path2.sep}`, "g"), "/")); + args.push("--skip-old-files", "-xf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path2.sep}`, "g"), "/")); break; case "list": args.push("-tf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "-P"); @@ -79029,6 +84400,7 @@ var require_cache2 = __commonJS({ var utils = __importStar2(require_cacheUtils()); var cacheHttpClient = __importStar2(require_cacheHttpClient()); var tar_1 = require_tar(); + var cacheHttpClient_1 = require_cacheHttpClient(); var ValidationError = class _ValidationError extends Error { static { __name(this, "ValidationError"); @@ -79072,6 +84444,31 @@ var require_cache2 = __commonJS({ } __name(isFeatureAvailable, "isFeatureAvailable"); exports2.isFeatureAvailable = isFeatureAvailable; + var promiseWithTimeout = /* @__PURE__ */ __name((timeoutMs, promise) => __awaiter2(void 0, void 0, void 0, function* () { + let timeoutHandle; + const timeoutPromise = new Promise((resolve) => { + timeoutHandle = setTimeout(() => resolve("timeout"), timeoutMs); + }); + return Promise.race([promise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle); + return result; + }); + }), "promiseWithTimeout"); + function reportFailure() { + return __awaiter2(this, void 0, void 0, function* () { + try { + core.info("Reporting failure to api.blacksmith.sh"); + const message = `${process.env.GITHUB_JOB} failed for ${process.env.GITHUB_REPOSITORY} with run ID: ${process.env.GITHUB_RUN_ID}; Sender: ${process.env.GITHUB_TRIGGERING_ACTOR}`; + const httpClient = (0, cacheHttpClient_1.createHttpClient)(); + yield promiseWithTimeout(1e4, httpClient.postJson((0, cacheHttpClient_1.getCacheApiUrl)("report-failed"), { + message + })); + } catch (error) { + core.warning("Failed to report failure to api.blacksmith.sh"); + } + }); + } + __name(reportFailure, "reportFailure"); function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) { return __awaiter2(this, void 0, void 0, function* () { checkPaths(paths); @@ -79119,6 +84516,7 @@ var require_cache2 = __commonJS({ core.info(`Did not get a cache hit; proceeding as an uncached run`); } else { core.warning(`Failed to restore: ${error.message}`); + yield reportFailure(); } } } finally { diff --git a/package.json b/package.json index 20da528..9a1b8bb 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/goto-bus-stop/setup-zig/issues" }, "dependencies": { - "@actions/cache": "npm:@useblacksmith/cache@3.2.48", + "@actions/cache": "npm:@useblacksmith/cache@3.2.131", "@actions/core": "^1.2.2", "@actions/tool-cache": "^2.0.1", "semver": "^7.1.3", @@ -39,4 +39,4 @@ "dist/**/*.js" ] } -} +} \ No newline at end of file