chaite
Version:
core for chatgpt-plugin and karin-plugin-chatgpt
1,230 lines (1,216 loc) • 1.04 MB
JavaScript
import { i as __require, o as __toDynamicImportESM, s as __toESM, t as __commonJS } from "../../../rolldown-runtime-DVriDoez.mjs";
import * as fs$1 from "fs/promises";
import { writeFile } from "fs/promises";
import * as path$1 from "path";
import { createWriteStream } from "fs";
import { Readable } from "node:stream";
import { finished } from "node:stream/promises";
//#region node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
var require_base64_js = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js": ((exports) => {
exports.byteLength = byteLength;
exports.toByteArray = toByteArray;
exports.fromByteArray = fromByteArray;
var lookup = [];
var revLookup = [];
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for (var i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i];
revLookup[code.charCodeAt(i)] = i;
}
revLookup["-".charCodeAt(0)] = 62;
revLookup["_".charCodeAt(0)] = 63;
function getLens(b64) {
var len$1 = b64.length;
if (len$1 % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
var validLen = b64.indexOf("=");
if (validLen === -1) validLen = len$1;
var placeHoldersLen = validLen === len$1 ? 0 : 4 - validLen % 4;
return [validLen, placeHoldersLen];
}
function byteLength(b64) {
var lens = getLens(b64);
var validLen = lens[0];
var placeHoldersLen = lens[1];
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}
function _byteLength(b64, validLen, placeHoldersLen) {
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}
function toByteArray(b64) {
var tmp;
var lens = getLens(b64);
var validLen = lens[0];
var placeHoldersLen = lens[1];
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
var curByte = 0;
var len$1 = placeHoldersLen > 0 ? validLen - 4 : validLen;
var i$1;
for (i$1 = 0; i$1 < len$1; i$1 += 4) {
tmp = revLookup[b64.charCodeAt(i$1)] << 18 | revLookup[b64.charCodeAt(i$1 + 1)] << 12 | revLookup[b64.charCodeAt(i$1 + 2)] << 6 | revLookup[b64.charCodeAt(i$1 + 3)];
arr[curByte++] = tmp >> 16 & 255;
arr[curByte++] = tmp >> 8 & 255;
arr[curByte++] = tmp & 255;
}
if (placeHoldersLen === 2) {
tmp = revLookup[b64.charCodeAt(i$1)] << 2 | revLookup[b64.charCodeAt(i$1 + 1)] >> 4;
arr[curByte++] = tmp & 255;
}
if (placeHoldersLen === 1) {
tmp = revLookup[b64.charCodeAt(i$1)] << 10 | revLookup[b64.charCodeAt(i$1 + 1)] << 4 | revLookup[b64.charCodeAt(i$1 + 2)] >> 2;
arr[curByte++] = tmp >> 8 & 255;
arr[curByte++] = tmp & 255;
}
return arr;
}
function tripletToBase64(num) {
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
}
function encodeChunk(uint8, start, end) {
var tmp;
var output = [];
for (var i$1 = start; i$1 < end; i$1 += 3) {
tmp = (uint8[i$1] << 16 & 16711680) + (uint8[i$1 + 1] << 8 & 65280) + (uint8[i$1 + 2] & 255);
output.push(tripletToBase64(tmp));
}
return output.join("");
}
function fromByteArray(uint8) {
var tmp;
var len$1 = uint8.length;
var extraBytes = len$1 % 3;
var parts = [];
var maxChunkLength = 16383;
for (var i$1 = 0, len2 = len$1 - extraBytes; i$1 < len2; i$1 += maxChunkLength) parts.push(encodeChunk(uint8, i$1, i$1 + maxChunkLength > len2 ? len2 : i$1 + maxChunkLength));
if (extraBytes === 1) {
tmp = uint8[len$1 - 1];
parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");
} else if (extraBytes === 2) {
tmp = (uint8[len$1 - 2] << 8) + uint8[len$1 - 1];
parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
}
return parts.join("");
}
}) });
//#endregion
//#region node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js
var require_safe_buffer = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js": ((exports, module) => {
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var buffer = __require("buffer");
var Buffer$8 = buffer.Buffer;
function copyProps(src, dst) {
for (var key in src) dst[key] = src[key];
}
if (Buffer$8.from && Buffer$8.alloc && Buffer$8.allocUnsafe && Buffer$8.allocUnsafeSlow) module.exports = buffer;
else {
copyProps(buffer, exports);
exports.Buffer = SafeBuffer;
}
function SafeBuffer(arg, encodingOrOffset, length) {
return Buffer$8(arg, encodingOrOffset, length);
}
SafeBuffer.prototype = Object.create(Buffer$8.prototype);
copyProps(Buffer$8, SafeBuffer);
SafeBuffer.from = function(arg, encodingOrOffset, length) {
if (typeof arg === "number") throw new TypeError("Argument must not be a number");
return Buffer$8(arg, encodingOrOffset, length);
};
SafeBuffer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") throw new TypeError("Argument must be a number");
var buf = Buffer$8(size);
if (fill !== void 0) if (typeof encoding === "string") buf.fill(fill, encoding);
else buf.fill(fill);
else buf.fill(0);
return buf;
};
SafeBuffer.allocUnsafe = function(size) {
if (typeof size !== "number") throw new TypeError("Argument must be a number");
return Buffer$8(size);
};
SafeBuffer.allocUnsafeSlow = function(size) {
if (typeof size !== "number") throw new TypeError("Argument must be a number");
return buffer.SlowBuffer(size);
};
}) });
//#endregion
//#region node_modules/.pnpm/buffer-equal-constant-time@1.0.1/node_modules/buffer-equal-constant-time/index.js
var require_buffer_equal_constant_time = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/buffer-equal-constant-time@1.0.1/node_modules/buffer-equal-constant-time/index.js": ((exports, module) => {
var Buffer$7 = __require("buffer").Buffer;
var SlowBuffer = __require("buffer").SlowBuffer;
module.exports = bufferEq;
function bufferEq(a, b) {
if (!Buffer$7.isBuffer(a) || !Buffer$7.isBuffer(b)) return false;
if (a.length !== b.length) return false;
var c = 0;
for (var i$1 = 0; i$1 < a.length; i$1++) c |= a[i$1] ^ b[i$1];
return c === 0;
}
bufferEq.install = function() {
Buffer$7.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
return bufferEq(this, that);
};
};
var origBufEqual = Buffer$7.prototype.equal;
var origSlowBufEqual = SlowBuffer.prototype.equal;
bufferEq.restore = function() {
Buffer$7.prototype.equal = origBufEqual;
SlowBuffer.prototype.equal = origSlowBufEqual;
};
}) });
//#endregion
//#region node_modules/.pnpm/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
var require_param_bytes_for_alg = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js": ((exports, module) => {
function getParamSize(keySize) {
return (keySize / 8 | 0) + (keySize % 8 === 0 ? 0 : 1);
}
var paramBytesForAlg = {
ES256: getParamSize(256),
ES384: getParamSize(384),
ES512: getParamSize(521)
};
function getParamBytesForAlg$1(alg) {
var paramBytes = paramBytesForAlg[alg];
if (paramBytes) return paramBytes;
throw new Error("Unknown algorithm \"" + alg + "\"");
}
module.exports = getParamBytesForAlg$1;
}) });
//#endregion
//#region node_modules/.pnpm/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
var require_ecdsa_sig_formatter = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js": ((exports, module) => {
var Buffer$6 = require_safe_buffer().Buffer;
var getParamBytesForAlg = require_param_bytes_for_alg();
var MAX_OCTET = 128, CLASS_UNIVERSAL = 0, PRIMITIVE_BIT = 32, TAG_SEQ = 16, TAG_INT = 2, ENCODED_TAG_SEQ = TAG_SEQ | PRIMITIVE_BIT | CLASS_UNIVERSAL << 6, ENCODED_TAG_INT = TAG_INT | CLASS_UNIVERSAL << 6;
function base64Url(base64) {
return base64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
}
function signatureAsBuffer(signature) {
if (Buffer$6.isBuffer(signature)) return signature;
else if ("string" === typeof signature) return Buffer$6.from(signature, "base64");
throw new TypeError("ECDSA signature must be a Base64 string or a Buffer");
}
function derToJose(signature, alg) {
signature = signatureAsBuffer(signature);
var paramBytes = getParamBytesForAlg(alg);
var maxEncodedParamLength = paramBytes + 1;
var inputLength = signature.length;
var offset = 0;
if (signature[offset++] !== ENCODED_TAG_SEQ) throw new Error("Could not find expected \"seq\"");
var seqLength = signature[offset++];
if (seqLength === (MAX_OCTET | 1)) seqLength = signature[offset++];
if (inputLength - offset < seqLength) throw new Error("\"seq\" specified length of \"" + seqLength + "\", only \"" + (inputLength - offset) + "\" remaining");
if (signature[offset++] !== ENCODED_TAG_INT) throw new Error("Could not find expected \"int\" for \"r\"");
var rLength = signature[offset++];
if (inputLength - offset - 2 < rLength) throw new Error("\"r\" specified length of \"" + rLength + "\", only \"" + (inputLength - offset - 2) + "\" available");
if (maxEncodedParamLength < rLength) throw new Error("\"r\" specified length of \"" + rLength + "\", max of \"" + maxEncodedParamLength + "\" is acceptable");
var rOffset = offset;
offset += rLength;
if (signature[offset++] !== ENCODED_TAG_INT) throw new Error("Could not find expected \"int\" for \"s\"");
var sLength = signature[offset++];
if (inputLength - offset !== sLength) throw new Error("\"s\" specified length of \"" + sLength + "\", expected \"" + (inputLength - offset) + "\"");
if (maxEncodedParamLength < sLength) throw new Error("\"s\" specified length of \"" + sLength + "\", max of \"" + maxEncodedParamLength + "\" is acceptable");
var sOffset = offset;
offset += sLength;
if (offset !== inputLength) throw new Error("Expected to consume entire buffer, but \"" + (inputLength - offset) + "\" bytes remain");
var rPadding = paramBytes - rLength, sPadding = paramBytes - sLength;
var dst = Buffer$6.allocUnsafe(rPadding + rLength + sPadding + sLength);
for (offset = 0; offset < rPadding; ++offset) dst[offset] = 0;
signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength);
offset = paramBytes;
for (var o = offset; offset < o + sPadding; ++offset) dst[offset] = 0;
signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength);
dst = dst.toString("base64");
dst = base64Url(dst);
return dst;
}
function countPadding(buf, start, stop) {
var padding = 0;
while (start + padding < stop && buf[start + padding] === 0) ++padding;
if (buf[start + padding] >= MAX_OCTET) --padding;
return padding;
}
function joseToDer(signature, alg) {
signature = signatureAsBuffer(signature);
var paramBytes = getParamBytesForAlg(alg);
var signatureBytes = signature.length;
if (signatureBytes !== paramBytes * 2) throw new TypeError("\"" + alg + "\" signatures must be \"" + paramBytes * 2 + "\" bytes, saw \"" + signatureBytes + "\"");
var rPadding = countPadding(signature, 0, paramBytes);
var sPadding = countPadding(signature, paramBytes, signature.length);
var rLength = paramBytes - rPadding;
var sLength = paramBytes - sPadding;
var rsBytes = 2 + rLength + 1 + 1 + sLength;
var shortLength = rsBytes < MAX_OCTET;
var dst = Buffer$6.allocUnsafe((shortLength ? 2 : 3) + rsBytes);
var offset = 0;
dst[offset++] = ENCODED_TAG_SEQ;
if (shortLength) dst[offset++] = rsBytes;
else {
dst[offset++] = MAX_OCTET | 1;
dst[offset++] = rsBytes & 255;
}
dst[offset++] = ENCODED_TAG_INT;
dst[offset++] = rLength;
if (rPadding < 0) {
dst[offset++] = 0;
offset += signature.copy(dst, offset, 0, paramBytes);
} else offset += signature.copy(dst, offset, rPadding, paramBytes);
dst[offset++] = ENCODED_TAG_INT;
dst[offset++] = sLength;
if (sPadding < 0) {
dst[offset++] = 0;
signature.copy(dst, offset, paramBytes);
} else signature.copy(dst, offset, paramBytes + sPadding);
return dst;
}
module.exports = {
derToJose,
joseToDer
};
}) });
//#endregion
//#region node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.js
var require_extend = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.js": ((exports, module) => {
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var defineProperty = Object.defineProperty;
var gOPD = Object.getOwnPropertyDescriptor;
var isArray = function isArray$1(arr) {
if (typeof Array.isArray === "function") return Array.isArray(arr);
return toStr.call(arr) === "[object Array]";
};
var isPlainObject = function isPlainObject$1(obj) {
if (!obj || toStr.call(obj) !== "[object Object]") return false;
var hasOwnConstructor = hasOwn.call(obj, "constructor");
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf");
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) return false;
var key;
for (key in obj);
return typeof key === "undefined" || hasOwn.call(obj, key);
};
var setProperty = function setProperty$1(target, options) {
if (defineProperty && options.name === "__proto__") defineProperty(target, options.name, {
enumerable: true,
configurable: true,
value: options.newValue,
writable: true
});
else target[options.name] = options.newValue;
};
var getProperty = function getProperty$1(obj, name) {
if (name === "__proto__") {
if (!hasOwn.call(obj, name)) return;
else if (gOPD) return gOPD(obj, name).value;
}
return obj[name];
};
module.exports = function extend() {
var options, name, src, copy, copyIsArray, clone;
var target = arguments[0];
var i$1 = 1;
var length = arguments.length;
var deep = false;
if (typeof target === "boolean") {
deep = target;
target = arguments[1] || {};
i$1 = 2;
}
if (target == null || typeof target !== "object" && typeof target !== "function") target = {};
for (; i$1 < length; ++i$1) {
options = arguments[i$1];
if (options != null) for (name in options) {
src = getProperty(target, name);
copy = getProperty(options, name);
if (target !== copy) {
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
} else clone = src && isPlainObject(src) ? src : {};
setProperty(target, {
name,
newValue: extend(deep, clone, copy)
});
} else if (typeof copy !== "undefined") setProperty(target, {
name,
newValue: copy
});
}
}
}
return target;
};
}) });
//#endregion
//#region node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/package.json
var require_package$1 = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/package.json": ((exports, module) => {
module.exports = {
"name": "gaxios",
"version": "7.1.3",
"description": "A simple common HTTP client specifically for Google APIs and services.",
"main": "build/cjs/src/index.js",
"types": "build/cjs/src/index.d.ts",
"files": ["build/"],
"exports": { ".": {
"import": {
"types": "./build/esm/src/index.d.ts",
"default": "./build/esm/src/index.js"
},
"require": {
"types": "./build/cjs/src/index.d.ts",
"default": "./build/cjs/src/index.js"
}
} },
"scripts": {
"lint": "gts check --no-inline-config",
"test": "c8 mocha build/esm/test",
"presystem-test": "npm run compile",
"system-test": "mocha build/esm/system-test --timeout 80000",
"compile": "tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",
"fix": "gts fix",
"prepare": "npm run compile",
"pretest": "npm run compile",
"webpack": "webpack",
"prebrowser-test": "npm run compile",
"browser-test": "node build/browser-test/browser-test-runner.js",
"docs": "jsdoc -c .jsdoc.js",
"docs-test": "linkinator docs",
"predocs-test": "npm run docs",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"prelint": "cd samples; npm link ../; npm install",
"clean": "gts clean"
},
"repository": {
"type": "git",
"directory": "packages/gaxios",
"url": "https://github.com/googleapis/google-cloud-node-core.git"
},
"keywords": ["google"],
"engines": { "node": ">=18" },
"author": "Google, LLC",
"license": "Apache-2.0",
"devDependencies": {
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@types/cors": "^2.8.6",
"@types/express": "^5.0.0",
"@types/extend": "^3.0.1",
"@types/mocha": "^10.0.10",
"@types/multiparty": "4.2.1",
"@types/mv": "^2.1.0",
"@types/ncp": "^2.0.1",
"@types/node": "^22.0.0",
"@types/sinon": "^17.0.0",
"@types/tmp": "0.2.6",
"assert": "^2.0.0",
"browserify": "^17.0.0",
"c8": "^10.0.0",
"cors": "^2.8.5",
"express": "^5.0.0",
"gts": "^6.0.0",
"is-docker": "^3.0.0",
"jsdoc": "^4.0.0",
"jsdoc-fresh": "^5.0.0",
"jsdoc-region-tag": "^4.0.0",
"karma": "^6.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-coverage": "^2.0.0",
"karma-firefox-launcher": "^2.0.0",
"karma-mocha": "^2.0.0",
"karma-remap-coverage": "^0.1.5",
"karma-sourcemap-loader": "^0.4.0",
"karma-webpack": "^5.0.1",
"linkinator": "^6.1.2",
"mocha": "^11.1.0",
"multiparty": "^4.2.1",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"nock": "^14.0.0-beta.13",
"null-loader": "^4.0.0",
"pack-n-play": "^4.0.0",
"puppeteer": "^24.0.0",
"sinon": "^21.0.0",
"stream-browserify": "^3.0.0",
"tmp": "0.2.5",
"ts-loader": "^9.5.2",
"typescript": "^5.8.3",
"webpack": "^5.35.0",
"webpack-cli": "^6.0.1"
},
"dependencies": {
"extend": "^3.0.2",
"https-proxy-agent": "^7.0.1",
"node-fetch": "^3.3.2",
"rimraf": "^5.0.1"
},
"homepage": "https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"
};
}) });
//#endregion
//#region node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/util.cjs
var require_util$1 = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/util.cjs": ((exports, module) => {
const pkg$2 = require_package$1();
module.exports = { pkg: pkg$2 };
}) });
//#endregion
//#region node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/common.js
var require_common = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/common.js": ((exports) => {
var __importDefault$1 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GaxiosError = exports.GAXIOS_ERROR_SYMBOL = void 0;
exports.defaultErrorRedactor = defaultErrorRedactor;
const extend_1$1 = __importDefault$1(require_extend());
const pkg$1 = __importDefault$1(require_util$1()).default.pkg;
/**
* Support `instanceof` operator for `GaxiosError`s in different versions of this library.
*
* @see {@link GaxiosError[Symbol.hasInstance]}
*/
exports.GAXIOS_ERROR_SYMBOL = Symbol.for(`${pkg$1.name}-gaxios-error`);
var GaxiosError = class GaxiosError extends Error {
config;
response;
/**
* An error code.
* Can be a system error code, DOMException error name, or any error's 'code' property where it is a `string`.
*
* It is only a `number` when the cause is sourced from an API-level error (AIP-193).
*
* @see {@link https://nodejs.org/api/errors.html#errorcode error.code}
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException#error_names DOMException#error_names}
* @see {@link https://google.aip.dev/193#http11json-representation AIP-193}
*
* @example
* 'ECONNRESET'
*
* @example
* 'TimeoutError'
*
* @example
* 500
*/
code;
/**
* An HTTP Status code.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Response/status Response#status}
*
* @example
* 500
*/
status;
/**
* @deprecated use {@link GaxiosError.cause} instead.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause Error#cause}
*
* @privateRemarks
*
* We will want to remove this property later as the modern `cause` property is better suited
* for displaying and relaying nested errors. Keeping this here makes the resulting
* error log larger than it needs to be.
*
*/
error;
/**
* Support `instanceof` operator for `GaxiosError` across builds/duplicated files.
*
* @see {@link GAXIOS_ERROR_SYMBOL}
* @see {@link GaxiosError[Symbol.hasInstance]}
* @see {@link https://github.com/microsoft/TypeScript/issues/13965#issuecomment-278570200}
* @see {@link https://stackoverflow.com/questions/46618852/require-and-instanceof}
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/@@hasInstance#reverting_to_default_instanceof_behavior}
*/
[exports.GAXIOS_ERROR_SYMBOL] = pkg$1.version;
/**
* Support `instanceof` operator for `GaxiosError` across builds/duplicated files.
*
* @see {@link GAXIOS_ERROR_SYMBOL}
* @see {@link GaxiosError[GAXIOS_ERROR_SYMBOL]}
*/
static [Symbol.hasInstance](instance$1) {
if (instance$1 && typeof instance$1 === "object" && exports.GAXIOS_ERROR_SYMBOL in instance$1 && instance$1[exports.GAXIOS_ERROR_SYMBOL] === pkg$1.version) return true;
return Function.prototype[Symbol.hasInstance].call(GaxiosError, instance$1);
}
constructor(message, config, response, cause) {
super(message, { cause });
this.config = config;
this.response = response;
this.error = cause instanceof Error ? cause : void 0;
this.config = (0, extend_1$1.default)(true, {}, config);
if (this.response) this.response.config = (0, extend_1$1.default)(true, {}, this.response.config);
if (this.response) {
try {
this.response.data = translateData(this.config.responseType, this.response?.bodyUsed ? this.response?.data : void 0);
} catch {}
this.status = this.response.status;
}
if (cause instanceof DOMException) this.code = cause.name;
else if (cause && typeof cause === "object" && "code" in cause && (typeof cause.code === "string" || typeof cause.code === "number")) this.code = cause.code;
}
/**
* An AIP-193 conforming error extractor.
*
* @see {@link https://google.aip.dev/193#http11json-representation AIP-193}
*
* @internal
* @expiremental
*
* @param res the response object
* @returns the extracted error information
*/
static extractAPIErrorFromResponse(res, defaultErrorMessage = "The request failed") {
let message = defaultErrorMessage;
if (typeof res.data === "string") message = res.data;
if (res.data && typeof res.data === "object" && "error" in res.data && res.data.error && !res.ok) {
if (typeof res.data.error === "string") return {
message: res.data.error,
code: res.status,
status: res.statusText
};
if (typeof res.data.error === "object") {
message = "message" in res.data.error && typeof res.data.error.message === "string" ? res.data.error.message : message;
const status = "status" in res.data.error && typeof res.data.error.status === "string" ? res.data.error.status : res.statusText;
const code$1 = "code" in res.data.error && typeof res.data.error.code === "number" ? res.data.error.code : res.status;
if ("errors" in res.data.error && Array.isArray(res.data.error.errors)) {
const errorMessages = [];
for (const e of res.data.error.errors) if (typeof e === "object" && "message" in e && typeof e.message === "string") errorMessages.push(e.message);
return Object.assign({
message: errorMessages.join("\n") || message,
code: code$1,
status
}, res.data.error);
}
return Object.assign({
message,
code: code$1,
status
}, res.data.error);
}
}
return {
message,
code: res.status,
status: res.statusText
};
}
};
exports.GaxiosError = GaxiosError;
function translateData(responseType, data) {
switch (responseType) {
case "stream": return data;
case "json": return JSON.parse(JSON.stringify(data));
case "arraybuffer": return JSON.parse(Buffer.from(data).toString("utf8"));
case "blob": return JSON.parse(data.text());
default: return data;
}
}
/**
* An experimental error redactor.
*
* @param config Config to potentially redact properties of
* @param response Config to potentially redact properties of
*
* @experimental
*/
function defaultErrorRedactor(data) {
const REDACT = "<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";
function redactHeaders(headers) {
if (!headers) return;
headers.forEach((_, key) => {
if (/^authentication$/i.test(key) || /^authorization$/i.test(key) || /secret/i.test(key)) headers.set(key, REDACT);
});
}
function redactString(obj, key) {
if (typeof obj === "object" && obj !== null && typeof obj[key] === "string") {
const text = obj[key];
if (/grant_type=/i.test(text) || /assertion=/i.test(text) || /secret/i.test(text)) obj[key] = REDACT;
}
}
function redactObject(obj) {
if (!obj || typeof obj !== "object") return;
else if (obj instanceof FormData || obj instanceof URLSearchParams || "forEach" in obj && "set" in obj) obj.forEach((_, key) => {
if (["grant_type", "assertion"].includes(key) || /secret/.test(key)) obj.set(key, REDACT);
});
else {
if ("grant_type" in obj) obj["grant_type"] = REDACT;
if ("assertion" in obj) obj["assertion"] = REDACT;
if ("client_secret" in obj) obj["client_secret"] = REDACT;
}
}
if (data.config) {
redactHeaders(data.config.headers);
redactString(data.config, "data");
redactObject(data.config.data);
redactString(data.config, "body");
redactObject(data.config.body);
if (data.config.url.searchParams.has("token")) data.config.url.searchParams.set("token", REDACT);
if (data.config.url.searchParams.has("client_secret")) data.config.url.searchParams.set("client_secret", REDACT);
}
if (data.response) {
defaultErrorRedactor({ config: data.response.config });
redactHeaders(data.response.headers);
if (data.response.bodyUsed) {
redactString(data.response, "data");
redactObject(data.response.data);
}
}
return data;
}
}) });
//#endregion
//#region node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/retry.js
var require_retry = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/retry.js": ((exports) => {
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRetryConfig = getRetryConfig;
async function getRetryConfig(err) {
let config = getConfig(err);
if (!err || !err.config || !config && !err.config.retry) return { shouldRetry: false };
config = config || {};
config.currentRetryAttempt = config.currentRetryAttempt || 0;
config.retry = config.retry === void 0 || config.retry === null ? 3 : config.retry;
config.httpMethodsToRetry = config.httpMethodsToRetry || [
"GET",
"HEAD",
"PUT",
"OPTIONS",
"DELETE"
];
config.noResponseRetries = config.noResponseRetries === void 0 || config.noResponseRetries === null ? 2 : config.noResponseRetries;
config.retryDelayMultiplier = config.retryDelayMultiplier ? config.retryDelayMultiplier : 2;
config.timeOfFirstRequest = config.timeOfFirstRequest ? config.timeOfFirstRequest : Date.now();
config.totalTimeout = config.totalTimeout ? config.totalTimeout : Number.MAX_SAFE_INTEGER;
config.maxRetryDelay = config.maxRetryDelay ? config.maxRetryDelay : Number.MAX_SAFE_INTEGER;
config.statusCodesToRetry = config.statusCodesToRetry || [
[100, 199],
[408, 408],
[429, 429],
[500, 599]
];
err.config.retryConfig = config;
if (!await (config.shouldRetry || shouldRetryRequest)(err)) return {
shouldRetry: false,
config: err.config
};
const delay = getNextRetryDelay(config);
err.config.retryConfig.currentRetryAttempt += 1;
const backoff = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve) => {
setTimeout(resolve, delay);
});
if (config.onRetryAttempt) await config.onRetryAttempt(err);
await backoff;
return {
shouldRetry: true,
config: err.config
};
}
/**
* Determine based on config if we should retry the request.
* @param err The GaxiosError passed to the interceptor.
*/
function shouldRetryRequest(err) {
const config = getConfig(err);
if (err.config.signal?.aborted && err.code !== "TimeoutError" || err.code === "AbortError") return false;
if (!config || config.retry === 0) return false;
if (!err.response && (config.currentRetryAttempt || 0) >= config.noResponseRetries) return false;
if (!config.httpMethodsToRetry || !config.httpMethodsToRetry.includes(err.config.method?.toUpperCase() || "GET")) return false;
if (err.response && err.response.status) {
let isInRange = false;
for (const [min, max] of config.statusCodesToRetry) {
const status = err.response.status;
if (status >= min && status <= max) {
isInRange = true;
break;
}
}
if (!isInRange) return false;
}
config.currentRetryAttempt = config.currentRetryAttempt || 0;
if (config.currentRetryAttempt >= config.retry) return false;
return true;
}
/**
* Acquire the raxConfig object from an GaxiosError if available.
* @param err The Gaxios error with a config object.
*/
function getConfig(err) {
if (err && err.config && err.config.retryConfig) return err.config.retryConfig;
}
/**
* Gets the delay to wait before the next retry.
*
* @param {RetryConfig} config The current set of retry options
* @returns {number} the amount of ms to wait before the next retry attempt.
*/
function getNextRetryDelay(config) {
const calculatedDelay = (config.currentRetryAttempt ? 0 : config.retryDelay ?? 100) + (Math.pow(config.retryDelayMultiplier, config.currentRetryAttempt) - 1) / 2 * 1e3;
const maxAllowableDelay = config.totalTimeout - (Date.now() - config.timeOfFirstRequest);
return Math.min(calculatedDelay, maxAllowableDelay, config.maxRetryDelay);
}
}) });
//#endregion
//#region node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/interceptor.js
var require_interceptor = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/interceptor.js": ((exports) => {
Object.defineProperty(exports, "__esModule", { value: true });
exports.GaxiosInterceptorManager = void 0;
/**
* Class to manage collections of GaxiosInterceptors for both requests and responses.
*/
var GaxiosInterceptorManager = class extends Set {};
exports.GaxiosInterceptorManager = GaxiosInterceptorManager;
}) });
//#endregion
//#region node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/gaxios.js
var require_gaxios = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/gaxios.js": ((exports) => {
var __importDefault = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Gaxios = void 0;
const extend_1 = __importDefault(require_extend());
const https_1 = __require("https");
const common_js_1$1 = require_common();
const retry_js_1 = require_retry();
const stream_1 = __require("stream");
const interceptor_js_1 = require_interceptor();
const randomUUID = async () => globalThis.crypto?.randomUUID() || (await import("crypto")).randomUUID();
const HTTP_STATUS_NO_CONTENT = 204;
var Gaxios = class {
agentCache = /* @__PURE__ */ new Map();
/**
* Default HTTP options that will be used for every HTTP request.
*/
defaults;
/**
* Interceptors
*/
interceptors;
/**
* The Gaxios class is responsible for making HTTP requests.
* @param defaults The default set of options to be used for this instance.
*/
constructor(defaults) {
this.defaults = defaults || {};
this.interceptors = {
request: new interceptor_js_1.GaxiosInterceptorManager(),
response: new interceptor_js_1.GaxiosInterceptorManager()
};
}
/**
* A {@link fetch `fetch`} compliant API for {@link Gaxios}.
*
* @remarks
*
* This is useful as a drop-in replacement for `fetch` API usage.
*
* @example
*
* ```ts
* const gaxios = new Gaxios();
* const myFetch: typeof fetch = (...args) => gaxios.fetch(...args);
* await myFetch('https://example.com');
* ```
*
* @param args `fetch` API or `Gaxios#request` parameters
* @returns the {@link Response} with Gaxios-added properties
*/
fetch(...args) {
const input = args[0];
const init = args[1];
let url = void 0;
const headers = new Headers();
if (typeof input === "string") url = new URL(input);
else if (input instanceof URL) url = input;
else if (input && input.url) url = new URL(input.url);
if (input && typeof input === "object" && "headers" in input) _a.mergeHeaders(headers, input.headers);
if (init) _a.mergeHeaders(headers, new Headers(init.headers));
if (typeof input === "object" && !(input instanceof URL)) return this.request({
...init,
...input,
headers,
url
});
else return this.request({
...init,
headers,
url
});
}
/**
* Perform an HTTP request with the given options.
* @param opts Set of HTTP options that will be used for this HTTP request.
*/
async request(opts = {}) {
let prepared = await this.#prepareRequest(opts);
prepared = await this.#applyRequestInterceptors(prepared);
return this.#applyResponseInterceptors(this._request(prepared));
}
async _defaultAdapter(config) {
const fetchImpl = config.fetchImplementation || this.defaults.fetchImplementation || await _a.#getFetch();
const preparedOpts = { ...config };
delete preparedOpts.data;
const res = await fetchImpl(config.url, preparedOpts);
const data = await this.getResponseData(config, res);
if (!Object.getOwnPropertyDescriptor(res, "data")?.configurable) Object.defineProperties(res, { data: {
configurable: true,
writable: true,
enumerable: true,
value: data
} });
return Object.assign(res, {
config,
data
});
}
/**
* Internal, retryable version of the `request` method.
* @param opts Set of HTTP options that will be used for this HTTP request.
*/
async _request(opts) {
try {
let translatedResponse;
if (opts.adapter) translatedResponse = await opts.adapter(opts, this._defaultAdapter.bind(this));
else translatedResponse = await this._defaultAdapter(opts);
if (!opts.validateStatus(translatedResponse.status)) {
if (opts.responseType === "stream") {
const response = [];
for await (const chunk of translatedResponse.data) response.push(chunk);
translatedResponse.data = response.toString();
}
const errorInfo = common_js_1$1.GaxiosError.extractAPIErrorFromResponse(translatedResponse, `Request failed with status code ${translatedResponse.status}`);
throw new common_js_1$1.GaxiosError(errorInfo?.message, opts, translatedResponse, errorInfo);
}
return translatedResponse;
} catch (e) {
let err;
if (e instanceof common_js_1$1.GaxiosError) err = e;
else if (e instanceof Error) err = new common_js_1$1.GaxiosError(e.message, opts, void 0, e);
else err = new common_js_1$1.GaxiosError("Unexpected Gaxios Error", opts, void 0, e);
const { shouldRetry, config } = await (0, retry_js_1.getRetryConfig)(err);
if (shouldRetry && config) {
err.config.retryConfig.currentRetryAttempt = config.retryConfig.currentRetryAttempt;
opts.retryConfig = err.config?.retryConfig;
this.#appendTimeoutToSignal(opts);
return this._request(opts);
}
if (opts.errorRedactor) opts.errorRedactor(err);
throw err;
}
}
async getResponseData(opts, res) {
if (res.status === HTTP_STATUS_NO_CONTENT) return "";
if (opts.maxContentLength && res.headers.has("content-length") && opts.maxContentLength < Number.parseInt(res.headers?.get("content-length") || "")) throw new common_js_1$1.GaxiosError("Response's `Content-Length` is over the limit.", opts, Object.assign(res, { config: opts }));
switch (opts.responseType) {
case "stream": return res.body;
case "json": {
const data = await res.text();
try {
return JSON.parse(data);
} catch {
return data;
}
}
case "arraybuffer": return res.arrayBuffer();
case "blob": return res.blob();
case "text": return res.text();
default: return this.getResponseDataFromContentType(res);
}
}
#urlMayUseProxy(url, noProxy = []) {
const candidate = new URL(url);
const noProxyList = [...noProxy];
const noProxyEnvList = (process.env.NO_PROXY ?? process.env.no_proxy)?.split(",") || [];
for (const rule of noProxyEnvList) noProxyList.push(rule.trim());
for (const rule of noProxyList) if (rule instanceof RegExp) {
if (rule.test(candidate.toString())) return false;
} else if (rule instanceof URL) {
if (rule.origin === candidate.origin) return false;
} else if (rule.startsWith("*.") || rule.startsWith(".")) {
const cleanedRule = rule.replace(/^\*\./, ".");
if (candidate.hostname.endsWith(cleanedRule)) return false;
} else if (rule === candidate.origin || rule === candidate.hostname || rule === candidate.href) return false;
return true;
}
/**
* Applies the request interceptors. The request interceptors are applied after the
* call to prepareRequest is completed.
*
* @param {GaxiosOptionsPrepared} options The current set of options.
*
* @returns {Promise<GaxiosOptionsPrepared>} Promise that resolves to the set of options or response after interceptors are applied.
*/
async #applyRequestInterceptors(options) {
let promiseChain = Promise.resolve(options);
for (const interceptor of this.interceptors.request.values()) if (interceptor) promiseChain = promiseChain.then(interceptor.resolved, interceptor.rejected);
return promiseChain;
}
/**
* Applies the response interceptors. The response interceptors are applied after the
* call to request is made.
*
* @param {GaxiosOptionsPrepared} options The current set of options.
*
* @returns {Promise<GaxiosOptionsPrepared>} Promise that resolves to the set of options or response after interceptors are applied.
*/
async #applyResponseInterceptors(response) {
let promiseChain = Promise.resolve(response);
for (const interceptor of this.interceptors.response.values()) if (interceptor) promiseChain = promiseChain.then(interceptor.resolved, interceptor.rejected);
return promiseChain;
}
/**
* Validates the options, merges them with defaults, and prepare request.
*
* @param options The original options passed from the client.
* @returns Prepared options, ready to make a request
*/
async #prepareRequest(options) {
const preparedHeaders = new Headers(this.defaults.headers);
_a.mergeHeaders(preparedHeaders, options.headers);
const opts = (0, extend_1.default)(true, {}, this.defaults, options);
if (!opts.url) throw new Error("URL is required.");
if (opts.baseURL) opts.url = new URL(opts.url, opts.baseURL);
opts.url = new URL(opts.url);
if (opts.params) if (opts.paramsSerializer) {
let additionalQueryParams = opts.paramsSerializer(opts.params);
if (additionalQueryParams.startsWith("?")) additionalQueryParams = additionalQueryParams.slice(1);
const prefix = opts.url.toString().includes("?") ? "&" : "?";
opts.url = opts.url + prefix + additionalQueryParams;
} else {
const url = opts.url instanceof URL ? opts.url : new URL(opts.url);
for (const [key, value] of new URLSearchParams(opts.params)) url.searchParams.append(key, value);
opts.url = url;
}
if (typeof options.maxContentLength === "number") opts.size = options.maxContentLength;
if (typeof options.maxRedirects === "number") opts.follow = options.maxRedirects;
const shouldDirectlyPassData = typeof opts.data === "string" || opts.data instanceof ArrayBuffer || opts.data instanceof Blob || globalThis.File && opts.data instanceof File || opts.data instanceof FormData || opts.data instanceof stream_1.Readable || opts.data instanceof ReadableStream || opts.data instanceof String || opts.data instanceof URLSearchParams || ArrayBuffer.isView(opts.data) || [
"Blob",
"File",
"FormData"
].includes(opts.data?.constructor?.name || "");
if (opts.multipart?.length) {
const boundary = await randomUUID();
preparedHeaders.set("content-type", `multipart/related; boundary=${boundary}`);
opts.body = stream_1.Readable.from(this.getMultipartRequest(opts.multipart, boundary));
} else if (shouldDirectlyPassData) opts.body = opts.data;
else if (typeof opts.data === "object") if (preparedHeaders.get("Content-Type") === "application/x-www-form-urlencoded") opts.body = opts.paramsSerializer ? opts.paramsSerializer(opts.data) : new URLSearchParams(opts.data);
else {
if (!preparedHeaders.has("content-type")) preparedHeaders.set("content-type", "application/json");
opts.body = JSON.stringify(opts.data);
}
else if (opts.data) opts.body = opts.data;
opts.validateStatus = opts.validateStatus || this.validateStatus;
opts.responseType = opts.responseType || "unknown";
if (!preparedHeaders.has("accept") && opts.responseType === "json") preparedHeaders.set("accept", "application/json");
const proxy = opts.proxy || process?.env?.HTTPS_PROXY || process?.env?.https_proxy || process?.env?.HTTP_PROXY || process?.env?.http_proxy;
if (opts.agent) {} else if (proxy && this.#urlMayUseProxy(opts.url, opts.noProxy)) {
const HttpsProxyAgent = await _a.#getProxyAgent();
if (this.agentCache.has(proxy)) opts.agent = this.agentCache.get(proxy);
else {
opts.agent = new HttpsProxyAgent(proxy, {
cert: opts.cert,
key: opts.key
});
this.agentCache.set(proxy, opts.agent);
}
} else if (opts.cert && opts.key) if (this.agentCache.has(opts.key)) opts.agent = this.agentCache.get(opts.key);
else {
opts.agent = new https_1.Agent({
cert: opts.cert,
key: opts.key
});
this.agentCache.set(opts.key, opts.agent);
}
if (typeof opts.errorRedactor !== "function" && opts.errorRedactor !== false) opts.errorRedactor = common_js_1$1.defaultErrorRedactor;
if (opts.body && !("duplex" in opts))
/**
* required for Node.js and the type isn't available today
* @link https://github.com/nodejs/node/issues/46221
* @link https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1483
*/
opts.duplex = "half";
this.#appendTimeoutToSignal(opts);
return Object.assign(opts, {
headers: preparedHeaders,
url: opts.url instanceof URL ? opts.url : new URL(opts.url)
});
}
#appendTimeoutToSignal(opts) {
if (opts.timeout) {
const timeoutSignal = AbortSignal.timeout(opts.timeout);
if (opts.signal && !opts.signal.aborted) opts.signal = AbortSignal.any([opts.signal, timeoutSignal]);
else opts.signal = timeoutSignal;
}
}
/**
* By default, throw for any non-2xx status code
* @param status status code from the HTTP response
*/
validateStatus(status) {
return status >= 200 && status < 300;
}
/**
* Attempts to parse a response by looking at the Content-Type header.
* @param {Response} response the HTTP response.
* @returns a promise that resolves to the response data.
*/
async getResponseDataFromContentType(response) {
let contentType = response.headers.get("Content-Type");
if (contentType === null) return response.text();
contentType = contentType.toLowerCase();
if (contentType.includes("application/json")) {
let data = await response.text();
try {
data = JSON.parse(data);
} catch {}
return data;
} else if (contentType.match(/^text\//)) return response.text();
else return response.blob();
}
/**
* Creates an async generator that yields the pieces of a multipart/related request body.
* This implementation follows the spec: https://www.ietf.org/rfc/rfc2387.txt. However, recursive
* multipart/related requests are not currently supported.
*
* @param {GaxiosMultipartOptions[]} multipartOptions the pieces to turn into a multipart/related body.
* @param {string} boundary the boundary string to be placed between each part.
*/
async *getMultipartRequest(multipartOptions, boundary) {
const finale = `--${boundary}--`;
for (const currentPart of multipartOptions) {
yield `--${boundary}\r\nContent-Type: ${currentPart.headers.get("Content-Type") || "application/octet-stream"}\r\n\r\n`;
if (typeof currentPart.content === "string") yield currentPart.content;
else yield* currentPart.content;
yield "\r\n";
}
yield finale;
}
/**
* A cache for the lazily-loaded proxy agent.
*
* Should use {@link Gaxios[#getProxyAgent]} to retrieve.
*/
static #proxyAgent;
/**
* A cache for the lazily-loaded fetch library.
*
* Should use {@link Gaxios[#getFetch]} to retrieve.
*/
static #fetch;
/**
* Imports, caches, and returns a proxy agent - if not already imported
*
* @returns A proxy agent
*/
static async #getProxyAgent() {
this.#proxyAgent ||= (await import("../../../dist-CoWyqx7o.mjs").then(__toDynamicImportESM())).HttpsProxyAgent;
return this.#proxyAgent;
}
static async #getFetch() {
const hasWindow = typeof window !== "undefined" && !!window;
this.#fetch ||= hasWindow ? window.fetch : (await import("../../../src-CcmaYBjm.mjs")).default;
return this.#fetch;
}
/**
* Merges headers.
* If the base headers do not exist a new `Headers` object will be returned.
*
* @remarks
*
* Using this utility can be helpful when the headers are not known to exist:
* - if they exist as `Headers`, that instance will be used
* - it improves performance and allows users to use their existing references to their `Headers`
* - if they exist in another form (`HeadersInit`), they will be used to create a new `Headers` object
* - if the base headers do not exist a new `Headers` object will be created
*
* @param base headers to append/overwrite to
* @param append headers to append/overwrite with
* @returns the base headers instance with merged `Headers`
*/
static mergeHeaders(base, ...append) {
base = base instanceof Headers ? base : new Headers(base);
for (const headers of append) (headers instanceof Headers ? headers : new Headers(headers)).forEach((value, key) => {
key === "set-cookie" ? base.append(key, value) : base.set(key, value);
});
return base;
}
};
exports.Gaxios = Gaxios;
_a = Gaxios;
}) });
//#endregion
//#region node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/index.js
var require_src$4 = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/gaxios@7.1.3/node_modules/gaxios/build/cjs/src/index.js": ((exports) => {
var __createBinding$4 = exports && exports.__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 __exportStar$3 = exports && exports.__exportStar || function(m, exports$1) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding$4(exports$1, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.instance = exports.Gaxios = exports.GaxiosError = void 0;
exports.request = request;
const gaxios_js_1 = require_gaxios();
Object.defineProperty(exports, "Gaxios", {
enumerable: true,
get: function() {
return gaxios_js_1.Gaxios;
}
});
var common_js_1 = require_common();
Object.defineProperty(exports, "GaxiosError", {
enumerable: true,
get: function() {
return common_js_1.GaxiosError;
}
});
__exportStar$3(require_interceptor(), exports);
/**
* The default instance used when the `request` method is directly
* invoked.
*/
exports.instance = new gaxios_js_1.Gaxios();
/**
* Make an HTTP request using the given options.
* @param opts Options for the request
*/
async function request(opts) {
return exports.instance.request(opts);
}
}) });
//#endregion
//#region node_modules/.pnpm/bignumber.js@9.3.1/node_modules/bignumber.js/bignumber.js
var require_bignumber = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/bignumber.js@9.3.1/node_modules/bignumber.js/bignumber.js": ((exports, module) => {
(function(globalObject) {
var BigNumber$2, isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 0x5af3107a4000, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [
1,
10,
100,
1e3,
1e4,
1e5,
1e6,
1e7,
1e8,
1e9,
1e10,
1e11,
0xe8d4a51000,
0x9184e72a000
], SQRT_BASE = 1e7, MAX = 1e9;
function clone(configObject) {
var div, convertBase, parseNumeric, P = BigNumber$3.prototype = {
constructor: BigNumber$3,
toString: null,
valueOf: null
}, ONE = new BigNumber$3(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false