From bebbed856f3b85cfa2d38c68c3cfbd4d438b5d43 Mon Sep 17 00:00:00 2001 From: GPT10 <57486732+di-sukharev@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:03:05 +0300 Subject: [PATCH] v 3.0.17 (#366) --- README.md | 33 +- out/cli.cjs | 8162 +++++++++------- out/github-action.cjs | 8262 +++++++++-------- package-lock.json | 13 +- package.json | 8 +- src/commands/config.ts | 186 +- src/engine/anthropic.ts | 4 +- src/engine/azure.ts | 2 +- src/engine/gemini.ts | 133 + src/engine/ollama.ts | 2 - src/engine/openAi.ts | 7 +- src/engine/testAi.ts | 25 +- src/generateCommitMessageFromGitDiff.ts | 12 +- src/modules/commitlint/config.ts | 11 +- src/modules/commitlint/pwd-commitlint.ts | 53 +- src/modules/commitlint/utils.ts | 4 +- src/utils/engine.ts | 32 +- test/e2e/noChanges.test.ts | 1 - test/e2e/oneFile.test.ts | 1 - test/e2e/prompt-module/commitlint.test.ts | 224 + .../data/commitlint_18/commitlint.config.js | 3 + .../data/commitlint_18/package-lock.json | 2029 ++++ .../data/commitlint_18/package.json | 15 + .../data/commitlint_19/commitlint.config.js | 3 + .../data/commitlint_19/package-lock.json | 1453 +++ .../data/commitlint_19/package.json | 16 + .../data/commitlint_9/commitlint.config.js | 3 + .../data/commitlint_9/package-lock.json | 1671 ++++ .../data/commitlint_9/package.json | 15 + test/e2e/setup.sh | 11 + test/e2e/utils.ts | 2 + test/jest-setup.ts | 3 + test/unit/config.test.ts | 4 +- test/unit/gemini.test.ts | 105 + tsconfig.json | 10 +- 35 files changed, 15123 insertions(+), 7395 deletions(-) create mode 100644 src/engine/gemini.ts create mode 100644 test/e2e/prompt-module/commitlint.test.ts create mode 100644 test/e2e/prompt-module/data/commitlint_18/commitlint.config.js create mode 100644 test/e2e/prompt-module/data/commitlint_18/package-lock.json create mode 100644 test/e2e/prompt-module/data/commitlint_18/package.json create mode 100644 test/e2e/prompt-module/data/commitlint_19/commitlint.config.js create mode 100644 test/e2e/prompt-module/data/commitlint_19/package-lock.json create mode 100644 test/e2e/prompt-module/data/commitlint_19/package.json create mode 100644 test/e2e/prompt-module/data/commitlint_9/commitlint.config.js create mode 100644 test/e2e/prompt-module/data/commitlint_9/package-lock.json create mode 100644 test/e2e/prompt-module/data/commitlint_9/package.json create mode 100755 test/e2e/setup.sh create mode 100644 test/unit/gemini.test.ts diff --git a/README.md b/README.md index b97d974..92c5984 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ git add oco ``` -Link to the GitMoji specification: https://gitmoji.dev/ +### Running locally with Ollama You can also run it with local model through ollama: @@ -70,12 +70,20 @@ You can also run it with local model through ollama: git add OCO_AI_PROVIDER='ollama' opencommit ``` + +If you want to use a model other than mistral, you can do so by setting the `OCO_AI_PROVIDER` environment variable as follows: + +```sh +OCO_AI_PROVIDER='ollama/llama3:8b' opencommit +``` + if you have ollama that is set up in docker/ on another machine with GPUs (not locally), you can change the default endpoint url. You can do so by setting the `OCO_OLLAMA_API_URL` environment variable as follows: ```sh OCO_OLLAMA_API_URL='http://192.168.1.10:11434/api/chat' opencommit ``` + where 192.168.1.10 is example of endpoint URL, where you have ollama set up. ### Flags @@ -84,6 +92,8 @@ There are multiple optional flags that can be used with the `oco` command: #### Use Full GitMoji Specification +Link to the GitMoji specification: https://gitmoji.dev/ + This flag can only be used if the `OCO_EMOJI` configuration item is set to `true`. This flag allows users to use all emojis in the GitMoji specification, By default, the GitMoji full specification is set to `false`, which only includes 10 emojis (🐛✨📝🚀✅♻️⬆️🔧🌐💡). This is due to limit the number of tokens sent in each request. However, if you would like to use the full GitMoji specification, you can use the `--fgm` flag. @@ -112,11 +122,12 @@ OCO_TOKENS_MAX_OUTPUT= OCO_OPENAI_BASE_PATH= OCO_DESCRIPTION= OCO_EMOJI= -OCO_MODEL= +OCO_MODEL= OCO_LANGUAGE= OCO_MESSAGE_TEMPLATE_PLACEHOLDER= OCO_PROMPT_MODULE= OCO_ONE_LINE_COMMIT= +OCO_AI_PROVIDER= ``` ### Global config for all repos @@ -126,7 +137,7 @@ Local config still has more priority than Global config, but you may set `OCO_MO Simply set any of the variables above like this: ```sh -oco config set OCO_MODEL=gpt-4 +oco config set OCO_MODEL=gpt-4o ``` Configure [GitMoji](https://gitmoji.dev/) to preface a message. @@ -143,7 +154,7 @@ oco config set OCO_EMOJI=false ### Switch to GPT-4 or other models -By default, OpenCommit uses `gpt-3.5-turbo` model. +By default, OpenCommit uses `gpt-4o` model. You may switch to GPT-4 which performs better, but costs ~x15 times more 🤠 @@ -154,17 +165,9 @@ oco config set OCO_MODEL=gpt-4 or for as a cheaper option: ```sh -oco config set OCO_MODEL=gpt-3.5-turbo +oco config set OCO_MODEL=gpt-4o-mini ``` -or for GPT-4 Turbo (Preview) which is more capable, has knowledge of world events up to April 2023, a 128k context window and 2-3x cheaper vs GPT-4: - -```sh -oco config set OCO_MODEL=gpt-4-0125-preview -``` - -Make sure that you spell it `gpt-4` (lowercase) and that you have API access to the 4th model. Even if you have ChatGPT+, that doesn't necessarily mean that you have API access to GPT-4. - ### Switch to Azure OpenAI By default OpenCommit uses [OpenAI](https://openai.com). @@ -220,7 +223,7 @@ Replace `` with either `conventional-commit` or `@commitlint`. #### Example: -To switch to using th` '@commitlint` prompt module, run: +To switch to using the `'@commitlint` prompt module, run: ```sh oco config set OCO_PROMPT_MODULE=@commitlint @@ -388,7 +391,7 @@ jobs: OCO_OPENAI_BASE_PATH: '' OCO_DESCRIPTION: false OCO_EMOJI: false - OCO_MODEL: gpt-3.5-turbo + OCO_MODEL: gpt-4o OCO_LANGUAGE: en OCO_PROMPT_MODULE: conventional-commit ``` diff --git a/out/cli.cjs b/out/cli.cjs index 6570746..2b9eeba 100755 --- a/out/cli.cjs +++ b/out/cli.cjs @@ -34,7 +34,7 @@ var require_windows = __commonJS({ "node_modules/isexe/windows.js"(exports, module2) { module2.exports = isexe; isexe.sync = sync; - var fs5 = require("fs"); + var fs6 = require("fs"); function checkPathExt(path5, options) { var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT; if (!pathext) { @@ -59,12 +59,12 @@ var require_windows = __commonJS({ return checkPathExt(path5, options); } function isexe(path5, options, cb) { - fs5.stat(path5, function(er2, stat) { + fs6.stat(path5, function(er2, stat) { cb(er2, er2 ? false : checkStat(stat, path5, options)); }); } function sync(path5, options) { - return checkStat(fs5.statSync(path5), path5, options); + return checkStat(fs6.statSync(path5), path5, options); } } }); @@ -74,14 +74,14 @@ var require_mode = __commonJS({ "node_modules/isexe/mode.js"(exports, module2) { module2.exports = isexe; isexe.sync = sync; - var fs5 = require("fs"); + var fs6 = require("fs"); function isexe(path5, options, cb) { - fs5.stat(path5, function(er2, stat) { + fs6.stat(path5, function(er2, stat) { cb(er2, er2 ? false : checkStat(stat, options)); }); } function sync(path5, options) { - return checkStat(fs5.statSync(path5), options); + return checkStat(fs6.statSync(path5), options); } function checkStat(stat, options) { return stat.isFile() && checkMode(stat, options); @@ -105,7 +105,7 @@ var require_mode = __commonJS({ // node_modules/isexe/index.js var require_isexe = __commonJS({ "node_modules/isexe/index.js"(exports, module2) { - var fs5 = require("fs"); + var fs6 = require("fs"); var core; if (process.platform === "win32" || global.TESTING_WINDOWS) { core = require_windows(); @@ -367,16 +367,16 @@ var require_shebang_command = __commonJS({ var require_readShebang = __commonJS({ "node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) { "use strict"; - var fs5 = require("fs"); + var fs6 = require("fs"); var shebangCommand = require_shebang_command(); function readShebang(command4) { const size = 150; const buffer = Buffer.alloc(size); let fd; try { - fd = fs5.openSync(command4, "r"); - fs5.readSync(fd, buffer, 0, size, 0); - fs5.closeSync(fd); + fd = fs6.openSync(command4, "r"); + fs6.readSync(fd, buffer, 0, size, 0); + fs6.closeSync(fd); } catch (e3) { } return shebangCommand(buffer.toString()); @@ -14177,7 +14177,7 @@ var require_form_data = __commonJS({ var http3 = require("http"); var https3 = require("https"); var parseUrl = require("url").parse; - var fs5 = require("fs"); + var fs6 = require("fs"); var Stream2 = require("stream").Stream; var mime = require_mime_types(); var asynckit = require_asynckit(); @@ -14242,7 +14242,7 @@ var require_form_data = __commonJS({ if (value.end != void 0 && value.end != Infinity && value.start != void 0) { callback(null, value.end + 1 - (value.start ? value.start : 0)); } else { - fs5.stat(value.path, function(err, stat) { + fs6.stat(value.path, function(err, stat) { var fileSize; if (err) { callback(err); @@ -14618,7 +14618,7 @@ var require_package2 = __commonJS({ // node_modules/dotenv/lib/main.js var require_main = __commonJS({ "node_modules/dotenv/lib/main.js"(exports, module2) { - var fs5 = require("fs"); + var fs6 = require("fs"); var path5 = require("path"); var os4 = require("os"); var crypto2 = require("crypto"); @@ -14725,7 +14725,7 @@ var require_main = __commonJS({ if (options && options.path && options.path.length > 0) { if (Array.isArray(options.path)) { for (const filepath of options.path) { - if (fs5.existsSync(filepath)) { + if (fs6.existsSync(filepath)) { possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`; } } @@ -14735,7 +14735,7 @@ var require_main = __commonJS({ } else { possibleVaultPath = path5.resolve(process.cwd(), ".env.vault"); } - if (fs5.existsSync(possibleVaultPath)) { + if (fs6.existsSync(possibleVaultPath)) { return possibleVaultPath; } return null; @@ -14779,7 +14779,7 @@ var require_main = __commonJS({ const parsedAll = {}; for (const path6 of optionPaths) { try { - const parsed = DotenvModule.parse(fs5.readFileSync(path6, { encoding })); + const parsed = DotenvModule.parse(fs6.readFileSync(path6, { encoding })); DotenvModule.populate(parsedAll, parsed, options); } catch (e3) { if (debug2) { @@ -15569,7 +15569,7 @@ var require_tiktoken = __commonJS({ var imports = {}; imports["./tiktoken_bg.js"] = wasm; var path5 = require("path"); - var fs5 = require("fs"); + var fs6 = require("fs"); var candidates = __dirname.split(path5.sep).reduce((memo, _7, index, array) => { const prefix = array.slice(0, index + 1).join(path5.sep) + path5.sep; if (!prefix.includes("node_modules" + path5.sep)) { @@ -15589,7 +15589,7 @@ var require_tiktoken = __commonJS({ var bytes = null; for (const candidate of candidates) { try { - bytes = fs5.readFileSync(candidate); + bytes = fs6.readFileSync(candidate); break; } catch { } @@ -15603,1181 +15603,6 @@ var require_tiktoken = __commonJS({ } }); -// node_modules/tslib/tslib.js -var require_tslib = __commonJS({ - "node_modules/tslib/tslib.js"(exports, module2) { - var __extends2; - var __assign2; - var __rest2; - var __decorate2; - var __param2; - var __esDecorate2; - var __runInitializers2; - var __propKey2; - var __setFunctionName2; - var __metadata2; - var __awaiter2; - var __generator2; - var __exportStar2; - var __values2; - var __read2; - var __spread2; - var __spreadArrays2; - var __spreadArray2; - var __await2; - var __asyncGenerator2; - var __asyncDelegator2; - var __asyncValues2; - var __makeTemplateObject2; - var __importStar2; - var __importDefault2; - var __classPrivateFieldGet9; - var __classPrivateFieldSet8; - var __classPrivateFieldIn2; - var __createBinding2; - var __addDisposableResource2; - var __disposeResources2; - (function(factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function(exports2) { - factory(createExporter(root, createExporter(exports2))); - }); - } else if (typeof module2 === "object" && typeof module2.exports === "object") { - factory(createExporter(root, createExporter(module2.exports))); - } else { - factory(createExporter(root)); - } - function createExporter(exports2, previous) { - if (exports2 !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports2, "__esModule", { value: true }); - } else { - exports2.__esModule = true; - } - } - return function(id, v5) { - return exports2[id] = previous ? previous(id, v5) : v5; - }; - } - })(function(exporter) { - var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d7, b7) { - d7.__proto__ = b7; - } || function(d7, b7) { - for (var p4 in b7) - if (Object.prototype.hasOwnProperty.call(b7, p4)) - d7[p4] = b7[p4]; - }; - __extends2 = function(d7, b7) { - if (typeof b7 !== "function" && b7 !== null) - throw new TypeError("Class extends value " + String(b7) + " is not a constructor or null"); - extendStatics(d7, b7); - function __() { - this.constructor = d7; - } - d7.prototype = b7 === null ? Object.create(b7) : (__.prototype = b7.prototype, new __()); - }; - __assign2 = Object.assign || function(t2) { - for (var s2, i3 = 1, n2 = arguments.length; i3 < n2; i3++) { - s2 = arguments[i3]; - for (var p4 in s2) - if (Object.prototype.hasOwnProperty.call(s2, p4)) - t2[p4] = s2[p4]; - } - return t2; - }; - __rest2 = function(s2, e3) { - var t2 = {}; - for (var p4 in s2) - if (Object.prototype.hasOwnProperty.call(s2, p4) && e3.indexOf(p4) < 0) - t2[p4] = s2[p4]; - if (s2 != null && typeof Object.getOwnPropertySymbols === "function") - for (var i3 = 0, p4 = Object.getOwnPropertySymbols(s2); i3 < p4.length; i3++) { - if (e3.indexOf(p4[i3]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p4[i3])) - t2[p4[i3]] = s2[p4[i3]]; - } - return t2; - }; - __decorate2 = function(decorators, target, key, desc) { - var c3 = arguments.length, r3 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d7; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") - r3 = Reflect.decorate(decorators, target, key, desc); - else - for (var i3 = decorators.length - 1; i3 >= 0; i3--) - if (d7 = decorators[i3]) - r3 = (c3 < 3 ? d7(r3) : c3 > 3 ? d7(target, key, r3) : d7(target, key)) || r3; - return c3 > 3 && r3 && Object.defineProperty(target, key, r3), r3; - }; - __param2 = function(paramIndex, decorator) { - return function(target, key) { - decorator(target, key, paramIndex); - }; - }; - __esDecorate2 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f4) { - if (f4 !== void 0 && typeof f4 !== "function") - throw new TypeError("Function expected"); - return f4; - } - var kind2 = contextIn.kind, key = kind2 === "getter" ? "get" : kind2 === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _7, done = false; - for (var i3 = decorators.length - 1; i3 >= 0; i3--) { - var context = {}; - for (var p4 in contextIn) - context[p4] = p4 === "access" ? {} : contextIn[p4]; - for (var p4 in contextIn.access) - context.access[p4] = contextIn.access[p4]; - context.addInitializer = function(f4) { - if (done) - throw new TypeError("Cannot add initializers after decoration has completed"); - extraInitializers.push(accept(f4 || null)); - }; - var result = (0, decorators[i3])(kind2 === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind2 === "accessor") { - if (result === void 0) - continue; - if (result === null || typeof result !== "object") - throw new TypeError("Object expected"); - if (_7 = accept(result.get)) - descriptor.get = _7; - if (_7 = accept(result.set)) - descriptor.set = _7; - if (_7 = accept(result.init)) - initializers.unshift(_7); - } else if (_7 = accept(result)) { - if (kind2 === "field") - initializers.unshift(_7); - else - descriptor[key] = _7; - } - } - if (target) - Object.defineProperty(target, contextIn.name, descriptor); - done = true; - }; - __runInitializers2 = function(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i3 = 0; i3 < initializers.length; i3++) { - value = useValue ? initializers[i3].call(thisArg, value) : initializers[i3].call(thisArg); - } - return useValue ? value : void 0; - }; - __propKey2 = function(x5) { - return typeof x5 === "symbol" ? x5 : "".concat(x5); - }; - __setFunctionName2 = function(f4, name, prefix) { - if (typeof name === "symbol") - name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f4, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - }; - __metadata2 = function(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") - return Reflect.metadata(metadataKey, metadataValue); - }; - __awaiter2 = function(thisArg, _arguments, P4, generator) { - function adopt(value) { - return value instanceof P4 ? value : new P4(function(resolve) { - resolve(value); - }); - } - return new (P4 || (P4 = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e3) { - reject(e3); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e3) { - reject(e3); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - __generator2 = function(thisArg, body) { - var _7 = { label: 0, sent: function() { - if (t2[0] & 1) - throw t2[1]; - return t2[1]; - }, trys: [], ops: [] }, f4, y6, t2, g4; - return g4 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g4[Symbol.iterator] = function() { - return this; - }), g4; - function verb(n2) { - return function(v5) { - return step([n2, v5]); - }; - } - function step(op) { - if (f4) - throw new TypeError("Generator is already executing."); - while (g4 && (g4 = 0, op[0] && (_7 = 0)), _7) - try { - if (f4 = 1, y6 && (t2 = op[0] & 2 ? y6["return"] : op[0] ? y6["throw"] || ((t2 = y6["return"]) && t2.call(y6), 0) : y6.next) && !(t2 = t2.call(y6, op[1])).done) - return t2; - if (y6 = 0, t2) - op = [op[0] & 2, t2.value]; - switch (op[0]) { - case 0: - case 1: - t2 = op; - break; - case 4: - _7.label++; - return { value: op[1], done: false }; - case 5: - _7.label++; - y6 = op[1]; - op = [0]; - continue; - case 7: - op = _7.ops.pop(); - _7.trys.pop(); - continue; - default: - if (!(t2 = _7.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _7 = 0; - continue; - } - if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { - _7.label = op[1]; - break; - } - if (op[0] === 6 && _7.label < t2[1]) { - _7.label = t2[1]; - t2 = op; - break; - } - if (t2 && _7.label < t2[2]) { - _7.label = t2[2]; - _7.ops.push(op); - break; - } - if (t2[2]) - _7.ops.pop(); - _7.trys.pop(); - continue; - } - op = body.call(thisArg, _7); - } catch (e3) { - op = [6, e3]; - y6 = 0; - } finally { - f4 = t2 = 0; - } - if (op[0] & 5) - throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - __exportStar2 = function(m5, o3) { - for (var p4 in m5) - if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(o3, p4)) - __createBinding2(o3, m5, p4); - }; - __createBinding2 = Object.create ? function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - var desc = Object.getOwnPropertyDescriptor(m5, k7); - if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m5[k7]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - o3[k22] = m5[k7]; - }; - __values2 = function(o3) { - var s2 = typeof Symbol === "function" && Symbol.iterator, m5 = s2 && o3[s2], i3 = 0; - if (m5) - return m5.call(o3); - if (o3 && typeof o3.length === "number") - return { - next: function() { - if (o3 && i3 >= o3.length) - o3 = void 0; - return { value: o3 && o3[i3++], done: !o3 }; - } - }; - throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - __read2 = function(o3, n2) { - var m5 = typeof Symbol === "function" && o3[Symbol.iterator]; - if (!m5) - return o3; - var i3 = m5.call(o3), r3, ar2 = [], e3; - try { - while ((n2 === void 0 || n2-- > 0) && !(r3 = i3.next()).done) - ar2.push(r3.value); - } catch (error) { - e3 = { error }; - } finally { - try { - if (r3 && !r3.done && (m5 = i3["return"])) - m5.call(i3); - } finally { - if (e3) - throw e3.error; - } - } - return ar2; - }; - __spread2 = function() { - for (var ar2 = [], i3 = 0; i3 < arguments.length; i3++) - ar2 = ar2.concat(__read2(arguments[i3])); - return ar2; - }; - __spreadArrays2 = function() { - for (var s2 = 0, i3 = 0, il = arguments.length; i3 < il; i3++) - s2 += arguments[i3].length; - for (var r3 = Array(s2), k7 = 0, i3 = 0; i3 < il; i3++) - for (var a4 = arguments[i3], j4 = 0, jl = a4.length; j4 < jl; j4++, k7++) - r3[k7] = a4[j4]; - return r3; - }; - __spreadArray2 = function(to, from, pack) { - if (pack || arguments.length === 2) - for (var i3 = 0, l3 = from.length, ar2; i3 < l3; i3++) { - if (ar2 || !(i3 in from)) { - if (!ar2) - ar2 = Array.prototype.slice.call(from, 0, i3); - ar2[i3] = from[i3]; - } - } - return to.concat(ar2 || Array.prototype.slice.call(from)); - }; - __await2 = function(v5) { - return this instanceof __await2 ? (this.v = v5, this) : new __await2(v5); - }; - __asyncGenerator2 = function(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var g4 = generator.apply(thisArg, _arguments || []), i3, q6 = []; - return i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { - return this; - }, i3; - function verb(n2) { - if (g4[n2]) - i3[n2] = function(v5) { - return new Promise(function(a4, b7) { - q6.push([n2, v5, a4, b7]) > 1 || resume(n2, v5); - }); - }; - } - function resume(n2, v5) { - try { - step(g4[n2](v5)); - } catch (e3) { - settle2(q6[0][3], e3); - } - } - function step(r3) { - r3.value instanceof __await2 ? Promise.resolve(r3.value.v).then(fulfill, reject) : settle2(q6[0][2], r3); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle2(f4, v5) { - if (f4(v5), q6.shift(), q6.length) - resume(q6[0][0], q6[0][1]); - } - }; - __asyncDelegator2 = function(o3) { - var i3, p4; - return i3 = {}, verb("next"), verb("throw", function(e3) { - throw e3; - }), verb("return"), i3[Symbol.iterator] = function() { - return this; - }, i3; - function verb(n2, f4) { - i3[n2] = o3[n2] ? function(v5) { - return (p4 = !p4) ? { value: __await2(o3[n2](v5)), done: false } : f4 ? f4(v5) : v5; - } : f4; - } - }; - __asyncValues2 = function(o3) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var m5 = o3[Symbol.asyncIterator], i3; - return m5 ? m5.call(o3) : (o3 = typeof __values2 === "function" ? __values2(o3) : o3[Symbol.iterator](), i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { - return this; - }, i3); - function verb(n2) { - i3[n2] = o3[n2] && function(v5) { - return new Promise(function(resolve, reject) { - v5 = o3[n2](v5), settle2(resolve, reject, v5.done, v5.value); - }); - }; - } - function settle2(resolve, reject, d7, v5) { - Promise.resolve(v5).then(function(v6) { - resolve({ value: v6, done: d7 }); - }, reject); - } - }; - __makeTemplateObject2 = function(cooked, raw) { - if (Object.defineProperty) { - Object.defineProperty(cooked, "raw", { value: raw }); - } else { - cooked.raw = raw; - } - return cooked; - }; - var __setModuleDefault = Object.create ? function(o3, v5) { - Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); - } : function(o3, v5) { - o3["default"] = v5; - }; - __importStar2 = function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k7 in mod) - if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) - __createBinding2(result, mod, k7); - } - __setModuleDefault(result, mod); - return result; - }; - __importDefault2 = function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - __classPrivateFieldGet9 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); - }; - __classPrivateFieldSet8 = function(receiver, state2, value, kind2, f4) { - if (kind2 === "m") - throw new TypeError("Private method is not writable"); - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; - }; - __classPrivateFieldIn2 = function(state2, receiver) { - if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") - throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state2 === "function" ? receiver === state2 : state2.has(receiver); - }; - __addDisposableResource2 = function(env2, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") - throw new TypeError("Object expected."); - var dispose; - if (async) { - if (!Symbol.asyncDispose) - throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) - throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - } - if (typeof dispose !== "function") - throw new TypeError("Object not disposable."); - env2.stack.push({ value, dispose, async }); - } else if (async) { - env2.stack.push({ async: true }); - } - return value; - }; - var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { - var e3 = new Error(message); - return e3.name = "SuppressedError", e3.error = error, e3.suppressed = suppressed, e3; - }; - __disposeResources2 = function(env2) { - function fail(e3) { - env2.error = env2.hasError ? new _SuppressedError(e3, env2.error, "An error was suppressed during disposal.") : e3; - env2.hasError = true; - } - function next() { - while (env2.stack.length) { - var rec = env2.stack.pop(); - try { - var result = rec.dispose && rec.dispose.call(rec.value); - if (rec.async) - return Promise.resolve(result).then(next, function(e3) { - fail(e3); - return next(); - }); - } catch (e3) { - fail(e3); - } - } - if (env2.hasError) - throw env2.error; - } - return next(); - }; - exporter("__extends", __extends2); - exporter("__assign", __assign2); - exporter("__rest", __rest2); - exporter("__decorate", __decorate2); - exporter("__param", __param2); - exporter("__esDecorate", __esDecorate2); - exporter("__runInitializers", __runInitializers2); - exporter("__propKey", __propKey2); - exporter("__setFunctionName", __setFunctionName2); - exporter("__metadata", __metadata2); - exporter("__awaiter", __awaiter2); - exporter("__generator", __generator2); - exporter("__exportStar", __exportStar2); - exporter("__createBinding", __createBinding2); - exporter("__values", __values2); - exporter("__read", __read2); - exporter("__spread", __spread2); - exporter("__spreadArrays", __spreadArrays2); - exporter("__spreadArray", __spreadArray2); - exporter("__await", __await2); - exporter("__asyncGenerator", __asyncGenerator2); - exporter("__asyncDelegator", __asyncDelegator2); - exporter("__asyncValues", __asyncValues2); - exporter("__makeTemplateObject", __makeTemplateObject2); - exporter("__importStar", __importStar2); - exporter("__importDefault", __importDefault2); - exporter("__classPrivateFieldGet", __classPrivateFieldGet9); - exporter("__classPrivateFieldSet", __classPrivateFieldSet8); - exporter("__classPrivateFieldIn", __classPrivateFieldIn2); - exporter("__addDisposableResource", __addDisposableResource2); - exporter("__disposeResources", __disposeResources2); - }); - } -}); - -// node_modules/agent-base/dist/helpers.js -var require_helpers = __commonJS({ - "node_modules/agent-base/dist/helpers.js"(exports) { - "use strict"; - var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - var desc = Object.getOwnPropertyDescriptor(m5, k7); - if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m5[k7]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - o3[k22] = m5[k7]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v5) { - Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); - } : function(o3, v5) { - o3["default"] = v5; - }); - var __importStar2 = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k7 in mod) - if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) - __createBinding2(result, mod, k7); - } - __setModuleDefault(result, mod); - return result; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.req = exports.json = exports.toBuffer = void 0; - var http3 = __importStar2(require("http")); - var https3 = __importStar2(require("https")); - async function toBuffer(stream4) { - let length = 0; - const chunks = []; - for await (const chunk of stream4) { - length += chunk.length; - chunks.push(chunk); - } - return Buffer.concat(chunks, length); - } - exports.toBuffer = toBuffer; - async function json(stream4) { - const buf = await toBuffer(stream4); - const str = buf.toString("utf8"); - try { - return JSON.parse(str); - } catch (_err) { - const err = _err; - err.message += ` (input: ${str})`; - throw err; - } - } - exports.json = json; - function req(url2, opts = {}) { - const href = typeof url2 === "string" ? url2 : url2.href; - const req2 = (href.startsWith("https:") ? https3 : http3).request(url2, opts); - const promise = new Promise((resolve, reject) => { - req2.once("response", resolve).once("error", reject).end(); - }); - req2.then = promise.then.bind(promise); - return req2; - } - exports.req = req; - } -}); - -// node_modules/agent-base/dist/index.js -var require_dist2 = __commonJS({ - "node_modules/agent-base/dist/index.js"(exports) { - "use strict"; - var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - var desc = Object.getOwnPropertyDescriptor(m5, k7); - if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m5[k7]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - o3[k22] = m5[k7]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v5) { - Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); - } : function(o3, v5) { - o3["default"] = v5; - }); - var __importStar2 = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k7 in mod) - if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) - __createBinding2(result, mod, k7); - } - __setModuleDefault(result, mod); - return result; - }; - var __exportStar2 = exports && exports.__exportStar || function(m5, exports2) { - for (var p4 in m5) - if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p4)) - __createBinding2(exports2, m5, p4); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Agent = void 0; - var net = __importStar2(require("net")); - var http3 = __importStar2(require("http")); - var https_1 = require("https"); - __exportStar2(require_helpers(), exports); - var INTERNAL = Symbol("AgentBaseInternalState"); - var Agent3 = class extends http3.Agent { - constructor(opts) { - super(opts); - this[INTERNAL] = {}; - } - isSecureEndpoint(options) { - if (options) { - if (typeof options.secureEndpoint === "boolean") { - return options.secureEndpoint; - } - if (typeof options.protocol === "string") { - return options.protocol === "https:"; - } - } - const { stack } = new Error(); - if (typeof stack !== "string") - return false; - return stack.split("\n").some((l3) => l3.indexOf("(https.js:") !== -1 || l3.indexOf("node:https:") !== -1); - } - incrementSockets(name) { - if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) { - return null; - } - if (!this.sockets[name]) { - this.sockets[name] = []; - } - const fakeSocket = new net.Socket({ writable: false }); - this.sockets[name].push(fakeSocket); - this.totalSocketCount++; - return fakeSocket; - } - decrementSockets(name, socket) { - if (!this.sockets[name] || socket === null) { - return; - } - const sockets = this.sockets[name]; - const index = sockets.indexOf(socket); - if (index !== -1) { - sockets.splice(index, 1); - this.totalSocketCount--; - if (sockets.length === 0) { - delete this.sockets[name]; - } - } - } - getName(options) { - const secureEndpoint = typeof options.secureEndpoint === "boolean" ? options.secureEndpoint : this.isSecureEndpoint(options); - if (secureEndpoint) { - return https_1.Agent.prototype.getName.call(this, options); - } - return super.getName(options); - } - createSocket(req, options, cb) { - const connectOpts = { - ...options, - secureEndpoint: this.isSecureEndpoint(options) - }; - const name = this.getName(connectOpts); - const fakeSocket = this.incrementSockets(name); - Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => { - this.decrementSockets(name, fakeSocket); - if (socket instanceof http3.Agent) { - return socket.addRequest(req, connectOpts); - } - this[INTERNAL].currentSocket = socket; - super.createSocket(req, options, cb); - }, (err) => { - this.decrementSockets(name, fakeSocket); - cb(err); - }); - } - createConnection() { - const socket = this[INTERNAL].currentSocket; - this[INTERNAL].currentSocket = void 0; - if (!socket) { - throw new Error("No socket was returned in the `connect()` function"); - } - return socket; - } - get defaultPort() { - return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80); - } - set defaultPort(v5) { - if (this[INTERNAL]) { - this[INTERNAL].defaultPort = v5; - } - } - get protocol() { - return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:"); - } - set protocol(v5) { - if (this[INTERNAL]) { - this[INTERNAL].protocol = v5; - } - } - }; - exports.Agent = Agent3; - } -}); - -// node_modules/https-proxy-agent/dist/parse-proxy-response.js -var require_parse_proxy_response = __commonJS({ - "node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) { - "use strict"; - var __importDefault2 = exports && exports.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.parseProxyResponse = void 0; - var debug_1 = __importDefault2(require_src2()); - var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response"); - function parseProxyResponse(socket) { - return new Promise((resolve, reject) => { - let buffersLength = 0; - const buffers = []; - function read() { - const b7 = socket.read(); - if (b7) - ondata(b7); - else - socket.once("readable", read); - } - function cleanup() { - socket.removeListener("end", onend); - socket.removeListener("error", onerror); - socket.removeListener("readable", read); - } - function onend() { - cleanup(); - debug2("onend"); - reject(new Error("Proxy connection ended before receiving CONNECT response")); - } - function onerror(err) { - cleanup(); - debug2("onerror %o", err); - reject(err); - } - function ondata(b7) { - buffers.push(b7); - buffersLength += b7.length; - const buffered = Buffer.concat(buffers, buffersLength); - const endOfHeaders = buffered.indexOf("\r\n\r\n"); - if (endOfHeaders === -1) { - debug2("have not received end of HTTP headers yet..."); - read(); - return; - } - const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n"); - const firstLine = headerParts.shift(); - if (!firstLine) { - socket.destroy(); - return reject(new Error("No header received from proxy CONNECT response")); - } - const firstLineParts = firstLine.split(" "); - const statusCode = +firstLineParts[1]; - const statusText = firstLineParts.slice(2).join(" "); - const headers = {}; - for (const header of headerParts) { - if (!header) - continue; - const firstColon = header.indexOf(":"); - if (firstColon === -1) { - socket.destroy(); - return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`)); - } - const key = header.slice(0, firstColon).toLowerCase(); - const value = header.slice(firstColon + 1).trimStart(); - const current = headers[key]; - if (typeof current === "string") { - headers[key] = [current, value]; - } else if (Array.isArray(current)) { - current.push(value); - } else { - headers[key] = value; - } - } - debug2("got proxy server response: %o %o", firstLine, headers); - cleanup(); - resolve({ - connect: { - statusCode, - statusText, - headers - }, - buffered - }); - } - socket.on("error", onerror); - socket.on("end", onend); - read(); - }); - } - exports.parseProxyResponse = parseProxyResponse; - } -}); - -// node_modules/https-proxy-agent/dist/index.js -var require_dist3 = __commonJS({ - "node_modules/https-proxy-agent/dist/index.js"(exports) { - "use strict"; - var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - var desc = Object.getOwnPropertyDescriptor(m5, k7); - if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m5[k7]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - o3[k22] = m5[k7]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v5) { - Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); - } : function(o3, v5) { - o3["default"] = v5; - }); - var __importStar2 = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k7 in mod) - if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) - __createBinding2(result, mod, k7); - } - __setModuleDefault(result, mod); - return result; - }; - var __importDefault2 = exports && exports.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.HttpsProxyAgent = void 0; - var net = __importStar2(require("net")); - var tls = __importStar2(require("tls")); - var assert_1 = __importDefault2(require("assert")); - var debug_1 = __importDefault2(require_src2()); - var agent_base_1 = require_dist2(); - var url_1 = require("url"); - var parse_proxy_response_1 = require_parse_proxy_response(); - var debug2 = (0, debug_1.default)("https-proxy-agent"); - var HttpsProxyAgent2 = class extends agent_base_1.Agent { - constructor(proxy, opts) { - super(opts); - this.options = { path: void 0 }; - this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy; - this.proxyHeaders = opts?.headers ?? {}; - debug2("Creating new HttpsProxyAgent instance: %o", this.proxy.href); - const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ""); - const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80; - this.connectOpts = { - ALPNProtocols: ["http/1.1"], - ...opts ? omit(opts, "headers") : null, - host, - port - }; - } - async connect(req, opts) { - const { proxy } = this; - if (!opts.host) { - throw new TypeError('No "host" provided'); - } - let socket; - if (proxy.protocol === "https:") { - debug2("Creating `tls.Socket`: %o", this.connectOpts); - const servername = this.connectOpts.servername || this.connectOpts.host; - socket = tls.connect({ - ...this.connectOpts, - servername: servername && net.isIP(servername) ? void 0 : servername - }); - } else { - debug2("Creating `net.Socket`: %o", this.connectOpts); - socket = net.connect(this.connectOpts); - } - const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders }; - const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host; - let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r -`; - if (proxy.username || proxy.password) { - const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; - headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`; - } - headers.Host = `${host}:${opts.port}`; - if (!headers["Proxy-Connection"]) { - headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close"; - } - for (const name of Object.keys(headers)) { - payload += `${name}: ${headers[name]}\r -`; - } - const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket); - socket.write(`${payload}\r -`); - const { connect, buffered } = await proxyResponsePromise; - req.emit("proxyConnect", connect); - this.emit("proxyConnect", connect, req); - if (connect.statusCode === 200) { - req.once("socket", resume); - if (opts.secureEndpoint) { - debug2("Upgrading socket connection to TLS"); - const servername = opts.servername || opts.host; - return tls.connect({ - ...omit(opts, "host", "path", "port"), - socket, - servername: net.isIP(servername) ? void 0 : servername - }); - } - return socket; - } - socket.destroy(); - const fakeSocket = new net.Socket({ writable: false }); - fakeSocket.readable = true; - req.once("socket", (s2) => { - debug2("Replaying proxy buffer for failed request"); - (0, assert_1.default)(s2.listenerCount("data") > 0); - s2.push(buffered); - s2.push(null); - }); - return fakeSocket; - } - }; - HttpsProxyAgent2.protocols = ["http", "https"]; - exports.HttpsProxyAgent = HttpsProxyAgent2; - function resume(socket) { - socket.resume(); - } - function omit(obj, ...keys) { - const ret = {}; - let key; - for (key in obj) { - if (!keys.includes(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - } -}); - -// node_modules/http-proxy-agent/dist/index.js -var require_dist4 = __commonJS({ - "node_modules/http-proxy-agent/dist/index.js"(exports) { - "use strict"; - var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - var desc = Object.getOwnPropertyDescriptor(m5, k7); - if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m5[k7]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m5, k7, k22) { - if (k22 === void 0) - k22 = k7; - o3[k22] = m5[k7]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v5) { - Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); - } : function(o3, v5) { - o3["default"] = v5; - }); - var __importStar2 = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k7 in mod) - if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) - __createBinding2(result, mod, k7); - } - __setModuleDefault(result, mod); - return result; - }; - var __importDefault2 = exports && exports.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.HttpProxyAgent = void 0; - var net = __importStar2(require("net")); - var tls = __importStar2(require("tls")); - var debug_1 = __importDefault2(require_src2()); - var events_1 = require("events"); - var agent_base_1 = require_dist2(); - var url_1 = require("url"); - var debug2 = (0, debug_1.default)("http-proxy-agent"); - var HttpProxyAgent2 = class extends agent_base_1.Agent { - constructor(proxy, opts) { - super(opts); - this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy; - this.proxyHeaders = opts?.headers ?? {}; - debug2("Creating new HttpProxyAgent instance: %o", this.proxy.href); - const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ""); - const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80; - this.connectOpts = { - ...opts ? omit(opts, "headers") : null, - host, - port - }; - } - addRequest(req, opts) { - req._header = null; - this.setRequestProps(req, opts); - super.addRequest(req, opts); - } - setRequestProps(req, opts) { - const { proxy } = this; - const protocol = opts.secureEndpoint ? "https:" : "http:"; - const hostname = req.getHeader("host") || "localhost"; - const base = `${protocol}//${hostname}`; - const url2 = new url_1.URL(req.path, base); - if (opts.port !== 80) { - url2.port = String(opts.port); - } - req.path = String(url2); - const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders }; - if (proxy.username || proxy.password) { - const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; - headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`; - } - if (!headers["Proxy-Connection"]) { - headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close"; - } - for (const name of Object.keys(headers)) { - const value = headers[name]; - if (value) { - req.setHeader(name, value); - } - } - } - async connect(req, opts) { - req._header = null; - if (!req.path.includes("://")) { - this.setRequestProps(req, opts); - } - let first; - let endOfHeaders; - debug2("Regenerating stored HTTP header string for request"); - req._implicitHeader(); - if (req.outputData && req.outputData.length > 0) { - debug2("Patching connection write() output buffer with updated header"); - first = req.outputData[0].data; - endOfHeaders = first.indexOf("\r\n\r\n") + 4; - req.outputData[0].data = req._header + first.substring(endOfHeaders); - debug2("Output buffer: %o", req.outputData[0].data); - } - let socket; - if (this.proxy.protocol === "https:") { - debug2("Creating `tls.Socket`: %o", this.connectOpts); - socket = tls.connect(this.connectOpts); - } else { - debug2("Creating `net.Socket`: %o", this.connectOpts); - socket = net.connect(this.connectOpts); - } - await (0, events_1.once)(socket, "connect"); - return socket; - } - }; - HttpProxyAgent2.protocols = ["http", "https"]; - exports.HttpProxyAgent = HttpProxyAgent2; - function omit(obj, ...keys) { - const ret = {}; - let key; - for (key in obj) { - if (!keys.includes(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - } -}); - -// node_modules/@azure/core-tracing/dist/commonjs/state.js -var require_state2 = __commonJS({ - "node_modules/@azure/core-tracing/dist/commonjs/state.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.state = void 0; - exports.state = { - instrumenterImplementation: void 0 - }; - } -}); - // node_modules/webidl-conversions/lib/index.js var require_lib2 = __commonJS({ "node_modules/webidl-conversions/lib/index.js"(exports, module2) { @@ -18993,11 +17818,11 @@ var require_lib3 = __commonJS({ return void 0; } var MAP = Symbol("map"); - var Headers3 = class { + var Headers4 = class { constructor() { let init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0; this[MAP] = /* @__PURE__ */ Object.create(null); - if (init instanceof Headers3) { + if (init instanceof Headers4) { const rawHeaders = init.raw(); const headerNames = Object.keys(rawHeaders); for (const headerName of headerNames) { @@ -19049,13 +17874,13 @@ var require_lib3 = __commonJS({ } forEach(callback) { let thisArg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0; - let pairs = getHeaders(this); + let pairs = getHeaders2(this); let i3 = 0; while (i3 < pairs.length) { var _pairs$i = pairs[i3]; const name = _pairs$i[0], value = _pairs$i[1]; callback.call(thisArg, value, name, this); - pairs = getHeaders(this); + pairs = getHeaders2(this); i3++; } } @@ -19105,14 +17930,14 @@ var require_lib3 = __commonJS({ return createHeadersIterator(this, "key+value"); } }; - Headers3.prototype.entries = Headers3.prototype[Symbol.iterator]; - Object.defineProperty(Headers3.prototype, Symbol.toStringTag, { + Headers4.prototype.entries = Headers4.prototype[Symbol.iterator]; + Object.defineProperty(Headers4.prototype, Symbol.toStringTag, { value: "Headers", writable: false, enumerable: false, configurable: true }); - Object.defineProperties(Headers3.prototype, { + Object.defineProperties(Headers4.prototype, { get: { enumerable: true }, forEach: { enumerable: true }, set: { enumerable: true }, @@ -19123,7 +17948,7 @@ var require_lib3 = __commonJS({ values: { enumerable: true }, entries: { enumerable: true } }); - function getHeaders(headers) { + function getHeaders2(headers) { let kind2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "key+value"; const keys = Object.keys(headers[MAP]).sort(); return keys.map(kind2 === "key" ? function(k7) { @@ -19151,7 +17976,7 @@ var require_lib3 = __commonJS({ } var _INTERNAL = this[INTERNAL]; const target = _INTERNAL.target, kind2 = _INTERNAL.kind, index = _INTERNAL.index; - const values = getHeaders(target, kind2); + const values = getHeaders2(target, kind2); const len = values.length; if (index >= len) { return { @@ -19181,7 +18006,7 @@ var require_lib3 = __commonJS({ return obj; } function createHeadersLenient(obj) { - const headers = new Headers3(); + const headers = new Headers4(); for (const name of Object.keys(obj)) { if (invalidTokenRegex.test(name)) { continue; @@ -19211,7 +18036,7 @@ var require_lib3 = __commonJS({ let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; Body.call(this, body, opts); const status = opts.status || 200; - const headers = new Headers3(opts.headers); + const headers = new Headers4(opts.headers); if (body != null && !headers.has("Content-Type")) { const contentType = extractContentType(body); if (contentType) { @@ -19313,7 +18138,7 @@ var require_lib3 = __commonJS({ timeout: init.timeout || input.timeout || 0, size: init.size || input.size || 0 }); - const headers = new Headers3(init.headers || input.headers || {}); + const headers = new Headers4(init.headers || input.headers || {}); if (inputBody != null && !headers.has("Content-Type")) { const contentType = extractContentType(inputBody); if (contentType) { @@ -19374,7 +18199,7 @@ var require_lib3 = __commonJS({ }); function getNodeRequestOptions(request3) { const parsedURL = request3[INTERNALS$2].parsedURL; - const headers = new Headers3(request3[INTERNALS$2].headers); + const headers = new Headers4(request3[INTERNALS$2].headers); if (!headers.has("Accept")) { headers.set("Accept", "*/*"); } @@ -19437,12 +18262,12 @@ var require_lib3 = __commonJS({ const dest = new URL$1(destination).protocol; return orig === dest; }; - function fetch2(url2, opts) { - if (!fetch2.Promise) { + function fetch3(url2, opts) { + if (!fetch3.Promise) { throw new Error("native promise missing, set fetch.Promise to your favorite alternative"); } - Body.Promise = fetch2.Promise; - return new fetch2.Promise(function(resolve, reject) { + Body.Promise = fetch3.Promise; + return new fetch3.Promise(function(resolve, reject) { const request3 = new Request3(url2, opts); const options = getNodeRequestOptions(request3); const send = (options.protocol === "https:" ? https3 : http3).request; @@ -19515,7 +18340,7 @@ var require_lib3 = __commonJS({ req.on("response", function(res) { clearTimeout(reqTimeout); const headers = createHeadersLenient(res.headers); - if (fetch2.isRedirect(res.statusCode)) { + if (fetch3.isRedirect(res.statusCode)) { const location = headers.get("Location"); let locationURL = null; try { @@ -19551,7 +18376,7 @@ var require_lib3 = __commonJS({ return; } const requestOpts = { - headers: new Headers3(request3.headers), + headers: new Headers4(request3.headers), follow: request3.follow, counter: request3.counter + 1, agent: request3.agent, @@ -19577,7 +18402,7 @@ var require_lib3 = __commonJS({ requestOpts.body = void 0; requestOpts.headers.delete("content-length"); } - resolve(fetch2(new Request3(locationURL, requestOpts))); + resolve(fetch3(new Request3(locationURL, requestOpts))); finalize(); return; } @@ -19670,14 +18495,14 @@ var require_lib3 = __commonJS({ stream4.end(); } } - fetch2.isRedirect = function(code) { + fetch3.isRedirect = function(code) { return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; }; - fetch2.Promise = global.Promise; - module2.exports = exports = fetch2; + fetch3.Promise = global.Promise; + module2.exports = exports = fetch3; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports; - exports.Headers = Headers3; + exports.Headers = Headers4; exports.Request = Request3; exports.Response = Response3; exports.FetchError = FetchError; @@ -21763,20 +20588,20 @@ var init_blobHelpers = __esm({ }); // node_modules/formdata-node/lib/esm/Blob.js -var __classPrivateFieldGet2, __classPrivateFieldSet2, _Blob_parts, _Blob_type, _Blob_size, Blob3; +var __classPrivateFieldGet, __classPrivateFieldSet, _Blob_parts, _Blob_type, _Blob_size, Blob3; var init_Blob = __esm({ "node_modules/formdata-node/lib/esm/Blob.js"() { init_ponyfill(); init_isFunction(); init_blobHelpers(); - __classPrivateFieldGet2 = function(receiver, state2, kind2, f4) { + __classPrivateFieldGet = function(receiver, state2, kind2, f4) { if (kind2 === "a" && !f4) throw new TypeError("Private accessor was defined without a getter"); if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); }; - __classPrivateFieldSet2 = function(receiver, state2, value, kind2, f4) { + __classPrivateFieldSet = function(receiver, state2, value, kind2, f4) { if (kind2 === "m") throw new TypeError("Private method is not writable"); if (kind2 === "a" && !f4) @@ -21812,30 +20637,30 @@ var init_Blob = __esm({ } else { part = encoder.encode(String(raw)); } - __classPrivateFieldSet2(this, _Blob_size, __classPrivateFieldGet2(this, _Blob_size, "f") + (ArrayBuffer.isView(part) ? part.byteLength : part.size), "f"); - __classPrivateFieldGet2(this, _Blob_parts, "f").push(part); + __classPrivateFieldSet(this, _Blob_size, __classPrivateFieldGet(this, _Blob_size, "f") + (ArrayBuffer.isView(part) ? part.byteLength : part.size), "f"); + __classPrivateFieldGet(this, _Blob_parts, "f").push(part); } const type2 = options.type === void 0 ? "" : String(options.type); - __classPrivateFieldSet2(this, _Blob_type, /^[\x20-\x7E]*$/.test(type2) ? type2 : "", "f"); + __classPrivateFieldSet(this, _Blob_type, /^[\x20-\x7E]*$/.test(type2) ? type2 : "", "f"); } static [(_Blob_parts = /* @__PURE__ */ new WeakMap(), _Blob_type = /* @__PURE__ */ new WeakMap(), _Blob_size = /* @__PURE__ */ new WeakMap(), Symbol.hasInstance)](value) { return Boolean(value && typeof value === "object" && isFunction2(value.constructor) && (isFunction2(value.stream) || isFunction2(value.arrayBuffer)) && /^(Blob|File)$/.test(value[Symbol.toStringTag])); } get type() { - return __classPrivateFieldGet2(this, _Blob_type, "f"); + return __classPrivateFieldGet(this, _Blob_type, "f"); } get size() { - return __classPrivateFieldGet2(this, _Blob_size, "f"); + return __classPrivateFieldGet(this, _Blob_size, "f"); } slice(start, end, contentType) { - return new Blob3(sliceBlob(__classPrivateFieldGet2(this, _Blob_parts, "f"), this.size, start, end), { + return new Blob3(sliceBlob(__classPrivateFieldGet(this, _Blob_parts, "f"), this.size, start, end), { type: contentType }); } async text() { const decoder = new TextDecoder(); let result = ""; - for await (const chunk of consumeBlobParts(__classPrivateFieldGet2(this, _Blob_parts, "f"))) { + for await (const chunk of consumeBlobParts(__classPrivateFieldGet(this, _Blob_parts, "f"))) { result += decoder.decode(chunk, { stream: true }); } result += decoder.decode(); @@ -21844,14 +20669,14 @@ var init_Blob = __esm({ async arrayBuffer() { const view = new Uint8Array(this.size); let offset = 0; - for await (const chunk of consumeBlobParts(__classPrivateFieldGet2(this, _Blob_parts, "f"))) { + for await (const chunk of consumeBlobParts(__classPrivateFieldGet(this, _Blob_parts, "f"))) { view.set(chunk, offset); offset += chunk.length; } return view.buffer; } stream() { - const iterator = consumeBlobParts(__classPrivateFieldGet2(this, _Blob_parts, "f"), true); + const iterator = consumeBlobParts(__classPrivateFieldGet(this, _Blob_parts, "f"), true); return new ReadableStream3({ async pull(controller) { const { value, done } = await iterator.next(); @@ -21881,11 +20706,11 @@ var init_Blob = __esm({ }); // node_modules/formdata-node/lib/esm/File.js -var __classPrivateFieldSet3, __classPrivateFieldGet3, _File_name, _File_lastModified, File3; +var __classPrivateFieldSet2, __classPrivateFieldGet2, _File_name, _File_lastModified, File3; var init_File = __esm({ "node_modules/formdata-node/lib/esm/File.js"() { init_Blob(); - __classPrivateFieldSet3 = function(receiver, state2, value, kind2, f4) { + __classPrivateFieldSet2 = function(receiver, state2, value, kind2, f4) { if (kind2 === "m") throw new TypeError("Private method is not writable"); if (kind2 === "a" && !f4) @@ -21894,7 +20719,7 @@ var init_File = __esm({ throw new TypeError("Cannot write private member to an object whose class did not declare it"); return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; }; - __classPrivateFieldGet3 = function(receiver, state2, kind2, f4) { + __classPrivateFieldGet2 = function(receiver, state2, kind2, f4) { if (kind2 === "a" && !f4) throw new TypeError("Private accessor was defined without a getter"); if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) @@ -21909,20 +20734,20 @@ var init_File = __esm({ if (arguments.length < 2) { throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`); } - __classPrivateFieldSet3(this, _File_name, String(name), "f"); + __classPrivateFieldSet2(this, _File_name, String(name), "f"); const lastModified = options.lastModified === void 0 ? Date.now() : Number(options.lastModified); if (!Number.isNaN(lastModified)) { - __classPrivateFieldSet3(this, _File_lastModified, lastModified, "f"); + __classPrivateFieldSet2(this, _File_lastModified, lastModified, "f"); } } static [(_File_name = /* @__PURE__ */ new WeakMap(), _File_lastModified = /* @__PURE__ */ new WeakMap(), Symbol.hasInstance)](value) { return value instanceof Blob3 && value[Symbol.toStringTag] === "File" && typeof value.name === "string"; } get name() { - return __classPrivateFieldGet3(this, _File_name, "f"); + return __classPrivateFieldGet2(this, _File_name, "f"); } get lastModified() { - return __classPrivateFieldGet3(this, _File_lastModified, "f"); + return __classPrivateFieldGet2(this, _File_lastModified, "f"); } get webkitRelativePath() { return ""; @@ -27025,7 +25850,7 @@ async function fileFromPath2(path5, filenameOrOptions, options) { const stats = await import_fs2.promises.stat(path5); return createFileFromPath(path5, stats, filenameOrOptions, options); } -var import_fs2, import_path3, import_node_domexception, __classPrivateFieldSet5, __classPrivateFieldGet6, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath; +var import_fs2, import_path3, import_node_domexception, __classPrivateFieldSet4, __classPrivateFieldGet5, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath; var init_fileFromPath = __esm({ "node_modules/formdata-node/lib/esm/fileFromPath.js"() { import_fs2 = require("fs"); @@ -27034,7 +25859,7 @@ var init_fileFromPath = __esm({ init_File(); init_isPlainObject(); init_isFile(); - __classPrivateFieldSet5 = function(receiver, state2, value, kind2, f4) { + __classPrivateFieldSet4 = function(receiver, state2, value, kind2, f4) { if (kind2 === "m") throw new TypeError("Private method is not writable"); if (kind2 === "a" && !f4) @@ -27043,7 +25868,7 @@ var init_fileFromPath = __esm({ throw new TypeError("Cannot write private member to an object whose class did not declare it"); return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; }; - __classPrivateFieldGet6 = function(receiver, state2, kind2, f4) { + __classPrivateFieldGet5 = function(receiver, state2, kind2, f4) { if (kind2 === "a" && !f4) throw new TypeError("Private accessor was defined without a getter"); if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) @@ -27055,29 +25880,29 @@ var init_fileFromPath = __esm({ constructor(input) { _FileFromPath_path.set(this, void 0); _FileFromPath_start.set(this, void 0); - __classPrivateFieldSet5(this, _FileFromPath_path, input.path, "f"); - __classPrivateFieldSet5(this, _FileFromPath_start, input.start || 0, "f"); - this.name = (0, import_path3.basename)(__classPrivateFieldGet6(this, _FileFromPath_path, "f")); + __classPrivateFieldSet4(this, _FileFromPath_path, input.path, "f"); + __classPrivateFieldSet4(this, _FileFromPath_start, input.start || 0, "f"); + this.name = (0, import_path3.basename)(__classPrivateFieldGet5(this, _FileFromPath_path, "f")); this.size = input.size; this.lastModified = input.lastModified; } slice(start, end) { return new FileFromPath({ - path: __classPrivateFieldGet6(this, _FileFromPath_path, "f"), + path: __classPrivateFieldGet5(this, _FileFromPath_path, "f"), lastModified: this.lastModified, size: end - start, start }); } async *stream() { - const { mtimeMs } = await import_fs2.promises.stat(__classPrivateFieldGet6(this, _FileFromPath_path, "f")); + const { mtimeMs } = await import_fs2.promises.stat(__classPrivateFieldGet5(this, _FileFromPath_path, "f")); if (mtimeMs > this.lastModified) { throw new import_node_domexception.default(MESSAGE, "NotReadableError"); } if (this.size) { - yield* (0, import_fs2.createReadStream)(__classPrivateFieldGet6(this, _FileFromPath_path, "f"), { - start: __classPrivateFieldGet6(this, _FileFromPath_start, "f"), - end: __classPrivateFieldGet6(this, _FileFromPath_start, "f") + this.size - 1 + yield* (0, import_fs2.createReadStream)(__classPrivateFieldGet5(this, _FileFromPath_path, "f"), { + start: __classPrivateFieldGet5(this, _FileFromPath_start, "f"), + end: __classPrivateFieldGet5(this, _FileFromPath_start, "f") + this.size - 1 }); } } @@ -27088,6 +25913,1181 @@ var init_fileFromPath = __esm({ } }); +// node_modules/tslib/tslib.js +var require_tslib = __commonJS({ + "node_modules/tslib/tslib.js"(exports, module2) { + var __extends2; + var __assign2; + var __rest2; + var __decorate2; + var __param2; + var __esDecorate2; + var __runInitializers2; + var __propKey2; + var __setFunctionName2; + var __metadata2; + var __awaiter2; + var __generator2; + var __exportStar2; + var __values2; + var __read2; + var __spread2; + var __spreadArrays2; + var __spreadArray2; + var __await3; + var __asyncGenerator3; + var __asyncDelegator2; + var __asyncValues2; + var __makeTemplateObject2; + var __importStar2; + var __importDefault2; + var __classPrivateFieldGet9; + var __classPrivateFieldSet8; + var __classPrivateFieldIn2; + var __createBinding2; + var __addDisposableResource2; + var __disposeResources2; + (function(factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function(exports2) { + factory(createExporter(root, createExporter(exports2))); + }); + } else if (typeof module2 === "object" && typeof module2.exports === "object") { + factory(createExporter(root, createExporter(module2.exports))); + } else { + factory(createExporter(root)); + } + function createExporter(exports2, previous) { + if (exports2 !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports2, "__esModule", { value: true }); + } else { + exports2.__esModule = true; + } + } + return function(id, v5) { + return exports2[id] = previous ? previous(id, v5) : v5; + }; + } + })(function(exporter) { + var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d7, b7) { + d7.__proto__ = b7; + } || function(d7, b7) { + for (var p4 in b7) + if (Object.prototype.hasOwnProperty.call(b7, p4)) + d7[p4] = b7[p4]; + }; + __extends2 = function(d7, b7) { + if (typeof b7 !== "function" && b7 !== null) + throw new TypeError("Class extends value " + String(b7) + " is not a constructor or null"); + extendStatics(d7, b7); + function __() { + this.constructor = d7; + } + d7.prototype = b7 === null ? Object.create(b7) : (__.prototype = b7.prototype, new __()); + }; + __assign2 = Object.assign || function(t2) { + for (var s2, i3 = 1, n2 = arguments.length; i3 < n2; i3++) { + s2 = arguments[i3]; + for (var p4 in s2) + if (Object.prototype.hasOwnProperty.call(s2, p4)) + t2[p4] = s2[p4]; + } + return t2; + }; + __rest2 = function(s2, e3) { + var t2 = {}; + for (var p4 in s2) + if (Object.prototype.hasOwnProperty.call(s2, p4) && e3.indexOf(p4) < 0) + t2[p4] = s2[p4]; + if (s2 != null && typeof Object.getOwnPropertySymbols === "function") + for (var i3 = 0, p4 = Object.getOwnPropertySymbols(s2); i3 < p4.length; i3++) { + if (e3.indexOf(p4[i3]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p4[i3])) + t2[p4[i3]] = s2[p4[i3]]; + } + return t2; + }; + __decorate2 = function(decorators, target, key, desc) { + var c3 = arguments.length, r3 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d7; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + r3 = Reflect.decorate(decorators, target, key, desc); + else + for (var i3 = decorators.length - 1; i3 >= 0; i3--) + if (d7 = decorators[i3]) + r3 = (c3 < 3 ? d7(r3) : c3 > 3 ? d7(target, key, r3) : d7(target, key)) || r3; + return c3 > 3 && r3 && Object.defineProperty(target, key, r3), r3; + }; + __param2 = function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + __esDecorate2 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f4) { + if (f4 !== void 0 && typeof f4 !== "function") + throw new TypeError("Function expected"); + return f4; + } + var kind2 = contextIn.kind, key = kind2 === "getter" ? "get" : kind2 === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _7, done = false; + for (var i3 = decorators.length - 1; i3 >= 0; i3--) { + var context = {}; + for (var p4 in contextIn) + context[p4] = p4 === "access" ? {} : contextIn[p4]; + for (var p4 in contextIn.access) + context.access[p4] = contextIn.access[p4]; + context.addInitializer = function(f4) { + if (done) + throw new TypeError("Cannot add initializers after decoration has completed"); + extraInitializers.push(accept(f4 || null)); + }; + var result = (0, decorators[i3])(kind2 === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind2 === "accessor") { + if (result === void 0) + continue; + if (result === null || typeof result !== "object") + throw new TypeError("Object expected"); + if (_7 = accept(result.get)) + descriptor.get = _7; + if (_7 = accept(result.set)) + descriptor.set = _7; + if (_7 = accept(result.init)) + initializers.unshift(_7); + } else if (_7 = accept(result)) { + if (kind2 === "field") + initializers.unshift(_7); + else + descriptor[key] = _7; + } + } + if (target) + Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + __runInitializers2 = function(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i3 = 0; i3 < initializers.length; i3++) { + value = useValue ? initializers[i3].call(thisArg, value) : initializers[i3].call(thisArg); + } + return useValue ? value : void 0; + }; + __propKey2 = function(x5) { + return typeof x5 === "symbol" ? x5 : "".concat(x5); + }; + __setFunctionName2 = function(f4, name, prefix) { + if (typeof name === "symbol") + name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f4, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + __metadata2 = function(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(metadataKey, metadataValue); + }; + __awaiter2 = function(thisArg, _arguments, P4, generator) { + function adopt(value) { + return value instanceof P4 ? value : new P4(function(resolve) { + resolve(value); + }); + } + return new (P4 || (P4 = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e3) { + reject(e3); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e3) { + reject(e3); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + __generator2 = function(thisArg, body) { + var _7 = { label: 0, sent: function() { + if (t2[0] & 1) + throw t2[1]; + return t2[1]; + }, trys: [], ops: [] }, f4, y6, t2, g4; + return g4 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g4[Symbol.iterator] = function() { + return this; + }), g4; + function verb(n2) { + return function(v5) { + return step([n2, v5]); + }; + } + function step(op) { + if (f4) + throw new TypeError("Generator is already executing."); + while (g4 && (g4 = 0, op[0] && (_7 = 0)), _7) + try { + if (f4 = 1, y6 && (t2 = op[0] & 2 ? y6["return"] : op[0] ? y6["throw"] || ((t2 = y6["return"]) && t2.call(y6), 0) : y6.next) && !(t2 = t2.call(y6, op[1])).done) + return t2; + if (y6 = 0, t2) + op = [op[0] & 2, t2.value]; + switch (op[0]) { + case 0: + case 1: + t2 = op; + break; + case 4: + _7.label++; + return { value: op[1], done: false }; + case 5: + _7.label++; + y6 = op[1]; + op = [0]; + continue; + case 7: + op = _7.ops.pop(); + _7.trys.pop(); + continue; + default: + if (!(t2 = _7.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _7 = 0; + continue; + } + if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { + _7.label = op[1]; + break; + } + if (op[0] === 6 && _7.label < t2[1]) { + _7.label = t2[1]; + t2 = op; + break; + } + if (t2 && _7.label < t2[2]) { + _7.label = t2[2]; + _7.ops.push(op); + break; + } + if (t2[2]) + _7.ops.pop(); + _7.trys.pop(); + continue; + } + op = body.call(thisArg, _7); + } catch (e3) { + op = [6, e3]; + y6 = 0; + } finally { + f4 = t2 = 0; + } + if (op[0] & 5) + throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + __exportStar2 = function(m5, o3) { + for (var p4 in m5) + if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(o3, p4)) + __createBinding2(o3, m5, p4); + }; + __createBinding2 = Object.create ? function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + var desc = Object.getOwnPropertyDescriptor(m5, k7); + if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m5[k7]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + o3[k22] = m5[k7]; + }; + __values2 = function(o3) { + var s2 = typeof Symbol === "function" && Symbol.iterator, m5 = s2 && o3[s2], i3 = 0; + if (m5) + return m5.call(o3); + if (o3 && typeof o3.length === "number") + return { + next: function() { + if (o3 && i3 >= o3.length) + o3 = void 0; + return { value: o3 && o3[i3++], done: !o3 }; + } + }; + throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + __read2 = function(o3, n2) { + var m5 = typeof Symbol === "function" && o3[Symbol.iterator]; + if (!m5) + return o3; + var i3 = m5.call(o3), r3, ar2 = [], e3; + try { + while ((n2 === void 0 || n2-- > 0) && !(r3 = i3.next()).done) + ar2.push(r3.value); + } catch (error) { + e3 = { error }; + } finally { + try { + if (r3 && !r3.done && (m5 = i3["return"])) + m5.call(i3); + } finally { + if (e3) + throw e3.error; + } + } + return ar2; + }; + __spread2 = function() { + for (var ar2 = [], i3 = 0; i3 < arguments.length; i3++) + ar2 = ar2.concat(__read2(arguments[i3])); + return ar2; + }; + __spreadArrays2 = function() { + for (var s2 = 0, i3 = 0, il = arguments.length; i3 < il; i3++) + s2 += arguments[i3].length; + for (var r3 = Array(s2), k7 = 0, i3 = 0; i3 < il; i3++) + for (var a4 = arguments[i3], j4 = 0, jl = a4.length; j4 < jl; j4++, k7++) + r3[k7] = a4[j4]; + return r3; + }; + __spreadArray2 = function(to, from, pack) { + if (pack || arguments.length === 2) + for (var i3 = 0, l3 = from.length, ar2; i3 < l3; i3++) { + if (ar2 || !(i3 in from)) { + if (!ar2) + ar2 = Array.prototype.slice.call(from, 0, i3); + ar2[i3] = from[i3]; + } + } + return to.concat(ar2 || Array.prototype.slice.call(from)); + }; + __await3 = function(v5) { + return this instanceof __await3 ? (this.v = v5, this) : new __await3(v5); + }; + __asyncGenerator3 = function(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var g4 = generator.apply(thisArg, _arguments || []), i3, q6 = []; + return i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { + return this; + }, i3; + function verb(n2) { + if (g4[n2]) + i3[n2] = function(v5) { + return new Promise(function(a4, b7) { + q6.push([n2, v5, a4, b7]) > 1 || resume(n2, v5); + }); + }; + } + function resume(n2, v5) { + try { + step(g4[n2](v5)); + } catch (e3) { + settle2(q6[0][3], e3); + } + } + function step(r3) { + r3.value instanceof __await3 ? Promise.resolve(r3.value.v).then(fulfill, reject) : settle2(q6[0][2], r3); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle2(f4, v5) { + if (f4(v5), q6.shift(), q6.length) + resume(q6[0][0], q6[0][1]); + } + }; + __asyncDelegator2 = function(o3) { + var i3, p4; + return i3 = {}, verb("next"), verb("throw", function(e3) { + throw e3; + }), verb("return"), i3[Symbol.iterator] = function() { + return this; + }, i3; + function verb(n2, f4) { + i3[n2] = o3[n2] ? function(v5) { + return (p4 = !p4) ? { value: __await3(o3[n2](v5)), done: false } : f4 ? f4(v5) : v5; + } : f4; + } + }; + __asyncValues2 = function(o3) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var m5 = o3[Symbol.asyncIterator], i3; + return m5 ? m5.call(o3) : (o3 = typeof __values2 === "function" ? __values2(o3) : o3[Symbol.iterator](), i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { + return this; + }, i3); + function verb(n2) { + i3[n2] = o3[n2] && function(v5) { + return new Promise(function(resolve, reject) { + v5 = o3[n2](v5), settle2(resolve, reject, v5.done, v5.value); + }); + }; + } + function settle2(resolve, reject, d7, v5) { + Promise.resolve(v5).then(function(v6) { + resolve({ value: v6, done: d7 }); + }, reject); + } + }; + __makeTemplateObject2 = function(cooked, raw) { + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { value: raw }); + } else { + cooked.raw = raw; + } + return cooked; + }; + var __setModuleDefault = Object.create ? function(o3, v5) { + Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); + } : function(o3, v5) { + o3["default"] = v5; + }; + __importStar2 = function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k7 in mod) + if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) + __createBinding2(result, mod, k7); + } + __setModuleDefault(result, mod); + return result; + }; + __importDefault2 = function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + __classPrivateFieldGet9 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); + }; + __classPrivateFieldSet8 = function(receiver, state2, value, kind2, f4) { + if (kind2 === "m") + throw new TypeError("Private method is not writable"); + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; + }; + __classPrivateFieldIn2 = function(state2, receiver) { + if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") + throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state2 === "function" ? receiver === state2 : state2.has(receiver); + }; + __addDisposableResource2 = function(env2, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") + throw new TypeError("Object expected."); + var dispose; + if (async) { + if (!Symbol.asyncDispose) + throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) + throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + } + if (typeof dispose !== "function") + throw new TypeError("Object not disposable."); + env2.stack.push({ value, dispose, async }); + } else if (async) { + env2.stack.push({ async: true }); + } + return value; + }; + var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { + var e3 = new Error(message); + return e3.name = "SuppressedError", e3.error = error, e3.suppressed = suppressed, e3; + }; + __disposeResources2 = function(env2) { + function fail(e3) { + env2.error = env2.hasError ? new _SuppressedError(e3, env2.error, "An error was suppressed during disposal.") : e3; + env2.hasError = true; + } + function next() { + while (env2.stack.length) { + var rec = env2.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) + return Promise.resolve(result).then(next, function(e3) { + fail(e3); + return next(); + }); + } catch (e3) { + fail(e3); + } + } + if (env2.hasError) + throw env2.error; + } + return next(); + }; + exporter("__extends", __extends2); + exporter("__assign", __assign2); + exporter("__rest", __rest2); + exporter("__decorate", __decorate2); + exporter("__param", __param2); + exporter("__esDecorate", __esDecorate2); + exporter("__runInitializers", __runInitializers2); + exporter("__propKey", __propKey2); + exporter("__setFunctionName", __setFunctionName2); + exporter("__metadata", __metadata2); + exporter("__awaiter", __awaiter2); + exporter("__generator", __generator2); + exporter("__exportStar", __exportStar2); + exporter("__createBinding", __createBinding2); + exporter("__values", __values2); + exporter("__read", __read2); + exporter("__spread", __spread2); + exporter("__spreadArrays", __spreadArrays2); + exporter("__spreadArray", __spreadArray2); + exporter("__await", __await3); + exporter("__asyncGenerator", __asyncGenerator3); + exporter("__asyncDelegator", __asyncDelegator2); + exporter("__asyncValues", __asyncValues2); + exporter("__makeTemplateObject", __makeTemplateObject2); + exporter("__importStar", __importStar2); + exporter("__importDefault", __importDefault2); + exporter("__classPrivateFieldGet", __classPrivateFieldGet9); + exporter("__classPrivateFieldSet", __classPrivateFieldSet8); + exporter("__classPrivateFieldIn", __classPrivateFieldIn2); + exporter("__addDisposableResource", __addDisposableResource2); + exporter("__disposeResources", __disposeResources2); + }); + } +}); + +// node_modules/agent-base/dist/helpers.js +var require_helpers = __commonJS({ + "node_modules/agent-base/dist/helpers.js"(exports) { + "use strict"; + var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + var desc = Object.getOwnPropertyDescriptor(m5, k7); + if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m5[k7]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + o3[k22] = m5[k7]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v5) { + Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); + } : function(o3, v5) { + o3["default"] = v5; + }); + var __importStar2 = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k7 in mod) + if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) + __createBinding2(result, mod, k7); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.req = exports.json = exports.toBuffer = void 0; + var http3 = __importStar2(require("http")); + var https3 = __importStar2(require("https")); + async function toBuffer(stream4) { + let length = 0; + const chunks = []; + for await (const chunk of stream4) { + length += chunk.length; + chunks.push(chunk); + } + return Buffer.concat(chunks, length); + } + exports.toBuffer = toBuffer; + async function json(stream4) { + const buf = await toBuffer(stream4); + const str = buf.toString("utf8"); + try { + return JSON.parse(str); + } catch (_err) { + const err = _err; + err.message += ` (input: ${str})`; + throw err; + } + } + exports.json = json; + function req(url2, opts = {}) { + const href = typeof url2 === "string" ? url2 : url2.href; + const req2 = (href.startsWith("https:") ? https3 : http3).request(url2, opts); + const promise = new Promise((resolve, reject) => { + req2.once("response", resolve).once("error", reject).end(); + }); + req2.then = promise.then.bind(promise); + return req2; + } + exports.req = req; + } +}); + +// node_modules/agent-base/dist/index.js +var require_dist2 = __commonJS({ + "node_modules/agent-base/dist/index.js"(exports) { + "use strict"; + var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + var desc = Object.getOwnPropertyDescriptor(m5, k7); + if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m5[k7]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + o3[k22] = m5[k7]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v5) { + Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); + } : function(o3, v5) { + o3["default"] = v5; + }); + var __importStar2 = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k7 in mod) + if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) + __createBinding2(result, mod, k7); + } + __setModuleDefault(result, mod); + return result; + }; + var __exportStar2 = exports && exports.__exportStar || function(m5, exports2) { + for (var p4 in m5) + if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p4)) + __createBinding2(exports2, m5, p4); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Agent = void 0; + var net = __importStar2(require("net")); + var http3 = __importStar2(require("http")); + var https_1 = require("https"); + __exportStar2(require_helpers(), exports); + var INTERNAL = Symbol("AgentBaseInternalState"); + var Agent3 = class extends http3.Agent { + constructor(opts) { + super(opts); + this[INTERNAL] = {}; + } + isSecureEndpoint(options) { + if (options) { + if (typeof options.secureEndpoint === "boolean") { + return options.secureEndpoint; + } + if (typeof options.protocol === "string") { + return options.protocol === "https:"; + } + } + const { stack } = new Error(); + if (typeof stack !== "string") + return false; + return stack.split("\n").some((l3) => l3.indexOf("(https.js:") !== -1 || l3.indexOf("node:https:") !== -1); + } + incrementSockets(name) { + if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) { + return null; + } + if (!this.sockets[name]) { + this.sockets[name] = []; + } + const fakeSocket = new net.Socket({ writable: false }); + this.sockets[name].push(fakeSocket); + this.totalSocketCount++; + return fakeSocket; + } + decrementSockets(name, socket) { + if (!this.sockets[name] || socket === null) { + return; + } + const sockets = this.sockets[name]; + const index = sockets.indexOf(socket); + if (index !== -1) { + sockets.splice(index, 1); + this.totalSocketCount--; + if (sockets.length === 0) { + delete this.sockets[name]; + } + } + } + getName(options) { + const secureEndpoint = typeof options.secureEndpoint === "boolean" ? options.secureEndpoint : this.isSecureEndpoint(options); + if (secureEndpoint) { + return https_1.Agent.prototype.getName.call(this, options); + } + return super.getName(options); + } + createSocket(req, options, cb) { + const connectOpts = { + ...options, + secureEndpoint: this.isSecureEndpoint(options) + }; + const name = this.getName(connectOpts); + const fakeSocket = this.incrementSockets(name); + Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => { + this.decrementSockets(name, fakeSocket); + if (socket instanceof http3.Agent) { + return socket.addRequest(req, connectOpts); + } + this[INTERNAL].currentSocket = socket; + super.createSocket(req, options, cb); + }, (err) => { + this.decrementSockets(name, fakeSocket); + cb(err); + }); + } + createConnection() { + const socket = this[INTERNAL].currentSocket; + this[INTERNAL].currentSocket = void 0; + if (!socket) { + throw new Error("No socket was returned in the `connect()` function"); + } + return socket; + } + get defaultPort() { + return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80); + } + set defaultPort(v5) { + if (this[INTERNAL]) { + this[INTERNAL].defaultPort = v5; + } + } + get protocol() { + return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:"); + } + set protocol(v5) { + if (this[INTERNAL]) { + this[INTERNAL].protocol = v5; + } + } + }; + exports.Agent = Agent3; + } +}); + +// node_modules/https-proxy-agent/dist/parse-proxy-response.js +var require_parse_proxy_response = __commonJS({ + "node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) { + "use strict"; + var __importDefault2 = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseProxyResponse = void 0; + var debug_1 = __importDefault2(require_src2()); + var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response"); + function parseProxyResponse(socket) { + return new Promise((resolve, reject) => { + let buffersLength = 0; + const buffers = []; + function read() { + const b7 = socket.read(); + if (b7) + ondata(b7); + else + socket.once("readable", read); + } + function cleanup() { + socket.removeListener("end", onend); + socket.removeListener("error", onerror); + socket.removeListener("readable", read); + } + function onend() { + cleanup(); + debug2("onend"); + reject(new Error("Proxy connection ended before receiving CONNECT response")); + } + function onerror(err) { + cleanup(); + debug2("onerror %o", err); + reject(err); + } + function ondata(b7) { + buffers.push(b7); + buffersLength += b7.length; + const buffered = Buffer.concat(buffers, buffersLength); + const endOfHeaders = buffered.indexOf("\r\n\r\n"); + if (endOfHeaders === -1) { + debug2("have not received end of HTTP headers yet..."); + read(); + return; + } + const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n"); + const firstLine = headerParts.shift(); + if (!firstLine) { + socket.destroy(); + return reject(new Error("No header received from proxy CONNECT response")); + } + const firstLineParts = firstLine.split(" "); + const statusCode = +firstLineParts[1]; + const statusText = firstLineParts.slice(2).join(" "); + const headers = {}; + for (const header of headerParts) { + if (!header) + continue; + const firstColon = header.indexOf(":"); + if (firstColon === -1) { + socket.destroy(); + return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`)); + } + const key = header.slice(0, firstColon).toLowerCase(); + const value = header.slice(firstColon + 1).trimStart(); + const current = headers[key]; + if (typeof current === "string") { + headers[key] = [current, value]; + } else if (Array.isArray(current)) { + current.push(value); + } else { + headers[key] = value; + } + } + debug2("got proxy server response: %o %o", firstLine, headers); + cleanup(); + resolve({ + connect: { + statusCode, + statusText, + headers + }, + buffered + }); + } + socket.on("error", onerror); + socket.on("end", onend); + read(); + }); + } + exports.parseProxyResponse = parseProxyResponse; + } +}); + +// node_modules/https-proxy-agent/dist/index.js +var require_dist3 = __commonJS({ + "node_modules/https-proxy-agent/dist/index.js"(exports) { + "use strict"; + var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + var desc = Object.getOwnPropertyDescriptor(m5, k7); + if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m5[k7]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + o3[k22] = m5[k7]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v5) { + Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); + } : function(o3, v5) { + o3["default"] = v5; + }); + var __importStar2 = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k7 in mod) + if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) + __createBinding2(result, mod, k7); + } + __setModuleDefault(result, mod); + return result; + }; + var __importDefault2 = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.HttpsProxyAgent = void 0; + var net = __importStar2(require("net")); + var tls = __importStar2(require("tls")); + var assert_1 = __importDefault2(require("assert")); + var debug_1 = __importDefault2(require_src2()); + var agent_base_1 = require_dist2(); + var url_1 = require("url"); + var parse_proxy_response_1 = require_parse_proxy_response(); + var debug2 = (0, debug_1.default)("https-proxy-agent"); + var HttpsProxyAgent2 = class extends agent_base_1.Agent { + constructor(proxy, opts) { + super(opts); + this.options = { path: void 0 }; + this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy; + this.proxyHeaders = opts?.headers ?? {}; + debug2("Creating new HttpsProxyAgent instance: %o", this.proxy.href); + const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ""); + const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80; + this.connectOpts = { + ALPNProtocols: ["http/1.1"], + ...opts ? omit(opts, "headers") : null, + host, + port + }; + } + async connect(req, opts) { + const { proxy } = this; + if (!opts.host) { + throw new TypeError('No "host" provided'); + } + let socket; + if (proxy.protocol === "https:") { + debug2("Creating `tls.Socket`: %o", this.connectOpts); + const servername = this.connectOpts.servername || this.connectOpts.host; + socket = tls.connect({ + ...this.connectOpts, + servername: servername && net.isIP(servername) ? void 0 : servername + }); + } else { + debug2("Creating `net.Socket`: %o", this.connectOpts); + socket = net.connect(this.connectOpts); + } + const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders }; + const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host; + let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r +`; + if (proxy.username || proxy.password) { + const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; + headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`; + } + headers.Host = `${host}:${opts.port}`; + if (!headers["Proxy-Connection"]) { + headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close"; + } + for (const name of Object.keys(headers)) { + payload += `${name}: ${headers[name]}\r +`; + } + const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket); + socket.write(`${payload}\r +`); + const { connect, buffered } = await proxyResponsePromise; + req.emit("proxyConnect", connect); + this.emit("proxyConnect", connect, req); + if (connect.statusCode === 200) { + req.once("socket", resume); + if (opts.secureEndpoint) { + debug2("Upgrading socket connection to TLS"); + const servername = opts.servername || opts.host; + return tls.connect({ + ...omit(opts, "host", "path", "port"), + socket, + servername: net.isIP(servername) ? void 0 : servername + }); + } + return socket; + } + socket.destroy(); + const fakeSocket = new net.Socket({ writable: false }); + fakeSocket.readable = true; + req.once("socket", (s2) => { + debug2("Replaying proxy buffer for failed request"); + (0, assert_1.default)(s2.listenerCount("data") > 0); + s2.push(buffered); + s2.push(null); + }); + return fakeSocket; + } + }; + HttpsProxyAgent2.protocols = ["http", "https"]; + exports.HttpsProxyAgent = HttpsProxyAgent2; + function resume(socket) { + socket.resume(); + } + function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + } +}); + +// node_modules/http-proxy-agent/dist/index.js +var require_dist4 = __commonJS({ + "node_modules/http-proxy-agent/dist/index.js"(exports) { + "use strict"; + var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + var desc = Object.getOwnPropertyDescriptor(m5, k7); + if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m5[k7]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m5, k7, k22) { + if (k22 === void 0) + k22 = k7; + o3[k22] = m5[k7]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v5) { + Object.defineProperty(o3, "default", { enumerable: true, value: v5 }); + } : function(o3, v5) { + o3["default"] = v5; + }); + var __importStar2 = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k7 in mod) + if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) + __createBinding2(result, mod, k7); + } + __setModuleDefault(result, mod); + return result; + }; + var __importDefault2 = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.HttpProxyAgent = void 0; + var net = __importStar2(require("net")); + var tls = __importStar2(require("tls")); + var debug_1 = __importDefault2(require_src2()); + var events_1 = require("events"); + var agent_base_1 = require_dist2(); + var url_1 = require("url"); + var debug2 = (0, debug_1.default)("http-proxy-agent"); + var HttpProxyAgent2 = class extends agent_base_1.Agent { + constructor(proxy, opts) { + super(opts); + this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy; + this.proxyHeaders = opts?.headers ?? {}; + debug2("Creating new HttpProxyAgent instance: %o", this.proxy.href); + const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ""); + const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80; + this.connectOpts = { + ...opts ? omit(opts, "headers") : null, + host, + port + }; + } + addRequest(req, opts) { + req._header = null; + this.setRequestProps(req, opts); + super.addRequest(req, opts); + } + setRequestProps(req, opts) { + const { proxy } = this; + const protocol = opts.secureEndpoint ? "https:" : "http:"; + const hostname = req.getHeader("host") || "localhost"; + const base = `${protocol}//${hostname}`; + const url2 = new url_1.URL(req.path, base); + if (opts.port !== 80) { + url2.port = String(opts.port); + } + req.path = String(url2); + const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders }; + if (proxy.username || proxy.password) { + const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; + headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`; + } + if (!headers["Proxy-Connection"]) { + headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close"; + } + for (const name of Object.keys(headers)) { + const value = headers[name]; + if (value) { + req.setHeader(name, value); + } + } + } + async connect(req, opts) { + req._header = null; + if (!req.path.includes("://")) { + this.setRequestProps(req, opts); + } + let first; + let endOfHeaders; + debug2("Regenerating stored HTTP header string for request"); + req._implicitHeader(); + if (req.outputData && req.outputData.length > 0) { + debug2("Patching connection write() output buffer with updated header"); + first = req.outputData[0].data; + endOfHeaders = first.indexOf("\r\n\r\n") + 4; + req.outputData[0].data = req._header + first.substring(endOfHeaders); + debug2("Output buffer: %o", req.outputData[0].data); + } + let socket; + if (this.proxy.protocol === "https:") { + debug2("Creating `tls.Socket`: %o", this.connectOpts); + socket = tls.connect(this.connectOpts); + } else { + debug2("Creating `net.Socket`: %o", this.connectOpts); + socket = net.connect(this.connectOpts); + } + await (0, events_1.once)(socket, "connect"); + return socket; + } + }; + HttpProxyAgent2.protocols = ["http", "https"]; + exports.HttpProxyAgent = HttpProxyAgent2; + function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + } +}); + +// node_modules/@azure/core-tracing/dist/commonjs/state.js +var require_state2 = __commonJS({ + "node_modules/@azure/core-tracing/dist/commonjs/state.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.state = void 0; + exports.state = { + instrumenterImplementation: void 0 + }; + } +}); + // node_modules/ignore/index.js var require_ignore = __commonJS({ "node_modules/ignore/index.js"(exports, module2) { @@ -28154,16 +28154,19 @@ var package_default = { start: "node ./out/cli.cjs", "ollama:start": "OCO_AI_PROVIDER='ollama' node ./out/cli.cjs", dev: "ts-node ./src/cli.ts", + "dev:gemini": "OCO_AI_PROVIDER='gemini' ts-node ./src/cli.ts", build: "rimraf out && node esbuild.config.js", "build:push": "npm run build && git add . && git commit -m 'build' && git push", deploy: "npm version patch && npm run build:push && git push --tags && npm publish --tag latest", lint: "eslint src --ext ts && tsc --noEmit", format: "prettier --write src", + test: "node --no-warnings --experimental-vm-modules $( [ -f ./node_modules/.bin/jest ] && echo ./node_modules/.bin/jest || which jest ) test/unit", "test:all": "npm run test:unit:docker && npm run test:e2e:docker", "test:docker-build": "docker build -t oco-test -f test/Dockerfile .", "test:unit": "NODE_OPTIONS=--experimental-vm-modules jest test/unit", "test:unit:docker": "npm run test:docker-build && DOCKER_CONTENT_TRUST=0 docker run --rm oco-test npm run test:unit", - "test:e2e": "jest test/e2e", + "test:e2e": "npm run test:e2e:setup && jest test/e2e", + "test:e2e:setup": "sh test/e2e/setup.sh", "test:e2e:docker": "npm run test:docker-build && DOCKER_CONTENT_TRUST=0 docker run --rm oco-test npm run test:e2e" }, devDependencies: { @@ -28192,6 +28195,7 @@ var package_default = { "@anthropic-ai/sdk": "^0.19.2", "@clack/prompts": "^0.6.1", "@dqbd/tiktoken": "^1.0.2", + "@google/generative-ai": "^0.11.4", "@octokit/webhooks-schemas": "^6.11.0", "@octokit/webhooks-types": "^6.11.0", ai: "^2.2.14", @@ -30628,42 +30632,71 @@ function getI18nLocal(value) { return false; } +// src/engine/testAi.ts +var TEST_MOCK_TYPES = [ + "commit-message", + "prompt-module-commitlint-config" +]; +var TestAi = class { + async generateCommitMessage(_messages) { + const config11 = getConfig(); + switch (config11?.OCO_TEST_MOCK_TYPE) { + case "commit-message": + return "fix(testAi.ts): test commit message"; + case "prompt-module-commitlint-config": + return `{ + "localLanguage": "english", + "commitFix": "fix(server): Change 'port' variable to uppercase 'PORT'", + "commitFeat": "feat(server): Allow server to listen on a port specified through environment variable", + "commitDescription": "Change 'port' variable to uppercase 'PORT'. Allow server to listen on a port specified through environment variable." +}`; + default: + throw Error("unsupported test mock type"); + } + } +}; + // src/commands/config.ts -var CONFIG_KEYS = /* @__PURE__ */ ((CONFIG_KEYS2) => { - CONFIG_KEYS2["OCO_OPENAI_API_KEY"] = "OCO_OPENAI_API_KEY"; - CONFIG_KEYS2["OCO_ANTHROPIC_API_KEY"] = "OCO_ANTHROPIC_API_KEY"; - CONFIG_KEYS2["OCO_AZURE_API_KEY"] = "OCO_AZURE_API_KEY"; - CONFIG_KEYS2["OCO_TOKENS_MAX_INPUT"] = "OCO_TOKENS_MAX_INPUT"; - CONFIG_KEYS2["OCO_TOKENS_MAX_OUTPUT"] = "OCO_TOKENS_MAX_OUTPUT"; - CONFIG_KEYS2["OCO_OPENAI_BASE_PATH"] = "OCO_OPENAI_BASE_PATH"; - CONFIG_KEYS2["OCO_DESCRIPTION"] = "OCO_DESCRIPTION"; - CONFIG_KEYS2["OCO_EMOJI"] = "OCO_EMOJI"; - CONFIG_KEYS2["OCO_MODEL"] = "OCO_MODEL"; - CONFIG_KEYS2["OCO_LANGUAGE"] = "OCO_LANGUAGE"; - CONFIG_KEYS2["OCO_MESSAGE_TEMPLATE_PLACEHOLDER"] = "OCO_MESSAGE_TEMPLATE_PLACEHOLDER"; - CONFIG_KEYS2["OCO_PROMPT_MODULE"] = "OCO_PROMPT_MODULE"; - CONFIG_KEYS2["OCO_AI_PROVIDER"] = "OCO_AI_PROVIDER"; - CONFIG_KEYS2["OCO_GITPUSH"] = "OCO_GITPUSH"; - CONFIG_KEYS2["OCO_ONE_LINE_COMMIT"] = "OCO_ONE_LINE_COMMIT"; - CONFIG_KEYS2["OCO_AZURE_ENDPOINT"] = "OCO_AZURE_ENDPOINT"; - CONFIG_KEYS2["OCO_OLLAMA_API_URL"] = "OCO_API_URL"; - return CONFIG_KEYS2; -})(CONFIG_KEYS || {}); var MODEL_LIST = { openai: [ "gpt-3.5-turbo", + "gpt-3.5-turbo-instruct", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-16k-0613", + "gpt-3.5-turbo-16k-0301", "gpt-4", - "gpt-4-turbo", + "gpt-4-0314", + "gpt-4-0613", "gpt-4-1106-preview", - "gpt-4-turbo-preview", "gpt-4-0125-preview", - "gpt-4o" + "gpt-4-turbo-preview", + "gpt-4-vision-preview", + "gpt-4-1106-vision-preview", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-4o", + "gpt-4o-2024-05-13", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18" ], anthropic: [ "claude-3-haiku-20240307", "claude-3-sonnet-20240229", "claude-3-opus-20240229" + ], + gemini: [ + "gemini-1.5-flash", + "gemini-1.5-pro", + "gemini-1.0-pro", + "gemini-pro-vision", + "text-embedding-004" ] }; var getDefaultModel = (provider4) => { @@ -30672,6 +30705,8 @@ var getDefaultModel = (provider4) => { return ""; case "anthropic": return MODEL_LIST.anthropic[0]; + case "gemini": + return MODEL_LIST.gemini[0]; default: return MODEL_LIST.openai[0]; } @@ -30686,6 +30721,8 @@ var validateConfig = (key, condition, validationMessage) => { }; var configValidators = { ["OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */](value, config11 = {}) { + if (config11.OCO_AI_PROVIDER == "gemini") + return value; validateConfig( "OpenAI API_KEY", value || config11.OCO_ANTHROPIC_API_KEY || config11.OCO_AI_PROVIDER.startsWith("ollama") || config11.OCO_AZURE_API_KEY || config11.OCO_AI_PROVIDER == "test", @@ -30706,11 +30743,21 @@ var configValidators = { ); return value; }, + ["OCO_GEMINI_API_KEY" /* OCO_GEMINI_API_KEY */](value, config11 = {}) { + if (config11.OCO_AI_PROVIDER != "gemini") + return value; + validateConfig( + "Gemini API Key", + value || config11.OCO_GEMINI_API_KEY || config11.OCO_AI_PROVIDER == "test", + "You need to provide an Gemini API key" + ); + return value; + }, ["OCO_ANTHROPIC_API_KEY" /* OCO_ANTHROPIC_API_KEY */](value, config11 = {}) { validateConfig( "ANTHROPIC_API_KEY", value || config11.OCO_OPENAI_API_KEY || config11.OCO_AI_PROVIDER == "ollama" || config11.OCO_AI_PROVIDER == "test", - "You need to provide an OpenAI/Anthropic/Azure API key" + "You need to provide an OpenAI/Anthropic API key" ); return value; }, @@ -30781,13 +30828,18 @@ var configValidators = { ["OCO_MODEL" /* OCO_MODEL */](value, config11 = {}) { validateConfig( "OCO_MODEL" /* OCO_MODEL */, - [...MODEL_LIST.openai, ...MODEL_LIST.anthropic].includes(value) || config11.OCO_AI_PROVIDER == "ollama" || config11.OCO_AI_PROVIDER == "test" || config11.OCO_AI_PROVIDER == "azure", - `${value} is not supported yet, use 'gpt-4o', 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview', 'gpt-4-0125-preview', 'claude-3-opus-20240229', 'claude-3-sonnet-20240229' or 'claude-3-haiku-20240307'` - ); - validateConfig( - "OCO_MODEL" /* OCO_MODEL */, - typeof value === "string" && value.match(/^[a-zA-Z0-9~\-]{1,63}[a-zA-Z0-9]$/) || config11.OCO_AI_PROVIDER != "azure", - `${value} is not model deployed name.` + [ + ...MODEL_LIST.openai, + ...MODEL_LIST.anthropic, + ...MODEL_LIST.gemini + ].includes(value) || config11.OCO_AI_PROVIDER == "ollama" || config11.OCO_AI_PROVIDER == "azure" || config11.OCO_AI_PROVIDER == "test", + `${value} is not supported yet, use: + + ${[ + ...MODEL_LIST.openai, + ...MODEL_LIST.anthropic, + ...MODEL_LIST.gemini + ].join("\n")}` ); return value; }, @@ -30818,15 +30870,8 @@ var configValidators = { ["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) { validateConfig( "OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */, - [ - "", - "openai", - "anthropic", - "azure", - "ollama", - "test" - ].includes(value) || value.startsWith("ollama"), - `${value} is not supported yet, use 'ollama/{model}', 'azure', 'anthropic' or 'openai' (default)` + ["", "openai", "anthropic", "gemini", "azure", "test"].includes(value) || value.startsWith("ollama"), + `${value} is not supported yet, use 'ollama', 'anthropic', 'azure', 'gemini' or 'openai' (default)` ); return value; }, @@ -30846,9 +30891,19 @@ var configValidators = { ); return value; }, - ["OCO_API_URL" /* OCO_OLLAMA_API_URL */](value) { + ["OCO_TEST_MOCK_TYPE" /* OCO_TEST_MOCK_TYPE */](value) { validateConfig( - CONFIG_KEYS.OCO_API_URL, + "OCO_TEST_MOCK_TYPE" /* OCO_TEST_MOCK_TYPE */, + TEST_MOCK_TYPES.includes(value), + `${value} is not supported yet, use ${TEST_MOCK_TYPES.map( + (t2) => `'${t2}'` + ).join(", ")}` + ); + return value; + }, + ["OCO_OLLAMA_API_URL" /* OCO_OLLAMA_API_URL */](value) { + validateConfig( + "OCO_API_URL" /* OCO_API_URL */, typeof value === "string" && value.startsWith("http"), `${value} is not a valid URL` ); @@ -30866,9 +30921,11 @@ var getConfig = ({ OCO_OPENAI_API_KEY: process.env.OCO_OPENAI_API_KEY, OCO_ANTHROPIC_API_KEY: process.env.OCO_ANTHROPIC_API_KEY, OCO_AZURE_API_KEY: process.env.OCO_AZURE_API_KEY, + OCO_GEMINI_API_KEY: process.env.OCO_GEMINI_API_KEY, OCO_TOKENS_MAX_INPUT: process.env.OCO_TOKENS_MAX_INPUT ? Number(process.env.OCO_TOKENS_MAX_INPUT) : void 0, OCO_TOKENS_MAX_OUTPUT: process.env.OCO_TOKENS_MAX_OUTPUT ? Number(process.env.OCO_TOKENS_MAX_OUTPUT) : void 0, OCO_OPENAI_BASE_PATH: process.env.OCO_OPENAI_BASE_PATH, + OCO_GEMINI_BASE_PATH: process.env.OCO_GEMINI_BASE_PATH, OCO_DESCRIPTION: process.env.OCO_DESCRIPTION === "true" ? true : false, OCO_EMOJI: process.env.OCO_EMOJI === "true" ? true : false, OCO_MODEL: process.env.OCO_MODEL || getDefaultModel(process.env.OCO_AI_PROVIDER), @@ -30878,7 +30935,8 @@ var getConfig = ({ OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai", OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true, OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false, - OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || "" + OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || "", + OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message" }; const configExists = (0, import_fs.existsSync)(configPath); if (!configExists) @@ -31114,15 +31172,38 @@ var commitlintPrompts = { }; // src/modules/commitlint/pwd-commitlint.ts +var import_promises = __toESM(require("fs/promises"), 1); var import_path2 = __toESM(require("path"), 1); -var nodeModulesPath = import_path2.default.join( - process.env.PWD || process.cwd(), - "node_modules", - "@commitlint", - "load" -); +var getCommitLintModuleType = async () => { + const packageFile = "node_modules/@commitlint/load/package.json"; + const packageJsonPath = import_path2.default.join( + process.env.PWD || process.cwd(), + packageFile + ); + const packageJson = JSON.parse(await import_promises.default.readFile(packageJsonPath, "utf8")); + if (!packageJson) { + throw new Error(`Failed to parse ${packageFile}`); + } + return packageJson.type === "module" ? "esm" : "cjs"; +}; var getCommitLintPWDConfig = async () => { - const load = require(nodeModulesPath).default; + let load, nodeModulesPath; + switch (await getCommitLintModuleType()) { + case "cjs": + nodeModulesPath = import_path2.default.join( + process.env.PWD || process.cwd(), + "node_modules/@commitlint/load" + ); + load = require(nodeModulesPath).default; + break; + case "esm": + nodeModulesPath = import_path2.default.join( + process.env.PWD || process.cwd(), + "node_modules/@commitlint/load/lib/load.js" + ); + load = (await import(nodeModulesPath)).default; + break; + } if (load && typeof load === "function") { return await load(); } @@ -31130,7 +31211,7 @@ var getCommitLintPWDConfig = async () => { }; // src/modules/commitlint/utils.ts -var import_promises = __toESM(require("fs/promises"), 1); +var import_promises2 = __toESM(require("fs/promises"), 1); var removeDoubleNewlines = (input) => { const pattern = /\\n\\n/g; if (pattern.test(input)) { @@ -31143,7 +31224,7 @@ var getJSONBlock = (input) => { const jsonIndex = input.search("```json"); if (jsonIndex > -1) { input = input.slice(jsonIndex + 8); - const endJsonIndex = consistency.search("```"); + const endJsonIndex = input.search("```"); input = input.slice(0, endJsonIndex); } return input; @@ -31151,7 +31232,7 @@ var getJSONBlock = (input) => { var commitlintLLMConfigExists = async () => { let exists; try { - await import_promises.default.access(COMMITLINT_LLM_CONFIG_PATH); + await import_promises2.default.access(COMMITLINT_LLM_CONFIG_PATH); exists = true; } catch (e3) { exists = false; @@ -31159,13 +31240,13 @@ var commitlintLLMConfigExists = async () => { return exists; }; var writeCommitlintLLMConfig = async (commitlintLLMConfig) => { - await import_promises.default.writeFile( + await import_promises2.default.writeFile( COMMITLINT_LLM_CONFIG_PATH, JSON.stringify(commitlintLLMConfig, null, 2) ); }; var getCommitlintLLMConfig = async () => { - const content = await import_promises.default.readFile(COMMITLINT_LLM_CONFIG_PATH); + const content = await import_promises2.default.readFile(COMMITLINT_LLM_CONFIG_PATH); const commitLintLLMConfig = JSON.parse( content.toString() ); @@ -34131,55 +34212,910 @@ if (provider === "openai" && !MODEL_LIST.openai.includes(MODEL) && command !== " process.exit(1); } var OpenAi = class { - openAiApiConfiguration = new import_openai2.Configuration({ - apiKey - }); - openAI; constructor() { + this.openAiApiConfiguration = new import_openai2.Configuration({ + apiKey + }); + this.generateCommitMessage = async (messages) => { + const params = { + model: MODEL, + messages, + temperature: 0, + top_p: 0.1, + max_tokens: MAX_TOKENS_OUTPUT + }; + try { + const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a4, b7) => a4 + b7, 0); + if (REQUEST_TOKENS > MAX_TOKENS_INPUT - MAX_TOKENS_OUTPUT) { + throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); + } + const { data } = await this.openAI.createChatCompletion(params); + const message = data.choices[0].message; + return message?.content; + } catch (error) { + ce(`${source_default.red("\u2716")} ${JSON.stringify(params)}`); + const err = error; + ce(`${source_default.red("\u2716")} ${err?.message || err}`); + if (axios_default.isAxiosError(error) && error.response?.status === 401) { + const openAiError = error.response.data.error; + if (openAiError?.message) + ce(openAiError.message); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + } + throw err; + } + }; if (basePath) { this.openAiApiConfiguration.basePath = basePath; } this.openAI = new import_openai2.OpenAIApi(this.openAiApiConfiguration); } - generateCommitMessage = async (messages) => { - const params = { - model: MODEL, - messages, - temperature: 0, - top_p: 0.1, - max_tokens: MAX_TOKENS_OUTPUT - }; - try { - const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a4, b7) => a4 + b7, 0); - if (REQUEST_TOKENS > MAX_TOKENS_INPUT - MAX_TOKENS_OUTPUT) { - throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); +}; + +// node_modules/@google/generative-ai/dist/index.mjs +var POSSIBLE_ROLES = ["user", "model", "function", "system"]; +var HarmCategory; +(function(HarmCategory2) { + HarmCategory2["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED"; + HarmCategory2["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH"; + HarmCategory2["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT"; + HarmCategory2["HARM_CATEGORY_HARASSMENT"] = "HARM_CATEGORY_HARASSMENT"; + HarmCategory2["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT"; +})(HarmCategory || (HarmCategory = {})); +var HarmBlockThreshold; +(function(HarmBlockThreshold2) { + HarmBlockThreshold2["HARM_BLOCK_THRESHOLD_UNSPECIFIED"] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED"; + HarmBlockThreshold2["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE"; + HarmBlockThreshold2["BLOCK_MEDIUM_AND_ABOVE"] = "BLOCK_MEDIUM_AND_ABOVE"; + HarmBlockThreshold2["BLOCK_ONLY_HIGH"] = "BLOCK_ONLY_HIGH"; + HarmBlockThreshold2["BLOCK_NONE"] = "BLOCK_NONE"; +})(HarmBlockThreshold || (HarmBlockThreshold = {})); +var HarmProbability; +(function(HarmProbability2) { + HarmProbability2["HARM_PROBABILITY_UNSPECIFIED"] = "HARM_PROBABILITY_UNSPECIFIED"; + HarmProbability2["NEGLIGIBLE"] = "NEGLIGIBLE"; + HarmProbability2["LOW"] = "LOW"; + HarmProbability2["MEDIUM"] = "MEDIUM"; + HarmProbability2["HIGH"] = "HIGH"; +})(HarmProbability || (HarmProbability = {})); +var BlockReason; +(function(BlockReason2) { + BlockReason2["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED"; + BlockReason2["SAFETY"] = "SAFETY"; + BlockReason2["OTHER"] = "OTHER"; +})(BlockReason || (BlockReason = {})); +var FinishReason; +(function(FinishReason2) { + FinishReason2["FINISH_REASON_UNSPECIFIED"] = "FINISH_REASON_UNSPECIFIED"; + FinishReason2["STOP"] = "STOP"; + FinishReason2["MAX_TOKENS"] = "MAX_TOKENS"; + FinishReason2["SAFETY"] = "SAFETY"; + FinishReason2["RECITATION"] = "RECITATION"; + FinishReason2["OTHER"] = "OTHER"; +})(FinishReason || (FinishReason = {})); +var TaskType; +(function(TaskType2) { + TaskType2["TASK_TYPE_UNSPECIFIED"] = "TASK_TYPE_UNSPECIFIED"; + TaskType2["RETRIEVAL_QUERY"] = "RETRIEVAL_QUERY"; + TaskType2["RETRIEVAL_DOCUMENT"] = "RETRIEVAL_DOCUMENT"; + TaskType2["SEMANTIC_SIMILARITY"] = "SEMANTIC_SIMILARITY"; + TaskType2["CLASSIFICATION"] = "CLASSIFICATION"; + TaskType2["CLUSTERING"] = "CLUSTERING"; +})(TaskType || (TaskType = {})); +var FunctionCallingMode; +(function(FunctionCallingMode2) { + FunctionCallingMode2["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED"; + FunctionCallingMode2["AUTO"] = "AUTO"; + FunctionCallingMode2["ANY"] = "ANY"; + FunctionCallingMode2["NONE"] = "NONE"; +})(FunctionCallingMode || (FunctionCallingMode = {})); +var FunctionDeclarationSchemaType; +(function(FunctionDeclarationSchemaType2) { + FunctionDeclarationSchemaType2["STRING"] = "STRING"; + FunctionDeclarationSchemaType2["NUMBER"] = "NUMBER"; + FunctionDeclarationSchemaType2["INTEGER"] = "INTEGER"; + FunctionDeclarationSchemaType2["BOOLEAN"] = "BOOLEAN"; + FunctionDeclarationSchemaType2["ARRAY"] = "ARRAY"; + FunctionDeclarationSchemaType2["OBJECT"] = "OBJECT"; +})(FunctionDeclarationSchemaType || (FunctionDeclarationSchemaType = {})); +var GoogleGenerativeAIError = class extends Error { + constructor(message) { + super(`[GoogleGenerativeAI Error]: ${message}`); + } +}; +var GoogleGenerativeAIResponseError = class extends GoogleGenerativeAIError { + constructor(message, response) { + super(message); + this.response = response; + } +}; +var GoogleGenerativeAIFetchError = class extends GoogleGenerativeAIError { + constructor(message, status, statusText, errorDetails) { + super(message); + this.status = status; + this.statusText = statusText; + this.errorDetails = errorDetails; + } +}; +var GoogleGenerativeAIRequestInputError = class extends GoogleGenerativeAIError { +}; +var DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com"; +var DEFAULT_API_VERSION = "v1beta"; +var PACKAGE_VERSION = "0.11.4"; +var PACKAGE_LOG_HEADER = "genai-js"; +var Task; +(function(Task2) { + Task2["GENERATE_CONTENT"] = "generateContent"; + Task2["STREAM_GENERATE_CONTENT"] = "streamGenerateContent"; + Task2["COUNT_TOKENS"] = "countTokens"; + Task2["EMBED_CONTENT"] = "embedContent"; + Task2["BATCH_EMBED_CONTENTS"] = "batchEmbedContents"; +})(Task || (Task = {})); +var RequestUrl = class { + constructor(model, task, apiKey4, stream4, requestOptions) { + this.model = model; + this.task = task; + this.apiKey = apiKey4; + this.stream = stream4; + this.requestOptions = requestOptions; + } + toString() { + var _a4, _b2; + const apiVersion = ((_a4 = this.requestOptions) === null || _a4 === void 0 ? void 0 : _a4.apiVersion) || DEFAULT_API_VERSION; + const baseUrl = ((_b2 = this.requestOptions) === null || _b2 === void 0 ? void 0 : _b2.baseUrl) || DEFAULT_BASE_URL; + let url2 = `${baseUrl}/${apiVersion}/${this.model}:${this.task}`; + if (this.stream) { + url2 += "?alt=sse"; + } + return url2; + } +}; +function getClientHeaders(requestOptions) { + const clientHeaders = []; + if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiClient) { + clientHeaders.push(requestOptions.apiClient); + } + clientHeaders.push(`${PACKAGE_LOG_HEADER}/${PACKAGE_VERSION}`); + return clientHeaders.join(" "); +} +async function getHeaders(url2) { + const headers = new Headers(); + headers.append("Content-Type", "application/json"); + headers.append("x-goog-api-client", getClientHeaders(url2.requestOptions)); + headers.append("x-goog-api-key", url2.apiKey); + let customHeaders = url2.requestOptions.customHeaders; + if (customHeaders) { + if (!(customHeaders instanceof Headers)) { + try { + customHeaders = new Headers(customHeaders); + } catch (e3) { + throw new GoogleGenerativeAIRequestInputError(`unable to convert customHeaders value ${JSON.stringify(customHeaders)} to Headers: ${e3.message}`); } - const { data } = await this.openAI.createChatCompletion(params); - const message = data.choices[0].message; - return message?.content; + } + for (const [headerName, headerValue] of customHeaders.entries()) { + if (headerName === "x-goog-api-key") { + throw new GoogleGenerativeAIRequestInputError(`Cannot set reserved header name ${headerName}`); + } else if (headerName === "x-goog-api-client") { + throw new GoogleGenerativeAIRequestInputError(`Header name ${headerName} can only be set using the apiClient field`); + } + headers.append(headerName, headerValue); + } + } + return headers; +} +async function constructRequest(model, task, apiKey4, stream4, body, requestOptions) { + const url2 = new RequestUrl(model, task, apiKey4, stream4, requestOptions); + return { + url: url2.toString(), + fetchOptions: Object.assign(Object.assign({}, buildFetchOptions(requestOptions)), { method: "POST", headers: await getHeaders(url2), body }) + }; +} +async function makeRequest(model, task, apiKey4, stream4, body, requestOptions) { + return _makeRequestInternal(model, task, apiKey4, stream4, body, requestOptions, fetch); +} +async function _makeRequestInternal(model, task, apiKey4, stream4, body, requestOptions, fetchFn = fetch) { + const url2 = new RequestUrl(model, task, apiKey4, stream4, requestOptions); + let response; + try { + const request3 = await constructRequest(model, task, apiKey4, stream4, body, requestOptions); + response = await fetchFn(request3.url, request3.fetchOptions); + if (!response.ok) { + let message = ""; + let errorDetails; + try { + const json = await response.json(); + message = json.error.message; + if (json.error.details) { + message += ` ${JSON.stringify(json.error.details)}`; + errorDetails = json.error.details; + } + } catch (e3) { + } + throw new GoogleGenerativeAIFetchError(`Error fetching from ${url2.toString()}: [${response.status} ${response.statusText}] ${message}`, response.status, response.statusText, errorDetails); + } + } catch (e3) { + let err = e3; + if (!(e3 instanceof GoogleGenerativeAIFetchError || e3 instanceof GoogleGenerativeAIRequestInputError)) { + err = new GoogleGenerativeAIError(`Error fetching from ${url2.toString()}: ${e3.message}`); + err.stack = e3.stack; + } + throw err; + } + return response; +} +function buildFetchOptions(requestOptions) { + const fetchOptions = {}; + if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeout) >= 0) { + const abortController = new AbortController(); + const signal = abortController.signal; + setTimeout(() => abortController.abort(), requestOptions.timeout); + fetchOptions.signal = signal; + } + return fetchOptions; +} +function addHelpers(response) { + response.text = () => { + if (response.candidates && response.candidates.length > 0) { + if (response.candidates.length > 1) { + console.warn(`This response had ${response.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`); + } + if (hadBadFinishReason(response.candidates[0])) { + throw new GoogleGenerativeAIResponseError(`${formatBlockErrorMessage(response)}`, response); + } + return getText(response); + } else if (response.promptFeedback) { + throw new GoogleGenerativeAIResponseError(`Text not available. ${formatBlockErrorMessage(response)}`, response); + } + return ""; + }; + response.functionCall = () => { + if (response.candidates && response.candidates.length > 0) { + if (response.candidates.length > 1) { + console.warn(`This response had ${response.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`); + } + if (hadBadFinishReason(response.candidates[0])) { + throw new GoogleGenerativeAIResponseError(`${formatBlockErrorMessage(response)}`, response); + } + console.warn(`response.functionCall() is deprecated. Use response.functionCalls() instead.`); + return getFunctionCalls(response)[0]; + } else if (response.promptFeedback) { + throw new GoogleGenerativeAIResponseError(`Function call not available. ${formatBlockErrorMessage(response)}`, response); + } + return void 0; + }; + response.functionCalls = () => { + if (response.candidates && response.candidates.length > 0) { + if (response.candidates.length > 1) { + console.warn(`This response had ${response.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`); + } + if (hadBadFinishReason(response.candidates[0])) { + throw new GoogleGenerativeAIResponseError(`${formatBlockErrorMessage(response)}`, response); + } + return getFunctionCalls(response); + } else if (response.promptFeedback) { + throw new GoogleGenerativeAIResponseError(`Function call not available. ${formatBlockErrorMessage(response)}`, response); + } + return void 0; + }; + return response; +} +function getText(response) { + var _a4, _b2, _c2, _d2; + const textStrings = []; + if ((_b2 = (_a4 = response.candidates) === null || _a4 === void 0 ? void 0 : _a4[0].content) === null || _b2 === void 0 ? void 0 : _b2.parts) { + for (const part of (_d2 = (_c2 = response.candidates) === null || _c2 === void 0 ? void 0 : _c2[0].content) === null || _d2 === void 0 ? void 0 : _d2.parts) { + if (part.text) { + textStrings.push(part.text); + } + } + } + if (textStrings.length > 0) { + return textStrings.join(""); + } else { + return ""; + } +} +function getFunctionCalls(response) { + var _a4, _b2, _c2, _d2; + const functionCalls = []; + if ((_b2 = (_a4 = response.candidates) === null || _a4 === void 0 ? void 0 : _a4[0].content) === null || _b2 === void 0 ? void 0 : _b2.parts) { + for (const part of (_d2 = (_c2 = response.candidates) === null || _c2 === void 0 ? void 0 : _c2[0].content) === null || _d2 === void 0 ? void 0 : _d2.parts) { + if (part.functionCall) { + functionCalls.push(part.functionCall); + } + } + } + if (functionCalls.length > 0) { + return functionCalls; + } else { + return void 0; + } +} +var badFinishReasons = [FinishReason.RECITATION, FinishReason.SAFETY]; +function hadBadFinishReason(candidate) { + return !!candidate.finishReason && badFinishReasons.includes(candidate.finishReason); +} +function formatBlockErrorMessage(response) { + var _a4, _b2, _c2; + let message = ""; + if ((!response.candidates || response.candidates.length === 0) && response.promptFeedback) { + message += "Response was blocked"; + if ((_a4 = response.promptFeedback) === null || _a4 === void 0 ? void 0 : _a4.blockReason) { + message += ` due to ${response.promptFeedback.blockReason}`; + } + if ((_b2 = response.promptFeedback) === null || _b2 === void 0 ? void 0 : _b2.blockReasonMessage) { + message += `: ${response.promptFeedback.blockReasonMessage}`; + } + } else if ((_c2 = response.candidates) === null || _c2 === void 0 ? void 0 : _c2[0]) { + const firstCandidate = response.candidates[0]; + if (hadBadFinishReason(firstCandidate)) { + message += `Candidate was blocked due to ${firstCandidate.finishReason}`; + if (firstCandidate.finishMessage) { + message += `: ${firstCandidate.finishMessage}`; + } + } + } + return message; +} +function __await(v5) { + return this instanceof __await ? (this.v = v5, this) : new __await(v5); +} +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var g4 = generator.apply(thisArg, _arguments || []), i3, q6 = []; + return i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { + return this; + }, i3; + function verb(n2) { + if (g4[n2]) + i3[n2] = function(v5) { + return new Promise(function(a4, b7) { + q6.push([n2, v5, a4, b7]) > 1 || resume(n2, v5); + }); + }; + } + function resume(n2, v5) { + try { + step(g4[n2](v5)); + } catch (e3) { + settle2(q6[0][3], e3); + } + } + function step(r3) { + r3.value instanceof __await ? Promise.resolve(r3.value.v).then(fulfill, reject) : settle2(q6[0][2], r3); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle2(f4, v5) { + if (f4(v5), q6.shift(), q6.length) + resume(q6[0][0], q6[0][1]); + } +} +var responseLineRE = /^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/; +function processStream(response) { + const inputStream = response.body.pipeThrough(new TextDecoderStream("utf8", { fatal: true })); + const responseStream = getResponseStream(inputStream); + const [stream1, stream22] = responseStream.tee(); + return { + stream: generateResponseSequence(stream1), + response: getResponsePromise(stream22) + }; +} +async function getResponsePromise(stream4) { + const allResponses = []; + const reader = stream4.getReader(); + while (true) { + const { done, value } = await reader.read(); + if (done) { + return addHelpers(aggregateResponses(allResponses)); + } + allResponses.push(value); + } +} +function generateResponseSequence(stream4) { + return __asyncGenerator(this, arguments, function* generateResponseSequence_1() { + const reader = stream4.getReader(); + while (true) { + const { value, done } = yield __await(reader.read()); + if (done) { + break; + } + yield yield __await(addHelpers(value)); + } + }); +} +function getResponseStream(inputStream) { + const reader = inputStream.getReader(); + const stream4 = new ReadableStream({ + start(controller) { + let currentText = ""; + return pump(); + function pump() { + return reader.read().then(({ value, done }) => { + if (done) { + if (currentText.trim()) { + controller.error(new GoogleGenerativeAIError("Failed to parse stream")); + return; + } + controller.close(); + return; + } + currentText += value; + let match = currentText.match(responseLineRE); + let parsedResponse; + while (match) { + try { + parsedResponse = JSON.parse(match[1]); + } catch (e3) { + controller.error(new GoogleGenerativeAIError(`Error parsing JSON response: "${match[1]}"`)); + return; + } + controller.enqueue(parsedResponse); + currentText = currentText.substring(match[0].length); + match = currentText.match(responseLineRE); + } + return pump(); + }); + } + } + }); + return stream4; +} +function aggregateResponses(responses) { + const lastResponse = responses[responses.length - 1]; + const aggregatedResponse = { + promptFeedback: lastResponse === null || lastResponse === void 0 ? void 0 : lastResponse.promptFeedback + }; + for (const response of responses) { + if (response.candidates) { + for (const candidate of response.candidates) { + const i3 = candidate.index; + if (!aggregatedResponse.candidates) { + aggregatedResponse.candidates = []; + } + if (!aggregatedResponse.candidates[i3]) { + aggregatedResponse.candidates[i3] = { + index: candidate.index + }; + } + aggregatedResponse.candidates[i3].citationMetadata = candidate.citationMetadata; + aggregatedResponse.candidates[i3].finishReason = candidate.finishReason; + aggregatedResponse.candidates[i3].finishMessage = candidate.finishMessage; + aggregatedResponse.candidates[i3].safetyRatings = candidate.safetyRatings; + if (candidate.content && candidate.content.parts) { + if (!aggregatedResponse.candidates[i3].content) { + aggregatedResponse.candidates[i3].content = { + role: candidate.content.role || "user", + parts: [] + }; + } + const newPart = {}; + for (const part of candidate.content.parts) { + if (part.text) { + newPart.text = part.text; + } + if (part.functionCall) { + newPart.functionCall = part.functionCall; + } + if (Object.keys(newPart).length === 0) { + newPart.text = ""; + } + aggregatedResponse.candidates[i3].content.parts.push(newPart); + } + } + } + } + } + return aggregatedResponse; +} +async function generateContentStream(apiKey4, model, params, requestOptions) { + const response = await makeRequest( + model, + Task.STREAM_GENERATE_CONTENT, + apiKey4, + true, + JSON.stringify(params), + requestOptions + ); + return processStream(response); +} +async function generateContent(apiKey4, model, params, requestOptions) { + const response = await makeRequest( + model, + Task.GENERATE_CONTENT, + apiKey4, + false, + JSON.stringify(params), + requestOptions + ); + const responseJson = await response.json(); + const enhancedResponse = addHelpers(responseJson); + return { + response: enhancedResponse + }; +} +function formatSystemInstruction(input) { + if (input == null) { + return void 0; + } else if (typeof input === "string") { + return { role: "system", parts: [{ text: input }] }; + } else if (input.text) { + return { role: "system", parts: [input] }; + } else if (input.parts) { + if (!input.role) { + return { role: "system", parts: input.parts }; + } else { + return input; + } + } +} +function formatNewContent(request3) { + let newParts = []; + if (typeof request3 === "string") { + newParts = [{ text: request3 }]; + } else { + for (const partOrString of request3) { + if (typeof partOrString === "string") { + newParts.push({ text: partOrString }); + } else { + newParts.push(partOrString); + } + } + } + return assignRoleToPartsAndValidateSendMessageRequest(newParts); +} +function assignRoleToPartsAndValidateSendMessageRequest(parts) { + const userContent = { role: "user", parts: [] }; + const functionContent = { role: "function", parts: [] }; + let hasUserContent = false; + let hasFunctionContent = false; + for (const part of parts) { + if ("functionResponse" in part) { + functionContent.parts.push(part); + hasFunctionContent = true; + } else { + userContent.parts.push(part); + hasUserContent = true; + } + } + if (hasUserContent && hasFunctionContent) { + throw new GoogleGenerativeAIError("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message."); + } + if (!hasUserContent && !hasFunctionContent) { + throw new GoogleGenerativeAIError("No content is provided for sending chat message."); + } + if (hasUserContent) { + return userContent; + } + return functionContent; +} +function formatGenerateContentInput(params) { + let formattedRequest; + if (params.contents) { + formattedRequest = params; + } else { + const content = formatNewContent(params); + formattedRequest = { contents: [content] }; + } + if (params.systemInstruction) { + formattedRequest.systemInstruction = formatSystemInstruction(params.systemInstruction); + } + return formattedRequest; +} +function formatEmbedContentInput(params) { + if (typeof params === "string" || Array.isArray(params)) { + const content = formatNewContent(params); + return { content }; + } + return params; +} +var VALID_PART_FIELDS = [ + "text", + "inlineData", + "functionCall", + "functionResponse" +]; +var VALID_PARTS_PER_ROLE = { + user: ["text", "inlineData"], + function: ["functionResponse"], + model: ["text", "functionCall"], + system: ["text"] +}; +function validateChatHistory(history) { + let prevContent = false; + for (const currContent of history) { + const { role, parts } = currContent; + if (!prevContent && role !== "user") { + throw new GoogleGenerativeAIError(`First content should be with role 'user', got ${role}`); + } + if (!POSSIBLE_ROLES.includes(role)) { + throw new GoogleGenerativeAIError(`Each item should include role field. Got ${role} but valid roles are: ${JSON.stringify(POSSIBLE_ROLES)}`); + } + if (!Array.isArray(parts)) { + throw new GoogleGenerativeAIError("Content should have 'parts' property with an array of Parts"); + } + if (parts.length === 0) { + throw new GoogleGenerativeAIError("Each Content should have at least one part"); + } + const countFields = { + text: 0, + inlineData: 0, + functionCall: 0, + functionResponse: 0, + fileData: 0 + }; + for (const part of parts) { + for (const key of VALID_PART_FIELDS) { + if (key in part) { + countFields[key] += 1; + } + } + } + const validParts = VALID_PARTS_PER_ROLE[role]; + for (const key of VALID_PART_FIELDS) { + if (!validParts.includes(key) && countFields[key] > 0) { + throw new GoogleGenerativeAIError(`Content with role '${role}' can't contain '${key}' part`); + } + } + prevContent = true; + } +} +var SILENT_ERROR = "SILENT_ERROR"; +var ChatSession = class { + constructor(apiKey4, model, params, requestOptions) { + this.model = model; + this.params = params; + this.requestOptions = requestOptions; + this._history = []; + this._sendPromise = Promise.resolve(); + this._apiKey = apiKey4; + if (params === null || params === void 0 ? void 0 : params.history) { + validateChatHistory(params.history); + this._history = params.history; + } + } + async getHistory() { + await this._sendPromise; + return this._history; + } + async sendMessage(request3) { + var _a4, _b2, _c2, _d2, _e2; + await this._sendPromise; + const newContent = formatNewContent(request3); + const generateContentRequest = { + safetySettings: (_a4 = this.params) === null || _a4 === void 0 ? void 0 : _a4.safetySettings, + generationConfig: (_b2 = this.params) === null || _b2 === void 0 ? void 0 : _b2.generationConfig, + tools: (_c2 = this.params) === null || _c2 === void 0 ? void 0 : _c2.tools, + toolConfig: (_d2 = this.params) === null || _d2 === void 0 ? void 0 : _d2.toolConfig, + systemInstruction: (_e2 = this.params) === null || _e2 === void 0 ? void 0 : _e2.systemInstruction, + contents: [...this._history, newContent] + }; + let finalResult; + this._sendPromise = this._sendPromise.then(() => generateContent(this._apiKey, this.model, generateContentRequest, this.requestOptions)).then((result) => { + var _a5; + if (result.response.candidates && result.response.candidates.length > 0) { + this._history.push(newContent); + const responseContent = Object.assign({ + parts: [], + role: "model" + }, (_a5 = result.response.candidates) === null || _a5 === void 0 ? void 0 : _a5[0].content); + this._history.push(responseContent); + } else { + const blockErrorMessage = formatBlockErrorMessage(result.response); + if (blockErrorMessage) { + console.warn(`sendMessage() was unsuccessful. ${blockErrorMessage}. Inspect response object for details.`); + } + } + finalResult = result; + }); + await this._sendPromise; + return finalResult; + } + async sendMessageStream(request3) { + var _a4, _b2, _c2, _d2, _e2; + await this._sendPromise; + const newContent = formatNewContent(request3); + const generateContentRequest = { + safetySettings: (_a4 = this.params) === null || _a4 === void 0 ? void 0 : _a4.safetySettings, + generationConfig: (_b2 = this.params) === null || _b2 === void 0 ? void 0 : _b2.generationConfig, + tools: (_c2 = this.params) === null || _c2 === void 0 ? void 0 : _c2.tools, + toolConfig: (_d2 = this.params) === null || _d2 === void 0 ? void 0 : _d2.toolConfig, + systemInstruction: (_e2 = this.params) === null || _e2 === void 0 ? void 0 : _e2.systemInstruction, + contents: [...this._history, newContent] + }; + const streamPromise = generateContentStream(this._apiKey, this.model, generateContentRequest, this.requestOptions); + this._sendPromise = this._sendPromise.then(() => streamPromise).catch((_ignored) => { + throw new Error(SILENT_ERROR); + }).then((streamResult) => streamResult.response).then((response) => { + if (response.candidates && response.candidates.length > 0) { + this._history.push(newContent); + const responseContent = Object.assign({}, response.candidates[0].content); + if (!responseContent.role) { + responseContent.role = "model"; + } + this._history.push(responseContent); + } else { + const blockErrorMessage = formatBlockErrorMessage(response); + if (blockErrorMessage) { + console.warn(`sendMessageStream() was unsuccessful. ${blockErrorMessage}. Inspect response object for details.`); + } + } + }).catch((e3) => { + if (e3.message !== SILENT_ERROR) { + console.error(e3); + } + }); + return streamPromise; + } +}; +async function countTokens(apiKey4, model, params, requestOptions) { + const response = await makeRequest(model, Task.COUNT_TOKENS, apiKey4, false, JSON.stringify(Object.assign(Object.assign({}, params), { model })), requestOptions); + return response.json(); +} +async function embedContent(apiKey4, model, params, requestOptions) { + const response = await makeRequest(model, Task.EMBED_CONTENT, apiKey4, false, JSON.stringify(params), requestOptions); + return response.json(); +} +async function batchEmbedContents(apiKey4, model, params, requestOptions) { + const requestsWithModel = params.requests.map((request3) => { + return Object.assign(Object.assign({}, request3), { model }); + }); + const response = await makeRequest(model, Task.BATCH_EMBED_CONTENTS, apiKey4, false, JSON.stringify({ requests: requestsWithModel }), requestOptions); + return response.json(); +} +var GenerativeModel = class { + constructor(apiKey4, modelParams, requestOptions) { + this.apiKey = apiKey4; + if (modelParams.model.includes("/")) { + this.model = modelParams.model; + } else { + this.model = `models/${modelParams.model}`; + } + this.generationConfig = modelParams.generationConfig || {}; + this.safetySettings = modelParams.safetySettings || []; + this.tools = modelParams.tools; + this.toolConfig = modelParams.toolConfig; + this.systemInstruction = formatSystemInstruction(modelParams.systemInstruction); + this.requestOptions = requestOptions || {}; + } + async generateContent(request3) { + const formattedParams = formatGenerateContentInput(request3); + return generateContent(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction }, formattedParams), this.requestOptions); + } + async generateContentStream(request3) { + const formattedParams = formatGenerateContentInput(request3); + return generateContentStream(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction }, formattedParams), this.requestOptions); + } + startChat(startChatParams) { + return new ChatSession(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction }, startChatParams), this.requestOptions); + } + async countTokens(request3) { + const formattedParams = formatGenerateContentInput(request3); + return countTokens(this.apiKey, this.model, formattedParams, this.requestOptions); + } + async embedContent(request3) { + const formattedParams = formatEmbedContentInput(request3); + return embedContent(this.apiKey, this.model, formattedParams, this.requestOptions); + } + async batchEmbedContents(batchEmbedContentRequest) { + return batchEmbedContents(this.apiKey, this.model, batchEmbedContentRequest, this.requestOptions); + } +}; +var GoogleGenerativeAI = class { + constructor(apiKey4) { + this.apiKey = apiKey4; + } + getGenerativeModel(modelParams, requestOptions) { + if (!modelParams.model) { + throw new GoogleGenerativeAIError(`Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })`); + } + return new GenerativeModel(this.apiKey, modelParams, requestOptions); + } +}; + +// src/engine/gemini.ts +var Gemini = class { + constructor() { + this.maxTokens = { + input: 4096 /* DEFAULT_MAX_TOKENS_INPUT */, + output: 500 /* DEFAULT_MAX_TOKENS_OUTPUT */ + }; + this.config = getConfig(); + this.googleGenerativeAi = new GoogleGenerativeAI(this.config.OCO_GEMINI_API_KEY); + this.warmup(); + } + async generateCommitMessage(messages) { + const systemInstruction = messages.filter((m5) => m5.role === "system").map((m5) => m5.content).join("\n"); + this.ai = this.googleGenerativeAi.getGenerativeModel({ + model: this.model, + systemInstruction + }); + const contents = messages.filter((m5) => m5.role !== "system").map((m5) => ({ parts: [{ text: m5.content }], role: m5.role == "user" ? m5.role : "model" })); + try { + const result = await this.ai.generateContent({ + contents, + safetySettings: [ + { + category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + }, + { + category: HarmCategory.HARM_CATEGORY_HARASSMENT, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + }, + { + category: HarmCategory.HARM_CATEGORY_HATE_SPEECH, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + }, + { + category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + } + ], + generationConfig: { + maxOutputTokens: this.maxTokens.output, + temperature: 0, + topP: 0.1 + } + }); + return result.response.text(); } catch (error) { - ce(`${source_default.red("\u2716")} ${JSON.stringify(params)}`); const err = error; ce(`${source_default.red("\u2716")} ${err?.message || err}`); if (axios_default.isAxiosError(error) && error.response?.status === 401) { - const openAiError = error.response.data.error; - if (openAiError?.message) - ce(openAiError.message); + const geminiError = error.response.data.error; + if (geminiError?.message) + ce(geminiError.message); ce( "For help look into README https://github.com/di-sukharev/opencommit#setup" ); } throw err; } - }; + } + warmup() { + if (this.config.OCO_TOKENS_MAX_INPUT !== void 0) + this.maxTokens.input = this.config.OCO_TOKENS_MAX_INPUT; + if (this.config.OCO_TOKENS_MAX_OUTPUT !== void 0) + this.maxTokens.output = this.config.OCO_TOKENS_MAX_OUTPUT; + this.basePath = this.config.OCO_GEMINI_BASE_PATH; + this.apiKey = this.config.OCO_GEMINI_API_KEY; + const [command4, mode4] = process.argv.slice(2); + const provider4 = this.config.OCO_AI_PROVIDER; + if (provider4 === "gemini" && !this.apiKey && command4 !== "config" && mode4 !== "set") { + ae("opencommit"); + ce("OCO_GEMINI_API_KEY is not set, please run `oco config set OCO_GEMINI_API_KEY= . If you are using GPT, make sure you add payment details, so API works."); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + process.exit(1); + } + this.model = this.config.OCO_MODEL || MODEL_LIST.gemini[0]; + if (provider4 === "gemini" && !MODEL_LIST.gemini.includes(this.model) && command4 !== "config" && mode4 !== "set" /* set */) { + ce( + `${source_default.red("\u2716")} Unsupported model ${this.model} for Gemini. Supported models are: ${MODEL_LIST.gemini.join( + ", " + )}` + ); + process.exit(1); + } + } }; -var api = new OpenAi(); // src/engine/ollama.ts var config4 = getConfig(); var OllamaAi = class { - model = "mistral"; - url = "http://localhost:11434/api/chat"; + constructor() { + this.model = "mistral"; + this.url = "http://localhost:11434/api/chat"; + } setModel(model) { this.model = model ?? config4?.OCO_MODEL ?? "mistral"; } @@ -34209,7 +35145,2163 @@ var OllamaAi = class { } } }; -var ollamaAi = new OllamaAi(); + +// node_modules/@anthropic-ai/sdk/version.mjs +var VERSION3 = "0.19.2"; + +// node_modules/@anthropic-ai/sdk/_shims/registry.mjs +var auto = false; +var kind = void 0; +var fetch2 = void 0; +var Request = void 0; +var Response = void 0; +var Headers2 = void 0; +var FormData3 = void 0; +var Blob2 = void 0; +var File2 = void 0; +var ReadableStream2 = void 0; +var getMultipartRequestOptions = void 0; +var getDefaultAgent = void 0; +var fileFromPath = void 0; +var isFsReadStream = void 0; +function setShims(shims, options = { auto: false }) { + if (auto) { + throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` before importing anything else from @anthropic-ai/sdk`); + } + if (kind) { + throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` after \`import '@anthropic-ai/sdk/shims/${kind}'\``); + } + auto = options.auto; + kind = shims.kind; + fetch2 = shims.fetch; + Request = shims.Request; + Response = shims.Response; + Headers2 = shims.Headers; + FormData3 = shims.FormData; + Blob2 = shims.Blob; + File2 = shims.File; + ReadableStream2 = shims.ReadableStream; + getMultipartRequestOptions = shims.getMultipartRequestOptions; + getDefaultAgent = shims.getDefaultAgent; + fileFromPath = shims.fileFromPath; + isFsReadStream = shims.isFsReadStream; +} + +// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs +var nf = __toESM(require_lib3(), 1); + +// node_modules/formdata-node/lib/esm/FormData.js +var import_util4 = require("util"); +init_File(); +init_isFile(); + +// node_modules/formdata-node/lib/esm/isBlob.js +init_Blob(); +var isBlob2 = (value) => value instanceof Blob3; + +// node_modules/formdata-node/lib/esm/FormData.js +init_isFunction(); + +// node_modules/formdata-node/lib/esm/deprecateConstructorEntries.js +var import_util3 = require("util"); +var deprecateConstructorEntries = (0, import_util3.deprecate)(() => { +}, 'Constructor "entries" argument is not spec-compliant and will be removed in next major release.'); + +// node_modules/formdata-node/lib/esm/FormData.js +var __classPrivateFieldGet3 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); +}; +var _FormData_instances; +var _FormData_entries; +var _FormData_setEntry; +var FormData4 = class { + constructor(entries) { + _FormData_instances.add(this); + _FormData_entries.set(this, /* @__PURE__ */ new Map()); + if (entries) { + deprecateConstructorEntries(); + entries.forEach(({ name, value, fileName }) => this.append(name, value, fileName)); + } + } + static [(_FormData_entries = /* @__PURE__ */ new WeakMap(), _FormData_instances = /* @__PURE__ */ new WeakSet(), Symbol.hasInstance)](value) { + return Boolean(value && isFunction2(value.constructor) && value[Symbol.toStringTag] === "FormData" && isFunction2(value.append) && isFunction2(value.set) && isFunction2(value.get) && isFunction2(value.getAll) && isFunction2(value.has) && isFunction2(value.delete) && isFunction2(value.entries) && isFunction2(value.values) && isFunction2(value.keys) && isFunction2(value[Symbol.iterator]) && isFunction2(value.forEach)); + } + append(name, value, fileName) { + __classPrivateFieldGet3(this, _FormData_instances, "m", _FormData_setEntry).call(this, { + name, + fileName, + append: true, + rawValue: value, + argsLength: arguments.length + }); + } + set(name, value, fileName) { + __classPrivateFieldGet3(this, _FormData_instances, "m", _FormData_setEntry).call(this, { + name, + fileName, + append: false, + rawValue: value, + argsLength: arguments.length + }); + } + get(name) { + const field = __classPrivateFieldGet3(this, _FormData_entries, "f").get(String(name)); + if (!field) { + return null; + } + return field[0]; + } + getAll(name) { + const field = __classPrivateFieldGet3(this, _FormData_entries, "f").get(String(name)); + if (!field) { + return []; + } + return field.slice(); + } + has(name) { + return __classPrivateFieldGet3(this, _FormData_entries, "f").has(String(name)); + } + delete(name) { + __classPrivateFieldGet3(this, _FormData_entries, "f").delete(String(name)); + } + *keys() { + for (const key of __classPrivateFieldGet3(this, _FormData_entries, "f").keys()) { + yield key; + } + } + *entries() { + for (const name of this.keys()) { + const values = this.getAll(name); + for (const value of values) { + yield [name, value]; + } + } + } + *values() { + for (const [, value] of this) { + yield value; + } + } + [(_FormData_setEntry = function _FormData_setEntry2({ name, rawValue, append: append2, fileName, argsLength }) { + const methodName = append2 ? "append" : "set"; + if (argsLength < 2) { + throw new TypeError(`Failed to execute '${methodName}' on 'FormData': 2 arguments required, but only ${argsLength} present.`); + } + name = String(name); + let value; + if (isFile2(rawValue)) { + value = fileName === void 0 ? rawValue : new File3([rawValue], fileName, { + type: rawValue.type, + lastModified: rawValue.lastModified + }); + } else if (isBlob2(rawValue)) { + value = new File3([rawValue], fileName === void 0 ? "blob" : fileName, { + type: rawValue.type + }); + } else if (fileName) { + throw new TypeError(`Failed to execute '${methodName}' on 'FormData': parameter 2 is not of type 'Blob'.`); + } else { + value = String(rawValue); + } + const values = __classPrivateFieldGet3(this, _FormData_entries, "f").get(name); + if (!values) { + return void __classPrivateFieldGet3(this, _FormData_entries, "f").set(name, [value]); + } + if (!append2) { + return void __classPrivateFieldGet3(this, _FormData_entries, "f").set(name, [value]); + } + values.push(value); + }, Symbol.iterator)]() { + return this.entries(); + } + forEach(callback, thisArg) { + for (const [name, value] of this) { + callback.call(thisArg, value, name, this); + } + } + get [Symbol.toStringTag]() { + return "FormData"; + } + [import_util4.inspect.custom]() { + return this[Symbol.toStringTag]; + } +}; + +// node_modules/formdata-node/lib/esm/index.js +init_Blob(); +init_File(); + +// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs +var import_agentkeepalive = __toESM(require_agentkeepalive(), 1); +var import_abort_controller = __toESM(require_abort_controller(), 1); +var import_node_fs3 = require("node:fs"); + +// node_modules/form-data-encoder/lib/esm/util/createBoundary.js +var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789"; +function createBoundary() { + let size = 16; + let res = ""; + while (size--) { + res += alphabet[Math.random() * alphabet.length << 0]; + } + return res; +} +var createBoundary_default = createBoundary; + +// node_modules/form-data-encoder/lib/esm/util/isPlainObject.js +var getType = (value) => Object.prototype.toString.call(value).slice(8, -1).toLowerCase(); +function isPlainObject2(value) { + if (getType(value) !== "object") { + return false; + } + const pp = Object.getPrototypeOf(value); + if (pp === null || pp === void 0) { + return true; + } + const Ctor = pp.constructor && pp.constructor.toString(); + return Ctor === Object.toString(); +} +var isPlainObject_default = isPlainObject2; + +// node_modules/form-data-encoder/lib/esm/util/normalizeValue.js +var normalizeValue2 = (value) => String(value).replace(/\r|\n/g, (match, i3, str) => { + if (match === "\r" && str[i3 + 1] !== "\n" || match === "\n" && str[i3 - 1] !== "\r") { + return "\r\n"; + } + return match; +}); +var normalizeValue_default = normalizeValue2; + +// node_modules/form-data-encoder/lib/esm/util/escapeName.js +var escapeName = (name) => String(name).replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/"/g, "%22"); +var escapeName_default = escapeName; + +// node_modules/form-data-encoder/lib/esm/util/isFunction.js +var isFunction3 = (value) => typeof value === "function"; +var isFunction_default = isFunction3; + +// node_modules/form-data-encoder/lib/esm/util/isFileLike.js +var isFileLike = (value) => Boolean(value && typeof value === "object" && isFunction_default(value.constructor) && value[Symbol.toStringTag] === "File" && isFunction_default(value.stream) && value.name != null && value.size != null && value.lastModified != null); + +// node_modules/form-data-encoder/lib/esm/util/isFormData.js +var isFormData2 = (value) => Boolean(value && isFunction_default(value.constructor) && value[Symbol.toStringTag] === "FormData" && isFunction_default(value.append) && isFunction_default(value.getAll) && isFunction_default(value.entries) && isFunction_default(value[Symbol.iterator])); + +// node_modules/form-data-encoder/lib/esm/FormDataEncoder.js +var __classPrivateFieldSet3 = function(receiver, state2, value, kind2, f4) { + if (kind2 === "m") + throw new TypeError("Private method is not writable"); + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; +}; +var __classPrivateFieldGet4 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); +}; +var _FormDataEncoder_instances; +var _FormDataEncoder_CRLF; +var _FormDataEncoder_CRLF_BYTES; +var _FormDataEncoder_CRLF_BYTES_LENGTH; +var _FormDataEncoder_DASHES; +var _FormDataEncoder_encoder; +var _FormDataEncoder_footer; +var _FormDataEncoder_form; +var _FormDataEncoder_options; +var _FormDataEncoder_getFieldHeader; +var defaultOptions = { + enableAdditionalHeaders: false +}; +var FormDataEncoder = class { + constructor(form, boundaryOrOptions, options) { + _FormDataEncoder_instances.add(this); + _FormDataEncoder_CRLF.set(this, "\r\n"); + _FormDataEncoder_CRLF_BYTES.set(this, void 0); + _FormDataEncoder_CRLF_BYTES_LENGTH.set(this, void 0); + _FormDataEncoder_DASHES.set(this, "-".repeat(2)); + _FormDataEncoder_encoder.set(this, new TextEncoder()); + _FormDataEncoder_footer.set(this, void 0); + _FormDataEncoder_form.set(this, void 0); + _FormDataEncoder_options.set(this, void 0); + if (!isFormData2(form)) { + throw new TypeError("Expected first argument to be a FormData instance."); + } + let boundary; + if (isPlainObject_default(boundaryOrOptions)) { + options = boundaryOrOptions; + } else { + boundary = boundaryOrOptions; + } + if (!boundary) { + boundary = createBoundary_default(); + } + if (typeof boundary !== "string") { + throw new TypeError("Expected boundary argument to be a string."); + } + if (options && !isPlainObject_default(options)) { + throw new TypeError("Expected options argument to be an object."); + } + __classPrivateFieldSet3(this, _FormDataEncoder_form, form, "f"); + __classPrivateFieldSet3(this, _FormDataEncoder_options, { ...defaultOptions, ...options }, "f"); + __classPrivateFieldSet3(this, _FormDataEncoder_CRLF_BYTES, __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f")), "f"); + __classPrivateFieldSet3(this, _FormDataEncoder_CRLF_BYTES_LENGTH, __classPrivateFieldGet4(this, _FormDataEncoder_CRLF_BYTES, "f").byteLength, "f"); + this.boundary = `form-data-boundary-${boundary}`; + this.contentType = `multipart/form-data; boundary=${this.boundary}`; + __classPrivateFieldSet3(this, _FormDataEncoder_footer, __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(`${__classPrivateFieldGet4(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet4(this, _FormDataEncoder_DASHES, "f")}${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f").repeat(2)}`), "f"); + this.contentLength = String(this.getContentLength()); + this.headers = Object.freeze({ + "Content-Type": this.contentType, + "Content-Length": this.contentLength + }); + Object.defineProperties(this, { + boundary: { writable: false, configurable: false }, + contentType: { writable: false, configurable: false }, + contentLength: { writable: false, configurable: false }, + headers: { writable: false, configurable: false } + }); + } + getContentLength() { + let length = 0; + for (const [name, raw] of __classPrivateFieldGet4(this, _FormDataEncoder_form, "f")) { + const value = isFileLike(raw) ? raw : __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(normalizeValue_default(raw)); + length += __classPrivateFieldGet4(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value).byteLength; + length += isFileLike(value) ? value.size : value.byteLength; + length += __classPrivateFieldGet4(this, _FormDataEncoder_CRLF_BYTES_LENGTH, "f"); + } + return length + __classPrivateFieldGet4(this, _FormDataEncoder_footer, "f").byteLength; + } + *values() { + for (const [name, raw] of __classPrivateFieldGet4(this, _FormDataEncoder_form, "f").entries()) { + const value = isFileLike(raw) ? raw : __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(normalizeValue_default(raw)); + yield __classPrivateFieldGet4(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value); + yield value; + yield __classPrivateFieldGet4(this, _FormDataEncoder_CRLF_BYTES, "f"); + } + yield __classPrivateFieldGet4(this, _FormDataEncoder_footer, "f"); + } + async *encode() { + for (const part of this.values()) { + if (isFileLike(part)) { + yield* part.stream(); + } else { + yield part; + } + } + } + [(_FormDataEncoder_CRLF = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES_LENGTH = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_DASHES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_encoder = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_footer = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_form = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_options = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_instances = /* @__PURE__ */ new WeakSet(), _FormDataEncoder_getFieldHeader = function _FormDataEncoder_getFieldHeader2(name, value) { + let header = ""; + header += `${__classPrivateFieldGet4(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f")}`; + header += `Content-Disposition: form-data; name="${escapeName_default(name)}"`; + if (isFileLike(value)) { + header += `; filename="${escapeName_default(value.name)}"${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f")}`; + header += `Content-Type: ${value.type || "application/octet-stream"}`; + } + if (__classPrivateFieldGet4(this, _FormDataEncoder_options, "f").enableAdditionalHeaders === true) { + header += `${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f")}Content-Length: ${isFileLike(value) ? value.size : value.byteLength}`; + } + return __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(`${header}${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f").repeat(2)}`); + }, Symbol.iterator)]() { + return this.values(); + } + [Symbol.asyncIterator]() { + return this.encode(); + } +}; + +// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs +var import_node_stream = require("node:stream"); + +// node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs +var MultipartBody = class { + constructor(body) { + this.body = body; + } + get [Symbol.toStringTag]() { + return "MultipartBody"; + } +}; + +// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs +var import_ponyfill_es2018 = __toESM(require_ponyfill_es2018(), 1); +var fileFromPathWarned = false; +async function fileFromPath3(path5, ...args) { + const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports)); + if (!fileFromPathWarned) { + console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path5)}) instead`); + fileFromPathWarned = true; + } + return await _fileFromPath(path5, ...args); +} +var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 }); +var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 }); +async function getMultipartRequestOptions2(form, opts) { + const encoder = new FormDataEncoder(form); + const readable = import_node_stream.Readable.from(encoder); + const body = new MultipartBody(readable); + const headers = { + ...opts.headers, + ...encoder.headers, + "Content-Length": encoder.contentLength + }; + return { ...opts, body, headers }; +} +function getRuntime() { + if (typeof AbortController === "undefined") { + globalThis.AbortController = import_abort_controller.AbortController; + } + return { + kind: "node", + fetch: nf.default, + Request: nf.Request, + Response: nf.Response, + Headers: nf.Headers, + FormData: FormData4, + Blob: Blob3, + File: File3, + ReadableStream: import_ponyfill_es2018.ReadableStream, + getMultipartRequestOptions: getMultipartRequestOptions2, + getDefaultAgent: (url2) => url2.startsWith("https") ? defaultHttpsAgent : defaultHttpAgent, + fileFromPath: fileFromPath3, + isFsReadStream: (value) => value instanceof import_node_fs3.ReadStream + }; +} + +// node_modules/@anthropic-ai/sdk/_shims/index.mjs +if (!kind) + setShims(getRuntime(), { auto: true }); + +// node_modules/@anthropic-ai/sdk/error.mjs +var error_exports = {}; +__export(error_exports, { + APIConnectionError: () => APIConnectionError, + APIConnectionTimeoutError: () => APIConnectionTimeoutError, + APIError: () => APIError, + APIUserAbortError: () => APIUserAbortError, + AnthropicError: () => AnthropicError, + AuthenticationError: () => AuthenticationError, + BadRequestError: () => BadRequestError, + ConflictError: () => ConflictError, + InternalServerError: () => InternalServerError, + NotFoundError: () => NotFoundError, + PermissionDeniedError: () => PermissionDeniedError, + RateLimitError: () => RateLimitError, + UnprocessableEntityError: () => UnprocessableEntityError +}); +var AnthropicError = class extends Error { +}; +var APIError = class extends AnthropicError { + constructor(status, error, message, headers) { + super(`${APIError.makeMessage(status, error, message)}`); + this.status = status; + this.headers = headers; + this.error = error; + } + static makeMessage(status, error, message) { + const msg = error?.message ? typeof error.message === "string" ? error.message : JSON.stringify(error.message) : error ? JSON.stringify(error) : message; + if (status && msg) { + return `${status} ${msg}`; + } + if (status) { + return `${status} status code (no body)`; + } + if (msg) { + return msg; + } + return "(no status code or body)"; + } + static generate(status, errorResponse, message, headers) { + if (!status) { + return new APIConnectionError({ cause: castToError(errorResponse) }); + } + const error = errorResponse; + if (status === 400) { + return new BadRequestError(status, error, message, headers); + } + if (status === 401) { + return new AuthenticationError(status, error, message, headers); + } + if (status === 403) { + return new PermissionDeniedError(status, error, message, headers); + } + if (status === 404) { + return new NotFoundError(status, error, message, headers); + } + if (status === 409) { + return new ConflictError(status, error, message, headers); + } + if (status === 422) { + return new UnprocessableEntityError(status, error, message, headers); + } + if (status === 429) { + return new RateLimitError(status, error, message, headers); + } + if (status >= 500) { + return new InternalServerError(status, error, message, headers); + } + return new APIError(status, error, message, headers); + } +}; +var APIUserAbortError = class extends APIError { + constructor({ message } = {}) { + super(void 0, void 0, message || "Request was aborted.", void 0); + this.status = void 0; + } +}; +var APIConnectionError = class extends APIError { + constructor({ message, cause }) { + super(void 0, void 0, message || "Connection error.", void 0); + this.status = void 0; + if (cause) + this.cause = cause; + } +}; +var APIConnectionTimeoutError = class extends APIConnectionError { + constructor({ message } = {}) { + super({ message: message ?? "Request timed out." }); + } +}; +var BadRequestError = class extends APIError { + constructor() { + super(...arguments); + this.status = 400; + } +}; +var AuthenticationError = class extends APIError { + constructor() { + super(...arguments); + this.status = 401; + } +}; +var PermissionDeniedError = class extends APIError { + constructor() { + super(...arguments); + this.status = 403; + } +}; +var NotFoundError = class extends APIError { + constructor() { + super(...arguments); + this.status = 404; + } +}; +var ConflictError = class extends APIError { + constructor() { + super(...arguments); + this.status = 409; + } +}; +var UnprocessableEntityError = class extends APIError { + constructor() { + super(...arguments); + this.status = 422; + } +}; +var RateLimitError = class extends APIError { + constructor() { + super(...arguments); + this.status = 429; + } +}; +var InternalServerError = class extends APIError { +}; + +// node_modules/@anthropic-ai/sdk/streaming.mjs +var Stream = class { + constructor(iterator, controller) { + this.iterator = iterator; + this.controller = controller; + } + static fromSSEResponse(response, controller) { + let consumed = false; + async function* iterator() { + if (consumed) { + throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream."); + } + consumed = true; + let done = false; + try { + for await (const sse of _iterSSEMessages(response, controller)) { + if (sse.event === "completion") { + try { + yield JSON.parse(sse.data); + } catch (e3) { + console.error(`Could not parse message into JSON:`, sse.data); + console.error(`From chunk:`, sse.raw); + throw e3; + } + } + if (sse.event === "message_start" || sse.event === "message_delta" || sse.event === "message_stop" || sse.event === "content_block_start" || sse.event === "content_block_delta" || sse.event === "content_block_stop") { + try { + yield JSON.parse(sse.data); + } catch (e3) { + console.error(`Could not parse message into JSON:`, sse.data); + console.error(`From chunk:`, sse.raw); + throw e3; + } + } + if (sse.event === "ping") { + continue; + } + if (sse.event === "error") { + const errText = sse.data; + const errJSON = safeJSON(errText); + const errMessage = errJSON ? void 0 : errText; + throw APIError.generate(void 0, errJSON, errMessage, createResponseHeaders(response.headers)); + } + } + done = true; + } catch (e3) { + if (e3 instanceof Error && e3.name === "AbortError") + return; + throw e3; + } finally { + if (!done) + controller.abort(); + } + } + return new Stream(iterator, controller); + } + static fromReadableStream(readableStream, controller) { + let consumed = false; + async function* iterLines() { + const lineDecoder = new LineDecoder(); + const iter = readableStreamAsyncIterable(readableStream); + for await (const chunk of iter) { + for (const line of lineDecoder.decode(chunk)) { + yield line; + } + } + for (const line of lineDecoder.flush()) { + yield line; + } + } + async function* iterator() { + if (consumed) { + throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream."); + } + consumed = true; + let done = false; + try { + for await (const line of iterLines()) { + if (done) + continue; + if (line) + yield JSON.parse(line); + } + done = true; + } catch (e3) { + if (e3 instanceof Error && e3.name === "AbortError") + return; + throw e3; + } finally { + if (!done) + controller.abort(); + } + } + return new Stream(iterator, controller); + } + [Symbol.asyncIterator]() { + return this.iterator(); + } + tee() { + const left = []; + const right = []; + const iterator = this.iterator(); + const teeIterator = (queue) => { + return { + next: () => { + if (queue.length === 0) { + const result = iterator.next(); + left.push(result); + right.push(result); + } + return queue.shift(); + } + }; + }; + return [ + new Stream(() => teeIterator(left), this.controller), + new Stream(() => teeIterator(right), this.controller) + ]; + } + toReadableStream() { + const self2 = this; + let iter; + const encoder = new TextEncoder(); + return new ReadableStream2({ + async start() { + iter = self2[Symbol.asyncIterator](); + }, + async pull(ctrl) { + try { + const { value, done } = await iter.next(); + if (done) + return ctrl.close(); + const bytes = encoder.encode(JSON.stringify(value) + "\n"); + ctrl.enqueue(bytes); + } catch (err) { + ctrl.error(err); + } + }, + async cancel() { + await iter.return?.(); + } + }); + } +}; +async function* _iterSSEMessages(response, controller) { + if (!response.body) { + controller.abort(); + throw new AnthropicError(`Attempted to iterate over a response with no body`); + } + const sseDecoder = new SSEDecoder(); + const lineDecoder = new LineDecoder(); + const iter = readableStreamAsyncIterable(response.body); + for await (const sseChunk of iterSSEChunks(iter)) { + for (const line of lineDecoder.decode(sseChunk)) { + const sse = sseDecoder.decode(line); + if (sse) + yield sse; + } + } + for (const line of lineDecoder.flush()) { + const sse = sseDecoder.decode(line); + if (sse) + yield sse; + } +} +async function* iterSSEChunks(iterator) { + let data = new Uint8Array(); + for await (const chunk of iterator) { + if (chunk == null) { + continue; + } + const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk) : typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk; + let newData = new Uint8Array(data.length + binaryChunk.length); + newData.set(data); + newData.set(binaryChunk, data.length); + data = newData; + let patternIndex; + while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) { + yield data.slice(0, patternIndex); + data = data.slice(patternIndex); + } + } + if (data.length > 0) { + yield data; + } +} +function findDoubleNewlineIndex(buffer) { + const newline = 10; + const carriage = 13; + for (let i3 = 0; i3 < buffer.length - 2; i3++) { + if (buffer[i3] === newline && buffer[i3 + 1] === newline) { + return i3 + 2; + } + if (buffer[i3] === carriage && buffer[i3 + 1] === carriage) { + return i3 + 2; + } + if (buffer[i3] === carriage && buffer[i3 + 1] === newline && i3 + 3 < buffer.length && buffer[i3 + 2] === carriage && buffer[i3 + 3] === newline) { + return i3 + 4; + } + } + return -1; +} +var SSEDecoder = class { + constructor() { + this.event = null; + this.data = []; + this.chunks = []; + } + decode(line) { + if (line.endsWith("\r")) { + line = line.substring(0, line.length - 1); + } + if (!line) { + if (!this.event && !this.data.length) + return null; + const sse = { + event: this.event, + data: this.data.join("\n"), + raw: this.chunks + }; + this.event = null; + this.data = []; + this.chunks = []; + return sse; + } + this.chunks.push(line); + if (line.startsWith(":")) { + return null; + } + let [fieldname, _7, value] = partition(line, ":"); + if (value.startsWith(" ")) { + value = value.substring(1); + } + if (fieldname === "event") { + this.event = value; + } else if (fieldname === "data") { + this.data.push(value); + } + return null; + } +}; +var LineDecoder = class { + constructor() { + this.buffer = []; + this.trailingCR = false; + } + decode(chunk) { + let text = this.decodeText(chunk); + if (this.trailingCR) { + text = "\r" + text; + this.trailingCR = false; + } + if (text.endsWith("\r")) { + this.trailingCR = true; + text = text.slice(0, -1); + } + if (!text) { + return []; + } + const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || ""); + let lines = text.split(LineDecoder.NEWLINE_REGEXP); + if (trailingNewline) { + lines.pop(); + } + if (lines.length === 1 && !trailingNewline) { + this.buffer.push(lines[0]); + return []; + } + if (this.buffer.length > 0) { + lines = [this.buffer.join("") + lines[0], ...lines.slice(1)]; + this.buffer = []; + } + if (!trailingNewline) { + this.buffer = [lines.pop() || ""]; + } + return lines; + } + decodeText(bytes) { + if (bytes == null) + return ""; + if (typeof bytes === "string") + return bytes; + if (typeof Buffer !== "undefined") { + if (bytes instanceof Buffer) { + return bytes.toString(); + } + if (bytes instanceof Uint8Array) { + return Buffer.from(bytes).toString(); + } + throw new AnthropicError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`); + } + if (typeof TextDecoder !== "undefined") { + if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) { + this.textDecoder ?? (this.textDecoder = new TextDecoder("utf8")); + return this.textDecoder.decode(bytes); + } + throw new AnthropicError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`); + } + throw new AnthropicError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`); + } + flush() { + if (!this.buffer.length && !this.trailingCR) { + return []; + } + const lines = [this.buffer.join("")]; + this.buffer = []; + this.trailingCR = false; + return lines; + } +}; +LineDecoder.NEWLINE_CHARS = /* @__PURE__ */ new Set(["\n", "\r"]); +LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g; +function partition(str, delimiter) { + const index = str.indexOf(delimiter); + if (index !== -1) { + return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)]; + } + return [str, "", ""]; +} +function readableStreamAsyncIterable(stream4) { + if (stream4[Symbol.asyncIterator]) + return stream4; + const reader = stream4.getReader(); + return { + async next() { + try { + const result = await reader.read(); + if (result?.done) + reader.releaseLock(); + return result; + } catch (e3) { + reader.releaseLock(); + throw e3; + } + }, + async return() { + const cancelPromise = reader.cancel(); + reader.releaseLock(); + await cancelPromise; + return { done: true, value: void 0 }; + }, + [Symbol.asyncIterator]() { + return this; + } + }; +} + +// node_modules/@anthropic-ai/sdk/uploads.mjs +var isResponseLike = (value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function"; +var isFileLike2 = (value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value); +var isBlobLike = (value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function"; +async function toFile(value, name, options) { + value = await value; + options ?? (options = isFileLike2(value) ? { lastModified: value.lastModified, type: value.type } : {}); + if (isResponseLike(value)) { + const blob = await value.blob(); + name || (name = new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file"); + return new File2([blob], name, options); + } + const bits = await getBytes(value); + name || (name = getName(value) ?? "unknown_file"); + if (!options.type) { + const type2 = bits[0]?.type; + if (typeof type2 === "string") { + options = { ...options, type: type2 }; + } + } + return new File2(bits, name, options); +} +async function getBytes(value) { + let parts = []; + if (typeof value === "string" || ArrayBuffer.isView(value) || value instanceof ArrayBuffer) { + parts.push(value); + } else if (isBlobLike(value)) { + parts.push(await value.arrayBuffer()); + } else if (isAsyncIterableIterator(value)) { + for await (const chunk of value) { + parts.push(chunk); + } + } else { + throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`); + } + return parts; +} +function propsForError(value) { + const props = Object.getOwnPropertyNames(value); + return `[${props.map((p4) => `"${p4}"`).join(", ")}]`; +} +function getName(value) { + return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop(); +} +var getStringFromMaybeBuffer = (x5) => { + if (typeof x5 === "string") + return x5; + if (typeof Buffer !== "undefined" && x5 instanceof Buffer) + return String(x5); + return void 0; +}; +var isAsyncIterableIterator = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function"; +var isMultipartBody = (body) => body && typeof body === "object" && body.body && body[Symbol.toStringTag] === "MultipartBody"; + +// node_modules/@anthropic-ai/sdk/core.mjs +var __classPrivateFieldSet5 = function(receiver, state2, value, kind2, f4) { + if (kind2 === "m") + throw new TypeError("Private method is not writable"); + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; +}; +var __classPrivateFieldGet6 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); +}; +var _AbstractPage_client; +async function defaultParseResponse(props) { + const { response } = props; + if (props.options.stream) { + debug("response", response.status, response.url, response.headers, response.body); + if (props.options.__streamClass) { + return props.options.__streamClass.fromSSEResponse(response, props.controller); + } + return Stream.fromSSEResponse(response, props.controller); + } + if (response.status === 204) { + return null; + } + if (props.options.__binaryResponse) { + return response; + } + const contentType = response.headers.get("content-type"); + const isJSON = contentType?.includes("application/json") || contentType?.includes("application/vnd.api+json"); + if (isJSON) { + const json = await response.json(); + debug("response", response.status, response.url, response.headers, json); + return json; + } + const text = await response.text(); + debug("response", response.status, response.url, response.headers, text); + return text; +} +var APIPromise = class extends Promise { + constructor(responsePromise, parseResponse = defaultParseResponse) { + super((resolve) => { + resolve(null); + }); + this.responsePromise = responsePromise; + this.parseResponse = parseResponse; + } + _thenUnwrap(transform) { + return new APIPromise(this.responsePromise, async (props) => transform(await this.parseResponse(props))); + } + asResponse() { + return this.responsePromise.then((p4) => p4.response); + } + async withResponse() { + const [data, response] = await Promise.all([this.parse(), this.asResponse()]); + return { data, response }; + } + parse() { + if (!this.parsedPromise) { + this.parsedPromise = this.responsePromise.then(this.parseResponse); + } + return this.parsedPromise; + } + then(onfulfilled, onrejected) { + return this.parse().then(onfulfilled, onrejected); + } + catch(onrejected) { + return this.parse().catch(onrejected); + } + finally(onfinally) { + return this.parse().finally(onfinally); + } +}; +var APIClient = class { + constructor({ + baseURL, + maxRetries = 2, + timeout = 6e5, + httpAgent, + fetch: overridenFetch + }) { + this.baseURL = baseURL; + this.maxRetries = validatePositiveInteger("maxRetries", maxRetries); + this.timeout = validatePositiveInteger("timeout", timeout); + this.httpAgent = httpAgent; + this.fetch = overridenFetch ?? fetch2; + } + authHeaders(opts) { + return {}; + } + defaultHeaders(opts) { + return { + Accept: "application/json", + "Content-Type": "application/json", + "User-Agent": this.getUserAgent(), + ...getPlatformHeaders(), + ...this.authHeaders(opts) + }; + } + validateHeaders(headers, customHeaders) { + } + defaultIdempotencyKey() { + return `stainless-node-retry-${uuid4()}`; + } + get(path5, opts) { + return this.methodRequest("get", path5, opts); + } + post(path5, opts) { + return this.methodRequest("post", path5, opts); + } + patch(path5, opts) { + return this.methodRequest("patch", path5, opts); + } + put(path5, opts) { + return this.methodRequest("put", path5, opts); + } + delete(path5, opts) { + return this.methodRequest("delete", path5, opts); + } + methodRequest(method, path5, opts) { + return this.request(Promise.resolve(opts).then((opts2) => ({ method, path: path5, ...opts2 }))); + } + getAPIList(path5, Page, opts) { + return this.requestAPIList(Page, { method: "get", path: path5, ...opts }); + } + calculateContentLength(body) { + if (typeof body === "string") { + if (typeof Buffer !== "undefined") { + return Buffer.byteLength(body, "utf8").toString(); + } + if (typeof TextEncoder !== "undefined") { + const encoder = new TextEncoder(); + const encoded = encoder.encode(body); + return encoded.length.toString(); + } + } + return null; + } + buildRequest(options) { + const { method, path: path5, query, headers = {} } = options; + const body = isMultipartBody(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null; + const contentLength = this.calculateContentLength(body); + const url2 = this.buildURL(path5, query); + if ("timeout" in options) + validatePositiveInteger("timeout", options.timeout); + const timeout = options.timeout ?? this.timeout; + const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url2); + const minAgentTimeout = timeout + 1e3; + if (typeof httpAgent?.options?.timeout === "number" && minAgentTimeout > (httpAgent.options.timeout ?? 0)) { + httpAgent.options.timeout = minAgentTimeout; + } + if (this.idempotencyHeader && method !== "get") { + if (!options.idempotencyKey) + options.idempotencyKey = this.defaultIdempotencyKey(); + headers[this.idempotencyHeader] = options.idempotencyKey; + } + const reqHeaders = this.buildHeaders({ options, headers, contentLength }); + const req = { + method, + ...body && { body }, + headers: reqHeaders, + ...httpAgent && { agent: httpAgent }, + signal: options.signal ?? null + }; + return { req, url: url2, timeout }; + } + buildHeaders({ options, headers, contentLength }) { + const reqHeaders = {}; + if (contentLength) { + reqHeaders["content-length"] = contentLength; + } + const defaultHeaders = this.defaultHeaders(options); + applyHeadersMut(reqHeaders, defaultHeaders); + applyHeadersMut(reqHeaders, headers); + if (isMultipartBody(options.body) && kind !== "node") { + delete reqHeaders["content-type"]; + } + this.validateHeaders(reqHeaders, headers); + return reqHeaders; + } + async prepareOptions(options) { + } + async prepareRequest(request3, { url: url2, options }) { + } + parseHeaders(headers) { + return !headers ? {} : Symbol.iterator in headers ? Object.fromEntries(Array.from(headers).map((header) => [...header])) : { ...headers }; + } + makeStatusError(status, error, message, headers) { + return APIError.generate(status, error, message, headers); + } + request(options, remainingRetries = null) { + return new APIPromise(this.makeRequest(options, remainingRetries)); + } + async makeRequest(optionsInput, retriesRemaining) { + const options = await optionsInput; + if (retriesRemaining == null) { + retriesRemaining = options.maxRetries ?? this.maxRetries; + } + await this.prepareOptions(options); + const { req, url: url2, timeout } = this.buildRequest(options); + await this.prepareRequest(req, { url: url2, options }); + debug("request", url2, options, req.headers); + if (options.signal?.aborted) { + throw new APIUserAbortError(); + } + const controller = new AbortController(); + const response = await this.fetchWithTimeout(url2, req, timeout, controller).catch(castToError); + if (response instanceof Error) { + if (options.signal?.aborted) { + throw new APIUserAbortError(); + } + if (retriesRemaining) { + return this.retryRequest(options, retriesRemaining); + } + if (response.name === "AbortError") { + throw new APIConnectionTimeoutError(); + } + throw new APIConnectionError({ cause: response }); + } + const responseHeaders = createResponseHeaders(response.headers); + if (!response.ok) { + if (retriesRemaining && this.shouldRetry(response)) { + const retryMessage2 = `retrying, ${retriesRemaining} attempts remaining`; + debug(`response (error; ${retryMessage2})`, response.status, url2, responseHeaders); + return this.retryRequest(options, retriesRemaining, responseHeaders); + } + const errText = await response.text().catch((e3) => castToError(e3).message); + const errJSON = safeJSON(errText); + const errMessage = errJSON ? void 0 : errText; + const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`; + debug(`response (error; ${retryMessage})`, response.status, url2, responseHeaders, errMessage); + const err = this.makeStatusError(response.status, errJSON, errMessage, responseHeaders); + throw err; + } + return { response, options, controller }; + } + requestAPIList(Page, options) { + const request3 = this.makeRequest(options, null); + return new PagePromise(this, request3, Page); + } + buildURL(path5, query) { + const url2 = isAbsoluteURL2(path5) ? new URL(path5) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path5.startsWith("/") ? path5.slice(1) : path5)); + const defaultQuery = this.defaultQuery(); + if (!isEmptyObj(defaultQuery)) { + query = { ...defaultQuery, ...query }; + } + if (typeof query === "object" && query && !Array.isArray(query)) { + url2.search = this.stringifyQuery(query); + } + return url2.toString(); + } + stringifyQuery(query) { + return Object.entries(query).filter(([_7, value]) => typeof value !== "undefined").map(([key, value]) => { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`; + } + if (value === null) { + return `${encodeURIComponent(key)}=`; + } + throw new AnthropicError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`); + }).join("&"); + } + async fetchWithTimeout(url2, init, ms, controller) { + const { signal, ...options } = init || {}; + if (signal) + signal.addEventListener("abort", () => controller.abort()); + const timeout = setTimeout(() => controller.abort(), ms); + return this.getRequestClient().fetch.call(void 0, url2, { signal: controller.signal, ...options }).finally(() => { + clearTimeout(timeout); + }); + } + getRequestClient() { + return { fetch: this.fetch }; + } + shouldRetry(response) { + const shouldRetryHeader = response.headers.get("x-should-retry"); + if (shouldRetryHeader === "true") + return true; + if (shouldRetryHeader === "false") + return false; + if (response.status === 408) + return true; + if (response.status === 409) + return true; + if (response.status === 429) + return true; + if (response.status >= 500) + return true; + return false; + } + async retryRequest(options, retriesRemaining, responseHeaders) { + let timeoutMillis; + const retryAfterMillisHeader = responseHeaders?.["retry-after-ms"]; + if (retryAfterMillisHeader) { + const timeoutMs = parseFloat(retryAfterMillisHeader); + if (!Number.isNaN(timeoutMs)) { + timeoutMillis = timeoutMs; + } + } + const retryAfterHeader = responseHeaders?.["retry-after"]; + if (retryAfterHeader && !timeoutMillis) { + const timeoutSeconds = parseFloat(retryAfterHeader); + if (!Number.isNaN(timeoutSeconds)) { + timeoutMillis = timeoutSeconds * 1e3; + } else { + timeoutMillis = Date.parse(retryAfterHeader) - Date.now(); + } + } + if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1e3)) { + const maxRetries = options.maxRetries ?? this.maxRetries; + timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); + } + await sleep(timeoutMillis); + return this.makeRequest(options, retriesRemaining - 1); + } + calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) { + const initialRetryDelay = 0.5; + const maxRetryDelay = 8; + const numRetries = maxRetries - retriesRemaining; + const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay); + const jitter = 1 - Math.random() * 0.25; + return sleepSeconds * jitter * 1e3; + } + getUserAgent() { + return `${this.constructor.name}/JS ${VERSION3}`; + } +}; +var AbstractPage = class { + constructor(client, response, body, options) { + _AbstractPage_client.set(this, void 0); + __classPrivateFieldSet5(this, _AbstractPage_client, client, "f"); + this.options = options; + this.response = response; + this.body = body; + } + hasNextPage() { + const items = this.getPaginatedItems(); + if (!items.length) + return false; + return this.nextPageInfo() != null; + } + async getNextPage() { + const nextInfo = this.nextPageInfo(); + if (!nextInfo) { + throw new AnthropicError("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`."); + } + const nextOptions = { ...this.options }; + if ("params" in nextInfo && typeof nextOptions.query === "object") { + nextOptions.query = { ...nextOptions.query, ...nextInfo.params }; + } else if ("url" in nextInfo) { + const params = [...Object.entries(nextOptions.query || {}), ...nextInfo.url.searchParams.entries()]; + for (const [key, value] of params) { + nextInfo.url.searchParams.set(key, value); + } + nextOptions.query = void 0; + nextOptions.path = nextInfo.url.toString(); + } + return await __classPrivateFieldGet6(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions); + } + async *iterPages() { + let page = this; + yield page; + while (page.hasNextPage()) { + page = await page.getNextPage(); + yield page; + } + } + async *[(_AbstractPage_client = /* @__PURE__ */ new WeakMap(), Symbol.asyncIterator)]() { + for await (const page of this.iterPages()) { + for (const item of page.getPaginatedItems()) { + yield item; + } + } + } +}; +var PagePromise = class extends APIPromise { + constructor(client, request3, Page) { + super(request3, async (props) => new Page(client, props.response, await defaultParseResponse(props), props.options)); + } + async *[Symbol.asyncIterator]() { + const page = await this; + for await (const item of page) { + yield item; + } + } +}; +var createResponseHeaders = (headers) => { + return new Proxy(Object.fromEntries( + headers.entries() + ), { + get(target, name) { + const key = name.toString(); + return target[key.toLowerCase()] || target[key]; + } + }); +}; +var getPlatformProperties = () => { + if (typeof Deno !== "undefined" && Deno.build != null) { + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": normalizePlatform(Deno.build.os), + "X-Stainless-Arch": normalizeArch(Deno.build.arch), + "X-Stainless-Runtime": "deno", + "X-Stainless-Runtime-Version": typeof Deno.version === "string" ? Deno.version : Deno.version?.deno ?? "unknown" + }; + } + if (typeof EdgeRuntime !== "undefined") { + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": "Unknown", + "X-Stainless-Arch": `other:${EdgeRuntime}`, + "X-Stainless-Runtime": "edge", + "X-Stainless-Runtime-Version": process.version + }; + } + if (Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]") { + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": normalizePlatform(process.platform), + "X-Stainless-Arch": normalizeArch(process.arch), + "X-Stainless-Runtime": "node", + "X-Stainless-Runtime-Version": process.version + }; + } + const browserInfo = getBrowserInfo(); + if (browserInfo) { + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": "Unknown", + "X-Stainless-Arch": "unknown", + "X-Stainless-Runtime": `browser:${browserInfo.browser}`, + "X-Stainless-Runtime-Version": browserInfo.version + }; + } + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": "Unknown", + "X-Stainless-Arch": "unknown", + "X-Stainless-Runtime": "unknown", + "X-Stainless-Runtime-Version": "unknown" + }; +}; +function getBrowserInfo() { + if (typeof navigator === "undefined" || !navigator) { + return null; + } + const browserPatterns = [ + { key: "edge", pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "ie", pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "ie", pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "chrome", pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "firefox", pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "safari", pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ } + ]; + for (const { key, pattern } of browserPatterns) { + const match = pattern.exec(navigator.userAgent); + if (match) { + const major = match[1] || 0; + const minor = match[2] || 0; + const patch = match[3] || 0; + return { browser: key, version: `${major}.${minor}.${patch}` }; + } + } + return null; +} +var normalizeArch = (arch2) => { + if (arch2 === "x32") + return "x32"; + if (arch2 === "x86_64" || arch2 === "x64") + return "x64"; + if (arch2 === "arm") + return "arm"; + if (arch2 === "aarch64" || arch2 === "arm64") + return "arm64"; + if (arch2) + return `other:${arch2}`; + return "unknown"; +}; +var normalizePlatform = (platform) => { + platform = platform.toLowerCase(); + if (platform.includes("ios")) + return "iOS"; + if (platform === "android") + return "Android"; + if (platform === "darwin") + return "MacOS"; + if (platform === "win32") + return "Windows"; + if (platform === "freebsd") + return "FreeBSD"; + if (platform === "openbsd") + return "OpenBSD"; + if (platform === "linux") + return "Linux"; + if (platform) + return `Other:${platform}`; + return "Unknown"; +}; +var _platformHeaders; +var getPlatformHeaders = () => { + return _platformHeaders ?? (_platformHeaders = getPlatformProperties()); +}; +var safeJSON = (text) => { + try { + return JSON.parse(text); + } catch (err) { + return void 0; + } +}; +var startsWithSchemeRegexp = new RegExp("^(?:[a-z]+:)?//", "i"); +var isAbsoluteURL2 = (url2) => { + return startsWithSchemeRegexp.test(url2); +}; +var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); +var validatePositiveInteger = (name, n2) => { + if (typeof n2 !== "number" || !Number.isInteger(n2)) { + throw new AnthropicError(`${name} must be an integer`); + } + if (n2 < 0) { + throw new AnthropicError(`${name} must be a positive integer`); + } + return n2; +}; +var castToError = (err) => { + if (err instanceof Error) + return err; + return new Error(err); +}; +var readEnv = (env2) => { + if (typeof process !== "undefined") { + return process.env?.[env2]?.trim() ?? void 0; + } + if (typeof Deno !== "undefined") { + return Deno.env?.get?.(env2)?.trim(); + } + return void 0; +}; +function isEmptyObj(obj) { + if (!obj) + return true; + for (const _k in obj) + return false; + return true; +} +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} +function applyHeadersMut(targetHeaders, newHeaders) { + for (const k7 in newHeaders) { + if (!hasOwn(newHeaders, k7)) + continue; + const lowerKey = k7.toLowerCase(); + if (!lowerKey) + continue; + const val = newHeaders[k7]; + if (val === null) { + delete targetHeaders[lowerKey]; + } else if (val !== void 0) { + targetHeaders[lowerKey] = val; + } + } +} +function debug(action, ...args) { + if (typeof process !== "undefined" && process?.env?.["DEBUG"] === "true") { + console.log(`Anthropic:DEBUG:${action}`, ...args); + } +} +var uuid4 = () => { + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c3) => { + const r3 = Math.random() * 16 | 0; + const v5 = c3 === "x" ? r3 : r3 & 3 | 8; + return v5.toString(16); + }); +}; + +// node_modules/@anthropic-ai/sdk/resource.mjs +var APIResource = class { + constructor(client) { + this._client = client; + } +}; + +// node_modules/@anthropic-ai/sdk/resources/completions.mjs +var Completions = class extends APIResource { + create(body, options) { + return this._client.post("/v1/complete", { + body, + timeout: 6e5, + ...options, + stream: body.stream ?? false + }); + } +}; +(function(Completions2) { +})(Completions || (Completions = {})); + +// node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +var __classPrivateFieldSet6 = function(receiver, state2, value, kind2, f4) { + if (kind2 === "m") + throw new TypeError("Private method is not writable"); + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; +}; +var __classPrivateFieldGet7 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); +}; +var _MessageStream_instances; +var _MessageStream_currentMessageSnapshot; +var _MessageStream_connectedPromise; +var _MessageStream_resolveConnectedPromise; +var _MessageStream_rejectConnectedPromise; +var _MessageStream_endPromise; +var _MessageStream_resolveEndPromise; +var _MessageStream_rejectEndPromise; +var _MessageStream_listeners; +var _MessageStream_ended; +var _MessageStream_errored; +var _MessageStream_aborted; +var _MessageStream_catchingPromiseCreated; +var _MessageStream_getFinalMessage; +var _MessageStream_getFinalText; +var _MessageStream_handleError; +var _MessageStream_beginRequest; +var _MessageStream_addStreamEvent; +var _MessageStream_endRequest; +var _MessageStream_accumulateMessage; +var MessageStream = class { + constructor() { + _MessageStream_instances.add(this); + this.messages = []; + this.receivedMessages = []; + _MessageStream_currentMessageSnapshot.set(this, void 0); + this.controller = new AbortController(); + _MessageStream_connectedPromise.set(this, void 0); + _MessageStream_resolveConnectedPromise.set(this, () => { + }); + _MessageStream_rejectConnectedPromise.set(this, () => { + }); + _MessageStream_endPromise.set(this, void 0); + _MessageStream_resolveEndPromise.set(this, () => { + }); + _MessageStream_rejectEndPromise.set(this, () => { + }); + _MessageStream_listeners.set(this, {}); + _MessageStream_ended.set(this, false); + _MessageStream_errored.set(this, false); + _MessageStream_aborted.set(this, false); + _MessageStream_catchingPromiseCreated.set(this, false); + _MessageStream_handleError.set(this, (error) => { + __classPrivateFieldSet6(this, _MessageStream_errored, true, "f"); + if (error instanceof Error && error.name === "AbortError") { + error = new APIUserAbortError(); + } + if (error instanceof APIUserAbortError) { + __classPrivateFieldSet6(this, _MessageStream_aborted, true, "f"); + return this._emit("abort", error); + } + if (error instanceof AnthropicError) { + return this._emit("error", error); + } + if (error instanceof Error) { + const anthropicError = new AnthropicError(error.message); + anthropicError.cause = error; + return this._emit("error", anthropicError); + } + return this._emit("error", new AnthropicError(String(error))); + }); + __classPrivateFieldSet6(this, _MessageStream_connectedPromise, new Promise((resolve, reject) => { + __classPrivateFieldSet6(this, _MessageStream_resolveConnectedPromise, resolve, "f"); + __classPrivateFieldSet6(this, _MessageStream_rejectConnectedPromise, reject, "f"); + }), "f"); + __classPrivateFieldSet6(this, _MessageStream_endPromise, new Promise((resolve, reject) => { + __classPrivateFieldSet6(this, _MessageStream_resolveEndPromise, resolve, "f"); + __classPrivateFieldSet6(this, _MessageStream_rejectEndPromise, reject, "f"); + }), "f"); + __classPrivateFieldGet7(this, _MessageStream_connectedPromise, "f").catch(() => { + }); + __classPrivateFieldGet7(this, _MessageStream_endPromise, "f").catch(() => { + }); + } + static fromReadableStream(stream4) { + const runner = new MessageStream(); + runner._run(() => runner._fromReadableStream(stream4)); + return runner; + } + static createMessage(messages, params, options) { + const runner = new MessageStream(); + for (const message of params.messages) { + runner._addMessageParam(message); + } + runner._run(() => runner._createMessage(messages, { ...params, stream: true }, { ...options, headers: { ...options?.headers, "X-Stainless-Helper-Method": "stream" } })); + return runner; + } + _run(executor) { + executor().then(() => { + this._emitFinal(); + this._emit("end"); + }, __classPrivateFieldGet7(this, _MessageStream_handleError, "f")); + } + _addMessageParam(message) { + this.messages.push(message); + } + _addMessage(message, emit = true) { + this.receivedMessages.push(message); + if (emit) { + this._emit("message", message); + } + } + async _createMessage(messages, params, options) { + const signal = options?.signal; + if (signal) { + if (signal.aborted) + this.controller.abort(); + signal.addEventListener("abort", () => this.controller.abort()); + } + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_beginRequest).call(this); + const stream4 = await messages.create({ ...params, stream: true }, { ...options, signal: this.controller.signal }); + this._connected(); + for await (const event of stream4) { + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_addStreamEvent).call(this, event); + } + if (stream4.controller.signal?.aborted) { + throw new APIUserAbortError(); + } + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_endRequest).call(this); + } + _connected() { + if (this.ended) + return; + __classPrivateFieldGet7(this, _MessageStream_resolveConnectedPromise, "f").call(this); + this._emit("connect"); + } + get ended() { + return __classPrivateFieldGet7(this, _MessageStream_ended, "f"); + } + get errored() { + return __classPrivateFieldGet7(this, _MessageStream_errored, "f"); + } + get aborted() { + return __classPrivateFieldGet7(this, _MessageStream_aborted, "f"); + } + abort() { + this.controller.abort(); + } + on(event, listener) { + const listeners = __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] = []); + listeners.push({ listener }); + return this; + } + off(event, listener) { + const listeners = __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event]; + if (!listeners) + return this; + const index = listeners.findIndex((l3) => l3.listener === listener); + if (index >= 0) + listeners.splice(index, 1); + return this; + } + once(event, listener) { + const listeners = __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] = []); + listeners.push({ listener, once: true }); + return this; + } + emitted(event) { + return new Promise((resolve, reject) => { + __classPrivateFieldSet6(this, _MessageStream_catchingPromiseCreated, true, "f"); + if (event !== "error") + this.once("error", reject); + this.once(event, resolve); + }); + } + async done() { + __classPrivateFieldSet6(this, _MessageStream_catchingPromiseCreated, true, "f"); + await __classPrivateFieldGet7(this, _MessageStream_endPromise, "f"); + } + get currentMessage() { + return __classPrivateFieldGet7(this, _MessageStream_currentMessageSnapshot, "f"); + } + async finalMessage() { + await this.done(); + return __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_getFinalMessage).call(this); + } + async finalText() { + await this.done(); + return __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_getFinalText).call(this); + } + _emit(event, ...args) { + if (__classPrivateFieldGet7(this, _MessageStream_ended, "f")) + return; + if (event === "end") { + __classPrivateFieldSet6(this, _MessageStream_ended, true, "f"); + __classPrivateFieldGet7(this, _MessageStream_resolveEndPromise, "f").call(this); + } + const listeners = __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event]; + if (listeners) { + __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] = listeners.filter((l3) => !l3.once); + listeners.forEach(({ listener }) => listener(...args)); + } + if (event === "abort") { + const error = args[0]; + if (!__classPrivateFieldGet7(this, _MessageStream_catchingPromiseCreated, "f") && !listeners?.length) { + Promise.reject(error); + } + __classPrivateFieldGet7(this, _MessageStream_rejectConnectedPromise, "f").call(this, error); + __classPrivateFieldGet7(this, _MessageStream_rejectEndPromise, "f").call(this, error); + this._emit("end"); + return; + } + if (event === "error") { + const error = args[0]; + if (!__classPrivateFieldGet7(this, _MessageStream_catchingPromiseCreated, "f") && !listeners?.length) { + Promise.reject(error); + } + __classPrivateFieldGet7(this, _MessageStream_rejectConnectedPromise, "f").call(this, error); + __classPrivateFieldGet7(this, _MessageStream_rejectEndPromise, "f").call(this, error); + this._emit("end"); + } + } + _emitFinal() { + const finalMessage = this.receivedMessages.at(-1); + if (finalMessage) { + this._emit("finalMessage", __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_getFinalMessage).call(this)); + } + } + async _fromReadableStream(readableStream, options) { + const signal = options?.signal; + if (signal) { + if (signal.aborted) + this.controller.abort(); + signal.addEventListener("abort", () => this.controller.abort()); + } + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_beginRequest).call(this); + this._connected(); + const stream4 = Stream.fromReadableStream(readableStream, this.controller); + for await (const event of stream4) { + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_addStreamEvent).call(this, event); + } + if (stream4.controller.signal?.aborted) { + throw new APIUserAbortError(); + } + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_endRequest).call(this); + } + [(_MessageStream_currentMessageSnapshot = /* @__PURE__ */ new WeakMap(), _MessageStream_connectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_resolveConnectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_rejectConnectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_endPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_resolveEndPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_rejectEndPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_listeners = /* @__PURE__ */ new WeakMap(), _MessageStream_ended = /* @__PURE__ */ new WeakMap(), _MessageStream_errored = /* @__PURE__ */ new WeakMap(), _MessageStream_aborted = /* @__PURE__ */ new WeakMap(), _MessageStream_catchingPromiseCreated = /* @__PURE__ */ new WeakMap(), _MessageStream_handleError = /* @__PURE__ */ new WeakMap(), _MessageStream_instances = /* @__PURE__ */ new WeakSet(), _MessageStream_getFinalMessage = function _MessageStream_getFinalMessage2() { + if (this.receivedMessages.length === 0) { + throw new AnthropicError("stream ended without producing a Message with role=assistant"); + } + return this.receivedMessages.at(-1); + }, _MessageStream_getFinalText = function _MessageStream_getFinalText2() { + if (this.receivedMessages.length === 0) { + throw new AnthropicError("stream ended without producing a Message with role=assistant"); + } + const textBlocks = this.receivedMessages.at(-1).content.filter((block) => block.type === "text").map((block) => block.text); + if (textBlocks.length === 0) { + throw new AnthropicError("stream ended without producing a content block with type=text"); + } + return textBlocks.join(" "); + }, _MessageStream_beginRequest = function _MessageStream_beginRequest2() { + if (this.ended) + return; + __classPrivateFieldSet6(this, _MessageStream_currentMessageSnapshot, void 0, "f"); + }, _MessageStream_addStreamEvent = function _MessageStream_addStreamEvent2(event) { + if (this.ended) + return; + const messageSnapshot = __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_accumulateMessage).call(this, event); + this._emit("streamEvent", event, messageSnapshot); + switch (event.type) { + case "content_block_delta": { + if (event.delta.type === "text_delta") { + this._emit("text", event.delta.text, messageSnapshot.content.at(-1).text || ""); + } + break; + } + case "message_stop": { + this._addMessageParam(messageSnapshot); + this._addMessage(messageSnapshot, true); + break; + } + case "content_block_stop": { + this._emit("contentBlock", messageSnapshot.content.at(-1)); + break; + } + case "message_start": { + __classPrivateFieldSet6(this, _MessageStream_currentMessageSnapshot, messageSnapshot, "f"); + break; + } + case "content_block_start": + case "message_delta": + break; + } + }, _MessageStream_endRequest = function _MessageStream_endRequest2() { + if (this.ended) { + throw new AnthropicError(`stream has ended, this shouldn't happen`); + } + const snapshot = __classPrivateFieldGet7(this, _MessageStream_currentMessageSnapshot, "f"); + if (!snapshot) { + throw new AnthropicError(`request ended without sending any chunks`); + } + __classPrivateFieldSet6(this, _MessageStream_currentMessageSnapshot, void 0, "f"); + return snapshot; + }, _MessageStream_accumulateMessage = function _MessageStream_accumulateMessage2(event) { + let snapshot = __classPrivateFieldGet7(this, _MessageStream_currentMessageSnapshot, "f"); + if (event.type === "message_start") { + if (snapshot) { + throw new AnthropicError(`Unexpected event order, got ${event.type} before receiving "message_stop"`); + } + return event.message; + } + if (!snapshot) { + throw new AnthropicError(`Unexpected event order, got ${event.type} before "message_start"`); + } + switch (event.type) { + case "message_stop": + return snapshot; + case "message_delta": + snapshot.stop_reason = event.delta.stop_reason; + snapshot.stop_sequence = event.delta.stop_sequence; + snapshot.usage.output_tokens = event.usage.output_tokens; + return snapshot; + case "content_block_start": + snapshot.content.push(event.content_block); + return snapshot; + case "content_block_delta": { + const snapshotContent = snapshot.content.at(event.index); + if (snapshotContent?.type === "text" && event.delta.type === "text_delta") { + snapshotContent.text += event.delta.text; + } + return snapshot; + } + case "content_block_stop": + return snapshot; + } + }, Symbol.asyncIterator)]() { + const pushQueue = []; + const readQueue = []; + let done = false; + this.on("streamEvent", (event) => { + const reader = readQueue.shift(); + if (reader) { + reader.resolve(event); + } else { + pushQueue.push(event); + } + }); + this.on("end", () => { + done = true; + for (const reader of readQueue) { + reader.resolve(void 0); + } + readQueue.length = 0; + }); + this.on("abort", (err) => { + done = true; + for (const reader of readQueue) { + reader.reject(err); + } + readQueue.length = 0; + }); + this.on("error", (err) => { + done = true; + for (const reader of readQueue) { + reader.reject(err); + } + readQueue.length = 0; + }); + return { + next: async () => { + if (!pushQueue.length) { + if (done) { + return { value: void 0, done: true }; + } + return new Promise((resolve, reject) => readQueue.push({ resolve, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true }); + } + const chunk = pushQueue.shift(); + return { value: chunk, done: false }; + }, + return: async () => { + this.abort(); + return { value: void 0, done: true }; + } + }; + } + toReadableStream() { + const stream4 = new Stream(this[Symbol.asyncIterator].bind(this), this.controller); + return stream4.toReadableStream(); + } +}; + +// node_modules/@anthropic-ai/sdk/resources/messages.mjs +var Messages = class extends APIResource { + create(body, options) { + return this._client.post("/v1/messages", { + body, + timeout: 6e5, + ...options, + stream: body.stream ?? false + }); + } + stream(body, options) { + return MessageStream.createMessage(this, body, options); + } +}; +(function(Messages2) { +})(Messages || (Messages = {})); + +// node_modules/@anthropic-ai/sdk/index.mjs +var _a; +var Anthropic = class extends APIClient { + constructor({ baseURL = readEnv("ANTHROPIC_BASE_URL"), apiKey: apiKey4 = readEnv("ANTHROPIC_API_KEY") ?? null, authToken = readEnv("ANTHROPIC_AUTH_TOKEN") ?? null, ...opts } = {}) { + const options = { + apiKey: apiKey4, + authToken, + ...opts, + baseURL: baseURL || `https://api.anthropic.com` + }; + super({ + baseURL: options.baseURL, + timeout: options.timeout ?? 6e5, + httpAgent: options.httpAgent, + maxRetries: options.maxRetries, + fetch: options.fetch + }); + this.completions = new Completions(this); + this.messages = new Messages(this); + this._options = options; + this.apiKey = apiKey4; + this.authToken = authToken; + } + defaultQuery() { + return this._options.defaultQuery; + } + defaultHeaders(opts) { + return { + ...super.defaultHeaders(opts), + "anthropic-version": "2023-06-01", + ...this._options.defaultHeaders + }; + } + validateHeaders(headers, customHeaders) { + if (this.apiKey && headers["x-api-key"]) { + return; + } + if (customHeaders["x-api-key"] === null) { + return; + } + if (this.authToken && headers["authorization"]) { + return; + } + if (customHeaders["authorization"] === null) { + return; + } + throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted'); + } + authHeaders(opts) { + const apiKeyAuth = this.apiKeyAuth(opts); + const bearerAuth = this.bearerAuth(opts); + if (apiKeyAuth != null && !isEmptyObj(apiKeyAuth)) { + return apiKeyAuth; + } + if (bearerAuth != null && !isEmptyObj(bearerAuth)) { + return bearerAuth; + } + return {}; + } + apiKeyAuth(opts) { + if (this.apiKey == null) { + return {}; + } + return { "X-Api-Key": this.apiKey }; + } + bearerAuth(opts) { + if (this.authToken == null) { + return {}; + } + return { Authorization: `Bearer ${this.authToken}` }; + } +}; +_a = Anthropic; +Anthropic.Anthropic = _a; +Anthropic.HUMAN_PROMPT = "\n\nHuman:"; +Anthropic.AI_PROMPT = "\n\nAssistant:"; +Anthropic.AnthropicError = AnthropicError; +Anthropic.APIError = APIError; +Anthropic.APIConnectionError = APIConnectionError; +Anthropic.APIConnectionTimeoutError = APIConnectionTimeoutError; +Anthropic.APIUserAbortError = APIUserAbortError; +Anthropic.NotFoundError = NotFoundError; +Anthropic.ConflictError = ConflictError; +Anthropic.RateLimitError = RateLimitError; +Anthropic.BadRequestError = BadRequestError; +Anthropic.AuthenticationError = AuthenticationError; +Anthropic.InternalServerError = InternalServerError; +Anthropic.PermissionDeniedError = PermissionDeniedError; +Anthropic.UnprocessableEntityError = UnprocessableEntityError; +var { HUMAN_PROMPT, AI_PROMPT } = Anthropic; +var { AnthropicError: AnthropicError2, APIError: APIError2, APIConnectionError: APIConnectionError2, APIConnectionTimeoutError: APIConnectionTimeoutError2, APIUserAbortError: APIUserAbortError2, NotFoundError: NotFoundError2, ConflictError: ConflictError2, RateLimitError: RateLimitError2, BadRequestError: BadRequestError2, AuthenticationError: AuthenticationError2, InternalServerError: InternalServerError2, PermissionDeniedError: PermissionDeniedError2, UnprocessableEntityError: UnprocessableEntityError2 } = error_exports; +(function(Anthropic2) { + Anthropic2.toFile = toFile; + Anthropic2.fileFromPath = fileFromPath; + Anthropic2.Completions = Completions; + Anthropic2.Messages = Messages; +})(Anthropic || (Anthropic = {})); +var sdk_default = Anthropic; + +// src/engine/anthropic.ts +var config5 = getConfig(); +var MAX_TOKENS_OUTPUT2 = config5?.OCO_TOKENS_MAX_OUTPUT || 500 /* DEFAULT_MAX_TOKENS_OUTPUT */; +var MAX_TOKENS_INPUT2 = config5?.OCO_TOKENS_MAX_INPUT || 4096 /* DEFAULT_MAX_TOKENS_INPUT */; +var provider2 = config5?.OCO_AI_PROVIDER; +var apiKey2 = config5?.OCO_ANTHROPIC_API_KEY; +var [command2, mode2] = process.argv.slice(2); +if (provider2 === "anthropic" && !apiKey2 && command2 !== "config" && mode2 !== "set" /* set */) { + ae("opencommit"); + ce( + "OCO_ANTHROPIC_API_KEY is not set, please run `oco config set OCO_ANTHROPIC_API_KEY= . If you are using Claude, make sure you add payment details, so API works.`" + ); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + process.exit(1); +} +var MODEL2 = config5?.OCO_MODEL; +if (provider2 === "anthropic" && !MODEL_LIST.anthropic.includes(MODEL2) && command2 !== "config" && mode2 !== "set" /* set */) { + ce( + `${source_default.red("\u2716")} Unsupported model ${MODEL2} for Anthropic. Supported models are: ${MODEL_LIST.anthropic.join( + ", " + )}` + ); + process.exit(1); +} +var AnthropicAi = class { + constructor() { + this.anthropicAiApiConfiguration = { + apiKey: apiKey2 + }; + this.generateCommitMessage = async (messages) => { + const systemMessage = messages.find((msg) => msg.role === "system")?.content; + const restMessages = messages.filter((msg) => msg.role !== "system"); + const params = { + model: MODEL2, + system: systemMessage, + messages: restMessages, + temperature: 0, + top_p: 0.1, + max_tokens: MAX_TOKENS_OUTPUT2 + }; + try { + const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a4, b7) => a4 + b7, 0); + if (REQUEST_TOKENS > MAX_TOKENS_INPUT2 - MAX_TOKENS_OUTPUT2) { + throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); + } + const data = await this.anthropicAI.messages.create(params); + const message = data?.content[0].text; + return message; + } catch (error) { + ce(`${source_default.red("\u2716")} ${JSON.stringify(params)}`); + const err = error; + ce(`${source_default.red("\u2716")} ${err?.message || err}`); + if (axios_default.isAxiosError(error) && error.response?.status === 401) { + const anthropicAiError = error.response.data.error; + if (anthropicAiError?.message) + ce(anthropicAiError.message); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + } + throw err; + } + }; + this.anthropicAI = new sdk_default(this.anthropicAiApiConfiguration); + } +}; // node_modules/@azure/core-auth/dist/esm/azureKeyCredential.js var AzureKeyCredential = class { @@ -34277,19 +37369,19 @@ function getErrorMessage(e3) { // node_modules/@azure/core-util/dist/esm/uuidUtils.js var import_crypto2 = require("crypto"); -var _a; -var uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function" ? globalThis.crypto.randomUUID.bind(globalThis.crypto) : import_crypto2.randomUUID; +var _a2; +var uuidFunction = typeof ((_a2 = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a2 === void 0 ? void 0 : _a2.randomUUID) === "function" ? globalThis.crypto.randomUUID.bind(globalThis.crypto) : import_crypto2.randomUUID; function randomUUID() { return uuidFunction(); } // node_modules/@azure/core-util/dist/esm/checkEnvironment.js -var _a2; +var _a3; var _b; var _c; var _d; var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; -var isWebWorker = typeof self === "object" && typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" && (((_a2 = self.constructor) === null || _a2 === void 0 ? void 0 : _a2.name) === "DedicatedWorkerGlobalScope" || ((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" || ((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope"); +var isWebWorker = typeof self === "object" && typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" && (((_a3 = self.constructor) === null || _a3 === void 0 ? void 0 : _a3.name) === "DedicatedWorkerGlobalScope" || ((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" || ((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope"); var isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined"; var isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; var isNodeLike = typeof globalThis.process !== "undefined" && Boolean(globalThis.process.version) && Boolean((_d = globalThis.process.versions) === null || _d === void 0 ? void 0 : _d.node); @@ -34329,15 +37421,15 @@ var { __spread, __spreadArrays, __spreadArray, - __await, - __asyncGenerator, + __await: __await2, + __asyncGenerator: __asyncGenerator2, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, + __classPrivateFieldGet: __classPrivateFieldGet8, + __classPrivateFieldSet: __classPrivateFieldSet7, __classPrivateFieldIn, __addDisposableResource, __disposeResources @@ -34929,10 +38021,10 @@ function userAgentPolicy(options = {}) { } // node_modules/@azure/core-rest-pipeline/dist/esm/util/concat.js -var import_node_stream = require("node:stream"); +var import_node_stream2 = require("node:stream"); // node_modules/@azure/core-rest-pipeline/dist/esm/util/typeGuards.js -function isBlob2(x5) { +function isBlob3(x5) { return typeof x5.stream === "function"; } @@ -34970,15 +38062,15 @@ function createFile(content, name, options = {}) { // node_modules/@azure/core-rest-pipeline/dist/esm/util/concat.js function streamAsyncIterator() { - return __asyncGenerator(this, arguments, function* streamAsyncIterator_1() { + return __asyncGenerator2(this, arguments, function* streamAsyncIterator_1() { const reader = this.getReader(); try { while (true) { - const { done, value } = yield __await(reader.read()); + const { done, value } = yield __await2(reader.read()); if (done) { - return yield __await(void 0); + return yield __await2(void 0); } - yield yield __await(value); + yield yield __await2(value); } } finally { reader.releaseLock(); @@ -34996,15 +38088,15 @@ function makeAsyncIterable(webStream) { function ensureNodeStream(stream4) { if (stream4 instanceof ReadableStream) { makeAsyncIterable(stream4); - return import_node_stream.Readable.fromWeb(stream4); + return import_node_stream2.Readable.fromWeb(stream4); } else { return stream4; } } function toStream(source) { if (source instanceof Uint8Array) { - return import_node_stream.Readable.from(Buffer.from(source)); - } else if (isBlob2(source)) { + return import_node_stream2.Readable.from(Buffer.from(source)); + } else if (isBlob3(source)) { return toStream(getRawContent(source)); } else { return ensureNodeStream(source); @@ -35013,23 +38105,23 @@ function toStream(source) { async function concat(sources) { return function() { const streams = sources.map((x5) => typeof x5 === "function" ? x5() : x5).map(toStream); - return import_node_stream.Readable.from(function() { - return __asyncGenerator(this, arguments, function* () { + return import_node_stream2.Readable.from(function() { + return __asyncGenerator2(this, arguments, function* () { var _a4, e_1, _b2, _c2; for (const stream4 of streams) { try { - for (var _d2 = true, stream_1 = (e_1 = void 0, __asyncValues(stream4)), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a4 = stream_1_1.done, !_a4; _d2 = true) { + for (var _d2 = true, stream_1 = (e_1 = void 0, __asyncValues(stream4)), stream_1_1; stream_1_1 = yield __await2(stream_1.next()), _a4 = stream_1_1.done, !_a4; _d2 = true) { _c2 = stream_1_1.value; _d2 = false; const chunk = _c2; - yield yield __await(chunk); + yield yield __await2(chunk); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (!_d2 && !_a4 && (_b2 = stream_1.return)) - yield __await(_b2.call(stream_1)); + yield __await2(_b2.call(stream_1)); } finally { if (e_1) throw e_1.error; @@ -35056,7 +38148,7 @@ function encodeHeaders(headers) { function getLength(source) { if (source instanceof Uint8Array) { return source.byteLength; - } else if (isBlob2(source)) { + } else if (isBlob3(source)) { return source.size === -1 ? void 0 : source.size; } else { return void 0; @@ -35932,7 +39024,7 @@ function createPipelineFromOptions(options) { var http2 = __toESM(require("node:http"), 1); var https2 = __toESM(require("node:https"), 1); var zlib2 = __toESM(require("node:zlib"), 1); -var import_node_stream2 = require("node:stream"); +var import_node_stream3 = require("node:stream"); var DEFAULT_TLS_SETTINGS = {}; function isReadableStream(body) { return body && typeof body.pipe === "function"; @@ -35947,7 +39039,7 @@ function isStreamComplete(stream4) { function isArrayBuffer2(body) { return body && typeof body.byteLength === "number"; } -var ReportTransform = class extends import_node_stream2.Transform { +var ReportTransform = class extends import_node_stream3.Transform { _transform(chunk, _encoding, callback) { this.push(chunk); this.loadedBytes += chunk.length; @@ -37234,20 +40326,20 @@ function isReadableStream3(body) { return Boolean(body && typeof body.getReader === "function" && typeof body.tee === "function"); } function toAsyncIterable(stream4) { - return __asyncGenerator(this, arguments, function* toAsyncIterable_1() { + return __asyncGenerator2(this, arguments, function* toAsyncIterable_1() { const reader = stream4.getReader(); try { while (true) { - const { value, done } = yield __await(reader.read()); + const { value, done } = yield __await2(reader.read()); if (done) { - return yield __await(void 0); + return yield __await2(void 0); } - yield yield __await(value); + yield yield __await2(value); } } finally { const cancelPromise = reader.cancel(); reader.releaseLock(); - yield __await(cancelPromise); + yield __await2(cancelPromise); } }); } @@ -37280,14 +40372,14 @@ function createMessage() { }; } function toLine(chunkIter) { - return __asyncGenerator(this, arguments, function* toLine_1() { + return __asyncGenerator2(this, arguments, function* toLine_1() { var _a4, e_1, _b2, _c2; let buf; let bufIdx = 0; let fieldLen = -1; let discardTrailingNewline = false; try { - for (var _d2 = true, chunkIter_1 = __asyncValues(chunkIter), chunkIter_1_1; chunkIter_1_1 = yield __await(chunkIter_1.next()), _a4 = chunkIter_1_1.done, !_a4; _d2 = true) { + for (var _d2 = true, chunkIter_1 = __asyncValues(chunkIter), chunkIter_1_1; chunkIter_1_1 = yield __await2(chunkIter_1.next()), _a4 = chunkIter_1_1.done, !_a4; _d2 = true) { _c2 = chunkIter_1_1.value; _d2 = false; const chunk = _c2; @@ -37327,7 +40419,7 @@ function toLine(chunkIter) { if (end === -1) { break; } - yield yield __await({ line: buf.subarray(start, end), fieldLen }); + yield yield __await2({ line: buf.subarray(start, end), fieldLen }); start = bufIdx; fieldLen = -1; } @@ -37343,7 +40435,7 @@ function toLine(chunkIter) { } finally { try { if (!_d2 && !_a4 && (_b2 = chunkIter_1.return)) - yield __await(_b2.call(chunkIter_1)); + yield __await2(_b2.call(chunkIter_1)); } finally { if (e_1) throw e_1.error; @@ -37352,17 +40444,17 @@ function toLine(chunkIter) { }); } function toMessage(lineIter) { - return __asyncGenerator(this, arguments, function* toMessage_1() { + return __asyncGenerator2(this, arguments, function* toMessage_1() { var _a4, e_2, _b2, _c2; let message = createMessage(); const decoder = new TextDecoder(); try { - for (var _d2 = true, lineIter_1 = __asyncValues(lineIter), lineIter_1_1; lineIter_1_1 = yield __await(lineIter_1.next()), _a4 = lineIter_1_1.done, !_a4; _d2 = true) { + for (var _d2 = true, lineIter_1 = __asyncValues(lineIter), lineIter_1_1; lineIter_1_1 = yield __await2(lineIter_1.next()), _a4 = lineIter_1_1.done, !_a4; _d2 = true) { _c2 = lineIter_1_1.value; _d2 = false; const { line, fieldLen } = _c2; if (line.length === 0 && message.data !== void 0) { - yield yield __await(message); + yield yield __await2(message); message = createMessage(); } else if (fieldLen > 0) { const field = decoder.decode(line.subarray(0, fieldLen)); @@ -37393,7 +40485,7 @@ function toMessage(lineIter) { } finally { try { if (!_d2 && !_a4 && (_b2 = lineIter_1.return)) - yield __await(_b2.call(lineIter_1)); + yield __await2(_b2.call(lineIter_1)); } finally { if (e_2) throw e_2.error; @@ -37416,20 +40508,20 @@ function makeAsyncIterable3(webStream) { } } function toAsyncIterable2(stream4) { - return __asyncGenerator(this, arguments, function* toAsyncIterable_1() { + return __asyncGenerator2(this, arguments, function* toAsyncIterable_1() { const reader = stream4.getReader(); try { while (true) { - const { value, done } = yield __await(reader.read()); + const { value, done } = yield __await2(reader.read()); if (done) { - return yield __await(void 0); + return yield __await2(void 0); } - yield yield __await(value); + yield yield __await2(value); } } finally { const cancelPromise = reader.cancel(); reader.releaseLock(); - yield __await(cancelPromise); + yield __await2(cancelPromise); } }); } @@ -37867,15 +40959,15 @@ var OpenAIClient = class { }; // src/engine/azure.ts -var config5 = getConfig(); -var MAX_TOKENS_OUTPUT2 = config5?.OCO_TOKENS_MAX_OUTPUT || 500 /* DEFAULT_MAX_TOKENS_OUTPUT */; -var MAX_TOKENS_INPUT2 = config5?.OCO_TOKENS_MAX_INPUT || 4096 /* DEFAULT_MAX_TOKENS_INPUT */; -var basePath2 = config5?.OCO_OPENAI_BASE_PATH; -var apiKey2 = config5?.OCO_AZURE_API_KEY; -var apiEndpoint = config5?.OCO_AZURE_ENDPOINT; -var [command2, mode2] = process.argv.slice(2); -var provider2 = config5?.OCO_AI_PROVIDER; -if (provider2 === "azure" && !apiKey2 && !apiEndpoint && command2 !== "config" && mode2 !== "set" /* set */) { +var config6 = getConfig(); +var MAX_TOKENS_OUTPUT3 = config6?.OCO_TOKENS_MAX_OUTPUT || 500 /* DEFAULT_MAX_TOKENS_OUTPUT */; +var MAX_TOKENS_INPUT3 = config6?.OCO_TOKENS_MAX_INPUT || 4096 /* DEFAULT_MAX_TOKENS_INPUT */; +var basePath2 = config6?.OCO_OPENAI_BASE_PATH; +var apiKey3 = config6?.OCO_AZURE_API_KEY; +var apiEndpoint = config6?.OCO_AZURE_ENDPOINT; +var [command3, mode3] = process.argv.slice(2); +var provider3 = config6?.OCO_AI_PROVIDER; +if (provider3 === "azure" && !apiKey3 && !apiEndpoint && command3 !== "config" && mode3 !== "set" /* set */) { ae("opencommit"); ce( "OCO_AZURE_API_KEY or OCO_AZURE_ENDPOINT are not set, please run `oco config set OCO_AZURE_API_KEY= . If you are using GPT, make sure you add payment details, so API works.`" @@ -37885,2228 +40977,63 @@ if (provider2 === "azure" && !apiKey2 && !apiEndpoint && command2 !== "config" & ); process.exit(1); } -var MODEL2 = config5?.OCO_MODEL || "gpt-3.5-turbo"; +var MODEL3 = config6?.OCO_MODEL || "gpt-3.5-turbo"; var Azure = class { - openAI; constructor() { - if (provider2 === "azure") { - this.openAI = new OpenAIClient(apiEndpoint, new AzureKeyCredential(apiKey2)); + this.generateCommitMessage = async (messages) => { + try { + const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a4, b7) => a4 + b7, 0); + if (REQUEST_TOKENS > MAX_TOKENS_INPUT3 - MAX_TOKENS_OUTPUT3) { + throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); + } + const data = await this.openAI.getChatCompletions(MODEL3, messages); + const message = data.choices[0].message; + if (message?.content === null) { + return void 0; + } + return message?.content; + } catch (error) { + ce(`${source_default.red("\u2716")} ${MODEL3}`); + const err = error; + ce(`${source_default.red("\u2716")} ${err?.message || err}`); + if (axios_default.isAxiosError(error) && error.response?.status === 401) { + const openAiError = error.response.data.error; + if (openAiError?.message) + ce(openAiError.message); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + } + throw err; + } + }; + if (provider3 === "azure") { + this.openAI = new OpenAIClient(apiEndpoint, new AzureKeyCredential(apiKey3)); } } - generateCommitMessage = async (messages) => { - try { - const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a4, b7) => a4 + b7, 0); - if (REQUEST_TOKENS > MAX_TOKENS_INPUT2 - MAX_TOKENS_OUTPUT2) { - throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); - } - const data = await this.openAI.getChatCompletions(MODEL2, messages); - const message = data.choices[0].message; - if (message?.content === null) { - return void 0; - } - return message?.content; - } catch (error) { - ce(`${source_default.red("\u2716")} ${MODEL2}`); - const err = error; - ce(`${source_default.red("\u2716")} ${err?.message || err}`); - if (axios_default.isAxiosError(error) && error.response?.status === 401) { - const openAiError = error.response.data.error; - if (openAiError?.message) - ce(openAiError.message); - ce( - "For help look into README https://github.com/di-sukharev/opencommit#setup" - ); - } - throw err; - } - }; }; var azure = new Azure(); -// node_modules/@anthropic-ai/sdk/version.mjs -var VERSION3 = "0.19.2"; - -// node_modules/@anthropic-ai/sdk/_shims/registry.mjs -var auto = false; -var kind = void 0; -var fetch = void 0; -var Request = void 0; -var Response = void 0; -var Headers = void 0; -var FormData3 = void 0; -var Blob2 = void 0; -var File2 = void 0; -var ReadableStream2 = void 0; -var getMultipartRequestOptions = void 0; -var getDefaultAgent = void 0; -var fileFromPath = void 0; -var isFsReadStream = void 0; -function setShims(shims, options = { auto: false }) { - if (auto) { - throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` before importing anything else from @anthropic-ai/sdk`); - } - if (kind) { - throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` after \`import '@anthropic-ai/sdk/shims/${kind}'\``); - } - auto = options.auto; - kind = shims.kind; - fetch = shims.fetch; - Request = shims.Request; - Response = shims.Response; - Headers = shims.Headers; - FormData3 = shims.FormData; - Blob2 = shims.Blob; - File2 = shims.File; - ReadableStream2 = shims.ReadableStream; - getMultipartRequestOptions = shims.getMultipartRequestOptions; - getDefaultAgent = shims.getDefaultAgent; - fileFromPath = shims.fileFromPath; - isFsReadStream = shims.isFsReadStream; -} - -// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs -var nf = __toESM(require_lib3(), 1); - -// node_modules/formdata-node/lib/esm/FormData.js -var import_util8 = require("util"); -init_File(); -init_isFile(); - -// node_modules/formdata-node/lib/esm/isBlob.js -init_Blob(); -var isBlob3 = (value) => value instanceof Blob3; - -// node_modules/formdata-node/lib/esm/FormData.js -init_isFunction(); - -// node_modules/formdata-node/lib/esm/deprecateConstructorEntries.js -var import_util7 = require("util"); -var deprecateConstructorEntries = (0, import_util7.deprecate)(() => { -}, 'Constructor "entries" argument is not spec-compliant and will be removed in next major release.'); - -// node_modules/formdata-node/lib/esm/FormData.js -var __classPrivateFieldGet4 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); -}; -var _FormData_instances; -var _FormData_entries; -var _FormData_setEntry; -var FormData4 = class { - constructor(entries) { - _FormData_instances.add(this); - _FormData_entries.set(this, /* @__PURE__ */ new Map()); - if (entries) { - deprecateConstructorEntries(); - entries.forEach(({ name, value, fileName }) => this.append(name, value, fileName)); - } - } - static [(_FormData_entries = /* @__PURE__ */ new WeakMap(), _FormData_instances = /* @__PURE__ */ new WeakSet(), Symbol.hasInstance)](value) { - return Boolean(value && isFunction2(value.constructor) && value[Symbol.toStringTag] === "FormData" && isFunction2(value.append) && isFunction2(value.set) && isFunction2(value.get) && isFunction2(value.getAll) && isFunction2(value.has) && isFunction2(value.delete) && isFunction2(value.entries) && isFunction2(value.values) && isFunction2(value.keys) && isFunction2(value[Symbol.iterator]) && isFunction2(value.forEach)); - } - append(name, value, fileName) { - __classPrivateFieldGet4(this, _FormData_instances, "m", _FormData_setEntry).call(this, { - name, - fileName, - append: true, - rawValue: value, - argsLength: arguments.length - }); - } - set(name, value, fileName) { - __classPrivateFieldGet4(this, _FormData_instances, "m", _FormData_setEntry).call(this, { - name, - fileName, - append: false, - rawValue: value, - argsLength: arguments.length - }); - } - get(name) { - const field = __classPrivateFieldGet4(this, _FormData_entries, "f").get(String(name)); - if (!field) { - return null; - } - return field[0]; - } - getAll(name) { - const field = __classPrivateFieldGet4(this, _FormData_entries, "f").get(String(name)); - if (!field) { - return []; - } - return field.slice(); - } - has(name) { - return __classPrivateFieldGet4(this, _FormData_entries, "f").has(String(name)); - } - delete(name) { - __classPrivateFieldGet4(this, _FormData_entries, "f").delete(String(name)); - } - *keys() { - for (const key of __classPrivateFieldGet4(this, _FormData_entries, "f").keys()) { - yield key; - } - } - *entries() { - for (const name of this.keys()) { - const values = this.getAll(name); - for (const value of values) { - yield [name, value]; - } - } - } - *values() { - for (const [, value] of this) { - yield value; - } - } - [(_FormData_setEntry = function _FormData_setEntry2({ name, rawValue, append: append2, fileName, argsLength }) { - const methodName = append2 ? "append" : "set"; - if (argsLength < 2) { - throw new TypeError(`Failed to execute '${methodName}' on 'FormData': 2 arguments required, but only ${argsLength} present.`); - } - name = String(name); - let value; - if (isFile2(rawValue)) { - value = fileName === void 0 ? rawValue : new File3([rawValue], fileName, { - type: rawValue.type, - lastModified: rawValue.lastModified - }); - } else if (isBlob3(rawValue)) { - value = new File3([rawValue], fileName === void 0 ? "blob" : fileName, { - type: rawValue.type - }); - } else if (fileName) { - throw new TypeError(`Failed to execute '${methodName}' on 'FormData': parameter 2 is not of type 'Blob'.`); - } else { - value = String(rawValue); - } - const values = __classPrivateFieldGet4(this, _FormData_entries, "f").get(name); - if (!values) { - return void __classPrivateFieldGet4(this, _FormData_entries, "f").set(name, [value]); - } - if (!append2) { - return void __classPrivateFieldGet4(this, _FormData_entries, "f").set(name, [value]); - } - values.push(value); - }, Symbol.iterator)]() { - return this.entries(); - } - forEach(callback, thisArg) { - for (const [name, value] of this) { - callback.call(thisArg, value, name, this); - } - } - get [Symbol.toStringTag]() { - return "FormData"; - } - [import_util8.inspect.custom]() { - return this[Symbol.toStringTag]; - } -}; - -// node_modules/formdata-node/lib/esm/index.js -init_Blob(); -init_File(); - -// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs -var import_agentkeepalive = __toESM(require_agentkeepalive(), 1); -var import_abort_controller5 = __toESM(require_abort_controller(), 1); -var import_node_fs3 = require("node:fs"); - -// node_modules/form-data-encoder/lib/esm/util/createBoundary.js -var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789"; -function createBoundary() { - let size = 16; - let res = ""; - while (size--) { - res += alphabet[Math.random() * alphabet.length << 0]; - } - return res; -} -var createBoundary_default = createBoundary; - -// node_modules/form-data-encoder/lib/esm/util/isPlainObject.js -var getType = (value) => Object.prototype.toString.call(value).slice(8, -1).toLowerCase(); -function isPlainObject2(value) { - if (getType(value) !== "object") { - return false; - } - const pp = Object.getPrototypeOf(value); - if (pp === null || pp === void 0) { - return true; - } - const Ctor = pp.constructor && pp.constructor.toString(); - return Ctor === Object.toString(); -} -var isPlainObject_default = isPlainObject2; - -// node_modules/form-data-encoder/lib/esm/util/normalizeValue.js -var normalizeValue2 = (value) => String(value).replace(/\r|\n/g, (match, i3, str) => { - if (match === "\r" && str[i3 + 1] !== "\n" || match === "\n" && str[i3 - 1] !== "\r") { - return "\r\n"; - } - return match; -}); -var normalizeValue_default = normalizeValue2; - -// node_modules/form-data-encoder/lib/esm/util/escapeName.js -var escapeName = (name) => String(name).replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/"/g, "%22"); -var escapeName_default = escapeName; - -// node_modules/form-data-encoder/lib/esm/util/isFunction.js -var isFunction3 = (value) => typeof value === "function"; -var isFunction_default = isFunction3; - -// node_modules/form-data-encoder/lib/esm/util/isFileLike.js -var isFileLike = (value) => Boolean(value && typeof value === "object" && isFunction_default(value.constructor) && value[Symbol.toStringTag] === "File" && isFunction_default(value.stream) && value.name != null && value.size != null && value.lastModified != null); - -// node_modules/form-data-encoder/lib/esm/util/isFormData.js -var isFormData2 = (value) => Boolean(value && isFunction_default(value.constructor) && value[Symbol.toStringTag] === "FormData" && isFunction_default(value.append) && isFunction_default(value.getAll) && isFunction_default(value.entries) && isFunction_default(value[Symbol.iterator])); - -// node_modules/form-data-encoder/lib/esm/FormDataEncoder.js -var __classPrivateFieldSet4 = function(receiver, state2, value, kind2, f4) { - if (kind2 === "m") - throw new TypeError("Private method is not writable"); - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; -}; -var __classPrivateFieldGet5 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); -}; -var _FormDataEncoder_instances; -var _FormDataEncoder_CRLF; -var _FormDataEncoder_CRLF_BYTES; -var _FormDataEncoder_CRLF_BYTES_LENGTH; -var _FormDataEncoder_DASHES; -var _FormDataEncoder_encoder; -var _FormDataEncoder_footer; -var _FormDataEncoder_form; -var _FormDataEncoder_options; -var _FormDataEncoder_getFieldHeader; -var defaultOptions = { - enableAdditionalHeaders: false -}; -var FormDataEncoder = class { - constructor(form, boundaryOrOptions, options) { - _FormDataEncoder_instances.add(this); - _FormDataEncoder_CRLF.set(this, "\r\n"); - _FormDataEncoder_CRLF_BYTES.set(this, void 0); - _FormDataEncoder_CRLF_BYTES_LENGTH.set(this, void 0); - _FormDataEncoder_DASHES.set(this, "-".repeat(2)); - _FormDataEncoder_encoder.set(this, new TextEncoder()); - _FormDataEncoder_footer.set(this, void 0); - _FormDataEncoder_form.set(this, void 0); - _FormDataEncoder_options.set(this, void 0); - if (!isFormData2(form)) { - throw new TypeError("Expected first argument to be a FormData instance."); - } - let boundary; - if (isPlainObject_default(boundaryOrOptions)) { - options = boundaryOrOptions; - } else { - boundary = boundaryOrOptions; - } - if (!boundary) { - boundary = createBoundary_default(); - } - if (typeof boundary !== "string") { - throw new TypeError("Expected boundary argument to be a string."); - } - if (options && !isPlainObject_default(options)) { - throw new TypeError("Expected options argument to be an object."); - } - __classPrivateFieldSet4(this, _FormDataEncoder_form, form, "f"); - __classPrivateFieldSet4(this, _FormDataEncoder_options, { ...defaultOptions, ...options }, "f"); - __classPrivateFieldSet4(this, _FormDataEncoder_CRLF_BYTES, __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f")), "f"); - __classPrivateFieldSet4(this, _FormDataEncoder_CRLF_BYTES_LENGTH, __classPrivateFieldGet5(this, _FormDataEncoder_CRLF_BYTES, "f").byteLength, "f"); - this.boundary = `form-data-boundary-${boundary}`; - this.contentType = `multipart/form-data; boundary=${this.boundary}`; - __classPrivateFieldSet4(this, _FormDataEncoder_footer, __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(`${__classPrivateFieldGet5(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet5(this, _FormDataEncoder_DASHES, "f")}${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f").repeat(2)}`), "f"); - this.contentLength = String(this.getContentLength()); - this.headers = Object.freeze({ - "Content-Type": this.contentType, - "Content-Length": this.contentLength - }); - Object.defineProperties(this, { - boundary: { writable: false, configurable: false }, - contentType: { writable: false, configurable: false }, - contentLength: { writable: false, configurable: false }, - headers: { writable: false, configurable: false } - }); - } - getContentLength() { - let length = 0; - for (const [name, raw] of __classPrivateFieldGet5(this, _FormDataEncoder_form, "f")) { - const value = isFileLike(raw) ? raw : __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(normalizeValue_default(raw)); - length += __classPrivateFieldGet5(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value).byteLength; - length += isFileLike(value) ? value.size : value.byteLength; - length += __classPrivateFieldGet5(this, _FormDataEncoder_CRLF_BYTES_LENGTH, "f"); - } - return length + __classPrivateFieldGet5(this, _FormDataEncoder_footer, "f").byteLength; - } - *values() { - for (const [name, raw] of __classPrivateFieldGet5(this, _FormDataEncoder_form, "f").entries()) { - const value = isFileLike(raw) ? raw : __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(normalizeValue_default(raw)); - yield __classPrivateFieldGet5(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value); - yield value; - yield __classPrivateFieldGet5(this, _FormDataEncoder_CRLF_BYTES, "f"); - } - yield __classPrivateFieldGet5(this, _FormDataEncoder_footer, "f"); - } - async *encode() { - for (const part of this.values()) { - if (isFileLike(part)) { - yield* part.stream(); - } else { - yield part; - } - } - } - [(_FormDataEncoder_CRLF = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES_LENGTH = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_DASHES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_encoder = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_footer = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_form = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_options = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_instances = /* @__PURE__ */ new WeakSet(), _FormDataEncoder_getFieldHeader = function _FormDataEncoder_getFieldHeader2(name, value) { - let header = ""; - header += `${__classPrivateFieldGet5(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f")}`; - header += `Content-Disposition: form-data; name="${escapeName_default(name)}"`; - if (isFileLike(value)) { - header += `; filename="${escapeName_default(value.name)}"${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f")}`; - header += `Content-Type: ${value.type || "application/octet-stream"}`; - } - if (__classPrivateFieldGet5(this, _FormDataEncoder_options, "f").enableAdditionalHeaders === true) { - header += `${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f")}Content-Length: ${isFileLike(value) ? value.size : value.byteLength}`; - } - return __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(`${header}${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f").repeat(2)}`); - }, Symbol.iterator)]() { - return this.values(); - } - [Symbol.asyncIterator]() { - return this.encode(); - } -}; - -// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs -var import_node_stream3 = require("node:stream"); - -// node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs -var MultipartBody = class { - constructor(body) { - this.body = body; - } - get [Symbol.toStringTag]() { - return "MultipartBody"; - } -}; - -// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs -var import_ponyfill_es2018 = __toESM(require_ponyfill_es2018(), 1); -var fileFromPathWarned = false; -async function fileFromPath3(path5, ...args) { - const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports)); - if (!fileFromPathWarned) { - console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path5)}) instead`); - fileFromPathWarned = true; - } - return await _fileFromPath(path5, ...args); -} -var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 }); -var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 }); -async function getMultipartRequestOptions2(form, opts) { - const encoder = new FormDataEncoder(form); - const readable = import_node_stream3.Readable.from(encoder); - const body = new MultipartBody(readable); - const headers = { - ...opts.headers, - ...encoder.headers, - "Content-Length": encoder.contentLength - }; - return { ...opts, body, headers }; -} -function getRuntime() { - if (typeof AbortController === "undefined") { - globalThis.AbortController = import_abort_controller5.AbortController; - } - return { - kind: "node", - fetch: nf.default, - Request: nf.Request, - Response: nf.Response, - Headers: nf.Headers, - FormData: FormData4, - Blob: Blob3, - File: File3, - ReadableStream: import_ponyfill_es2018.ReadableStream, - getMultipartRequestOptions: getMultipartRequestOptions2, - getDefaultAgent: (url2) => url2.startsWith("https") ? defaultHttpsAgent : defaultHttpAgent, - fileFromPath: fileFromPath3, - isFsReadStream: (value) => value instanceof import_node_fs3.ReadStream - }; -} - -// node_modules/@anthropic-ai/sdk/_shims/index.mjs -if (!kind) - setShims(getRuntime(), { auto: true }); - -// node_modules/@anthropic-ai/sdk/error.mjs -var error_exports = {}; -__export(error_exports, { - APIConnectionError: () => APIConnectionError, - APIConnectionTimeoutError: () => APIConnectionTimeoutError, - APIError: () => APIError, - APIUserAbortError: () => APIUserAbortError, - AnthropicError: () => AnthropicError, - AuthenticationError: () => AuthenticationError, - BadRequestError: () => BadRequestError, - ConflictError: () => ConflictError, - InternalServerError: () => InternalServerError, - NotFoundError: () => NotFoundError, - PermissionDeniedError: () => PermissionDeniedError, - RateLimitError: () => RateLimitError, - UnprocessableEntityError: () => UnprocessableEntityError -}); -var AnthropicError = class extends Error { -}; -var APIError = class extends AnthropicError { - constructor(status, error, message, headers) { - super(`${APIError.makeMessage(status, error, message)}`); - this.status = status; - this.headers = headers; - this.error = error; - } - static makeMessage(status, error, message) { - const msg = error?.message ? typeof error.message === "string" ? error.message : JSON.stringify(error.message) : error ? JSON.stringify(error) : message; - if (status && msg) { - return `${status} ${msg}`; - } - if (status) { - return `${status} status code (no body)`; - } - if (msg) { - return msg; - } - return "(no status code or body)"; - } - static generate(status, errorResponse, message, headers) { - if (!status) { - return new APIConnectionError({ cause: castToError(errorResponse) }); - } - const error = errorResponse; - if (status === 400) { - return new BadRequestError(status, error, message, headers); - } - if (status === 401) { - return new AuthenticationError(status, error, message, headers); - } - if (status === 403) { - return new PermissionDeniedError(status, error, message, headers); - } - if (status === 404) { - return new NotFoundError(status, error, message, headers); - } - if (status === 409) { - return new ConflictError(status, error, message, headers); - } - if (status === 422) { - return new UnprocessableEntityError(status, error, message, headers); - } - if (status === 429) { - return new RateLimitError(status, error, message, headers); - } - if (status >= 500) { - return new InternalServerError(status, error, message, headers); - } - return new APIError(status, error, message, headers); - } -}; -var APIUserAbortError = class extends APIError { - constructor({ message } = {}) { - super(void 0, void 0, message || "Request was aborted.", void 0); - this.status = void 0; - } -}; -var APIConnectionError = class extends APIError { - constructor({ message, cause }) { - super(void 0, void 0, message || "Connection error.", void 0); - this.status = void 0; - if (cause) - this.cause = cause; - } -}; -var APIConnectionTimeoutError = class extends APIConnectionError { - constructor({ message } = {}) { - super({ message: message ?? "Request timed out." }); - } -}; -var BadRequestError = class extends APIError { - constructor() { - super(...arguments); - this.status = 400; - } -}; -var AuthenticationError = class extends APIError { - constructor() { - super(...arguments); - this.status = 401; - } -}; -var PermissionDeniedError = class extends APIError { - constructor() { - super(...arguments); - this.status = 403; - } -}; -var NotFoundError = class extends APIError { - constructor() { - super(...arguments); - this.status = 404; - } -}; -var ConflictError = class extends APIError { - constructor() { - super(...arguments); - this.status = 409; - } -}; -var UnprocessableEntityError = class extends APIError { - constructor() { - super(...arguments); - this.status = 422; - } -}; -var RateLimitError = class extends APIError { - constructor() { - super(...arguments); - this.status = 429; - } -}; -var InternalServerError = class extends APIError { -}; - -// node_modules/@anthropic-ai/sdk/streaming.mjs -var Stream = class { - constructor(iterator, controller) { - this.iterator = iterator; - this.controller = controller; - } - static fromSSEResponse(response, controller) { - let consumed = false; - async function* iterator() { - if (consumed) { - throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream."); - } - consumed = true; - let done = false; - try { - for await (const sse of _iterSSEMessages(response, controller)) { - if (sse.event === "completion") { - try { - yield JSON.parse(sse.data); - } catch (e3) { - console.error(`Could not parse message into JSON:`, sse.data); - console.error(`From chunk:`, sse.raw); - throw e3; - } - } - if (sse.event === "message_start" || sse.event === "message_delta" || sse.event === "message_stop" || sse.event === "content_block_start" || sse.event === "content_block_delta" || sse.event === "content_block_stop") { - try { - yield JSON.parse(sse.data); - } catch (e3) { - console.error(`Could not parse message into JSON:`, sse.data); - console.error(`From chunk:`, sse.raw); - throw e3; - } - } - if (sse.event === "ping") { - continue; - } - if (sse.event === "error") { - const errText = sse.data; - const errJSON = safeJSON(errText); - const errMessage = errJSON ? void 0 : errText; - throw APIError.generate(void 0, errJSON, errMessage, createResponseHeaders(response.headers)); - } - } - done = true; - } catch (e3) { - if (e3 instanceof Error && e3.name === "AbortError") - return; - throw e3; - } finally { - if (!done) - controller.abort(); - } - } - return new Stream(iterator, controller); - } - static fromReadableStream(readableStream, controller) { - let consumed = false; - async function* iterLines() { - const lineDecoder = new LineDecoder(); - const iter = readableStreamAsyncIterable(readableStream); - for await (const chunk of iter) { - for (const line of lineDecoder.decode(chunk)) { - yield line; - } - } - for (const line of lineDecoder.flush()) { - yield line; - } - } - async function* iterator() { - if (consumed) { - throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream."); - } - consumed = true; - let done = false; - try { - for await (const line of iterLines()) { - if (done) - continue; - if (line) - yield JSON.parse(line); - } - done = true; - } catch (e3) { - if (e3 instanceof Error && e3.name === "AbortError") - return; - throw e3; - } finally { - if (!done) - controller.abort(); - } - } - return new Stream(iterator, controller); - } - [Symbol.asyncIterator]() { - return this.iterator(); - } - tee() { - const left = []; - const right = []; - const iterator = this.iterator(); - const teeIterator = (queue) => { - return { - next: () => { - if (queue.length === 0) { - const result = iterator.next(); - left.push(result); - right.push(result); - } - return queue.shift(); - } - }; - }; - return [ - new Stream(() => teeIterator(left), this.controller), - new Stream(() => teeIterator(right), this.controller) - ]; - } - toReadableStream() { - const self2 = this; - let iter; - const encoder = new TextEncoder(); - return new ReadableStream2({ - async start() { - iter = self2[Symbol.asyncIterator](); - }, - async pull(ctrl) { - try { - const { value, done } = await iter.next(); - if (done) - return ctrl.close(); - const bytes = encoder.encode(JSON.stringify(value) + "\n"); - ctrl.enqueue(bytes); - } catch (err) { - ctrl.error(err); - } - }, - async cancel() { - await iter.return?.(); - } - }); - } -}; -async function* _iterSSEMessages(response, controller) { - if (!response.body) { - controller.abort(); - throw new AnthropicError(`Attempted to iterate over a response with no body`); - } - const sseDecoder = new SSEDecoder(); - const lineDecoder = new LineDecoder(); - const iter = readableStreamAsyncIterable(response.body); - for await (const sseChunk of iterSSEChunks(iter)) { - for (const line of lineDecoder.decode(sseChunk)) { - const sse = sseDecoder.decode(line); - if (sse) - yield sse; - } - } - for (const line of lineDecoder.flush()) { - const sse = sseDecoder.decode(line); - if (sse) - yield sse; - } -} -async function* iterSSEChunks(iterator) { - let data = new Uint8Array(); - for await (const chunk of iterator) { - if (chunk == null) { - continue; - } - const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk) : typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk; - let newData = new Uint8Array(data.length + binaryChunk.length); - newData.set(data); - newData.set(binaryChunk, data.length); - data = newData; - let patternIndex; - while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) { - yield data.slice(0, patternIndex); - data = data.slice(patternIndex); - } - } - if (data.length > 0) { - yield data; - } -} -function findDoubleNewlineIndex(buffer) { - const newline = 10; - const carriage = 13; - for (let i3 = 0; i3 < buffer.length - 2; i3++) { - if (buffer[i3] === newline && buffer[i3 + 1] === newline) { - return i3 + 2; - } - if (buffer[i3] === carriage && buffer[i3 + 1] === carriage) { - return i3 + 2; - } - if (buffer[i3] === carriage && buffer[i3 + 1] === newline && i3 + 3 < buffer.length && buffer[i3 + 2] === carriage && buffer[i3 + 3] === newline) { - return i3 + 4; - } - } - return -1; -} -var SSEDecoder = class { - constructor() { - this.event = null; - this.data = []; - this.chunks = []; - } - decode(line) { - if (line.endsWith("\r")) { - line = line.substring(0, line.length - 1); - } - if (!line) { - if (!this.event && !this.data.length) - return null; - const sse = { - event: this.event, - data: this.data.join("\n"), - raw: this.chunks - }; - this.event = null; - this.data = []; - this.chunks = []; - return sse; - } - this.chunks.push(line); - if (line.startsWith(":")) { - return null; - } - let [fieldname, _7, value] = partition(line, ":"); - if (value.startsWith(" ")) { - value = value.substring(1); - } - if (fieldname === "event") { - this.event = value; - } else if (fieldname === "data") { - this.data.push(value); - } - return null; - } -}; -var LineDecoder = class { - constructor() { - this.buffer = []; - this.trailingCR = false; - } - decode(chunk) { - let text = this.decodeText(chunk); - if (this.trailingCR) { - text = "\r" + text; - this.trailingCR = false; - } - if (text.endsWith("\r")) { - this.trailingCR = true; - text = text.slice(0, -1); - } - if (!text) { - return []; - } - const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || ""); - let lines = text.split(LineDecoder.NEWLINE_REGEXP); - if (trailingNewline) { - lines.pop(); - } - if (lines.length === 1 && !trailingNewline) { - this.buffer.push(lines[0]); - return []; - } - if (this.buffer.length > 0) { - lines = [this.buffer.join("") + lines[0], ...lines.slice(1)]; - this.buffer = []; - } - if (!trailingNewline) { - this.buffer = [lines.pop() || ""]; - } - return lines; - } - decodeText(bytes) { - if (bytes == null) - return ""; - if (typeof bytes === "string") - return bytes; - if (typeof Buffer !== "undefined") { - if (bytes instanceof Buffer) { - return bytes.toString(); - } - if (bytes instanceof Uint8Array) { - return Buffer.from(bytes).toString(); - } - throw new AnthropicError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`); - } - if (typeof TextDecoder !== "undefined") { - if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) { - this.textDecoder ?? (this.textDecoder = new TextDecoder("utf8")); - return this.textDecoder.decode(bytes); - } - throw new AnthropicError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`); - } - throw new AnthropicError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`); - } - flush() { - if (!this.buffer.length && !this.trailingCR) { - return []; - } - const lines = [this.buffer.join("")]; - this.buffer = []; - this.trailingCR = false; - return lines; - } -}; -LineDecoder.NEWLINE_CHARS = /* @__PURE__ */ new Set(["\n", "\r"]); -LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g; -function partition(str, delimiter) { - const index = str.indexOf(delimiter); - if (index !== -1) { - return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)]; - } - return [str, "", ""]; -} -function readableStreamAsyncIterable(stream4) { - if (stream4[Symbol.asyncIterator]) - return stream4; - const reader = stream4.getReader(); - return { - async next() { - try { - const result = await reader.read(); - if (result?.done) - reader.releaseLock(); - return result; - } catch (e3) { - reader.releaseLock(); - throw e3; - } - }, - async return() { - const cancelPromise = reader.cancel(); - reader.releaseLock(); - await cancelPromise; - return { done: true, value: void 0 }; - }, - [Symbol.asyncIterator]() { - return this; - } - }; -} - -// node_modules/@anthropic-ai/sdk/uploads.mjs -var isResponseLike = (value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function"; -var isFileLike2 = (value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value); -var isBlobLike = (value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function"; -async function toFile(value, name, options) { - value = await value; - options ?? (options = isFileLike2(value) ? { lastModified: value.lastModified, type: value.type } : {}); - if (isResponseLike(value)) { - const blob = await value.blob(); - name || (name = new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file"); - return new File2([blob], name, options); - } - const bits = await getBytes(value); - name || (name = getName(value) ?? "unknown_file"); - if (!options.type) { - const type2 = bits[0]?.type; - if (typeof type2 === "string") { - options = { ...options, type: type2 }; - } - } - return new File2(bits, name, options); -} -async function getBytes(value) { - let parts = []; - if (typeof value === "string" || ArrayBuffer.isView(value) || value instanceof ArrayBuffer) { - parts.push(value); - } else if (isBlobLike(value)) { - parts.push(await value.arrayBuffer()); - } else if (isAsyncIterableIterator(value)) { - for await (const chunk of value) { - parts.push(chunk); - } - } else { - throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`); - } - return parts; -} -function propsForError(value) { - const props = Object.getOwnPropertyNames(value); - return `[${props.map((p4) => `"${p4}"`).join(", ")}]`; -} -function getName(value) { - return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop(); -} -var getStringFromMaybeBuffer = (x5) => { - if (typeof x5 === "string") - return x5; - if (typeof Buffer !== "undefined" && x5 instanceof Buffer) - return String(x5); - return void 0; -}; -var isAsyncIterableIterator = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function"; -var isMultipartBody = (body) => body && typeof body === "object" && body.body && body[Symbol.toStringTag] === "MultipartBody"; - -// node_modules/@anthropic-ai/sdk/core.mjs -var __classPrivateFieldSet6 = function(receiver, state2, value, kind2, f4) { - if (kind2 === "m") - throw new TypeError("Private method is not writable"); - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; -}; -var __classPrivateFieldGet7 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); -}; -var _AbstractPage_client; -async function defaultParseResponse(props) { - const { response } = props; - if (props.options.stream) { - debug("response", response.status, response.url, response.headers, response.body); - if (props.options.__streamClass) { - return props.options.__streamClass.fromSSEResponse(response, props.controller); - } - return Stream.fromSSEResponse(response, props.controller); - } - if (response.status === 204) { - return null; - } - if (props.options.__binaryResponse) { - return response; - } - const contentType = response.headers.get("content-type"); - const isJSON = contentType?.includes("application/json") || contentType?.includes("application/vnd.api+json"); - if (isJSON) { - const json = await response.json(); - debug("response", response.status, response.url, response.headers, json); - return json; - } - const text = await response.text(); - debug("response", response.status, response.url, response.headers, text); - return text; -} -var APIPromise = class extends Promise { - constructor(responsePromise, parseResponse = defaultParseResponse) { - super((resolve) => { - resolve(null); - }); - this.responsePromise = responsePromise; - this.parseResponse = parseResponse; - } - _thenUnwrap(transform) { - return new APIPromise(this.responsePromise, async (props) => transform(await this.parseResponse(props))); - } - asResponse() { - return this.responsePromise.then((p4) => p4.response); - } - async withResponse() { - const [data, response] = await Promise.all([this.parse(), this.asResponse()]); - return { data, response }; - } - parse() { - if (!this.parsedPromise) { - this.parsedPromise = this.responsePromise.then(this.parseResponse); - } - return this.parsedPromise; - } - then(onfulfilled, onrejected) { - return this.parse().then(onfulfilled, onrejected); - } - catch(onrejected) { - return this.parse().catch(onrejected); - } - finally(onfinally) { - return this.parse().finally(onfinally); - } -}; -var APIClient = class { - constructor({ - baseURL, - maxRetries = 2, - timeout = 6e5, - httpAgent, - fetch: overridenFetch - }) { - this.baseURL = baseURL; - this.maxRetries = validatePositiveInteger("maxRetries", maxRetries); - this.timeout = validatePositiveInteger("timeout", timeout); - this.httpAgent = httpAgent; - this.fetch = overridenFetch ?? fetch; - } - authHeaders(opts) { - return {}; - } - defaultHeaders(opts) { - return { - Accept: "application/json", - "Content-Type": "application/json", - "User-Agent": this.getUserAgent(), - ...getPlatformHeaders(), - ...this.authHeaders(opts) - }; - } - validateHeaders(headers, customHeaders) { - } - defaultIdempotencyKey() { - return `stainless-node-retry-${uuid4()}`; - } - get(path5, opts) { - return this.methodRequest("get", path5, opts); - } - post(path5, opts) { - return this.methodRequest("post", path5, opts); - } - patch(path5, opts) { - return this.methodRequest("patch", path5, opts); - } - put(path5, opts) { - return this.methodRequest("put", path5, opts); - } - delete(path5, opts) { - return this.methodRequest("delete", path5, opts); - } - methodRequest(method, path5, opts) { - return this.request(Promise.resolve(opts).then((opts2) => ({ method, path: path5, ...opts2 }))); - } - getAPIList(path5, Page, opts) { - return this.requestAPIList(Page, { method: "get", path: path5, ...opts }); - } - calculateContentLength(body) { - if (typeof body === "string") { - if (typeof Buffer !== "undefined") { - return Buffer.byteLength(body, "utf8").toString(); - } - if (typeof TextEncoder !== "undefined") { - const encoder = new TextEncoder(); - const encoded = encoder.encode(body); - return encoded.length.toString(); - } - } - return null; - } - buildRequest(options) { - const { method, path: path5, query, headers = {} } = options; - const body = isMultipartBody(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null; - const contentLength = this.calculateContentLength(body); - const url2 = this.buildURL(path5, query); - if ("timeout" in options) - validatePositiveInteger("timeout", options.timeout); - const timeout = options.timeout ?? this.timeout; - const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url2); - const minAgentTimeout = timeout + 1e3; - if (typeof httpAgent?.options?.timeout === "number" && minAgentTimeout > (httpAgent.options.timeout ?? 0)) { - httpAgent.options.timeout = minAgentTimeout; - } - if (this.idempotencyHeader && method !== "get") { - if (!options.idempotencyKey) - options.idempotencyKey = this.defaultIdempotencyKey(); - headers[this.idempotencyHeader] = options.idempotencyKey; - } - const reqHeaders = this.buildHeaders({ options, headers, contentLength }); - const req = { - method, - ...body && { body }, - headers: reqHeaders, - ...httpAgent && { agent: httpAgent }, - signal: options.signal ?? null - }; - return { req, url: url2, timeout }; - } - buildHeaders({ options, headers, contentLength }) { - const reqHeaders = {}; - if (contentLength) { - reqHeaders["content-length"] = contentLength; - } - const defaultHeaders = this.defaultHeaders(options); - applyHeadersMut(reqHeaders, defaultHeaders); - applyHeadersMut(reqHeaders, headers); - if (isMultipartBody(options.body) && kind !== "node") { - delete reqHeaders["content-type"]; - } - this.validateHeaders(reqHeaders, headers); - return reqHeaders; - } - async prepareOptions(options) { - } - async prepareRequest(request3, { url: url2, options }) { - } - parseHeaders(headers) { - return !headers ? {} : Symbol.iterator in headers ? Object.fromEntries(Array.from(headers).map((header) => [...header])) : { ...headers }; - } - makeStatusError(status, error, message, headers) { - return APIError.generate(status, error, message, headers); - } - request(options, remainingRetries = null) { - return new APIPromise(this.makeRequest(options, remainingRetries)); - } - async makeRequest(optionsInput, retriesRemaining) { - const options = await optionsInput; - if (retriesRemaining == null) { - retriesRemaining = options.maxRetries ?? this.maxRetries; - } - await this.prepareOptions(options); - const { req, url: url2, timeout } = this.buildRequest(options); - await this.prepareRequest(req, { url: url2, options }); - debug("request", url2, options, req.headers); - if (options.signal?.aborted) { - throw new APIUserAbortError(); - } - const controller = new AbortController(); - const response = await this.fetchWithTimeout(url2, req, timeout, controller).catch(castToError); - if (response instanceof Error) { - if (options.signal?.aborted) { - throw new APIUserAbortError(); - } - if (retriesRemaining) { - return this.retryRequest(options, retriesRemaining); - } - if (response.name === "AbortError") { - throw new APIConnectionTimeoutError(); - } - throw new APIConnectionError({ cause: response }); - } - const responseHeaders = createResponseHeaders(response.headers); - if (!response.ok) { - if (retriesRemaining && this.shouldRetry(response)) { - const retryMessage2 = `retrying, ${retriesRemaining} attempts remaining`; - debug(`response (error; ${retryMessage2})`, response.status, url2, responseHeaders); - return this.retryRequest(options, retriesRemaining, responseHeaders); - } - const errText = await response.text().catch((e3) => castToError(e3).message); - const errJSON = safeJSON(errText); - const errMessage = errJSON ? void 0 : errText; - const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`; - debug(`response (error; ${retryMessage})`, response.status, url2, responseHeaders, errMessage); - const err = this.makeStatusError(response.status, errJSON, errMessage, responseHeaders); - throw err; - } - return { response, options, controller }; - } - requestAPIList(Page, options) { - const request3 = this.makeRequest(options, null); - return new PagePromise(this, request3, Page); - } - buildURL(path5, query) { - const url2 = isAbsoluteURL2(path5) ? new URL(path5) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path5.startsWith("/") ? path5.slice(1) : path5)); - const defaultQuery = this.defaultQuery(); - if (!isEmptyObj(defaultQuery)) { - query = { ...defaultQuery, ...query }; - } - if (typeof query === "object" && query && !Array.isArray(query)) { - url2.search = this.stringifyQuery(query); - } - return url2.toString(); - } - stringifyQuery(query) { - return Object.entries(query).filter(([_7, value]) => typeof value !== "undefined").map(([key, value]) => { - if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { - return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`; - } - if (value === null) { - return `${encodeURIComponent(key)}=`; - } - throw new AnthropicError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`); - }).join("&"); - } - async fetchWithTimeout(url2, init, ms, controller) { - const { signal, ...options } = init || {}; - if (signal) - signal.addEventListener("abort", () => controller.abort()); - const timeout = setTimeout(() => controller.abort(), ms); - return this.getRequestClient().fetch.call(void 0, url2, { signal: controller.signal, ...options }).finally(() => { - clearTimeout(timeout); - }); - } - getRequestClient() { - return { fetch: this.fetch }; - } - shouldRetry(response) { - const shouldRetryHeader = response.headers.get("x-should-retry"); - if (shouldRetryHeader === "true") - return true; - if (shouldRetryHeader === "false") - return false; - if (response.status === 408) - return true; - if (response.status === 409) - return true; - if (response.status === 429) - return true; - if (response.status >= 500) - return true; - return false; - } - async retryRequest(options, retriesRemaining, responseHeaders) { - let timeoutMillis; - const retryAfterMillisHeader = responseHeaders?.["retry-after-ms"]; - if (retryAfterMillisHeader) { - const timeoutMs = parseFloat(retryAfterMillisHeader); - if (!Number.isNaN(timeoutMs)) { - timeoutMillis = timeoutMs; - } - } - const retryAfterHeader = responseHeaders?.["retry-after"]; - if (retryAfterHeader && !timeoutMillis) { - const timeoutSeconds = parseFloat(retryAfterHeader); - if (!Number.isNaN(timeoutSeconds)) { - timeoutMillis = timeoutSeconds * 1e3; - } else { - timeoutMillis = Date.parse(retryAfterHeader) - Date.now(); - } - } - if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1e3)) { - const maxRetries = options.maxRetries ?? this.maxRetries; - timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); - } - await sleep(timeoutMillis); - return this.makeRequest(options, retriesRemaining - 1); - } - calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) { - const initialRetryDelay = 0.5; - const maxRetryDelay = 8; - const numRetries = maxRetries - retriesRemaining; - const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay); - const jitter = 1 - Math.random() * 0.25; - return sleepSeconds * jitter * 1e3; - } - getUserAgent() { - return `${this.constructor.name}/JS ${VERSION3}`; - } -}; -var AbstractPage = class { - constructor(client, response, body, options) { - _AbstractPage_client.set(this, void 0); - __classPrivateFieldSet6(this, _AbstractPage_client, client, "f"); - this.options = options; - this.response = response; - this.body = body; - } - hasNextPage() { - const items = this.getPaginatedItems(); - if (!items.length) - return false; - return this.nextPageInfo() != null; - } - async getNextPage() { - const nextInfo = this.nextPageInfo(); - if (!nextInfo) { - throw new AnthropicError("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`."); - } - const nextOptions = { ...this.options }; - if ("params" in nextInfo && typeof nextOptions.query === "object") { - nextOptions.query = { ...nextOptions.query, ...nextInfo.params }; - } else if ("url" in nextInfo) { - const params = [...Object.entries(nextOptions.query || {}), ...nextInfo.url.searchParams.entries()]; - for (const [key, value] of params) { - nextInfo.url.searchParams.set(key, value); - } - nextOptions.query = void 0; - nextOptions.path = nextInfo.url.toString(); - } - return await __classPrivateFieldGet7(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions); - } - async *iterPages() { - let page = this; - yield page; - while (page.hasNextPage()) { - page = await page.getNextPage(); - yield page; - } - } - async *[(_AbstractPage_client = /* @__PURE__ */ new WeakMap(), Symbol.asyncIterator)]() { - for await (const page of this.iterPages()) { - for (const item of page.getPaginatedItems()) { - yield item; - } - } - } -}; -var PagePromise = class extends APIPromise { - constructor(client, request3, Page) { - super(request3, async (props) => new Page(client, props.response, await defaultParseResponse(props), props.options)); - } - async *[Symbol.asyncIterator]() { - const page = await this; - for await (const item of page) { - yield item; - } - } -}; -var createResponseHeaders = (headers) => { - return new Proxy(Object.fromEntries( - headers.entries() - ), { - get(target, name) { - const key = name.toString(); - return target[key.toLowerCase()] || target[key]; - } - }); -}; -var getPlatformProperties = () => { - if (typeof Deno !== "undefined" && Deno.build != null) { - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": normalizePlatform(Deno.build.os), - "X-Stainless-Arch": normalizeArch(Deno.build.arch), - "X-Stainless-Runtime": "deno", - "X-Stainless-Runtime-Version": typeof Deno.version === "string" ? Deno.version : Deno.version?.deno ?? "unknown" - }; - } - if (typeof EdgeRuntime !== "undefined") { - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": "Unknown", - "X-Stainless-Arch": `other:${EdgeRuntime}`, - "X-Stainless-Runtime": "edge", - "X-Stainless-Runtime-Version": process.version - }; - } - if (Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]") { - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": normalizePlatform(process.platform), - "X-Stainless-Arch": normalizeArch(process.arch), - "X-Stainless-Runtime": "node", - "X-Stainless-Runtime-Version": process.version - }; - } - const browserInfo = getBrowserInfo(); - if (browserInfo) { - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": "Unknown", - "X-Stainless-Arch": "unknown", - "X-Stainless-Runtime": `browser:${browserInfo.browser}`, - "X-Stainless-Runtime-Version": browserInfo.version - }; - } - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": "Unknown", - "X-Stainless-Arch": "unknown", - "X-Stainless-Runtime": "unknown", - "X-Stainless-Runtime-Version": "unknown" - }; -}; -function getBrowserInfo() { - if (typeof navigator === "undefined" || !navigator) { - return null; - } - const browserPatterns = [ - { key: "edge", pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "ie", pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "ie", pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "chrome", pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "firefox", pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "safari", pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ } - ]; - for (const { key, pattern } of browserPatterns) { - const match = pattern.exec(navigator.userAgent); - if (match) { - const major = match[1] || 0; - const minor = match[2] || 0; - const patch = match[3] || 0; - return { browser: key, version: `${major}.${minor}.${patch}` }; - } - } - return null; -} -var normalizeArch = (arch2) => { - if (arch2 === "x32") - return "x32"; - if (arch2 === "x86_64" || arch2 === "x64") - return "x64"; - if (arch2 === "arm") - return "arm"; - if (arch2 === "aarch64" || arch2 === "arm64") - return "arm64"; - if (arch2) - return `other:${arch2}`; - return "unknown"; -}; -var normalizePlatform = (platform) => { - platform = platform.toLowerCase(); - if (platform.includes("ios")) - return "iOS"; - if (platform === "android") - return "Android"; - if (platform === "darwin") - return "MacOS"; - if (platform === "win32") - return "Windows"; - if (platform === "freebsd") - return "FreeBSD"; - if (platform === "openbsd") - return "OpenBSD"; - if (platform === "linux") - return "Linux"; - if (platform) - return `Other:${platform}`; - return "Unknown"; -}; -var _platformHeaders; -var getPlatformHeaders = () => { - return _platformHeaders ?? (_platformHeaders = getPlatformProperties()); -}; -var safeJSON = (text) => { - try { - return JSON.parse(text); - } catch (err) { - return void 0; - } -}; -var startsWithSchemeRegexp = new RegExp("^(?:[a-z]+:)?//", "i"); -var isAbsoluteURL2 = (url2) => { - return startsWithSchemeRegexp.test(url2); -}; -var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); -var validatePositiveInteger = (name, n2) => { - if (typeof n2 !== "number" || !Number.isInteger(n2)) { - throw new AnthropicError(`${name} must be an integer`); - } - if (n2 < 0) { - throw new AnthropicError(`${name} must be a positive integer`); - } - return n2; -}; -var castToError = (err) => { - if (err instanceof Error) - return err; - return new Error(err); -}; -var readEnv = (env2) => { - if (typeof process !== "undefined") { - return process.env?.[env2]?.trim() ?? void 0; - } - if (typeof Deno !== "undefined") { - return Deno.env?.get?.(env2)?.trim(); - } - return void 0; -}; -function isEmptyObj(obj) { - if (!obj) - return true; - for (const _k in obj) - return false; - return true; -} -function hasOwn(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} -function applyHeadersMut(targetHeaders, newHeaders) { - for (const k7 in newHeaders) { - if (!hasOwn(newHeaders, k7)) - continue; - const lowerKey = k7.toLowerCase(); - if (!lowerKey) - continue; - const val = newHeaders[k7]; - if (val === null) { - delete targetHeaders[lowerKey]; - } else if (val !== void 0) { - targetHeaders[lowerKey] = val; - } - } -} -function debug(action, ...args) { - if (typeof process !== "undefined" && process?.env?.["DEBUG"] === "true") { - console.log(`Anthropic:DEBUG:${action}`, ...args); - } -} -var uuid4 = () => { - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c3) => { - const r3 = Math.random() * 16 | 0; - const v5 = c3 === "x" ? r3 : r3 & 3 | 8; - return v5.toString(16); - }); -}; - -// node_modules/@anthropic-ai/sdk/resource.mjs -var APIResource = class { - constructor(client) { - this._client = client; - } -}; - -// node_modules/@anthropic-ai/sdk/resources/completions.mjs -var Completions = class extends APIResource { - create(body, options) { - return this._client.post("/v1/complete", { - body, - timeout: 6e5, - ...options, - stream: body.stream ?? false - }); - } -}; -(function(Completions2) { -})(Completions || (Completions = {})); - -// node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs -var __classPrivateFieldSet7 = function(receiver, state2, value, kind2, f4) { - if (kind2 === "m") - throw new TypeError("Private method is not writable"); - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; -}; -var __classPrivateFieldGet8 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); -}; -var _MessageStream_instances; -var _MessageStream_currentMessageSnapshot; -var _MessageStream_connectedPromise; -var _MessageStream_resolveConnectedPromise; -var _MessageStream_rejectConnectedPromise; -var _MessageStream_endPromise; -var _MessageStream_resolveEndPromise; -var _MessageStream_rejectEndPromise; -var _MessageStream_listeners; -var _MessageStream_ended; -var _MessageStream_errored; -var _MessageStream_aborted; -var _MessageStream_catchingPromiseCreated; -var _MessageStream_getFinalMessage; -var _MessageStream_getFinalText; -var _MessageStream_handleError; -var _MessageStream_beginRequest; -var _MessageStream_addStreamEvent; -var _MessageStream_endRequest; -var _MessageStream_accumulateMessage; -var MessageStream = class { - constructor() { - _MessageStream_instances.add(this); - this.messages = []; - this.receivedMessages = []; - _MessageStream_currentMessageSnapshot.set(this, void 0); - this.controller = new AbortController(); - _MessageStream_connectedPromise.set(this, void 0); - _MessageStream_resolveConnectedPromise.set(this, () => { - }); - _MessageStream_rejectConnectedPromise.set(this, () => { - }); - _MessageStream_endPromise.set(this, void 0); - _MessageStream_resolveEndPromise.set(this, () => { - }); - _MessageStream_rejectEndPromise.set(this, () => { - }); - _MessageStream_listeners.set(this, {}); - _MessageStream_ended.set(this, false); - _MessageStream_errored.set(this, false); - _MessageStream_aborted.set(this, false); - _MessageStream_catchingPromiseCreated.set(this, false); - _MessageStream_handleError.set(this, (error) => { - __classPrivateFieldSet7(this, _MessageStream_errored, true, "f"); - if (error instanceof Error && error.name === "AbortError") { - error = new APIUserAbortError(); - } - if (error instanceof APIUserAbortError) { - __classPrivateFieldSet7(this, _MessageStream_aborted, true, "f"); - return this._emit("abort", error); - } - if (error instanceof AnthropicError) { - return this._emit("error", error); - } - if (error instanceof Error) { - const anthropicError = new AnthropicError(error.message); - anthropicError.cause = error; - return this._emit("error", anthropicError); - } - return this._emit("error", new AnthropicError(String(error))); - }); - __classPrivateFieldSet7(this, _MessageStream_connectedPromise, new Promise((resolve, reject) => { - __classPrivateFieldSet7(this, _MessageStream_resolveConnectedPromise, resolve, "f"); - __classPrivateFieldSet7(this, _MessageStream_rejectConnectedPromise, reject, "f"); - }), "f"); - __classPrivateFieldSet7(this, _MessageStream_endPromise, new Promise((resolve, reject) => { - __classPrivateFieldSet7(this, _MessageStream_resolveEndPromise, resolve, "f"); - __classPrivateFieldSet7(this, _MessageStream_rejectEndPromise, reject, "f"); - }), "f"); - __classPrivateFieldGet8(this, _MessageStream_connectedPromise, "f").catch(() => { - }); - __classPrivateFieldGet8(this, _MessageStream_endPromise, "f").catch(() => { - }); - } - static fromReadableStream(stream4) { - const runner = new MessageStream(); - runner._run(() => runner._fromReadableStream(stream4)); - return runner; - } - static createMessage(messages, params, options) { - const runner = new MessageStream(); - for (const message of params.messages) { - runner._addMessageParam(message); - } - runner._run(() => runner._createMessage(messages, { ...params, stream: true }, { ...options, headers: { ...options?.headers, "X-Stainless-Helper-Method": "stream" } })); - return runner; - } - _run(executor) { - executor().then(() => { - this._emitFinal(); - this._emit("end"); - }, __classPrivateFieldGet8(this, _MessageStream_handleError, "f")); - } - _addMessageParam(message) { - this.messages.push(message); - } - _addMessage(message, emit = true) { - this.receivedMessages.push(message); - if (emit) { - this._emit("message", message); - } - } - async _createMessage(messages, params, options) { - const signal = options?.signal; - if (signal) { - if (signal.aborted) - this.controller.abort(); - signal.addEventListener("abort", () => this.controller.abort()); - } - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_beginRequest).call(this); - const stream4 = await messages.create({ ...params, stream: true }, { ...options, signal: this.controller.signal }); - this._connected(); - for await (const event of stream4) { - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_addStreamEvent).call(this, event); - } - if (stream4.controller.signal?.aborted) { - throw new APIUserAbortError(); - } - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_endRequest).call(this); - } - _connected() { - if (this.ended) - return; - __classPrivateFieldGet8(this, _MessageStream_resolveConnectedPromise, "f").call(this); - this._emit("connect"); - } - get ended() { - return __classPrivateFieldGet8(this, _MessageStream_ended, "f"); - } - get errored() { - return __classPrivateFieldGet8(this, _MessageStream_errored, "f"); - } - get aborted() { - return __classPrivateFieldGet8(this, _MessageStream_aborted, "f"); - } - abort() { - this.controller.abort(); - } - on(event, listener) { - const listeners = __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] = []); - listeners.push({ listener }); - return this; - } - off(event, listener) { - const listeners = __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event]; - if (!listeners) - return this; - const index = listeners.findIndex((l3) => l3.listener === listener); - if (index >= 0) - listeners.splice(index, 1); - return this; - } - once(event, listener) { - const listeners = __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] = []); - listeners.push({ listener, once: true }); - return this; - } - emitted(event) { - return new Promise((resolve, reject) => { - __classPrivateFieldSet7(this, _MessageStream_catchingPromiseCreated, true, "f"); - if (event !== "error") - this.once("error", reject); - this.once(event, resolve); - }); - } - async done() { - __classPrivateFieldSet7(this, _MessageStream_catchingPromiseCreated, true, "f"); - await __classPrivateFieldGet8(this, _MessageStream_endPromise, "f"); - } - get currentMessage() { - return __classPrivateFieldGet8(this, _MessageStream_currentMessageSnapshot, "f"); - } - async finalMessage() { - await this.done(); - return __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_getFinalMessage).call(this); - } - async finalText() { - await this.done(); - return __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_getFinalText).call(this); - } - _emit(event, ...args) { - if (__classPrivateFieldGet8(this, _MessageStream_ended, "f")) - return; - if (event === "end") { - __classPrivateFieldSet7(this, _MessageStream_ended, true, "f"); - __classPrivateFieldGet8(this, _MessageStream_resolveEndPromise, "f").call(this); - } - const listeners = __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event]; - if (listeners) { - __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] = listeners.filter((l3) => !l3.once); - listeners.forEach(({ listener }) => listener(...args)); - } - if (event === "abort") { - const error = args[0]; - if (!__classPrivateFieldGet8(this, _MessageStream_catchingPromiseCreated, "f") && !listeners?.length) { - Promise.reject(error); - } - __classPrivateFieldGet8(this, _MessageStream_rejectConnectedPromise, "f").call(this, error); - __classPrivateFieldGet8(this, _MessageStream_rejectEndPromise, "f").call(this, error); - this._emit("end"); - return; - } - if (event === "error") { - const error = args[0]; - if (!__classPrivateFieldGet8(this, _MessageStream_catchingPromiseCreated, "f") && !listeners?.length) { - Promise.reject(error); - } - __classPrivateFieldGet8(this, _MessageStream_rejectConnectedPromise, "f").call(this, error); - __classPrivateFieldGet8(this, _MessageStream_rejectEndPromise, "f").call(this, error); - this._emit("end"); - } - } - _emitFinal() { - const finalMessage = this.receivedMessages.at(-1); - if (finalMessage) { - this._emit("finalMessage", __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_getFinalMessage).call(this)); - } - } - async _fromReadableStream(readableStream, options) { - const signal = options?.signal; - if (signal) { - if (signal.aborted) - this.controller.abort(); - signal.addEventListener("abort", () => this.controller.abort()); - } - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_beginRequest).call(this); - this._connected(); - const stream4 = Stream.fromReadableStream(readableStream, this.controller); - for await (const event of stream4) { - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_addStreamEvent).call(this, event); - } - if (stream4.controller.signal?.aborted) { - throw new APIUserAbortError(); - } - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_endRequest).call(this); - } - [(_MessageStream_currentMessageSnapshot = /* @__PURE__ */ new WeakMap(), _MessageStream_connectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_resolveConnectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_rejectConnectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_endPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_resolveEndPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_rejectEndPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_listeners = /* @__PURE__ */ new WeakMap(), _MessageStream_ended = /* @__PURE__ */ new WeakMap(), _MessageStream_errored = /* @__PURE__ */ new WeakMap(), _MessageStream_aborted = /* @__PURE__ */ new WeakMap(), _MessageStream_catchingPromiseCreated = /* @__PURE__ */ new WeakMap(), _MessageStream_handleError = /* @__PURE__ */ new WeakMap(), _MessageStream_instances = /* @__PURE__ */ new WeakSet(), _MessageStream_getFinalMessage = function _MessageStream_getFinalMessage2() { - if (this.receivedMessages.length === 0) { - throw new AnthropicError("stream ended without producing a Message with role=assistant"); - } - return this.receivedMessages.at(-1); - }, _MessageStream_getFinalText = function _MessageStream_getFinalText2() { - if (this.receivedMessages.length === 0) { - throw new AnthropicError("stream ended without producing a Message with role=assistant"); - } - const textBlocks = this.receivedMessages.at(-1).content.filter((block) => block.type === "text").map((block) => block.text); - if (textBlocks.length === 0) { - throw new AnthropicError("stream ended without producing a content block with type=text"); - } - return textBlocks.join(" "); - }, _MessageStream_beginRequest = function _MessageStream_beginRequest2() { - if (this.ended) - return; - __classPrivateFieldSet7(this, _MessageStream_currentMessageSnapshot, void 0, "f"); - }, _MessageStream_addStreamEvent = function _MessageStream_addStreamEvent2(event) { - if (this.ended) - return; - const messageSnapshot = __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_accumulateMessage).call(this, event); - this._emit("streamEvent", event, messageSnapshot); - switch (event.type) { - case "content_block_delta": { - if (event.delta.type === "text_delta") { - this._emit("text", event.delta.text, messageSnapshot.content.at(-1).text || ""); - } - break; - } - case "message_stop": { - this._addMessageParam(messageSnapshot); - this._addMessage(messageSnapshot, true); - break; - } - case "content_block_stop": { - this._emit("contentBlock", messageSnapshot.content.at(-1)); - break; - } - case "message_start": { - __classPrivateFieldSet7(this, _MessageStream_currentMessageSnapshot, messageSnapshot, "f"); - break; - } - case "content_block_start": - case "message_delta": - break; - } - }, _MessageStream_endRequest = function _MessageStream_endRequest2() { - if (this.ended) { - throw new AnthropicError(`stream has ended, this shouldn't happen`); - } - const snapshot = __classPrivateFieldGet8(this, _MessageStream_currentMessageSnapshot, "f"); - if (!snapshot) { - throw new AnthropicError(`request ended without sending any chunks`); - } - __classPrivateFieldSet7(this, _MessageStream_currentMessageSnapshot, void 0, "f"); - return snapshot; - }, _MessageStream_accumulateMessage = function _MessageStream_accumulateMessage2(event) { - let snapshot = __classPrivateFieldGet8(this, _MessageStream_currentMessageSnapshot, "f"); - if (event.type === "message_start") { - if (snapshot) { - throw new AnthropicError(`Unexpected event order, got ${event.type} before receiving "message_stop"`); - } - return event.message; - } - if (!snapshot) { - throw new AnthropicError(`Unexpected event order, got ${event.type} before "message_start"`); - } - switch (event.type) { - case "message_stop": - return snapshot; - case "message_delta": - snapshot.stop_reason = event.delta.stop_reason; - snapshot.stop_sequence = event.delta.stop_sequence; - snapshot.usage.output_tokens = event.usage.output_tokens; - return snapshot; - case "content_block_start": - snapshot.content.push(event.content_block); - return snapshot; - case "content_block_delta": { - const snapshotContent = snapshot.content.at(event.index); - if (snapshotContent?.type === "text" && event.delta.type === "text_delta") { - snapshotContent.text += event.delta.text; - } - return snapshot; - } - case "content_block_stop": - return snapshot; - } - }, Symbol.asyncIterator)]() { - const pushQueue = []; - const readQueue = []; - let done = false; - this.on("streamEvent", (event) => { - const reader = readQueue.shift(); - if (reader) { - reader.resolve(event); - } else { - pushQueue.push(event); - } - }); - this.on("end", () => { - done = true; - for (const reader of readQueue) { - reader.resolve(void 0); - } - readQueue.length = 0; - }); - this.on("abort", (err) => { - done = true; - for (const reader of readQueue) { - reader.reject(err); - } - readQueue.length = 0; - }); - this.on("error", (err) => { - done = true; - for (const reader of readQueue) { - reader.reject(err); - } - readQueue.length = 0; - }); - return { - next: async () => { - if (!pushQueue.length) { - if (done) { - return { value: void 0, done: true }; - } - return new Promise((resolve, reject) => readQueue.push({ resolve, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true }); - } - const chunk = pushQueue.shift(); - return { value: chunk, done: false }; - }, - return: async () => { - this.abort(); - return { value: void 0, done: true }; - } - }; - } - toReadableStream() { - const stream4 = new Stream(this[Symbol.asyncIterator].bind(this), this.controller); - return stream4.toReadableStream(); - } -}; - -// node_modules/@anthropic-ai/sdk/resources/messages.mjs -var Messages = class extends APIResource { - create(body, options) { - return this._client.post("/v1/messages", { - body, - timeout: 6e5, - ...options, - stream: body.stream ?? false - }); - } - stream(body, options) { - return MessageStream.createMessage(this, body, options); - } -}; -(function(Messages2) { -})(Messages || (Messages = {})); - -// node_modules/@anthropic-ai/sdk/index.mjs -var _a3; -var Anthropic = class extends APIClient { - constructor({ baseURL = readEnv("ANTHROPIC_BASE_URL"), apiKey: apiKey4 = readEnv("ANTHROPIC_API_KEY") ?? null, authToken = readEnv("ANTHROPIC_AUTH_TOKEN") ?? null, ...opts } = {}) { - const options = { - apiKey: apiKey4, - authToken, - ...opts, - baseURL: baseURL || `https://api.anthropic.com` - }; - super({ - baseURL: options.baseURL, - timeout: options.timeout ?? 6e5, - httpAgent: options.httpAgent, - maxRetries: options.maxRetries, - fetch: options.fetch - }); - this.completions = new Completions(this); - this.messages = new Messages(this); - this._options = options; - this.apiKey = apiKey4; - this.authToken = authToken; - } - defaultQuery() { - return this._options.defaultQuery; - } - defaultHeaders(opts) { - return { - ...super.defaultHeaders(opts), - "anthropic-version": "2023-06-01", - ...this._options.defaultHeaders - }; - } - validateHeaders(headers, customHeaders) { - if (this.apiKey && headers["x-api-key"]) { - return; - } - if (customHeaders["x-api-key"] === null) { - return; - } - if (this.authToken && headers["authorization"]) { - return; - } - if (customHeaders["authorization"] === null) { - return; - } - throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted'); - } - authHeaders(opts) { - const apiKeyAuth = this.apiKeyAuth(opts); - const bearerAuth = this.bearerAuth(opts); - if (apiKeyAuth != null && !isEmptyObj(apiKeyAuth)) { - return apiKeyAuth; - } - if (bearerAuth != null && !isEmptyObj(bearerAuth)) { - return bearerAuth; - } - return {}; - } - apiKeyAuth(opts) { - if (this.apiKey == null) { - return {}; - } - return { "X-Api-Key": this.apiKey }; - } - bearerAuth(opts) { - if (this.authToken == null) { - return {}; - } - return { Authorization: `Bearer ${this.authToken}` }; - } -}; -_a3 = Anthropic; -Anthropic.Anthropic = _a3; -Anthropic.HUMAN_PROMPT = "\n\nHuman:"; -Anthropic.AI_PROMPT = "\n\nAssistant:"; -Anthropic.AnthropicError = AnthropicError; -Anthropic.APIError = APIError; -Anthropic.APIConnectionError = APIConnectionError; -Anthropic.APIConnectionTimeoutError = APIConnectionTimeoutError; -Anthropic.APIUserAbortError = APIUserAbortError; -Anthropic.NotFoundError = NotFoundError; -Anthropic.ConflictError = ConflictError; -Anthropic.RateLimitError = RateLimitError; -Anthropic.BadRequestError = BadRequestError; -Anthropic.AuthenticationError = AuthenticationError; -Anthropic.InternalServerError = InternalServerError; -Anthropic.PermissionDeniedError = PermissionDeniedError; -Anthropic.UnprocessableEntityError = UnprocessableEntityError; -var { HUMAN_PROMPT, AI_PROMPT } = Anthropic; -var { AnthropicError: AnthropicError2, APIError: APIError2, APIConnectionError: APIConnectionError2, APIConnectionTimeoutError: APIConnectionTimeoutError2, APIUserAbortError: APIUserAbortError2, NotFoundError: NotFoundError2, ConflictError: ConflictError2, RateLimitError: RateLimitError2, BadRequestError: BadRequestError2, AuthenticationError: AuthenticationError2, InternalServerError: InternalServerError2, PermissionDeniedError: PermissionDeniedError2, UnprocessableEntityError: UnprocessableEntityError2 } = error_exports; -(function(Anthropic2) { - Anthropic2.toFile = toFile; - Anthropic2.fileFromPath = fileFromPath; - Anthropic2.Completions = Completions; - Anthropic2.Messages = Messages; -})(Anthropic || (Anthropic = {})); -var sdk_default = Anthropic; - -// src/engine/anthropic.ts -var config6 = getConfig(); -var MAX_TOKENS_OUTPUT3 = config6?.OCO_TOKENS_MAX_OUTPUT || 500 /* DEFAULT_MAX_TOKENS_OUTPUT */; -var MAX_TOKENS_INPUT3 = config6?.OCO_TOKENS_MAX_INPUT || 4096 /* DEFAULT_MAX_TOKENS_INPUT */; -var provider3 = config6?.OCO_AI_PROVIDER; -var apiKey3 = config6?.OCO_ANTHROPIC_API_KEY; -var [command3, mode3] = process.argv.slice(2); -if (provider3 === "anthropic" && !apiKey3 && command3 !== "config" && mode3 !== "set" /* set */) { - ae("opencommit"); - ce( - "OCO_ANTHROPIC_API_KEY is not set, please run `oco config set OCO_ANTHROPIC_API_KEY= . If you are using Claude, make sure you add payment details, so API works.`" - ); - ce( - "For help look into README https://github.com/di-sukharev/opencommit#setup" - ); - process.exit(1); -} -var MODEL3 = config6?.OCO_MODEL; -if (provider3 === "anthropic" && !MODEL_LIST.anthropic.includes(MODEL3) && command3 !== "config" && mode3 !== "set" /* set */) { - ce( - `${source_default.red("\u2716")} Unsupported model ${MODEL3} for Anthropic. Supported models are: ${MODEL_LIST.anthropic.join( - ", " - )}` - ); - process.exit(1); -} -var AnthropicAi = class { - anthropicAiApiConfiguration = { - apiKey: apiKey3 - }; - anthropicAI; - constructor() { - this.anthropicAI = new sdk_default(this.anthropicAiApiConfiguration); - } - generateCommitMessage = async (messages) => { - const systemMessage = messages.find((msg) => msg.role === "system")?.content; - const restMessages = messages.filter((msg) => msg.role !== "system"); - const params = { - model: MODEL3, - system: systemMessage, - messages: restMessages, - temperature: 0, - top_p: 0.1, - max_tokens: MAX_TOKENS_OUTPUT3 - }; - try { - const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a4, b7) => a4 + b7, 0); - if (REQUEST_TOKENS > MAX_TOKENS_INPUT3 - MAX_TOKENS_OUTPUT3) { - throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); - } - const data = await this.anthropicAI.messages.create(params); - const message = data?.content[0].text; - return message; - } catch (error) { - ce(`${source_default.red("\u2716")} ${JSON.stringify(params)}`); - const err = error; - ce(`${source_default.red("\u2716")} ${err?.message || err}`); - if (axios_default.isAxiosError(error) && error.response?.status === 401) { - const anthropicAiError = error.response.data.error; - if (anthropicAiError?.message) - ce(anthropicAiError.message); - ce( - "For help look into README https://github.com/di-sukharev/opencommit#setup" - ); - } - throw err; - } - }; -}; -var anthropicAi = new AnthropicAi(); - -// src/engine/testAi.ts -var TestAi = class { - async generateCommitMessage(messages) { - return "test commit message"; - } -}; -var testAi = new TestAi(); - // src/utils/engine.ts function getEngine() { const config11 = getConfig(); const provider4 = config11?.OCO_AI_PROVIDER; if (provider4?.startsWith("ollama")) { + const ollamaAi = new OllamaAi(); const model = provider4.split("/")[1]; if (model) ollamaAi.setModel(model); return ollamaAi; - } else if (config11?.OCO_AI_PROVIDER == "anthropic") { - return anthropicAi; - } else if (config11?.OCO_AI_PROVIDER == "test") { - return testAi; - } else if (config11?.OCO_AI_PROVIDER == "azure") { - return azure; + } else if (provider4 == "anthropic") { + return new AnthropicAi(); + } else if (provider4 == "test") { + return new TestAi(); + } else if (provider4 == "gemini") { + return new Gemini(); + } else if (provider4 == "azure") { + return new Azure(); } - return api; + return new OpenAi(); } // src/modules/commitlint/config.ts @@ -40116,7 +41043,16 @@ var configureCommitlintIntegration = async (force = false) => { const spin = le(); spin.start("Loading @commitlint configuration"); const fileExists = await commitlintLLMConfigExists(); - let commitLintConfig = await getCommitLintPWDConfig(); + const commitLintConfig = await getCommitLintPWDConfig(); + if (commitLintConfig === null) { + throw new Error( + `Failed to load @commitlint config. Please check the following: + * @commitlint >= 9.0.0 is installed in the local directory. + * 'node_modules/@commitlint/load' package exists. + * A valid @commitlint configuration exists. + ` + ); + } const hash = await computeHash(JSON.stringify(commitLintConfig)); spin.stop(`Read @commitlint configuration (hash: ${hash})`); if (fileExists) { @@ -40132,16 +41068,16 @@ var configureCommitlintIntegration = async (force = false) => { const prompts = inferPromptsFromCommitlintConfig(commitLintConfig); const consistencyPrompts = commitlintPrompts.GEN_COMMITLINT_CONSISTENCY_PROMPT(prompts); const engine = getEngine(); - let consistency2 = await engine.generateCommitMessage(consistencyPrompts) || "{}"; - prompts.forEach((prompt) => consistency2 = consistency2.replace(prompt, "")); - consistency2 = getJSONBlock(consistency2); - consistency2 = removeDoubleNewlines(consistency2); + let consistency = await engine.generateCommitMessage(consistencyPrompts) || "{}"; + prompts.forEach((prompt) => consistency = consistency.replace(prompt, "")); + consistency = getJSONBlock(consistency); + consistency = removeDoubleNewlines(consistency); const commitlintLLMConfig = { hash, prompts, consistency: { [translation2.localLanguage]: { - ...JSON.parse(consistency2) + ...JSON.parse(consistency) } } }; @@ -40694,7 +41630,7 @@ var commitlintConfigCommand = G3( // src/commands/githook.ts var import_fs4 = require("fs"); -var import_promises2 = __toESM(require("fs/promises"), 1); +var import_promises3 = __toESM(require("fs/promises"), 1); var import_path4 = __toESM(require("path"), 1); var HOOK_NAME = "prepare-commit-msg"; var DEFAULT_SYMLINK_URL = import_path4.default.join(".git", "hooks", HOOK_NAME); @@ -40730,7 +41666,7 @@ var hookCommand = G3( if (await isHookExists()) { let realPath; try { - realPath = await import_promises2.default.realpath(SYMLINK_URL); + realPath = await import_promises3.default.realpath(SYMLINK_URL); } catch (error) { ce(error); realPath = null; @@ -40741,9 +41677,9 @@ var hookCommand = G3( `Different ${HOOK_NAME} is already set. Remove it before setting opencommit as '${HOOK_NAME}' hook.` ); } - await import_promises2.default.mkdir(import_path4.default.dirname(SYMLINK_URL), { recursive: true }); - await import_promises2.default.symlink(HOOK_URL, SYMLINK_URL, "file"); - await import_promises2.default.chmod(SYMLINK_URL, 493); + await import_promises3.default.mkdir(import_path4.default.dirname(SYMLINK_URL), { recursive: true }); + await import_promises3.default.symlink(HOOK_URL, SYMLINK_URL, "file"); + await import_promises3.default.chmod(SYMLINK_URL, 493); return ce(`${source_default.green("\u2714")} Hook set`); } if (mode4 === "unset") { @@ -40755,13 +41691,13 @@ var hookCommand = G3( `OpenCommit wasn't previously set as '${HOOK_NAME}' hook, nothing to remove` ); } - const realpath = await import_promises2.default.realpath(SYMLINK_URL); + const realpath = await import_promises3.default.realpath(SYMLINK_URL); if (realpath !== HOOK_URL) { return ce( `OpenCommit wasn't previously set as '${HOOK_NAME}' hook, but different hook was, if you want to remove it \u2014 do it manually` ); } - await import_promises2.default.rm(SYMLINK_URL); + await import_promises3.default.rm(SYMLINK_URL); return ce(`${source_default.green("\u2714")} Hook is removed`); } throw new Error( @@ -40775,7 +41711,7 @@ var hookCommand = G3( ); // src/commands/prepare-commit-msg-hook.ts -var import_promises3 = __toESM(require("fs/promises"), 1); +var import_promises4 = __toESM(require("fs/promises"), 1); var [messageFilePath, commitSource] = process.argv.slice(2); var prepareCommitMessageHook = async (isStageAllFlag = false) => { try { @@ -40811,8 +41747,8 @@ var prepareCommitMessageHook = async (isStageAllFlag = false) => { await getDiff({ files: staged }) ); spin.stop("Done"); - const fileContent = await import_promises3.default.readFile(messageFilePath); - await import_promises3.default.writeFile( + const fileContent = await import_promises4.default.readFile(messageFilePath); + await import_promises4.default.writeFile( messageFilePath, commitMessage + "\n" + fileContent.toString() ); @@ -40900,6 +41836,22 @@ Z2( */ /*! Based on fetch-blob. MIT License. Jimmy Wärting & David Frank */ /*! node-domexception. MIT License. Jimmy Wärting */ +/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @license * web-streams-polyfill v3.3.3 diff --git a/out/github-action.cjs b/out/github-action.cjs index e310be2..3698726 100644 --- a/out/github-action.cjs +++ b/out/github-action.cjs @@ -672,7 +672,7 @@ var require_file_command = __commonJS({ }; Object.defineProperty(exports, "__esModule", { value: true }); exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; - var fs3 = __importStar2(require("fs")); + var fs4 = __importStar2(require("fs")); var os3 = __importStar2(require("os")); var uuid_1 = require_dist(); var utils_1 = require_utils(); @@ -681,10 +681,10 @@ var require_file_command = __commonJS({ if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command4}`); } - if (!fs3.existsSync(filePath)) { + if (!fs4.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs3.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os3.EOL}`, { + fs4.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os3.EOL}`, { encoding: "utf8" }); } @@ -12076,7 +12076,7 @@ var require_headers = __commonJS({ return headers; } }; - var Headers3 = class { + var Headers4 = class { constructor(init = void 0) { if (init === kConstruct) { return; @@ -12089,14 +12089,14 @@ var require_headers = __commonJS({ } } append(name, value) { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); webidl.argumentLengthCheck(arguments, 2, { header: "Headers.append" }); name = webidl.converters.ByteString(name); value = webidl.converters.ByteString(value); return appendHeader(this, name, value); } delete(name) { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); webidl.argumentLengthCheck(arguments, 1, { header: "Headers.delete" }); name = webidl.converters.ByteString(name); if (!isValidHeaderName2(name)) { @@ -12116,7 +12116,7 @@ var require_headers = __commonJS({ this[kHeadersList].delete(name); } get(name) { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); webidl.argumentLengthCheck(arguments, 1, { header: "Headers.get" }); name = webidl.converters.ByteString(name); if (!isValidHeaderName2(name)) { @@ -12129,7 +12129,7 @@ var require_headers = __commonJS({ return this[kHeadersList].get(name); } has(name) { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); webidl.argumentLengthCheck(arguments, 1, { header: "Headers.has" }); name = webidl.converters.ByteString(name); if (!isValidHeaderName2(name)) { @@ -12142,7 +12142,7 @@ var require_headers = __commonJS({ return this[kHeadersList].contains(name); } set(name, value) { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); webidl.argumentLengthCheck(arguments, 2, { header: "Headers.set" }); name = webidl.converters.ByteString(name); value = webidl.converters.ByteString(value); @@ -12167,7 +12167,7 @@ var require_headers = __commonJS({ this[kHeadersList].set(name, value); } getSetCookie() { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); const list = this[kHeadersList].cookies; if (list) { return [...list]; @@ -12196,7 +12196,7 @@ var require_headers = __commonJS({ return headers; } keys() { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); if (this[kGuard] === "immutable") { const value = this[kHeadersSortedMap]; return makeIterator( @@ -12212,7 +12212,7 @@ var require_headers = __commonJS({ ); } values() { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); if (this[kGuard] === "immutable") { const value = this[kHeadersSortedMap]; return makeIterator( @@ -12228,7 +12228,7 @@ var require_headers = __commonJS({ ); } entries() { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); if (this[kGuard] === "immutable") { const value = this[kHeadersSortedMap]; return makeIterator( @@ -12244,7 +12244,7 @@ var require_headers = __commonJS({ ); } forEach(callbackFn, thisArg = globalThis) { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); webidl.argumentLengthCheck(arguments, 1, { header: "Headers.forEach" }); if (typeof callbackFn !== "function") { throw new TypeError( @@ -12256,12 +12256,12 @@ var require_headers = __commonJS({ } } [Symbol.for("nodejs.util.inspect.custom")]() { - webidl.brandCheck(this, Headers3); + webidl.brandCheck(this, Headers4); return this[kHeadersList]; } }; - Headers3.prototype[Symbol.iterator] = Headers3.prototype.entries; - Object.defineProperties(Headers3.prototype, { + Headers4.prototype[Symbol.iterator] = Headers4.prototype.entries; + Object.defineProperties(Headers4.prototype, { append: kEnumerableProperty, delete: kEnumerableProperty, get: kEnumerableProperty, @@ -12293,7 +12293,7 @@ var require_headers = __commonJS({ }; module2.exports = { fill, - Headers: Headers3, + Headers: Headers4, HeadersList }; } @@ -12303,7 +12303,7 @@ var require_headers = __commonJS({ var require_response = __commonJS({ "node_modules/undici/lib/fetch/response.js"(exports, module2) { "use strict"; - var { Headers: Headers3, HeadersList, fill } = require_headers(); + var { Headers: Headers4, HeadersList, fill } = require_headers(); var { extractBody, cloneBody, mixinBody } = require_body(); var util3 = require_util(); var { kEnumerableProperty } = util3; @@ -12391,7 +12391,7 @@ var require_response = __commonJS({ init = webidl.converters.ResponseInit(init); this[kRealm] = { settingsObject: {} }; this[kState] = makeResponse({}); - this[kHeaders] = new Headers3(kConstruct); + this[kHeaders] = new Headers4(kConstruct); this[kHeaders][kGuard] = "response"; this[kHeaders][kHeadersList] = this[kState].headersList; this[kHeaders][kRealm] = this[kRealm]; @@ -12671,7 +12671,7 @@ var require_request2 = __commonJS({ "node_modules/undici/lib/fetch/request.js"(exports, module2) { "use strict"; var { extractBody, mixinBody, cloneBody } = require_body(); - var { Headers: Headers3, fill: fillHeaders, HeadersList } = require_headers(); + var { Headers: Headers4, fill: fillHeaders, HeadersList } = require_headers(); var { FinalizationRegistry: FinalizationRegistry2 } = require_dispatcher_weakref()(); var util3 = require_util(); var { @@ -12737,7 +12737,7 @@ var require_request2 = __commonJS({ "Request cannot be constructed from a URL that includes credentials: " + input ); } - request3 = makeRequest({ urlList: [parsedURL] }); + request3 = makeRequest2({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { assert(input instanceof Request3); @@ -12755,7 +12755,7 @@ var require_request2 = __commonJS({ if ("window" in init) { window2 = "no-window"; } - request3 = makeRequest({ + request3 = makeRequest2({ method: request3.method, headersList: request3.headersList, unsafeRequest: request3.unsafeRequest, @@ -12891,7 +12891,7 @@ var require_request2 = __commonJS({ requestFinalizer.register(ac, { signal, abort }); } } - this[kHeaders] = new Headers3(kConstruct); + this[kHeaders] = new Headers4(kConstruct); this[kHeaders][kHeadersList] = request3.headersList; this[kHeaders][kGuard] = "request"; this[kHeaders][kRealm] = this[kRealm]; @@ -13049,7 +13049,7 @@ var require_request2 = __commonJS({ const clonedRequestObject = new Request3(kConstruct); clonedRequestObject[kState] = clonedRequest; clonedRequestObject[kRealm] = this[kRealm]; - clonedRequestObject[kHeaders] = new Headers3(kConstruct); + clonedRequestObject[kHeaders] = new Headers4(kConstruct); clonedRequestObject[kHeaders][kHeadersList] = clonedRequest.headersList; clonedRequestObject[kHeaders][kGuard] = this[kHeaders][kGuard]; clonedRequestObject[kHeaders][kRealm] = this[kHeaders][kRealm]; @@ -13069,7 +13069,7 @@ var require_request2 = __commonJS({ } }; mixinBody(Request3); - function makeRequest(init) { + function makeRequest2(init) { const request3 = { method: "GET", localURLsOnly: false, @@ -13113,7 +13113,7 @@ var require_request2 = __commonJS({ return request3; } function cloneRequest(request3) { - const newRequest = makeRequest({ ...request3, body: null }); + const newRequest = makeRequest2({ ...request3, body: null }); if (request3.body != null) { newRequest.body = cloneBody(request3.body); } @@ -13231,7 +13231,7 @@ var require_request2 = __commonJS({ allowedValues: requestDuplex } ]); - module2.exports = { Request: Request3, makeRequest }; + module2.exports = { Request: Request3, makeRequest: makeRequest2 }; } }); @@ -13246,8 +13246,8 @@ var require_fetch = __commonJS({ filterResponse, makeResponse } = require_response(); - var { Headers: Headers3 } = require_headers(); - var { Request: Request3, makeRequest } = require_request2(); + var { Headers: Headers4 } = require_headers(); + var { Request: Request3, makeRequest: makeRequest2 } = require_request2(); var zlib3 = require("zlib"); var { bytesMatch, @@ -13332,7 +13332,7 @@ var require_fetch = __commonJS({ this.emit("terminated", error); } }; - function fetch2(input, init = {}) { + function fetch3(input, init = {}) { webidl.argumentLengthCheck(arguments, 1, { header: "globalThis.fetch" }); const p3 = createDeferredPromise(); let requestObject; @@ -13845,7 +13845,7 @@ var require_fetch = __commonJS({ httpFetchParams = fetchParams; httpRequest = request3; } else { - httpRequest = makeRequest(request3); + httpRequest = makeRequest2(request3); httpFetchParams = { ...fetchParams }; httpFetchParams.request = httpRequest; } @@ -14145,7 +14145,7 @@ var require_fetch = __commonJS({ } let codings = []; let location = ""; - const headers = new Headers3(); + const headers = new Headers4(); if (Array.isArray(headersList)) { for (let n2 = 0; n2 < headersList.length; n2 += 2) { const key = headersList[n2 + 0].toString("latin1"); @@ -14226,7 +14226,7 @@ var require_fetch = __commonJS({ if (status !== 101) { return; } - const headers = new Headers3(); + const headers = new Headers4(); for (let n2 = 0; n2 < headersList.length; n2 += 2) { const key = headersList[n2 + 0].toString("latin1"); const val = headersList[n2 + 1].toString("latin1"); @@ -14245,7 +14245,7 @@ var require_fetch = __commonJS({ } } module2.exports = { - fetch: fetch2, + fetch: fetch3, Fetch, fetching, finalizeAndReportTiming @@ -15980,10 +15980,10 @@ var require_cookies = __commonJS({ var { parseSetCookie } = require_parse2(); var { stringify, getHeadersList } = require_util6(); var { webidl } = require_webidl(); - var { Headers: Headers3 } = require_headers(); + var { Headers: Headers4 } = require_headers(); function getCookies(headers) { webidl.argumentLengthCheck(arguments, 1, { header: "getCookies" }); - webidl.brandCheck(headers, Headers3, { strict: false }); + webidl.brandCheck(headers, Headers4, { strict: false }); const cookie = headers.get("cookie"); const out = {}; if (!cookie) { @@ -15997,7 +15997,7 @@ var require_cookies = __commonJS({ } function deleteCookie(headers, name, attributes) { webidl.argumentLengthCheck(arguments, 2, { header: "deleteCookie" }); - webidl.brandCheck(headers, Headers3, { strict: false }); + webidl.brandCheck(headers, Headers4, { strict: false }); name = webidl.converters.DOMString(name); attributes = webidl.converters.DeleteCookieAttributes(attributes); setCookie(headers, { @@ -16009,7 +16009,7 @@ var require_cookies = __commonJS({ } function getSetCookies(headers) { webidl.argumentLengthCheck(arguments, 1, { header: "getSetCookies" }); - webidl.brandCheck(headers, Headers3, { strict: false }); + webidl.brandCheck(headers, Headers4, { strict: false }); const cookies = getHeadersList(headers).cookies; if (!cookies) { return []; @@ -16018,7 +16018,7 @@ var require_cookies = __commonJS({ } function setCookie(headers, cookie) { webidl.argumentLengthCheck(arguments, 2, { header: "setCookie" }); - webidl.brandCheck(headers, Headers3, { strict: false }); + webidl.brandCheck(headers, Headers4, { strict: false }); cookie = webidl.converters.Cookie(cookie); const str = stringify(cookie); if (str) { @@ -16504,9 +16504,9 @@ var require_connection = __commonJS({ } = require_symbols5(); var { fireEvent, failWebsocketConnection } = require_util7(); var { CloseEvent } = require_events(); - var { makeRequest } = require_request2(); + var { makeRequest: makeRequest2 } = require_request2(); var { fetching } = require_fetch(); - var { Headers: Headers3 } = require_headers(); + var { Headers: Headers4 } = require_headers(); var { getGlobalDispatcher } = require_global2(); var { kHeadersList } = require_symbols(); var channels = {}; @@ -16521,7 +16521,7 @@ var require_connection = __commonJS({ function establishWebSocketConnection(url2, protocols, ws, onEstablish, options) { const requestURL = url2; requestURL.protocol = url2.protocol === "ws:" ? "http:" : "https:"; - const request3 = makeRequest({ + const request3 = makeRequest2({ urlList: [requestURL], serviceWorkers: "none", referrer: "no-referrer", @@ -16531,7 +16531,7 @@ var require_connection = __commonJS({ redirect: "error" }); if (options.headers) { - const headersList = new Headers3(options.headers)[kHeadersList]; + const headersList = new Headers4(options.headers)[kHeadersList]; request3.headersList = headersList; } const keyValue = crypto2.randomBytes(16).toString("base64"); @@ -17315,7 +17315,7 @@ var require_undici = __commonJS({ var Agent3 = require_agent(); var util3 = require_util(); var { InvalidArgumentError } = errors; - var api2 = require_api(); + var api = require_api(); var buildConnector = require_connect(); var MockClient = require_mock_client(); var MockAgent = require_mock_agent(); @@ -17334,7 +17334,7 @@ var require_undici = __commonJS({ } catch { hasCrypto = false; } - Object.assign(Dispatcher.prototype, api2); + Object.assign(Dispatcher.prototype, api); module2.exports.Dispatcher = Dispatcher; module2.exports.Client = Client; module2.exports.Pool = Pool; @@ -17390,7 +17390,7 @@ var require_undici = __commonJS({ module2.exports.getGlobalDispatcher = getGlobalDispatcher; if (util3.nodeMajor > 16 || util3.nodeMajor === 16 && util3.nodeMinor >= 8) { let fetchImpl = null; - module2.exports.fetch = async function fetch2(resource) { + module2.exports.fetch = async function fetch3(resource) { if (!fetchImpl) { fetchImpl = require_fetch().fetch; } @@ -17430,11 +17430,11 @@ var require_undici = __commonJS({ const { WebSocket } = require_websocket(); module2.exports.WebSocket = WebSocket; } - module2.exports.request = makeDispatcher(api2.request); - module2.exports.stream = makeDispatcher(api2.stream); - module2.exports.pipeline = makeDispatcher(api2.pipeline); - module2.exports.connect = makeDispatcher(api2.connect); - module2.exports.upgrade = makeDispatcher(api2.upgrade); + module2.exports.request = makeDispatcher(api.request); + module2.exports.stream = makeDispatcher(api.stream); + module2.exports.pipeline = makeDispatcher(api.pipeline); + module2.exports.connect = makeDispatcher(api.connect); + module2.exports.upgrade = makeDispatcher(api.upgrade); module2.exports.MockClient = MockClient; module2.exports.MockPool = MockPool; module2.exports.MockAgent = MockAgent; @@ -17542,11 +17542,11 @@ var require_lib = __commonJS({ HttpCodes2[HttpCodes2["ServiceUnavailable"] = 503] = "ServiceUnavailable"; HttpCodes2[HttpCodes2["GatewayTimeout"] = 504] = "GatewayTimeout"; })(HttpCodes || (exports.HttpCodes = HttpCodes = {})); - var Headers3; - (function(Headers4) { - Headers4["Accept"] = "accept"; - Headers4["ContentType"] = "content-type"; - })(Headers3 || (exports.Headers = Headers3 = {})); + var Headers4; + (function(Headers5) { + Headers5["Accept"] = "accept"; + Headers5["ContentType"] = "content-type"; + })(Headers4 || (exports.Headers = Headers4 = {})); var MediaTypes; (function(MediaTypes2) { MediaTypes2["ApplicationJson"] = "application/json"; @@ -17697,7 +17697,7 @@ var require_lib = __commonJS({ } getJson(requestUrl, additionalHeaders = {}) { return __awaiter2(this, void 0, void 0, function* () { - additionalHeaders[Headers3.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers3.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers4.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers4.Accept, MediaTypes.ApplicationJson); const res = yield this.get(requestUrl, additionalHeaders); return this._processResponse(res, this.requestOptions); }); @@ -17705,8 +17705,8 @@ var require_lib = __commonJS({ postJson(requestUrl, obj, additionalHeaders = {}) { return __awaiter2(this, void 0, void 0, function* () { const data = JSON.stringify(obj, null, 2); - additionalHeaders[Headers3.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers3.Accept, MediaTypes.ApplicationJson); - additionalHeaders[Headers3.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers3.ContentType, MediaTypes.ApplicationJson); + additionalHeaders[Headers4.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers4.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers4.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers4.ContentType, MediaTypes.ApplicationJson); const res = yield this.post(requestUrl, data, additionalHeaders); return this._processResponse(res, this.requestOptions); }); @@ -17714,8 +17714,8 @@ var require_lib = __commonJS({ putJson(requestUrl, obj, additionalHeaders = {}) { return __awaiter2(this, void 0, void 0, function* () { const data = JSON.stringify(obj, null, 2); - additionalHeaders[Headers3.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers3.Accept, MediaTypes.ApplicationJson); - additionalHeaders[Headers3.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers3.ContentType, MediaTypes.ApplicationJson); + additionalHeaders[Headers4.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers4.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers4.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers4.ContentType, MediaTypes.ApplicationJson); const res = yield this.put(requestUrl, data, additionalHeaders); return this._processResponse(res, this.requestOptions); }); @@ -17723,8 +17723,8 @@ var require_lib = __commonJS({ patchJson(requestUrl, obj, additionalHeaders = {}) { return __awaiter2(this, void 0, void 0, function* () { const data = JSON.stringify(obj, null, 2); - additionalHeaders[Headers3.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers3.Accept, MediaTypes.ApplicationJson); - additionalHeaders[Headers3.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers3.ContentType, MediaTypes.ApplicationJson); + additionalHeaders[Headers4.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers4.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers4.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers4.ContentType, MediaTypes.ApplicationJson); const res = yield this.patch(requestUrl, data, additionalHeaders); return this._processResponse(res, this.requestOptions); }); @@ -18739,12 +18739,12 @@ var require_io_util = __commonJS({ var _a4; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; - var fs3 = __importStar2(require("fs")); + var fs4 = __importStar2(require("fs")); var path2 = __importStar2(require("path")); - _a4 = fs3.promises, exports.chmod = _a4.chmod, exports.copyFile = _a4.copyFile, exports.lstat = _a4.lstat, exports.mkdir = _a4.mkdir, exports.open = _a4.open, exports.readdir = _a4.readdir, exports.readlink = _a4.readlink, exports.rename = _a4.rename, exports.rm = _a4.rm, exports.rmdir = _a4.rmdir, exports.stat = _a4.stat, exports.symlink = _a4.symlink, exports.unlink = _a4.unlink; + _a4 = fs4.promises, exports.chmod = _a4.chmod, exports.copyFile = _a4.copyFile, exports.lstat = _a4.lstat, exports.mkdir = _a4.mkdir, exports.open = _a4.open, exports.readdir = _a4.readdir, exports.readlink = _a4.readlink, exports.rename = _a4.rename, exports.rm = _a4.rm, exports.rmdir = _a4.rmdir, exports.stat = _a4.stat, exports.symlink = _a4.symlink, exports.unlink = _a4.unlink; exports.IS_WINDOWS = process.platform === "win32"; exports.UV_FS_O_EXLOCK = 268435456; - exports.READONLY = fs3.constants.O_RDONLY; + exports.READONLY = fs4.constants.O_RDONLY; function exists(fsPath) { return __awaiter2(this, void 0, void 0, function* () { try { @@ -22513,11 +22513,11 @@ var require_lib3 = __commonJS({ return void 0; } var MAP = Symbol("map"); - var Headers3 = class { + var Headers4 = class { constructor() { let init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0; this[MAP] = /* @__PURE__ */ Object.create(null); - if (init instanceof Headers3) { + if (init instanceof Headers4) { const rawHeaders = init.raw(); const headerNames = Object.keys(rawHeaders); for (const headerName of headerNames) { @@ -22569,13 +22569,13 @@ var require_lib3 = __commonJS({ } forEach(callback) { let thisArg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0; - let pairs = getHeaders(this); + let pairs = getHeaders2(this); let i3 = 0; while (i3 < pairs.length) { var _pairs$i = pairs[i3]; const name = _pairs$i[0], value = _pairs$i[1]; callback.call(thisArg, value, name, this); - pairs = getHeaders(this); + pairs = getHeaders2(this); i3++; } } @@ -22625,14 +22625,14 @@ var require_lib3 = __commonJS({ return createHeadersIterator(this, "key+value"); } }; - Headers3.prototype.entries = Headers3.prototype[Symbol.iterator]; - Object.defineProperty(Headers3.prototype, Symbol.toStringTag, { + Headers4.prototype.entries = Headers4.prototype[Symbol.iterator]; + Object.defineProperty(Headers4.prototype, Symbol.toStringTag, { value: "Headers", writable: false, enumerable: false, configurable: true }); - Object.defineProperties(Headers3.prototype, { + Object.defineProperties(Headers4.prototype, { get: { enumerable: true }, forEach: { enumerable: true }, set: { enumerable: true }, @@ -22643,7 +22643,7 @@ var require_lib3 = __commonJS({ values: { enumerable: true }, entries: { enumerable: true } }); - function getHeaders(headers) { + function getHeaders2(headers) { let kind2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "key+value"; const keys = Object.keys(headers[MAP]).sort(); return keys.map(kind2 === "key" ? function(k4) { @@ -22671,7 +22671,7 @@ var require_lib3 = __commonJS({ } var _INTERNAL = this[INTERNAL]; const target = _INTERNAL.target, kind2 = _INTERNAL.kind, index = _INTERNAL.index; - const values = getHeaders(target, kind2); + const values = getHeaders2(target, kind2); const len = values.length; if (index >= len) { return { @@ -22701,7 +22701,7 @@ var require_lib3 = __commonJS({ return obj; } function createHeadersLenient(obj) { - const headers = new Headers3(); + const headers = new Headers4(); for (const name of Object.keys(obj)) { if (invalidTokenRegex.test(name)) { continue; @@ -22731,7 +22731,7 @@ var require_lib3 = __commonJS({ let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; Body.call(this, body, opts); const status = opts.status || 200; - const headers = new Headers3(opts.headers); + const headers = new Headers4(opts.headers); if (body != null && !headers.has("Content-Type")) { const contentType = extractContentType(body); if (contentType) { @@ -22833,7 +22833,7 @@ var require_lib3 = __commonJS({ timeout: init.timeout || input.timeout || 0, size: init.size || input.size || 0 }); - const headers = new Headers3(init.headers || input.headers || {}); + const headers = new Headers4(init.headers || input.headers || {}); if (inputBody != null && !headers.has("Content-Type")) { const contentType = extractContentType(inputBody); if (contentType) { @@ -22894,7 +22894,7 @@ var require_lib3 = __commonJS({ }); function getNodeRequestOptions(request3) { const parsedURL = request3[INTERNALS$2].parsedURL; - const headers = new Headers3(request3[INTERNALS$2].headers); + const headers = new Headers4(request3[INTERNALS$2].headers); if (!headers.has("Accept")) { headers.set("Accept", "*/*"); } @@ -22957,12 +22957,12 @@ var require_lib3 = __commonJS({ const dest = new URL$1(destination).protocol; return orig === dest; }; - function fetch2(url2, opts) { - if (!fetch2.Promise) { + function fetch3(url2, opts) { + if (!fetch3.Promise) { throw new Error("native promise missing, set fetch.Promise to your favorite alternative"); } - Body.Promise = fetch2.Promise; - return new fetch2.Promise(function(resolve, reject) { + Body.Promise = fetch3.Promise; + return new fetch3.Promise(function(resolve, reject) { const request3 = new Request3(url2, opts); const options = getNodeRequestOptions(request3); const send = (options.protocol === "https:" ? https3 : http3).request; @@ -23035,7 +23035,7 @@ var require_lib3 = __commonJS({ req.on("response", function(res) { clearTimeout(reqTimeout); const headers = createHeadersLenient(res.headers); - if (fetch2.isRedirect(res.statusCode)) { + if (fetch3.isRedirect(res.statusCode)) { const location = headers.get("Location"); let locationURL = null; try { @@ -23071,7 +23071,7 @@ var require_lib3 = __commonJS({ return; } const requestOpts = { - headers: new Headers3(request3.headers), + headers: new Headers4(request3.headers), follow: request3.follow, counter: request3.counter + 1, agent: request3.agent, @@ -23097,7 +23097,7 @@ var require_lib3 = __commonJS({ requestOpts.body = void 0; requestOpts.headers.delete("content-length"); } - resolve(fetch2(new Request3(locationURL, requestOpts))); + resolve(fetch3(new Request3(locationURL, requestOpts))); finalize(); return; } @@ -23190,14 +23190,14 @@ var require_lib3 = __commonJS({ stream4.end(); } } - fetch2.isRedirect = function(code) { + fetch3.isRedirect = function(code) { return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; }; - fetch2.Promise = global.Promise; - module2.exports = exports = fetch2; + fetch3.Promise = global.Promise; + module2.exports = exports = fetch3; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports; - exports.Headers = Headers3; + exports.Headers = Headers4; exports.Request = Request3; exports.Response = Response3; exports.FetchError = FetchError; @@ -23378,8 +23378,8 @@ var require_dist_node5 = __commonJS({ let headers = {}; let status; let url2; - const fetch2 = requestOptions.request && requestOptions.request.fetch || nodeFetch; - return fetch2(requestOptions.url, Object.assign( + const fetch3 = requestOptions.request && requestOptions.request.fetch || nodeFetch; + return fetch3(requestOptions.url, Object.assign( { method: requestOptions.method, body: requestOptions.body, @@ -24842,16 +24842,16 @@ var require_dist_node9 = __commonJS({ return Object.assign(withDecorations, requestWithDefaults); } function restEndpointMethods(octokit2) { - const api2 = endpointsToMethods(octokit2, Endpoints); + const api = endpointsToMethods(octokit2, Endpoints); return { - rest: api2 + rest: api }; } restEndpointMethods.VERSION = VERSION4; function legacyRestEndpointMethods(octokit2) { - const api2 = endpointsToMethods(octokit2, Endpoints); - return _objectSpread2(_objectSpread2({}, api2), {}, { - rest: api2 + const api = endpointsToMethods(octokit2, Endpoints); + return _objectSpread2(_objectSpread2({}, api), {}, { + rest: api }); } legacyRestEndpointMethods.VERSION = VERSION4; @@ -38442,7 +38442,7 @@ var require_form_data = __commonJS({ var http3 = require("http"); var https3 = require("https"); var parseUrl = require("url").parse; - var fs3 = require("fs"); + var fs4 = require("fs"); var Stream2 = require("stream").Stream; var mime = require_mime_types(); var asynckit = require_asynckit(); @@ -38507,7 +38507,7 @@ var require_form_data = __commonJS({ if (value.end != void 0 && value.end != Infinity && value.start != void 0) { callback(null, value.end + 1 - (value.start ? value.start : 0)); } else { - fs3.stat(value.path, function(err, stat) { + fs4.stat(value.path, function(err, stat) { var fileSize; if (err) { callback(err); @@ -38883,7 +38883,7 @@ var require_package2 = __commonJS({ // node_modules/dotenv/lib/main.js var require_main2 = __commonJS({ "node_modules/dotenv/lib/main.js"(exports, module2) { - var fs3 = require("fs"); + var fs4 = require("fs"); var path2 = require("path"); var os3 = require("os"); var crypto2 = require("crypto"); @@ -38990,7 +38990,7 @@ var require_main2 = __commonJS({ if (options && options.path && options.path.length > 0) { if (Array.isArray(options.path)) { for (const filepath of options.path) { - if (fs3.existsSync(filepath)) { + if (fs4.existsSync(filepath)) { possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`; } } @@ -39000,7 +39000,7 @@ var require_main2 = __commonJS({ } else { possibleVaultPath = path2.resolve(process.cwd(), ".env.vault"); } - if (fs3.existsSync(possibleVaultPath)) { + if (fs4.existsSync(possibleVaultPath)) { return possibleVaultPath; } return null; @@ -39044,7 +39044,7 @@ var require_main2 = __commonJS({ const parsedAll = {}; for (const path3 of optionPaths) { try { - const parsed = DotenvModule.parse(fs3.readFileSync(path3, { encoding })); + const parsed = DotenvModule.parse(fs4.readFileSync(path3, { encoding })); DotenvModule.populate(parsedAll, parsed, options); } catch (e3) { if (debug2) { @@ -39834,7 +39834,7 @@ var require_tiktoken = __commonJS({ var imports = {}; imports["./tiktoken_bg.js"] = wasm; var path2 = require("path"); - var fs3 = require("fs"); + var fs4 = require("fs"); var candidates = __dirname.split(path2.sep).reduce((memo, _3, index, array) => { const prefix = array.slice(0, index + 1).join(path2.sep) + path2.sep; if (!prefix.includes("node_modules" + path2.sep)) { @@ -39854,7 +39854,7 @@ var require_tiktoken = __commonJS({ var bytes = null; for (const candidate of candidates) { try { - bytes = fs3.readFileSync(candidate); + bytes = fs4.readFileSync(candidate); break; } catch { } @@ -39868,1181 +39868,6 @@ var require_tiktoken = __commonJS({ } }); -// node_modules/tslib/tslib.js -var require_tslib = __commonJS({ - "node_modules/tslib/tslib.js"(exports, module2) { - var __extends2; - var __assign2; - var __rest2; - var __decorate2; - var __param2; - var __esDecorate2; - var __runInitializers2; - var __propKey2; - var __setFunctionName2; - var __metadata2; - var __awaiter2; - var __generator2; - var __exportStar2; - var __values2; - var __read2; - var __spread2; - var __spreadArrays2; - var __spreadArray2; - var __await2; - var __asyncGenerator2; - var __asyncDelegator2; - var __asyncValues2; - var __makeTemplateObject2; - var __importStar2; - var __importDefault2; - var __classPrivateFieldGet9; - var __classPrivateFieldSet8; - var __classPrivateFieldIn2; - var __createBinding2; - var __addDisposableResource2; - var __disposeResources2; - (function(factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function(exports2) { - factory(createExporter(root, createExporter(exports2))); - }); - } else if (typeof module2 === "object" && typeof module2.exports === "object") { - factory(createExporter(root, createExporter(module2.exports))); - } else { - factory(createExporter(root)); - } - function createExporter(exports2, previous) { - if (exports2 !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports2, "__esModule", { value: true }); - } else { - exports2.__esModule = true; - } - } - return function(id, v2) { - return exports2[id] = previous ? previous(id, v2) : v2; - }; - } - })(function(exporter) { - var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) { - d5.__proto__ = b3; - } || function(d5, b3) { - for (var p3 in b3) - if (Object.prototype.hasOwnProperty.call(b3, p3)) - d5[p3] = b3[p3]; - }; - __extends2 = function(d5, b3) { - if (typeof b3 !== "function" && b3 !== null) - throw new TypeError("Class extends value " + String(b3) + " is not a constructor or null"); - extendStatics(d5, b3); - function __() { - this.constructor = d5; - } - d5.prototype = b3 === null ? Object.create(b3) : (__.prototype = b3.prototype, new __()); - }; - __assign2 = Object.assign || function(t2) { - for (var s2, i3 = 1, n2 = arguments.length; i3 < n2; i3++) { - s2 = arguments[i3]; - for (var p3 in s2) - if (Object.prototype.hasOwnProperty.call(s2, p3)) - t2[p3] = s2[p3]; - } - return t2; - }; - __rest2 = function(s2, e3) { - var t2 = {}; - for (var p3 in s2) - if (Object.prototype.hasOwnProperty.call(s2, p3) && e3.indexOf(p3) < 0) - t2[p3] = s2[p3]; - if (s2 != null && typeof Object.getOwnPropertySymbols === "function") - for (var i3 = 0, p3 = Object.getOwnPropertySymbols(s2); i3 < p3.length; i3++) { - if (e3.indexOf(p3[i3]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p3[i3])) - t2[p3[i3]] = s2[p3[i3]]; - } - return t2; - }; - __decorate2 = function(decorators, target, key, desc) { - var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d5; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") - r3 = Reflect.decorate(decorators, target, key, desc); - else - for (var i3 = decorators.length - 1; i3 >= 0; i3--) - if (d5 = decorators[i3]) - r3 = (c2 < 3 ? d5(r3) : c2 > 3 ? d5(target, key, r3) : d5(target, key)) || r3; - return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3; - }; - __param2 = function(paramIndex, decorator) { - return function(target, key) { - decorator(target, key, paramIndex); - }; - }; - __esDecorate2 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f4) { - if (f4 !== void 0 && typeof f4 !== "function") - throw new TypeError("Function expected"); - return f4; - } - var kind2 = contextIn.kind, key = kind2 === "getter" ? "get" : kind2 === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _3, done = false; - for (var i3 = decorators.length - 1; i3 >= 0; i3--) { - var context2 = {}; - for (var p3 in contextIn) - context2[p3] = p3 === "access" ? {} : contextIn[p3]; - for (var p3 in contextIn.access) - context2.access[p3] = contextIn.access[p3]; - context2.addInitializer = function(f4) { - if (done) - throw new TypeError("Cannot add initializers after decoration has completed"); - extraInitializers.push(accept(f4 || null)); - }; - var result = (0, decorators[i3])(kind2 === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context2); - if (kind2 === "accessor") { - if (result === void 0) - continue; - if (result === null || typeof result !== "object") - throw new TypeError("Object expected"); - if (_3 = accept(result.get)) - descriptor.get = _3; - if (_3 = accept(result.set)) - descriptor.set = _3; - if (_3 = accept(result.init)) - initializers.unshift(_3); - } else if (_3 = accept(result)) { - if (kind2 === "field") - initializers.unshift(_3); - else - descriptor[key] = _3; - } - } - if (target) - Object.defineProperty(target, contextIn.name, descriptor); - done = true; - }; - __runInitializers2 = function(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i3 = 0; i3 < initializers.length; i3++) { - value = useValue ? initializers[i3].call(thisArg, value) : initializers[i3].call(thisArg); - } - return useValue ? value : void 0; - }; - __propKey2 = function(x2) { - return typeof x2 === "symbol" ? x2 : "".concat(x2); - }; - __setFunctionName2 = function(f4, name, prefix) { - if (typeof name === "symbol") - name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f4, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - }; - __metadata2 = function(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") - return Reflect.metadata(metadataKey, metadataValue); - }; - __awaiter2 = function(thisArg, _arguments, P3, generator) { - function adopt(value) { - return value instanceof P3 ? value : new P3(function(resolve) { - resolve(value); - }); - } - return new (P3 || (P3 = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e3) { - reject(e3); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e3) { - reject(e3); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - __generator2 = function(thisArg, body) { - var _3 = { label: 0, sent: function() { - if (t2[0] & 1) - throw t2[1]; - return t2[1]; - }, trys: [], ops: [] }, f4, y4, t2, g2; - return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { - return this; - }), g2; - function verb(n2) { - return function(v2) { - return step([n2, v2]); - }; - } - function step(op) { - if (f4) - throw new TypeError("Generator is already executing."); - while (g2 && (g2 = 0, op[0] && (_3 = 0)), _3) - try { - if (f4 = 1, y4 && (t2 = op[0] & 2 ? y4["return"] : op[0] ? y4["throw"] || ((t2 = y4["return"]) && t2.call(y4), 0) : y4.next) && !(t2 = t2.call(y4, op[1])).done) - return t2; - if (y4 = 0, t2) - op = [op[0] & 2, t2.value]; - switch (op[0]) { - case 0: - case 1: - t2 = op; - break; - case 4: - _3.label++; - return { value: op[1], done: false }; - case 5: - _3.label++; - y4 = op[1]; - op = [0]; - continue; - case 7: - op = _3.ops.pop(); - _3.trys.pop(); - continue; - default: - if (!(t2 = _3.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _3 = 0; - continue; - } - if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { - _3.label = op[1]; - break; - } - if (op[0] === 6 && _3.label < t2[1]) { - _3.label = t2[1]; - t2 = op; - break; - } - if (t2 && _3.label < t2[2]) { - _3.label = t2[2]; - _3.ops.push(op); - break; - } - if (t2[2]) - _3.ops.pop(); - _3.trys.pop(); - continue; - } - op = body.call(thisArg, _3); - } catch (e3) { - op = [6, e3]; - y4 = 0; - } finally { - f4 = t2 = 0; - } - if (op[0] & 5) - throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - __exportStar2 = function(m4, o3) { - for (var p3 in m4) - if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(o3, p3)) - __createBinding2(o3, m4, p3); - }; - __createBinding2 = Object.create ? function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - var desc = Object.getOwnPropertyDescriptor(m4, k4); - if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m4[k4]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - o3[k22] = m4[k4]; - }; - __values2 = function(o3) { - var s2 = typeof Symbol === "function" && Symbol.iterator, m4 = s2 && o3[s2], i3 = 0; - if (m4) - return m4.call(o3); - if (o3 && typeof o3.length === "number") - return { - next: function() { - if (o3 && i3 >= o3.length) - o3 = void 0; - return { value: o3 && o3[i3++], done: !o3 }; - } - }; - throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - __read2 = function(o3, n2) { - var m4 = typeof Symbol === "function" && o3[Symbol.iterator]; - if (!m4) - return o3; - var i3 = m4.call(o3), r3, ar2 = [], e3; - try { - while ((n2 === void 0 || n2-- > 0) && !(r3 = i3.next()).done) - ar2.push(r3.value); - } catch (error) { - e3 = { error }; - } finally { - try { - if (r3 && !r3.done && (m4 = i3["return"])) - m4.call(i3); - } finally { - if (e3) - throw e3.error; - } - } - return ar2; - }; - __spread2 = function() { - for (var ar2 = [], i3 = 0; i3 < arguments.length; i3++) - ar2 = ar2.concat(__read2(arguments[i3])); - return ar2; - }; - __spreadArrays2 = function() { - for (var s2 = 0, i3 = 0, il = arguments.length; i3 < il; i3++) - s2 += arguments[i3].length; - for (var r3 = Array(s2), k4 = 0, i3 = 0; i3 < il; i3++) - for (var a3 = arguments[i3], j4 = 0, jl = a3.length; j4 < jl; j4++, k4++) - r3[k4] = a3[j4]; - return r3; - }; - __spreadArray2 = function(to, from, pack) { - if (pack || arguments.length === 2) - for (var i3 = 0, l3 = from.length, ar2; i3 < l3; i3++) { - if (ar2 || !(i3 in from)) { - if (!ar2) - ar2 = Array.prototype.slice.call(from, 0, i3); - ar2[i3] = from[i3]; - } - } - return to.concat(ar2 || Array.prototype.slice.call(from)); - }; - __await2 = function(v2) { - return this instanceof __await2 ? (this.v = v2, this) : new __await2(v2); - }; - __asyncGenerator2 = function(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var g2 = generator.apply(thisArg, _arguments || []), i3, q3 = []; - return i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { - return this; - }, i3; - function verb(n2) { - if (g2[n2]) - i3[n2] = function(v2) { - return new Promise(function(a3, b3) { - q3.push([n2, v2, a3, b3]) > 1 || resume(n2, v2); - }); - }; - } - function resume(n2, v2) { - try { - step(g2[n2](v2)); - } catch (e3) { - settle2(q3[0][3], e3); - } - } - function step(r3) { - r3.value instanceof __await2 ? Promise.resolve(r3.value.v).then(fulfill, reject) : settle2(q3[0][2], r3); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle2(f4, v2) { - if (f4(v2), q3.shift(), q3.length) - resume(q3[0][0], q3[0][1]); - } - }; - __asyncDelegator2 = function(o3) { - var i3, p3; - return i3 = {}, verb("next"), verb("throw", function(e3) { - throw e3; - }), verb("return"), i3[Symbol.iterator] = function() { - return this; - }, i3; - function verb(n2, f4) { - i3[n2] = o3[n2] ? function(v2) { - return (p3 = !p3) ? { value: __await2(o3[n2](v2)), done: false } : f4 ? f4(v2) : v2; - } : f4; - } - }; - __asyncValues2 = function(o3) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var m4 = o3[Symbol.asyncIterator], i3; - return m4 ? m4.call(o3) : (o3 = typeof __values2 === "function" ? __values2(o3) : o3[Symbol.iterator](), i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { - return this; - }, i3); - function verb(n2) { - i3[n2] = o3[n2] && function(v2) { - return new Promise(function(resolve, reject) { - v2 = o3[n2](v2), settle2(resolve, reject, v2.done, v2.value); - }); - }; - } - function settle2(resolve, reject, d5, v2) { - Promise.resolve(v2).then(function(v3) { - resolve({ value: v3, done: d5 }); - }, reject); - } - }; - __makeTemplateObject2 = function(cooked, raw) { - if (Object.defineProperty) { - Object.defineProperty(cooked, "raw", { value: raw }); - } else { - cooked.raw = raw; - } - return cooked; - }; - var __setModuleDefault = Object.create ? function(o3, v2) { - Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); - } : function(o3, v2) { - o3["default"] = v2; - }; - __importStar2 = function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k4 in mod) - if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) - __createBinding2(result, mod, k4); - } - __setModuleDefault(result, mod); - return result; - }; - __importDefault2 = function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - __classPrivateFieldGet9 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); - }; - __classPrivateFieldSet8 = function(receiver, state2, value, kind2, f4) { - if (kind2 === "m") - throw new TypeError("Private method is not writable"); - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; - }; - __classPrivateFieldIn2 = function(state2, receiver) { - if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") - throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state2 === "function" ? receiver === state2 : state2.has(receiver); - }; - __addDisposableResource2 = function(env2, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") - throw new TypeError("Object expected."); - var dispose; - if (async) { - if (!Symbol.asyncDispose) - throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) - throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - } - if (typeof dispose !== "function") - throw new TypeError("Object not disposable."); - env2.stack.push({ value, dispose, async }); - } else if (async) { - env2.stack.push({ async: true }); - } - return value; - }; - var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { - var e3 = new Error(message); - return e3.name = "SuppressedError", e3.error = error, e3.suppressed = suppressed, e3; - }; - __disposeResources2 = function(env2) { - function fail(e3) { - env2.error = env2.hasError ? new _SuppressedError(e3, env2.error, "An error was suppressed during disposal.") : e3; - env2.hasError = true; - } - function next() { - while (env2.stack.length) { - var rec = env2.stack.pop(); - try { - var result = rec.dispose && rec.dispose.call(rec.value); - if (rec.async) - return Promise.resolve(result).then(next, function(e3) { - fail(e3); - return next(); - }); - } catch (e3) { - fail(e3); - } - } - if (env2.hasError) - throw env2.error; - } - return next(); - }; - exporter("__extends", __extends2); - exporter("__assign", __assign2); - exporter("__rest", __rest2); - exporter("__decorate", __decorate2); - exporter("__param", __param2); - exporter("__esDecorate", __esDecorate2); - exporter("__runInitializers", __runInitializers2); - exporter("__propKey", __propKey2); - exporter("__setFunctionName", __setFunctionName2); - exporter("__metadata", __metadata2); - exporter("__awaiter", __awaiter2); - exporter("__generator", __generator2); - exporter("__exportStar", __exportStar2); - exporter("__createBinding", __createBinding2); - exporter("__values", __values2); - exporter("__read", __read2); - exporter("__spread", __spread2); - exporter("__spreadArrays", __spreadArrays2); - exporter("__spreadArray", __spreadArray2); - exporter("__await", __await2); - exporter("__asyncGenerator", __asyncGenerator2); - exporter("__asyncDelegator", __asyncDelegator2); - exporter("__asyncValues", __asyncValues2); - exporter("__makeTemplateObject", __makeTemplateObject2); - exporter("__importStar", __importStar2); - exporter("__importDefault", __importDefault2); - exporter("__classPrivateFieldGet", __classPrivateFieldGet9); - exporter("__classPrivateFieldSet", __classPrivateFieldSet8); - exporter("__classPrivateFieldIn", __classPrivateFieldIn2); - exporter("__addDisposableResource", __addDisposableResource2); - exporter("__disposeResources", __disposeResources2); - }); - } -}); - -// node_modules/agent-base/dist/helpers.js -var require_helpers = __commonJS({ - "node_modules/agent-base/dist/helpers.js"(exports) { - "use strict"; - var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - var desc = Object.getOwnPropertyDescriptor(m4, k4); - if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m4[k4]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - o3[k22] = m4[k4]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v2) { - Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); - } : function(o3, v2) { - o3["default"] = v2; - }); - var __importStar2 = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k4 in mod) - if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) - __createBinding2(result, mod, k4); - } - __setModuleDefault(result, mod); - return result; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.req = exports.json = exports.toBuffer = void 0; - var http3 = __importStar2(require("http")); - var https3 = __importStar2(require("https")); - async function toBuffer(stream4) { - let length = 0; - const chunks = []; - for await (const chunk of stream4) { - length += chunk.length; - chunks.push(chunk); - } - return Buffer.concat(chunks, length); - } - exports.toBuffer = toBuffer; - async function json(stream4) { - const buf = await toBuffer(stream4); - const str = buf.toString("utf8"); - try { - return JSON.parse(str); - } catch (_err) { - const err = _err; - err.message += ` (input: ${str})`; - throw err; - } - } - exports.json = json; - function req(url2, opts = {}) { - const href = typeof url2 === "string" ? url2 : url2.href; - const req2 = (href.startsWith("https:") ? https3 : http3).request(url2, opts); - const promise = new Promise((resolve, reject) => { - req2.once("response", resolve).once("error", reject).end(); - }); - req2.then = promise.then.bind(promise); - return req2; - } - exports.req = req; - } -}); - -// node_modules/agent-base/dist/index.js -var require_dist3 = __commonJS({ - "node_modules/agent-base/dist/index.js"(exports) { - "use strict"; - var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - var desc = Object.getOwnPropertyDescriptor(m4, k4); - if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m4[k4]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - o3[k22] = m4[k4]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v2) { - Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); - } : function(o3, v2) { - o3["default"] = v2; - }); - var __importStar2 = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k4 in mod) - if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) - __createBinding2(result, mod, k4); - } - __setModuleDefault(result, mod); - return result; - }; - var __exportStar2 = exports && exports.__exportStar || function(m4, exports2) { - for (var p3 in m4) - if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p3)) - __createBinding2(exports2, m4, p3); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Agent = void 0; - var net = __importStar2(require("net")); - var http3 = __importStar2(require("http")); - var https_1 = require("https"); - __exportStar2(require_helpers(), exports); - var INTERNAL = Symbol("AgentBaseInternalState"); - var Agent3 = class extends http3.Agent { - constructor(opts) { - super(opts); - this[INTERNAL] = {}; - } - isSecureEndpoint(options) { - if (options) { - if (typeof options.secureEndpoint === "boolean") { - return options.secureEndpoint; - } - if (typeof options.protocol === "string") { - return options.protocol === "https:"; - } - } - const { stack } = new Error(); - if (typeof stack !== "string") - return false; - return stack.split("\n").some((l3) => l3.indexOf("(https.js:") !== -1 || l3.indexOf("node:https:") !== -1); - } - incrementSockets(name) { - if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) { - return null; - } - if (!this.sockets[name]) { - this.sockets[name] = []; - } - const fakeSocket = new net.Socket({ writable: false }); - this.sockets[name].push(fakeSocket); - this.totalSocketCount++; - return fakeSocket; - } - decrementSockets(name, socket) { - if (!this.sockets[name] || socket === null) { - return; - } - const sockets = this.sockets[name]; - const index = sockets.indexOf(socket); - if (index !== -1) { - sockets.splice(index, 1); - this.totalSocketCount--; - if (sockets.length === 0) { - delete this.sockets[name]; - } - } - } - getName(options) { - const secureEndpoint = typeof options.secureEndpoint === "boolean" ? options.secureEndpoint : this.isSecureEndpoint(options); - if (secureEndpoint) { - return https_1.Agent.prototype.getName.call(this, options); - } - return super.getName(options); - } - createSocket(req, options, cb) { - const connectOpts = { - ...options, - secureEndpoint: this.isSecureEndpoint(options) - }; - const name = this.getName(connectOpts); - const fakeSocket = this.incrementSockets(name); - Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => { - this.decrementSockets(name, fakeSocket); - if (socket instanceof http3.Agent) { - return socket.addRequest(req, connectOpts); - } - this[INTERNAL].currentSocket = socket; - super.createSocket(req, options, cb); - }, (err) => { - this.decrementSockets(name, fakeSocket); - cb(err); - }); - } - createConnection() { - const socket = this[INTERNAL].currentSocket; - this[INTERNAL].currentSocket = void 0; - if (!socket) { - throw new Error("No socket was returned in the `connect()` function"); - } - return socket; - } - get defaultPort() { - return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80); - } - set defaultPort(v2) { - if (this[INTERNAL]) { - this[INTERNAL].defaultPort = v2; - } - } - get protocol() { - return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:"); - } - set protocol(v2) { - if (this[INTERNAL]) { - this[INTERNAL].protocol = v2; - } - } - }; - exports.Agent = Agent3; - } -}); - -// node_modules/https-proxy-agent/dist/parse-proxy-response.js -var require_parse_proxy_response = __commonJS({ - "node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) { - "use strict"; - var __importDefault2 = exports && exports.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.parseProxyResponse = void 0; - var debug_1 = __importDefault2(require_src2()); - var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response"); - function parseProxyResponse(socket) { - return new Promise((resolve, reject) => { - let buffersLength = 0; - const buffers = []; - function read() { - const b3 = socket.read(); - if (b3) - ondata(b3); - else - socket.once("readable", read); - } - function cleanup() { - socket.removeListener("end", onend); - socket.removeListener("error", onerror); - socket.removeListener("readable", read); - } - function onend() { - cleanup(); - debug2("onend"); - reject(new Error("Proxy connection ended before receiving CONNECT response")); - } - function onerror(err) { - cleanup(); - debug2("onerror %o", err); - reject(err); - } - function ondata(b3) { - buffers.push(b3); - buffersLength += b3.length; - const buffered = Buffer.concat(buffers, buffersLength); - const endOfHeaders = buffered.indexOf("\r\n\r\n"); - if (endOfHeaders === -1) { - debug2("have not received end of HTTP headers yet..."); - read(); - return; - } - const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n"); - const firstLine = headerParts.shift(); - if (!firstLine) { - socket.destroy(); - return reject(new Error("No header received from proxy CONNECT response")); - } - const firstLineParts = firstLine.split(" "); - const statusCode = +firstLineParts[1]; - const statusText = firstLineParts.slice(2).join(" "); - const headers = {}; - for (const header of headerParts) { - if (!header) - continue; - const firstColon = header.indexOf(":"); - if (firstColon === -1) { - socket.destroy(); - return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`)); - } - const key = header.slice(0, firstColon).toLowerCase(); - const value = header.slice(firstColon + 1).trimStart(); - const current = headers[key]; - if (typeof current === "string") { - headers[key] = [current, value]; - } else if (Array.isArray(current)) { - current.push(value); - } else { - headers[key] = value; - } - } - debug2("got proxy server response: %o %o", firstLine, headers); - cleanup(); - resolve({ - connect: { - statusCode, - statusText, - headers - }, - buffered - }); - } - socket.on("error", onerror); - socket.on("end", onend); - read(); - }); - } - exports.parseProxyResponse = parseProxyResponse; - } -}); - -// node_modules/https-proxy-agent/dist/index.js -var require_dist4 = __commonJS({ - "node_modules/https-proxy-agent/dist/index.js"(exports) { - "use strict"; - var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - var desc = Object.getOwnPropertyDescriptor(m4, k4); - if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m4[k4]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - o3[k22] = m4[k4]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v2) { - Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); - } : function(o3, v2) { - o3["default"] = v2; - }); - var __importStar2 = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k4 in mod) - if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) - __createBinding2(result, mod, k4); - } - __setModuleDefault(result, mod); - return result; - }; - var __importDefault2 = exports && exports.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.HttpsProxyAgent = void 0; - var net = __importStar2(require("net")); - var tls = __importStar2(require("tls")); - var assert_1 = __importDefault2(require("assert")); - var debug_1 = __importDefault2(require_src2()); - var agent_base_1 = require_dist3(); - var url_1 = require("url"); - var parse_proxy_response_1 = require_parse_proxy_response(); - var debug2 = (0, debug_1.default)("https-proxy-agent"); - var HttpsProxyAgent2 = class extends agent_base_1.Agent { - constructor(proxy, opts) { - super(opts); - this.options = { path: void 0 }; - this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy; - this.proxyHeaders = opts?.headers ?? {}; - debug2("Creating new HttpsProxyAgent instance: %o", this.proxy.href); - const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ""); - const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80; - this.connectOpts = { - ALPNProtocols: ["http/1.1"], - ...opts ? omit(opts, "headers") : null, - host, - port - }; - } - async connect(req, opts) { - const { proxy } = this; - if (!opts.host) { - throw new TypeError('No "host" provided'); - } - let socket; - if (proxy.protocol === "https:") { - debug2("Creating `tls.Socket`: %o", this.connectOpts); - const servername = this.connectOpts.servername || this.connectOpts.host; - socket = tls.connect({ - ...this.connectOpts, - servername: servername && net.isIP(servername) ? void 0 : servername - }); - } else { - debug2("Creating `net.Socket`: %o", this.connectOpts); - socket = net.connect(this.connectOpts); - } - const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders }; - const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host; - let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r -`; - if (proxy.username || proxy.password) { - const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; - headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`; - } - headers.Host = `${host}:${opts.port}`; - if (!headers["Proxy-Connection"]) { - headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close"; - } - for (const name of Object.keys(headers)) { - payload += `${name}: ${headers[name]}\r -`; - } - const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket); - socket.write(`${payload}\r -`); - const { connect, buffered } = await proxyResponsePromise; - req.emit("proxyConnect", connect); - this.emit("proxyConnect", connect, req); - if (connect.statusCode === 200) { - req.once("socket", resume); - if (opts.secureEndpoint) { - debug2("Upgrading socket connection to TLS"); - const servername = opts.servername || opts.host; - return tls.connect({ - ...omit(opts, "host", "path", "port"), - socket, - servername: net.isIP(servername) ? void 0 : servername - }); - } - return socket; - } - socket.destroy(); - const fakeSocket = new net.Socket({ writable: false }); - fakeSocket.readable = true; - req.once("socket", (s2) => { - debug2("Replaying proxy buffer for failed request"); - (0, assert_1.default)(s2.listenerCount("data") > 0); - s2.push(buffered); - s2.push(null); - }); - return fakeSocket; - } - }; - HttpsProxyAgent2.protocols = ["http", "https"]; - exports.HttpsProxyAgent = HttpsProxyAgent2; - function resume(socket) { - socket.resume(); - } - function omit(obj, ...keys) { - const ret = {}; - let key; - for (key in obj) { - if (!keys.includes(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - } -}); - -// node_modules/http-proxy-agent/dist/index.js -var require_dist5 = __commonJS({ - "node_modules/http-proxy-agent/dist/index.js"(exports) { - "use strict"; - var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - var desc = Object.getOwnPropertyDescriptor(m4, k4); - if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m4[k4]; - } }; - } - Object.defineProperty(o3, k22, desc); - } : function(o3, m4, k4, k22) { - if (k22 === void 0) - k22 = k4; - o3[k22] = m4[k4]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v2) { - Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); - } : function(o3, v2) { - o3["default"] = v2; - }); - var __importStar2 = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k4 in mod) - if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) - __createBinding2(result, mod, k4); - } - __setModuleDefault(result, mod); - return result; - }; - var __importDefault2 = exports && exports.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.HttpProxyAgent = void 0; - var net = __importStar2(require("net")); - var tls = __importStar2(require("tls")); - var debug_1 = __importDefault2(require_src2()); - var events_1 = require("events"); - var agent_base_1 = require_dist3(); - var url_1 = require("url"); - var debug2 = (0, debug_1.default)("http-proxy-agent"); - var HttpProxyAgent2 = class extends agent_base_1.Agent { - constructor(proxy, opts) { - super(opts); - this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy; - this.proxyHeaders = opts?.headers ?? {}; - debug2("Creating new HttpProxyAgent instance: %o", this.proxy.href); - const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ""); - const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80; - this.connectOpts = { - ...opts ? omit(opts, "headers") : null, - host, - port - }; - } - addRequest(req, opts) { - req._header = null; - this.setRequestProps(req, opts); - super.addRequest(req, opts); - } - setRequestProps(req, opts) { - const { proxy } = this; - const protocol = opts.secureEndpoint ? "https:" : "http:"; - const hostname = req.getHeader("host") || "localhost"; - const base = `${protocol}//${hostname}`; - const url2 = new url_1.URL(req.path, base); - if (opts.port !== 80) { - url2.port = String(opts.port); - } - req.path = String(url2); - const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders }; - if (proxy.username || proxy.password) { - const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; - headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`; - } - if (!headers["Proxy-Connection"]) { - headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close"; - } - for (const name of Object.keys(headers)) { - const value = headers[name]; - if (value) { - req.setHeader(name, value); - } - } - } - async connect(req, opts) { - req._header = null; - if (!req.path.includes("://")) { - this.setRequestProps(req, opts); - } - let first; - let endOfHeaders; - debug2("Regenerating stored HTTP header string for request"); - req._implicitHeader(); - if (req.outputData && req.outputData.length > 0) { - debug2("Patching connection write() output buffer with updated header"); - first = req.outputData[0].data; - endOfHeaders = first.indexOf("\r\n\r\n") + 4; - req.outputData[0].data = req._header + first.substring(endOfHeaders); - debug2("Output buffer: %o", req.outputData[0].data); - } - let socket; - if (this.proxy.protocol === "https:") { - debug2("Creating `tls.Socket`: %o", this.connectOpts); - socket = tls.connect(this.connectOpts); - } else { - debug2("Creating `net.Socket`: %o", this.connectOpts); - socket = net.connect(this.connectOpts); - } - await (0, events_1.once)(socket, "connect"); - return socket; - } - }; - HttpProxyAgent2.protocols = ["http", "https"]; - exports.HttpProxyAgent = HttpProxyAgent2; - function omit(obj, ...keys) { - const ret = {}; - let key; - for (key in obj) { - if (!keys.includes(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - } -}); - -// node_modules/@azure/core-tracing/dist/commonjs/state.js -var require_state2 = __commonJS({ - "node_modules/@azure/core-tracing/dist/commonjs/state.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.state = void 0; - exports.state = { - instrumenterImplementation: void 0 - }; - } -}); - // node_modules/formdata-node/node_modules/web-streams-polyfill/dist/ponyfill.mjs function t() { } @@ -43121,20 +41946,20 @@ var init_blobHelpers = __esm({ }); // node_modules/formdata-node/lib/esm/Blob.js -var __classPrivateFieldGet2, __classPrivateFieldSet2, _Blob_parts, _Blob_type, _Blob_size, Blob3; +var __classPrivateFieldGet, __classPrivateFieldSet, _Blob_parts, _Blob_type, _Blob_size, Blob3; var init_Blob = __esm({ "node_modules/formdata-node/lib/esm/Blob.js"() { init_ponyfill(); init_isFunction(); init_blobHelpers(); - __classPrivateFieldGet2 = function(receiver, state2, kind2, f4) { + __classPrivateFieldGet = function(receiver, state2, kind2, f4) { if (kind2 === "a" && !f4) throw new TypeError("Private accessor was defined without a getter"); if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); }; - __classPrivateFieldSet2 = function(receiver, state2, value, kind2, f4) { + __classPrivateFieldSet = function(receiver, state2, value, kind2, f4) { if (kind2 === "m") throw new TypeError("Private method is not writable"); if (kind2 === "a" && !f4) @@ -43170,30 +41995,30 @@ var init_Blob = __esm({ } else { part = encoder.encode(String(raw)); } - __classPrivateFieldSet2(this, _Blob_size, __classPrivateFieldGet2(this, _Blob_size, "f") + (ArrayBuffer.isView(part) ? part.byteLength : part.size), "f"); - __classPrivateFieldGet2(this, _Blob_parts, "f").push(part); + __classPrivateFieldSet(this, _Blob_size, __classPrivateFieldGet(this, _Blob_size, "f") + (ArrayBuffer.isView(part) ? part.byteLength : part.size), "f"); + __classPrivateFieldGet(this, _Blob_parts, "f").push(part); } const type2 = options.type === void 0 ? "" : String(options.type); - __classPrivateFieldSet2(this, _Blob_type, /^[\x20-\x7E]*$/.test(type2) ? type2 : "", "f"); + __classPrivateFieldSet(this, _Blob_type, /^[\x20-\x7E]*$/.test(type2) ? type2 : "", "f"); } static [(_Blob_parts = /* @__PURE__ */ new WeakMap(), _Blob_type = /* @__PURE__ */ new WeakMap(), _Blob_size = /* @__PURE__ */ new WeakMap(), Symbol.hasInstance)](value) { return Boolean(value && typeof value === "object" && isFunction2(value.constructor) && (isFunction2(value.stream) || isFunction2(value.arrayBuffer)) && /^(Blob|File)$/.test(value[Symbol.toStringTag])); } get type() { - return __classPrivateFieldGet2(this, _Blob_type, "f"); + return __classPrivateFieldGet(this, _Blob_type, "f"); } get size() { - return __classPrivateFieldGet2(this, _Blob_size, "f"); + return __classPrivateFieldGet(this, _Blob_size, "f"); } slice(start, end, contentType) { - return new Blob3(sliceBlob(__classPrivateFieldGet2(this, _Blob_parts, "f"), this.size, start, end), { + return new Blob3(sliceBlob(__classPrivateFieldGet(this, _Blob_parts, "f"), this.size, start, end), { type: contentType }); } async text() { const decoder = new TextDecoder(); let result = ""; - for await (const chunk of consumeBlobParts(__classPrivateFieldGet2(this, _Blob_parts, "f"))) { + for await (const chunk of consumeBlobParts(__classPrivateFieldGet(this, _Blob_parts, "f"))) { result += decoder.decode(chunk, { stream: true }); } result += decoder.decode(); @@ -43202,14 +42027,14 @@ var init_Blob = __esm({ async arrayBuffer() { const view = new Uint8Array(this.size); let offset = 0; - for await (const chunk of consumeBlobParts(__classPrivateFieldGet2(this, _Blob_parts, "f"))) { + for await (const chunk of consumeBlobParts(__classPrivateFieldGet(this, _Blob_parts, "f"))) { view.set(chunk, offset); offset += chunk.length; } return view.buffer; } stream() { - const iterator = consumeBlobParts(__classPrivateFieldGet2(this, _Blob_parts, "f"), true); + const iterator = consumeBlobParts(__classPrivateFieldGet(this, _Blob_parts, "f"), true); return new ReadableStream3({ async pull(controller) { const { value, done } = await iterator.next(); @@ -43239,11 +42064,11 @@ var init_Blob = __esm({ }); // node_modules/formdata-node/lib/esm/File.js -var __classPrivateFieldSet3, __classPrivateFieldGet3, _File_name, _File_lastModified, File3; +var __classPrivateFieldSet2, __classPrivateFieldGet2, _File_name, _File_lastModified, File3; var init_File = __esm({ "node_modules/formdata-node/lib/esm/File.js"() { init_Blob(); - __classPrivateFieldSet3 = function(receiver, state2, value, kind2, f4) { + __classPrivateFieldSet2 = function(receiver, state2, value, kind2, f4) { if (kind2 === "m") throw new TypeError("Private method is not writable"); if (kind2 === "a" && !f4) @@ -43252,7 +42077,7 @@ var init_File = __esm({ throw new TypeError("Cannot write private member to an object whose class did not declare it"); return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; }; - __classPrivateFieldGet3 = function(receiver, state2, kind2, f4) { + __classPrivateFieldGet2 = function(receiver, state2, kind2, f4) { if (kind2 === "a" && !f4) throw new TypeError("Private accessor was defined without a getter"); if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) @@ -43267,20 +42092,20 @@ var init_File = __esm({ if (arguments.length < 2) { throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`); } - __classPrivateFieldSet3(this, _File_name, String(name), "f"); + __classPrivateFieldSet2(this, _File_name, String(name), "f"); const lastModified = options.lastModified === void 0 ? Date.now() : Number(options.lastModified); if (!Number.isNaN(lastModified)) { - __classPrivateFieldSet3(this, _File_lastModified, lastModified, "f"); + __classPrivateFieldSet2(this, _File_lastModified, lastModified, "f"); } } static [(_File_name = /* @__PURE__ */ new WeakMap(), _File_lastModified = /* @__PURE__ */ new WeakMap(), Symbol.hasInstance)](value) { return value instanceof Blob3 && value[Symbol.toStringTag] === "File" && typeof value.name === "string"; } get name() { - return __classPrivateFieldGet3(this, _File_name, "f"); + return __classPrivateFieldGet2(this, _File_name, "f"); } get lastModified() { - return __classPrivateFieldGet3(this, _File_lastModified, "f"); + return __classPrivateFieldGet2(this, _File_lastModified, "f"); } get webkitRelativePath() { return ""; @@ -48383,7 +47208,7 @@ async function fileFromPath2(path2, filenameOrOptions, options) { const stats = await import_fs2.promises.stat(path2); return createFileFromPath(path2, stats, filenameOrOptions, options); } -var import_fs2, import_path3, import_node_domexception, __classPrivateFieldSet5, __classPrivateFieldGet6, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath; +var import_fs2, import_path3, import_node_domexception, __classPrivateFieldSet4, __classPrivateFieldGet5, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath; var init_fileFromPath = __esm({ "node_modules/formdata-node/lib/esm/fileFromPath.js"() { import_fs2 = require("fs"); @@ -48392,7 +47217,7 @@ var init_fileFromPath = __esm({ init_File(); init_isPlainObject(); init_isFile(); - __classPrivateFieldSet5 = function(receiver, state2, value, kind2, f4) { + __classPrivateFieldSet4 = function(receiver, state2, value, kind2, f4) { if (kind2 === "m") throw new TypeError("Private method is not writable"); if (kind2 === "a" && !f4) @@ -48401,7 +47226,7 @@ var init_fileFromPath = __esm({ throw new TypeError("Cannot write private member to an object whose class did not declare it"); return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; }; - __classPrivateFieldGet6 = function(receiver, state2, kind2, f4) { + __classPrivateFieldGet5 = function(receiver, state2, kind2, f4) { if (kind2 === "a" && !f4) throw new TypeError("Private accessor was defined without a getter"); if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) @@ -48413,29 +47238,29 @@ var init_fileFromPath = __esm({ constructor(input) { _FileFromPath_path.set(this, void 0); _FileFromPath_start.set(this, void 0); - __classPrivateFieldSet5(this, _FileFromPath_path, input.path, "f"); - __classPrivateFieldSet5(this, _FileFromPath_start, input.start || 0, "f"); - this.name = (0, import_path3.basename)(__classPrivateFieldGet6(this, _FileFromPath_path, "f")); + __classPrivateFieldSet4(this, _FileFromPath_path, input.path, "f"); + __classPrivateFieldSet4(this, _FileFromPath_start, input.start || 0, "f"); + this.name = (0, import_path3.basename)(__classPrivateFieldGet5(this, _FileFromPath_path, "f")); this.size = input.size; this.lastModified = input.lastModified; } slice(start, end) { return new FileFromPath({ - path: __classPrivateFieldGet6(this, _FileFromPath_path, "f"), + path: __classPrivateFieldGet5(this, _FileFromPath_path, "f"), lastModified: this.lastModified, size: end - start, start }); } async *stream() { - const { mtimeMs } = await import_fs2.promises.stat(__classPrivateFieldGet6(this, _FileFromPath_path, "f")); + const { mtimeMs } = await import_fs2.promises.stat(__classPrivateFieldGet5(this, _FileFromPath_path, "f")); if (mtimeMs > this.lastModified) { throw new import_node_domexception.default(MESSAGE, "NotReadableError"); } if (this.size) { - yield* (0, import_fs2.createReadStream)(__classPrivateFieldGet6(this, _FileFromPath_path, "f"), { - start: __classPrivateFieldGet6(this, _FileFromPath_start, "f"), - end: __classPrivateFieldGet6(this, _FileFromPath_start, "f") + this.size - 1 + yield* (0, import_fs2.createReadStream)(__classPrivateFieldGet5(this, _FileFromPath_path, "f"), { + start: __classPrivateFieldGet5(this, _FileFromPath_start, "f"), + end: __classPrivateFieldGet5(this, _FileFromPath_start, "f") + this.size - 1 }); } } @@ -48446,6 +47271,1181 @@ var init_fileFromPath = __esm({ } }); +// node_modules/tslib/tslib.js +var require_tslib = __commonJS({ + "node_modules/tslib/tslib.js"(exports, module2) { + var __extends2; + var __assign2; + var __rest2; + var __decorate2; + var __param2; + var __esDecorate2; + var __runInitializers2; + var __propKey2; + var __setFunctionName2; + var __metadata2; + var __awaiter2; + var __generator2; + var __exportStar2; + var __values2; + var __read2; + var __spread2; + var __spreadArrays2; + var __spreadArray2; + var __await3; + var __asyncGenerator3; + var __asyncDelegator2; + var __asyncValues2; + var __makeTemplateObject2; + var __importStar2; + var __importDefault2; + var __classPrivateFieldGet9; + var __classPrivateFieldSet8; + var __classPrivateFieldIn2; + var __createBinding2; + var __addDisposableResource2; + var __disposeResources2; + (function(factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function(exports2) { + factory(createExporter(root, createExporter(exports2))); + }); + } else if (typeof module2 === "object" && typeof module2.exports === "object") { + factory(createExporter(root, createExporter(module2.exports))); + } else { + factory(createExporter(root)); + } + function createExporter(exports2, previous) { + if (exports2 !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports2, "__esModule", { value: true }); + } else { + exports2.__esModule = true; + } + } + return function(id, v2) { + return exports2[id] = previous ? previous(id, v2) : v2; + }; + } + })(function(exporter) { + var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b3) { + d5.__proto__ = b3; + } || function(d5, b3) { + for (var p3 in b3) + if (Object.prototype.hasOwnProperty.call(b3, p3)) + d5[p3] = b3[p3]; + }; + __extends2 = function(d5, b3) { + if (typeof b3 !== "function" && b3 !== null) + throw new TypeError("Class extends value " + String(b3) + " is not a constructor or null"); + extendStatics(d5, b3); + function __() { + this.constructor = d5; + } + d5.prototype = b3 === null ? Object.create(b3) : (__.prototype = b3.prototype, new __()); + }; + __assign2 = Object.assign || function(t2) { + for (var s2, i3 = 1, n2 = arguments.length; i3 < n2; i3++) { + s2 = arguments[i3]; + for (var p3 in s2) + if (Object.prototype.hasOwnProperty.call(s2, p3)) + t2[p3] = s2[p3]; + } + return t2; + }; + __rest2 = function(s2, e3) { + var t2 = {}; + for (var p3 in s2) + if (Object.prototype.hasOwnProperty.call(s2, p3) && e3.indexOf(p3) < 0) + t2[p3] = s2[p3]; + if (s2 != null && typeof Object.getOwnPropertySymbols === "function") + for (var i3 = 0, p3 = Object.getOwnPropertySymbols(s2); i3 < p3.length; i3++) { + if (e3.indexOf(p3[i3]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p3[i3])) + t2[p3[i3]] = s2[p3[i3]]; + } + return t2; + }; + __decorate2 = function(decorators, target, key, desc) { + var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d5; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + r3 = Reflect.decorate(decorators, target, key, desc); + else + for (var i3 = decorators.length - 1; i3 >= 0; i3--) + if (d5 = decorators[i3]) + r3 = (c2 < 3 ? d5(r3) : c2 > 3 ? d5(target, key, r3) : d5(target, key)) || r3; + return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3; + }; + __param2 = function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + __esDecorate2 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f4) { + if (f4 !== void 0 && typeof f4 !== "function") + throw new TypeError("Function expected"); + return f4; + } + var kind2 = contextIn.kind, key = kind2 === "getter" ? "get" : kind2 === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _3, done = false; + for (var i3 = decorators.length - 1; i3 >= 0; i3--) { + var context2 = {}; + for (var p3 in contextIn) + context2[p3] = p3 === "access" ? {} : contextIn[p3]; + for (var p3 in contextIn.access) + context2.access[p3] = contextIn.access[p3]; + context2.addInitializer = function(f4) { + if (done) + throw new TypeError("Cannot add initializers after decoration has completed"); + extraInitializers.push(accept(f4 || null)); + }; + var result = (0, decorators[i3])(kind2 === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context2); + if (kind2 === "accessor") { + if (result === void 0) + continue; + if (result === null || typeof result !== "object") + throw new TypeError("Object expected"); + if (_3 = accept(result.get)) + descriptor.get = _3; + if (_3 = accept(result.set)) + descriptor.set = _3; + if (_3 = accept(result.init)) + initializers.unshift(_3); + } else if (_3 = accept(result)) { + if (kind2 === "field") + initializers.unshift(_3); + else + descriptor[key] = _3; + } + } + if (target) + Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + __runInitializers2 = function(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i3 = 0; i3 < initializers.length; i3++) { + value = useValue ? initializers[i3].call(thisArg, value) : initializers[i3].call(thisArg); + } + return useValue ? value : void 0; + }; + __propKey2 = function(x2) { + return typeof x2 === "symbol" ? x2 : "".concat(x2); + }; + __setFunctionName2 = function(f4, name, prefix) { + if (typeof name === "symbol") + name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f4, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + __metadata2 = function(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(metadataKey, metadataValue); + }; + __awaiter2 = function(thisArg, _arguments, P3, generator) { + function adopt(value) { + return value instanceof P3 ? value : new P3(function(resolve) { + resolve(value); + }); + } + return new (P3 || (P3 = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e3) { + reject(e3); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e3) { + reject(e3); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + __generator2 = function(thisArg, body) { + var _3 = { label: 0, sent: function() { + if (t2[0] & 1) + throw t2[1]; + return t2[1]; + }, trys: [], ops: [] }, f4, y4, t2, g2; + return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { + return this; + }), g2; + function verb(n2) { + return function(v2) { + return step([n2, v2]); + }; + } + function step(op) { + if (f4) + throw new TypeError("Generator is already executing."); + while (g2 && (g2 = 0, op[0] && (_3 = 0)), _3) + try { + if (f4 = 1, y4 && (t2 = op[0] & 2 ? y4["return"] : op[0] ? y4["throw"] || ((t2 = y4["return"]) && t2.call(y4), 0) : y4.next) && !(t2 = t2.call(y4, op[1])).done) + return t2; + if (y4 = 0, t2) + op = [op[0] & 2, t2.value]; + switch (op[0]) { + case 0: + case 1: + t2 = op; + break; + case 4: + _3.label++; + return { value: op[1], done: false }; + case 5: + _3.label++; + y4 = op[1]; + op = [0]; + continue; + case 7: + op = _3.ops.pop(); + _3.trys.pop(); + continue; + default: + if (!(t2 = _3.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _3 = 0; + continue; + } + if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { + _3.label = op[1]; + break; + } + if (op[0] === 6 && _3.label < t2[1]) { + _3.label = t2[1]; + t2 = op; + break; + } + if (t2 && _3.label < t2[2]) { + _3.label = t2[2]; + _3.ops.push(op); + break; + } + if (t2[2]) + _3.ops.pop(); + _3.trys.pop(); + continue; + } + op = body.call(thisArg, _3); + } catch (e3) { + op = [6, e3]; + y4 = 0; + } finally { + f4 = t2 = 0; + } + if (op[0] & 5) + throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + __exportStar2 = function(m4, o3) { + for (var p3 in m4) + if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(o3, p3)) + __createBinding2(o3, m4, p3); + }; + __createBinding2 = Object.create ? function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + var desc = Object.getOwnPropertyDescriptor(m4, k4); + if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m4[k4]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + o3[k22] = m4[k4]; + }; + __values2 = function(o3) { + var s2 = typeof Symbol === "function" && Symbol.iterator, m4 = s2 && o3[s2], i3 = 0; + if (m4) + return m4.call(o3); + if (o3 && typeof o3.length === "number") + return { + next: function() { + if (o3 && i3 >= o3.length) + o3 = void 0; + return { value: o3 && o3[i3++], done: !o3 }; + } + }; + throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + __read2 = function(o3, n2) { + var m4 = typeof Symbol === "function" && o3[Symbol.iterator]; + if (!m4) + return o3; + var i3 = m4.call(o3), r3, ar2 = [], e3; + try { + while ((n2 === void 0 || n2-- > 0) && !(r3 = i3.next()).done) + ar2.push(r3.value); + } catch (error) { + e3 = { error }; + } finally { + try { + if (r3 && !r3.done && (m4 = i3["return"])) + m4.call(i3); + } finally { + if (e3) + throw e3.error; + } + } + return ar2; + }; + __spread2 = function() { + for (var ar2 = [], i3 = 0; i3 < arguments.length; i3++) + ar2 = ar2.concat(__read2(arguments[i3])); + return ar2; + }; + __spreadArrays2 = function() { + for (var s2 = 0, i3 = 0, il = arguments.length; i3 < il; i3++) + s2 += arguments[i3].length; + for (var r3 = Array(s2), k4 = 0, i3 = 0; i3 < il; i3++) + for (var a3 = arguments[i3], j4 = 0, jl = a3.length; j4 < jl; j4++, k4++) + r3[k4] = a3[j4]; + return r3; + }; + __spreadArray2 = function(to, from, pack) { + if (pack || arguments.length === 2) + for (var i3 = 0, l3 = from.length, ar2; i3 < l3; i3++) { + if (ar2 || !(i3 in from)) { + if (!ar2) + ar2 = Array.prototype.slice.call(from, 0, i3); + ar2[i3] = from[i3]; + } + } + return to.concat(ar2 || Array.prototype.slice.call(from)); + }; + __await3 = function(v2) { + return this instanceof __await3 ? (this.v = v2, this) : new __await3(v2); + }; + __asyncGenerator3 = function(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var g2 = generator.apply(thisArg, _arguments || []), i3, q3 = []; + return i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { + return this; + }, i3; + function verb(n2) { + if (g2[n2]) + i3[n2] = function(v2) { + return new Promise(function(a3, b3) { + q3.push([n2, v2, a3, b3]) > 1 || resume(n2, v2); + }); + }; + } + function resume(n2, v2) { + try { + step(g2[n2](v2)); + } catch (e3) { + settle2(q3[0][3], e3); + } + } + function step(r3) { + r3.value instanceof __await3 ? Promise.resolve(r3.value.v).then(fulfill, reject) : settle2(q3[0][2], r3); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle2(f4, v2) { + if (f4(v2), q3.shift(), q3.length) + resume(q3[0][0], q3[0][1]); + } + }; + __asyncDelegator2 = function(o3) { + var i3, p3; + return i3 = {}, verb("next"), verb("throw", function(e3) { + throw e3; + }), verb("return"), i3[Symbol.iterator] = function() { + return this; + }, i3; + function verb(n2, f4) { + i3[n2] = o3[n2] ? function(v2) { + return (p3 = !p3) ? { value: __await3(o3[n2](v2)), done: false } : f4 ? f4(v2) : v2; + } : f4; + } + }; + __asyncValues2 = function(o3) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var m4 = o3[Symbol.asyncIterator], i3; + return m4 ? m4.call(o3) : (o3 = typeof __values2 === "function" ? __values2(o3) : o3[Symbol.iterator](), i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { + return this; + }, i3); + function verb(n2) { + i3[n2] = o3[n2] && function(v2) { + return new Promise(function(resolve, reject) { + v2 = o3[n2](v2), settle2(resolve, reject, v2.done, v2.value); + }); + }; + } + function settle2(resolve, reject, d5, v2) { + Promise.resolve(v2).then(function(v3) { + resolve({ value: v3, done: d5 }); + }, reject); + } + }; + __makeTemplateObject2 = function(cooked, raw) { + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { value: raw }); + } else { + cooked.raw = raw; + } + return cooked; + }; + var __setModuleDefault = Object.create ? function(o3, v2) { + Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); + } : function(o3, v2) { + o3["default"] = v2; + }; + __importStar2 = function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k4 in mod) + if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) + __createBinding2(result, mod, k4); + } + __setModuleDefault(result, mod); + return result; + }; + __importDefault2 = function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + __classPrivateFieldGet9 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); + }; + __classPrivateFieldSet8 = function(receiver, state2, value, kind2, f4) { + if (kind2 === "m") + throw new TypeError("Private method is not writable"); + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; + }; + __classPrivateFieldIn2 = function(state2, receiver) { + if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") + throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state2 === "function" ? receiver === state2 : state2.has(receiver); + }; + __addDisposableResource2 = function(env2, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") + throw new TypeError("Object expected."); + var dispose; + if (async) { + if (!Symbol.asyncDispose) + throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) + throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + } + if (typeof dispose !== "function") + throw new TypeError("Object not disposable."); + env2.stack.push({ value, dispose, async }); + } else if (async) { + env2.stack.push({ async: true }); + } + return value; + }; + var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { + var e3 = new Error(message); + return e3.name = "SuppressedError", e3.error = error, e3.suppressed = suppressed, e3; + }; + __disposeResources2 = function(env2) { + function fail(e3) { + env2.error = env2.hasError ? new _SuppressedError(e3, env2.error, "An error was suppressed during disposal.") : e3; + env2.hasError = true; + } + function next() { + while (env2.stack.length) { + var rec = env2.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) + return Promise.resolve(result).then(next, function(e3) { + fail(e3); + return next(); + }); + } catch (e3) { + fail(e3); + } + } + if (env2.hasError) + throw env2.error; + } + return next(); + }; + exporter("__extends", __extends2); + exporter("__assign", __assign2); + exporter("__rest", __rest2); + exporter("__decorate", __decorate2); + exporter("__param", __param2); + exporter("__esDecorate", __esDecorate2); + exporter("__runInitializers", __runInitializers2); + exporter("__propKey", __propKey2); + exporter("__setFunctionName", __setFunctionName2); + exporter("__metadata", __metadata2); + exporter("__awaiter", __awaiter2); + exporter("__generator", __generator2); + exporter("__exportStar", __exportStar2); + exporter("__createBinding", __createBinding2); + exporter("__values", __values2); + exporter("__read", __read2); + exporter("__spread", __spread2); + exporter("__spreadArrays", __spreadArrays2); + exporter("__spreadArray", __spreadArray2); + exporter("__await", __await3); + exporter("__asyncGenerator", __asyncGenerator3); + exporter("__asyncDelegator", __asyncDelegator2); + exporter("__asyncValues", __asyncValues2); + exporter("__makeTemplateObject", __makeTemplateObject2); + exporter("__importStar", __importStar2); + exporter("__importDefault", __importDefault2); + exporter("__classPrivateFieldGet", __classPrivateFieldGet9); + exporter("__classPrivateFieldSet", __classPrivateFieldSet8); + exporter("__classPrivateFieldIn", __classPrivateFieldIn2); + exporter("__addDisposableResource", __addDisposableResource2); + exporter("__disposeResources", __disposeResources2); + }); + } +}); + +// node_modules/agent-base/dist/helpers.js +var require_helpers = __commonJS({ + "node_modules/agent-base/dist/helpers.js"(exports) { + "use strict"; + var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + var desc = Object.getOwnPropertyDescriptor(m4, k4); + if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m4[k4]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + o3[k22] = m4[k4]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v2) { + Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); + } : function(o3, v2) { + o3["default"] = v2; + }); + var __importStar2 = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k4 in mod) + if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) + __createBinding2(result, mod, k4); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.req = exports.json = exports.toBuffer = void 0; + var http3 = __importStar2(require("http")); + var https3 = __importStar2(require("https")); + async function toBuffer(stream4) { + let length = 0; + const chunks = []; + for await (const chunk of stream4) { + length += chunk.length; + chunks.push(chunk); + } + return Buffer.concat(chunks, length); + } + exports.toBuffer = toBuffer; + async function json(stream4) { + const buf = await toBuffer(stream4); + const str = buf.toString("utf8"); + try { + return JSON.parse(str); + } catch (_err) { + const err = _err; + err.message += ` (input: ${str})`; + throw err; + } + } + exports.json = json; + function req(url2, opts = {}) { + const href = typeof url2 === "string" ? url2 : url2.href; + const req2 = (href.startsWith("https:") ? https3 : http3).request(url2, opts); + const promise = new Promise((resolve, reject) => { + req2.once("response", resolve).once("error", reject).end(); + }); + req2.then = promise.then.bind(promise); + return req2; + } + exports.req = req; + } +}); + +// node_modules/agent-base/dist/index.js +var require_dist3 = __commonJS({ + "node_modules/agent-base/dist/index.js"(exports) { + "use strict"; + var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + var desc = Object.getOwnPropertyDescriptor(m4, k4); + if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m4[k4]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + o3[k22] = m4[k4]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v2) { + Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); + } : function(o3, v2) { + o3["default"] = v2; + }); + var __importStar2 = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k4 in mod) + if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) + __createBinding2(result, mod, k4); + } + __setModuleDefault(result, mod); + return result; + }; + var __exportStar2 = exports && exports.__exportStar || function(m4, exports2) { + for (var p3 in m4) + if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p3)) + __createBinding2(exports2, m4, p3); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Agent = void 0; + var net = __importStar2(require("net")); + var http3 = __importStar2(require("http")); + var https_1 = require("https"); + __exportStar2(require_helpers(), exports); + var INTERNAL = Symbol("AgentBaseInternalState"); + var Agent3 = class extends http3.Agent { + constructor(opts) { + super(opts); + this[INTERNAL] = {}; + } + isSecureEndpoint(options) { + if (options) { + if (typeof options.secureEndpoint === "boolean") { + return options.secureEndpoint; + } + if (typeof options.protocol === "string") { + return options.protocol === "https:"; + } + } + const { stack } = new Error(); + if (typeof stack !== "string") + return false; + return stack.split("\n").some((l3) => l3.indexOf("(https.js:") !== -1 || l3.indexOf("node:https:") !== -1); + } + incrementSockets(name) { + if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) { + return null; + } + if (!this.sockets[name]) { + this.sockets[name] = []; + } + const fakeSocket = new net.Socket({ writable: false }); + this.sockets[name].push(fakeSocket); + this.totalSocketCount++; + return fakeSocket; + } + decrementSockets(name, socket) { + if (!this.sockets[name] || socket === null) { + return; + } + const sockets = this.sockets[name]; + const index = sockets.indexOf(socket); + if (index !== -1) { + sockets.splice(index, 1); + this.totalSocketCount--; + if (sockets.length === 0) { + delete this.sockets[name]; + } + } + } + getName(options) { + const secureEndpoint = typeof options.secureEndpoint === "boolean" ? options.secureEndpoint : this.isSecureEndpoint(options); + if (secureEndpoint) { + return https_1.Agent.prototype.getName.call(this, options); + } + return super.getName(options); + } + createSocket(req, options, cb) { + const connectOpts = { + ...options, + secureEndpoint: this.isSecureEndpoint(options) + }; + const name = this.getName(connectOpts); + const fakeSocket = this.incrementSockets(name); + Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => { + this.decrementSockets(name, fakeSocket); + if (socket instanceof http3.Agent) { + return socket.addRequest(req, connectOpts); + } + this[INTERNAL].currentSocket = socket; + super.createSocket(req, options, cb); + }, (err) => { + this.decrementSockets(name, fakeSocket); + cb(err); + }); + } + createConnection() { + const socket = this[INTERNAL].currentSocket; + this[INTERNAL].currentSocket = void 0; + if (!socket) { + throw new Error("No socket was returned in the `connect()` function"); + } + return socket; + } + get defaultPort() { + return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80); + } + set defaultPort(v2) { + if (this[INTERNAL]) { + this[INTERNAL].defaultPort = v2; + } + } + get protocol() { + return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:"); + } + set protocol(v2) { + if (this[INTERNAL]) { + this[INTERNAL].protocol = v2; + } + } + }; + exports.Agent = Agent3; + } +}); + +// node_modules/https-proxy-agent/dist/parse-proxy-response.js +var require_parse_proxy_response = __commonJS({ + "node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) { + "use strict"; + var __importDefault2 = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseProxyResponse = void 0; + var debug_1 = __importDefault2(require_src2()); + var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response"); + function parseProxyResponse(socket) { + return new Promise((resolve, reject) => { + let buffersLength = 0; + const buffers = []; + function read() { + const b3 = socket.read(); + if (b3) + ondata(b3); + else + socket.once("readable", read); + } + function cleanup() { + socket.removeListener("end", onend); + socket.removeListener("error", onerror); + socket.removeListener("readable", read); + } + function onend() { + cleanup(); + debug2("onend"); + reject(new Error("Proxy connection ended before receiving CONNECT response")); + } + function onerror(err) { + cleanup(); + debug2("onerror %o", err); + reject(err); + } + function ondata(b3) { + buffers.push(b3); + buffersLength += b3.length; + const buffered = Buffer.concat(buffers, buffersLength); + const endOfHeaders = buffered.indexOf("\r\n\r\n"); + if (endOfHeaders === -1) { + debug2("have not received end of HTTP headers yet..."); + read(); + return; + } + const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n"); + const firstLine = headerParts.shift(); + if (!firstLine) { + socket.destroy(); + return reject(new Error("No header received from proxy CONNECT response")); + } + const firstLineParts = firstLine.split(" "); + const statusCode = +firstLineParts[1]; + const statusText = firstLineParts.slice(2).join(" "); + const headers = {}; + for (const header of headerParts) { + if (!header) + continue; + const firstColon = header.indexOf(":"); + if (firstColon === -1) { + socket.destroy(); + return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`)); + } + const key = header.slice(0, firstColon).toLowerCase(); + const value = header.slice(firstColon + 1).trimStart(); + const current = headers[key]; + if (typeof current === "string") { + headers[key] = [current, value]; + } else if (Array.isArray(current)) { + current.push(value); + } else { + headers[key] = value; + } + } + debug2("got proxy server response: %o %o", firstLine, headers); + cleanup(); + resolve({ + connect: { + statusCode, + statusText, + headers + }, + buffered + }); + } + socket.on("error", onerror); + socket.on("end", onend); + read(); + }); + } + exports.parseProxyResponse = parseProxyResponse; + } +}); + +// node_modules/https-proxy-agent/dist/index.js +var require_dist4 = __commonJS({ + "node_modules/https-proxy-agent/dist/index.js"(exports) { + "use strict"; + var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + var desc = Object.getOwnPropertyDescriptor(m4, k4); + if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m4[k4]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + o3[k22] = m4[k4]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v2) { + Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); + } : function(o3, v2) { + o3["default"] = v2; + }); + var __importStar2 = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k4 in mod) + if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) + __createBinding2(result, mod, k4); + } + __setModuleDefault(result, mod); + return result; + }; + var __importDefault2 = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.HttpsProxyAgent = void 0; + var net = __importStar2(require("net")); + var tls = __importStar2(require("tls")); + var assert_1 = __importDefault2(require("assert")); + var debug_1 = __importDefault2(require_src2()); + var agent_base_1 = require_dist3(); + var url_1 = require("url"); + var parse_proxy_response_1 = require_parse_proxy_response(); + var debug2 = (0, debug_1.default)("https-proxy-agent"); + var HttpsProxyAgent2 = class extends agent_base_1.Agent { + constructor(proxy, opts) { + super(opts); + this.options = { path: void 0 }; + this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy; + this.proxyHeaders = opts?.headers ?? {}; + debug2("Creating new HttpsProxyAgent instance: %o", this.proxy.href); + const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ""); + const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80; + this.connectOpts = { + ALPNProtocols: ["http/1.1"], + ...opts ? omit(opts, "headers") : null, + host, + port + }; + } + async connect(req, opts) { + const { proxy } = this; + if (!opts.host) { + throw new TypeError('No "host" provided'); + } + let socket; + if (proxy.protocol === "https:") { + debug2("Creating `tls.Socket`: %o", this.connectOpts); + const servername = this.connectOpts.servername || this.connectOpts.host; + socket = tls.connect({ + ...this.connectOpts, + servername: servername && net.isIP(servername) ? void 0 : servername + }); + } else { + debug2("Creating `net.Socket`: %o", this.connectOpts); + socket = net.connect(this.connectOpts); + } + const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders }; + const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host; + let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r +`; + if (proxy.username || proxy.password) { + const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; + headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`; + } + headers.Host = `${host}:${opts.port}`; + if (!headers["Proxy-Connection"]) { + headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close"; + } + for (const name of Object.keys(headers)) { + payload += `${name}: ${headers[name]}\r +`; + } + const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket); + socket.write(`${payload}\r +`); + const { connect, buffered } = await proxyResponsePromise; + req.emit("proxyConnect", connect); + this.emit("proxyConnect", connect, req); + if (connect.statusCode === 200) { + req.once("socket", resume); + if (opts.secureEndpoint) { + debug2("Upgrading socket connection to TLS"); + const servername = opts.servername || opts.host; + return tls.connect({ + ...omit(opts, "host", "path", "port"), + socket, + servername: net.isIP(servername) ? void 0 : servername + }); + } + return socket; + } + socket.destroy(); + const fakeSocket = new net.Socket({ writable: false }); + fakeSocket.readable = true; + req.once("socket", (s2) => { + debug2("Replaying proxy buffer for failed request"); + (0, assert_1.default)(s2.listenerCount("data") > 0); + s2.push(buffered); + s2.push(null); + }); + return fakeSocket; + } + }; + HttpsProxyAgent2.protocols = ["http", "https"]; + exports.HttpsProxyAgent = HttpsProxyAgent2; + function resume(socket) { + socket.resume(); + } + function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + } +}); + +// node_modules/http-proxy-agent/dist/index.js +var require_dist5 = __commonJS({ + "node_modules/http-proxy-agent/dist/index.js"(exports) { + "use strict"; + var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + var desc = Object.getOwnPropertyDescriptor(m4, k4); + if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m4[k4]; + } }; + } + Object.defineProperty(o3, k22, desc); + } : function(o3, m4, k4, k22) { + if (k22 === void 0) + k22 = k4; + o3[k22] = m4[k4]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o3, v2) { + Object.defineProperty(o3, "default", { enumerable: true, value: v2 }); + } : function(o3, v2) { + o3["default"] = v2; + }); + var __importStar2 = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k4 in mod) + if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) + __createBinding2(result, mod, k4); + } + __setModuleDefault(result, mod); + return result; + }; + var __importDefault2 = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.HttpProxyAgent = void 0; + var net = __importStar2(require("net")); + var tls = __importStar2(require("tls")); + var debug_1 = __importDefault2(require_src2()); + var events_1 = require("events"); + var agent_base_1 = require_dist3(); + var url_1 = require("url"); + var debug2 = (0, debug_1.default)("http-proxy-agent"); + var HttpProxyAgent2 = class extends agent_base_1.Agent { + constructor(proxy, opts) { + super(opts); + this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy; + this.proxyHeaders = opts?.headers ?? {}; + debug2("Creating new HttpProxyAgent instance: %o", this.proxy.href); + const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ""); + const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80; + this.connectOpts = { + ...opts ? omit(opts, "headers") : null, + host, + port + }; + } + addRequest(req, opts) { + req._header = null; + this.setRequestProps(req, opts); + super.addRequest(req, opts); + } + setRequestProps(req, opts) { + const { proxy } = this; + const protocol = opts.secureEndpoint ? "https:" : "http:"; + const hostname = req.getHeader("host") || "localhost"; + const base = `${protocol}//${hostname}`; + const url2 = new url_1.URL(req.path, base); + if (opts.port !== 80) { + url2.port = String(opts.port); + } + req.path = String(url2); + const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders }; + if (proxy.username || proxy.password) { + const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; + headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`; + } + if (!headers["Proxy-Connection"]) { + headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close"; + } + for (const name of Object.keys(headers)) { + const value = headers[name]; + if (value) { + req.setHeader(name, value); + } + } + } + async connect(req, opts) { + req._header = null; + if (!req.path.includes("://")) { + this.setRequestProps(req, opts); + } + let first; + let endOfHeaders; + debug2("Regenerating stored HTTP header string for request"); + req._implicitHeader(); + if (req.outputData && req.outputData.length > 0) { + debug2("Patching connection write() output buffer with updated header"); + first = req.outputData[0].data; + endOfHeaders = first.indexOf("\r\n\r\n") + 4; + req.outputData[0].data = req._header + first.substring(endOfHeaders); + debug2("Output buffer: %o", req.outputData[0].data); + } + let socket; + if (this.proxy.protocol === "https:") { + debug2("Creating `tls.Socket`: %o", this.connectOpts); + socket = tls.connect(this.connectOpts); + } else { + debug2("Creating `net.Socket`: %o", this.connectOpts); + socket = net.connect(this.connectOpts); + } + await (0, events_1.once)(socket, "connect"); + return socket; + } + }; + HttpProxyAgent2.protocols = ["http", "https"]; + exports.HttpProxyAgent = HttpProxyAgent2; + function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + } +}); + +// node_modules/@azure/core-tracing/dist/commonjs/state.js +var require_state2 = __commonJS({ + "node_modules/@azure/core-tracing/dist/commonjs/state.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.state = void 0; + exports.state = { + instrumenterImplementation: void 0 + }; + } +}); + // src/github-action.ts var import_fs3 = require("fs"); var import_core5 = __toESM(require_core(), 1); @@ -49443,42 +49443,71 @@ function getI18nLocal(value) { return false; } +// src/engine/testAi.ts +var TEST_MOCK_TYPES = [ + "commit-message", + "prompt-module-commitlint-config" +]; +var TestAi = class { + async generateCommitMessage(_messages) { + const config10 = getConfig(); + switch (config10?.OCO_TEST_MOCK_TYPE) { + case "commit-message": + return "fix(testAi.ts): test commit message"; + case "prompt-module-commitlint-config": + return `{ + "localLanguage": "english", + "commitFix": "fix(server): Change 'port' variable to uppercase 'PORT'", + "commitFeat": "feat(server): Allow server to listen on a port specified through environment variable", + "commitDescription": "Change 'port' variable to uppercase 'PORT'. Allow server to listen on a port specified through environment variable." +}`; + default: + throw Error("unsupported test mock type"); + } + } +}; + // src/commands/config.ts -var CONFIG_KEYS = /* @__PURE__ */ ((CONFIG_KEYS2) => { - CONFIG_KEYS2["OCO_OPENAI_API_KEY"] = "OCO_OPENAI_API_KEY"; - CONFIG_KEYS2["OCO_ANTHROPIC_API_KEY"] = "OCO_ANTHROPIC_API_KEY"; - CONFIG_KEYS2["OCO_AZURE_API_KEY"] = "OCO_AZURE_API_KEY"; - CONFIG_KEYS2["OCO_TOKENS_MAX_INPUT"] = "OCO_TOKENS_MAX_INPUT"; - CONFIG_KEYS2["OCO_TOKENS_MAX_OUTPUT"] = "OCO_TOKENS_MAX_OUTPUT"; - CONFIG_KEYS2["OCO_OPENAI_BASE_PATH"] = "OCO_OPENAI_BASE_PATH"; - CONFIG_KEYS2["OCO_DESCRIPTION"] = "OCO_DESCRIPTION"; - CONFIG_KEYS2["OCO_EMOJI"] = "OCO_EMOJI"; - CONFIG_KEYS2["OCO_MODEL"] = "OCO_MODEL"; - CONFIG_KEYS2["OCO_LANGUAGE"] = "OCO_LANGUAGE"; - CONFIG_KEYS2["OCO_MESSAGE_TEMPLATE_PLACEHOLDER"] = "OCO_MESSAGE_TEMPLATE_PLACEHOLDER"; - CONFIG_KEYS2["OCO_PROMPT_MODULE"] = "OCO_PROMPT_MODULE"; - CONFIG_KEYS2["OCO_AI_PROVIDER"] = "OCO_AI_PROVIDER"; - CONFIG_KEYS2["OCO_GITPUSH"] = "OCO_GITPUSH"; - CONFIG_KEYS2["OCO_ONE_LINE_COMMIT"] = "OCO_ONE_LINE_COMMIT"; - CONFIG_KEYS2["OCO_AZURE_ENDPOINT"] = "OCO_AZURE_ENDPOINT"; - CONFIG_KEYS2["OCO_OLLAMA_API_URL"] = "OCO_API_URL"; - return CONFIG_KEYS2; -})(CONFIG_KEYS || {}); var MODEL_LIST = { openai: [ "gpt-3.5-turbo", + "gpt-3.5-turbo-instruct", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-16k-0613", + "gpt-3.5-turbo-16k-0301", "gpt-4", - "gpt-4-turbo", + "gpt-4-0314", + "gpt-4-0613", "gpt-4-1106-preview", - "gpt-4-turbo-preview", "gpt-4-0125-preview", - "gpt-4o" + "gpt-4-turbo-preview", + "gpt-4-vision-preview", + "gpt-4-1106-vision-preview", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-4o", + "gpt-4o-2024-05-13", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18" ], anthropic: [ "claude-3-haiku-20240307", "claude-3-sonnet-20240229", "claude-3-opus-20240229" + ], + gemini: [ + "gemini-1.5-flash", + "gemini-1.5-pro", + "gemini-1.0-pro", + "gemini-pro-vision", + "text-embedding-004" ] }; var getDefaultModel = (provider4) => { @@ -49487,6 +49516,8 @@ var getDefaultModel = (provider4) => { return ""; case "anthropic": return MODEL_LIST.anthropic[0]; + case "gemini": + return MODEL_LIST.gemini[0]; default: return MODEL_LIST.openai[0]; } @@ -49501,6 +49532,8 @@ var validateConfig = (key, condition, validationMessage) => { }; var configValidators = { ["OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */](value, config10 = {}) { + if (config10.OCO_AI_PROVIDER == "gemini") + return value; validateConfig( "OpenAI API_KEY", value || config10.OCO_ANTHROPIC_API_KEY || config10.OCO_AI_PROVIDER.startsWith("ollama") || config10.OCO_AZURE_API_KEY || config10.OCO_AI_PROVIDER == "test", @@ -49521,11 +49554,21 @@ var configValidators = { ); return value; }, + ["OCO_GEMINI_API_KEY" /* OCO_GEMINI_API_KEY */](value, config10 = {}) { + if (config10.OCO_AI_PROVIDER != "gemini") + return value; + validateConfig( + "Gemini API Key", + value || config10.OCO_GEMINI_API_KEY || config10.OCO_AI_PROVIDER == "test", + "You need to provide an Gemini API key" + ); + return value; + }, ["OCO_ANTHROPIC_API_KEY" /* OCO_ANTHROPIC_API_KEY */](value, config10 = {}) { validateConfig( "ANTHROPIC_API_KEY", value || config10.OCO_OPENAI_API_KEY || config10.OCO_AI_PROVIDER == "ollama" || config10.OCO_AI_PROVIDER == "test", - "You need to provide an OpenAI/Anthropic/Azure API key" + "You need to provide an OpenAI/Anthropic API key" ); return value; }, @@ -49596,13 +49639,18 @@ var configValidators = { ["OCO_MODEL" /* OCO_MODEL */](value, config10 = {}) { validateConfig( "OCO_MODEL" /* OCO_MODEL */, - [...MODEL_LIST.openai, ...MODEL_LIST.anthropic].includes(value) || config10.OCO_AI_PROVIDER == "ollama" || config10.OCO_AI_PROVIDER == "test" || config10.OCO_AI_PROVIDER == "azure", - `${value} is not supported yet, use 'gpt-4o', 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview', 'gpt-4-0125-preview', 'claude-3-opus-20240229', 'claude-3-sonnet-20240229' or 'claude-3-haiku-20240307'` - ); - validateConfig( - "OCO_MODEL" /* OCO_MODEL */, - typeof value === "string" && value.match(/^[a-zA-Z0-9~\-]{1,63}[a-zA-Z0-9]$/) || config10.OCO_AI_PROVIDER != "azure", - `${value} is not model deployed name.` + [ + ...MODEL_LIST.openai, + ...MODEL_LIST.anthropic, + ...MODEL_LIST.gemini + ].includes(value) || config10.OCO_AI_PROVIDER == "ollama" || config10.OCO_AI_PROVIDER == "azure" || config10.OCO_AI_PROVIDER == "test", + `${value} is not supported yet, use: + + ${[ + ...MODEL_LIST.openai, + ...MODEL_LIST.anthropic, + ...MODEL_LIST.gemini + ].join("\n")}` ); return value; }, @@ -49633,15 +49681,8 @@ var configValidators = { ["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) { validateConfig( "OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */, - [ - "", - "openai", - "anthropic", - "azure", - "ollama", - "test" - ].includes(value) || value.startsWith("ollama"), - `${value} is not supported yet, use 'ollama/{model}', 'azure', 'anthropic' or 'openai' (default)` + ["", "openai", "anthropic", "gemini", "azure", "test"].includes(value) || value.startsWith("ollama"), + `${value} is not supported yet, use 'ollama', 'anthropic', 'azure', 'gemini' or 'openai' (default)` ); return value; }, @@ -49661,9 +49702,19 @@ var configValidators = { ); return value; }, - ["OCO_API_URL" /* OCO_OLLAMA_API_URL */](value) { + ["OCO_TEST_MOCK_TYPE" /* OCO_TEST_MOCK_TYPE */](value) { validateConfig( - CONFIG_KEYS.OCO_API_URL, + "OCO_TEST_MOCK_TYPE" /* OCO_TEST_MOCK_TYPE */, + TEST_MOCK_TYPES.includes(value), + `${value} is not supported yet, use ${TEST_MOCK_TYPES.map( + (t2) => `'${t2}'` + ).join(", ")}` + ); + return value; + }, + ["OCO_OLLAMA_API_URL" /* OCO_OLLAMA_API_URL */](value) { + validateConfig( + "OCO_API_URL" /* OCO_API_URL */, typeof value === "string" && value.startsWith("http"), `${value} is not a valid URL` ); @@ -49681,9 +49732,11 @@ var getConfig = ({ OCO_OPENAI_API_KEY: process.env.OCO_OPENAI_API_KEY, OCO_ANTHROPIC_API_KEY: process.env.OCO_ANTHROPIC_API_KEY, OCO_AZURE_API_KEY: process.env.OCO_AZURE_API_KEY, + OCO_GEMINI_API_KEY: process.env.OCO_GEMINI_API_KEY, OCO_TOKENS_MAX_INPUT: process.env.OCO_TOKENS_MAX_INPUT ? Number(process.env.OCO_TOKENS_MAX_INPUT) : void 0, OCO_TOKENS_MAX_OUTPUT: process.env.OCO_TOKENS_MAX_OUTPUT ? Number(process.env.OCO_TOKENS_MAX_OUTPUT) : void 0, OCO_OPENAI_BASE_PATH: process.env.OCO_OPENAI_BASE_PATH, + OCO_GEMINI_BASE_PATH: process.env.OCO_GEMINI_BASE_PATH, OCO_DESCRIPTION: process.env.OCO_DESCRIPTION === "true" ? true : false, OCO_EMOJI: process.env.OCO_EMOJI === "true" ? true : false, OCO_MODEL: process.env.OCO_MODEL || getDefaultModel(process.env.OCO_AI_PROVIDER), @@ -49693,7 +49746,8 @@ var getConfig = ({ OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai", OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true, OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false, - OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || "" + OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || "", + OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message" }; const configExists = (0, import_fs.existsSync)(configPath); if (!configExists) @@ -49929,15 +49983,38 @@ var commitlintPrompts = { }; // src/modules/commitlint/pwd-commitlint.ts +var import_promises = __toESM(require("fs/promises"), 1); var import_path2 = __toESM(require("path"), 1); -var nodeModulesPath = import_path2.default.join( - process.env.PWD || process.cwd(), - "node_modules", - "@commitlint", - "load" -); +var getCommitLintModuleType = async () => { + const packageFile = "node_modules/@commitlint/load/package.json"; + const packageJsonPath = import_path2.default.join( + process.env.PWD || process.cwd(), + packageFile + ); + const packageJson = JSON.parse(await import_promises.default.readFile(packageJsonPath, "utf8")); + if (!packageJson) { + throw new Error(`Failed to parse ${packageFile}`); + } + return packageJson.type === "module" ? "esm" : "cjs"; +}; var getCommitLintPWDConfig = async () => { - const load = require(nodeModulesPath).default; + let load, nodeModulesPath; + switch (await getCommitLintModuleType()) { + case "cjs": + nodeModulesPath = import_path2.default.join( + process.env.PWD || process.cwd(), + "node_modules/@commitlint/load" + ); + load = require(nodeModulesPath).default; + break; + case "esm": + nodeModulesPath = import_path2.default.join( + process.env.PWD || process.cwd(), + "node_modules/@commitlint/load/lib/load.js" + ); + load = (await import(nodeModulesPath)).default; + break; + } if (load && typeof load === "function") { return await load(); } @@ -49945,7 +50022,7 @@ var getCommitLintPWDConfig = async () => { }; // src/modules/commitlint/utils.ts -var import_promises = __toESM(require("fs/promises"), 1); +var import_promises2 = __toESM(require("fs/promises"), 1); var removeDoubleNewlines = (input) => { const pattern = /\\n\\n/g; if (pattern.test(input)) { @@ -49958,7 +50035,7 @@ var getJSONBlock = (input) => { const jsonIndex = input.search("```json"); if (jsonIndex > -1) { input = input.slice(jsonIndex + 8); - const endJsonIndex = consistency.search("```"); + const endJsonIndex = input.search("```"); input = input.slice(0, endJsonIndex); } return input; @@ -49966,7 +50043,7 @@ var getJSONBlock = (input) => { var commitlintLLMConfigExists = async () => { let exists; try { - await import_promises.default.access(COMMITLINT_LLM_CONFIG_PATH); + await import_promises2.default.access(COMMITLINT_LLM_CONFIG_PATH); exists = true; } catch (e3) { exists = false; @@ -49974,13 +50051,13 @@ var commitlintLLMConfigExists = async () => { return exists; }; var writeCommitlintLLMConfig = async (commitlintLLMConfig) => { - await import_promises.default.writeFile( + await import_promises2.default.writeFile( COMMITLINT_LLM_CONFIG_PATH, JSON.stringify(commitlintLLMConfig, null, 2) ); }; var getCommitlintLLMConfig = async () => { - const content = await import_promises.default.readFile(COMMITLINT_LLM_CONFIG_PATH); + const content = await import_promises2.default.readFile(COMMITLINT_LLM_CONFIG_PATH); const commitLintLLMConfig = JSON.parse( content.toString() ); @@ -52946,55 +53023,910 @@ if (provider === "openai" && !MODEL_LIST.openai.includes(MODEL) && command !== " process.exit(1); } var OpenAi = class { - openAiApiConfiguration = new import_openai2.Configuration({ - apiKey - }); - openAI; constructor() { + this.openAiApiConfiguration = new import_openai2.Configuration({ + apiKey + }); + this.generateCommitMessage = async (messages) => { + const params = { + model: MODEL, + messages, + temperature: 0, + top_p: 0.1, + max_tokens: MAX_TOKENS_OUTPUT + }; + try { + const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a3, b3) => a3 + b3, 0); + if (REQUEST_TOKENS > MAX_TOKENS_INPUT - MAX_TOKENS_OUTPUT) { + throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); + } + const { data } = await this.openAI.createChatCompletion(params); + const message = data.choices[0].message; + return message?.content; + } catch (error) { + ce(`${source_default.red("\u2716")} ${JSON.stringify(params)}`); + const err = error; + ce(`${source_default.red("\u2716")} ${err?.message || err}`); + if (axios_default.isAxiosError(error) && error.response?.status === 401) { + const openAiError = error.response.data.error; + if (openAiError?.message) + ce(openAiError.message); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + } + throw err; + } + }; if (basePath) { this.openAiApiConfiguration.basePath = basePath; } this.openAI = new import_openai2.OpenAIApi(this.openAiApiConfiguration); } - generateCommitMessage = async (messages) => { - const params = { - model: MODEL, - messages, - temperature: 0, - top_p: 0.1, - max_tokens: MAX_TOKENS_OUTPUT - }; - try { - const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a3, b3) => a3 + b3, 0); - if (REQUEST_TOKENS > MAX_TOKENS_INPUT - MAX_TOKENS_OUTPUT) { - throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); +}; + +// node_modules/@google/generative-ai/dist/index.mjs +var POSSIBLE_ROLES = ["user", "model", "function", "system"]; +var HarmCategory; +(function(HarmCategory2) { + HarmCategory2["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED"; + HarmCategory2["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH"; + HarmCategory2["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT"; + HarmCategory2["HARM_CATEGORY_HARASSMENT"] = "HARM_CATEGORY_HARASSMENT"; + HarmCategory2["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT"; +})(HarmCategory || (HarmCategory = {})); +var HarmBlockThreshold; +(function(HarmBlockThreshold2) { + HarmBlockThreshold2["HARM_BLOCK_THRESHOLD_UNSPECIFIED"] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED"; + HarmBlockThreshold2["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE"; + HarmBlockThreshold2["BLOCK_MEDIUM_AND_ABOVE"] = "BLOCK_MEDIUM_AND_ABOVE"; + HarmBlockThreshold2["BLOCK_ONLY_HIGH"] = "BLOCK_ONLY_HIGH"; + HarmBlockThreshold2["BLOCK_NONE"] = "BLOCK_NONE"; +})(HarmBlockThreshold || (HarmBlockThreshold = {})); +var HarmProbability; +(function(HarmProbability2) { + HarmProbability2["HARM_PROBABILITY_UNSPECIFIED"] = "HARM_PROBABILITY_UNSPECIFIED"; + HarmProbability2["NEGLIGIBLE"] = "NEGLIGIBLE"; + HarmProbability2["LOW"] = "LOW"; + HarmProbability2["MEDIUM"] = "MEDIUM"; + HarmProbability2["HIGH"] = "HIGH"; +})(HarmProbability || (HarmProbability = {})); +var BlockReason; +(function(BlockReason2) { + BlockReason2["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED"; + BlockReason2["SAFETY"] = "SAFETY"; + BlockReason2["OTHER"] = "OTHER"; +})(BlockReason || (BlockReason = {})); +var FinishReason; +(function(FinishReason2) { + FinishReason2["FINISH_REASON_UNSPECIFIED"] = "FINISH_REASON_UNSPECIFIED"; + FinishReason2["STOP"] = "STOP"; + FinishReason2["MAX_TOKENS"] = "MAX_TOKENS"; + FinishReason2["SAFETY"] = "SAFETY"; + FinishReason2["RECITATION"] = "RECITATION"; + FinishReason2["OTHER"] = "OTHER"; +})(FinishReason || (FinishReason = {})); +var TaskType; +(function(TaskType2) { + TaskType2["TASK_TYPE_UNSPECIFIED"] = "TASK_TYPE_UNSPECIFIED"; + TaskType2["RETRIEVAL_QUERY"] = "RETRIEVAL_QUERY"; + TaskType2["RETRIEVAL_DOCUMENT"] = "RETRIEVAL_DOCUMENT"; + TaskType2["SEMANTIC_SIMILARITY"] = "SEMANTIC_SIMILARITY"; + TaskType2["CLASSIFICATION"] = "CLASSIFICATION"; + TaskType2["CLUSTERING"] = "CLUSTERING"; +})(TaskType || (TaskType = {})); +var FunctionCallingMode; +(function(FunctionCallingMode2) { + FunctionCallingMode2["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED"; + FunctionCallingMode2["AUTO"] = "AUTO"; + FunctionCallingMode2["ANY"] = "ANY"; + FunctionCallingMode2["NONE"] = "NONE"; +})(FunctionCallingMode || (FunctionCallingMode = {})); +var FunctionDeclarationSchemaType; +(function(FunctionDeclarationSchemaType2) { + FunctionDeclarationSchemaType2["STRING"] = "STRING"; + FunctionDeclarationSchemaType2["NUMBER"] = "NUMBER"; + FunctionDeclarationSchemaType2["INTEGER"] = "INTEGER"; + FunctionDeclarationSchemaType2["BOOLEAN"] = "BOOLEAN"; + FunctionDeclarationSchemaType2["ARRAY"] = "ARRAY"; + FunctionDeclarationSchemaType2["OBJECT"] = "OBJECT"; +})(FunctionDeclarationSchemaType || (FunctionDeclarationSchemaType = {})); +var GoogleGenerativeAIError = class extends Error { + constructor(message) { + super(`[GoogleGenerativeAI Error]: ${message}`); + } +}; +var GoogleGenerativeAIResponseError = class extends GoogleGenerativeAIError { + constructor(message, response) { + super(message); + this.response = response; + } +}; +var GoogleGenerativeAIFetchError = class extends GoogleGenerativeAIError { + constructor(message, status, statusText, errorDetails) { + super(message); + this.status = status; + this.statusText = statusText; + this.errorDetails = errorDetails; + } +}; +var GoogleGenerativeAIRequestInputError = class extends GoogleGenerativeAIError { +}; +var DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com"; +var DEFAULT_API_VERSION = "v1beta"; +var PACKAGE_VERSION = "0.11.4"; +var PACKAGE_LOG_HEADER = "genai-js"; +var Task; +(function(Task2) { + Task2["GENERATE_CONTENT"] = "generateContent"; + Task2["STREAM_GENERATE_CONTENT"] = "streamGenerateContent"; + Task2["COUNT_TOKENS"] = "countTokens"; + Task2["EMBED_CONTENT"] = "embedContent"; + Task2["BATCH_EMBED_CONTENTS"] = "batchEmbedContents"; +})(Task || (Task = {})); +var RequestUrl = class { + constructor(model, task, apiKey4, stream4, requestOptions) { + this.model = model; + this.task = task; + this.apiKey = apiKey4; + this.stream = stream4; + this.requestOptions = requestOptions; + } + toString() { + var _a4, _b2; + const apiVersion = ((_a4 = this.requestOptions) === null || _a4 === void 0 ? void 0 : _a4.apiVersion) || DEFAULT_API_VERSION; + const baseUrl = ((_b2 = this.requestOptions) === null || _b2 === void 0 ? void 0 : _b2.baseUrl) || DEFAULT_BASE_URL; + let url2 = `${baseUrl}/${apiVersion}/${this.model}:${this.task}`; + if (this.stream) { + url2 += "?alt=sse"; + } + return url2; + } +}; +function getClientHeaders(requestOptions) { + const clientHeaders = []; + if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiClient) { + clientHeaders.push(requestOptions.apiClient); + } + clientHeaders.push(`${PACKAGE_LOG_HEADER}/${PACKAGE_VERSION}`); + return clientHeaders.join(" "); +} +async function getHeaders(url2) { + const headers = new Headers(); + headers.append("Content-Type", "application/json"); + headers.append("x-goog-api-client", getClientHeaders(url2.requestOptions)); + headers.append("x-goog-api-key", url2.apiKey); + let customHeaders = url2.requestOptions.customHeaders; + if (customHeaders) { + if (!(customHeaders instanceof Headers)) { + try { + customHeaders = new Headers(customHeaders); + } catch (e3) { + throw new GoogleGenerativeAIRequestInputError(`unable to convert customHeaders value ${JSON.stringify(customHeaders)} to Headers: ${e3.message}`); } - const { data } = await this.openAI.createChatCompletion(params); - const message = data.choices[0].message; - return message?.content; + } + for (const [headerName, headerValue] of customHeaders.entries()) { + if (headerName === "x-goog-api-key") { + throw new GoogleGenerativeAIRequestInputError(`Cannot set reserved header name ${headerName}`); + } else if (headerName === "x-goog-api-client") { + throw new GoogleGenerativeAIRequestInputError(`Header name ${headerName} can only be set using the apiClient field`); + } + headers.append(headerName, headerValue); + } + } + return headers; +} +async function constructRequest(model, task, apiKey4, stream4, body, requestOptions) { + const url2 = new RequestUrl(model, task, apiKey4, stream4, requestOptions); + return { + url: url2.toString(), + fetchOptions: Object.assign(Object.assign({}, buildFetchOptions(requestOptions)), { method: "POST", headers: await getHeaders(url2), body }) + }; +} +async function makeRequest(model, task, apiKey4, stream4, body, requestOptions) { + return _makeRequestInternal(model, task, apiKey4, stream4, body, requestOptions, fetch); +} +async function _makeRequestInternal(model, task, apiKey4, stream4, body, requestOptions, fetchFn = fetch) { + const url2 = new RequestUrl(model, task, apiKey4, stream4, requestOptions); + let response; + try { + const request3 = await constructRequest(model, task, apiKey4, stream4, body, requestOptions); + response = await fetchFn(request3.url, request3.fetchOptions); + if (!response.ok) { + let message = ""; + let errorDetails; + try { + const json = await response.json(); + message = json.error.message; + if (json.error.details) { + message += ` ${JSON.stringify(json.error.details)}`; + errorDetails = json.error.details; + } + } catch (e3) { + } + throw new GoogleGenerativeAIFetchError(`Error fetching from ${url2.toString()}: [${response.status} ${response.statusText}] ${message}`, response.status, response.statusText, errorDetails); + } + } catch (e3) { + let err = e3; + if (!(e3 instanceof GoogleGenerativeAIFetchError || e3 instanceof GoogleGenerativeAIRequestInputError)) { + err = new GoogleGenerativeAIError(`Error fetching from ${url2.toString()}: ${e3.message}`); + err.stack = e3.stack; + } + throw err; + } + return response; +} +function buildFetchOptions(requestOptions) { + const fetchOptions = {}; + if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeout) >= 0) { + const abortController = new AbortController(); + const signal = abortController.signal; + setTimeout(() => abortController.abort(), requestOptions.timeout); + fetchOptions.signal = signal; + } + return fetchOptions; +} +function addHelpers(response) { + response.text = () => { + if (response.candidates && response.candidates.length > 0) { + if (response.candidates.length > 1) { + console.warn(`This response had ${response.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`); + } + if (hadBadFinishReason(response.candidates[0])) { + throw new GoogleGenerativeAIResponseError(`${formatBlockErrorMessage(response)}`, response); + } + return getText(response); + } else if (response.promptFeedback) { + throw new GoogleGenerativeAIResponseError(`Text not available. ${formatBlockErrorMessage(response)}`, response); + } + return ""; + }; + response.functionCall = () => { + if (response.candidates && response.candidates.length > 0) { + if (response.candidates.length > 1) { + console.warn(`This response had ${response.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`); + } + if (hadBadFinishReason(response.candidates[0])) { + throw new GoogleGenerativeAIResponseError(`${formatBlockErrorMessage(response)}`, response); + } + console.warn(`response.functionCall() is deprecated. Use response.functionCalls() instead.`); + return getFunctionCalls(response)[0]; + } else if (response.promptFeedback) { + throw new GoogleGenerativeAIResponseError(`Function call not available. ${formatBlockErrorMessage(response)}`, response); + } + return void 0; + }; + response.functionCalls = () => { + if (response.candidates && response.candidates.length > 0) { + if (response.candidates.length > 1) { + console.warn(`This response had ${response.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`); + } + if (hadBadFinishReason(response.candidates[0])) { + throw new GoogleGenerativeAIResponseError(`${formatBlockErrorMessage(response)}`, response); + } + return getFunctionCalls(response); + } else if (response.promptFeedback) { + throw new GoogleGenerativeAIResponseError(`Function call not available. ${formatBlockErrorMessage(response)}`, response); + } + return void 0; + }; + return response; +} +function getText(response) { + var _a4, _b2, _c2, _d2; + const textStrings = []; + if ((_b2 = (_a4 = response.candidates) === null || _a4 === void 0 ? void 0 : _a4[0].content) === null || _b2 === void 0 ? void 0 : _b2.parts) { + for (const part of (_d2 = (_c2 = response.candidates) === null || _c2 === void 0 ? void 0 : _c2[0].content) === null || _d2 === void 0 ? void 0 : _d2.parts) { + if (part.text) { + textStrings.push(part.text); + } + } + } + if (textStrings.length > 0) { + return textStrings.join(""); + } else { + return ""; + } +} +function getFunctionCalls(response) { + var _a4, _b2, _c2, _d2; + const functionCalls = []; + if ((_b2 = (_a4 = response.candidates) === null || _a4 === void 0 ? void 0 : _a4[0].content) === null || _b2 === void 0 ? void 0 : _b2.parts) { + for (const part of (_d2 = (_c2 = response.candidates) === null || _c2 === void 0 ? void 0 : _c2[0].content) === null || _d2 === void 0 ? void 0 : _d2.parts) { + if (part.functionCall) { + functionCalls.push(part.functionCall); + } + } + } + if (functionCalls.length > 0) { + return functionCalls; + } else { + return void 0; + } +} +var badFinishReasons = [FinishReason.RECITATION, FinishReason.SAFETY]; +function hadBadFinishReason(candidate) { + return !!candidate.finishReason && badFinishReasons.includes(candidate.finishReason); +} +function formatBlockErrorMessage(response) { + var _a4, _b2, _c2; + let message = ""; + if ((!response.candidates || response.candidates.length === 0) && response.promptFeedback) { + message += "Response was blocked"; + if ((_a4 = response.promptFeedback) === null || _a4 === void 0 ? void 0 : _a4.blockReason) { + message += ` due to ${response.promptFeedback.blockReason}`; + } + if ((_b2 = response.promptFeedback) === null || _b2 === void 0 ? void 0 : _b2.blockReasonMessage) { + message += `: ${response.promptFeedback.blockReasonMessage}`; + } + } else if ((_c2 = response.candidates) === null || _c2 === void 0 ? void 0 : _c2[0]) { + const firstCandidate = response.candidates[0]; + if (hadBadFinishReason(firstCandidate)) { + message += `Candidate was blocked due to ${firstCandidate.finishReason}`; + if (firstCandidate.finishMessage) { + message += `: ${firstCandidate.finishMessage}`; + } + } + } + return message; +} +function __await(v2) { + return this instanceof __await ? (this.v = v2, this) : new __await(v2); +} +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var g2 = generator.apply(thisArg, _arguments || []), i3, q3 = []; + return i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { + return this; + }, i3; + function verb(n2) { + if (g2[n2]) + i3[n2] = function(v2) { + return new Promise(function(a3, b3) { + q3.push([n2, v2, a3, b3]) > 1 || resume(n2, v2); + }); + }; + } + function resume(n2, v2) { + try { + step(g2[n2](v2)); + } catch (e3) { + settle2(q3[0][3], e3); + } + } + function step(r3) { + r3.value instanceof __await ? Promise.resolve(r3.value.v).then(fulfill, reject) : settle2(q3[0][2], r3); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle2(f4, v2) { + if (f4(v2), q3.shift(), q3.length) + resume(q3[0][0], q3[0][1]); + } +} +var responseLineRE = /^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/; +function processStream(response) { + const inputStream = response.body.pipeThrough(new TextDecoderStream("utf8", { fatal: true })); + const responseStream = getResponseStream(inputStream); + const [stream1, stream22] = responseStream.tee(); + return { + stream: generateResponseSequence(stream1), + response: getResponsePromise(stream22) + }; +} +async function getResponsePromise(stream4) { + const allResponses = []; + const reader = stream4.getReader(); + while (true) { + const { done, value } = await reader.read(); + if (done) { + return addHelpers(aggregateResponses(allResponses)); + } + allResponses.push(value); + } +} +function generateResponseSequence(stream4) { + return __asyncGenerator(this, arguments, function* generateResponseSequence_1() { + const reader = stream4.getReader(); + while (true) { + const { value, done } = yield __await(reader.read()); + if (done) { + break; + } + yield yield __await(addHelpers(value)); + } + }); +} +function getResponseStream(inputStream) { + const reader = inputStream.getReader(); + const stream4 = new ReadableStream({ + start(controller) { + let currentText = ""; + return pump(); + function pump() { + return reader.read().then(({ value, done }) => { + if (done) { + if (currentText.trim()) { + controller.error(new GoogleGenerativeAIError("Failed to parse stream")); + return; + } + controller.close(); + return; + } + currentText += value; + let match = currentText.match(responseLineRE); + let parsedResponse; + while (match) { + try { + parsedResponse = JSON.parse(match[1]); + } catch (e3) { + controller.error(new GoogleGenerativeAIError(`Error parsing JSON response: "${match[1]}"`)); + return; + } + controller.enqueue(parsedResponse); + currentText = currentText.substring(match[0].length); + match = currentText.match(responseLineRE); + } + return pump(); + }); + } + } + }); + return stream4; +} +function aggregateResponses(responses) { + const lastResponse = responses[responses.length - 1]; + const aggregatedResponse = { + promptFeedback: lastResponse === null || lastResponse === void 0 ? void 0 : lastResponse.promptFeedback + }; + for (const response of responses) { + if (response.candidates) { + for (const candidate of response.candidates) { + const i3 = candidate.index; + if (!aggregatedResponse.candidates) { + aggregatedResponse.candidates = []; + } + if (!aggregatedResponse.candidates[i3]) { + aggregatedResponse.candidates[i3] = { + index: candidate.index + }; + } + aggregatedResponse.candidates[i3].citationMetadata = candidate.citationMetadata; + aggregatedResponse.candidates[i3].finishReason = candidate.finishReason; + aggregatedResponse.candidates[i3].finishMessage = candidate.finishMessage; + aggregatedResponse.candidates[i3].safetyRatings = candidate.safetyRatings; + if (candidate.content && candidate.content.parts) { + if (!aggregatedResponse.candidates[i3].content) { + aggregatedResponse.candidates[i3].content = { + role: candidate.content.role || "user", + parts: [] + }; + } + const newPart = {}; + for (const part of candidate.content.parts) { + if (part.text) { + newPart.text = part.text; + } + if (part.functionCall) { + newPart.functionCall = part.functionCall; + } + if (Object.keys(newPart).length === 0) { + newPart.text = ""; + } + aggregatedResponse.candidates[i3].content.parts.push(newPart); + } + } + } + } + } + return aggregatedResponse; +} +async function generateContentStream(apiKey4, model, params, requestOptions) { + const response = await makeRequest( + model, + Task.STREAM_GENERATE_CONTENT, + apiKey4, + true, + JSON.stringify(params), + requestOptions + ); + return processStream(response); +} +async function generateContent(apiKey4, model, params, requestOptions) { + const response = await makeRequest( + model, + Task.GENERATE_CONTENT, + apiKey4, + false, + JSON.stringify(params), + requestOptions + ); + const responseJson = await response.json(); + const enhancedResponse = addHelpers(responseJson); + return { + response: enhancedResponse + }; +} +function formatSystemInstruction(input) { + if (input == null) { + return void 0; + } else if (typeof input === "string") { + return { role: "system", parts: [{ text: input }] }; + } else if (input.text) { + return { role: "system", parts: [input] }; + } else if (input.parts) { + if (!input.role) { + return { role: "system", parts: input.parts }; + } else { + return input; + } + } +} +function formatNewContent(request3) { + let newParts = []; + if (typeof request3 === "string") { + newParts = [{ text: request3 }]; + } else { + for (const partOrString of request3) { + if (typeof partOrString === "string") { + newParts.push({ text: partOrString }); + } else { + newParts.push(partOrString); + } + } + } + return assignRoleToPartsAndValidateSendMessageRequest(newParts); +} +function assignRoleToPartsAndValidateSendMessageRequest(parts) { + const userContent = { role: "user", parts: [] }; + const functionContent = { role: "function", parts: [] }; + let hasUserContent = false; + let hasFunctionContent = false; + for (const part of parts) { + if ("functionResponse" in part) { + functionContent.parts.push(part); + hasFunctionContent = true; + } else { + userContent.parts.push(part); + hasUserContent = true; + } + } + if (hasUserContent && hasFunctionContent) { + throw new GoogleGenerativeAIError("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message."); + } + if (!hasUserContent && !hasFunctionContent) { + throw new GoogleGenerativeAIError("No content is provided for sending chat message."); + } + if (hasUserContent) { + return userContent; + } + return functionContent; +} +function formatGenerateContentInput(params) { + let formattedRequest; + if (params.contents) { + formattedRequest = params; + } else { + const content = formatNewContent(params); + formattedRequest = { contents: [content] }; + } + if (params.systemInstruction) { + formattedRequest.systemInstruction = formatSystemInstruction(params.systemInstruction); + } + return formattedRequest; +} +function formatEmbedContentInput(params) { + if (typeof params === "string" || Array.isArray(params)) { + const content = formatNewContent(params); + return { content }; + } + return params; +} +var VALID_PART_FIELDS = [ + "text", + "inlineData", + "functionCall", + "functionResponse" +]; +var VALID_PARTS_PER_ROLE = { + user: ["text", "inlineData"], + function: ["functionResponse"], + model: ["text", "functionCall"], + system: ["text"] +}; +function validateChatHistory(history) { + let prevContent = false; + for (const currContent of history) { + const { role, parts } = currContent; + if (!prevContent && role !== "user") { + throw new GoogleGenerativeAIError(`First content should be with role 'user', got ${role}`); + } + if (!POSSIBLE_ROLES.includes(role)) { + throw new GoogleGenerativeAIError(`Each item should include role field. Got ${role} but valid roles are: ${JSON.stringify(POSSIBLE_ROLES)}`); + } + if (!Array.isArray(parts)) { + throw new GoogleGenerativeAIError("Content should have 'parts' property with an array of Parts"); + } + if (parts.length === 0) { + throw new GoogleGenerativeAIError("Each Content should have at least one part"); + } + const countFields = { + text: 0, + inlineData: 0, + functionCall: 0, + functionResponse: 0, + fileData: 0 + }; + for (const part of parts) { + for (const key of VALID_PART_FIELDS) { + if (key in part) { + countFields[key] += 1; + } + } + } + const validParts = VALID_PARTS_PER_ROLE[role]; + for (const key of VALID_PART_FIELDS) { + if (!validParts.includes(key) && countFields[key] > 0) { + throw new GoogleGenerativeAIError(`Content with role '${role}' can't contain '${key}' part`); + } + } + prevContent = true; + } +} +var SILENT_ERROR = "SILENT_ERROR"; +var ChatSession = class { + constructor(apiKey4, model, params, requestOptions) { + this.model = model; + this.params = params; + this.requestOptions = requestOptions; + this._history = []; + this._sendPromise = Promise.resolve(); + this._apiKey = apiKey4; + if (params === null || params === void 0 ? void 0 : params.history) { + validateChatHistory(params.history); + this._history = params.history; + } + } + async getHistory() { + await this._sendPromise; + return this._history; + } + async sendMessage(request3) { + var _a4, _b2, _c2, _d2, _e2; + await this._sendPromise; + const newContent = formatNewContent(request3); + const generateContentRequest = { + safetySettings: (_a4 = this.params) === null || _a4 === void 0 ? void 0 : _a4.safetySettings, + generationConfig: (_b2 = this.params) === null || _b2 === void 0 ? void 0 : _b2.generationConfig, + tools: (_c2 = this.params) === null || _c2 === void 0 ? void 0 : _c2.tools, + toolConfig: (_d2 = this.params) === null || _d2 === void 0 ? void 0 : _d2.toolConfig, + systemInstruction: (_e2 = this.params) === null || _e2 === void 0 ? void 0 : _e2.systemInstruction, + contents: [...this._history, newContent] + }; + let finalResult; + this._sendPromise = this._sendPromise.then(() => generateContent(this._apiKey, this.model, generateContentRequest, this.requestOptions)).then((result) => { + var _a5; + if (result.response.candidates && result.response.candidates.length > 0) { + this._history.push(newContent); + const responseContent = Object.assign({ + parts: [], + role: "model" + }, (_a5 = result.response.candidates) === null || _a5 === void 0 ? void 0 : _a5[0].content); + this._history.push(responseContent); + } else { + const blockErrorMessage = formatBlockErrorMessage(result.response); + if (blockErrorMessage) { + console.warn(`sendMessage() was unsuccessful. ${blockErrorMessage}. Inspect response object for details.`); + } + } + finalResult = result; + }); + await this._sendPromise; + return finalResult; + } + async sendMessageStream(request3) { + var _a4, _b2, _c2, _d2, _e2; + await this._sendPromise; + const newContent = formatNewContent(request3); + const generateContentRequest = { + safetySettings: (_a4 = this.params) === null || _a4 === void 0 ? void 0 : _a4.safetySettings, + generationConfig: (_b2 = this.params) === null || _b2 === void 0 ? void 0 : _b2.generationConfig, + tools: (_c2 = this.params) === null || _c2 === void 0 ? void 0 : _c2.tools, + toolConfig: (_d2 = this.params) === null || _d2 === void 0 ? void 0 : _d2.toolConfig, + systemInstruction: (_e2 = this.params) === null || _e2 === void 0 ? void 0 : _e2.systemInstruction, + contents: [...this._history, newContent] + }; + const streamPromise = generateContentStream(this._apiKey, this.model, generateContentRequest, this.requestOptions); + this._sendPromise = this._sendPromise.then(() => streamPromise).catch((_ignored) => { + throw new Error(SILENT_ERROR); + }).then((streamResult) => streamResult.response).then((response) => { + if (response.candidates && response.candidates.length > 0) { + this._history.push(newContent); + const responseContent = Object.assign({}, response.candidates[0].content); + if (!responseContent.role) { + responseContent.role = "model"; + } + this._history.push(responseContent); + } else { + const blockErrorMessage = formatBlockErrorMessage(response); + if (blockErrorMessage) { + console.warn(`sendMessageStream() was unsuccessful. ${blockErrorMessage}. Inspect response object for details.`); + } + } + }).catch((e3) => { + if (e3.message !== SILENT_ERROR) { + console.error(e3); + } + }); + return streamPromise; + } +}; +async function countTokens(apiKey4, model, params, requestOptions) { + const response = await makeRequest(model, Task.COUNT_TOKENS, apiKey4, false, JSON.stringify(Object.assign(Object.assign({}, params), { model })), requestOptions); + return response.json(); +} +async function embedContent(apiKey4, model, params, requestOptions) { + const response = await makeRequest(model, Task.EMBED_CONTENT, apiKey4, false, JSON.stringify(params), requestOptions); + return response.json(); +} +async function batchEmbedContents(apiKey4, model, params, requestOptions) { + const requestsWithModel = params.requests.map((request3) => { + return Object.assign(Object.assign({}, request3), { model }); + }); + const response = await makeRequest(model, Task.BATCH_EMBED_CONTENTS, apiKey4, false, JSON.stringify({ requests: requestsWithModel }), requestOptions); + return response.json(); +} +var GenerativeModel = class { + constructor(apiKey4, modelParams, requestOptions) { + this.apiKey = apiKey4; + if (modelParams.model.includes("/")) { + this.model = modelParams.model; + } else { + this.model = `models/${modelParams.model}`; + } + this.generationConfig = modelParams.generationConfig || {}; + this.safetySettings = modelParams.safetySettings || []; + this.tools = modelParams.tools; + this.toolConfig = modelParams.toolConfig; + this.systemInstruction = formatSystemInstruction(modelParams.systemInstruction); + this.requestOptions = requestOptions || {}; + } + async generateContent(request3) { + const formattedParams = formatGenerateContentInput(request3); + return generateContent(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction }, formattedParams), this.requestOptions); + } + async generateContentStream(request3) { + const formattedParams = formatGenerateContentInput(request3); + return generateContentStream(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction }, formattedParams), this.requestOptions); + } + startChat(startChatParams) { + return new ChatSession(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction }, startChatParams), this.requestOptions); + } + async countTokens(request3) { + const formattedParams = formatGenerateContentInput(request3); + return countTokens(this.apiKey, this.model, formattedParams, this.requestOptions); + } + async embedContent(request3) { + const formattedParams = formatEmbedContentInput(request3); + return embedContent(this.apiKey, this.model, formattedParams, this.requestOptions); + } + async batchEmbedContents(batchEmbedContentRequest) { + return batchEmbedContents(this.apiKey, this.model, batchEmbedContentRequest, this.requestOptions); + } +}; +var GoogleGenerativeAI = class { + constructor(apiKey4) { + this.apiKey = apiKey4; + } + getGenerativeModel(modelParams, requestOptions) { + if (!modelParams.model) { + throw new GoogleGenerativeAIError(`Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })`); + } + return new GenerativeModel(this.apiKey, modelParams, requestOptions); + } +}; + +// src/engine/gemini.ts +var Gemini = class { + constructor() { + this.maxTokens = { + input: 4096 /* DEFAULT_MAX_TOKENS_INPUT */, + output: 500 /* DEFAULT_MAX_TOKENS_OUTPUT */ + }; + this.config = getConfig(); + this.googleGenerativeAi = new GoogleGenerativeAI(this.config.OCO_GEMINI_API_KEY); + this.warmup(); + } + async generateCommitMessage(messages) { + const systemInstruction = messages.filter((m4) => m4.role === "system").map((m4) => m4.content).join("\n"); + this.ai = this.googleGenerativeAi.getGenerativeModel({ + model: this.model, + systemInstruction + }); + const contents = messages.filter((m4) => m4.role !== "system").map((m4) => ({ parts: [{ text: m4.content }], role: m4.role == "user" ? m4.role : "model" })); + try { + const result = await this.ai.generateContent({ + contents, + safetySettings: [ + { + category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + }, + { + category: HarmCategory.HARM_CATEGORY_HARASSMENT, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + }, + { + category: HarmCategory.HARM_CATEGORY_HATE_SPEECH, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + }, + { + category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + } + ], + generationConfig: { + maxOutputTokens: this.maxTokens.output, + temperature: 0, + topP: 0.1 + } + }); + return result.response.text(); } catch (error) { - ce(`${source_default.red("\u2716")} ${JSON.stringify(params)}`); const err = error; ce(`${source_default.red("\u2716")} ${err?.message || err}`); if (axios_default.isAxiosError(error) && error.response?.status === 401) { - const openAiError = error.response.data.error; - if (openAiError?.message) - ce(openAiError.message); + const geminiError = error.response.data.error; + if (geminiError?.message) + ce(geminiError.message); ce( "For help look into README https://github.com/di-sukharev/opencommit#setup" ); } throw err; } - }; + } + warmup() { + if (this.config.OCO_TOKENS_MAX_INPUT !== void 0) + this.maxTokens.input = this.config.OCO_TOKENS_MAX_INPUT; + if (this.config.OCO_TOKENS_MAX_OUTPUT !== void 0) + this.maxTokens.output = this.config.OCO_TOKENS_MAX_OUTPUT; + this.basePath = this.config.OCO_GEMINI_BASE_PATH; + this.apiKey = this.config.OCO_GEMINI_API_KEY; + const [command4, mode4] = process.argv.slice(2); + const provider4 = this.config.OCO_AI_PROVIDER; + if (provider4 === "gemini" && !this.apiKey && command4 !== "config" && mode4 !== "set") { + ae("opencommit"); + ce("OCO_GEMINI_API_KEY is not set, please run `oco config set OCO_GEMINI_API_KEY= . If you are using GPT, make sure you add payment details, so API works."); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + process.exit(1); + } + this.model = this.config.OCO_MODEL || MODEL_LIST.gemini[0]; + if (provider4 === "gemini" && !MODEL_LIST.gemini.includes(this.model) && command4 !== "config" && mode4 !== "set" /* set */) { + ce( + `${source_default.red("\u2716")} Unsupported model ${this.model} for Gemini. Supported models are: ${MODEL_LIST.gemini.join( + ", " + )}` + ); + process.exit(1); + } + } }; -var api = new OpenAi(); // src/engine/ollama.ts var config4 = getConfig(); var OllamaAi = class { - model = "mistral"; - url = "http://localhost:11434/api/chat"; + constructor() { + this.model = "mistral"; + this.url = "http://localhost:11434/api/chat"; + } setModel(model) { this.model = model ?? config4?.OCO_MODEL ?? "mistral"; } @@ -53024,7 +53956,2163 @@ var OllamaAi = class { } } }; -var ollamaAi = new OllamaAi(); + +// node_modules/@anthropic-ai/sdk/version.mjs +var VERSION3 = "0.19.2"; + +// node_modules/@anthropic-ai/sdk/_shims/registry.mjs +var auto = false; +var kind = void 0; +var fetch2 = void 0; +var Request = void 0; +var Response = void 0; +var Headers2 = void 0; +var FormData3 = void 0; +var Blob2 = void 0; +var File2 = void 0; +var ReadableStream2 = void 0; +var getMultipartRequestOptions = void 0; +var getDefaultAgent = void 0; +var fileFromPath = void 0; +var isFsReadStream = void 0; +function setShims(shims, options = { auto: false }) { + if (auto) { + throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` before importing anything else from @anthropic-ai/sdk`); + } + if (kind) { + throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` after \`import '@anthropic-ai/sdk/shims/${kind}'\``); + } + auto = options.auto; + kind = shims.kind; + fetch2 = shims.fetch; + Request = shims.Request; + Response = shims.Response; + Headers2 = shims.Headers; + FormData3 = shims.FormData; + Blob2 = shims.Blob; + File2 = shims.File; + ReadableStream2 = shims.ReadableStream; + getMultipartRequestOptions = shims.getMultipartRequestOptions; + getDefaultAgent = shims.getDefaultAgent; + fileFromPath = shims.fileFromPath; + isFsReadStream = shims.isFsReadStream; +} + +// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs +var nf = __toESM(require_lib3(), 1); + +// node_modules/formdata-node/lib/esm/FormData.js +var import_util4 = require("util"); +init_File(); +init_isFile(); + +// node_modules/formdata-node/lib/esm/isBlob.js +init_Blob(); +var isBlob2 = (value) => value instanceof Blob3; + +// node_modules/formdata-node/lib/esm/FormData.js +init_isFunction(); + +// node_modules/formdata-node/lib/esm/deprecateConstructorEntries.js +var import_util3 = require("util"); +var deprecateConstructorEntries = (0, import_util3.deprecate)(() => { +}, 'Constructor "entries" argument is not spec-compliant and will be removed in next major release.'); + +// node_modules/formdata-node/lib/esm/FormData.js +var __classPrivateFieldGet3 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); +}; +var _FormData_instances; +var _FormData_entries; +var _FormData_setEntry; +var FormData4 = class { + constructor(entries) { + _FormData_instances.add(this); + _FormData_entries.set(this, /* @__PURE__ */ new Map()); + if (entries) { + deprecateConstructorEntries(); + entries.forEach(({ name, value, fileName }) => this.append(name, value, fileName)); + } + } + static [(_FormData_entries = /* @__PURE__ */ new WeakMap(), _FormData_instances = /* @__PURE__ */ new WeakSet(), Symbol.hasInstance)](value) { + return Boolean(value && isFunction2(value.constructor) && value[Symbol.toStringTag] === "FormData" && isFunction2(value.append) && isFunction2(value.set) && isFunction2(value.get) && isFunction2(value.getAll) && isFunction2(value.has) && isFunction2(value.delete) && isFunction2(value.entries) && isFunction2(value.values) && isFunction2(value.keys) && isFunction2(value[Symbol.iterator]) && isFunction2(value.forEach)); + } + append(name, value, fileName) { + __classPrivateFieldGet3(this, _FormData_instances, "m", _FormData_setEntry).call(this, { + name, + fileName, + append: true, + rawValue: value, + argsLength: arguments.length + }); + } + set(name, value, fileName) { + __classPrivateFieldGet3(this, _FormData_instances, "m", _FormData_setEntry).call(this, { + name, + fileName, + append: false, + rawValue: value, + argsLength: arguments.length + }); + } + get(name) { + const field = __classPrivateFieldGet3(this, _FormData_entries, "f").get(String(name)); + if (!field) { + return null; + } + return field[0]; + } + getAll(name) { + const field = __classPrivateFieldGet3(this, _FormData_entries, "f").get(String(name)); + if (!field) { + return []; + } + return field.slice(); + } + has(name) { + return __classPrivateFieldGet3(this, _FormData_entries, "f").has(String(name)); + } + delete(name) { + __classPrivateFieldGet3(this, _FormData_entries, "f").delete(String(name)); + } + *keys() { + for (const key of __classPrivateFieldGet3(this, _FormData_entries, "f").keys()) { + yield key; + } + } + *entries() { + for (const name of this.keys()) { + const values = this.getAll(name); + for (const value of values) { + yield [name, value]; + } + } + } + *values() { + for (const [, value] of this) { + yield value; + } + } + [(_FormData_setEntry = function _FormData_setEntry2({ name, rawValue, append: append2, fileName, argsLength }) { + const methodName = append2 ? "append" : "set"; + if (argsLength < 2) { + throw new TypeError(`Failed to execute '${methodName}' on 'FormData': 2 arguments required, but only ${argsLength} present.`); + } + name = String(name); + let value; + if (isFile2(rawValue)) { + value = fileName === void 0 ? rawValue : new File3([rawValue], fileName, { + type: rawValue.type, + lastModified: rawValue.lastModified + }); + } else if (isBlob2(rawValue)) { + value = new File3([rawValue], fileName === void 0 ? "blob" : fileName, { + type: rawValue.type + }); + } else if (fileName) { + throw new TypeError(`Failed to execute '${methodName}' on 'FormData': parameter 2 is not of type 'Blob'.`); + } else { + value = String(rawValue); + } + const values = __classPrivateFieldGet3(this, _FormData_entries, "f").get(name); + if (!values) { + return void __classPrivateFieldGet3(this, _FormData_entries, "f").set(name, [value]); + } + if (!append2) { + return void __classPrivateFieldGet3(this, _FormData_entries, "f").set(name, [value]); + } + values.push(value); + }, Symbol.iterator)]() { + return this.entries(); + } + forEach(callback, thisArg) { + for (const [name, value] of this) { + callback.call(thisArg, value, name, this); + } + } + get [Symbol.toStringTag]() { + return "FormData"; + } + [import_util4.inspect.custom]() { + return this[Symbol.toStringTag]; + } +}; + +// node_modules/formdata-node/lib/esm/index.js +init_Blob(); +init_File(); + +// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs +var import_agentkeepalive = __toESM(require_agentkeepalive(), 1); +var import_abort_controller = __toESM(require_abort_controller(), 1); +var import_node_fs = require("node:fs"); + +// node_modules/form-data-encoder/lib/esm/util/createBoundary.js +var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789"; +function createBoundary() { + let size = 16; + let res = ""; + while (size--) { + res += alphabet[Math.random() * alphabet.length << 0]; + } + return res; +} +var createBoundary_default = createBoundary; + +// node_modules/form-data-encoder/lib/esm/util/isPlainObject.js +var getType = (value) => Object.prototype.toString.call(value).slice(8, -1).toLowerCase(); +function isPlainObject2(value) { + if (getType(value) !== "object") { + return false; + } + const pp = Object.getPrototypeOf(value); + if (pp === null || pp === void 0) { + return true; + } + const Ctor = pp.constructor && pp.constructor.toString(); + return Ctor === Object.toString(); +} +var isPlainObject_default = isPlainObject2; + +// node_modules/form-data-encoder/lib/esm/util/normalizeValue.js +var normalizeValue2 = (value) => String(value).replace(/\r|\n/g, (match, i3, str) => { + if (match === "\r" && str[i3 + 1] !== "\n" || match === "\n" && str[i3 - 1] !== "\r") { + return "\r\n"; + } + return match; +}); +var normalizeValue_default = normalizeValue2; + +// node_modules/form-data-encoder/lib/esm/util/escapeName.js +var escapeName = (name) => String(name).replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/"/g, "%22"); +var escapeName_default = escapeName; + +// node_modules/form-data-encoder/lib/esm/util/isFunction.js +var isFunction3 = (value) => typeof value === "function"; +var isFunction_default = isFunction3; + +// node_modules/form-data-encoder/lib/esm/util/isFileLike.js +var isFileLike = (value) => Boolean(value && typeof value === "object" && isFunction_default(value.constructor) && value[Symbol.toStringTag] === "File" && isFunction_default(value.stream) && value.name != null && value.size != null && value.lastModified != null); + +// node_modules/form-data-encoder/lib/esm/util/isFormData.js +var isFormData2 = (value) => Boolean(value && isFunction_default(value.constructor) && value[Symbol.toStringTag] === "FormData" && isFunction_default(value.append) && isFunction_default(value.getAll) && isFunction_default(value.entries) && isFunction_default(value[Symbol.iterator])); + +// node_modules/form-data-encoder/lib/esm/FormDataEncoder.js +var __classPrivateFieldSet3 = function(receiver, state2, value, kind2, f4) { + if (kind2 === "m") + throw new TypeError("Private method is not writable"); + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; +}; +var __classPrivateFieldGet4 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); +}; +var _FormDataEncoder_instances; +var _FormDataEncoder_CRLF; +var _FormDataEncoder_CRLF_BYTES; +var _FormDataEncoder_CRLF_BYTES_LENGTH; +var _FormDataEncoder_DASHES; +var _FormDataEncoder_encoder; +var _FormDataEncoder_footer; +var _FormDataEncoder_form; +var _FormDataEncoder_options; +var _FormDataEncoder_getFieldHeader; +var defaultOptions = { + enableAdditionalHeaders: false +}; +var FormDataEncoder = class { + constructor(form, boundaryOrOptions, options) { + _FormDataEncoder_instances.add(this); + _FormDataEncoder_CRLF.set(this, "\r\n"); + _FormDataEncoder_CRLF_BYTES.set(this, void 0); + _FormDataEncoder_CRLF_BYTES_LENGTH.set(this, void 0); + _FormDataEncoder_DASHES.set(this, "-".repeat(2)); + _FormDataEncoder_encoder.set(this, new TextEncoder()); + _FormDataEncoder_footer.set(this, void 0); + _FormDataEncoder_form.set(this, void 0); + _FormDataEncoder_options.set(this, void 0); + if (!isFormData2(form)) { + throw new TypeError("Expected first argument to be a FormData instance."); + } + let boundary; + if (isPlainObject_default(boundaryOrOptions)) { + options = boundaryOrOptions; + } else { + boundary = boundaryOrOptions; + } + if (!boundary) { + boundary = createBoundary_default(); + } + if (typeof boundary !== "string") { + throw new TypeError("Expected boundary argument to be a string."); + } + if (options && !isPlainObject_default(options)) { + throw new TypeError("Expected options argument to be an object."); + } + __classPrivateFieldSet3(this, _FormDataEncoder_form, form, "f"); + __classPrivateFieldSet3(this, _FormDataEncoder_options, { ...defaultOptions, ...options }, "f"); + __classPrivateFieldSet3(this, _FormDataEncoder_CRLF_BYTES, __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f")), "f"); + __classPrivateFieldSet3(this, _FormDataEncoder_CRLF_BYTES_LENGTH, __classPrivateFieldGet4(this, _FormDataEncoder_CRLF_BYTES, "f").byteLength, "f"); + this.boundary = `form-data-boundary-${boundary}`; + this.contentType = `multipart/form-data; boundary=${this.boundary}`; + __classPrivateFieldSet3(this, _FormDataEncoder_footer, __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(`${__classPrivateFieldGet4(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet4(this, _FormDataEncoder_DASHES, "f")}${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f").repeat(2)}`), "f"); + this.contentLength = String(this.getContentLength()); + this.headers = Object.freeze({ + "Content-Type": this.contentType, + "Content-Length": this.contentLength + }); + Object.defineProperties(this, { + boundary: { writable: false, configurable: false }, + contentType: { writable: false, configurable: false }, + contentLength: { writable: false, configurable: false }, + headers: { writable: false, configurable: false } + }); + } + getContentLength() { + let length = 0; + for (const [name, raw] of __classPrivateFieldGet4(this, _FormDataEncoder_form, "f")) { + const value = isFileLike(raw) ? raw : __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(normalizeValue_default(raw)); + length += __classPrivateFieldGet4(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value).byteLength; + length += isFileLike(value) ? value.size : value.byteLength; + length += __classPrivateFieldGet4(this, _FormDataEncoder_CRLF_BYTES_LENGTH, "f"); + } + return length + __classPrivateFieldGet4(this, _FormDataEncoder_footer, "f").byteLength; + } + *values() { + for (const [name, raw] of __classPrivateFieldGet4(this, _FormDataEncoder_form, "f").entries()) { + const value = isFileLike(raw) ? raw : __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(normalizeValue_default(raw)); + yield __classPrivateFieldGet4(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value); + yield value; + yield __classPrivateFieldGet4(this, _FormDataEncoder_CRLF_BYTES, "f"); + } + yield __classPrivateFieldGet4(this, _FormDataEncoder_footer, "f"); + } + async *encode() { + for (const part of this.values()) { + if (isFileLike(part)) { + yield* part.stream(); + } else { + yield part; + } + } + } + [(_FormDataEncoder_CRLF = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES_LENGTH = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_DASHES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_encoder = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_footer = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_form = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_options = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_instances = /* @__PURE__ */ new WeakSet(), _FormDataEncoder_getFieldHeader = function _FormDataEncoder_getFieldHeader2(name, value) { + let header = ""; + header += `${__classPrivateFieldGet4(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f")}`; + header += `Content-Disposition: form-data; name="${escapeName_default(name)}"`; + if (isFileLike(value)) { + header += `; filename="${escapeName_default(value.name)}"${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f")}`; + header += `Content-Type: ${value.type || "application/octet-stream"}`; + } + if (__classPrivateFieldGet4(this, _FormDataEncoder_options, "f").enableAdditionalHeaders === true) { + header += `${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f")}Content-Length: ${isFileLike(value) ? value.size : value.byteLength}`; + } + return __classPrivateFieldGet4(this, _FormDataEncoder_encoder, "f").encode(`${header}${__classPrivateFieldGet4(this, _FormDataEncoder_CRLF, "f").repeat(2)}`); + }, Symbol.iterator)]() { + return this.values(); + } + [Symbol.asyncIterator]() { + return this.encode(); + } +}; + +// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs +var import_node_stream = require("node:stream"); + +// node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs +var MultipartBody = class { + constructor(body) { + this.body = body; + } + get [Symbol.toStringTag]() { + return "MultipartBody"; + } +}; + +// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs +var import_ponyfill_es2018 = __toESM(require_ponyfill_es2018(), 1); +var fileFromPathWarned = false; +async function fileFromPath3(path2, ...args) { + const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports)); + if (!fileFromPathWarned) { + console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path2)}) instead`); + fileFromPathWarned = true; + } + return await _fileFromPath(path2, ...args); +} +var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 }); +var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 }); +async function getMultipartRequestOptions2(form, opts) { + const encoder = new FormDataEncoder(form); + const readable = import_node_stream.Readable.from(encoder); + const body = new MultipartBody(readable); + const headers = { + ...opts.headers, + ...encoder.headers, + "Content-Length": encoder.contentLength + }; + return { ...opts, body, headers }; +} +function getRuntime() { + if (typeof AbortController === "undefined") { + globalThis.AbortController = import_abort_controller.AbortController; + } + return { + kind: "node", + fetch: nf.default, + Request: nf.Request, + Response: nf.Response, + Headers: nf.Headers, + FormData: FormData4, + Blob: Blob3, + File: File3, + ReadableStream: import_ponyfill_es2018.ReadableStream, + getMultipartRequestOptions: getMultipartRequestOptions2, + getDefaultAgent: (url2) => url2.startsWith("https") ? defaultHttpsAgent : defaultHttpAgent, + fileFromPath: fileFromPath3, + isFsReadStream: (value) => value instanceof import_node_fs.ReadStream + }; +} + +// node_modules/@anthropic-ai/sdk/_shims/index.mjs +if (!kind) + setShims(getRuntime(), { auto: true }); + +// node_modules/@anthropic-ai/sdk/error.mjs +var error_exports = {}; +__export(error_exports, { + APIConnectionError: () => APIConnectionError, + APIConnectionTimeoutError: () => APIConnectionTimeoutError, + APIError: () => APIError, + APIUserAbortError: () => APIUserAbortError, + AnthropicError: () => AnthropicError, + AuthenticationError: () => AuthenticationError, + BadRequestError: () => BadRequestError, + ConflictError: () => ConflictError, + InternalServerError: () => InternalServerError, + NotFoundError: () => NotFoundError, + PermissionDeniedError: () => PermissionDeniedError, + RateLimitError: () => RateLimitError, + UnprocessableEntityError: () => UnprocessableEntityError +}); +var AnthropicError = class extends Error { +}; +var APIError = class extends AnthropicError { + constructor(status, error, message, headers) { + super(`${APIError.makeMessage(status, error, message)}`); + this.status = status; + this.headers = headers; + this.error = error; + } + static makeMessage(status, error, message) { + const msg = error?.message ? typeof error.message === "string" ? error.message : JSON.stringify(error.message) : error ? JSON.stringify(error) : message; + if (status && msg) { + return `${status} ${msg}`; + } + if (status) { + return `${status} status code (no body)`; + } + if (msg) { + return msg; + } + return "(no status code or body)"; + } + static generate(status, errorResponse, message, headers) { + if (!status) { + return new APIConnectionError({ cause: castToError(errorResponse) }); + } + const error = errorResponse; + if (status === 400) { + return new BadRequestError(status, error, message, headers); + } + if (status === 401) { + return new AuthenticationError(status, error, message, headers); + } + if (status === 403) { + return new PermissionDeniedError(status, error, message, headers); + } + if (status === 404) { + return new NotFoundError(status, error, message, headers); + } + if (status === 409) { + return new ConflictError(status, error, message, headers); + } + if (status === 422) { + return new UnprocessableEntityError(status, error, message, headers); + } + if (status === 429) { + return new RateLimitError(status, error, message, headers); + } + if (status >= 500) { + return new InternalServerError(status, error, message, headers); + } + return new APIError(status, error, message, headers); + } +}; +var APIUserAbortError = class extends APIError { + constructor({ message } = {}) { + super(void 0, void 0, message || "Request was aborted.", void 0); + this.status = void 0; + } +}; +var APIConnectionError = class extends APIError { + constructor({ message, cause }) { + super(void 0, void 0, message || "Connection error.", void 0); + this.status = void 0; + if (cause) + this.cause = cause; + } +}; +var APIConnectionTimeoutError = class extends APIConnectionError { + constructor({ message } = {}) { + super({ message: message ?? "Request timed out." }); + } +}; +var BadRequestError = class extends APIError { + constructor() { + super(...arguments); + this.status = 400; + } +}; +var AuthenticationError = class extends APIError { + constructor() { + super(...arguments); + this.status = 401; + } +}; +var PermissionDeniedError = class extends APIError { + constructor() { + super(...arguments); + this.status = 403; + } +}; +var NotFoundError = class extends APIError { + constructor() { + super(...arguments); + this.status = 404; + } +}; +var ConflictError = class extends APIError { + constructor() { + super(...arguments); + this.status = 409; + } +}; +var UnprocessableEntityError = class extends APIError { + constructor() { + super(...arguments); + this.status = 422; + } +}; +var RateLimitError = class extends APIError { + constructor() { + super(...arguments); + this.status = 429; + } +}; +var InternalServerError = class extends APIError { +}; + +// node_modules/@anthropic-ai/sdk/streaming.mjs +var Stream = class { + constructor(iterator, controller) { + this.iterator = iterator; + this.controller = controller; + } + static fromSSEResponse(response, controller) { + let consumed = false; + async function* iterator() { + if (consumed) { + throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream."); + } + consumed = true; + let done = false; + try { + for await (const sse of _iterSSEMessages(response, controller)) { + if (sse.event === "completion") { + try { + yield JSON.parse(sse.data); + } catch (e3) { + console.error(`Could not parse message into JSON:`, sse.data); + console.error(`From chunk:`, sse.raw); + throw e3; + } + } + if (sse.event === "message_start" || sse.event === "message_delta" || sse.event === "message_stop" || sse.event === "content_block_start" || sse.event === "content_block_delta" || sse.event === "content_block_stop") { + try { + yield JSON.parse(sse.data); + } catch (e3) { + console.error(`Could not parse message into JSON:`, sse.data); + console.error(`From chunk:`, sse.raw); + throw e3; + } + } + if (sse.event === "ping") { + continue; + } + if (sse.event === "error") { + const errText = sse.data; + const errJSON = safeJSON(errText); + const errMessage = errJSON ? void 0 : errText; + throw APIError.generate(void 0, errJSON, errMessage, createResponseHeaders(response.headers)); + } + } + done = true; + } catch (e3) { + if (e3 instanceof Error && e3.name === "AbortError") + return; + throw e3; + } finally { + if (!done) + controller.abort(); + } + } + return new Stream(iterator, controller); + } + static fromReadableStream(readableStream, controller) { + let consumed = false; + async function* iterLines() { + const lineDecoder = new LineDecoder(); + const iter = readableStreamAsyncIterable(readableStream); + for await (const chunk of iter) { + for (const line of lineDecoder.decode(chunk)) { + yield line; + } + } + for (const line of lineDecoder.flush()) { + yield line; + } + } + async function* iterator() { + if (consumed) { + throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream."); + } + consumed = true; + let done = false; + try { + for await (const line of iterLines()) { + if (done) + continue; + if (line) + yield JSON.parse(line); + } + done = true; + } catch (e3) { + if (e3 instanceof Error && e3.name === "AbortError") + return; + throw e3; + } finally { + if (!done) + controller.abort(); + } + } + return new Stream(iterator, controller); + } + [Symbol.asyncIterator]() { + return this.iterator(); + } + tee() { + const left = []; + const right = []; + const iterator = this.iterator(); + const teeIterator = (queue) => { + return { + next: () => { + if (queue.length === 0) { + const result = iterator.next(); + left.push(result); + right.push(result); + } + return queue.shift(); + } + }; + }; + return [ + new Stream(() => teeIterator(left), this.controller), + new Stream(() => teeIterator(right), this.controller) + ]; + } + toReadableStream() { + const self2 = this; + let iter; + const encoder = new TextEncoder(); + return new ReadableStream2({ + async start() { + iter = self2[Symbol.asyncIterator](); + }, + async pull(ctrl) { + try { + const { value, done } = await iter.next(); + if (done) + return ctrl.close(); + const bytes = encoder.encode(JSON.stringify(value) + "\n"); + ctrl.enqueue(bytes); + } catch (err) { + ctrl.error(err); + } + }, + async cancel() { + await iter.return?.(); + } + }); + } +}; +async function* _iterSSEMessages(response, controller) { + if (!response.body) { + controller.abort(); + throw new AnthropicError(`Attempted to iterate over a response with no body`); + } + const sseDecoder = new SSEDecoder(); + const lineDecoder = new LineDecoder(); + const iter = readableStreamAsyncIterable(response.body); + for await (const sseChunk of iterSSEChunks(iter)) { + for (const line of lineDecoder.decode(sseChunk)) { + const sse = sseDecoder.decode(line); + if (sse) + yield sse; + } + } + for (const line of lineDecoder.flush()) { + const sse = sseDecoder.decode(line); + if (sse) + yield sse; + } +} +async function* iterSSEChunks(iterator) { + let data = new Uint8Array(); + for await (const chunk of iterator) { + if (chunk == null) { + continue; + } + const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk) : typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk; + let newData = new Uint8Array(data.length + binaryChunk.length); + newData.set(data); + newData.set(binaryChunk, data.length); + data = newData; + let patternIndex; + while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) { + yield data.slice(0, patternIndex); + data = data.slice(patternIndex); + } + } + if (data.length > 0) { + yield data; + } +} +function findDoubleNewlineIndex(buffer) { + const newline = 10; + const carriage = 13; + for (let i3 = 0; i3 < buffer.length - 2; i3++) { + if (buffer[i3] === newline && buffer[i3 + 1] === newline) { + return i3 + 2; + } + if (buffer[i3] === carriage && buffer[i3 + 1] === carriage) { + return i3 + 2; + } + if (buffer[i3] === carriage && buffer[i3 + 1] === newline && i3 + 3 < buffer.length && buffer[i3 + 2] === carriage && buffer[i3 + 3] === newline) { + return i3 + 4; + } + } + return -1; +} +var SSEDecoder = class { + constructor() { + this.event = null; + this.data = []; + this.chunks = []; + } + decode(line) { + if (line.endsWith("\r")) { + line = line.substring(0, line.length - 1); + } + if (!line) { + if (!this.event && !this.data.length) + return null; + const sse = { + event: this.event, + data: this.data.join("\n"), + raw: this.chunks + }; + this.event = null; + this.data = []; + this.chunks = []; + return sse; + } + this.chunks.push(line); + if (line.startsWith(":")) { + return null; + } + let [fieldname, _3, value] = partition(line, ":"); + if (value.startsWith(" ")) { + value = value.substring(1); + } + if (fieldname === "event") { + this.event = value; + } else if (fieldname === "data") { + this.data.push(value); + } + return null; + } +}; +var LineDecoder = class { + constructor() { + this.buffer = []; + this.trailingCR = false; + } + decode(chunk) { + let text = this.decodeText(chunk); + if (this.trailingCR) { + text = "\r" + text; + this.trailingCR = false; + } + if (text.endsWith("\r")) { + this.trailingCR = true; + text = text.slice(0, -1); + } + if (!text) { + return []; + } + const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || ""); + let lines = text.split(LineDecoder.NEWLINE_REGEXP); + if (trailingNewline) { + lines.pop(); + } + if (lines.length === 1 && !trailingNewline) { + this.buffer.push(lines[0]); + return []; + } + if (this.buffer.length > 0) { + lines = [this.buffer.join("") + lines[0], ...lines.slice(1)]; + this.buffer = []; + } + if (!trailingNewline) { + this.buffer = [lines.pop() || ""]; + } + return lines; + } + decodeText(bytes) { + if (bytes == null) + return ""; + if (typeof bytes === "string") + return bytes; + if (typeof Buffer !== "undefined") { + if (bytes instanceof Buffer) { + return bytes.toString(); + } + if (bytes instanceof Uint8Array) { + return Buffer.from(bytes).toString(); + } + throw new AnthropicError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`); + } + if (typeof TextDecoder !== "undefined") { + if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) { + this.textDecoder ?? (this.textDecoder = new TextDecoder("utf8")); + return this.textDecoder.decode(bytes); + } + throw new AnthropicError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`); + } + throw new AnthropicError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`); + } + flush() { + if (!this.buffer.length && !this.trailingCR) { + return []; + } + const lines = [this.buffer.join("")]; + this.buffer = []; + this.trailingCR = false; + return lines; + } +}; +LineDecoder.NEWLINE_CHARS = /* @__PURE__ */ new Set(["\n", "\r"]); +LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g; +function partition(str, delimiter) { + const index = str.indexOf(delimiter); + if (index !== -1) { + return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)]; + } + return [str, "", ""]; +} +function readableStreamAsyncIterable(stream4) { + if (stream4[Symbol.asyncIterator]) + return stream4; + const reader = stream4.getReader(); + return { + async next() { + try { + const result = await reader.read(); + if (result?.done) + reader.releaseLock(); + return result; + } catch (e3) { + reader.releaseLock(); + throw e3; + } + }, + async return() { + const cancelPromise = reader.cancel(); + reader.releaseLock(); + await cancelPromise; + return { done: true, value: void 0 }; + }, + [Symbol.asyncIterator]() { + return this; + } + }; +} + +// node_modules/@anthropic-ai/sdk/uploads.mjs +var isResponseLike = (value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function"; +var isFileLike2 = (value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value); +var isBlobLike = (value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function"; +async function toFile(value, name, options) { + value = await value; + options ?? (options = isFileLike2(value) ? { lastModified: value.lastModified, type: value.type } : {}); + if (isResponseLike(value)) { + const blob = await value.blob(); + name || (name = new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file"); + return new File2([blob], name, options); + } + const bits = await getBytes(value); + name || (name = getName(value) ?? "unknown_file"); + if (!options.type) { + const type2 = bits[0]?.type; + if (typeof type2 === "string") { + options = { ...options, type: type2 }; + } + } + return new File2(bits, name, options); +} +async function getBytes(value) { + let parts = []; + if (typeof value === "string" || ArrayBuffer.isView(value) || value instanceof ArrayBuffer) { + parts.push(value); + } else if (isBlobLike(value)) { + parts.push(await value.arrayBuffer()); + } else if (isAsyncIterableIterator(value)) { + for await (const chunk of value) { + parts.push(chunk); + } + } else { + throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`); + } + return parts; +} +function propsForError(value) { + const props = Object.getOwnPropertyNames(value); + return `[${props.map((p3) => `"${p3}"`).join(", ")}]`; +} +function getName(value) { + return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop(); +} +var getStringFromMaybeBuffer = (x2) => { + if (typeof x2 === "string") + return x2; + if (typeof Buffer !== "undefined" && x2 instanceof Buffer) + return String(x2); + return void 0; +}; +var isAsyncIterableIterator = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function"; +var isMultipartBody = (body) => body && typeof body === "object" && body.body && body[Symbol.toStringTag] === "MultipartBody"; + +// node_modules/@anthropic-ai/sdk/core.mjs +var __classPrivateFieldSet5 = function(receiver, state2, value, kind2, f4) { + if (kind2 === "m") + throw new TypeError("Private method is not writable"); + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; +}; +var __classPrivateFieldGet6 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); +}; +var _AbstractPage_client; +async function defaultParseResponse(props) { + const { response } = props; + if (props.options.stream) { + debug("response", response.status, response.url, response.headers, response.body); + if (props.options.__streamClass) { + return props.options.__streamClass.fromSSEResponse(response, props.controller); + } + return Stream.fromSSEResponse(response, props.controller); + } + if (response.status === 204) { + return null; + } + if (props.options.__binaryResponse) { + return response; + } + const contentType = response.headers.get("content-type"); + const isJSON = contentType?.includes("application/json") || contentType?.includes("application/vnd.api+json"); + if (isJSON) { + const json = await response.json(); + debug("response", response.status, response.url, response.headers, json); + return json; + } + const text = await response.text(); + debug("response", response.status, response.url, response.headers, text); + return text; +} +var APIPromise = class extends Promise { + constructor(responsePromise, parseResponse = defaultParseResponse) { + super((resolve) => { + resolve(null); + }); + this.responsePromise = responsePromise; + this.parseResponse = parseResponse; + } + _thenUnwrap(transform) { + return new APIPromise(this.responsePromise, async (props) => transform(await this.parseResponse(props))); + } + asResponse() { + return this.responsePromise.then((p3) => p3.response); + } + async withResponse() { + const [data, response] = await Promise.all([this.parse(), this.asResponse()]); + return { data, response }; + } + parse() { + if (!this.parsedPromise) { + this.parsedPromise = this.responsePromise.then(this.parseResponse); + } + return this.parsedPromise; + } + then(onfulfilled, onrejected) { + return this.parse().then(onfulfilled, onrejected); + } + catch(onrejected) { + return this.parse().catch(onrejected); + } + finally(onfinally) { + return this.parse().finally(onfinally); + } +}; +var APIClient = class { + constructor({ + baseURL, + maxRetries = 2, + timeout = 6e5, + httpAgent, + fetch: overridenFetch + }) { + this.baseURL = baseURL; + this.maxRetries = validatePositiveInteger("maxRetries", maxRetries); + this.timeout = validatePositiveInteger("timeout", timeout); + this.httpAgent = httpAgent; + this.fetch = overridenFetch ?? fetch2; + } + authHeaders(opts) { + return {}; + } + defaultHeaders(opts) { + return { + Accept: "application/json", + "Content-Type": "application/json", + "User-Agent": this.getUserAgent(), + ...getPlatformHeaders(), + ...this.authHeaders(opts) + }; + } + validateHeaders(headers, customHeaders) { + } + defaultIdempotencyKey() { + return `stainless-node-retry-${uuid4()}`; + } + get(path2, opts) { + return this.methodRequest("get", path2, opts); + } + post(path2, opts) { + return this.methodRequest("post", path2, opts); + } + patch(path2, opts) { + return this.methodRequest("patch", path2, opts); + } + put(path2, opts) { + return this.methodRequest("put", path2, opts); + } + delete(path2, opts) { + return this.methodRequest("delete", path2, opts); + } + methodRequest(method, path2, opts) { + return this.request(Promise.resolve(opts).then((opts2) => ({ method, path: path2, ...opts2 }))); + } + getAPIList(path2, Page, opts) { + return this.requestAPIList(Page, { method: "get", path: path2, ...opts }); + } + calculateContentLength(body) { + if (typeof body === "string") { + if (typeof Buffer !== "undefined") { + return Buffer.byteLength(body, "utf8").toString(); + } + if (typeof TextEncoder !== "undefined") { + const encoder = new TextEncoder(); + const encoded = encoder.encode(body); + return encoded.length.toString(); + } + } + return null; + } + buildRequest(options) { + const { method, path: path2, query, headers = {} } = options; + const body = isMultipartBody(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null; + const contentLength = this.calculateContentLength(body); + const url2 = this.buildURL(path2, query); + if ("timeout" in options) + validatePositiveInteger("timeout", options.timeout); + const timeout = options.timeout ?? this.timeout; + const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url2); + const minAgentTimeout = timeout + 1e3; + if (typeof httpAgent?.options?.timeout === "number" && minAgentTimeout > (httpAgent.options.timeout ?? 0)) { + httpAgent.options.timeout = minAgentTimeout; + } + if (this.idempotencyHeader && method !== "get") { + if (!options.idempotencyKey) + options.idempotencyKey = this.defaultIdempotencyKey(); + headers[this.idempotencyHeader] = options.idempotencyKey; + } + const reqHeaders = this.buildHeaders({ options, headers, contentLength }); + const req = { + method, + ...body && { body }, + headers: reqHeaders, + ...httpAgent && { agent: httpAgent }, + signal: options.signal ?? null + }; + return { req, url: url2, timeout }; + } + buildHeaders({ options, headers, contentLength }) { + const reqHeaders = {}; + if (contentLength) { + reqHeaders["content-length"] = contentLength; + } + const defaultHeaders = this.defaultHeaders(options); + applyHeadersMut(reqHeaders, defaultHeaders); + applyHeadersMut(reqHeaders, headers); + if (isMultipartBody(options.body) && kind !== "node") { + delete reqHeaders["content-type"]; + } + this.validateHeaders(reqHeaders, headers); + return reqHeaders; + } + async prepareOptions(options) { + } + async prepareRequest(request3, { url: url2, options }) { + } + parseHeaders(headers) { + return !headers ? {} : Symbol.iterator in headers ? Object.fromEntries(Array.from(headers).map((header) => [...header])) : { ...headers }; + } + makeStatusError(status, error, message, headers) { + return APIError.generate(status, error, message, headers); + } + request(options, remainingRetries = null) { + return new APIPromise(this.makeRequest(options, remainingRetries)); + } + async makeRequest(optionsInput, retriesRemaining) { + const options = await optionsInput; + if (retriesRemaining == null) { + retriesRemaining = options.maxRetries ?? this.maxRetries; + } + await this.prepareOptions(options); + const { req, url: url2, timeout } = this.buildRequest(options); + await this.prepareRequest(req, { url: url2, options }); + debug("request", url2, options, req.headers); + if (options.signal?.aborted) { + throw new APIUserAbortError(); + } + const controller = new AbortController(); + const response = await this.fetchWithTimeout(url2, req, timeout, controller).catch(castToError); + if (response instanceof Error) { + if (options.signal?.aborted) { + throw new APIUserAbortError(); + } + if (retriesRemaining) { + return this.retryRequest(options, retriesRemaining); + } + if (response.name === "AbortError") { + throw new APIConnectionTimeoutError(); + } + throw new APIConnectionError({ cause: response }); + } + const responseHeaders = createResponseHeaders(response.headers); + if (!response.ok) { + if (retriesRemaining && this.shouldRetry(response)) { + const retryMessage2 = `retrying, ${retriesRemaining} attempts remaining`; + debug(`response (error; ${retryMessage2})`, response.status, url2, responseHeaders); + return this.retryRequest(options, retriesRemaining, responseHeaders); + } + const errText = await response.text().catch((e3) => castToError(e3).message); + const errJSON = safeJSON(errText); + const errMessage = errJSON ? void 0 : errText; + const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`; + debug(`response (error; ${retryMessage})`, response.status, url2, responseHeaders, errMessage); + const err = this.makeStatusError(response.status, errJSON, errMessage, responseHeaders); + throw err; + } + return { response, options, controller }; + } + requestAPIList(Page, options) { + const request3 = this.makeRequest(options, null); + return new PagePromise(this, request3, Page); + } + buildURL(path2, query) { + const url2 = isAbsoluteURL2(path2) ? new URL(path2) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path2.startsWith("/") ? path2.slice(1) : path2)); + const defaultQuery = this.defaultQuery(); + if (!isEmptyObj(defaultQuery)) { + query = { ...defaultQuery, ...query }; + } + if (typeof query === "object" && query && !Array.isArray(query)) { + url2.search = this.stringifyQuery(query); + } + return url2.toString(); + } + stringifyQuery(query) { + return Object.entries(query).filter(([_3, value]) => typeof value !== "undefined").map(([key, value]) => { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`; + } + if (value === null) { + return `${encodeURIComponent(key)}=`; + } + throw new AnthropicError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`); + }).join("&"); + } + async fetchWithTimeout(url2, init, ms, controller) { + const { signal, ...options } = init || {}; + if (signal) + signal.addEventListener("abort", () => controller.abort()); + const timeout = setTimeout(() => controller.abort(), ms); + return this.getRequestClient().fetch.call(void 0, url2, { signal: controller.signal, ...options }).finally(() => { + clearTimeout(timeout); + }); + } + getRequestClient() { + return { fetch: this.fetch }; + } + shouldRetry(response) { + const shouldRetryHeader = response.headers.get("x-should-retry"); + if (shouldRetryHeader === "true") + return true; + if (shouldRetryHeader === "false") + return false; + if (response.status === 408) + return true; + if (response.status === 409) + return true; + if (response.status === 429) + return true; + if (response.status >= 500) + return true; + return false; + } + async retryRequest(options, retriesRemaining, responseHeaders) { + let timeoutMillis; + const retryAfterMillisHeader = responseHeaders?.["retry-after-ms"]; + if (retryAfterMillisHeader) { + const timeoutMs = parseFloat(retryAfterMillisHeader); + if (!Number.isNaN(timeoutMs)) { + timeoutMillis = timeoutMs; + } + } + const retryAfterHeader = responseHeaders?.["retry-after"]; + if (retryAfterHeader && !timeoutMillis) { + const timeoutSeconds = parseFloat(retryAfterHeader); + if (!Number.isNaN(timeoutSeconds)) { + timeoutMillis = timeoutSeconds * 1e3; + } else { + timeoutMillis = Date.parse(retryAfterHeader) - Date.now(); + } + } + if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1e3)) { + const maxRetries = options.maxRetries ?? this.maxRetries; + timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); + } + await sleep(timeoutMillis); + return this.makeRequest(options, retriesRemaining - 1); + } + calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) { + const initialRetryDelay = 0.5; + const maxRetryDelay = 8; + const numRetries = maxRetries - retriesRemaining; + const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay); + const jitter = 1 - Math.random() * 0.25; + return sleepSeconds * jitter * 1e3; + } + getUserAgent() { + return `${this.constructor.name}/JS ${VERSION3}`; + } +}; +var AbstractPage = class { + constructor(client, response, body, options) { + _AbstractPage_client.set(this, void 0); + __classPrivateFieldSet5(this, _AbstractPage_client, client, "f"); + this.options = options; + this.response = response; + this.body = body; + } + hasNextPage() { + const items = this.getPaginatedItems(); + if (!items.length) + return false; + return this.nextPageInfo() != null; + } + async getNextPage() { + const nextInfo = this.nextPageInfo(); + if (!nextInfo) { + throw new AnthropicError("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`."); + } + const nextOptions = { ...this.options }; + if ("params" in nextInfo && typeof nextOptions.query === "object") { + nextOptions.query = { ...nextOptions.query, ...nextInfo.params }; + } else if ("url" in nextInfo) { + const params = [...Object.entries(nextOptions.query || {}), ...nextInfo.url.searchParams.entries()]; + for (const [key, value] of params) { + nextInfo.url.searchParams.set(key, value); + } + nextOptions.query = void 0; + nextOptions.path = nextInfo.url.toString(); + } + return await __classPrivateFieldGet6(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions); + } + async *iterPages() { + let page = this; + yield page; + while (page.hasNextPage()) { + page = await page.getNextPage(); + yield page; + } + } + async *[(_AbstractPage_client = /* @__PURE__ */ new WeakMap(), Symbol.asyncIterator)]() { + for await (const page of this.iterPages()) { + for (const item of page.getPaginatedItems()) { + yield item; + } + } + } +}; +var PagePromise = class extends APIPromise { + constructor(client, request3, Page) { + super(request3, async (props) => new Page(client, props.response, await defaultParseResponse(props), props.options)); + } + async *[Symbol.asyncIterator]() { + const page = await this; + for await (const item of page) { + yield item; + } + } +}; +var createResponseHeaders = (headers) => { + return new Proxy(Object.fromEntries( + headers.entries() + ), { + get(target, name) { + const key = name.toString(); + return target[key.toLowerCase()] || target[key]; + } + }); +}; +var getPlatformProperties = () => { + if (typeof Deno !== "undefined" && Deno.build != null) { + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": normalizePlatform(Deno.build.os), + "X-Stainless-Arch": normalizeArch(Deno.build.arch), + "X-Stainless-Runtime": "deno", + "X-Stainless-Runtime-Version": typeof Deno.version === "string" ? Deno.version : Deno.version?.deno ?? "unknown" + }; + } + if (typeof EdgeRuntime !== "undefined") { + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": "Unknown", + "X-Stainless-Arch": `other:${EdgeRuntime}`, + "X-Stainless-Runtime": "edge", + "X-Stainless-Runtime-Version": process.version + }; + } + if (Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]") { + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": normalizePlatform(process.platform), + "X-Stainless-Arch": normalizeArch(process.arch), + "X-Stainless-Runtime": "node", + "X-Stainless-Runtime-Version": process.version + }; + } + const browserInfo = getBrowserInfo(); + if (browserInfo) { + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": "Unknown", + "X-Stainless-Arch": "unknown", + "X-Stainless-Runtime": `browser:${browserInfo.browser}`, + "X-Stainless-Runtime-Version": browserInfo.version + }; + } + return { + "X-Stainless-Lang": "js", + "X-Stainless-Package-Version": VERSION3, + "X-Stainless-OS": "Unknown", + "X-Stainless-Arch": "unknown", + "X-Stainless-Runtime": "unknown", + "X-Stainless-Runtime-Version": "unknown" + }; +}; +function getBrowserInfo() { + if (typeof navigator === "undefined" || !navigator) { + return null; + } + const browserPatterns = [ + { key: "edge", pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "ie", pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "ie", pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "chrome", pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "firefox", pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: "safari", pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ } + ]; + for (const { key, pattern } of browserPatterns) { + const match = pattern.exec(navigator.userAgent); + if (match) { + const major = match[1] || 0; + const minor = match[2] || 0; + const patch = match[3] || 0; + return { browser: key, version: `${major}.${minor}.${patch}` }; + } + } + return null; +} +var normalizeArch = (arch2) => { + if (arch2 === "x32") + return "x32"; + if (arch2 === "x86_64" || arch2 === "x64") + return "x64"; + if (arch2 === "arm") + return "arm"; + if (arch2 === "aarch64" || arch2 === "arm64") + return "arm64"; + if (arch2) + return `other:${arch2}`; + return "unknown"; +}; +var normalizePlatform = (platform) => { + platform = platform.toLowerCase(); + if (platform.includes("ios")) + return "iOS"; + if (platform === "android") + return "Android"; + if (platform === "darwin") + return "MacOS"; + if (platform === "win32") + return "Windows"; + if (platform === "freebsd") + return "FreeBSD"; + if (platform === "openbsd") + return "OpenBSD"; + if (platform === "linux") + return "Linux"; + if (platform) + return `Other:${platform}`; + return "Unknown"; +}; +var _platformHeaders; +var getPlatformHeaders = () => { + return _platformHeaders ?? (_platformHeaders = getPlatformProperties()); +}; +var safeJSON = (text) => { + try { + return JSON.parse(text); + } catch (err) { + return void 0; + } +}; +var startsWithSchemeRegexp = new RegExp("^(?:[a-z]+:)?//", "i"); +var isAbsoluteURL2 = (url2) => { + return startsWithSchemeRegexp.test(url2); +}; +var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); +var validatePositiveInteger = (name, n2) => { + if (typeof n2 !== "number" || !Number.isInteger(n2)) { + throw new AnthropicError(`${name} must be an integer`); + } + if (n2 < 0) { + throw new AnthropicError(`${name} must be a positive integer`); + } + return n2; +}; +var castToError = (err) => { + if (err instanceof Error) + return err; + return new Error(err); +}; +var readEnv = (env2) => { + if (typeof process !== "undefined") { + return process.env?.[env2]?.trim() ?? void 0; + } + if (typeof Deno !== "undefined") { + return Deno.env?.get?.(env2)?.trim(); + } + return void 0; +}; +function isEmptyObj(obj) { + if (!obj) + return true; + for (const _k in obj) + return false; + return true; +} +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} +function applyHeadersMut(targetHeaders, newHeaders) { + for (const k4 in newHeaders) { + if (!hasOwn(newHeaders, k4)) + continue; + const lowerKey = k4.toLowerCase(); + if (!lowerKey) + continue; + const val = newHeaders[k4]; + if (val === null) { + delete targetHeaders[lowerKey]; + } else if (val !== void 0) { + targetHeaders[lowerKey] = val; + } + } +} +function debug(action, ...args) { + if (typeof process !== "undefined" && process?.env?.["DEBUG"] === "true") { + console.log(`Anthropic:DEBUG:${action}`, ...args); + } +} +var uuid4 = () => { + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => { + const r3 = Math.random() * 16 | 0; + const v2 = c2 === "x" ? r3 : r3 & 3 | 8; + return v2.toString(16); + }); +}; + +// node_modules/@anthropic-ai/sdk/resource.mjs +var APIResource = class { + constructor(client) { + this._client = client; + } +}; + +// node_modules/@anthropic-ai/sdk/resources/completions.mjs +var Completions = class extends APIResource { + create(body, options) { + return this._client.post("/v1/complete", { + body, + timeout: 6e5, + ...options, + stream: body.stream ?? false + }); + } +}; +(function(Completions2) { +})(Completions || (Completions = {})); + +// node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +var __classPrivateFieldSet6 = function(receiver, state2, value, kind2, f4) { + if (kind2 === "m") + throw new TypeError("Private method is not writable"); + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; +}; +var __classPrivateFieldGet7 = function(receiver, state2, kind2, f4) { + if (kind2 === "a" && !f4) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); +}; +var _MessageStream_instances; +var _MessageStream_currentMessageSnapshot; +var _MessageStream_connectedPromise; +var _MessageStream_resolveConnectedPromise; +var _MessageStream_rejectConnectedPromise; +var _MessageStream_endPromise; +var _MessageStream_resolveEndPromise; +var _MessageStream_rejectEndPromise; +var _MessageStream_listeners; +var _MessageStream_ended; +var _MessageStream_errored; +var _MessageStream_aborted; +var _MessageStream_catchingPromiseCreated; +var _MessageStream_getFinalMessage; +var _MessageStream_getFinalText; +var _MessageStream_handleError; +var _MessageStream_beginRequest; +var _MessageStream_addStreamEvent; +var _MessageStream_endRequest; +var _MessageStream_accumulateMessage; +var MessageStream = class { + constructor() { + _MessageStream_instances.add(this); + this.messages = []; + this.receivedMessages = []; + _MessageStream_currentMessageSnapshot.set(this, void 0); + this.controller = new AbortController(); + _MessageStream_connectedPromise.set(this, void 0); + _MessageStream_resolveConnectedPromise.set(this, () => { + }); + _MessageStream_rejectConnectedPromise.set(this, () => { + }); + _MessageStream_endPromise.set(this, void 0); + _MessageStream_resolveEndPromise.set(this, () => { + }); + _MessageStream_rejectEndPromise.set(this, () => { + }); + _MessageStream_listeners.set(this, {}); + _MessageStream_ended.set(this, false); + _MessageStream_errored.set(this, false); + _MessageStream_aborted.set(this, false); + _MessageStream_catchingPromiseCreated.set(this, false); + _MessageStream_handleError.set(this, (error) => { + __classPrivateFieldSet6(this, _MessageStream_errored, true, "f"); + if (error instanceof Error && error.name === "AbortError") { + error = new APIUserAbortError(); + } + if (error instanceof APIUserAbortError) { + __classPrivateFieldSet6(this, _MessageStream_aborted, true, "f"); + return this._emit("abort", error); + } + if (error instanceof AnthropicError) { + return this._emit("error", error); + } + if (error instanceof Error) { + const anthropicError = new AnthropicError(error.message); + anthropicError.cause = error; + return this._emit("error", anthropicError); + } + return this._emit("error", new AnthropicError(String(error))); + }); + __classPrivateFieldSet6(this, _MessageStream_connectedPromise, new Promise((resolve, reject) => { + __classPrivateFieldSet6(this, _MessageStream_resolveConnectedPromise, resolve, "f"); + __classPrivateFieldSet6(this, _MessageStream_rejectConnectedPromise, reject, "f"); + }), "f"); + __classPrivateFieldSet6(this, _MessageStream_endPromise, new Promise((resolve, reject) => { + __classPrivateFieldSet6(this, _MessageStream_resolveEndPromise, resolve, "f"); + __classPrivateFieldSet6(this, _MessageStream_rejectEndPromise, reject, "f"); + }), "f"); + __classPrivateFieldGet7(this, _MessageStream_connectedPromise, "f").catch(() => { + }); + __classPrivateFieldGet7(this, _MessageStream_endPromise, "f").catch(() => { + }); + } + static fromReadableStream(stream4) { + const runner = new MessageStream(); + runner._run(() => runner._fromReadableStream(stream4)); + return runner; + } + static createMessage(messages, params, options) { + const runner = new MessageStream(); + for (const message of params.messages) { + runner._addMessageParam(message); + } + runner._run(() => runner._createMessage(messages, { ...params, stream: true }, { ...options, headers: { ...options?.headers, "X-Stainless-Helper-Method": "stream" } })); + return runner; + } + _run(executor) { + executor().then(() => { + this._emitFinal(); + this._emit("end"); + }, __classPrivateFieldGet7(this, _MessageStream_handleError, "f")); + } + _addMessageParam(message) { + this.messages.push(message); + } + _addMessage(message, emit = true) { + this.receivedMessages.push(message); + if (emit) { + this._emit("message", message); + } + } + async _createMessage(messages, params, options) { + const signal = options?.signal; + if (signal) { + if (signal.aborted) + this.controller.abort(); + signal.addEventListener("abort", () => this.controller.abort()); + } + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_beginRequest).call(this); + const stream4 = await messages.create({ ...params, stream: true }, { ...options, signal: this.controller.signal }); + this._connected(); + for await (const event of stream4) { + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_addStreamEvent).call(this, event); + } + if (stream4.controller.signal?.aborted) { + throw new APIUserAbortError(); + } + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_endRequest).call(this); + } + _connected() { + if (this.ended) + return; + __classPrivateFieldGet7(this, _MessageStream_resolveConnectedPromise, "f").call(this); + this._emit("connect"); + } + get ended() { + return __classPrivateFieldGet7(this, _MessageStream_ended, "f"); + } + get errored() { + return __classPrivateFieldGet7(this, _MessageStream_errored, "f"); + } + get aborted() { + return __classPrivateFieldGet7(this, _MessageStream_aborted, "f"); + } + abort() { + this.controller.abort(); + } + on(event, listener) { + const listeners = __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] = []); + listeners.push({ listener }); + return this; + } + off(event, listener) { + const listeners = __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event]; + if (!listeners) + return this; + const index = listeners.findIndex((l3) => l3.listener === listener); + if (index >= 0) + listeners.splice(index, 1); + return this; + } + once(event, listener) { + const listeners = __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] = []); + listeners.push({ listener, once: true }); + return this; + } + emitted(event) { + return new Promise((resolve, reject) => { + __classPrivateFieldSet6(this, _MessageStream_catchingPromiseCreated, true, "f"); + if (event !== "error") + this.once("error", reject); + this.once(event, resolve); + }); + } + async done() { + __classPrivateFieldSet6(this, _MessageStream_catchingPromiseCreated, true, "f"); + await __classPrivateFieldGet7(this, _MessageStream_endPromise, "f"); + } + get currentMessage() { + return __classPrivateFieldGet7(this, _MessageStream_currentMessageSnapshot, "f"); + } + async finalMessage() { + await this.done(); + return __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_getFinalMessage).call(this); + } + async finalText() { + await this.done(); + return __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_getFinalText).call(this); + } + _emit(event, ...args) { + if (__classPrivateFieldGet7(this, _MessageStream_ended, "f")) + return; + if (event === "end") { + __classPrivateFieldSet6(this, _MessageStream_ended, true, "f"); + __classPrivateFieldGet7(this, _MessageStream_resolveEndPromise, "f").call(this); + } + const listeners = __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event]; + if (listeners) { + __classPrivateFieldGet7(this, _MessageStream_listeners, "f")[event] = listeners.filter((l3) => !l3.once); + listeners.forEach(({ listener }) => listener(...args)); + } + if (event === "abort") { + const error = args[0]; + if (!__classPrivateFieldGet7(this, _MessageStream_catchingPromiseCreated, "f") && !listeners?.length) { + Promise.reject(error); + } + __classPrivateFieldGet7(this, _MessageStream_rejectConnectedPromise, "f").call(this, error); + __classPrivateFieldGet7(this, _MessageStream_rejectEndPromise, "f").call(this, error); + this._emit("end"); + return; + } + if (event === "error") { + const error = args[0]; + if (!__classPrivateFieldGet7(this, _MessageStream_catchingPromiseCreated, "f") && !listeners?.length) { + Promise.reject(error); + } + __classPrivateFieldGet7(this, _MessageStream_rejectConnectedPromise, "f").call(this, error); + __classPrivateFieldGet7(this, _MessageStream_rejectEndPromise, "f").call(this, error); + this._emit("end"); + } + } + _emitFinal() { + const finalMessage = this.receivedMessages.at(-1); + if (finalMessage) { + this._emit("finalMessage", __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_getFinalMessage).call(this)); + } + } + async _fromReadableStream(readableStream, options) { + const signal = options?.signal; + if (signal) { + if (signal.aborted) + this.controller.abort(); + signal.addEventListener("abort", () => this.controller.abort()); + } + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_beginRequest).call(this); + this._connected(); + const stream4 = Stream.fromReadableStream(readableStream, this.controller); + for await (const event of stream4) { + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_addStreamEvent).call(this, event); + } + if (stream4.controller.signal?.aborted) { + throw new APIUserAbortError(); + } + __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_endRequest).call(this); + } + [(_MessageStream_currentMessageSnapshot = /* @__PURE__ */ new WeakMap(), _MessageStream_connectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_resolveConnectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_rejectConnectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_endPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_resolveEndPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_rejectEndPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_listeners = /* @__PURE__ */ new WeakMap(), _MessageStream_ended = /* @__PURE__ */ new WeakMap(), _MessageStream_errored = /* @__PURE__ */ new WeakMap(), _MessageStream_aborted = /* @__PURE__ */ new WeakMap(), _MessageStream_catchingPromiseCreated = /* @__PURE__ */ new WeakMap(), _MessageStream_handleError = /* @__PURE__ */ new WeakMap(), _MessageStream_instances = /* @__PURE__ */ new WeakSet(), _MessageStream_getFinalMessage = function _MessageStream_getFinalMessage2() { + if (this.receivedMessages.length === 0) { + throw new AnthropicError("stream ended without producing a Message with role=assistant"); + } + return this.receivedMessages.at(-1); + }, _MessageStream_getFinalText = function _MessageStream_getFinalText2() { + if (this.receivedMessages.length === 0) { + throw new AnthropicError("stream ended without producing a Message with role=assistant"); + } + const textBlocks = this.receivedMessages.at(-1).content.filter((block) => block.type === "text").map((block) => block.text); + if (textBlocks.length === 0) { + throw new AnthropicError("stream ended without producing a content block with type=text"); + } + return textBlocks.join(" "); + }, _MessageStream_beginRequest = function _MessageStream_beginRequest2() { + if (this.ended) + return; + __classPrivateFieldSet6(this, _MessageStream_currentMessageSnapshot, void 0, "f"); + }, _MessageStream_addStreamEvent = function _MessageStream_addStreamEvent2(event) { + if (this.ended) + return; + const messageSnapshot = __classPrivateFieldGet7(this, _MessageStream_instances, "m", _MessageStream_accumulateMessage).call(this, event); + this._emit("streamEvent", event, messageSnapshot); + switch (event.type) { + case "content_block_delta": { + if (event.delta.type === "text_delta") { + this._emit("text", event.delta.text, messageSnapshot.content.at(-1).text || ""); + } + break; + } + case "message_stop": { + this._addMessageParam(messageSnapshot); + this._addMessage(messageSnapshot, true); + break; + } + case "content_block_stop": { + this._emit("contentBlock", messageSnapshot.content.at(-1)); + break; + } + case "message_start": { + __classPrivateFieldSet6(this, _MessageStream_currentMessageSnapshot, messageSnapshot, "f"); + break; + } + case "content_block_start": + case "message_delta": + break; + } + }, _MessageStream_endRequest = function _MessageStream_endRequest2() { + if (this.ended) { + throw new AnthropicError(`stream has ended, this shouldn't happen`); + } + const snapshot = __classPrivateFieldGet7(this, _MessageStream_currentMessageSnapshot, "f"); + if (!snapshot) { + throw new AnthropicError(`request ended without sending any chunks`); + } + __classPrivateFieldSet6(this, _MessageStream_currentMessageSnapshot, void 0, "f"); + return snapshot; + }, _MessageStream_accumulateMessage = function _MessageStream_accumulateMessage2(event) { + let snapshot = __classPrivateFieldGet7(this, _MessageStream_currentMessageSnapshot, "f"); + if (event.type === "message_start") { + if (snapshot) { + throw new AnthropicError(`Unexpected event order, got ${event.type} before receiving "message_stop"`); + } + return event.message; + } + if (!snapshot) { + throw new AnthropicError(`Unexpected event order, got ${event.type} before "message_start"`); + } + switch (event.type) { + case "message_stop": + return snapshot; + case "message_delta": + snapshot.stop_reason = event.delta.stop_reason; + snapshot.stop_sequence = event.delta.stop_sequence; + snapshot.usage.output_tokens = event.usage.output_tokens; + return snapshot; + case "content_block_start": + snapshot.content.push(event.content_block); + return snapshot; + case "content_block_delta": { + const snapshotContent = snapshot.content.at(event.index); + if (snapshotContent?.type === "text" && event.delta.type === "text_delta") { + snapshotContent.text += event.delta.text; + } + return snapshot; + } + case "content_block_stop": + return snapshot; + } + }, Symbol.asyncIterator)]() { + const pushQueue = []; + const readQueue = []; + let done = false; + this.on("streamEvent", (event) => { + const reader = readQueue.shift(); + if (reader) { + reader.resolve(event); + } else { + pushQueue.push(event); + } + }); + this.on("end", () => { + done = true; + for (const reader of readQueue) { + reader.resolve(void 0); + } + readQueue.length = 0; + }); + this.on("abort", (err) => { + done = true; + for (const reader of readQueue) { + reader.reject(err); + } + readQueue.length = 0; + }); + this.on("error", (err) => { + done = true; + for (const reader of readQueue) { + reader.reject(err); + } + readQueue.length = 0; + }); + return { + next: async () => { + if (!pushQueue.length) { + if (done) { + return { value: void 0, done: true }; + } + return new Promise((resolve, reject) => readQueue.push({ resolve, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true }); + } + const chunk = pushQueue.shift(); + return { value: chunk, done: false }; + }, + return: async () => { + this.abort(); + return { value: void 0, done: true }; + } + }; + } + toReadableStream() { + const stream4 = new Stream(this[Symbol.asyncIterator].bind(this), this.controller); + return stream4.toReadableStream(); + } +}; + +// node_modules/@anthropic-ai/sdk/resources/messages.mjs +var Messages = class extends APIResource { + create(body, options) { + return this._client.post("/v1/messages", { + body, + timeout: 6e5, + ...options, + stream: body.stream ?? false + }); + } + stream(body, options) { + return MessageStream.createMessage(this, body, options); + } +}; +(function(Messages2) { +})(Messages || (Messages = {})); + +// node_modules/@anthropic-ai/sdk/index.mjs +var _a; +var Anthropic = class extends APIClient { + constructor({ baseURL = readEnv("ANTHROPIC_BASE_URL"), apiKey: apiKey4 = readEnv("ANTHROPIC_API_KEY") ?? null, authToken = readEnv("ANTHROPIC_AUTH_TOKEN") ?? null, ...opts } = {}) { + const options = { + apiKey: apiKey4, + authToken, + ...opts, + baseURL: baseURL || `https://api.anthropic.com` + }; + super({ + baseURL: options.baseURL, + timeout: options.timeout ?? 6e5, + httpAgent: options.httpAgent, + maxRetries: options.maxRetries, + fetch: options.fetch + }); + this.completions = new Completions(this); + this.messages = new Messages(this); + this._options = options; + this.apiKey = apiKey4; + this.authToken = authToken; + } + defaultQuery() { + return this._options.defaultQuery; + } + defaultHeaders(opts) { + return { + ...super.defaultHeaders(opts), + "anthropic-version": "2023-06-01", + ...this._options.defaultHeaders + }; + } + validateHeaders(headers, customHeaders) { + if (this.apiKey && headers["x-api-key"]) { + return; + } + if (customHeaders["x-api-key"] === null) { + return; + } + if (this.authToken && headers["authorization"]) { + return; + } + if (customHeaders["authorization"] === null) { + return; + } + throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted'); + } + authHeaders(opts) { + const apiKeyAuth = this.apiKeyAuth(opts); + const bearerAuth = this.bearerAuth(opts); + if (apiKeyAuth != null && !isEmptyObj(apiKeyAuth)) { + return apiKeyAuth; + } + if (bearerAuth != null && !isEmptyObj(bearerAuth)) { + return bearerAuth; + } + return {}; + } + apiKeyAuth(opts) { + if (this.apiKey == null) { + return {}; + } + return { "X-Api-Key": this.apiKey }; + } + bearerAuth(opts) { + if (this.authToken == null) { + return {}; + } + return { Authorization: `Bearer ${this.authToken}` }; + } +}; +_a = Anthropic; +Anthropic.Anthropic = _a; +Anthropic.HUMAN_PROMPT = "\n\nHuman:"; +Anthropic.AI_PROMPT = "\n\nAssistant:"; +Anthropic.AnthropicError = AnthropicError; +Anthropic.APIError = APIError; +Anthropic.APIConnectionError = APIConnectionError; +Anthropic.APIConnectionTimeoutError = APIConnectionTimeoutError; +Anthropic.APIUserAbortError = APIUserAbortError; +Anthropic.NotFoundError = NotFoundError; +Anthropic.ConflictError = ConflictError; +Anthropic.RateLimitError = RateLimitError; +Anthropic.BadRequestError = BadRequestError; +Anthropic.AuthenticationError = AuthenticationError; +Anthropic.InternalServerError = InternalServerError; +Anthropic.PermissionDeniedError = PermissionDeniedError; +Anthropic.UnprocessableEntityError = UnprocessableEntityError; +var { HUMAN_PROMPT, AI_PROMPT } = Anthropic; +var { AnthropicError: AnthropicError2, APIError: APIError2, APIConnectionError: APIConnectionError2, APIConnectionTimeoutError: APIConnectionTimeoutError2, APIUserAbortError: APIUserAbortError2, NotFoundError: NotFoundError2, ConflictError: ConflictError2, RateLimitError: RateLimitError2, BadRequestError: BadRequestError2, AuthenticationError: AuthenticationError2, InternalServerError: InternalServerError2, PermissionDeniedError: PermissionDeniedError2, UnprocessableEntityError: UnprocessableEntityError2 } = error_exports; +(function(Anthropic2) { + Anthropic2.toFile = toFile; + Anthropic2.fileFromPath = fileFromPath; + Anthropic2.Completions = Completions; + Anthropic2.Messages = Messages; +})(Anthropic || (Anthropic = {})); +var sdk_default = Anthropic; + +// src/engine/anthropic.ts +var config5 = getConfig(); +var MAX_TOKENS_OUTPUT2 = config5?.OCO_TOKENS_MAX_OUTPUT || 500 /* DEFAULT_MAX_TOKENS_OUTPUT */; +var MAX_TOKENS_INPUT2 = config5?.OCO_TOKENS_MAX_INPUT || 4096 /* DEFAULT_MAX_TOKENS_INPUT */; +var provider2 = config5?.OCO_AI_PROVIDER; +var apiKey2 = config5?.OCO_ANTHROPIC_API_KEY; +var [command2, mode2] = process.argv.slice(2); +if (provider2 === "anthropic" && !apiKey2 && command2 !== "config" && mode2 !== "set" /* set */) { + ae("opencommit"); + ce( + "OCO_ANTHROPIC_API_KEY is not set, please run `oco config set OCO_ANTHROPIC_API_KEY= . If you are using Claude, make sure you add payment details, so API works.`" + ); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + process.exit(1); +} +var MODEL2 = config5?.OCO_MODEL; +if (provider2 === "anthropic" && !MODEL_LIST.anthropic.includes(MODEL2) && command2 !== "config" && mode2 !== "set" /* set */) { + ce( + `${source_default.red("\u2716")} Unsupported model ${MODEL2} for Anthropic. Supported models are: ${MODEL_LIST.anthropic.join( + ", " + )}` + ); + process.exit(1); +} +var AnthropicAi = class { + constructor() { + this.anthropicAiApiConfiguration = { + apiKey: apiKey2 + }; + this.generateCommitMessage = async (messages) => { + const systemMessage = messages.find((msg) => msg.role === "system")?.content; + const restMessages = messages.filter((msg) => msg.role !== "system"); + const params = { + model: MODEL2, + system: systemMessage, + messages: restMessages, + temperature: 0, + top_p: 0.1, + max_tokens: MAX_TOKENS_OUTPUT2 + }; + try { + const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a3, b3) => a3 + b3, 0); + if (REQUEST_TOKENS > MAX_TOKENS_INPUT2 - MAX_TOKENS_OUTPUT2) { + throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); + } + const data = await this.anthropicAI.messages.create(params); + const message = data?.content[0].text; + return message; + } catch (error) { + ce(`${source_default.red("\u2716")} ${JSON.stringify(params)}`); + const err = error; + ce(`${source_default.red("\u2716")} ${err?.message || err}`); + if (axios_default.isAxiosError(error) && error.response?.status === 401) { + const anthropicAiError = error.response.data.error; + if (anthropicAiError?.message) + ce(anthropicAiError.message); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + } + throw err; + } + }; + this.anthropicAI = new sdk_default(this.anthropicAiApiConfiguration); + } +}; // node_modules/@azure/core-auth/dist/esm/azureKeyCredential.js var AzureKeyCredential = class { @@ -53092,19 +56180,19 @@ function getErrorMessage(e3) { // node_modules/@azure/core-util/dist/esm/uuidUtils.js var import_crypto2 = require("crypto"); -var _a; -var uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function" ? globalThis.crypto.randomUUID.bind(globalThis.crypto) : import_crypto2.randomUUID; +var _a2; +var uuidFunction = typeof ((_a2 = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a2 === void 0 ? void 0 : _a2.randomUUID) === "function" ? globalThis.crypto.randomUUID.bind(globalThis.crypto) : import_crypto2.randomUUID; function randomUUID() { return uuidFunction(); } // node_modules/@azure/core-util/dist/esm/checkEnvironment.js -var _a2; +var _a3; var _b; var _c; var _d; var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; -var isWebWorker = typeof self === "object" && typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" && (((_a2 = self.constructor) === null || _a2 === void 0 ? void 0 : _a2.name) === "DedicatedWorkerGlobalScope" || ((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" || ((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope"); +var isWebWorker = typeof self === "object" && typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" && (((_a3 = self.constructor) === null || _a3 === void 0 ? void 0 : _a3.name) === "DedicatedWorkerGlobalScope" || ((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" || ((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope"); var isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined"; var isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; var isNodeLike = typeof globalThis.process !== "undefined" && Boolean(globalThis.process.version) && Boolean((_d = globalThis.process.versions) === null || _d === void 0 ? void 0 : _d.node); @@ -53144,15 +56232,15 @@ var { __spread, __spreadArrays, __spreadArray, - __await, - __asyncGenerator, + __await: __await2, + __asyncGenerator: __asyncGenerator2, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, + __classPrivateFieldGet: __classPrivateFieldGet8, + __classPrivateFieldSet: __classPrivateFieldSet7, __classPrivateFieldIn, __addDisposableResource, __disposeResources @@ -53744,10 +56832,10 @@ function userAgentPolicy(options = {}) { } // node_modules/@azure/core-rest-pipeline/dist/esm/util/concat.js -var import_node_stream = require("node:stream"); +var import_node_stream2 = require("node:stream"); // node_modules/@azure/core-rest-pipeline/dist/esm/util/typeGuards.js -function isBlob2(x2) { +function isBlob3(x2) { return typeof x2.stream === "function"; } @@ -53785,15 +56873,15 @@ function createFile(content, name, options = {}) { // node_modules/@azure/core-rest-pipeline/dist/esm/util/concat.js function streamAsyncIterator() { - return __asyncGenerator(this, arguments, function* streamAsyncIterator_1() { + return __asyncGenerator2(this, arguments, function* streamAsyncIterator_1() { const reader = this.getReader(); try { while (true) { - const { done, value } = yield __await(reader.read()); + const { done, value } = yield __await2(reader.read()); if (done) { - return yield __await(void 0); + return yield __await2(void 0); } - yield yield __await(value); + yield yield __await2(value); } } finally { reader.releaseLock(); @@ -53811,15 +56899,15 @@ function makeAsyncIterable(webStream) { function ensureNodeStream(stream4) { if (stream4 instanceof ReadableStream) { makeAsyncIterable(stream4); - return import_node_stream.Readable.fromWeb(stream4); + return import_node_stream2.Readable.fromWeb(stream4); } else { return stream4; } } function toStream(source) { if (source instanceof Uint8Array) { - return import_node_stream.Readable.from(Buffer.from(source)); - } else if (isBlob2(source)) { + return import_node_stream2.Readable.from(Buffer.from(source)); + } else if (isBlob3(source)) { return toStream(getRawContent(source)); } else { return ensureNodeStream(source); @@ -53828,23 +56916,23 @@ function toStream(source) { async function concat(sources) { return function() { const streams = sources.map((x2) => typeof x2 === "function" ? x2() : x2).map(toStream); - return import_node_stream.Readable.from(function() { - return __asyncGenerator(this, arguments, function* () { + return import_node_stream2.Readable.from(function() { + return __asyncGenerator2(this, arguments, function* () { var _a4, e_1, _b2, _c2; for (const stream4 of streams) { try { - for (var _d2 = true, stream_1 = (e_1 = void 0, __asyncValues(stream4)), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a4 = stream_1_1.done, !_a4; _d2 = true) { + for (var _d2 = true, stream_1 = (e_1 = void 0, __asyncValues(stream4)), stream_1_1; stream_1_1 = yield __await2(stream_1.next()), _a4 = stream_1_1.done, !_a4; _d2 = true) { _c2 = stream_1_1.value; _d2 = false; const chunk = _c2; - yield yield __await(chunk); + yield yield __await2(chunk); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (!_d2 && !_a4 && (_b2 = stream_1.return)) - yield __await(_b2.call(stream_1)); + yield __await2(_b2.call(stream_1)); } finally { if (e_1) throw e_1.error; @@ -53871,7 +56959,7 @@ function encodeHeaders(headers) { function getLength(source) { if (source instanceof Uint8Array) { return source.byteLength; - } else if (isBlob2(source)) { + } else if (isBlob3(source)) { return source.size === -1 ? void 0 : source.size; } else { return void 0; @@ -54747,7 +57835,7 @@ function createPipelineFromOptions(options) { var http2 = __toESM(require("node:http"), 1); var https2 = __toESM(require("node:https"), 1); var zlib2 = __toESM(require("node:zlib"), 1); -var import_node_stream2 = require("node:stream"); +var import_node_stream3 = require("node:stream"); var DEFAULT_TLS_SETTINGS = {}; function isReadableStream(body) { return body && typeof body.pipe === "function"; @@ -54762,7 +57850,7 @@ function isStreamComplete(stream4) { function isArrayBuffer2(body) { return body && typeof body.byteLength === "number"; } -var ReportTransform = class extends import_node_stream2.Transform { +var ReportTransform = class extends import_node_stream3.Transform { _transform(chunk, _encoding, callback) { this.push(chunk); this.loadedBytes += chunk.length; @@ -56049,20 +59137,20 @@ function isReadableStream3(body) { return Boolean(body && typeof body.getReader === "function" && typeof body.tee === "function"); } function toAsyncIterable(stream4) { - return __asyncGenerator(this, arguments, function* toAsyncIterable_1() { + return __asyncGenerator2(this, arguments, function* toAsyncIterable_1() { const reader = stream4.getReader(); try { while (true) { - const { value, done } = yield __await(reader.read()); + const { value, done } = yield __await2(reader.read()); if (done) { - return yield __await(void 0); + return yield __await2(void 0); } - yield yield __await(value); + yield yield __await2(value); } } finally { const cancelPromise = reader.cancel(); reader.releaseLock(); - yield __await(cancelPromise); + yield __await2(cancelPromise); } }); } @@ -56095,14 +59183,14 @@ function createMessage() { }; } function toLine(chunkIter) { - return __asyncGenerator(this, arguments, function* toLine_1() { + return __asyncGenerator2(this, arguments, function* toLine_1() { var _a4, e_1, _b2, _c2; let buf; let bufIdx = 0; let fieldLen = -1; let discardTrailingNewline = false; try { - for (var _d2 = true, chunkIter_1 = __asyncValues(chunkIter), chunkIter_1_1; chunkIter_1_1 = yield __await(chunkIter_1.next()), _a4 = chunkIter_1_1.done, !_a4; _d2 = true) { + for (var _d2 = true, chunkIter_1 = __asyncValues(chunkIter), chunkIter_1_1; chunkIter_1_1 = yield __await2(chunkIter_1.next()), _a4 = chunkIter_1_1.done, !_a4; _d2 = true) { _c2 = chunkIter_1_1.value; _d2 = false; const chunk = _c2; @@ -56142,7 +59230,7 @@ function toLine(chunkIter) { if (end === -1) { break; } - yield yield __await({ line: buf.subarray(start, end), fieldLen }); + yield yield __await2({ line: buf.subarray(start, end), fieldLen }); start = bufIdx; fieldLen = -1; } @@ -56158,7 +59246,7 @@ function toLine(chunkIter) { } finally { try { if (!_d2 && !_a4 && (_b2 = chunkIter_1.return)) - yield __await(_b2.call(chunkIter_1)); + yield __await2(_b2.call(chunkIter_1)); } finally { if (e_1) throw e_1.error; @@ -56167,17 +59255,17 @@ function toLine(chunkIter) { }); } function toMessage(lineIter) { - return __asyncGenerator(this, arguments, function* toMessage_1() { + return __asyncGenerator2(this, arguments, function* toMessage_1() { var _a4, e_2, _b2, _c2; let message = createMessage(); const decoder = new TextDecoder(); try { - for (var _d2 = true, lineIter_1 = __asyncValues(lineIter), lineIter_1_1; lineIter_1_1 = yield __await(lineIter_1.next()), _a4 = lineIter_1_1.done, !_a4; _d2 = true) { + for (var _d2 = true, lineIter_1 = __asyncValues(lineIter), lineIter_1_1; lineIter_1_1 = yield __await2(lineIter_1.next()), _a4 = lineIter_1_1.done, !_a4; _d2 = true) { _c2 = lineIter_1_1.value; _d2 = false; const { line, fieldLen } = _c2; if (line.length === 0 && message.data !== void 0) { - yield yield __await(message); + yield yield __await2(message); message = createMessage(); } else if (fieldLen > 0) { const field = decoder.decode(line.subarray(0, fieldLen)); @@ -56208,7 +59296,7 @@ function toMessage(lineIter) { } finally { try { if (!_d2 && !_a4 && (_b2 = lineIter_1.return)) - yield __await(_b2.call(lineIter_1)); + yield __await2(_b2.call(lineIter_1)); } finally { if (e_2) throw e_2.error; @@ -56231,20 +59319,20 @@ function makeAsyncIterable3(webStream) { } } function toAsyncIterable2(stream4) { - return __asyncGenerator(this, arguments, function* toAsyncIterable_1() { + return __asyncGenerator2(this, arguments, function* toAsyncIterable_1() { const reader = stream4.getReader(); try { while (true) { - const { value, done } = yield __await(reader.read()); + const { value, done } = yield __await2(reader.read()); if (done) { - return yield __await(void 0); + return yield __await2(void 0); } - yield yield __await(value); + yield yield __await2(value); } } finally { const cancelPromise = reader.cancel(); reader.releaseLock(); - yield __await(cancelPromise); + yield __await2(cancelPromise); } }); } @@ -56682,15 +59770,15 @@ var OpenAIClient = class { }; // src/engine/azure.ts -var config5 = getConfig(); -var MAX_TOKENS_OUTPUT2 = config5?.OCO_TOKENS_MAX_OUTPUT || 500 /* DEFAULT_MAX_TOKENS_OUTPUT */; -var MAX_TOKENS_INPUT2 = config5?.OCO_TOKENS_MAX_INPUT || 4096 /* DEFAULT_MAX_TOKENS_INPUT */; -var basePath2 = config5?.OCO_OPENAI_BASE_PATH; -var apiKey2 = config5?.OCO_AZURE_API_KEY; -var apiEndpoint = config5?.OCO_AZURE_ENDPOINT; -var [command2, mode2] = process.argv.slice(2); -var provider2 = config5?.OCO_AI_PROVIDER; -if (provider2 === "azure" && !apiKey2 && !apiEndpoint && command2 !== "config" && mode2 !== "set" /* set */) { +var config6 = getConfig(); +var MAX_TOKENS_OUTPUT3 = config6?.OCO_TOKENS_MAX_OUTPUT || 500 /* DEFAULT_MAX_TOKENS_OUTPUT */; +var MAX_TOKENS_INPUT3 = config6?.OCO_TOKENS_MAX_INPUT || 4096 /* DEFAULT_MAX_TOKENS_INPUT */; +var basePath2 = config6?.OCO_OPENAI_BASE_PATH; +var apiKey3 = config6?.OCO_AZURE_API_KEY; +var apiEndpoint = config6?.OCO_AZURE_ENDPOINT; +var [command3, mode3] = process.argv.slice(2); +var provider3 = config6?.OCO_AI_PROVIDER; +if (provider3 === "azure" && !apiKey3 && !apiEndpoint && command3 !== "config" && mode3 !== "set" /* set */) { ae("opencommit"); ce( "OCO_AZURE_API_KEY or OCO_AZURE_ENDPOINT are not set, please run `oco config set OCO_AZURE_API_KEY= . If you are using GPT, make sure you add payment details, so API works.`" @@ -56700,2228 +59788,63 @@ if (provider2 === "azure" && !apiKey2 && !apiEndpoint && command2 !== "config" & ); process.exit(1); } -var MODEL2 = config5?.OCO_MODEL || "gpt-3.5-turbo"; +var MODEL3 = config6?.OCO_MODEL || "gpt-3.5-turbo"; var Azure = class { - openAI; constructor() { - if (provider2 === "azure") { - this.openAI = new OpenAIClient(apiEndpoint, new AzureKeyCredential(apiKey2)); + this.generateCommitMessage = async (messages) => { + try { + const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a3, b3) => a3 + b3, 0); + if (REQUEST_TOKENS > MAX_TOKENS_INPUT3 - MAX_TOKENS_OUTPUT3) { + throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); + } + const data = await this.openAI.getChatCompletions(MODEL3, messages); + const message = data.choices[0].message; + if (message?.content === null) { + return void 0; + } + return message?.content; + } catch (error) { + ce(`${source_default.red("\u2716")} ${MODEL3}`); + const err = error; + ce(`${source_default.red("\u2716")} ${err?.message || err}`); + if (axios_default.isAxiosError(error) && error.response?.status === 401) { + const openAiError = error.response.data.error; + if (openAiError?.message) + ce(openAiError.message); + ce( + "For help look into README https://github.com/di-sukharev/opencommit#setup" + ); + } + throw err; + } + }; + if (provider3 === "azure") { + this.openAI = new OpenAIClient(apiEndpoint, new AzureKeyCredential(apiKey3)); } } - generateCommitMessage = async (messages) => { - try { - const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a3, b3) => a3 + b3, 0); - if (REQUEST_TOKENS > MAX_TOKENS_INPUT2 - MAX_TOKENS_OUTPUT2) { - throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); - } - const data = await this.openAI.getChatCompletions(MODEL2, messages); - const message = data.choices[0].message; - if (message?.content === null) { - return void 0; - } - return message?.content; - } catch (error) { - ce(`${source_default.red("\u2716")} ${MODEL2}`); - const err = error; - ce(`${source_default.red("\u2716")} ${err?.message || err}`); - if (axios_default.isAxiosError(error) && error.response?.status === 401) { - const openAiError = error.response.data.error; - if (openAiError?.message) - ce(openAiError.message); - ce( - "For help look into README https://github.com/di-sukharev/opencommit#setup" - ); - } - throw err; - } - }; }; var azure = new Azure(); -// node_modules/@anthropic-ai/sdk/version.mjs -var VERSION3 = "0.19.2"; - -// node_modules/@anthropic-ai/sdk/_shims/registry.mjs -var auto = false; -var kind = void 0; -var fetch = void 0; -var Request = void 0; -var Response = void 0; -var Headers = void 0; -var FormData3 = void 0; -var Blob2 = void 0; -var File2 = void 0; -var ReadableStream2 = void 0; -var getMultipartRequestOptions = void 0; -var getDefaultAgent = void 0; -var fileFromPath = void 0; -var isFsReadStream = void 0; -function setShims(shims, options = { auto: false }) { - if (auto) { - throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` before importing anything else from @anthropic-ai/sdk`); - } - if (kind) { - throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` after \`import '@anthropic-ai/sdk/shims/${kind}'\``); - } - auto = options.auto; - kind = shims.kind; - fetch = shims.fetch; - Request = shims.Request; - Response = shims.Response; - Headers = shims.Headers; - FormData3 = shims.FormData; - Blob2 = shims.Blob; - File2 = shims.File; - ReadableStream2 = shims.ReadableStream; - getMultipartRequestOptions = shims.getMultipartRequestOptions; - getDefaultAgent = shims.getDefaultAgent; - fileFromPath = shims.fileFromPath; - isFsReadStream = shims.isFsReadStream; -} - -// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs -var nf = __toESM(require_lib3(), 1); - -// node_modules/formdata-node/lib/esm/FormData.js -var import_util8 = require("util"); -init_File(); -init_isFile(); - -// node_modules/formdata-node/lib/esm/isBlob.js -init_Blob(); -var isBlob3 = (value) => value instanceof Blob3; - -// node_modules/formdata-node/lib/esm/FormData.js -init_isFunction(); - -// node_modules/formdata-node/lib/esm/deprecateConstructorEntries.js -var import_util7 = require("util"); -var deprecateConstructorEntries = (0, import_util7.deprecate)(() => { -}, 'Constructor "entries" argument is not spec-compliant and will be removed in next major release.'); - -// node_modules/formdata-node/lib/esm/FormData.js -var __classPrivateFieldGet4 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); -}; -var _FormData_instances; -var _FormData_entries; -var _FormData_setEntry; -var FormData4 = class { - constructor(entries) { - _FormData_instances.add(this); - _FormData_entries.set(this, /* @__PURE__ */ new Map()); - if (entries) { - deprecateConstructorEntries(); - entries.forEach(({ name, value, fileName }) => this.append(name, value, fileName)); - } - } - static [(_FormData_entries = /* @__PURE__ */ new WeakMap(), _FormData_instances = /* @__PURE__ */ new WeakSet(), Symbol.hasInstance)](value) { - return Boolean(value && isFunction2(value.constructor) && value[Symbol.toStringTag] === "FormData" && isFunction2(value.append) && isFunction2(value.set) && isFunction2(value.get) && isFunction2(value.getAll) && isFunction2(value.has) && isFunction2(value.delete) && isFunction2(value.entries) && isFunction2(value.values) && isFunction2(value.keys) && isFunction2(value[Symbol.iterator]) && isFunction2(value.forEach)); - } - append(name, value, fileName) { - __classPrivateFieldGet4(this, _FormData_instances, "m", _FormData_setEntry).call(this, { - name, - fileName, - append: true, - rawValue: value, - argsLength: arguments.length - }); - } - set(name, value, fileName) { - __classPrivateFieldGet4(this, _FormData_instances, "m", _FormData_setEntry).call(this, { - name, - fileName, - append: false, - rawValue: value, - argsLength: arguments.length - }); - } - get(name) { - const field = __classPrivateFieldGet4(this, _FormData_entries, "f").get(String(name)); - if (!field) { - return null; - } - return field[0]; - } - getAll(name) { - const field = __classPrivateFieldGet4(this, _FormData_entries, "f").get(String(name)); - if (!field) { - return []; - } - return field.slice(); - } - has(name) { - return __classPrivateFieldGet4(this, _FormData_entries, "f").has(String(name)); - } - delete(name) { - __classPrivateFieldGet4(this, _FormData_entries, "f").delete(String(name)); - } - *keys() { - for (const key of __classPrivateFieldGet4(this, _FormData_entries, "f").keys()) { - yield key; - } - } - *entries() { - for (const name of this.keys()) { - const values = this.getAll(name); - for (const value of values) { - yield [name, value]; - } - } - } - *values() { - for (const [, value] of this) { - yield value; - } - } - [(_FormData_setEntry = function _FormData_setEntry2({ name, rawValue, append: append2, fileName, argsLength }) { - const methodName = append2 ? "append" : "set"; - if (argsLength < 2) { - throw new TypeError(`Failed to execute '${methodName}' on 'FormData': 2 arguments required, but only ${argsLength} present.`); - } - name = String(name); - let value; - if (isFile2(rawValue)) { - value = fileName === void 0 ? rawValue : new File3([rawValue], fileName, { - type: rawValue.type, - lastModified: rawValue.lastModified - }); - } else if (isBlob3(rawValue)) { - value = new File3([rawValue], fileName === void 0 ? "blob" : fileName, { - type: rawValue.type - }); - } else if (fileName) { - throw new TypeError(`Failed to execute '${methodName}' on 'FormData': parameter 2 is not of type 'Blob'.`); - } else { - value = String(rawValue); - } - const values = __classPrivateFieldGet4(this, _FormData_entries, "f").get(name); - if (!values) { - return void __classPrivateFieldGet4(this, _FormData_entries, "f").set(name, [value]); - } - if (!append2) { - return void __classPrivateFieldGet4(this, _FormData_entries, "f").set(name, [value]); - } - values.push(value); - }, Symbol.iterator)]() { - return this.entries(); - } - forEach(callback, thisArg) { - for (const [name, value] of this) { - callback.call(thisArg, value, name, this); - } - } - get [Symbol.toStringTag]() { - return "FormData"; - } - [import_util8.inspect.custom]() { - return this[Symbol.toStringTag]; - } -}; - -// node_modules/formdata-node/lib/esm/index.js -init_Blob(); -init_File(); - -// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs -var import_agentkeepalive = __toESM(require_agentkeepalive(), 1); -var import_abort_controller5 = __toESM(require_abort_controller(), 1); -var import_node_fs = require("node:fs"); - -// node_modules/form-data-encoder/lib/esm/util/createBoundary.js -var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789"; -function createBoundary() { - let size = 16; - let res = ""; - while (size--) { - res += alphabet[Math.random() * alphabet.length << 0]; - } - return res; -} -var createBoundary_default = createBoundary; - -// node_modules/form-data-encoder/lib/esm/util/isPlainObject.js -var getType = (value) => Object.prototype.toString.call(value).slice(8, -1).toLowerCase(); -function isPlainObject2(value) { - if (getType(value) !== "object") { - return false; - } - const pp = Object.getPrototypeOf(value); - if (pp === null || pp === void 0) { - return true; - } - const Ctor = pp.constructor && pp.constructor.toString(); - return Ctor === Object.toString(); -} -var isPlainObject_default = isPlainObject2; - -// node_modules/form-data-encoder/lib/esm/util/normalizeValue.js -var normalizeValue2 = (value) => String(value).replace(/\r|\n/g, (match, i3, str) => { - if (match === "\r" && str[i3 + 1] !== "\n" || match === "\n" && str[i3 - 1] !== "\r") { - return "\r\n"; - } - return match; -}); -var normalizeValue_default = normalizeValue2; - -// node_modules/form-data-encoder/lib/esm/util/escapeName.js -var escapeName = (name) => String(name).replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/"/g, "%22"); -var escapeName_default = escapeName; - -// node_modules/form-data-encoder/lib/esm/util/isFunction.js -var isFunction3 = (value) => typeof value === "function"; -var isFunction_default = isFunction3; - -// node_modules/form-data-encoder/lib/esm/util/isFileLike.js -var isFileLike = (value) => Boolean(value && typeof value === "object" && isFunction_default(value.constructor) && value[Symbol.toStringTag] === "File" && isFunction_default(value.stream) && value.name != null && value.size != null && value.lastModified != null); - -// node_modules/form-data-encoder/lib/esm/util/isFormData.js -var isFormData2 = (value) => Boolean(value && isFunction_default(value.constructor) && value[Symbol.toStringTag] === "FormData" && isFunction_default(value.append) && isFunction_default(value.getAll) && isFunction_default(value.entries) && isFunction_default(value[Symbol.iterator])); - -// node_modules/form-data-encoder/lib/esm/FormDataEncoder.js -var __classPrivateFieldSet4 = function(receiver, state2, value, kind2, f4) { - if (kind2 === "m") - throw new TypeError("Private method is not writable"); - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; -}; -var __classPrivateFieldGet5 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); -}; -var _FormDataEncoder_instances; -var _FormDataEncoder_CRLF; -var _FormDataEncoder_CRLF_BYTES; -var _FormDataEncoder_CRLF_BYTES_LENGTH; -var _FormDataEncoder_DASHES; -var _FormDataEncoder_encoder; -var _FormDataEncoder_footer; -var _FormDataEncoder_form; -var _FormDataEncoder_options; -var _FormDataEncoder_getFieldHeader; -var defaultOptions = { - enableAdditionalHeaders: false -}; -var FormDataEncoder = class { - constructor(form, boundaryOrOptions, options) { - _FormDataEncoder_instances.add(this); - _FormDataEncoder_CRLF.set(this, "\r\n"); - _FormDataEncoder_CRLF_BYTES.set(this, void 0); - _FormDataEncoder_CRLF_BYTES_LENGTH.set(this, void 0); - _FormDataEncoder_DASHES.set(this, "-".repeat(2)); - _FormDataEncoder_encoder.set(this, new TextEncoder()); - _FormDataEncoder_footer.set(this, void 0); - _FormDataEncoder_form.set(this, void 0); - _FormDataEncoder_options.set(this, void 0); - if (!isFormData2(form)) { - throw new TypeError("Expected first argument to be a FormData instance."); - } - let boundary; - if (isPlainObject_default(boundaryOrOptions)) { - options = boundaryOrOptions; - } else { - boundary = boundaryOrOptions; - } - if (!boundary) { - boundary = createBoundary_default(); - } - if (typeof boundary !== "string") { - throw new TypeError("Expected boundary argument to be a string."); - } - if (options && !isPlainObject_default(options)) { - throw new TypeError("Expected options argument to be an object."); - } - __classPrivateFieldSet4(this, _FormDataEncoder_form, form, "f"); - __classPrivateFieldSet4(this, _FormDataEncoder_options, { ...defaultOptions, ...options }, "f"); - __classPrivateFieldSet4(this, _FormDataEncoder_CRLF_BYTES, __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f")), "f"); - __classPrivateFieldSet4(this, _FormDataEncoder_CRLF_BYTES_LENGTH, __classPrivateFieldGet5(this, _FormDataEncoder_CRLF_BYTES, "f").byteLength, "f"); - this.boundary = `form-data-boundary-${boundary}`; - this.contentType = `multipart/form-data; boundary=${this.boundary}`; - __classPrivateFieldSet4(this, _FormDataEncoder_footer, __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(`${__classPrivateFieldGet5(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet5(this, _FormDataEncoder_DASHES, "f")}${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f").repeat(2)}`), "f"); - this.contentLength = String(this.getContentLength()); - this.headers = Object.freeze({ - "Content-Type": this.contentType, - "Content-Length": this.contentLength - }); - Object.defineProperties(this, { - boundary: { writable: false, configurable: false }, - contentType: { writable: false, configurable: false }, - contentLength: { writable: false, configurable: false }, - headers: { writable: false, configurable: false } - }); - } - getContentLength() { - let length = 0; - for (const [name, raw] of __classPrivateFieldGet5(this, _FormDataEncoder_form, "f")) { - const value = isFileLike(raw) ? raw : __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(normalizeValue_default(raw)); - length += __classPrivateFieldGet5(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value).byteLength; - length += isFileLike(value) ? value.size : value.byteLength; - length += __classPrivateFieldGet5(this, _FormDataEncoder_CRLF_BYTES_LENGTH, "f"); - } - return length + __classPrivateFieldGet5(this, _FormDataEncoder_footer, "f").byteLength; - } - *values() { - for (const [name, raw] of __classPrivateFieldGet5(this, _FormDataEncoder_form, "f").entries()) { - const value = isFileLike(raw) ? raw : __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(normalizeValue_default(raw)); - yield __classPrivateFieldGet5(this, _FormDataEncoder_instances, "m", _FormDataEncoder_getFieldHeader).call(this, name, value); - yield value; - yield __classPrivateFieldGet5(this, _FormDataEncoder_CRLF_BYTES, "f"); - } - yield __classPrivateFieldGet5(this, _FormDataEncoder_footer, "f"); - } - async *encode() { - for (const part of this.values()) { - if (isFileLike(part)) { - yield* part.stream(); - } else { - yield part; - } - } - } - [(_FormDataEncoder_CRLF = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_CRLF_BYTES_LENGTH = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_DASHES = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_encoder = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_footer = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_form = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_options = /* @__PURE__ */ new WeakMap(), _FormDataEncoder_instances = /* @__PURE__ */ new WeakSet(), _FormDataEncoder_getFieldHeader = function _FormDataEncoder_getFieldHeader2(name, value) { - let header = ""; - header += `${__classPrivateFieldGet5(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f")}`; - header += `Content-Disposition: form-data; name="${escapeName_default(name)}"`; - if (isFileLike(value)) { - header += `; filename="${escapeName_default(value.name)}"${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f")}`; - header += `Content-Type: ${value.type || "application/octet-stream"}`; - } - if (__classPrivateFieldGet5(this, _FormDataEncoder_options, "f").enableAdditionalHeaders === true) { - header += `${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f")}Content-Length: ${isFileLike(value) ? value.size : value.byteLength}`; - } - return __classPrivateFieldGet5(this, _FormDataEncoder_encoder, "f").encode(`${header}${__classPrivateFieldGet5(this, _FormDataEncoder_CRLF, "f").repeat(2)}`); - }, Symbol.iterator)]() { - return this.values(); - } - [Symbol.asyncIterator]() { - return this.encode(); - } -}; - -// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs -var import_node_stream3 = require("node:stream"); - -// node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs -var MultipartBody = class { - constructor(body) { - this.body = body; - } - get [Symbol.toStringTag]() { - return "MultipartBody"; - } -}; - -// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs -var import_ponyfill_es2018 = __toESM(require_ponyfill_es2018(), 1); -var fileFromPathWarned = false; -async function fileFromPath3(path2, ...args) { - const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports)); - if (!fileFromPathWarned) { - console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path2)}) instead`); - fileFromPathWarned = true; - } - return await _fileFromPath(path2, ...args); -} -var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 }); -var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 }); -async function getMultipartRequestOptions2(form, opts) { - const encoder = new FormDataEncoder(form); - const readable = import_node_stream3.Readable.from(encoder); - const body = new MultipartBody(readable); - const headers = { - ...opts.headers, - ...encoder.headers, - "Content-Length": encoder.contentLength - }; - return { ...opts, body, headers }; -} -function getRuntime() { - if (typeof AbortController === "undefined") { - globalThis.AbortController = import_abort_controller5.AbortController; - } - return { - kind: "node", - fetch: nf.default, - Request: nf.Request, - Response: nf.Response, - Headers: nf.Headers, - FormData: FormData4, - Blob: Blob3, - File: File3, - ReadableStream: import_ponyfill_es2018.ReadableStream, - getMultipartRequestOptions: getMultipartRequestOptions2, - getDefaultAgent: (url2) => url2.startsWith("https") ? defaultHttpsAgent : defaultHttpAgent, - fileFromPath: fileFromPath3, - isFsReadStream: (value) => value instanceof import_node_fs.ReadStream - }; -} - -// node_modules/@anthropic-ai/sdk/_shims/index.mjs -if (!kind) - setShims(getRuntime(), { auto: true }); - -// node_modules/@anthropic-ai/sdk/error.mjs -var error_exports = {}; -__export(error_exports, { - APIConnectionError: () => APIConnectionError, - APIConnectionTimeoutError: () => APIConnectionTimeoutError, - APIError: () => APIError, - APIUserAbortError: () => APIUserAbortError, - AnthropicError: () => AnthropicError, - AuthenticationError: () => AuthenticationError, - BadRequestError: () => BadRequestError, - ConflictError: () => ConflictError, - InternalServerError: () => InternalServerError, - NotFoundError: () => NotFoundError, - PermissionDeniedError: () => PermissionDeniedError, - RateLimitError: () => RateLimitError, - UnprocessableEntityError: () => UnprocessableEntityError -}); -var AnthropicError = class extends Error { -}; -var APIError = class extends AnthropicError { - constructor(status, error, message, headers) { - super(`${APIError.makeMessage(status, error, message)}`); - this.status = status; - this.headers = headers; - this.error = error; - } - static makeMessage(status, error, message) { - const msg = error?.message ? typeof error.message === "string" ? error.message : JSON.stringify(error.message) : error ? JSON.stringify(error) : message; - if (status && msg) { - return `${status} ${msg}`; - } - if (status) { - return `${status} status code (no body)`; - } - if (msg) { - return msg; - } - return "(no status code or body)"; - } - static generate(status, errorResponse, message, headers) { - if (!status) { - return new APIConnectionError({ cause: castToError(errorResponse) }); - } - const error = errorResponse; - if (status === 400) { - return new BadRequestError(status, error, message, headers); - } - if (status === 401) { - return new AuthenticationError(status, error, message, headers); - } - if (status === 403) { - return new PermissionDeniedError(status, error, message, headers); - } - if (status === 404) { - return new NotFoundError(status, error, message, headers); - } - if (status === 409) { - return new ConflictError(status, error, message, headers); - } - if (status === 422) { - return new UnprocessableEntityError(status, error, message, headers); - } - if (status === 429) { - return new RateLimitError(status, error, message, headers); - } - if (status >= 500) { - return new InternalServerError(status, error, message, headers); - } - return new APIError(status, error, message, headers); - } -}; -var APIUserAbortError = class extends APIError { - constructor({ message } = {}) { - super(void 0, void 0, message || "Request was aborted.", void 0); - this.status = void 0; - } -}; -var APIConnectionError = class extends APIError { - constructor({ message, cause }) { - super(void 0, void 0, message || "Connection error.", void 0); - this.status = void 0; - if (cause) - this.cause = cause; - } -}; -var APIConnectionTimeoutError = class extends APIConnectionError { - constructor({ message } = {}) { - super({ message: message ?? "Request timed out." }); - } -}; -var BadRequestError = class extends APIError { - constructor() { - super(...arguments); - this.status = 400; - } -}; -var AuthenticationError = class extends APIError { - constructor() { - super(...arguments); - this.status = 401; - } -}; -var PermissionDeniedError = class extends APIError { - constructor() { - super(...arguments); - this.status = 403; - } -}; -var NotFoundError = class extends APIError { - constructor() { - super(...arguments); - this.status = 404; - } -}; -var ConflictError = class extends APIError { - constructor() { - super(...arguments); - this.status = 409; - } -}; -var UnprocessableEntityError = class extends APIError { - constructor() { - super(...arguments); - this.status = 422; - } -}; -var RateLimitError = class extends APIError { - constructor() { - super(...arguments); - this.status = 429; - } -}; -var InternalServerError = class extends APIError { -}; - -// node_modules/@anthropic-ai/sdk/streaming.mjs -var Stream = class { - constructor(iterator, controller) { - this.iterator = iterator; - this.controller = controller; - } - static fromSSEResponse(response, controller) { - let consumed = false; - async function* iterator() { - if (consumed) { - throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream."); - } - consumed = true; - let done = false; - try { - for await (const sse of _iterSSEMessages(response, controller)) { - if (sse.event === "completion") { - try { - yield JSON.parse(sse.data); - } catch (e3) { - console.error(`Could not parse message into JSON:`, sse.data); - console.error(`From chunk:`, sse.raw); - throw e3; - } - } - if (sse.event === "message_start" || sse.event === "message_delta" || sse.event === "message_stop" || sse.event === "content_block_start" || sse.event === "content_block_delta" || sse.event === "content_block_stop") { - try { - yield JSON.parse(sse.data); - } catch (e3) { - console.error(`Could not parse message into JSON:`, sse.data); - console.error(`From chunk:`, sse.raw); - throw e3; - } - } - if (sse.event === "ping") { - continue; - } - if (sse.event === "error") { - const errText = sse.data; - const errJSON = safeJSON(errText); - const errMessage = errJSON ? void 0 : errText; - throw APIError.generate(void 0, errJSON, errMessage, createResponseHeaders(response.headers)); - } - } - done = true; - } catch (e3) { - if (e3 instanceof Error && e3.name === "AbortError") - return; - throw e3; - } finally { - if (!done) - controller.abort(); - } - } - return new Stream(iterator, controller); - } - static fromReadableStream(readableStream, controller) { - let consumed = false; - async function* iterLines() { - const lineDecoder = new LineDecoder(); - const iter = readableStreamAsyncIterable(readableStream); - for await (const chunk of iter) { - for (const line of lineDecoder.decode(chunk)) { - yield line; - } - } - for (const line of lineDecoder.flush()) { - yield line; - } - } - async function* iterator() { - if (consumed) { - throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream."); - } - consumed = true; - let done = false; - try { - for await (const line of iterLines()) { - if (done) - continue; - if (line) - yield JSON.parse(line); - } - done = true; - } catch (e3) { - if (e3 instanceof Error && e3.name === "AbortError") - return; - throw e3; - } finally { - if (!done) - controller.abort(); - } - } - return new Stream(iterator, controller); - } - [Symbol.asyncIterator]() { - return this.iterator(); - } - tee() { - const left = []; - const right = []; - const iterator = this.iterator(); - const teeIterator = (queue) => { - return { - next: () => { - if (queue.length === 0) { - const result = iterator.next(); - left.push(result); - right.push(result); - } - return queue.shift(); - } - }; - }; - return [ - new Stream(() => teeIterator(left), this.controller), - new Stream(() => teeIterator(right), this.controller) - ]; - } - toReadableStream() { - const self2 = this; - let iter; - const encoder = new TextEncoder(); - return new ReadableStream2({ - async start() { - iter = self2[Symbol.asyncIterator](); - }, - async pull(ctrl) { - try { - const { value, done } = await iter.next(); - if (done) - return ctrl.close(); - const bytes = encoder.encode(JSON.stringify(value) + "\n"); - ctrl.enqueue(bytes); - } catch (err) { - ctrl.error(err); - } - }, - async cancel() { - await iter.return?.(); - } - }); - } -}; -async function* _iterSSEMessages(response, controller) { - if (!response.body) { - controller.abort(); - throw new AnthropicError(`Attempted to iterate over a response with no body`); - } - const sseDecoder = new SSEDecoder(); - const lineDecoder = new LineDecoder(); - const iter = readableStreamAsyncIterable(response.body); - for await (const sseChunk of iterSSEChunks(iter)) { - for (const line of lineDecoder.decode(sseChunk)) { - const sse = sseDecoder.decode(line); - if (sse) - yield sse; - } - } - for (const line of lineDecoder.flush()) { - const sse = sseDecoder.decode(line); - if (sse) - yield sse; - } -} -async function* iterSSEChunks(iterator) { - let data = new Uint8Array(); - for await (const chunk of iterator) { - if (chunk == null) { - continue; - } - const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk) : typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk; - let newData = new Uint8Array(data.length + binaryChunk.length); - newData.set(data); - newData.set(binaryChunk, data.length); - data = newData; - let patternIndex; - while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) { - yield data.slice(0, patternIndex); - data = data.slice(patternIndex); - } - } - if (data.length > 0) { - yield data; - } -} -function findDoubleNewlineIndex(buffer) { - const newline = 10; - const carriage = 13; - for (let i3 = 0; i3 < buffer.length - 2; i3++) { - if (buffer[i3] === newline && buffer[i3 + 1] === newline) { - return i3 + 2; - } - if (buffer[i3] === carriage && buffer[i3 + 1] === carriage) { - return i3 + 2; - } - if (buffer[i3] === carriage && buffer[i3 + 1] === newline && i3 + 3 < buffer.length && buffer[i3 + 2] === carriage && buffer[i3 + 3] === newline) { - return i3 + 4; - } - } - return -1; -} -var SSEDecoder = class { - constructor() { - this.event = null; - this.data = []; - this.chunks = []; - } - decode(line) { - if (line.endsWith("\r")) { - line = line.substring(0, line.length - 1); - } - if (!line) { - if (!this.event && !this.data.length) - return null; - const sse = { - event: this.event, - data: this.data.join("\n"), - raw: this.chunks - }; - this.event = null; - this.data = []; - this.chunks = []; - return sse; - } - this.chunks.push(line); - if (line.startsWith(":")) { - return null; - } - let [fieldname, _3, value] = partition(line, ":"); - if (value.startsWith(" ")) { - value = value.substring(1); - } - if (fieldname === "event") { - this.event = value; - } else if (fieldname === "data") { - this.data.push(value); - } - return null; - } -}; -var LineDecoder = class { - constructor() { - this.buffer = []; - this.trailingCR = false; - } - decode(chunk) { - let text = this.decodeText(chunk); - if (this.trailingCR) { - text = "\r" + text; - this.trailingCR = false; - } - if (text.endsWith("\r")) { - this.trailingCR = true; - text = text.slice(0, -1); - } - if (!text) { - return []; - } - const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || ""); - let lines = text.split(LineDecoder.NEWLINE_REGEXP); - if (trailingNewline) { - lines.pop(); - } - if (lines.length === 1 && !trailingNewline) { - this.buffer.push(lines[0]); - return []; - } - if (this.buffer.length > 0) { - lines = [this.buffer.join("") + lines[0], ...lines.slice(1)]; - this.buffer = []; - } - if (!trailingNewline) { - this.buffer = [lines.pop() || ""]; - } - return lines; - } - decodeText(bytes) { - if (bytes == null) - return ""; - if (typeof bytes === "string") - return bytes; - if (typeof Buffer !== "undefined") { - if (bytes instanceof Buffer) { - return bytes.toString(); - } - if (bytes instanceof Uint8Array) { - return Buffer.from(bytes).toString(); - } - throw new AnthropicError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`); - } - if (typeof TextDecoder !== "undefined") { - if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) { - this.textDecoder ?? (this.textDecoder = new TextDecoder("utf8")); - return this.textDecoder.decode(bytes); - } - throw new AnthropicError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`); - } - throw new AnthropicError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`); - } - flush() { - if (!this.buffer.length && !this.trailingCR) { - return []; - } - const lines = [this.buffer.join("")]; - this.buffer = []; - this.trailingCR = false; - return lines; - } -}; -LineDecoder.NEWLINE_CHARS = /* @__PURE__ */ new Set(["\n", "\r"]); -LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g; -function partition(str, delimiter) { - const index = str.indexOf(delimiter); - if (index !== -1) { - return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)]; - } - return [str, "", ""]; -} -function readableStreamAsyncIterable(stream4) { - if (stream4[Symbol.asyncIterator]) - return stream4; - const reader = stream4.getReader(); - return { - async next() { - try { - const result = await reader.read(); - if (result?.done) - reader.releaseLock(); - return result; - } catch (e3) { - reader.releaseLock(); - throw e3; - } - }, - async return() { - const cancelPromise = reader.cancel(); - reader.releaseLock(); - await cancelPromise; - return { done: true, value: void 0 }; - }, - [Symbol.asyncIterator]() { - return this; - } - }; -} - -// node_modules/@anthropic-ai/sdk/uploads.mjs -var isResponseLike = (value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function"; -var isFileLike2 = (value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value); -var isBlobLike = (value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function"; -async function toFile(value, name, options) { - value = await value; - options ?? (options = isFileLike2(value) ? { lastModified: value.lastModified, type: value.type } : {}); - if (isResponseLike(value)) { - const blob = await value.blob(); - name || (name = new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file"); - return new File2([blob], name, options); - } - const bits = await getBytes(value); - name || (name = getName(value) ?? "unknown_file"); - if (!options.type) { - const type2 = bits[0]?.type; - if (typeof type2 === "string") { - options = { ...options, type: type2 }; - } - } - return new File2(bits, name, options); -} -async function getBytes(value) { - let parts = []; - if (typeof value === "string" || ArrayBuffer.isView(value) || value instanceof ArrayBuffer) { - parts.push(value); - } else if (isBlobLike(value)) { - parts.push(await value.arrayBuffer()); - } else if (isAsyncIterableIterator(value)) { - for await (const chunk of value) { - parts.push(chunk); - } - } else { - throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`); - } - return parts; -} -function propsForError(value) { - const props = Object.getOwnPropertyNames(value); - return `[${props.map((p3) => `"${p3}"`).join(", ")}]`; -} -function getName(value) { - return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop(); -} -var getStringFromMaybeBuffer = (x2) => { - if (typeof x2 === "string") - return x2; - if (typeof Buffer !== "undefined" && x2 instanceof Buffer) - return String(x2); - return void 0; -}; -var isAsyncIterableIterator = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function"; -var isMultipartBody = (body) => body && typeof body === "object" && body.body && body[Symbol.toStringTag] === "MultipartBody"; - -// node_modules/@anthropic-ai/sdk/core.mjs -var __classPrivateFieldSet6 = function(receiver, state2, value, kind2, f4) { - if (kind2 === "m") - throw new TypeError("Private method is not writable"); - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; -}; -var __classPrivateFieldGet7 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); -}; -var _AbstractPage_client; -async function defaultParseResponse(props) { - const { response } = props; - if (props.options.stream) { - debug("response", response.status, response.url, response.headers, response.body); - if (props.options.__streamClass) { - return props.options.__streamClass.fromSSEResponse(response, props.controller); - } - return Stream.fromSSEResponse(response, props.controller); - } - if (response.status === 204) { - return null; - } - if (props.options.__binaryResponse) { - return response; - } - const contentType = response.headers.get("content-type"); - const isJSON = contentType?.includes("application/json") || contentType?.includes("application/vnd.api+json"); - if (isJSON) { - const json = await response.json(); - debug("response", response.status, response.url, response.headers, json); - return json; - } - const text = await response.text(); - debug("response", response.status, response.url, response.headers, text); - return text; -} -var APIPromise = class extends Promise { - constructor(responsePromise, parseResponse = defaultParseResponse) { - super((resolve) => { - resolve(null); - }); - this.responsePromise = responsePromise; - this.parseResponse = parseResponse; - } - _thenUnwrap(transform) { - return new APIPromise(this.responsePromise, async (props) => transform(await this.parseResponse(props))); - } - asResponse() { - return this.responsePromise.then((p3) => p3.response); - } - async withResponse() { - const [data, response] = await Promise.all([this.parse(), this.asResponse()]); - return { data, response }; - } - parse() { - if (!this.parsedPromise) { - this.parsedPromise = this.responsePromise.then(this.parseResponse); - } - return this.parsedPromise; - } - then(onfulfilled, onrejected) { - return this.parse().then(onfulfilled, onrejected); - } - catch(onrejected) { - return this.parse().catch(onrejected); - } - finally(onfinally) { - return this.parse().finally(onfinally); - } -}; -var APIClient = class { - constructor({ - baseURL, - maxRetries = 2, - timeout = 6e5, - httpAgent, - fetch: overridenFetch - }) { - this.baseURL = baseURL; - this.maxRetries = validatePositiveInteger("maxRetries", maxRetries); - this.timeout = validatePositiveInteger("timeout", timeout); - this.httpAgent = httpAgent; - this.fetch = overridenFetch ?? fetch; - } - authHeaders(opts) { - return {}; - } - defaultHeaders(opts) { - return { - Accept: "application/json", - "Content-Type": "application/json", - "User-Agent": this.getUserAgent(), - ...getPlatformHeaders(), - ...this.authHeaders(opts) - }; - } - validateHeaders(headers, customHeaders) { - } - defaultIdempotencyKey() { - return `stainless-node-retry-${uuid4()}`; - } - get(path2, opts) { - return this.methodRequest("get", path2, opts); - } - post(path2, opts) { - return this.methodRequest("post", path2, opts); - } - patch(path2, opts) { - return this.methodRequest("patch", path2, opts); - } - put(path2, opts) { - return this.methodRequest("put", path2, opts); - } - delete(path2, opts) { - return this.methodRequest("delete", path2, opts); - } - methodRequest(method, path2, opts) { - return this.request(Promise.resolve(opts).then((opts2) => ({ method, path: path2, ...opts2 }))); - } - getAPIList(path2, Page, opts) { - return this.requestAPIList(Page, { method: "get", path: path2, ...opts }); - } - calculateContentLength(body) { - if (typeof body === "string") { - if (typeof Buffer !== "undefined") { - return Buffer.byteLength(body, "utf8").toString(); - } - if (typeof TextEncoder !== "undefined") { - const encoder = new TextEncoder(); - const encoded = encoder.encode(body); - return encoded.length.toString(); - } - } - return null; - } - buildRequest(options) { - const { method, path: path2, query, headers = {} } = options; - const body = isMultipartBody(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null; - const contentLength = this.calculateContentLength(body); - const url2 = this.buildURL(path2, query); - if ("timeout" in options) - validatePositiveInteger("timeout", options.timeout); - const timeout = options.timeout ?? this.timeout; - const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url2); - const minAgentTimeout = timeout + 1e3; - if (typeof httpAgent?.options?.timeout === "number" && minAgentTimeout > (httpAgent.options.timeout ?? 0)) { - httpAgent.options.timeout = minAgentTimeout; - } - if (this.idempotencyHeader && method !== "get") { - if (!options.idempotencyKey) - options.idempotencyKey = this.defaultIdempotencyKey(); - headers[this.idempotencyHeader] = options.idempotencyKey; - } - const reqHeaders = this.buildHeaders({ options, headers, contentLength }); - const req = { - method, - ...body && { body }, - headers: reqHeaders, - ...httpAgent && { agent: httpAgent }, - signal: options.signal ?? null - }; - return { req, url: url2, timeout }; - } - buildHeaders({ options, headers, contentLength }) { - const reqHeaders = {}; - if (contentLength) { - reqHeaders["content-length"] = contentLength; - } - const defaultHeaders = this.defaultHeaders(options); - applyHeadersMut(reqHeaders, defaultHeaders); - applyHeadersMut(reqHeaders, headers); - if (isMultipartBody(options.body) && kind !== "node") { - delete reqHeaders["content-type"]; - } - this.validateHeaders(reqHeaders, headers); - return reqHeaders; - } - async prepareOptions(options) { - } - async prepareRequest(request3, { url: url2, options }) { - } - parseHeaders(headers) { - return !headers ? {} : Symbol.iterator in headers ? Object.fromEntries(Array.from(headers).map((header) => [...header])) : { ...headers }; - } - makeStatusError(status, error, message, headers) { - return APIError.generate(status, error, message, headers); - } - request(options, remainingRetries = null) { - return new APIPromise(this.makeRequest(options, remainingRetries)); - } - async makeRequest(optionsInput, retriesRemaining) { - const options = await optionsInput; - if (retriesRemaining == null) { - retriesRemaining = options.maxRetries ?? this.maxRetries; - } - await this.prepareOptions(options); - const { req, url: url2, timeout } = this.buildRequest(options); - await this.prepareRequest(req, { url: url2, options }); - debug("request", url2, options, req.headers); - if (options.signal?.aborted) { - throw new APIUserAbortError(); - } - const controller = new AbortController(); - const response = await this.fetchWithTimeout(url2, req, timeout, controller).catch(castToError); - if (response instanceof Error) { - if (options.signal?.aborted) { - throw new APIUserAbortError(); - } - if (retriesRemaining) { - return this.retryRequest(options, retriesRemaining); - } - if (response.name === "AbortError") { - throw new APIConnectionTimeoutError(); - } - throw new APIConnectionError({ cause: response }); - } - const responseHeaders = createResponseHeaders(response.headers); - if (!response.ok) { - if (retriesRemaining && this.shouldRetry(response)) { - const retryMessage2 = `retrying, ${retriesRemaining} attempts remaining`; - debug(`response (error; ${retryMessage2})`, response.status, url2, responseHeaders); - return this.retryRequest(options, retriesRemaining, responseHeaders); - } - const errText = await response.text().catch((e3) => castToError(e3).message); - const errJSON = safeJSON(errText); - const errMessage = errJSON ? void 0 : errText; - const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`; - debug(`response (error; ${retryMessage})`, response.status, url2, responseHeaders, errMessage); - const err = this.makeStatusError(response.status, errJSON, errMessage, responseHeaders); - throw err; - } - return { response, options, controller }; - } - requestAPIList(Page, options) { - const request3 = this.makeRequest(options, null); - return new PagePromise(this, request3, Page); - } - buildURL(path2, query) { - const url2 = isAbsoluteURL2(path2) ? new URL(path2) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path2.startsWith("/") ? path2.slice(1) : path2)); - const defaultQuery = this.defaultQuery(); - if (!isEmptyObj(defaultQuery)) { - query = { ...defaultQuery, ...query }; - } - if (typeof query === "object" && query && !Array.isArray(query)) { - url2.search = this.stringifyQuery(query); - } - return url2.toString(); - } - stringifyQuery(query) { - return Object.entries(query).filter(([_3, value]) => typeof value !== "undefined").map(([key, value]) => { - if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { - return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`; - } - if (value === null) { - return `${encodeURIComponent(key)}=`; - } - throw new AnthropicError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`); - }).join("&"); - } - async fetchWithTimeout(url2, init, ms, controller) { - const { signal, ...options } = init || {}; - if (signal) - signal.addEventListener("abort", () => controller.abort()); - const timeout = setTimeout(() => controller.abort(), ms); - return this.getRequestClient().fetch.call(void 0, url2, { signal: controller.signal, ...options }).finally(() => { - clearTimeout(timeout); - }); - } - getRequestClient() { - return { fetch: this.fetch }; - } - shouldRetry(response) { - const shouldRetryHeader = response.headers.get("x-should-retry"); - if (shouldRetryHeader === "true") - return true; - if (shouldRetryHeader === "false") - return false; - if (response.status === 408) - return true; - if (response.status === 409) - return true; - if (response.status === 429) - return true; - if (response.status >= 500) - return true; - return false; - } - async retryRequest(options, retriesRemaining, responseHeaders) { - let timeoutMillis; - const retryAfterMillisHeader = responseHeaders?.["retry-after-ms"]; - if (retryAfterMillisHeader) { - const timeoutMs = parseFloat(retryAfterMillisHeader); - if (!Number.isNaN(timeoutMs)) { - timeoutMillis = timeoutMs; - } - } - const retryAfterHeader = responseHeaders?.["retry-after"]; - if (retryAfterHeader && !timeoutMillis) { - const timeoutSeconds = parseFloat(retryAfterHeader); - if (!Number.isNaN(timeoutSeconds)) { - timeoutMillis = timeoutSeconds * 1e3; - } else { - timeoutMillis = Date.parse(retryAfterHeader) - Date.now(); - } - } - if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1e3)) { - const maxRetries = options.maxRetries ?? this.maxRetries; - timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); - } - await sleep(timeoutMillis); - return this.makeRequest(options, retriesRemaining - 1); - } - calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) { - const initialRetryDelay = 0.5; - const maxRetryDelay = 8; - const numRetries = maxRetries - retriesRemaining; - const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay); - const jitter = 1 - Math.random() * 0.25; - return sleepSeconds * jitter * 1e3; - } - getUserAgent() { - return `${this.constructor.name}/JS ${VERSION3}`; - } -}; -var AbstractPage = class { - constructor(client, response, body, options) { - _AbstractPage_client.set(this, void 0); - __classPrivateFieldSet6(this, _AbstractPage_client, client, "f"); - this.options = options; - this.response = response; - this.body = body; - } - hasNextPage() { - const items = this.getPaginatedItems(); - if (!items.length) - return false; - return this.nextPageInfo() != null; - } - async getNextPage() { - const nextInfo = this.nextPageInfo(); - if (!nextInfo) { - throw new AnthropicError("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`."); - } - const nextOptions = { ...this.options }; - if ("params" in nextInfo && typeof nextOptions.query === "object") { - nextOptions.query = { ...nextOptions.query, ...nextInfo.params }; - } else if ("url" in nextInfo) { - const params = [...Object.entries(nextOptions.query || {}), ...nextInfo.url.searchParams.entries()]; - for (const [key, value] of params) { - nextInfo.url.searchParams.set(key, value); - } - nextOptions.query = void 0; - nextOptions.path = nextInfo.url.toString(); - } - return await __classPrivateFieldGet7(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions); - } - async *iterPages() { - let page = this; - yield page; - while (page.hasNextPage()) { - page = await page.getNextPage(); - yield page; - } - } - async *[(_AbstractPage_client = /* @__PURE__ */ new WeakMap(), Symbol.asyncIterator)]() { - for await (const page of this.iterPages()) { - for (const item of page.getPaginatedItems()) { - yield item; - } - } - } -}; -var PagePromise = class extends APIPromise { - constructor(client, request3, Page) { - super(request3, async (props) => new Page(client, props.response, await defaultParseResponse(props), props.options)); - } - async *[Symbol.asyncIterator]() { - const page = await this; - for await (const item of page) { - yield item; - } - } -}; -var createResponseHeaders = (headers) => { - return new Proxy(Object.fromEntries( - headers.entries() - ), { - get(target, name) { - const key = name.toString(); - return target[key.toLowerCase()] || target[key]; - } - }); -}; -var getPlatformProperties = () => { - if (typeof Deno !== "undefined" && Deno.build != null) { - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": normalizePlatform(Deno.build.os), - "X-Stainless-Arch": normalizeArch(Deno.build.arch), - "X-Stainless-Runtime": "deno", - "X-Stainless-Runtime-Version": typeof Deno.version === "string" ? Deno.version : Deno.version?.deno ?? "unknown" - }; - } - if (typeof EdgeRuntime !== "undefined") { - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": "Unknown", - "X-Stainless-Arch": `other:${EdgeRuntime}`, - "X-Stainless-Runtime": "edge", - "X-Stainless-Runtime-Version": process.version - }; - } - if (Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]") { - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": normalizePlatform(process.platform), - "X-Stainless-Arch": normalizeArch(process.arch), - "X-Stainless-Runtime": "node", - "X-Stainless-Runtime-Version": process.version - }; - } - const browserInfo = getBrowserInfo(); - if (browserInfo) { - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": "Unknown", - "X-Stainless-Arch": "unknown", - "X-Stainless-Runtime": `browser:${browserInfo.browser}`, - "X-Stainless-Runtime-Version": browserInfo.version - }; - } - return { - "X-Stainless-Lang": "js", - "X-Stainless-Package-Version": VERSION3, - "X-Stainless-OS": "Unknown", - "X-Stainless-Arch": "unknown", - "X-Stainless-Runtime": "unknown", - "X-Stainless-Runtime-Version": "unknown" - }; -}; -function getBrowserInfo() { - if (typeof navigator === "undefined" || !navigator) { - return null; - } - const browserPatterns = [ - { key: "edge", pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "ie", pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "ie", pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "chrome", pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "firefox", pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: "safari", pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ } - ]; - for (const { key, pattern } of browserPatterns) { - const match = pattern.exec(navigator.userAgent); - if (match) { - const major = match[1] || 0; - const minor = match[2] || 0; - const patch = match[3] || 0; - return { browser: key, version: `${major}.${minor}.${patch}` }; - } - } - return null; -} -var normalizeArch = (arch2) => { - if (arch2 === "x32") - return "x32"; - if (arch2 === "x86_64" || arch2 === "x64") - return "x64"; - if (arch2 === "arm") - return "arm"; - if (arch2 === "aarch64" || arch2 === "arm64") - return "arm64"; - if (arch2) - return `other:${arch2}`; - return "unknown"; -}; -var normalizePlatform = (platform) => { - platform = platform.toLowerCase(); - if (platform.includes("ios")) - return "iOS"; - if (platform === "android") - return "Android"; - if (platform === "darwin") - return "MacOS"; - if (platform === "win32") - return "Windows"; - if (platform === "freebsd") - return "FreeBSD"; - if (platform === "openbsd") - return "OpenBSD"; - if (platform === "linux") - return "Linux"; - if (platform) - return `Other:${platform}`; - return "Unknown"; -}; -var _platformHeaders; -var getPlatformHeaders = () => { - return _platformHeaders ?? (_platformHeaders = getPlatformProperties()); -}; -var safeJSON = (text) => { - try { - return JSON.parse(text); - } catch (err) { - return void 0; - } -}; -var startsWithSchemeRegexp = new RegExp("^(?:[a-z]+:)?//", "i"); -var isAbsoluteURL2 = (url2) => { - return startsWithSchemeRegexp.test(url2); -}; -var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); -var validatePositiveInteger = (name, n2) => { - if (typeof n2 !== "number" || !Number.isInteger(n2)) { - throw new AnthropicError(`${name} must be an integer`); - } - if (n2 < 0) { - throw new AnthropicError(`${name} must be a positive integer`); - } - return n2; -}; -var castToError = (err) => { - if (err instanceof Error) - return err; - return new Error(err); -}; -var readEnv = (env2) => { - if (typeof process !== "undefined") { - return process.env?.[env2]?.trim() ?? void 0; - } - if (typeof Deno !== "undefined") { - return Deno.env?.get?.(env2)?.trim(); - } - return void 0; -}; -function isEmptyObj(obj) { - if (!obj) - return true; - for (const _k in obj) - return false; - return true; -} -function hasOwn(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} -function applyHeadersMut(targetHeaders, newHeaders) { - for (const k4 in newHeaders) { - if (!hasOwn(newHeaders, k4)) - continue; - const lowerKey = k4.toLowerCase(); - if (!lowerKey) - continue; - const val = newHeaders[k4]; - if (val === null) { - delete targetHeaders[lowerKey]; - } else if (val !== void 0) { - targetHeaders[lowerKey] = val; - } - } -} -function debug(action, ...args) { - if (typeof process !== "undefined" && process?.env?.["DEBUG"] === "true") { - console.log(`Anthropic:DEBUG:${action}`, ...args); - } -} -var uuid4 = () => { - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => { - const r3 = Math.random() * 16 | 0; - const v2 = c2 === "x" ? r3 : r3 & 3 | 8; - return v2.toString(16); - }); -}; - -// node_modules/@anthropic-ai/sdk/resource.mjs -var APIResource = class { - constructor(client) { - this._client = client; - } -}; - -// node_modules/@anthropic-ai/sdk/resources/completions.mjs -var Completions = class extends APIResource { - create(body, options) { - return this._client.post("/v1/complete", { - body, - timeout: 6e5, - ...options, - stream: body.stream ?? false - }); - } -}; -(function(Completions2) { -})(Completions || (Completions = {})); - -// node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs -var __classPrivateFieldSet7 = function(receiver, state2, value, kind2, f4) { - if (kind2 === "m") - throw new TypeError("Private method is not writable"); - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind2 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value; -}; -var __classPrivateFieldGet8 = function(receiver, state2, kind2, f4) { - if (kind2 === "a" && !f4) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind2 === "m" ? f4 : kind2 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver); -}; -var _MessageStream_instances; -var _MessageStream_currentMessageSnapshot; -var _MessageStream_connectedPromise; -var _MessageStream_resolveConnectedPromise; -var _MessageStream_rejectConnectedPromise; -var _MessageStream_endPromise; -var _MessageStream_resolveEndPromise; -var _MessageStream_rejectEndPromise; -var _MessageStream_listeners; -var _MessageStream_ended; -var _MessageStream_errored; -var _MessageStream_aborted; -var _MessageStream_catchingPromiseCreated; -var _MessageStream_getFinalMessage; -var _MessageStream_getFinalText; -var _MessageStream_handleError; -var _MessageStream_beginRequest; -var _MessageStream_addStreamEvent; -var _MessageStream_endRequest; -var _MessageStream_accumulateMessage; -var MessageStream = class { - constructor() { - _MessageStream_instances.add(this); - this.messages = []; - this.receivedMessages = []; - _MessageStream_currentMessageSnapshot.set(this, void 0); - this.controller = new AbortController(); - _MessageStream_connectedPromise.set(this, void 0); - _MessageStream_resolveConnectedPromise.set(this, () => { - }); - _MessageStream_rejectConnectedPromise.set(this, () => { - }); - _MessageStream_endPromise.set(this, void 0); - _MessageStream_resolveEndPromise.set(this, () => { - }); - _MessageStream_rejectEndPromise.set(this, () => { - }); - _MessageStream_listeners.set(this, {}); - _MessageStream_ended.set(this, false); - _MessageStream_errored.set(this, false); - _MessageStream_aborted.set(this, false); - _MessageStream_catchingPromiseCreated.set(this, false); - _MessageStream_handleError.set(this, (error) => { - __classPrivateFieldSet7(this, _MessageStream_errored, true, "f"); - if (error instanceof Error && error.name === "AbortError") { - error = new APIUserAbortError(); - } - if (error instanceof APIUserAbortError) { - __classPrivateFieldSet7(this, _MessageStream_aborted, true, "f"); - return this._emit("abort", error); - } - if (error instanceof AnthropicError) { - return this._emit("error", error); - } - if (error instanceof Error) { - const anthropicError = new AnthropicError(error.message); - anthropicError.cause = error; - return this._emit("error", anthropicError); - } - return this._emit("error", new AnthropicError(String(error))); - }); - __classPrivateFieldSet7(this, _MessageStream_connectedPromise, new Promise((resolve, reject) => { - __classPrivateFieldSet7(this, _MessageStream_resolveConnectedPromise, resolve, "f"); - __classPrivateFieldSet7(this, _MessageStream_rejectConnectedPromise, reject, "f"); - }), "f"); - __classPrivateFieldSet7(this, _MessageStream_endPromise, new Promise((resolve, reject) => { - __classPrivateFieldSet7(this, _MessageStream_resolveEndPromise, resolve, "f"); - __classPrivateFieldSet7(this, _MessageStream_rejectEndPromise, reject, "f"); - }), "f"); - __classPrivateFieldGet8(this, _MessageStream_connectedPromise, "f").catch(() => { - }); - __classPrivateFieldGet8(this, _MessageStream_endPromise, "f").catch(() => { - }); - } - static fromReadableStream(stream4) { - const runner = new MessageStream(); - runner._run(() => runner._fromReadableStream(stream4)); - return runner; - } - static createMessage(messages, params, options) { - const runner = new MessageStream(); - for (const message of params.messages) { - runner._addMessageParam(message); - } - runner._run(() => runner._createMessage(messages, { ...params, stream: true }, { ...options, headers: { ...options?.headers, "X-Stainless-Helper-Method": "stream" } })); - return runner; - } - _run(executor) { - executor().then(() => { - this._emitFinal(); - this._emit("end"); - }, __classPrivateFieldGet8(this, _MessageStream_handleError, "f")); - } - _addMessageParam(message) { - this.messages.push(message); - } - _addMessage(message, emit = true) { - this.receivedMessages.push(message); - if (emit) { - this._emit("message", message); - } - } - async _createMessage(messages, params, options) { - const signal = options?.signal; - if (signal) { - if (signal.aborted) - this.controller.abort(); - signal.addEventListener("abort", () => this.controller.abort()); - } - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_beginRequest).call(this); - const stream4 = await messages.create({ ...params, stream: true }, { ...options, signal: this.controller.signal }); - this._connected(); - for await (const event of stream4) { - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_addStreamEvent).call(this, event); - } - if (stream4.controller.signal?.aborted) { - throw new APIUserAbortError(); - } - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_endRequest).call(this); - } - _connected() { - if (this.ended) - return; - __classPrivateFieldGet8(this, _MessageStream_resolveConnectedPromise, "f").call(this); - this._emit("connect"); - } - get ended() { - return __classPrivateFieldGet8(this, _MessageStream_ended, "f"); - } - get errored() { - return __classPrivateFieldGet8(this, _MessageStream_errored, "f"); - } - get aborted() { - return __classPrivateFieldGet8(this, _MessageStream_aborted, "f"); - } - abort() { - this.controller.abort(); - } - on(event, listener) { - const listeners = __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] = []); - listeners.push({ listener }); - return this; - } - off(event, listener) { - const listeners = __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event]; - if (!listeners) - return this; - const index = listeners.findIndex((l3) => l3.listener === listener); - if (index >= 0) - listeners.splice(index, 1); - return this; - } - once(event, listener) { - const listeners = __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] = []); - listeners.push({ listener, once: true }); - return this; - } - emitted(event) { - return new Promise((resolve, reject) => { - __classPrivateFieldSet7(this, _MessageStream_catchingPromiseCreated, true, "f"); - if (event !== "error") - this.once("error", reject); - this.once(event, resolve); - }); - } - async done() { - __classPrivateFieldSet7(this, _MessageStream_catchingPromiseCreated, true, "f"); - await __classPrivateFieldGet8(this, _MessageStream_endPromise, "f"); - } - get currentMessage() { - return __classPrivateFieldGet8(this, _MessageStream_currentMessageSnapshot, "f"); - } - async finalMessage() { - await this.done(); - return __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_getFinalMessage).call(this); - } - async finalText() { - await this.done(); - return __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_getFinalText).call(this); - } - _emit(event, ...args) { - if (__classPrivateFieldGet8(this, _MessageStream_ended, "f")) - return; - if (event === "end") { - __classPrivateFieldSet7(this, _MessageStream_ended, true, "f"); - __classPrivateFieldGet8(this, _MessageStream_resolveEndPromise, "f").call(this); - } - const listeners = __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event]; - if (listeners) { - __classPrivateFieldGet8(this, _MessageStream_listeners, "f")[event] = listeners.filter((l3) => !l3.once); - listeners.forEach(({ listener }) => listener(...args)); - } - if (event === "abort") { - const error = args[0]; - if (!__classPrivateFieldGet8(this, _MessageStream_catchingPromiseCreated, "f") && !listeners?.length) { - Promise.reject(error); - } - __classPrivateFieldGet8(this, _MessageStream_rejectConnectedPromise, "f").call(this, error); - __classPrivateFieldGet8(this, _MessageStream_rejectEndPromise, "f").call(this, error); - this._emit("end"); - return; - } - if (event === "error") { - const error = args[0]; - if (!__classPrivateFieldGet8(this, _MessageStream_catchingPromiseCreated, "f") && !listeners?.length) { - Promise.reject(error); - } - __classPrivateFieldGet8(this, _MessageStream_rejectConnectedPromise, "f").call(this, error); - __classPrivateFieldGet8(this, _MessageStream_rejectEndPromise, "f").call(this, error); - this._emit("end"); - } - } - _emitFinal() { - const finalMessage = this.receivedMessages.at(-1); - if (finalMessage) { - this._emit("finalMessage", __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_getFinalMessage).call(this)); - } - } - async _fromReadableStream(readableStream, options) { - const signal = options?.signal; - if (signal) { - if (signal.aborted) - this.controller.abort(); - signal.addEventListener("abort", () => this.controller.abort()); - } - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_beginRequest).call(this); - this._connected(); - const stream4 = Stream.fromReadableStream(readableStream, this.controller); - for await (const event of stream4) { - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_addStreamEvent).call(this, event); - } - if (stream4.controller.signal?.aborted) { - throw new APIUserAbortError(); - } - __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_endRequest).call(this); - } - [(_MessageStream_currentMessageSnapshot = /* @__PURE__ */ new WeakMap(), _MessageStream_connectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_resolveConnectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_rejectConnectedPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_endPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_resolveEndPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_rejectEndPromise = /* @__PURE__ */ new WeakMap(), _MessageStream_listeners = /* @__PURE__ */ new WeakMap(), _MessageStream_ended = /* @__PURE__ */ new WeakMap(), _MessageStream_errored = /* @__PURE__ */ new WeakMap(), _MessageStream_aborted = /* @__PURE__ */ new WeakMap(), _MessageStream_catchingPromiseCreated = /* @__PURE__ */ new WeakMap(), _MessageStream_handleError = /* @__PURE__ */ new WeakMap(), _MessageStream_instances = /* @__PURE__ */ new WeakSet(), _MessageStream_getFinalMessage = function _MessageStream_getFinalMessage2() { - if (this.receivedMessages.length === 0) { - throw new AnthropicError("stream ended without producing a Message with role=assistant"); - } - return this.receivedMessages.at(-1); - }, _MessageStream_getFinalText = function _MessageStream_getFinalText2() { - if (this.receivedMessages.length === 0) { - throw new AnthropicError("stream ended without producing a Message with role=assistant"); - } - const textBlocks = this.receivedMessages.at(-1).content.filter((block) => block.type === "text").map((block) => block.text); - if (textBlocks.length === 0) { - throw new AnthropicError("stream ended without producing a content block with type=text"); - } - return textBlocks.join(" "); - }, _MessageStream_beginRequest = function _MessageStream_beginRequest2() { - if (this.ended) - return; - __classPrivateFieldSet7(this, _MessageStream_currentMessageSnapshot, void 0, "f"); - }, _MessageStream_addStreamEvent = function _MessageStream_addStreamEvent2(event) { - if (this.ended) - return; - const messageSnapshot = __classPrivateFieldGet8(this, _MessageStream_instances, "m", _MessageStream_accumulateMessage).call(this, event); - this._emit("streamEvent", event, messageSnapshot); - switch (event.type) { - case "content_block_delta": { - if (event.delta.type === "text_delta") { - this._emit("text", event.delta.text, messageSnapshot.content.at(-1).text || ""); - } - break; - } - case "message_stop": { - this._addMessageParam(messageSnapshot); - this._addMessage(messageSnapshot, true); - break; - } - case "content_block_stop": { - this._emit("contentBlock", messageSnapshot.content.at(-1)); - break; - } - case "message_start": { - __classPrivateFieldSet7(this, _MessageStream_currentMessageSnapshot, messageSnapshot, "f"); - break; - } - case "content_block_start": - case "message_delta": - break; - } - }, _MessageStream_endRequest = function _MessageStream_endRequest2() { - if (this.ended) { - throw new AnthropicError(`stream has ended, this shouldn't happen`); - } - const snapshot = __classPrivateFieldGet8(this, _MessageStream_currentMessageSnapshot, "f"); - if (!snapshot) { - throw new AnthropicError(`request ended without sending any chunks`); - } - __classPrivateFieldSet7(this, _MessageStream_currentMessageSnapshot, void 0, "f"); - return snapshot; - }, _MessageStream_accumulateMessage = function _MessageStream_accumulateMessage2(event) { - let snapshot = __classPrivateFieldGet8(this, _MessageStream_currentMessageSnapshot, "f"); - if (event.type === "message_start") { - if (snapshot) { - throw new AnthropicError(`Unexpected event order, got ${event.type} before receiving "message_stop"`); - } - return event.message; - } - if (!snapshot) { - throw new AnthropicError(`Unexpected event order, got ${event.type} before "message_start"`); - } - switch (event.type) { - case "message_stop": - return snapshot; - case "message_delta": - snapshot.stop_reason = event.delta.stop_reason; - snapshot.stop_sequence = event.delta.stop_sequence; - snapshot.usage.output_tokens = event.usage.output_tokens; - return snapshot; - case "content_block_start": - snapshot.content.push(event.content_block); - return snapshot; - case "content_block_delta": { - const snapshotContent = snapshot.content.at(event.index); - if (snapshotContent?.type === "text" && event.delta.type === "text_delta") { - snapshotContent.text += event.delta.text; - } - return snapshot; - } - case "content_block_stop": - return snapshot; - } - }, Symbol.asyncIterator)]() { - const pushQueue = []; - const readQueue = []; - let done = false; - this.on("streamEvent", (event) => { - const reader = readQueue.shift(); - if (reader) { - reader.resolve(event); - } else { - pushQueue.push(event); - } - }); - this.on("end", () => { - done = true; - for (const reader of readQueue) { - reader.resolve(void 0); - } - readQueue.length = 0; - }); - this.on("abort", (err) => { - done = true; - for (const reader of readQueue) { - reader.reject(err); - } - readQueue.length = 0; - }); - this.on("error", (err) => { - done = true; - for (const reader of readQueue) { - reader.reject(err); - } - readQueue.length = 0; - }); - return { - next: async () => { - if (!pushQueue.length) { - if (done) { - return { value: void 0, done: true }; - } - return new Promise((resolve, reject) => readQueue.push({ resolve, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true }); - } - const chunk = pushQueue.shift(); - return { value: chunk, done: false }; - }, - return: async () => { - this.abort(); - return { value: void 0, done: true }; - } - }; - } - toReadableStream() { - const stream4 = new Stream(this[Symbol.asyncIterator].bind(this), this.controller); - return stream4.toReadableStream(); - } -}; - -// node_modules/@anthropic-ai/sdk/resources/messages.mjs -var Messages = class extends APIResource { - create(body, options) { - return this._client.post("/v1/messages", { - body, - timeout: 6e5, - ...options, - stream: body.stream ?? false - }); - } - stream(body, options) { - return MessageStream.createMessage(this, body, options); - } -}; -(function(Messages2) { -})(Messages || (Messages = {})); - -// node_modules/@anthropic-ai/sdk/index.mjs -var _a3; -var Anthropic = class extends APIClient { - constructor({ baseURL = readEnv("ANTHROPIC_BASE_URL"), apiKey: apiKey4 = readEnv("ANTHROPIC_API_KEY") ?? null, authToken = readEnv("ANTHROPIC_AUTH_TOKEN") ?? null, ...opts } = {}) { - const options = { - apiKey: apiKey4, - authToken, - ...opts, - baseURL: baseURL || `https://api.anthropic.com` - }; - super({ - baseURL: options.baseURL, - timeout: options.timeout ?? 6e5, - httpAgent: options.httpAgent, - maxRetries: options.maxRetries, - fetch: options.fetch - }); - this.completions = new Completions(this); - this.messages = new Messages(this); - this._options = options; - this.apiKey = apiKey4; - this.authToken = authToken; - } - defaultQuery() { - return this._options.defaultQuery; - } - defaultHeaders(opts) { - return { - ...super.defaultHeaders(opts), - "anthropic-version": "2023-06-01", - ...this._options.defaultHeaders - }; - } - validateHeaders(headers, customHeaders) { - if (this.apiKey && headers["x-api-key"]) { - return; - } - if (customHeaders["x-api-key"] === null) { - return; - } - if (this.authToken && headers["authorization"]) { - return; - } - if (customHeaders["authorization"] === null) { - return; - } - throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted'); - } - authHeaders(opts) { - const apiKeyAuth = this.apiKeyAuth(opts); - const bearerAuth = this.bearerAuth(opts); - if (apiKeyAuth != null && !isEmptyObj(apiKeyAuth)) { - return apiKeyAuth; - } - if (bearerAuth != null && !isEmptyObj(bearerAuth)) { - return bearerAuth; - } - return {}; - } - apiKeyAuth(opts) { - if (this.apiKey == null) { - return {}; - } - return { "X-Api-Key": this.apiKey }; - } - bearerAuth(opts) { - if (this.authToken == null) { - return {}; - } - return { Authorization: `Bearer ${this.authToken}` }; - } -}; -_a3 = Anthropic; -Anthropic.Anthropic = _a3; -Anthropic.HUMAN_PROMPT = "\n\nHuman:"; -Anthropic.AI_PROMPT = "\n\nAssistant:"; -Anthropic.AnthropicError = AnthropicError; -Anthropic.APIError = APIError; -Anthropic.APIConnectionError = APIConnectionError; -Anthropic.APIConnectionTimeoutError = APIConnectionTimeoutError; -Anthropic.APIUserAbortError = APIUserAbortError; -Anthropic.NotFoundError = NotFoundError; -Anthropic.ConflictError = ConflictError; -Anthropic.RateLimitError = RateLimitError; -Anthropic.BadRequestError = BadRequestError; -Anthropic.AuthenticationError = AuthenticationError; -Anthropic.InternalServerError = InternalServerError; -Anthropic.PermissionDeniedError = PermissionDeniedError; -Anthropic.UnprocessableEntityError = UnprocessableEntityError; -var { HUMAN_PROMPT, AI_PROMPT } = Anthropic; -var { AnthropicError: AnthropicError2, APIError: APIError2, APIConnectionError: APIConnectionError2, APIConnectionTimeoutError: APIConnectionTimeoutError2, APIUserAbortError: APIUserAbortError2, NotFoundError: NotFoundError2, ConflictError: ConflictError2, RateLimitError: RateLimitError2, BadRequestError: BadRequestError2, AuthenticationError: AuthenticationError2, InternalServerError: InternalServerError2, PermissionDeniedError: PermissionDeniedError2, UnprocessableEntityError: UnprocessableEntityError2 } = error_exports; -(function(Anthropic2) { - Anthropic2.toFile = toFile; - Anthropic2.fileFromPath = fileFromPath; - Anthropic2.Completions = Completions; - Anthropic2.Messages = Messages; -})(Anthropic || (Anthropic = {})); -var sdk_default = Anthropic; - -// src/engine/anthropic.ts -var config6 = getConfig(); -var MAX_TOKENS_OUTPUT3 = config6?.OCO_TOKENS_MAX_OUTPUT || 500 /* DEFAULT_MAX_TOKENS_OUTPUT */; -var MAX_TOKENS_INPUT3 = config6?.OCO_TOKENS_MAX_INPUT || 4096 /* DEFAULT_MAX_TOKENS_INPUT */; -var provider3 = config6?.OCO_AI_PROVIDER; -var apiKey3 = config6?.OCO_ANTHROPIC_API_KEY; -var [command3, mode3] = process.argv.slice(2); -if (provider3 === "anthropic" && !apiKey3 && command3 !== "config" && mode3 !== "set" /* set */) { - ae("opencommit"); - ce( - "OCO_ANTHROPIC_API_KEY is not set, please run `oco config set OCO_ANTHROPIC_API_KEY= . If you are using Claude, make sure you add payment details, so API works.`" - ); - ce( - "For help look into README https://github.com/di-sukharev/opencommit#setup" - ); - process.exit(1); -} -var MODEL3 = config6?.OCO_MODEL; -if (provider3 === "anthropic" && !MODEL_LIST.anthropic.includes(MODEL3) && command3 !== "config" && mode3 !== "set" /* set */) { - ce( - `${source_default.red("\u2716")} Unsupported model ${MODEL3} for Anthropic. Supported models are: ${MODEL_LIST.anthropic.join( - ", " - )}` - ); - process.exit(1); -} -var AnthropicAi = class { - anthropicAiApiConfiguration = { - apiKey: apiKey3 - }; - anthropicAI; - constructor() { - this.anthropicAI = new sdk_default(this.anthropicAiApiConfiguration); - } - generateCommitMessage = async (messages) => { - const systemMessage = messages.find((msg) => msg.role === "system")?.content; - const restMessages = messages.filter((msg) => msg.role !== "system"); - const params = { - model: MODEL3, - system: systemMessage, - messages: restMessages, - temperature: 0, - top_p: 0.1, - max_tokens: MAX_TOKENS_OUTPUT3 - }; - try { - const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a3, b3) => a3 + b3, 0); - if (REQUEST_TOKENS > MAX_TOKENS_INPUT3 - MAX_TOKENS_OUTPUT3) { - throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */); - } - const data = await this.anthropicAI.messages.create(params); - const message = data?.content[0].text; - return message; - } catch (error) { - ce(`${source_default.red("\u2716")} ${JSON.stringify(params)}`); - const err = error; - ce(`${source_default.red("\u2716")} ${err?.message || err}`); - if (axios_default.isAxiosError(error) && error.response?.status === 401) { - const anthropicAiError = error.response.data.error; - if (anthropicAiError?.message) - ce(anthropicAiError.message); - ce( - "For help look into README https://github.com/di-sukharev/opencommit#setup" - ); - } - throw err; - } - }; -}; -var anthropicAi = new AnthropicAi(); - -// src/engine/testAi.ts -var TestAi = class { - async generateCommitMessage(messages) { - return "test commit message"; - } -}; -var testAi = new TestAi(); - // src/utils/engine.ts function getEngine() { const config10 = getConfig(); const provider4 = config10?.OCO_AI_PROVIDER; if (provider4?.startsWith("ollama")) { + const ollamaAi = new OllamaAi(); const model = provider4.split("/")[1]; if (model) ollamaAi.setModel(model); return ollamaAi; - } else if (config10?.OCO_AI_PROVIDER == "anthropic") { - return anthropicAi; - } else if (config10?.OCO_AI_PROVIDER == "test") { - return testAi; - } else if (config10?.OCO_AI_PROVIDER == "azure") { - return azure; + } else if (provider4 == "anthropic") { + return new AnthropicAi(); + } else if (provider4 == "test") { + return new TestAi(); + } else if (provider4 == "gemini") { + return new Gemini(); + } else if (provider4 == "azure") { + return new Azure(); } - return api; + return new OpenAi(); } // src/modules/commitlint/config.ts @@ -58931,7 +59854,16 @@ var configureCommitlintIntegration = async (force = false) => { const spin = le(); spin.start("Loading @commitlint configuration"); const fileExists = await commitlintLLMConfigExists(); - let commitLintConfig = await getCommitLintPWDConfig(); + const commitLintConfig = await getCommitLintPWDConfig(); + if (commitLintConfig === null) { + throw new Error( + `Failed to load @commitlint config. Please check the following: + * @commitlint >= 9.0.0 is installed in the local directory. + * 'node_modules/@commitlint/load' package exists. + * A valid @commitlint configuration exists. + ` + ); + } const hash = await computeHash(JSON.stringify(commitLintConfig)); spin.stop(`Read @commitlint configuration (hash: ${hash})`); if (fileExists) { @@ -58947,16 +59879,16 @@ var configureCommitlintIntegration = async (force = false) => { const prompts = inferPromptsFromCommitlintConfig(commitLintConfig); const consistencyPrompts = commitlintPrompts.GEN_COMMITLINT_CONSISTENCY_PROMPT(prompts); const engine = getEngine(); - let consistency2 = await engine.generateCommitMessage(consistencyPrompts) || "{}"; - prompts.forEach((prompt) => consistency2 = consistency2.replace(prompt, "")); - consistency2 = getJSONBlock(consistency2); - consistency2 = removeDoubleNewlines(consistency2); + let consistency = await engine.generateCommitMessage(consistencyPrompts) || "{}"; + prompts.forEach((prompt) => consistency = consistency.replace(prompt, "")); + consistency = getJSONBlock(consistency); + consistency = removeDoubleNewlines(consistency); const commitlintLLMConfig = { hash, prompts, consistency: { [translation2.localLanguage]: { - ...JSON.parse(consistency2) + ...JSON.parse(consistency) } } }; @@ -59376,6 +60308,22 @@ run(); /*! formdata-polyfill. MIT License. Jimmy Wärting */ /*! node-domexception. MIT License. Jimmy Wärting */ /*! ws. MIT License. Einar Otto Stangvik */ +/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @license * web-streams-polyfill v3.3.3 diff --git a/package-lock.json b/package-lock.json index 2db6c47..62fbc39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "opencommit", - "version": "3.0.16", + "version": "3.0.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "opencommit", - "version": "3.0.16", + "version": "3.0.17", "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", @@ -16,6 +16,7 @@ "@azure/openai": "^1.0.0-beta.12", "@clack/prompts": "^0.6.1", "@dqbd/tiktoken": "^1.0.2", + "@google/generative-ai": "^0.11.4", "@octokit/webhooks-schemas": "^6.11.0", "@octokit/webhooks-types": "^6.11.0", "ai": "^2.2.14", @@ -1051,6 +1052,14 @@ "node": ">=14" } }, + "node_modules/@google/generative-ai": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/@google/generative-ai/-/generative-ai-0.11.4.tgz", + "integrity": "sha512-hlw+E9Prv9aUIQISRnLSXi4rukFqKe5WhxPvzBccTvIvXjw2BHMFOJWSC/Gq7WE0W+L/qRHGmYxopmx9qjrB9w==", + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", diff --git a/package.json b/package.json index 675219f..723bd81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opencommit", - "version": "3.0.16", + "version": "3.0.17", "description": "Auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫", "keywords": [ "git", @@ -43,16 +43,19 @@ "start": "node ./out/cli.cjs", "ollama:start": "OCO_AI_PROVIDER='ollama' node ./out/cli.cjs", "dev": "ts-node ./src/cli.ts", + "dev:gemini": "OCO_AI_PROVIDER='gemini' ts-node ./src/cli.ts", "build": "rimraf out && node esbuild.config.js", "build:push": "npm run build && git add . && git commit -m 'build' && git push", "deploy": "npm version patch && npm run build:push && git push --tags && npm publish --tag latest", "lint": "eslint src --ext ts && tsc --noEmit", "format": "prettier --write src", + "test": "node --no-warnings --experimental-vm-modules $( [ -f ./node_modules/.bin/jest ] && echo ./node_modules/.bin/jest || which jest ) test/unit", "test:all": "npm run test:unit:docker && npm run test:e2e:docker", "test:docker-build": "docker build -t oco-test -f test/Dockerfile .", "test:unit": "NODE_OPTIONS=--experimental-vm-modules jest test/unit", "test:unit:docker": "npm run test:docker-build && DOCKER_CONTENT_TRUST=0 docker run --rm oco-test npm run test:unit", - "test:e2e": "jest test/e2e", + "test:e2e": "npm run test:e2e:setup && jest test/e2e", + "test:e2e:setup": "sh test/e2e/setup.sh", "test:e2e:docker": "npm run test:docker-build && DOCKER_CONTENT_TRUST=0 docker run --rm oco-test npm run test:e2e" }, "devDependencies": { @@ -81,6 +84,7 @@ "@anthropic-ai/sdk": "^0.19.2", "@clack/prompts": "^0.6.1", "@dqbd/tiktoken": "^1.0.2", + "@google/generative-ai": "^0.11.4", "@octokit/webhooks-schemas": "^6.11.0", "@octokit/webhooks-types": "^6.11.0", "ai": "^2.2.14", diff --git a/src/commands/config.ts b/src/commands/config.ts index f4ff307..2d0dbe7 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -10,11 +10,14 @@ import { intro, outro } from '@clack/prompts'; import { COMMANDS } from '../CommandsEnum'; import { getI18nLocal } from '../i18n'; +import { TEST_MOCK_TYPES } from '../engine/testAi'; export enum CONFIG_KEYS { OCO_OPENAI_API_KEY = 'OCO_OPENAI_API_KEY', OCO_ANTHROPIC_API_KEY = 'OCO_ANTHROPIC_API_KEY', OCO_AZURE_API_KEY = 'OCO_AZURE_API_KEY', + OCO_GEMINI_API_KEY = 'OCO_GEMINI_API_KEY', + OCO_GEMINI_BASE_PATH = 'OCO_GEMINI_BASE_PATH', OCO_TOKENS_MAX_INPUT = 'OCO_TOKENS_MAX_INPUT', OCO_TOKENS_MAX_OUTPUT = 'OCO_TOKENS_MAX_OUTPUT', OCO_OPENAI_BASE_PATH = 'OCO_OPENAI_BASE_PATH', @@ -28,7 +31,9 @@ export enum CONFIG_KEYS { OCO_GITPUSH = 'OCO_GITPUSH', OCO_ONE_LINE_COMMIT = 'OCO_ONE_LINE_COMMIT', OCO_AZURE_ENDPOINT = 'OCO_AZURE_ENDPOINT', - OCO_OLLAMA_API_URL = 'OCO_API_URL', + OCO_TEST_MOCK_TYPE = 'OCO_TEST_MOCK_TYPE', + OCO_API_URL = 'OCO_API_URL', + OCO_OLLAMA_API_URL = 'OCO_OLLAMA_API_URL' } export enum CONFIG_MODES { @@ -37,38 +42,50 @@ export enum CONFIG_MODES { } export const MODEL_LIST = { - openai: ["gpt-3.5-turbo", - "gpt-3.5-turbo-instruct", - "gpt-3.5-turbo-0613", - "gpt-3.5-turbo-0301", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-3.5-turbo-16k", - "gpt-3.5-turbo-16k-0613", - "gpt-3.5-turbo-16k-0301", - "gpt-4", - "gpt-4-0314", - "gpt-4-0613", - "gpt-4-1106-preview", - "gpt-4-0125-preview", - "gpt-4-turbo-preview", - "gpt-4-vision-preview", - "gpt-4-1106-vision-preview", - "gpt-4-turbo", - "gpt-4-turbo-2024-04-09", - "gpt-4-32k", - "gpt-4-32k-0314", - "gpt-4-32k-0613", - "gpt-4o", - "gpt-4o-2024-05-13", - "gpt-4o-mini", - "gpt-4o-mini-2024-07-18"], + openai: [ + 'gpt-3.5-turbo', + 'gpt-3.5-turbo-instruct', + 'gpt-3.5-turbo-0613', + 'gpt-3.5-turbo-0301', + 'gpt-3.5-turbo-1106', + 'gpt-3.5-turbo-0125', + 'gpt-3.5-turbo-16k', + 'gpt-3.5-turbo-16k-0613', + 'gpt-3.5-turbo-16k-0301', + 'gpt-4', + 'gpt-4-0314', + 'gpt-4-0613', + 'gpt-4-1106-preview', + 'gpt-4-0125-preview', + 'gpt-4-turbo-preview', + 'gpt-4-vision-preview', + 'gpt-4-1106-vision-preview', + 'gpt-4-turbo', + 'gpt-4-turbo-2024-04-09', + 'gpt-4-32k', + 'gpt-4-32k-0314', + 'gpt-4-32k-0613', + 'gpt-4o', + 'gpt-4o-2024-05-13', + 'gpt-4o-mini', + 'gpt-4o-mini-2024-07-18' + ], - anthropic: ['claude-3-5-sonnet-20240620', - 'claude-3-opus-20240229', - 'claude-3-sonnet-20240229', - 'claude-3-haiku-20240307'] -} + anthropic: [ + 'claude-3-5-sonnet-20240620', + 'claude-3-opus-20240229', + 'claude-3-sonnet-20240229', + 'claude-3-haiku-20240307' + ], + + gemini: [ + 'gemini-1.5-flash', + 'gemini-1.5-pro', + 'gemini-1.0-pro', + 'gemini-pro-vision', + 'text-embedding-004' + ] +}; const getDefaultModel = (provider: string | undefined): string => { switch (provider) { @@ -76,6 +93,8 @@ const getDefaultModel = (provider: string | undefined): string => { return ''; case 'anthropic': return MODEL_LIST.anthropic[0]; + case 'gemini': + return MODEL_LIST.gemini[0]; default: return MODEL_LIST.openai[0]; } @@ -102,10 +121,16 @@ const validateConfig = ( export const configValidators = { [CONFIG_KEYS.OCO_OPENAI_API_KEY](value: any, config: any = {}) { + if (config.OCO_AI_PROVIDER == 'gemini') return value; + //need api key unless running locally with ollama validateConfig( 'OpenAI API_KEY', - value || config.OCO_ANTHROPIC_API_KEY || config.OCO_AI_PROVIDER.startsWith('ollama') || config.OCO_AZURE_API_KEY || config.OCO_AI_PROVIDER == 'test' , + value || + config.OCO_ANTHROPIC_API_KEY || + config.OCO_AI_PROVIDER.startsWith('ollama') || + config.OCO_AZURE_API_KEY || + config.OCO_AI_PROVIDER == 'test', 'You need to provide an OpenAI/Anthropic/Azure API key' ); validateConfig( @@ -120,18 +145,38 @@ export const configValidators = { [CONFIG_KEYS.OCO_AZURE_API_KEY](value: any, config: any = {}) { validateConfig( 'ANTHROPIC_API_KEY', - value || config.OCO_OPENAI_API_KEY || config.OCO_AZURE_API_KEY || config.OCO_AI_PROVIDER == 'ollama' || config.OCO_AI_PROVIDER == 'test', + value || + config.OCO_OPENAI_API_KEY || + config.OCO_AZURE_API_KEY || + config.OCO_AI_PROVIDER == 'ollama' || + config.OCO_AI_PROVIDER == 'test', 'You need to provide an OpenAI/Anthropic/Azure API key' ); return value; }, + [CONFIG_KEYS.OCO_GEMINI_API_KEY](value: any, config: any = {}) { + // only need to check for gemini api key if using gemini + if (config.OCO_AI_PROVIDER != 'gemini') return value; + + validateConfig( + 'Gemini API Key', + value || config.OCO_GEMINI_API_KEY || config.OCO_AI_PROVIDER == 'test', + 'You need to provide an Gemini API key' + ); + + return value; + }, + [CONFIG_KEYS.OCO_ANTHROPIC_API_KEY](value: any, config: any = {}) { validateConfig( 'ANTHROPIC_API_KEY', - value || config.OCO_OPENAI_API_KEY || config.OCO_AI_PROVIDER == 'ollama' || config.OCO_AI_PROVIDER == 'test', - 'You need to provide an OpenAI/Anthropic/Azure API key' + value || + config.OCO_OPENAI_API_KEY || + config.OCO_AI_PROVIDER == 'ollama' || + config.OCO_AI_PROVIDER == 'test', + 'You need to provide an OpenAI/Anthropic API key' ); return value; @@ -216,15 +261,19 @@ export const configValidators = { [CONFIG_KEYS.OCO_MODEL](value: any, config: any = {}) { validateConfig( CONFIG_KEYS.OCO_MODEL, - [...MODEL_LIST.openai, ...MODEL_LIST.anthropic].includes(value) || config.OCO_AI_PROVIDER == 'ollama' || config.OCO_AI_PROVIDER == 'test'|| config.OCO_AI_PROVIDER == 'azure', - `${value} is not supported yet, use 'gpt-4o', 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview', 'gpt-4-0125-preview', 'claude-3-opus-20240229', 'claude-3-sonnet-20240229' or 'claude-3-haiku-20240307'` - ); - validateConfig( - CONFIG_KEYS.OCO_MODEL, - typeof value === 'string' && - value.match(/^[a-zA-Z0-9~\-]{1,63}[a-zA-Z0-9]$/) || - config.OCO_AI_PROVIDER != 'azure', - `${value} is not model deployed name.` + [ + ...MODEL_LIST.openai, + ...MODEL_LIST.anthropic, + ...MODEL_LIST.gemini + ].includes(value) || + config.OCO_AI_PROVIDER == 'ollama' || + config.OCO_AI_PROVIDER == 'azure' || + config.OCO_AI_PROVIDER == 'test', + `${value} is not supported yet, use:\n\n ${[ + ...MODEL_LIST.openai, + ...MODEL_LIST.anthropic, + ...MODEL_LIST.gemini + ].join('\n')}` ); return value; }, @@ -259,15 +308,9 @@ export const configValidators = { [CONFIG_KEYS.OCO_AI_PROVIDER](value: any) { validateConfig( CONFIG_KEYS.OCO_AI_PROVIDER, - [ - '', - 'openai', - 'anthropic', - 'azure', - 'ollama', - 'test' - ].includes(value) || value.startsWith('ollama'), - `${value} is not supported yet, use 'ollama/{model}', 'azure', 'anthropic' or 'openai' (default)` + ['', 'openai', 'anthropic', 'gemini', 'azure', 'test'].includes(value) || + value.startsWith('ollama'), + `${value} is not supported yet, use 'ollama', 'anthropic', 'azure', 'gemini' or 'openai' (default)` ); return value; }, @@ -290,14 +333,26 @@ export const configValidators = { return value; }, - [CONFIG_KEYS.OCO_OLLAMA_API_URL](value: any) { // add simple api validator + [CONFIG_KEYS.OCO_TEST_MOCK_TYPE](value: any) { + validateConfig( + CONFIG_KEYS.OCO_TEST_MOCK_TYPE, + TEST_MOCK_TYPES.includes(value), + `${value} is not supported yet, use ${TEST_MOCK_TYPES.map( + (t) => `'${t}'` + ).join(', ')}` + ); + return value; + }, + + [CONFIG_KEYS.OCO_OLLAMA_API_URL](value: any) { + // add simple api validator validateConfig( CONFIG_KEYS.OCO_API_URL, typeof value === 'string' && value.startsWith('http'), `${value} is not a valid URL` ); return value; - }, + } }; export type ConfigType = { @@ -311,14 +366,15 @@ export const getConfig = ({ configPath = defaultConfigPath, envPath = defaultEnvPath }: { - configPath?: string - envPath?: string + configPath?: string; + envPath?: string; } = {}): ConfigType | null => { dotenv.config({ path: envPath }); const configFromEnv = { OCO_OPENAI_API_KEY: process.env.OCO_OPENAI_API_KEY, OCO_ANTHROPIC_API_KEY: process.env.OCO_ANTHROPIC_API_KEY, OCO_AZURE_API_KEY: process.env.OCO_AZURE_API_KEY, + OCO_GEMINI_API_KEY: process.env.OCO_GEMINI_API_KEY, OCO_TOKENS_MAX_INPUT: process.env.OCO_TOKENS_MAX_INPUT ? Number(process.env.OCO_TOKENS_MAX_INPUT) : undefined, @@ -326,9 +382,11 @@ export const getConfig = ({ ? Number(process.env.OCO_TOKENS_MAX_OUTPUT) : undefined, OCO_OPENAI_BASE_PATH: process.env.OCO_OPENAI_BASE_PATH, + OCO_GEMINI_BASE_PATH: process.env.OCO_GEMINI_BASE_PATH, OCO_DESCRIPTION: process.env.OCO_DESCRIPTION === 'true' ? true : false, OCO_EMOJI: process.env.OCO_EMOJI === 'true' ? true : false, - OCO_MODEL: process.env.OCO_MODEL || getDefaultModel(process.env.OCO_AI_PROVIDER), + OCO_MODEL: + process.env.OCO_MODEL || getDefaultModel(process.env.OCO_AI_PROVIDER), OCO_LANGUAGE: process.env.OCO_LANGUAGE || 'en', OCO_MESSAGE_TEMPLATE_PLACEHOLDER: process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || '$msg', @@ -338,6 +396,7 @@ export const getConfig = ({ OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === 'true' ? true : false, OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || '', + OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || 'commit-message' }; const configExists = existsSync(configPath); @@ -347,9 +406,7 @@ export const getConfig = ({ const config = iniParse(configFile); for (const configKey of Object.keys(config)) { - if ( - ['null', 'undefined'].includes(config[configKey]) - ) { + if (['null', 'undefined'].includes(config[configKey])) { config[configKey] = undefined; continue; } @@ -373,7 +430,10 @@ export const getConfig = ({ return config; }; -export const setConfig = (keyValues: [key: string, value: string][], configPath: string = defaultConfigPath) => { +export const setConfig = ( + keyValues: [key: string, value: string][], + configPath: string = defaultConfigPath +) => { const config = getConfig() || {}; for (const [configKey, configValue] of keyValues) { diff --git a/src/engine/anthropic.ts b/src/engine/anthropic.ts index 1aaf532..dcd9faa 100644 --- a/src/engine/anthropic.ts +++ b/src/engine/anthropic.ts @@ -59,7 +59,7 @@ if (provider === 'anthropic' && process.exit(1); } -class AnthropicAi implements AiEngine { +export class AnthropicAi implements AiEngine { private anthropicAiApiConfiguration = { apiKey: apiKey }; @@ -120,5 +120,3 @@ class AnthropicAi implements AiEngine { } }; } - -export const anthropicAi = new AnthropicAi(); \ No newline at end of file diff --git a/src/engine/azure.ts b/src/engine/azure.ts index 578d2b7..cfd18ed 100644 --- a/src/engine/azure.ts +++ b/src/engine/azure.ts @@ -54,7 +54,7 @@ if ( const MODEL = config?.OCO_MODEL || 'gpt-3.5-turbo'; -class Azure implements AiEngine { +export class Azure implements AiEngine { private openAI!: OpenAIClient; constructor() { diff --git a/src/engine/gemini.ts b/src/engine/gemini.ts new file mode 100644 index 0000000..552ae2c --- /dev/null +++ b/src/engine/gemini.ts @@ -0,0 +1,133 @@ +import { ChatCompletionRequestMessage } from 'openai'; +import { AiEngine } from './Engine'; +import { Content, GenerativeModel, GoogleGenerativeAI, HarmBlockThreshold, HarmCategory, Part } from '@google/generative-ai'; +import { CONFIG_MODES, ConfigType, DEFAULT_TOKEN_LIMITS, getConfig, MODEL_LIST } from '../commands/config'; +import { intro, outro } from '@clack/prompts'; +import chalk from 'chalk'; +import axios from 'axios'; + + +export class Gemini implements AiEngine { + + private readonly config: ConfigType; + private readonly googleGenerativeAi: GoogleGenerativeAI; + private ai: GenerativeModel; + + // vars + private maxTokens = { + input: DEFAULT_TOKEN_LIMITS.DEFAULT_MAX_TOKENS_INPUT, + output: DEFAULT_TOKEN_LIMITS.DEFAULT_MAX_TOKENS_OUTPUT + }; + private basePath: string; + private apiKey: string; + private model: string; + + constructor() { + this.config = getConfig() as ConfigType; + this.googleGenerativeAi = new GoogleGenerativeAI(this.config.OCO_GEMINI_API_KEY); + + this.warmup(); + } + + async generateCommitMessage(messages: ChatCompletionRequestMessage[]): Promise { + const systemInstruction = messages.filter(m => m.role === 'system') + .map(m => m.content) + .join('\n'); + + this.ai = this.googleGenerativeAi.getGenerativeModel({ + model: this.model, + systemInstruction, + }); + + const contents = messages.filter(m => m.role !== 'system') + .map(m => ({ parts: [{ text: m.content } as Part], role: m.role == 'user' ? m.role : 'model', } as Content)); + + try { + const result = await this.ai.generateContent({ + contents, + safetySettings: [ + { + category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE, + }, + { + category: HarmCategory.HARM_CATEGORY_HARASSMENT, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + }, + { + category: HarmCategory.HARM_CATEGORY_HATE_SPEECH, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + }, + { + category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, + threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE + }, + ], + generationConfig: { + maxOutputTokens: this.maxTokens.output, + temperature: 0, + topP: 0.1, + }, + }); + + return result.response.text(); + } catch (error) { + const err = error as Error; + outro(`${chalk.red('✖')} ${err?.message || err}`); + + if ( + axios.isAxiosError<{ error?: { message: string } }>(error) && + error.response?.status === 401 + ) { + const geminiError = error.response.data.error; + + if (geminiError?.message) outro(geminiError.message); + outro( + 'For help look into README https://github.com/di-sukharev/opencommit#setup' + ); + } + + throw err; + } + } + + private warmup(): void { + if (this.config.OCO_TOKENS_MAX_INPUT !== undefined) this.maxTokens.input = this.config.OCO_TOKENS_MAX_INPUT; + if (this.config.OCO_TOKENS_MAX_OUTPUT !== undefined) this.maxTokens.output = this.config.OCO_TOKENS_MAX_OUTPUT; + this.basePath = this.config.OCO_GEMINI_BASE_PATH; + this.apiKey = this.config.OCO_GEMINI_API_KEY; + + const [command, mode] = process.argv.slice(2); + + const provider = this.config.OCO_AI_PROVIDER; + + if (provider === 'gemini' && !this.apiKey && + command !== 'config' && mode !== 'set') { + intro('opencommit'); + + outro('OCO_GEMINI_API_KEY is not set, please run `oco config set OCO_GEMINI_API_KEY= . If you are using GPT, make sure you add payment details, so API works.'); + + outro( + 'For help look into README https://github.com/di-sukharev/opencommit#setup' + ); + + process.exit(1); + } + + this.model = this.config.OCO_MODEL || MODEL_LIST.gemini[0]; + + if (provider === 'gemini' && + !MODEL_LIST.gemini.includes(this.model) && + command !== 'config' && + mode !== CONFIG_MODES.set) { + outro( + `${chalk.red('✖')} Unsupported model ${this.model} for Gemini. Supported models are: ${MODEL_LIST.gemini.join( + ', ' + )}` + ); + + process.exit(1); + } + } + +} \ No newline at end of file diff --git a/src/engine/ollama.ts b/src/engine/ollama.ts index 5b187f0..5899d79 100644 --- a/src/engine/ollama.ts +++ b/src/engine/ollama.ts @@ -50,5 +50,3 @@ export class OllamaAi implements AiEngine { } } } - -export const ollamaAi = new OllamaAi(); diff --git a/src/engine/openAi.ts b/src/engine/openAi.ts index 5f530a6..4727f74 100644 --- a/src/engine/openAi.ts +++ b/src/engine/openAi.ts @@ -66,7 +66,8 @@ if (provider === 'openai' && process.exit(1); } -class OpenAi implements AiEngine { +export class OpenAi implements AiEngine { + private openAiApiConfiguration = new OpenAiApiConfiguration({ apiKey: apiKey }); @@ -91,7 +92,7 @@ class OpenAi implements AiEngine { }; try { const REQUEST_TOKENS = messages - .map((msg) => tokenCount(msg.content) + 4) + .map((msg) => tokenCount(msg.content as string) + 4) .reduce((a, b) => a + b, 0); if (REQUEST_TOKENS > MAX_TOKENS_INPUT - MAX_TOKENS_OUTPUT) { @@ -124,6 +125,6 @@ class OpenAi implements AiEngine { throw err; } }; + } -export const api = new OpenAi(); diff --git a/src/engine/testAi.ts b/src/engine/testAi.ts index 2d4f72b..78c7424 100644 --- a/src/engine/testAi.ts +++ b/src/engine/testAi.ts @@ -1,12 +1,31 @@ import { ChatCompletionRequestMessage } from 'openai'; import { AiEngine } from './Engine'; +import { getConfig } from '../commands/config'; + +export const TEST_MOCK_TYPES = [ + 'commit-message', + 'prompt-module-commitlint-config', +] as const +type TestMockType = typeof TEST_MOCK_TYPES[number]; export class TestAi implements AiEngine { async generateCommitMessage( - messages: Array + _messages: Array ): Promise { - return 'test commit message'; + const config = getConfig(); + switch (config?.OCO_TEST_MOCK_TYPE as TestMockType | undefined) { + case 'commit-message': + return 'fix(testAi.ts): test commit message'; + case 'prompt-module-commitlint-config': + return `{\n` + + ` "localLanguage": "english",\n` + + ` "commitFix": "fix(server): Change 'port' variable to uppercase 'PORT'",\n` + + ` "commitFeat": "feat(server): Allow server to listen on a port specified through environment variable",\n` + + ` "commitDescription": "Change 'port' variable to uppercase 'PORT'. Allow server to listen on a port specified through environment variable."\n` + + `}` + default: + throw Error('unsupported test mock type') + } } } -export const testAi = new TestAi(); diff --git a/src/generateCommitMessageFromGitDiff.ts b/src/generateCommitMessageFromGitDiff.ts index 14bd575..3f5981e 100644 --- a/src/generateCommitMessageFromGitDiff.ts +++ b/src/generateCommitMessageFromGitDiff.ts @@ -49,7 +49,7 @@ export const generateCommitMessageByDiff = async ( const INIT_MESSAGES_PROMPT = await getMainCommitPrompt(fullGitMojiSpec); const INIT_MESSAGES_PROMPT_LENGTH = INIT_MESSAGES_PROMPT.map( - (msg) => tokenCount(msg.content) + 4 + (msg) => tokenCount(msg.content as string) + 4 ).reduce((a, b) => a + b, 0); const MAX_REQUEST_TOKENS = @@ -65,9 +65,9 @@ export const generateCommitMessageByDiff = async ( fullGitMojiSpec ); - const commitMessages = []; + const commitMessages = [] as string[]; for (const promise of commitMessagePromises) { - commitMessages.push(await promise); + commitMessages.push((await promise) as string); await delay(2000); } @@ -106,7 +106,7 @@ function getMessagesPromisesByChangesInFile( maxChangeLength ); - const lineDiffsWithHeader = []; + const lineDiffsWithHeader = [] as string[]; for (const change of mergedChanges) { const totalChange = fileHeader + change; if (tokenCount(totalChange) > maxChangeLength) { @@ -135,7 +135,7 @@ function getMessagesPromisesByChangesInFile( function splitDiff(diff: string, maxChangeLength: number) { const lines = diff.split('\n'); - const splitDiffs = []; + const splitDiffs = [] as string[]; let currentDiff = ''; if (maxChangeLength <= 0) { @@ -181,7 +181,7 @@ export const getCommitMsgsPromisesFromFileDiffs = async ( // merge multiple files-diffs into 1 prompt to save tokens const mergedFilesDiffs = mergeDiffs(diffByFiles, maxDiffLength); - const commitMessagePromises = []; + const commitMessagePromises = [] as Promise[]; for (const fileDiff of mergedFilesDiffs) { if (tokenCount(fileDiff) >= maxDiffLength) { diff --git a/src/modules/commitlint/config.ts b/src/modules/commitlint/config.ts index 0d5a1b8..5465a02 100644 --- a/src/modules/commitlint/config.ts +++ b/src/modules/commitlint/config.ts @@ -19,7 +19,16 @@ export const configureCommitlintIntegration = async (force = false) => { const fileExists = await utils.commitlintLLMConfigExists(); - let commitLintConfig = await getCommitLintPWDConfig(); + const commitLintConfig = await getCommitLintPWDConfig(); + if (commitLintConfig === null) { + throw new Error( + `Failed to load @commitlint config. Please check the following: + * @commitlint >= 9.0.0 is installed in the local directory. + * 'node_modules/@commitlint/load' package exists. + * A valid @commitlint configuration exists. + `, + ); + } // debug complete @commitlint configuration // await fs.writeFile( diff --git a/src/modules/commitlint/pwd-commitlint.ts b/src/modules/commitlint/pwd-commitlint.ts index 00c4807..76e74e9 100644 --- a/src/modules/commitlint/pwd-commitlint.ts +++ b/src/modules/commitlint/pwd-commitlint.ts @@ -1,11 +1,25 @@ +import fs from 'fs/promises'; import path from 'path'; -const nodeModulesPath = path.join( - process.env.PWD || process.cwd(), - 'node_modules', - '@commitlint', - 'load' -); +const getCommitLintModuleType = async (): Promise<'cjs' | 'esm'> => { + const packageFile = 'node_modules/@commitlint/load/package.json'; + const packageJsonPath = path.join( + process.env.PWD || process.cwd(), + packageFile, + ); + const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8')); + if (!packageJson) { + throw new Error(`Failed to parse ${packageFile}`); + } + + return packageJson.type === 'module' ? 'esm' : 'cjs'; +}; + +/** + * QualifiedConfig from any version of @commitlint/types + * @see https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/types/src/load.ts + */ +type QualifiedConfigOnAnyVersion = { [key:string]: unknown }; /** * This code is loading the configuration for the `@commitlint` package from the current working @@ -13,8 +27,31 @@ const nodeModulesPath = path.join( * * @returns */ -export const getCommitLintPWDConfig = async () => { - const load = require(nodeModulesPath).default; +export const getCommitLintPWDConfig = async (): Promise => { + let load, nodeModulesPath; + switch (await getCommitLintModuleType()) { + case 'cjs': + /** + * CommonJS (<= commitlint@v18.x.x.) + */ + nodeModulesPath = path.join( + process.env.PWD || process.cwd(), + 'node_modules/@commitlint/load', + ); + load = require(nodeModulesPath).default; + break; + case 'esm': + /** + * ES Module (commitlint@v19.x.x. <= ) + * Directory import is not supported in ES Module resolution, so import the file directly + */ + nodeModulesPath = path.join( + process.env.PWD || process.cwd(), + 'node_modules/@commitlint/load/lib/load.js', + ); + load = (await import(nodeModulesPath)).default; + break; + } if (load && typeof load === 'function') { return await load(); diff --git a/src/modules/commitlint/utils.ts b/src/modules/commitlint/utils.ts index 72c81e4..1e02c8a 100644 --- a/src/modules/commitlint/utils.ts +++ b/src/modules/commitlint/utils.ts @@ -20,8 +20,8 @@ export const getJSONBlock = (input: string): string => { const jsonIndex = input.search('```json'); if (jsonIndex > -1) { input = input.slice(jsonIndex + 8); - const endJsonIndex = consistency.search('```'); - input = input.slice(0, endJsonIndex); + const endJsonIndex = input.search('```'); + input = input.slice(0, endJsonIndex); } return input; }; diff --git a/src/utils/engine.ts b/src/utils/engine.ts index 793c39e..ac9fdfd 100644 --- a/src/utils/engine.ts +++ b/src/utils/engine.ts @@ -1,26 +1,32 @@ import { AiEngine } from '../engine/Engine'; -import { api } from '../engine/openAi'; +import { OpenAi } from '../engine/openAi'; +import { Gemini } from '../engine/gemini'; import { getConfig } from '../commands/config'; -import { ollamaAi } from '../engine/ollama'; -import { azure } from '../engine/azure'; -import { anthropicAi } from '../engine/anthropic' -import { testAi } from '../engine/testAi'; +import { OllamaAi } from '../engine/ollama'; +import { AnthropicAi } from '../engine/anthropic' +import { TestAi } from '../engine/testAi'; +import { Azure } from '../engine/azure'; export function getEngine(): AiEngine { const config = getConfig(); const provider = config?.OCO_AI_PROVIDER; + if (provider?.startsWith('ollama')) { + const ollamaAi = new OllamaAi(); const model = provider.split('/')[1]; if (model) ollamaAi.setModel(model); return ollamaAi; - } else if (config?.OCO_AI_PROVIDER == 'anthropic') { - return anthropicAi; - } else if (config?.OCO_AI_PROVIDER == 'test') { - return testAi; - } else if (config?.OCO_AI_PROVIDER == 'azure') { - return azure; + } else if (provider == 'anthropic') { + return new AnthropicAi(); + } else if (provider == 'test') { + return new TestAi(); + } else if (provider == 'gemini') { + return new Gemini(); + } else if (provider == 'azure') { + return new Azure(); } - // open ai gpt by default - return api; + + //open ai gpt by default + return new OpenAi(); } diff --git a/test/e2e/noChanges.test.ts b/test/e2e/noChanges.test.ts index 031e88b..b50e740 100644 --- a/test/e2e/noChanges.test.ts +++ b/test/e2e/noChanges.test.ts @@ -5,7 +5,6 @@ import { prepareEnvironment } from './utils'; it('cli flow when there are no changes', async () => { const { gitDir, cleanup } = await prepareEnvironment(); - const { findByText } = await render(`OCO_AI_PROVIDER='test' node`, [resolve('./out/cli.cjs')], { cwd: gitDir }); expect(await findByText('No changes detected')).toBeInTheConsole(); diff --git a/test/e2e/oneFile.test.ts b/test/e2e/oneFile.test.ts index aaa69c1..ddfbc10 100644 --- a/test/e2e/oneFile.test.ts +++ b/test/e2e/oneFile.test.ts @@ -10,7 +10,6 @@ it('cli flow to generate commit message for 1 new file (staged)', async () => { await render('git' ,['add index.ts'], { cwd: gitDir }); const { queryByText, findByText, userEvent } = await render(`OCO_AI_PROVIDER='test' node`, [resolve('./out/cli.cjs')], { cwd: gitDir }); - expect(await queryByText('No files are staged')).not.toBeInTheConsole(); expect(await queryByText('Do you want to stage all files and generate commit message?')).not.toBeInTheConsole(); diff --git a/test/e2e/prompt-module/commitlint.test.ts b/test/e2e/prompt-module/commitlint.test.ts new file mode 100644 index 0000000..b7303e4 --- /dev/null +++ b/test/e2e/prompt-module/commitlint.test.ts @@ -0,0 +1,224 @@ +import { resolve } from 'path'; +import { render } from 'cli-testing-library'; +import 'cli-testing-library/extend-expect'; +import { prepareEnvironment, wait } from '../utils'; +import path from 'path'; + +function getAbsolutePath(relativePath: string) { + const scriptDir = path.dirname(__filename); + return path.resolve(scriptDir, relativePath); +} +async function setupCommitlint(dir: string, ver: 9 | 18 | 19) { + let packagePath, packageJsonPath, configPath; + switch (ver) { + case 9: + packagePath = getAbsolutePath('./data/commitlint_9/node_modules'); + packageJsonPath = getAbsolutePath('./data/commitlint_9/package.json'); + configPath = getAbsolutePath('./data/commitlint_9/commitlint.config.js'); + break; + case 18: + packagePath = getAbsolutePath('./data/commitlint_18/node_modules'); + packageJsonPath = getAbsolutePath('./data/commitlint_18/package.json'); + configPath = getAbsolutePath('./data/commitlint_18/commitlint.config.js'); + break; + case 19: + packagePath = getAbsolutePath('./data/commitlint_19/node_modules'); + packageJsonPath = getAbsolutePath('./data/commitlint_19/package.json'); + configPath = getAbsolutePath('./data/commitlint_19/commitlint.config.js'); + break; + } + await render('cp', ['-r', packagePath, '.'], { cwd: dir }); + await render('cp', [packageJsonPath, '.'], { cwd: dir }); + await render('cp', [configPath, '.'], { cwd: dir }); + await wait(3000); // Avoid flakiness by waiting +} + +describe('cli flow to run "oco commitlint force"', () => { + it('on commitlint@9 using CJS', async () => { + const { gitDir, cleanup } = await prepareEnvironment(); + + await setupCommitlint(gitDir, 9); + const npmList = await render('npm', ['list', '@commitlint/load'], { + cwd: gitDir + }); + expect(await npmList.findByText('@commitlint/load@9')).toBeInTheConsole(); + + const { findByText } = await render( + ` + OCO_TEST_MOCK_TYPE='prompt-module-commitlint-config' \ + OCO_PROMPT_MODULE='@commitlint' \ + OCO_AI_PROVIDER='test' \ + node ${resolve('./out/cli.cjs')} commitlint force \ + `, + [], + { cwd: gitDir } + ); + + expect( + await findByText('opencommit — configure @commitlint') + ).toBeInTheConsole(); + expect( + await findByText('Read @commitlint configuration') + ).toBeInTheConsole(); + + expect( + await findByText('Generating consistency with given @commitlint rules') + ).toBeInTheConsole(); + expect( + await findByText('Done - please review contents of') + ).toBeInTheConsole(); + + await cleanup(); + }); + it('on commitlint@18 using CJS', async () => { + const { gitDir, cleanup } = await prepareEnvironment(); + + await setupCommitlint(gitDir, 18); + const npmList = await render('npm', ['list', '@commitlint/load'], { + cwd: gitDir + }); + expect(await npmList.findByText('@commitlint/load@18')).toBeInTheConsole(); + + const { findByText } = await render( + ` + OCO_TEST_MOCK_TYPE='prompt-module-commitlint-config' \ + OCO_PROMPT_MODULE='@commitlint' \ + OCO_AI_PROVIDER='test' \ + node ${resolve('./out/cli.cjs')} commitlint force \ + `, + [], + { cwd: gitDir } + ); + + expect( + await findByText('opencommit — configure @commitlint') + ).toBeInTheConsole(); + expect( + await findByText('Read @commitlint configuration') + ).toBeInTheConsole(); + + expect( + await findByText('Generating consistency with given @commitlint rules') + ).toBeInTheConsole(); + expect( + await findByText('Done - please review contents of') + ).toBeInTheConsole(); + + await cleanup(); + }); + it('on commitlint@19 using ESM', async () => { + const { gitDir, cleanup } = await prepareEnvironment(); + + await setupCommitlint(gitDir, 19); + const npmList = await render('npm', ['list', '@commitlint/load'], { + cwd: gitDir + }); + expect(await npmList.findByText('@commitlint/load@19')).toBeInTheConsole(); + + const { findByText } = await render( + ` + OCO_TEST_MOCK_TYPE='prompt-module-commitlint-config' \ + OCO_PROMPT_MODULE='@commitlint' \ + OCO_AI_PROVIDER='test' \ + node ${resolve('./out/cli.cjs')} commitlint force \ + `, + [], + { cwd: gitDir } + ); + + expect( + await findByText('opencommit — configure @commitlint') + ).toBeInTheConsole(); + expect( + await findByText('Read @commitlint configuration') + ).toBeInTheConsole(); + + expect( + await findByText('Generating consistency with given @commitlint rules') + ).toBeInTheConsole(); + expect( + await findByText('Done - please review contents of') + ).toBeInTheConsole(); + + await cleanup(); + }); +}); + +describe('cli flow to generate commit message using @commitlint prompt-module', () => { + it('on commitlint@19 using ESM', async () => { + const { gitDir, cleanup } = await prepareEnvironment(); + + // Setup commitlint@19 + await setupCommitlint(gitDir, 19); + const npmList = await render('npm', ['list', '@commitlint/load'], { + cwd: gitDir + }); + expect(await npmList.findByText('@commitlint/load@19')).toBeInTheConsole(); + + // Run `oco commitlint force` + const commitlintForce = await render( + ` + OCO_TEST_MOCK_TYPE='prompt-module-commitlint-config' \ + OCO_PROMPT_MODULE='@commitlint' \ + OCO_AI_PROVIDER='test' \ + node ${resolve('./out/cli.cjs')} commitlint force \ + `, + [], + { cwd: gitDir } + ); + expect( + await commitlintForce.findByText('Done - please review contents of') + ).toBeInTheConsole(); + + // Run `oco commitlint get` + const commitlintGet = await render( + ` + OCO_TEST_MOCK_TYPE='prompt-module-commitlint-config' \ + OCO_PROMPT_MODULE='@commitlint' \ + OCO_AI_PROVIDER='test' \ + node ${resolve('./out/cli.cjs')} commitlint get \ + `, + [], + { cwd: gitDir } + ); + expect( + await commitlintGet.findByText('[object Object]') + ).toBeInTheConsole(); + + // Run 'oco' using .opencommit-commitlint + await render('echo', [`'console.log("Hello World");' > index.ts`], { + cwd: gitDir + }); + await render('git', ['add index.ts'], { cwd: gitDir }); + + const oco = await render( + ` + OCO_TEST_MOCK_TYPE='commit-message' \ + OCO_PROMPT_MODULE='@commitlint' \ + OCO_AI_PROVIDER='test' \ + node ${resolve('./out/cli.cjs')} \ + `, + [], + { cwd: gitDir } + ); + + expect( + await oco.findByText('Generating the commit message') + ).toBeInTheConsole(); + expect( + await oco.findByText('Confirm the commit message?') + ).toBeInTheConsole(); + oco.userEvent.keyboard('[Enter]'); + + expect( + await oco.findByText('Choose a remote to push to') + ).toBeInTheConsole(); + oco.userEvent.keyboard('[Enter]'); + + expect( + await oco.findByText('Successfully pushed all commits to origin') + ).toBeInTheConsole(); + + await cleanup(); + }); +}); diff --git a/test/e2e/prompt-module/data/commitlint_18/commitlint.config.js b/test/e2e/prompt-module/data/commitlint_18/commitlint.config.js new file mode 100644 index 0000000..c34aa79 --- /dev/null +++ b/test/e2e/prompt-module/data/commitlint_18/commitlint.config.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ['@commitlint/config-conventional'] +}; diff --git a/test/e2e/prompt-module/data/commitlint_18/package-lock.json b/test/e2e/prompt-module/data/commitlint_18/package-lock.json new file mode 100644 index 0000000..5919819 --- /dev/null +++ b/test/e2e/prompt-module/data/commitlint_18/package-lock.json @@ -0,0 +1,2029 @@ +{ + "name": "commitlint-test", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "commitlint-test", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "@commitlint/cli": "^18.0.0", + "@commitlint/config-conventional": "^18.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", + "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.24.2", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", + "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", + "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.5", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@commitlint/cli": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-18.6.1.tgz", + "integrity": "sha512-5IDE0a+lWGdkOvKH892HHAZgbAjcj1mT5QrfA/SVbLJV/BbBMGyKN0W5mhgjekPJJwEQdVNvhl9PwUacY58Usw==", + "dev": true, + "dependencies": { + "@commitlint/format": "^18.6.1", + "@commitlint/lint": "^18.6.1", + "@commitlint/load": "^18.6.1", + "@commitlint/read": "^18.6.1", + "@commitlint/types": "^18.6.1", + "execa": "^5.0.0", + "lodash.isfunction": "^3.0.9", + "resolve-from": "5.0.0", + "resolve-global": "1.0.0", + "yargs": "^17.0.0" + }, + "bin": { + "commitlint": "cli.js" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/config-conventional": { + "version": "18.6.3", + "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-18.6.3.tgz", + "integrity": "sha512-8ZrRHqF6je+TRaFoJVwszwnOXb/VeYrPmTwPhf0WxpzpGTcYy1p0SPyZ2eRn/sRi/obnWAcobtDAq6+gJQQNhQ==", + "dev": true, + "dependencies": { + "@commitlint/types": "^18.6.1", + "conventional-changelog-conventionalcommits": "^7.0.2" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/config-validator": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-18.6.1.tgz", + "integrity": "sha512-05uiToBVfPhepcQWE1ZQBR/Io3+tb3gEotZjnI4tTzzPk16NffN6YABgwFQCLmzZefbDcmwWqJWc2XT47q7Znw==", + "dev": true, + "dependencies": { + "@commitlint/types": "^18.6.1", + "ajv": "^8.11.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/ensure": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-18.6.1.tgz", + "integrity": "sha512-BPm6+SspyxQ7ZTsZwXc7TRQL5kh5YWt3euKmEIBZnocMFkJevqs3fbLRb8+8I/cfbVcAo4mxRlpTPfz8zX7SnQ==", + "dev": true, + "dependencies": { + "@commitlint/types": "^18.6.1", + "lodash.camelcase": "^4.3.0", + "lodash.kebabcase": "^4.1.1", + "lodash.snakecase": "^4.1.1", + "lodash.startcase": "^4.4.0", + "lodash.upperfirst": "^4.3.1" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/execute-rule": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-18.6.1.tgz", + "integrity": "sha512-7s37a+iWyJiGUeMFF6qBlyZciUkF8odSAnHijbD36YDctLhGKoYltdvuJ/AFfRm6cBLRtRk9cCVPdsEFtt/2rg==", + "dev": true, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/format": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-18.6.1.tgz", + "integrity": "sha512-K8mNcfU/JEFCharj2xVjxGSF+My+FbUHoqR+4GqPGrHNqXOGNio47ziiR4HQUPKtiNs05o8/WyLBoIpMVOP7wg==", + "dev": true, + "dependencies": { + "@commitlint/types": "^18.6.1", + "chalk": "^4.1.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/is-ignored": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-18.6.1.tgz", + "integrity": "sha512-MOfJjkEJj/wOaPBw5jFjTtfnx72RGwqYIROABudOtJKW7isVjFe9j0t8xhceA02QebtYf4P/zea4HIwnXg8rvA==", + "dev": true, + "dependencies": { + "@commitlint/types": "^18.6.1", + "semver": "7.6.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/lint": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-18.6.1.tgz", + "integrity": "sha512-8WwIFo3jAuU+h1PkYe5SfnIOzp+TtBHpFr4S8oJWhu44IWKuVx6GOPux3+9H1iHOan/rGBaiacicZkMZuluhfQ==", + "dev": true, + "dependencies": { + "@commitlint/is-ignored": "^18.6.1", + "@commitlint/parse": "^18.6.1", + "@commitlint/rules": "^18.6.1", + "@commitlint/types": "^18.6.1" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/load": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-18.6.1.tgz", + "integrity": "sha512-p26x8734tSXUHoAw0ERIiHyW4RaI4Bj99D8YgUlVV9SedLf8hlWAfyIFhHRIhfPngLlCe0QYOdRKYFt8gy56TA==", + "dev": true, + "dependencies": { + "@commitlint/config-validator": "^18.6.1", + "@commitlint/execute-rule": "^18.6.1", + "@commitlint/resolve-extends": "^18.6.1", + "@commitlint/types": "^18.6.1", + "chalk": "^4.1.0", + "cosmiconfig": "^8.3.6", + "cosmiconfig-typescript-loader": "^5.0.0", + "lodash.isplainobject": "^4.0.6", + "lodash.merge": "^4.6.2", + "lodash.uniq": "^4.5.0", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/message": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-18.6.1.tgz", + "integrity": "sha512-VKC10UTMLcpVjMIaHHsY1KwhuTQtdIKPkIdVEwWV+YuzKkzhlI3aNy6oo1eAN6b/D2LTtZkJe2enHmX0corYRw==", + "dev": true, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/parse": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-18.6.1.tgz", + "integrity": "sha512-eS/3GREtvVJqGZrwAGRwR9Gdno3YcZ6Xvuaa+vUF8j++wsmxrA2En3n0ccfVO2qVOLJC41ni7jSZhQiJpMPGOQ==", + "dev": true, + "dependencies": { + "@commitlint/types": "^18.6.1", + "conventional-changelog-angular": "^7.0.0", + "conventional-commits-parser": "^5.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/read": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-18.6.1.tgz", + "integrity": "sha512-ia6ODaQFzXrVul07ffSgbZGFajpe8xhnDeLIprLeyfz3ivQU1dIoHp7yz0QIorZ6yuf4nlzg4ZUkluDrGN/J/w==", + "dev": true, + "dependencies": { + "@commitlint/top-level": "^18.6.1", + "@commitlint/types": "^18.6.1", + "git-raw-commits": "^2.0.11", + "minimist": "^1.2.6" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/resolve-extends": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-18.6.1.tgz", + "integrity": "sha512-ifRAQtHwK+Gj3Bxj/5chhc4L2LIc3s30lpsyW67yyjsETR6ctHAHRu1FSpt0KqahK5xESqoJ92v6XxoDRtjwEQ==", + "dev": true, + "dependencies": { + "@commitlint/config-validator": "^18.6.1", + "@commitlint/types": "^18.6.1", + "import-fresh": "^3.0.0", + "lodash.mergewith": "^4.6.2", + "resolve-from": "^5.0.0", + "resolve-global": "^1.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/rules": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-18.6.1.tgz", + "integrity": "sha512-kguM6HxZDtz60v/zQYOe0voAtTdGybWXefA1iidjWYmyUUspO1zBPQEmJZ05/plIAqCVyNUTAiRPWIBKLCrGew==", + "dev": true, + "dependencies": { + "@commitlint/ensure": "^18.6.1", + "@commitlint/message": "^18.6.1", + "@commitlint/to-lines": "^18.6.1", + "@commitlint/types": "^18.6.1", + "execa": "^5.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/to-lines": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-18.6.1.tgz", + "integrity": "sha512-Gl+orGBxYSNphx1+83GYeNy5N0dQsHBQ9PJMriaLQDB51UQHCVLBT/HBdOx5VaYksivSf5Os55TLePbRLlW50Q==", + "dev": true, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/top-level": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-18.6.1.tgz", + "integrity": "sha512-HyiHQZUTf0+r0goTCDs/bbVv/LiiQ7AVtz6KIar+8ZrseB9+YJAIo8HQ2IC2QT1y3N1lbW6OqVEsTHjbT6hGSw==", + "dev": true, + "dependencies": { + "find-up": "^5.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/types": { + "version": "18.6.1", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-18.6.1.tgz", + "integrity": "sha512-gwRLBLra/Dozj2OywopeuHj2ac26gjGkz2cZ+86cTJOdtWfiRRr4+e77ZDAGc6MDWxaWheI+mAV5TLWWRwqrFg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@types/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.12.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.10.tgz", + "integrity": "sha512-Eem5pH9pmWBHoGAT8Dr5fdc5rYA+4NAovdM4EktRPVAAiJhmWWfQrA0cFhAbOsQdSfIHjAud6YdkbL69+zSKjw==", + "dev": true, + "peer": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", + "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", + "dev": true + }, + "node_modules/ajv": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz", + "integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.4.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "dev": true + }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/compare-func": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", + "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "dev": true, + "dependencies": { + "array-ify": "^1.0.0", + "dot-prop": "^5.1.0" + } + }, + "node_modules/conventional-changelog-angular": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", + "integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", + "dev": true, + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/conventional-changelog-conventionalcommits": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-7.0.2.tgz", + "integrity": "sha512-NKXYmMR/Hr1DevQegFB4MwfM5Vv0m4UIxKZTTYuD98lpTknaZlSRrDOG4X7wIXpGkfsYxZTghUN+Qq+T0YQI7w==", + "dev": true, + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/conventional-commits-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", + "integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", + "dev": true, + "dependencies": { + "is-text-path": "^2.0.0", + "JSONStream": "^1.3.5", + "meow": "^12.0.1", + "split2": "^4.0.0" + }, + "bin": { + "conventional-commits-parser": "cli.mjs" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "dev": true, + "dependencies": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/cosmiconfig-typescript-loader": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-5.0.0.tgz", + "integrity": "sha512-+8cK7jRAReYkMwMiG+bxhcNKiHJDM6bR9FD/nGBXOWdMLuYawjF5cGrtLilJ+LGd3ZjCXnJjR5DkfWPoIVlqJA==", + "dev": true, + "dependencies": { + "jiti": "^1.19.1" + }, + "engines": { + "node": ">=v16" + }, + "peerDependencies": { + "@types/node": "*", + "cosmiconfig": ">=8.2", + "typescript": ">=4" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/dargs": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", + "integrity": "sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "dev": true, + "dependencies": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decamelize-keys/node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/git-raw-commits": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.11.tgz", + "integrity": "sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==", + "dev": true, + "dependencies": { + "dargs": "^7.0.0", + "lodash": "^4.17.15", + "meow": "^8.0.0", + "split2": "^3.0.0", + "through2": "^4.0.0" + }, + "bin": { + "git-raw-commits": "cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/git-raw-commits/node_modules/meow": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", + "integrity": "sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==", + "dev": true, + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/git-raw-commits/node_modules/split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dev": true, + "dependencies": { + "readable-stream": "^3.0.0" + } + }, + "node_modules/git-raw-commits/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/global-dirs": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==", + "dev": true, + "dependencies": { + "ini": "^1.3.4" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-text-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", + "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", + "dev": true, + "dependencies": { + "text-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "dev": true, + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "dev": true, + "engines": [ + "node >= 0.2.0" + ] + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "dev": true + }, + "node_modules/lodash.isfunction": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz", + "integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==", + "dev": true + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true + }, + "node_modules/lodash.kebabcase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", + "integrity": "sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lodash.mergewith": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", + "dev": true + }, + "node_modules/lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==", + "dev": true + }, + "node_modules/lodash.startcase": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", + "integrity": "sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==", + "dev": true + }, + "node_modules/lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "dev": true + }, + "node_modules/lodash.upperfirst": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", + "integrity": "sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true, + "engines": { + "node": ">=16.10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "dev": true, + "dependencies": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/read-pkg/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-global": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-global/-/resolve-global-1.0.0.tgz", + "integrity": "sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw==", + "dev": true, + "dependencies": { + "global-dirs": "^0.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.17.tgz", + "integrity": "sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==", + "dev": true + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "dev": true, + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/text-extensions": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", + "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, + "node_modules/through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "dev": true, + "dependencies": { + "readable-stream": "3" + } + }, + "node_modules/trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, + "peer": true + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/test/e2e/prompt-module/data/commitlint_18/package.json b/test/e2e/prompt-module/data/commitlint_18/package.json new file mode 100644 index 0000000..6a50f59 --- /dev/null +++ b/test/e2e/prompt-module/data/commitlint_18/package.json @@ -0,0 +1,15 @@ +{ + "name": "commitlint-test", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "@commitlint/cli": "^18.0.0", + "@commitlint/config-conventional": "^18.0.0" + } +} diff --git a/test/e2e/prompt-module/data/commitlint_19/commitlint.config.js b/test/e2e/prompt-module/data/commitlint_19/commitlint.config.js new file mode 100644 index 0000000..2291173 --- /dev/null +++ b/test/e2e/prompt-module/data/commitlint_19/commitlint.config.js @@ -0,0 +1,3 @@ +export default { + extends: ['@commitlint/config-conventional'] +}; diff --git a/test/e2e/prompt-module/data/commitlint_19/package-lock.json b/test/e2e/prompt-module/data/commitlint_19/package-lock.json new file mode 100644 index 0000000..d105873 --- /dev/null +++ b/test/e2e/prompt-module/data/commitlint_19/package-lock.json @@ -0,0 +1,1453 @@ +{ + "name": "commitlint-test", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "commitlint-test", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "@commitlint/cli": "^19.0.0", + "@commitlint/config-conventional": "^19.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", + "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.24.2", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", + "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", + "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.5", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@commitlint/cli": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-19.3.0.tgz", + "integrity": "sha512-LgYWOwuDR7BSTQ9OLZ12m7F/qhNY+NpAyPBgo4YNMkACE7lGuUnuQq1yi9hz1KA4+3VqpOYl8H1rY/LYK43v7g==", + "dev": true, + "dependencies": { + "@commitlint/format": "^19.3.0", + "@commitlint/lint": "^19.2.2", + "@commitlint/load": "^19.2.0", + "@commitlint/read": "^19.2.1", + "@commitlint/types": "^19.0.3", + "execa": "^8.0.1", + "yargs": "^17.0.0" + }, + "bin": { + "commitlint": "cli.js" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/config-conventional": { + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-19.2.2.tgz", + "integrity": "sha512-mLXjsxUVLYEGgzbxbxicGPggDuyWNkf25Ht23owXIH+zV2pv1eJuzLK3t1gDY5Gp6pxdE60jZnWUY5cvgL3ufw==", + "dev": true, + "dependencies": { + "@commitlint/types": "^19.0.3", + "conventional-changelog-conventionalcommits": "^7.0.2" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/config-validator": { + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-19.0.3.tgz", + "integrity": "sha512-2D3r4PKjoo59zBc2auodrSCaUnCSALCx54yveOFwwP/i2kfEAQrygwOleFWswLqK0UL/F9r07MFi5ev2ohyM4Q==", + "dev": true, + "dependencies": { + "@commitlint/types": "^19.0.3", + "ajv": "^8.11.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/ensure": { + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-19.0.3.tgz", + "integrity": "sha512-SZEpa/VvBLoT+EFZVb91YWbmaZ/9rPH3ESrINOl0HD2kMYsjvl0tF7nMHh0EpTcv4+gTtZBAe1y/SS6/OhfZzQ==", + "dev": true, + "dependencies": { + "@commitlint/types": "^19.0.3", + "lodash.camelcase": "^4.3.0", + "lodash.kebabcase": "^4.1.1", + "lodash.snakecase": "^4.1.1", + "lodash.startcase": "^4.4.0", + "lodash.upperfirst": "^4.3.1" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/execute-rule": { + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-19.0.0.tgz", + "integrity": "sha512-mtsdpY1qyWgAO/iOK0L6gSGeR7GFcdW7tIjcNFxcWkfLDF5qVbPHKuGATFqRMsxcO8OUKNj0+3WOHB7EHm4Jdw==", + "dev": true, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/format": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-19.3.0.tgz", + "integrity": "sha512-luguk5/aF68HiF4H23ACAfk8qS8AHxl4LLN5oxPc24H+2+JRPsNr1OS3Gaea0CrH7PKhArBMKBz5RX9sA5NtTg==", + "dev": true, + "dependencies": { + "@commitlint/types": "^19.0.3", + "chalk": "^5.3.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/is-ignored": { + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-19.2.2.tgz", + "integrity": "sha512-eNX54oXMVxncORywF4ZPFtJoBm3Tvp111tg1xf4zWXGfhBPKpfKG6R+G3G4v5CPlRROXpAOpQ3HMhA9n1Tck1g==", + "dev": true, + "dependencies": { + "@commitlint/types": "^19.0.3", + "semver": "^7.6.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/lint": { + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-19.2.2.tgz", + "integrity": "sha512-xrzMmz4JqwGyKQKTpFzlN0dx0TAiT7Ran1fqEBgEmEj+PU98crOFtysJgY+QdeSagx6EDRigQIXJVnfrI0ratA==", + "dev": true, + "dependencies": { + "@commitlint/is-ignored": "^19.2.2", + "@commitlint/parse": "^19.0.3", + "@commitlint/rules": "^19.0.3", + "@commitlint/types": "^19.0.3" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/load": { + "version": "19.2.0", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-19.2.0.tgz", + "integrity": "sha512-XvxxLJTKqZojCxaBQ7u92qQLFMMZc4+p9qrIq/9kJDy8DOrEa7P1yx7Tjdc2u2JxIalqT4KOGraVgCE7eCYJyQ==", + "dev": true, + "dependencies": { + "@commitlint/config-validator": "^19.0.3", + "@commitlint/execute-rule": "^19.0.0", + "@commitlint/resolve-extends": "^19.1.0", + "@commitlint/types": "^19.0.3", + "chalk": "^5.3.0", + "cosmiconfig": "^9.0.0", + "cosmiconfig-typescript-loader": "^5.0.0", + "lodash.isplainobject": "^4.0.6", + "lodash.merge": "^4.6.2", + "lodash.uniq": "^4.5.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/message": { + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-19.0.0.tgz", + "integrity": "sha512-c9czf6lU+9oF9gVVa2lmKaOARJvt4soRsVmbR7Njwp9FpbBgste5i7l/2l5o8MmbwGh4yE1snfnsy2qyA2r/Fw==", + "dev": true, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/parse": { + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-19.0.3.tgz", + "integrity": "sha512-Il+tNyOb8VDxN3P6XoBBwWJtKKGzHlitEuXA5BP6ir/3loWlsSqDr5aecl6hZcC/spjq4pHqNh0qPlfeWu38QA==", + "dev": true, + "dependencies": { + "@commitlint/types": "^19.0.3", + "conventional-changelog-angular": "^7.0.0", + "conventional-commits-parser": "^5.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/read": { + "version": "19.2.1", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-19.2.1.tgz", + "integrity": "sha512-qETc4+PL0EUv7Q36lJbPG+NJiBOGg7SSC7B5BsPWOmei+Dyif80ErfWQ0qXoW9oCh7GTpTNRoaVhiI8RbhuaNw==", + "dev": true, + "dependencies": { + "@commitlint/top-level": "^19.0.0", + "@commitlint/types": "^19.0.3", + "execa": "^8.0.1", + "git-raw-commits": "^4.0.0", + "minimist": "^1.2.8" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/resolve-extends": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-19.1.0.tgz", + "integrity": "sha512-z2riI+8G3CET5CPgXJPlzftH+RiWYLMYv4C9tSLdLXdr6pBNimSKukYP9MS27ejmscqCTVA4almdLh0ODD2KYg==", + "dev": true, + "dependencies": { + "@commitlint/config-validator": "^19.0.3", + "@commitlint/types": "^19.0.3", + "global-directory": "^4.0.1", + "import-meta-resolve": "^4.0.0", + "lodash.mergewith": "^4.6.2", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/rules": { + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-19.0.3.tgz", + "integrity": "sha512-TspKb9VB6svklxNCKKwxhELn7qhtY1rFF8ls58DcFd0F97XoG07xugPjjbVnLqmMkRjZDbDIwBKt9bddOfLaPw==", + "dev": true, + "dependencies": { + "@commitlint/ensure": "^19.0.3", + "@commitlint/message": "^19.0.0", + "@commitlint/to-lines": "^19.0.0", + "@commitlint/types": "^19.0.3", + "execa": "^8.0.1" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/to-lines": { + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-19.0.0.tgz", + "integrity": "sha512-vkxWo+VQU5wFhiP9Ub9Sre0FYe019JxFikrALVoD5UGa8/t3yOJEpEhxC5xKiENKKhUkTpEItMTRAjHw2SCpZw==", + "dev": true, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/top-level": { + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-19.0.0.tgz", + "integrity": "sha512-KKjShd6u1aMGNkCkaX4aG1jOGdn7f8ZI8TR1VEuNqUOjWTOdcDSsmglinglJ18JTjuBX5I1PtjrhQCRcixRVFQ==", + "dev": true, + "dependencies": { + "find-up": "^7.0.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@commitlint/types": { + "version": "19.0.3", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-19.0.3.tgz", + "integrity": "sha512-tpyc+7i6bPG9mvaBbtKUeghfyZSDgWquIDfMgqYtTbmZ9Y9VzEm2je9EYcQ0aoz5o7NvGS+rcDec93yO08MHYA==", + "dev": true, + "dependencies": { + "@types/conventional-commits-parser": "^5.0.0", + "chalk": "^5.3.0" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@types/conventional-commits-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", + "integrity": "sha512-loB369iXNmAZglwWATL+WRe+CRMmmBPtpolYzIebFaX4YA3x+BEfLqhUAV9WanycKI3TG1IMr5bMJDajDKLlUQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "20.12.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.10.tgz", + "integrity": "sha512-Eem5pH9pmWBHoGAT8Dr5fdc5rYA+4NAovdM4EktRPVAAiJhmWWfQrA0cFhAbOsQdSfIHjAud6YdkbL69+zSKjw==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/ajv": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz", + "integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.4.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "dev": true + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/compare-func": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", + "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "dev": true, + "dependencies": { + "array-ify": "^1.0.0", + "dot-prop": "^5.1.0" + } + }, + "node_modules/conventional-changelog-angular": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", + "integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", + "dev": true, + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/conventional-changelog-conventionalcommits": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-7.0.2.tgz", + "integrity": "sha512-NKXYmMR/Hr1DevQegFB4MwfM5Vv0m4UIxKZTTYuD98lpTknaZlSRrDOG4X7wIXpGkfsYxZTghUN+Qq+T0YQI7w==", + "dev": true, + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/conventional-commits-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", + "integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", + "dev": true, + "dependencies": { + "is-text-path": "^2.0.0", + "JSONStream": "^1.3.5", + "meow": "^12.0.1", + "split2": "^4.0.0" + }, + "bin": { + "conventional-commits-parser": "cli.mjs" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/cosmiconfig": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "dev": true, + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/cosmiconfig-typescript-loader": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-5.0.0.tgz", + "integrity": "sha512-+8cK7jRAReYkMwMiG+bxhcNKiHJDM6bR9FD/nGBXOWdMLuYawjF5cGrtLilJ+LGd3ZjCXnJjR5DkfWPoIVlqJA==", + "dev": true, + "dependencies": { + "jiti": "^1.19.1" + }, + "engines": { + "node": ">=v16" + }, + "peerDependencies": { + "@types/node": "*", + "cosmiconfig": ">=8.2", + "typescript": ">=4" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/dargs": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-8.1.0.tgz", + "integrity": "sha512-wAV9QHOsNbwnWdNW2FYvE1P56wtgSbM+3SZcdGiWQILwVjACCXDCI3Ai8QlCjMDB8YK5zySiXZYBiwGmNY3lnw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/find-up": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-7.0.0.tgz", + "integrity": "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==", + "dev": true, + "dependencies": { + "locate-path": "^7.2.0", + "path-exists": "^5.0.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/git-raw-commits": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-4.0.0.tgz", + "integrity": "sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==", + "dev": true, + "dependencies": { + "dargs": "^8.0.0", + "meow": "^12.0.1", + "split2": "^4.0.0" + }, + "bin": { + "git-raw-commits": "cli.mjs" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/global-directory": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz", + "integrity": "sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==", + "dev": true, + "dependencies": { + "ini": "4.1.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/import-meta-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", + "integrity": "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ini": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz", + "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-text-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", + "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", + "dev": true, + "dependencies": { + "text-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "dev": true, + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "dev": true, + "engines": [ + "node >= 0.2.0" + ] + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dev": true, + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "dev": true + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true + }, + "node_modules/lodash.kebabcase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", + "integrity": "sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lodash.mergewith": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", + "dev": true + }, + "node_modules/lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==", + "dev": true + }, + "node_modules/lodash.startcase": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", + "integrity": "sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==", + "dev": true + }, + "node_modules/lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "dev": true + }, + "node_modules/lodash.upperfirst": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", + "integrity": "sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true, + "engines": { + "node": ">=16.10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "dev": true, + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/text-extensions": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", + "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, + "node_modules/typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/test/e2e/prompt-module/data/commitlint_19/package.json b/test/e2e/prompt-module/data/commitlint_19/package.json new file mode 100644 index 0000000..eac0d13 --- /dev/null +++ b/test/e2e/prompt-module/data/commitlint_19/package.json @@ -0,0 +1,16 @@ +{ + "name": "commitlint-test", + "version": "1.0.0", + "description": "", + "main": "index.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "@commitlint/cli": "^19.0.0", + "@commitlint/config-conventional": "^19.0.0" + } +} diff --git a/test/e2e/prompt-module/data/commitlint_9/commitlint.config.js b/test/e2e/prompt-module/data/commitlint_9/commitlint.config.js new file mode 100644 index 0000000..c34aa79 --- /dev/null +++ b/test/e2e/prompt-module/data/commitlint_9/commitlint.config.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ['@commitlint/config-conventional'] +}; diff --git a/test/e2e/prompt-module/data/commitlint_9/package-lock.json b/test/e2e/prompt-module/data/commitlint_9/package-lock.json new file mode 100644 index 0000000..0db3f07 --- /dev/null +++ b/test/e2e/prompt-module/data/commitlint_9/package-lock.json @@ -0,0 +1,1671 @@ +{ + "name": "commitlint-test", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "commitlint-test", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "@commitlint/cli": "^9.0.0", + "@commitlint/config-conventional": "^9.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", + "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.24.2", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", + "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", + "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.5", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/runtime": { + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.5.tgz", + "integrity": "sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@commitlint/cli": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-9.1.2.tgz", + "integrity": "sha512-ctRrrPqjZ8r4Vc4FXpPaScEpkPwfvB0Us3NK2SD2AnLwXGMxOLFTabDmNySU1Xc40ud2CmJsaV8lpavvzs8ZZA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.9.6", + "@commitlint/format": "^9.1.2", + "@commitlint/lint": "^9.1.2", + "@commitlint/load": "^9.1.2", + "@commitlint/read": "^9.1.2", + "chalk": "4.1.0", + "core-js": "^3.6.1", + "get-stdin": "7.0.0", + "lodash": "^4.17.19", + "resolve-from": "5.0.0", + "resolve-global": "1.0.0", + "yargs": "^15.1.0" + }, + "bin": { + "commitlint": "cli.js" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/config-conventional": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-9.1.2.tgz", + "integrity": "sha512-2zfnsrBJuCNJEKMEmltYlCUEoQNE4anvEBI/SYEuiB1JYXYaELijobDBpqhUVjh5NEpprNTY16oMZat6ewnxOg==", + "dev": true, + "dependencies": { + "conventional-changelog-conventionalcommits": "4.3.0" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/ensure": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-9.1.2.tgz", + "integrity": "sha512-hwQICwpNSTsZgj/1/SdPvYAzhwjwgCJI4vLbT879+Jc+AJ6sj2bUDGw/F89vzgKz1VnaMm4D65bNhoWhG3pdhQ==", + "dev": true, + "dependencies": { + "@commitlint/types": "^9.1.2", + "lodash": "^4.17.19" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/execute-rule": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-9.1.2.tgz", + "integrity": "sha512-NGbeo0KCVYo1yj9vVPFHv6RGFpIF6wcQxpFYUKGIzZVV9Vz1WyiKS689JXa99Dt1aN0cZlEJJLnTNDIgYls0Vg==", + "dev": true, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/format": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-9.1.2.tgz", + "integrity": "sha512-+ZWTOSGEU6dbn3NRh1q7sY5K5QLiSs7E2uSzuYnWHXcQk8nlTvnE0ibwMCQxdKLaOTZiN57fHM/7M9Re2gsRuw==", + "dev": true, + "dependencies": { + "@commitlint/types": "^9.1.2", + "chalk": "^4.0.0" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/is-ignored": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-9.1.2.tgz", + "integrity": "sha512-423W/+Ro+Cc8cg81+t9gds1EscMZNjnGT31nKDvxVxJxXiXQsYYoFEQbU+nfUrRGQsUikEgEJ3ppVGr1linvcQ==", + "dev": true, + "dependencies": { + "@commitlint/types": "^9.1.2", + "semver": "7.3.2" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/lint": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-9.1.2.tgz", + "integrity": "sha512-XvggqHZ4XSTKOgzJhCzz52cWRRO57QQnEviwGj0qnD4jdwC+8h2u9LNZwoa2tGAuaNM3nSm//wNK7FRZhgiiFA==", + "dev": true, + "dependencies": { + "@commitlint/is-ignored": "^9.1.2", + "@commitlint/parse": "^9.1.2", + "@commitlint/rules": "^9.1.2", + "@commitlint/types": "^9.1.2" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/load": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-9.1.2.tgz", + "integrity": "sha512-FPL82xBuF7J3EJ57kLVoligQP4BFRwrknooP+vNT787AXmQ/Fddc/iYYwHwy67pNkk5N++/51UyDl/CqiHb6nA==", + "dev": true, + "dependencies": { + "@commitlint/execute-rule": "^9.1.2", + "@commitlint/resolve-extends": "^9.1.2", + "@commitlint/types": "^9.1.2", + "chalk": "4.1.0", + "cosmiconfig": "^6.0.0", + "lodash": "^4.17.19", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/message": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-9.1.2.tgz", + "integrity": "sha512-ndlx5z7bPVLG347oYJUHuQ41eTcsw+aUYT1ZwQyci0Duy2atpuoeeSw9SuM1PjufzRCpb6ExzFEgGzcCRKAJsg==", + "dev": true, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/parse": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-9.1.2.tgz", + "integrity": "sha512-d+/VYbkotctW+lzDpus/R6xTerOqFQkW1myH+3PwnqYSE6JU/uHT4MlZNGJBv8pX9SPlR66t6X9puFobqtezEw==", + "dev": true, + "dependencies": { + "conventional-changelog-angular": "^5.0.0", + "conventional-commits-parser": "^3.0.0" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/read": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-9.1.2.tgz", + "integrity": "sha512-C2sNBQOqeQXMxpWtRnXYKYB3D9yuybPtQNY/P67A6o8XH/UMHkFaUTyIx1KRgu0IG0yTTItRt46FGnsMWLotvA==", + "dev": true, + "dependencies": { + "@commitlint/top-level": "^9.1.2", + "fs-extra": "^8.1.0", + "git-raw-commits": "^2.0.0" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/resolve-extends": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-9.1.2.tgz", + "integrity": "sha512-HcoL+qFGmWEu9VM4fY0HI+VzF4yHcg3x+9Hx6pYFZ+r2wLbnKs964y0v68oyMO/mS/46MVoLNXZGR8U3adpadg==", + "dev": true, + "dependencies": { + "import-fresh": "^3.0.0", + "lodash": "^4.17.19", + "resolve-from": "^5.0.0", + "resolve-global": "^1.0.0" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/rules": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-9.1.2.tgz", + "integrity": "sha512-1vecFuzqVqjiT57ocXq1bL8V6GEF1NZs3BR0dQzObaqHftImIxBVII299gasckTkcuxNc8M+7XxZyKxUthukpQ==", + "dev": true, + "dependencies": { + "@commitlint/ensure": "^9.1.2", + "@commitlint/message": "^9.1.2", + "@commitlint/to-lines": "^9.1.2", + "@commitlint/types": "^9.1.2" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/to-lines": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-9.1.2.tgz", + "integrity": "sha512-o4zWcMf9EnzA3MOqx01780SgrKq5hqDJmUBPk30g6an0XcDuDy3OSZHHTJFdzsg4V9FjC4OY44sFeK7GN7NaxQ==", + "dev": true, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/top-level": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-9.1.2.tgz", + "integrity": "sha512-KMPP5xVePcz3B1dKqcZdU4FZBVOkT+bG3ip4RQX2TeCJoomMkTjd0utALs7rpTGLID6BXbwwXepZCZJREjR/Bw==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@commitlint/types": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-9.1.2.tgz", + "integrity": "sha512-r3fwVbVH+M8W0qYlBBZFsUwKe6NT5qvz+EmU7sr8VeN1cQ63z+3cfXyTo7WGGEMEgKiT0jboNAK3b1FZp8k9LQ==", + "dev": true, + "engines": { + "node": ">=v8.17.0" + } + }, + "node_modules/@types/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", + "dev": true + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", + "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", + "dev": true + }, + "node_modules/@types/parse-json": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", + "dev": true + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "dev": true + }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/compare-func": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", + "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "dev": true, + "dependencies": { + "array-ify": "^1.0.0", + "dot-prop": "^5.1.0" + } + }, + "node_modules/conventional-changelog-angular": { + "version": "5.0.13", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz", + "integrity": "sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA==", + "dev": true, + "dependencies": { + "compare-func": "^2.0.0", + "q": "^1.5.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/conventional-changelog-conventionalcommits": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.3.0.tgz", + "integrity": "sha512-oYHydvZKU+bS8LnGqTMlNrrd7769EsuEHKy4fh1oMdvvDi7fem8U+nvfresJ1IDB8K00Mn4LpiA/lR+7Gs6rgg==", + "dev": true, + "dependencies": { + "compare-func": "^1.3.1", + "lodash": "^4.17.15", + "q": "^1.5.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/conventional-changelog-conventionalcommits/node_modules/compare-func": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.4.tgz", + "integrity": "sha512-sq2sWtrqKPkEXAC8tEJA1+BqAH9GbFkGBtUOqrUX57VSfwp8xyktctk+uLoRy5eccTdxzDcVIztlYDpKs3Jv1Q==", + "dev": true, + "dependencies": { + "array-ify": "^1.0.0", + "dot-prop": "^3.0.0" + } + }, + "node_modules/conventional-changelog-conventionalcommits/node_modules/dot-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-3.0.0.tgz", + "integrity": "sha512-k4ELWeEU3uCcwub7+dWydqQBRjAjkV9L33HjVRG5Xo2QybI6ja/v+4W73SRi8ubCqJz0l9XsTP1NbewfyqaSlw==", + "dev": true, + "dependencies": { + "is-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/conventional-changelog-conventionalcommits/node_modules/is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha512-l4RyHgRqGN4Y3+9JHVrNqO+tN0rV5My76uW5/nuO4K1b6vw5G8d/cmFjP9tRfEsdhZNt0IFdZuK/c2Vr4Nb+Qg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/conventional-commits-parser": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.2.4.tgz", + "integrity": "sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q==", + "dev": true, + "dependencies": { + "is-text-path": "^1.0.1", + "JSONStream": "^1.0.4", + "lodash": "^4.17.15", + "meow": "^8.0.0", + "split2": "^3.0.0", + "through2": "^4.0.0" + }, + "bin": { + "conventional-commits-parser": "cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/core-js": { + "version": "3.37.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.37.0.tgz", + "integrity": "sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==", + "dev": true, + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dargs": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", + "integrity": "sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "dev": true, + "dependencies": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decamelize-keys/node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-stdin": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", + "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/git-raw-commits": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.11.tgz", + "integrity": "sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==", + "dev": true, + "dependencies": { + "dargs": "^7.0.0", + "lodash": "^4.17.15", + "meow": "^8.0.0", + "split2": "^3.0.0", + "through2": "^4.0.0" + }, + "bin": { + "git-raw-commits": "cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/global-dirs": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==", + "dev": true, + "dependencies": { + "ini": "^1.3.4" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-text-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", + "integrity": "sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==", + "dev": true, + "dependencies": { + "text-extensions": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "dev": true, + "engines": [ + "node >= 0.2.0" + ] + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", + "integrity": "sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==", + "dev": true, + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "dev": true, + "dependencies": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", + "dev": true, + "engines": { + "node": ">=0.6.0", + "teleport": ">=0.2.0" + } + }, + "node_modules/quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/read-pkg/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "dev": true + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-global": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-global/-/resolve-global-1.0.0.tgz", + "integrity": "sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw==", + "dev": true, + "dependencies": { + "global-dirs": "^0.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.17.tgz", + "integrity": "sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==", + "dev": true + }, + "node_modules/split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dev": true, + "dependencies": { + "readable-stream": "^3.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/text-extensions": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", + "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, + "node_modules/through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "dev": true, + "dependencies": { + "readable-stream": "3" + } + }, + "node_modules/trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs/node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + } + } +} diff --git a/test/e2e/prompt-module/data/commitlint_9/package.json b/test/e2e/prompt-module/data/commitlint_9/package.json new file mode 100644 index 0000000..a0c3c98 --- /dev/null +++ b/test/e2e/prompt-module/data/commitlint_9/package.json @@ -0,0 +1,15 @@ +{ + "name": "commitlint-test", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "@commitlint/cli": "^9.0.0", + "@commitlint/config-conventional": "^9.0.0" + } +} diff --git a/test/e2e/setup.sh b/test/e2e/setup.sh new file mode 100755 index 0000000..83bf72f --- /dev/null +++ b/test/e2e/setup.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +current_dir=$(pwd) +setup_dir="$(cd "$(dirname "$0")" && pwd)" + +# Set up for prompt-module/commitlint +cd $setup_dir && cd prompt-module/data/commitlint_9 && npm ci +cd $setup_dir && cd prompt-module/data/commitlint_18 && npm ci +cd $setup_dir && cd prompt-module/data/commitlint_19 && npm ci + +cd $current_dir diff --git a/test/e2e/utils.ts b/test/e2e/utils.ts index 3094966..73f909c 100644 --- a/test/e2e/utils.ts +++ b/test/e2e/utils.ts @@ -29,3 +29,5 @@ export const prepareEnvironment = async (): Promise<{ cleanup, } } + +export const wait = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/test/jest-setup.ts b/test/jest-setup.ts index eb782d3..29280f7 100644 --- a/test/jest-setup.ts +++ b/test/jest-setup.ts @@ -1,5 +1,8 @@ import 'cli-testing-library/extend-expect' import { configure } from 'cli-testing-library' +import { jest } from '@jest/globals'; + +global.jest = jest; /** * Adjusted the wait time for waitFor/findByText to 2000ms, because the default 1000ms makes the test results flaky diff --git a/test/unit/config.test.ts b/test/unit/config.test.ts index 4c596ae..aa44e3b 100644 --- a/test/unit/config.test.ts +++ b/test/unit/config.test.ts @@ -55,7 +55,7 @@ OCO_ONE_LINE_COMMIT="true" expect(config!['OCO_LANGUAGE']).toEqual('de'); expect(config!['OCO_MESSAGE_TEMPLATE_PLACEHOLDER']).toEqual('$m'); expect(config!['OCO_PROMPT_MODULE']).toEqual('@commitlint'); - expect(config!['OCO_AI_PROVIDER']).toEqual('ollama'); + expect(() => ['ollama', 'gemini'].includes(config!['OCO_AI_PROVIDER'])).toBeTruthy(); expect(config!['OCO_GITPUSH']).toEqual(false); expect(config!['OCO_ONE_LINE_COMMIT']).toEqual(true); @@ -96,7 +96,7 @@ OCO_ONE_LINE_COMMIT="true" expect(config!['OCO_LANGUAGE']).toEqual('de'); expect(config!['OCO_MESSAGE_TEMPLATE_PLACEHOLDER']).toEqual('$m'); expect(config!['OCO_PROMPT_MODULE']).toEqual('@commitlint'); - expect(config!['OCO_AI_PROVIDER']).toEqual('ollama'); + expect(() => ['ollama', 'gemini'].includes(config!['OCO_AI_PROVIDER'])).toBeTruthy(); expect(config!['OCO_GITPUSH']).toEqual(false); expect(config!['OCO_ONE_LINE_COMMIT']).toEqual(true); diff --git a/test/unit/gemini.test.ts b/test/unit/gemini.test.ts new file mode 100644 index 0000000..8b7fd9d --- /dev/null +++ b/test/unit/gemini.test.ts @@ -0,0 +1,105 @@ +import { Gemini } from '../../src/engine/gemini'; +import { ChatCompletionRequestMessage } from 'openai'; +import { GenerativeModel, GoogleGenerativeAI } from '@google/generative-ai'; +import { ConfigType, getConfig } from '../../src/commands/config'; + +describe('Gemini', () => { + let gemini: Gemini; + let mockConfig: ConfigType; + let mockGoogleGenerativeAi: GoogleGenerativeAI; + let mockGenerativeModel: GenerativeModel; + let mockExit: jest.SpyInstance; + let mockWarmup: jest.SpyInstance; + + const noop: (code?: number | undefined) => never = (code?: number | undefined) => {}; + + const mockGemini = () => { + gemini = new Gemini(); + } + + const oldEnv = process.env; + + beforeEach(() => { + jest.resetModules(); + process.env = { ...oldEnv }; + + jest.mock('@google/generative-ai'); + jest.mock('../src/commands/config'); + + jest.mock('@clack/prompts', () => ({ + intro: jest.fn(), + outro: jest.fn(), + })); + + if (mockWarmup) mockWarmup.mockRestore(); + + mockExit = jest.spyOn(process, 'exit').mockImplementation(); + mockConfig = getConfig() as ConfigType; + + mockConfig.OCO_AI_PROVIDER = 'gemini'; + mockConfig.OCO_GEMINI_API_KEY = 'mock-api-key'; + mockConfig.OCO_MODEL = 'gemini-1.5-flash'; + + mockGoogleGenerativeAi = new GoogleGenerativeAI(mockConfig.OCO_GEMINI_API_KEY); + mockGenerativeModel = mockGoogleGenerativeAi.getGenerativeModel({ model: mockConfig.OCO_MODEL, }); + }); + + afterEach(() => { + gemini = undefined as any; + }) + + afterAll(() => { + mockExit.mockRestore(); + process.env = oldEnv; + }); + + it('should initialize with correct config', () => { + mockGemini(); + // gemini = new Gemini(); + expect(gemini).toBeDefined(); + }); + + it('should warmup correctly', () => { + mockWarmup = jest.spyOn(Gemini.prototype as any, 'warmup').mockImplementation(noop); + mockGemini(); + expect(gemini).toBeDefined(); + }); + + it('should exit process if OCO_GEMINI_API_KEY is not set and command is not config', () => { + process.env.OCO_GEMINI_API_KEY = undefined; + process.env.OCO_AI_PROVIDER = 'gemini'; + + mockGemini(); + + expect(mockExit).toHaveBeenCalledWith(1); + }); + + it('should exit process if model is not supported and command is not config', () => { + process.env.OCO_GEMINI_API_KEY = undefined; + process.env.OCO_AI_PROVIDER = 'gemini'; + + mockGemini(); + + expect(mockExit).toHaveBeenCalledWith(1); + }); + + it('should generate commit message', async () => { + const mockGenerateContent = jest.fn().mockResolvedValue({ response: { text: () => 'generated content' } }); + mockGenerativeModel.generateContent = mockGenerateContent; + + mockWarmup = jest.spyOn(Gemini.prototype as any, 'warmup').mockImplementation(noop); + mockGemini(); + + const messages: ChatCompletionRequestMessage[] = [ + { role: 'system', content: 'system message' }, + { role: 'assistant', content: 'assistant message' }, + ]; + + jest.spyOn(gemini, 'generateCommitMessage').mockImplementation(async () => 'generated content'); + const result = await gemini.generateCommitMessage(messages); + + expect(result).toEqual('generated content'); + expect(mockWarmup).toHaveBeenCalled(); + }); + +}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 3009ccd..485bd04 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,12 @@ { "compilerOptions": { - "target": "ESNext", - "lib": ["ES5", "ES6"], + "target": "ES2020", + "lib": ["ES6", "ES2020"], - "module": "ESNext", - // "rootDir": "./src", + "module": "CommonJS", + "resolveJsonModule": true, - "moduleResolution": "node", + "moduleResolution": "Node", "allowJs": true,