@hot-updater/aws 0.11.0 → 0.12.1-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4734 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // lambda/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ handler: () => handler
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_client_s32 = require("@aws-sdk/client-s3");
37
+
38
+ // ../../node_modules/.pnpm/@smithy+util-uri-escape@4.0.0/node_modules/@smithy/util-uri-escape/dist-es/escape-uri.js
39
+ var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
40
+ var hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
41
+
42
+ // ../../node_modules/.pnpm/@smithy+querystring-builder@4.0.1/node_modules/@smithy/querystring-builder/dist-es/index.js
43
+ function buildQueryString(query) {
44
+ const parts = [];
45
+ for (let key of Object.keys(query).sort()) {
46
+ const value = query[key];
47
+ key = escapeUri(key);
48
+ if (Array.isArray(value)) {
49
+ for (let i = 0, iLen = value.length; i < iLen; i++) {
50
+ parts.push(`${key}=${escapeUri(value[i])}`);
51
+ }
52
+ } else {
53
+ let qsEntry = key;
54
+ if (value || typeof value === "string") {
55
+ qsEntry += `=${escapeUri(value)}`;
56
+ }
57
+ parts.push(qsEntry);
58
+ }
59
+ }
60
+ return parts.join("&");
61
+ }
62
+
63
+ // ../../node_modules/.pnpm/@aws-sdk+util-format-url@3.734.0/node_modules/@aws-sdk/util-format-url/dist-es/index.js
64
+ function formatUrl(request) {
65
+ const { port, query } = request;
66
+ let { protocol, path, hostname } = request;
67
+ if (protocol && protocol.slice(-1) !== ":") {
68
+ protocol += ":";
69
+ }
70
+ if (port) {
71
+ hostname += `:${port}`;
72
+ }
73
+ if (path && path.charAt(0) !== "/") {
74
+ path = `/${path}`;
75
+ }
76
+ let queryString = query ? buildQueryString(query) : "";
77
+ if (queryString && queryString[0] !== "?") {
78
+ queryString = `?${queryString}`;
79
+ }
80
+ let auth = "";
81
+ if (request.username != null || request.password != null) {
82
+ const username = request.username ?? "";
83
+ const password = request.password ?? "";
84
+ auth = `${username}:${password}@`;
85
+ }
86
+ let fragment = "";
87
+ if (request.fragment) {
88
+ fragment = `#${request.fragment}`;
89
+ }
90
+ return `${protocol}//${auth}${hostname}${path}${queryString}${fragment}`;
91
+ }
92
+
93
+ // ../../node_modules/.pnpm/@smithy+middleware-endpoint@4.0.5/node_modules/@smithy/middleware-endpoint/dist-es/service-customizations/s3.js
94
+ var resolveParamsForS3 = async (endpointParams) => {
95
+ const bucket = endpointParams?.Bucket || "";
96
+ if (typeof endpointParams.Bucket === "string") {
97
+ endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?"));
98
+ }
99
+ if (isArnBucketName(bucket)) {
100
+ if (endpointParams.ForcePathStyle === true) {
101
+ throw new Error("Path-style addressing cannot be used with ARN buckets");
102
+ }
103
+ } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) {
104
+ endpointParams.ForcePathStyle = true;
105
+ }
106
+ if (endpointParams.DisableMultiRegionAccessPoints) {
107
+ endpointParams.disableMultiRegionAccessPoints = true;
108
+ endpointParams.DisableMRAP = true;
109
+ }
110
+ return endpointParams;
111
+ };
112
+ var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
113
+ var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
114
+ var DOTS_PATTERN = /\.\./;
115
+ var isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
116
+ var isArnBucketName = (bucketName) => {
117
+ const [arn, partition, service, , , bucket] = bucketName.split(":");
118
+ const isArn = arn === "arn" && bucketName.split(":").length >= 6;
119
+ const isValidArn = Boolean(isArn && partition && service && bucket);
120
+ if (isArn && !isValidArn) {
121
+ throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`);
122
+ }
123
+ return isValidArn;
124
+ };
125
+
126
+ // ../../node_modules/.pnpm/@smithy+middleware-endpoint@4.0.5/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/createConfigValueProvider.js
127
+ var createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) => {
128
+ const configProvider = async () => {
129
+ const configValue = config[configKey] ?? config[canonicalEndpointParamKey];
130
+ if (typeof configValue === "function") {
131
+ return configValue();
132
+ }
133
+ return configValue;
134
+ };
135
+ if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") {
136
+ return async () => {
137
+ const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
138
+ const configValue = credentials?.credentialScope ?? credentials?.CredentialScope;
139
+ return configValue;
140
+ };
141
+ }
142
+ if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") {
143
+ return async () => {
144
+ const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
145
+ const configValue = credentials?.accountId ?? credentials?.AccountId;
146
+ return configValue;
147
+ };
148
+ }
149
+ if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
150
+ return async () => {
151
+ const endpoint = await configProvider();
152
+ if (endpoint && typeof endpoint === "object") {
153
+ if ("url" in endpoint) {
154
+ return endpoint.url.href;
155
+ }
156
+ if ("hostname" in endpoint) {
157
+ const { protocol, hostname, port, path } = endpoint;
158
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
159
+ }
160
+ }
161
+ return endpoint;
162
+ };
163
+ }
164
+ return configProvider;
165
+ };
166
+
167
+ // ../../node_modules/.pnpm/@smithy+property-provider@4.0.1/node_modules/@smithy/property-provider/dist-es/ProviderError.js
168
+ var ProviderError = class _ProviderError extends Error {
169
+ constructor(message, options = true) {
170
+ let logger;
171
+ let tryNextLink = true;
172
+ if (typeof options === "boolean") {
173
+ logger = void 0;
174
+ tryNextLink = options;
175
+ } else if (options != null && typeof options === "object") {
176
+ logger = options.logger;
177
+ tryNextLink = options.tryNextLink ?? true;
178
+ }
179
+ super(message);
180
+ this.name = "ProviderError";
181
+ this.tryNextLink = tryNextLink;
182
+ Object.setPrototypeOf(this, _ProviderError.prototype);
183
+ logger?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
184
+ }
185
+ static from(error, options = true) {
186
+ return Object.assign(new this(error.message, options), error);
187
+ }
188
+ };
189
+
190
+ // ../../node_modules/.pnpm/@smithy+property-provider@4.0.1/node_modules/@smithy/property-provider/dist-es/CredentialsProviderError.js
191
+ var CredentialsProviderError = class _CredentialsProviderError extends ProviderError {
192
+ constructor(message, options = true) {
193
+ super(message, options);
194
+ this.name = "CredentialsProviderError";
195
+ Object.setPrototypeOf(this, _CredentialsProviderError.prototype);
196
+ }
197
+ };
198
+
199
+ // ../../node_modules/.pnpm/@smithy+property-provider@4.0.1/node_modules/@smithy/property-provider/dist-es/chain.js
200
+ var chain = (...providers) => async () => {
201
+ if (providers.length === 0) {
202
+ throw new ProviderError("No providers in chain");
203
+ }
204
+ let lastProviderError;
205
+ for (const provider of providers) {
206
+ try {
207
+ const credentials = await provider();
208
+ return credentials;
209
+ } catch (err) {
210
+ lastProviderError = err;
211
+ if (err?.tryNextLink) {
212
+ continue;
213
+ }
214
+ throw err;
215
+ }
216
+ }
217
+ throw lastProviderError;
218
+ };
219
+
220
+ // ../../node_modules/.pnpm/@smithy+property-provider@4.0.1/node_modules/@smithy/property-provider/dist-es/fromStatic.js
221
+ var fromStatic = (staticValue) => () => Promise.resolve(staticValue);
222
+
223
+ // ../../node_modules/.pnpm/@smithy+property-provider@4.0.1/node_modules/@smithy/property-provider/dist-es/memoize.js
224
+ var memoize = (provider, isExpired, requiresRefresh) => {
225
+ let resolved;
226
+ let pending;
227
+ let hasResult;
228
+ let isConstant = false;
229
+ const coalesceProvider = async () => {
230
+ if (!pending) {
231
+ pending = provider();
232
+ }
233
+ try {
234
+ resolved = await pending;
235
+ hasResult = true;
236
+ isConstant = false;
237
+ } finally {
238
+ pending = void 0;
239
+ }
240
+ return resolved;
241
+ };
242
+ if (isExpired === void 0) {
243
+ return async (options) => {
244
+ if (!hasResult || options?.forceRefresh) {
245
+ resolved = await coalesceProvider();
246
+ }
247
+ return resolved;
248
+ };
249
+ }
250
+ return async (options) => {
251
+ if (!hasResult || options?.forceRefresh) {
252
+ resolved = await coalesceProvider();
253
+ }
254
+ if (isConstant) {
255
+ return resolved;
256
+ }
257
+ if (requiresRefresh && !requiresRefresh(resolved)) {
258
+ isConstant = true;
259
+ return resolved;
260
+ }
261
+ if (isExpired(resolved)) {
262
+ await coalesceProvider();
263
+ return resolved;
264
+ }
265
+ return resolved;
266
+ };
267
+ };
268
+
269
+ // ../../node_modules/.pnpm/@smithy+node-config-provider@4.0.1/node_modules/@smithy/node-config-provider/dist-es/getSelectorName.js
270
+ function getSelectorName(functionString) {
271
+ try {
272
+ const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
273
+ constants.delete("CONFIG");
274
+ constants.delete("CONFIG_PREFIX_SEPARATOR");
275
+ constants.delete("ENV");
276
+ return [...constants].join(", ");
277
+ } catch (e) {
278
+ return functionString;
279
+ }
280
+ }
281
+
282
+ // ../../node_modules/.pnpm/@smithy+node-config-provider@4.0.1/node_modules/@smithy/node-config-provider/dist-es/fromEnv.js
283
+ var fromEnv = (envVarSelector, logger) => async () => {
284
+ try {
285
+ const config = envVarSelector(process.env);
286
+ if (config === void 0) {
287
+ throw new Error();
288
+ }
289
+ return config;
290
+ } catch (e) {
291
+ throw new CredentialsProviderError(e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, { logger });
292
+ }
293
+ };
294
+
295
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/getHomeDir.js
296
+ var import_os = require("os");
297
+ var import_path = require("path");
298
+ var homeDirCache = {};
299
+ var getHomeDirCacheKey = () => {
300
+ if (process && process.geteuid) {
301
+ return `${process.geteuid()}`;
302
+ }
303
+ return "DEFAULT";
304
+ };
305
+ var getHomeDir = () => {
306
+ const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${import_path.sep}` } = process.env;
307
+ if (HOME)
308
+ return HOME;
309
+ if (USERPROFILE)
310
+ return USERPROFILE;
311
+ if (HOMEPATH)
312
+ return `${HOMEDRIVE}${HOMEPATH}`;
313
+ const homeDirCacheKey = getHomeDirCacheKey();
314
+ if (!homeDirCache[homeDirCacheKey])
315
+ homeDirCache[homeDirCacheKey] = (0, import_os.homedir)();
316
+ return homeDirCache[homeDirCacheKey];
317
+ };
318
+
319
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/getProfileName.js
320
+ var ENV_PROFILE = "AWS_PROFILE";
321
+ var DEFAULT_PROFILE = "default";
322
+ var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
323
+
324
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/getSSOTokenFromFile.js
325
+ var import_fs = require("fs");
326
+ var { readFile } = import_fs.promises;
327
+
328
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/loadSharedConfigFiles.js
329
+ var import_path4 = require("path");
330
+
331
+ // ../../node_modules/.pnpm/@smithy+types@4.1.0/node_modules/@smithy/types/dist-es/auth/auth.js
332
+ var HttpAuthLocation;
333
+ (function(HttpAuthLocation2) {
334
+ HttpAuthLocation2["HEADER"] = "header";
335
+ HttpAuthLocation2["QUERY"] = "query";
336
+ })(HttpAuthLocation || (HttpAuthLocation = {}));
337
+
338
+ // ../../node_modules/.pnpm/@smithy+types@4.1.0/node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js
339
+ var HttpApiKeyAuthLocation;
340
+ (function(HttpApiKeyAuthLocation2) {
341
+ HttpApiKeyAuthLocation2["HEADER"] = "header";
342
+ HttpApiKeyAuthLocation2["QUERY"] = "query";
343
+ })(HttpApiKeyAuthLocation || (HttpApiKeyAuthLocation = {}));
344
+
345
+ // ../../node_modules/.pnpm/@smithy+types@4.1.0/node_modules/@smithy/types/dist-es/endpoint.js
346
+ var EndpointURLScheme;
347
+ (function(EndpointURLScheme2) {
348
+ EndpointURLScheme2["HTTP"] = "http";
349
+ EndpointURLScheme2["HTTPS"] = "https";
350
+ })(EndpointURLScheme || (EndpointURLScheme = {}));
351
+
352
+ // ../../node_modules/.pnpm/@smithy+types@4.1.0/node_modules/@smithy/types/dist-es/extensions/checksum.js
353
+ var AlgorithmId;
354
+ (function(AlgorithmId2) {
355
+ AlgorithmId2["MD5"] = "md5";
356
+ AlgorithmId2["CRC32"] = "crc32";
357
+ AlgorithmId2["CRC32C"] = "crc32c";
358
+ AlgorithmId2["SHA1"] = "sha1";
359
+ AlgorithmId2["SHA256"] = "sha256";
360
+ })(AlgorithmId || (AlgorithmId = {}));
361
+
362
+ // ../../node_modules/.pnpm/@smithy+types@4.1.0/node_modules/@smithy/types/dist-es/http.js
363
+ var FieldPosition;
364
+ (function(FieldPosition2) {
365
+ FieldPosition2[FieldPosition2["HEADER"] = 0] = "HEADER";
366
+ FieldPosition2[FieldPosition2["TRAILER"] = 1] = "TRAILER";
367
+ })(FieldPosition || (FieldPosition = {}));
368
+
369
+ // ../../node_modules/.pnpm/@smithy+types@4.1.0/node_modules/@smithy/types/dist-es/profile.js
370
+ var IniSectionType;
371
+ (function(IniSectionType2) {
372
+ IniSectionType2["PROFILE"] = "profile";
373
+ IniSectionType2["SSO_SESSION"] = "sso-session";
374
+ IniSectionType2["SERVICES"] = "services";
375
+ })(IniSectionType || (IniSectionType = {}));
376
+
377
+ // ../../node_modules/.pnpm/@smithy+types@4.1.0/node_modules/@smithy/types/dist-es/transfer.js
378
+ var RequestHandlerProtocol;
379
+ (function(RequestHandlerProtocol2) {
380
+ RequestHandlerProtocol2["HTTP_0_9"] = "http/0.9";
381
+ RequestHandlerProtocol2["HTTP_1_0"] = "http/1.0";
382
+ RequestHandlerProtocol2["TDS_8_0"] = "tds/8.0";
383
+ })(RequestHandlerProtocol || (RequestHandlerProtocol = {}));
384
+
385
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/getConfigData.js
386
+ var getConfigData = (data) => Object.entries(data).filter(([key]) => {
387
+ const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
388
+ if (indexOfSeparator === -1) {
389
+ return false;
390
+ }
391
+ return Object.values(IniSectionType).includes(key.substring(0, indexOfSeparator));
392
+ }).reduce((acc, [key, value]) => {
393
+ const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
394
+ const updatedKey = key.substring(0, indexOfSeparator) === IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
395
+ acc[updatedKey] = value;
396
+ return acc;
397
+ }, {
398
+ ...data.default && { default: data.default }
399
+ });
400
+
401
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/getConfigFilepath.js
402
+ var import_path2 = require("path");
403
+ var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
404
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || (0, import_path2.join)(getHomeDir(), ".aws", "config");
405
+
406
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/getCredentialsFilepath.js
407
+ var import_path3 = require("path");
408
+ var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
409
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || (0, import_path3.join)(getHomeDir(), ".aws", "credentials");
410
+
411
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/parseIni.js
412
+ var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
413
+ var profileNameBlockList = ["__proto__", "profile __proto__"];
414
+ var parseIni = (iniData) => {
415
+ const map = {};
416
+ let currentSection;
417
+ let currentSubSection;
418
+ for (const iniLine of iniData.split(/\r?\n/)) {
419
+ const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim();
420
+ const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]";
421
+ if (isSection) {
422
+ currentSection = void 0;
423
+ currentSubSection = void 0;
424
+ const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);
425
+ const matches = prefixKeyRegex.exec(sectionName);
426
+ if (matches) {
427
+ const [, prefix, , name] = matches;
428
+ if (Object.values(IniSectionType).includes(prefix)) {
429
+ currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);
430
+ }
431
+ } else {
432
+ currentSection = sectionName;
433
+ }
434
+ if (profileNameBlockList.includes(sectionName)) {
435
+ throw new Error(`Found invalid profile name "${sectionName}"`);
436
+ }
437
+ } else if (currentSection) {
438
+ const indexOfEqualsSign = trimmedLine.indexOf("=");
439
+ if (![0, -1].includes(indexOfEqualsSign)) {
440
+ const [name, value] = [
441
+ trimmedLine.substring(0, indexOfEqualsSign).trim(),
442
+ trimmedLine.substring(indexOfEqualsSign + 1).trim()
443
+ ];
444
+ if (value === "") {
445
+ currentSubSection = name;
446
+ } else {
447
+ if (currentSubSection && iniLine.trimStart() === iniLine) {
448
+ currentSubSection = void 0;
449
+ }
450
+ map[currentSection] = map[currentSection] || {};
451
+ const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;
452
+ map[currentSection][key] = value;
453
+ }
454
+ }
455
+ }
456
+ }
457
+ return map;
458
+ };
459
+
460
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/slurpFile.js
461
+ var import_fs2 = require("fs");
462
+ var { readFile: readFile2 } = import_fs2.promises;
463
+ var filePromisesHash = {};
464
+ var slurpFile = (path, options) => {
465
+ if (!filePromisesHash[path] || options?.ignoreCache) {
466
+ filePromisesHash[path] = readFile2(path, "utf8");
467
+ }
468
+ return filePromisesHash[path];
469
+ };
470
+
471
+ // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.0.1/node_modules/@smithy/shared-ini-file-loader/dist-es/loadSharedConfigFiles.js
472
+ var swallowError = () => ({});
473
+ var CONFIG_PREFIX_SEPARATOR = ".";
474
+ var loadSharedConfigFiles = async (init = {}) => {
475
+ const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
476
+ const homeDir = getHomeDir();
477
+ const relativeHomeDirPrefix = "~/";
478
+ let resolvedFilepath = filepath;
479
+ if (filepath.startsWith(relativeHomeDirPrefix)) {
480
+ resolvedFilepath = (0, import_path4.join)(homeDir, filepath.slice(2));
481
+ }
482
+ let resolvedConfigFilepath = configFilepath;
483
+ if (configFilepath.startsWith(relativeHomeDirPrefix)) {
484
+ resolvedConfigFilepath = (0, import_path4.join)(homeDir, configFilepath.slice(2));
485
+ }
486
+ const parsedFiles = await Promise.all([
487
+ slurpFile(resolvedConfigFilepath, {
488
+ ignoreCache: init.ignoreCache
489
+ }).then(parseIni).then(getConfigData).catch(swallowError),
490
+ slurpFile(resolvedFilepath, {
491
+ ignoreCache: init.ignoreCache
492
+ }).then(parseIni).catch(swallowError)
493
+ ]);
494
+ return {
495
+ configFile: parsedFiles[0],
496
+ credentialsFile: parsedFiles[1]
497
+ };
498
+ };
499
+
500
+ // ../../node_modules/.pnpm/@smithy+node-config-provider@4.0.1/node_modules/@smithy/node-config-provider/dist-es/fromSharedConfigFiles.js
501
+ var fromSharedConfigFiles = (configSelector, { preferredFile = "config", ...init } = {}) => async () => {
502
+ const profile = getProfileName(init);
503
+ const { configFile, credentialsFile } = await loadSharedConfigFiles(init);
504
+ const profileFromCredentials = credentialsFile[profile] || {};
505
+ const profileFromConfig = configFile[profile] || {};
506
+ const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials };
507
+ try {
508
+ const cfgFile = preferredFile === "config" ? configFile : credentialsFile;
509
+ const configValue = configSelector(mergedProfile, cfgFile);
510
+ if (configValue === void 0) {
511
+ throw new Error();
512
+ }
513
+ return configValue;
514
+ } catch (e) {
515
+ throw new CredentialsProviderError(e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, { logger: init.logger });
516
+ }
517
+ };
518
+
519
+ // ../../node_modules/.pnpm/@smithy+node-config-provider@4.0.1/node_modules/@smithy/node-config-provider/dist-es/fromStatic.js
520
+ var isFunction = (func) => typeof func === "function";
521
+ var fromStatic2 = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : fromStatic(defaultValue);
522
+
523
+ // ../../node_modules/.pnpm/@smithy+node-config-provider@4.0.1/node_modules/@smithy/node-config-provider/dist-es/configLoader.js
524
+ var loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => memoize(chain(fromEnv(environmentVariableSelector), fromSharedConfigFiles(configFileSelector, configuration), fromStatic2(defaultValue)));
525
+
526
+ // ../../node_modules/.pnpm/@smithy+middleware-endpoint@4.0.5/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointUrlConfig.js
527
+ var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
528
+ var CONFIG_ENDPOINT_URL = "endpoint_url";
529
+ var getEndpointUrlConfig = (serviceId) => ({
530
+ environmentVariableSelector: (env) => {
531
+ const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
532
+ const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
533
+ if (serviceEndpointUrl)
534
+ return serviceEndpointUrl;
535
+ const endpointUrl = env[ENV_ENDPOINT_URL];
536
+ if (endpointUrl)
537
+ return endpointUrl;
538
+ return void 0;
539
+ },
540
+ configFileSelector: (profile, config) => {
541
+ if (config && profile.services) {
542
+ const servicesSection = config[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
543
+ if (servicesSection) {
544
+ const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
545
+ const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
546
+ if (endpointUrl2)
547
+ return endpointUrl2;
548
+ }
549
+ }
550
+ const endpointUrl = profile[CONFIG_ENDPOINT_URL];
551
+ if (endpointUrl)
552
+ return endpointUrl;
553
+ return void 0;
554
+ },
555
+ default: void 0
556
+ });
557
+
558
+ // ../../node_modules/.pnpm/@smithy+middleware-endpoint@4.0.5/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.js
559
+ var getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
560
+
561
+ // ../../node_modules/.pnpm/@smithy+querystring-parser@4.0.1/node_modules/@smithy/querystring-parser/dist-es/index.js
562
+ function parseQueryString(querystring) {
563
+ const query = {};
564
+ querystring = querystring.replace(/^\?/, "");
565
+ if (querystring) {
566
+ for (const pair of querystring.split("&")) {
567
+ let [key, value = null] = pair.split("=");
568
+ key = decodeURIComponent(key);
569
+ if (value) {
570
+ value = decodeURIComponent(value);
571
+ }
572
+ if (!(key in query)) {
573
+ query[key] = value;
574
+ } else if (Array.isArray(query[key])) {
575
+ query[key].push(value);
576
+ } else {
577
+ query[key] = [query[key], value];
578
+ }
579
+ }
580
+ }
581
+ return query;
582
+ }
583
+
584
+ // ../../node_modules/.pnpm/@smithy+url-parser@4.0.1/node_modules/@smithy/url-parser/dist-es/index.js
585
+ var parseUrl = (url) => {
586
+ if (typeof url === "string") {
587
+ return parseUrl(new URL(url));
588
+ }
589
+ const { hostname, pathname, port, protocol, search } = url;
590
+ let query;
591
+ if (search) {
592
+ query = parseQueryString(search);
593
+ }
594
+ return {
595
+ hostname,
596
+ port: port ? parseInt(port) : void 0,
597
+ protocol,
598
+ path: pathname,
599
+ query
600
+ };
601
+ };
602
+
603
+ // ../../node_modules/.pnpm/@smithy+middleware-endpoint@4.0.5/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/toEndpointV1.js
604
+ var toEndpointV1 = (endpoint) => {
605
+ if (typeof endpoint === "object") {
606
+ if ("url" in endpoint) {
607
+ return parseUrl(endpoint.url);
608
+ }
609
+ return endpoint;
610
+ }
611
+ return parseUrl(endpoint);
612
+ };
613
+
614
+ // ../../node_modules/.pnpm/@smithy+middleware-endpoint@4.0.5/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js
615
+ var getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context) => {
616
+ if (!clientConfig.endpoint) {
617
+ let endpointFromConfig;
618
+ if (clientConfig.serviceConfiguredEndpoint) {
619
+ endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
620
+ } else {
621
+ endpointFromConfig = await getEndpointFromConfig(clientConfig.serviceId);
622
+ }
623
+ if (endpointFromConfig) {
624
+ clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
625
+ }
626
+ }
627
+ const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
628
+ if (typeof clientConfig.endpointProvider !== "function") {
629
+ throw new Error("config.endpointProvider is not set.");
630
+ }
631
+ const endpoint = clientConfig.endpointProvider(endpointParams, context);
632
+ return endpoint;
633
+ };
634
+ var resolveParams = async (commandInput, instructionsSupplier, clientConfig) => {
635
+ const endpointParams = {};
636
+ const instructions = instructionsSupplier?.getEndpointParameterInstructions?.() || {};
637
+ for (const [name, instruction] of Object.entries(instructions)) {
638
+ switch (instruction.type) {
639
+ case "staticContextParams":
640
+ endpointParams[name] = instruction.value;
641
+ break;
642
+ case "contextParams":
643
+ endpointParams[name] = commandInput[instruction.name];
644
+ break;
645
+ case "clientContextParams":
646
+ case "builtInParams":
647
+ endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)();
648
+ break;
649
+ case "operationContextParams":
650
+ endpointParams[name] = instruction.get(commandInput);
651
+ break;
652
+ default:
653
+ throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction));
654
+ }
655
+ }
656
+ if (Object.keys(instructions).length === 0) {
657
+ Object.assign(endpointParams, clientConfig);
658
+ }
659
+ if (String(clientConfig.serviceId).toLowerCase() === "s3") {
660
+ await resolveParamsForS3(endpointParams);
661
+ }
662
+ return endpointParams;
663
+ };
664
+
665
+ // ../../node_modules/.pnpm/@smithy+util-middleware@4.0.1/node_modules/@smithy/util-middleware/dist-es/normalizeProvider.js
666
+ var normalizeProvider = (input) => {
667
+ if (typeof input === "function")
668
+ return input;
669
+ const promisified = Promise.resolve(input);
670
+ return () => promisified;
671
+ };
672
+
673
+ // ../../node_modules/.pnpm/@smithy+middleware-serde@4.0.2/node_modules/@smithy/middleware-serde/dist-es/serdePlugin.js
674
+ var serializerMiddlewareOption = {
675
+ name: "serializerMiddleware",
676
+ step: "serialize",
677
+ tags: ["SERIALIZER"],
678
+ override: true
679
+ };
680
+
681
+ // ../../node_modules/.pnpm/@smithy+core@3.1.4/node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js
682
+ var httpAuthSchemeMiddlewareOptions = {
683
+ step: "serialize",
684
+ tags: ["HTTP_AUTH_SCHEME"],
685
+ name: "httpAuthSchemeMiddleware",
686
+ override: true,
687
+ relation: "before",
688
+ toMiddleware: serializerMiddlewareOption.name
689
+ };
690
+
691
+ // ../../node_modules/.pnpm/@smithy+protocol-http@5.0.1/node_modules/@smithy/protocol-http/dist-es/httpRequest.js
692
+ var HttpRequest = class _HttpRequest {
693
+ constructor(options) {
694
+ this.method = options.method || "GET";
695
+ this.hostname = options.hostname || "localhost";
696
+ this.port = options.port;
697
+ this.query = options.query || {};
698
+ this.headers = options.headers || {};
699
+ this.body = options.body;
700
+ this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:";
701
+ this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/";
702
+ this.username = options.username;
703
+ this.password = options.password;
704
+ this.fragment = options.fragment;
705
+ }
706
+ static clone(request) {
707
+ const cloned = new _HttpRequest({
708
+ ...request,
709
+ headers: { ...request.headers }
710
+ });
711
+ if (cloned.query) {
712
+ cloned.query = cloneQuery(cloned.query);
713
+ }
714
+ return cloned;
715
+ }
716
+ static isInstance(request) {
717
+ if (!request) {
718
+ return false;
719
+ }
720
+ const req = request;
721
+ return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object";
722
+ }
723
+ clone() {
724
+ return _HttpRequest.clone(this);
725
+ }
726
+ };
727
+ function cloneQuery(query) {
728
+ return Object.keys(query).reduce((carry, paramName) => {
729
+ const param = query[paramName];
730
+ return {
731
+ ...carry,
732
+ [paramName]: Array.isArray(param) ? [...param] : param
733
+ };
734
+ }, {});
735
+ }
736
+
737
+ // ../../node_modules/.pnpm/@smithy+is-array-buffer@4.0.0/node_modules/@smithy/is-array-buffer/dist-es/index.js
738
+ var isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
739
+
740
+ // ../../node_modules/.pnpm/@smithy+util-buffer-from@4.0.0/node_modules/@smithy/util-buffer-from/dist-es/index.js
741
+ var import_buffer = require("buffer");
742
+ var fromString = (input, encoding) => {
743
+ if (typeof input !== "string") {
744
+ throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`);
745
+ }
746
+ return encoding ? import_buffer.Buffer.from(input, encoding) : import_buffer.Buffer.from(input);
747
+ };
748
+
749
+ // ../../node_modules/.pnpm/@smithy+util-utf8@4.0.0/node_modules/@smithy/util-utf8/dist-es/fromUtf8.js
750
+ var fromUtf8 = (input) => {
751
+ const buf = fromString(input, "utf8");
752
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
753
+ };
754
+
755
+ // ../../node_modules/.pnpm/@smithy+util-utf8@4.0.0/node_modules/@smithy/util-utf8/dist-es/toUint8Array.js
756
+ var toUint8Array = (data) => {
757
+ if (typeof data === "string") {
758
+ return fromUtf8(data);
759
+ }
760
+ if (ArrayBuffer.isView(data)) {
761
+ return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);
762
+ }
763
+ return new Uint8Array(data);
764
+ };
765
+
766
+ // ../../node_modules/.pnpm/@smithy+util-stream@4.1.1/node_modules/@smithy/util-stream/dist-es/createBufferedReadable.js
767
+ var import_node_stream = require("stream");
768
+
769
+ // ../../node_modules/.pnpm/@smithy+util-hex-encoding@4.0.0/node_modules/@smithy/util-hex-encoding/dist-es/index.js
770
+ var SHORT_TO_HEX = {};
771
+ var HEX_TO_SHORT = {};
772
+ for (let i = 0; i < 256; i++) {
773
+ let encodedByte = i.toString(16).toLowerCase();
774
+ if (encodedByte.length === 1) {
775
+ encodedByte = `0${encodedByte}`;
776
+ }
777
+ SHORT_TO_HEX[i] = encodedByte;
778
+ HEX_TO_SHORT[encodedByte] = i;
779
+ }
780
+ function fromHex(encoded) {
781
+ if (encoded.length % 2 !== 0) {
782
+ throw new Error("Hex encoded strings must have an even number length");
783
+ }
784
+ const out = new Uint8Array(encoded.length / 2);
785
+ for (let i = 0; i < encoded.length; i += 2) {
786
+ const encodedByte = encoded.slice(i, i + 2).toLowerCase();
787
+ if (encodedByte in HEX_TO_SHORT) {
788
+ out[i / 2] = HEX_TO_SHORT[encodedByte];
789
+ } else {
790
+ throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`);
791
+ }
792
+ }
793
+ return out;
794
+ }
795
+ function toHex(bytes) {
796
+ let out = "";
797
+ for (let i = 0; i < bytes.byteLength; i++) {
798
+ out += SHORT_TO_HEX[bytes[i]];
799
+ }
800
+ return out;
801
+ }
802
+
803
+ // ../../node_modules/.pnpm/@smithy+core@3.1.4/node_modules/@smithy/core/dist-es/util-identity-and-auth/memoizeIdentityProvider.js
804
+ var createIsIdentityExpiredFunction = (expirationMs) => (identity) => doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs;
805
+ var EXPIRATION_MS = 3e5;
806
+ var isIdentityExpired = createIsIdentityExpiredFunction(EXPIRATION_MS);
807
+ var doesIdentityRequireRefresh = (identity) => identity.expiration !== void 0;
808
+
809
+ // ../../node_modules/.pnpm/@smithy+middleware-endpoint@4.0.5/node_modules/@smithy/middleware-endpoint/dist-es/getEndpointPlugin.js
810
+ var endpointMiddlewareOptions = {
811
+ step: "serialize",
812
+ tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
813
+ name: "endpointV2Middleware",
814
+ override: true,
815
+ relation: "before",
816
+ toMiddleware: serializerMiddlewareOption.name
817
+ };
818
+
819
+ // ../../node_modules/.pnpm/@smithy+smithy-client@4.1.5/node_modules/@smithy/smithy-client/dist-es/parse-utils.js
820
+ var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
821
+
822
+ // ../../node_modules/.pnpm/@smithy+smithy-client@4.1.5/node_modules/@smithy/smithy-client/dist-es/date-utils.js
823
+ var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);
824
+ var RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
825
+ var IMF_FIXDATE = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
826
+ var RFC_850_DATE = new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
827
+ var ASC_TIME = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);
828
+ var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1e3;
829
+
830
+ // ../../node_modules/.pnpm/@smithy+smithy-client@4.1.5/node_modules/@smithy/smithy-client/dist-es/lazy-json.js
831
+ var LazyJsonString = function LazyJsonString2(val) {
832
+ const str = Object.assign(new String(val), {
833
+ deserializeJSON() {
834
+ return JSON.parse(String(val));
835
+ },
836
+ toString() {
837
+ return String(val);
838
+ },
839
+ toJSON() {
840
+ return String(val);
841
+ }
842
+ });
843
+ return str;
844
+ };
845
+ LazyJsonString.from = (object) => {
846
+ if (object && typeof object === "object" && (object instanceof LazyJsonString || "deserializeJSON" in object)) {
847
+ return object;
848
+ } else if (typeof object === "string" || Object.getPrototypeOf(object) === String.prototype) {
849
+ return LazyJsonString(String(object));
850
+ }
851
+ return LazyJsonString(JSON.stringify(object));
852
+ };
853
+ LazyJsonString.fromObject = LazyJsonString.from;
854
+
855
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/constants.js
856
+ var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
857
+ var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
858
+ var AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
859
+ var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
860
+ var EXPIRES_QUERY_PARAM = "X-Amz-Expires";
861
+ var SIGNATURE_QUERY_PARAM = "X-Amz-Signature";
862
+ var TOKEN_QUERY_PARAM = "X-Amz-Security-Token";
863
+ var AUTH_HEADER = "authorization";
864
+ var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase();
865
+ var DATE_HEADER = "date";
866
+ var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER];
867
+ var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase();
868
+ var SHA256_HEADER = "x-amz-content-sha256";
869
+ var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase();
870
+ var ALWAYS_UNSIGNABLE_HEADERS = {
871
+ authorization: true,
872
+ "cache-control": true,
873
+ connection: true,
874
+ expect: true,
875
+ from: true,
876
+ "keep-alive": true,
877
+ "max-forwards": true,
878
+ pragma: true,
879
+ referer: true,
880
+ te: true,
881
+ trailer: true,
882
+ "transfer-encoding": true,
883
+ upgrade: true,
884
+ "user-agent": true,
885
+ "x-amzn-trace-id": true
886
+ };
887
+ var PROXY_HEADER_PATTERN = /^proxy-/;
888
+ var SEC_HEADER_PATTERN = /^sec-/;
889
+ var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
890
+ var EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD";
891
+ var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD";
892
+ var MAX_CACHE_SIZE = 50;
893
+ var KEY_TYPE_IDENTIFIER = "aws4_request";
894
+ var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7;
895
+
896
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/credentialDerivation.js
897
+ var signingKeyCache = {};
898
+ var cacheQueue = [];
899
+ var createScope = (shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`;
900
+ var getSigningKey = async (sha256Constructor, credentials, shortDate, region, service) => {
901
+ const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId);
902
+ const cacheKey = `${shortDate}:${region}:${service}:${toHex(credsHash)}:${credentials.sessionToken}`;
903
+ if (cacheKey in signingKeyCache) {
904
+ return signingKeyCache[cacheKey];
905
+ }
906
+ cacheQueue.push(cacheKey);
907
+ while (cacheQueue.length > MAX_CACHE_SIZE) {
908
+ delete signingKeyCache[cacheQueue.shift()];
909
+ }
910
+ let key = `AWS4${credentials.secretAccessKey}`;
911
+ for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) {
912
+ key = await hmac(sha256Constructor, key, signable);
913
+ }
914
+ return signingKeyCache[cacheKey] = key;
915
+ };
916
+ var hmac = (ctor, secret, data) => {
917
+ const hash = new ctor(secret);
918
+ hash.update(toUint8Array(data));
919
+ return hash.digest();
920
+ };
921
+
922
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js
923
+ var getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => {
924
+ const canonical = {};
925
+ for (const headerName of Object.keys(headers).sort()) {
926
+ if (headers[headerName] == void 0) {
927
+ continue;
928
+ }
929
+ const canonicalHeaderName = headerName.toLowerCase();
930
+ if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || unsignableHeaders?.has(canonicalHeaderName) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) {
931
+ if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) {
932
+ continue;
933
+ }
934
+ }
935
+ canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " ");
936
+ }
937
+ return canonical;
938
+ };
939
+
940
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js
941
+ var getCanonicalQuery = ({ query = {} }) => {
942
+ const keys = [];
943
+ const serialized = {};
944
+ for (const key of Object.keys(query)) {
945
+ if (key.toLowerCase() === SIGNATURE_HEADER) {
946
+ continue;
947
+ }
948
+ const encodedKey = escapeUri(key);
949
+ keys.push(encodedKey);
950
+ const value = query[key];
951
+ if (typeof value === "string") {
952
+ serialized[encodedKey] = `${encodedKey}=${escapeUri(value)}`;
953
+ } else if (Array.isArray(value)) {
954
+ serialized[encodedKey] = value.slice(0).reduce((encoded, value2) => encoded.concat([`${encodedKey}=${escapeUri(value2)}`]), []).sort().join("&");
955
+ }
956
+ }
957
+ return keys.sort().map((key) => serialized[key]).filter((serialized2) => serialized2).join("&");
958
+ };
959
+
960
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js
961
+ var getPayloadHash = async ({ headers, body }, hashConstructor) => {
962
+ for (const headerName of Object.keys(headers)) {
963
+ if (headerName.toLowerCase() === SHA256_HEADER) {
964
+ return headers[headerName];
965
+ }
966
+ }
967
+ if (body == void 0) {
968
+ return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
969
+ } else if (typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body)) {
970
+ const hashCtor = new hashConstructor();
971
+ hashCtor.update(toUint8Array(body));
972
+ return toHex(await hashCtor.digest());
973
+ }
974
+ return UNSIGNED_PAYLOAD;
975
+ };
976
+
977
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js
978
+ var HeaderFormatter = class {
979
+ format(headers) {
980
+ const chunks = [];
981
+ for (const headerName of Object.keys(headers)) {
982
+ const bytes = fromUtf8(headerName);
983
+ chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
984
+ }
985
+ const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
986
+ let position = 0;
987
+ for (const chunk of chunks) {
988
+ out.set(chunk, position);
989
+ position += chunk.byteLength;
990
+ }
991
+ return out;
992
+ }
993
+ formatHeaderValue(header) {
994
+ switch (header.type) {
995
+ case "boolean":
996
+ return Uint8Array.from([header.value ? 0 : 1]);
997
+ case "byte":
998
+ return Uint8Array.from([2, header.value]);
999
+ case "short":
1000
+ const shortView = new DataView(new ArrayBuffer(3));
1001
+ shortView.setUint8(0, 3);
1002
+ shortView.setInt16(1, header.value, false);
1003
+ return new Uint8Array(shortView.buffer);
1004
+ case "integer":
1005
+ const intView = new DataView(new ArrayBuffer(5));
1006
+ intView.setUint8(0, 4);
1007
+ intView.setInt32(1, header.value, false);
1008
+ return new Uint8Array(intView.buffer);
1009
+ case "long":
1010
+ const longBytes = new Uint8Array(9);
1011
+ longBytes[0] = 5;
1012
+ longBytes.set(header.value.bytes, 1);
1013
+ return longBytes;
1014
+ case "binary":
1015
+ const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
1016
+ binView.setUint8(0, 6);
1017
+ binView.setUint16(1, header.value.byteLength, false);
1018
+ const binBytes = new Uint8Array(binView.buffer);
1019
+ binBytes.set(header.value, 3);
1020
+ return binBytes;
1021
+ case "string":
1022
+ const utf8Bytes = fromUtf8(header.value);
1023
+ const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
1024
+ strView.setUint8(0, 7);
1025
+ strView.setUint16(1, utf8Bytes.byteLength, false);
1026
+ const strBytes = new Uint8Array(strView.buffer);
1027
+ strBytes.set(utf8Bytes, 3);
1028
+ return strBytes;
1029
+ case "timestamp":
1030
+ const tsBytes = new Uint8Array(9);
1031
+ tsBytes[0] = 8;
1032
+ tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
1033
+ return tsBytes;
1034
+ case "uuid":
1035
+ if (!UUID_PATTERN.test(header.value)) {
1036
+ throw new Error(`Invalid UUID received: ${header.value}`);
1037
+ }
1038
+ const uuidBytes = new Uint8Array(17);
1039
+ uuidBytes[0] = 9;
1040
+ uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
1041
+ return uuidBytes;
1042
+ }
1043
+ }
1044
+ };
1045
+ var HEADER_VALUE_TYPE;
1046
+ (function(HEADER_VALUE_TYPE2) {
1047
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolTrue"] = 0] = "boolTrue";
1048
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolFalse"] = 1] = "boolFalse";
1049
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byte"] = 2] = "byte";
1050
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["short"] = 3] = "short";
1051
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["integer"] = 4] = "integer";
1052
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["long"] = 5] = "long";
1053
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byteArray"] = 6] = "byteArray";
1054
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["string"] = 7] = "string";
1055
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["timestamp"] = 8] = "timestamp";
1056
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["uuid"] = 9] = "uuid";
1057
+ })(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));
1058
+ var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
1059
+ var Int64 = class _Int64 {
1060
+ constructor(bytes) {
1061
+ this.bytes = bytes;
1062
+ if (bytes.byteLength !== 8) {
1063
+ throw new Error("Int64 buffers must be exactly 8 bytes");
1064
+ }
1065
+ }
1066
+ static fromNumber(number) {
1067
+ if (number > 9223372036854776e3 || number < -9223372036854776e3) {
1068
+ throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
1069
+ }
1070
+ const bytes = new Uint8Array(8);
1071
+ for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
1072
+ bytes[i] = remaining;
1073
+ }
1074
+ if (number < 0) {
1075
+ negate(bytes);
1076
+ }
1077
+ return new _Int64(bytes);
1078
+ }
1079
+ valueOf() {
1080
+ const bytes = this.bytes.slice(0);
1081
+ const negative = bytes[0] & 128;
1082
+ if (negative) {
1083
+ negate(bytes);
1084
+ }
1085
+ return parseInt(toHex(bytes), 16) * (negative ? -1 : 1);
1086
+ }
1087
+ toString() {
1088
+ return String(this.valueOf());
1089
+ }
1090
+ };
1091
+ function negate(bytes) {
1092
+ for (let i = 0; i < 8; i++) {
1093
+ bytes[i] ^= 255;
1094
+ }
1095
+ for (let i = 7; i > -1; i--) {
1096
+ bytes[i]++;
1097
+ if (bytes[i] !== 0)
1098
+ break;
1099
+ }
1100
+ }
1101
+
1102
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/headerUtil.js
1103
+ var hasHeader = (soughtHeader, headers) => {
1104
+ soughtHeader = soughtHeader.toLowerCase();
1105
+ for (const headerName of Object.keys(headers)) {
1106
+ if (soughtHeader === headerName.toLowerCase()) {
1107
+ return true;
1108
+ }
1109
+ }
1110
+ return false;
1111
+ };
1112
+
1113
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js
1114
+ var moveHeadersToQuery = (request, options = {}) => {
1115
+ const { headers, query = {} } = HttpRequest.clone(request);
1116
+ for (const name of Object.keys(headers)) {
1117
+ const lname = name.toLowerCase();
1118
+ if (lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname) || options.hoistableHeaders?.has(lname)) {
1119
+ query[name] = headers[name];
1120
+ delete headers[name];
1121
+ }
1122
+ }
1123
+ return {
1124
+ ...request,
1125
+ headers,
1126
+ query
1127
+ };
1128
+ };
1129
+
1130
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/prepareRequest.js
1131
+ var prepareRequest = (request) => {
1132
+ request = HttpRequest.clone(request);
1133
+ for (const headerName of Object.keys(request.headers)) {
1134
+ if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {
1135
+ delete request.headers[headerName];
1136
+ }
1137
+ }
1138
+ return request;
1139
+ };
1140
+
1141
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/utilDate.js
1142
+ var iso8601 = (time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z");
1143
+ var toDate = (time) => {
1144
+ if (typeof time === "number") {
1145
+ return new Date(time * 1e3);
1146
+ }
1147
+ if (typeof time === "string") {
1148
+ if (Number(time)) {
1149
+ return new Date(Number(time) * 1e3);
1150
+ }
1151
+ return new Date(time);
1152
+ }
1153
+ return time;
1154
+ };
1155
+
1156
+ // ../../node_modules/.pnpm/@smithy+signature-v4@5.0.1/node_modules/@smithy/signature-v4/dist-es/SignatureV4.js
1157
+ var SignatureV4 = class {
1158
+ constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true }) {
1159
+ this.headerFormatter = new HeaderFormatter();
1160
+ this.service = service;
1161
+ this.sha256 = sha256;
1162
+ this.uriEscapePath = uriEscapePath;
1163
+ this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true;
1164
+ this.regionProvider = normalizeProvider(region);
1165
+ this.credentialProvider = normalizeProvider(credentials);
1166
+ }
1167
+ async presign(originalRequest, options = {}) {
1168
+ const { signingDate = /* @__PURE__ */ new Date(), expiresIn = 3600, unsignableHeaders, unhoistableHeaders, signableHeaders, hoistableHeaders, signingRegion, signingService } = options;
1169
+ const credentials = await this.credentialProvider();
1170
+ this.validateResolvedCredentials(credentials);
1171
+ const region = signingRegion ?? await this.regionProvider();
1172
+ const { longDate, shortDate } = formatDate(signingDate);
1173
+ if (expiresIn > MAX_PRESIGNED_TTL) {
1174
+ return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");
1175
+ }
1176
+ const scope = createScope(shortDate, region, signingService ?? this.service);
1177
+ const request = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders, hoistableHeaders });
1178
+ if (credentials.sessionToken) {
1179
+ request.query[TOKEN_QUERY_PARAM] = credentials.sessionToken;
1180
+ }
1181
+ request.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER;
1182
+ request.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`;
1183
+ request.query[AMZ_DATE_QUERY_PARAM] = longDate;
1184
+ request.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10);
1185
+ const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
1186
+ request.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders);
1187
+ request.query[SIGNATURE_QUERY_PARAM] = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256)));
1188
+ return request;
1189
+ }
1190
+ async sign(toSign, options) {
1191
+ if (typeof toSign === "string") {
1192
+ return this.signString(toSign, options);
1193
+ } else if (toSign.headers && toSign.payload) {
1194
+ return this.signEvent(toSign, options);
1195
+ } else if (toSign.message) {
1196
+ return this.signMessage(toSign, options);
1197
+ } else {
1198
+ return this.signRequest(toSign, options);
1199
+ }
1200
+ }
1201
+ async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService }) {
1202
+ const region = signingRegion ?? await this.regionProvider();
1203
+ const { shortDate, longDate } = formatDate(signingDate);
1204
+ const scope = createScope(shortDate, region, signingService ?? this.service);
1205
+ const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256);
1206
+ const hash = new this.sha256();
1207
+ hash.update(headers);
1208
+ const hashedHeaders = toHex(await hash.digest());
1209
+ const stringToSign = [
1210
+ EVENT_ALGORITHM_IDENTIFIER,
1211
+ longDate,
1212
+ scope,
1213
+ priorSignature,
1214
+ hashedHeaders,
1215
+ hashedPayload
1216
+ ].join("\n");
1217
+ return this.signString(stringToSign, { signingDate, signingRegion: region, signingService });
1218
+ }
1219
+ async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService }) {
1220
+ const promise = this.signEvent({
1221
+ headers: this.headerFormatter.format(signableMessage.message.headers),
1222
+ payload: signableMessage.message.body
1223
+ }, {
1224
+ signingDate,
1225
+ signingRegion,
1226
+ signingService,
1227
+ priorSignature: signableMessage.priorSignature
1228
+ });
1229
+ return promise.then((signature) => {
1230
+ return { message: signableMessage.message, signature };
1231
+ });
1232
+ }
1233
+ async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService } = {}) {
1234
+ const credentials = await this.credentialProvider();
1235
+ this.validateResolvedCredentials(credentials);
1236
+ const region = signingRegion ?? await this.regionProvider();
1237
+ const { shortDate } = formatDate(signingDate);
1238
+ const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService));
1239
+ hash.update(toUint8Array(stringToSign));
1240
+ return toHex(await hash.digest());
1241
+ }
1242
+ async signRequest(requestToSign, { signingDate = /* @__PURE__ */ new Date(), signableHeaders, unsignableHeaders, signingRegion, signingService } = {}) {
1243
+ const credentials = await this.credentialProvider();
1244
+ this.validateResolvedCredentials(credentials);
1245
+ const region = signingRegion ?? await this.regionProvider();
1246
+ const request = prepareRequest(requestToSign);
1247
+ const { longDate, shortDate } = formatDate(signingDate);
1248
+ const scope = createScope(shortDate, region, signingService ?? this.service);
1249
+ request.headers[AMZ_DATE_HEADER] = longDate;
1250
+ if (credentials.sessionToken) {
1251
+ request.headers[TOKEN_HEADER] = credentials.sessionToken;
1252
+ }
1253
+ const payloadHash = await getPayloadHash(request, this.sha256);
1254
+ if (!hasHeader(SHA256_HEADER, request.headers) && this.applyChecksum) {
1255
+ request.headers[SHA256_HEADER] = payloadHash;
1256
+ }
1257
+ const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
1258
+ const signature = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, payloadHash));
1259
+ request.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature}`;
1260
+ return request;
1261
+ }
1262
+ createCanonicalRequest(request, canonicalHeaders, payloadHash) {
1263
+ const sortedHeaders = Object.keys(canonicalHeaders).sort();
1264
+ return `${request.method}
1265
+ ${this.getCanonicalPath(request)}
1266
+ ${getCanonicalQuery(request)}
1267
+ ${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")}
1268
+
1269
+ ${sortedHeaders.join(";")}
1270
+ ${payloadHash}`;
1271
+ }
1272
+ async createStringToSign(longDate, credentialScope, canonicalRequest) {
1273
+ const hash = new this.sha256();
1274
+ hash.update(toUint8Array(canonicalRequest));
1275
+ const hashedRequest = await hash.digest();
1276
+ return `${ALGORITHM_IDENTIFIER}
1277
+ ${longDate}
1278
+ ${credentialScope}
1279
+ ${toHex(hashedRequest)}`;
1280
+ }
1281
+ getCanonicalPath({ path }) {
1282
+ if (this.uriEscapePath) {
1283
+ const normalizedPathSegments = [];
1284
+ for (const pathSegment of path.split("/")) {
1285
+ if (pathSegment?.length === 0)
1286
+ continue;
1287
+ if (pathSegment === ".")
1288
+ continue;
1289
+ if (pathSegment === "..") {
1290
+ normalizedPathSegments.pop();
1291
+ } else {
1292
+ normalizedPathSegments.push(pathSegment);
1293
+ }
1294
+ }
1295
+ const normalizedPath = `${path?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path?.endsWith("/") ? "/" : ""}`;
1296
+ const doubleEncoded = escapeUri(normalizedPath);
1297
+ return doubleEncoded.replace(/%2F/g, "/");
1298
+ }
1299
+ return path;
1300
+ }
1301
+ async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) {
1302
+ const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest);
1303
+ const hash = new this.sha256(await keyPromise);
1304
+ hash.update(toUint8Array(stringToSign));
1305
+ return toHex(await hash.digest());
1306
+ }
1307
+ getSigningKey(credentials, region, shortDate, service) {
1308
+ return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service);
1309
+ }
1310
+ validateResolvedCredentials(credentials) {
1311
+ if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
1312
+ throw new Error("Resolved credential object is not valid");
1313
+ }
1314
+ }
1315
+ };
1316
+ var formatDate = (now) => {
1317
+ const longDate = iso8601(now).replace(/[\-:]/g, "");
1318
+ return {
1319
+ longDate,
1320
+ shortDate: longDate.slice(0, 8)
1321
+ };
1322
+ };
1323
+ var getCanonicalHeaderList = (headers) => Object.keys(headers).sort().join(";");
1324
+
1325
+ // ../../node_modules/.pnpm/@smithy+util-config-provider@4.0.0/node_modules/@smithy/util-config-provider/dist-es/types.js
1326
+ var SelectorType;
1327
+ (function(SelectorType2) {
1328
+ SelectorType2["ENV"] = "env";
1329
+ SelectorType2["CONFIG"] = "shared config entry";
1330
+ })(SelectorType || (SelectorType = {}));
1331
+
1332
+ // ../../node_modules/.pnpm/@aws-sdk+middleware-sdk-s3@3.750.0/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/constants.js
1333
+ var SESSION_TOKEN_QUERY_PARAM = "X-Amz-S3session-Token";
1334
+ var SESSION_TOKEN_HEADER = SESSION_TOKEN_QUERY_PARAM.toLowerCase();
1335
+
1336
+ // ../../node_modules/.pnpm/@aws-sdk+middleware-sdk-s3@3.750.0/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/s3-express/classes/SignatureV4S3Express.js
1337
+ var SignatureV4S3Express = class extends SignatureV4 {
1338
+ async signWithCredentials(requestToSign, credentials, options) {
1339
+ const credentialsWithoutSessionToken = getCredentialsWithoutSessionToken(credentials);
1340
+ requestToSign.headers[SESSION_TOKEN_HEADER] = credentials.sessionToken;
1341
+ const privateAccess = this;
1342
+ setSingleOverride(privateAccess, credentialsWithoutSessionToken);
1343
+ return privateAccess.signRequest(requestToSign, options ?? {});
1344
+ }
1345
+ async presignWithCredentials(requestToSign, credentials, options) {
1346
+ const credentialsWithoutSessionToken = getCredentialsWithoutSessionToken(credentials);
1347
+ delete requestToSign.headers[SESSION_TOKEN_HEADER];
1348
+ requestToSign.headers[SESSION_TOKEN_QUERY_PARAM] = credentials.sessionToken;
1349
+ requestToSign.query = requestToSign.query ?? {};
1350
+ requestToSign.query[SESSION_TOKEN_QUERY_PARAM] = credentials.sessionToken;
1351
+ const privateAccess = this;
1352
+ setSingleOverride(privateAccess, credentialsWithoutSessionToken);
1353
+ return this.presign(requestToSign, options);
1354
+ }
1355
+ };
1356
+ function getCredentialsWithoutSessionToken(credentials) {
1357
+ const credentialsWithoutSessionToken = {
1358
+ accessKeyId: credentials.accessKeyId,
1359
+ secretAccessKey: credentials.secretAccessKey,
1360
+ expiration: credentials.expiration
1361
+ };
1362
+ return credentialsWithoutSessionToken;
1363
+ }
1364
+ function setSingleOverride(privateAccess, credentialsWithoutSessionToken) {
1365
+ const id = setTimeout(() => {
1366
+ throw new Error("SignatureV4S3Express credential override was created but not called.");
1367
+ }, 10);
1368
+ const currentCredentialProvider = privateAccess.credentialProvider;
1369
+ const overrideCredentialsProviderOnce = () => {
1370
+ clearTimeout(id);
1371
+ privateAccess.credentialProvider = currentCredentialProvider;
1372
+ return Promise.resolve(credentialsWithoutSessionToken);
1373
+ };
1374
+ privateAccess.credentialProvider = overrideCredentialsProviderOnce;
1375
+ }
1376
+
1377
+ // ../../node_modules/.pnpm/@aws-sdk+signature-v4-multi-region@3.750.0/node_modules/@aws-sdk/signature-v4-multi-region/dist-es/signature-v4-crt-container.js
1378
+ var signatureV4CrtContainer = {
1379
+ CrtSignerV4: null
1380
+ };
1381
+
1382
+ // ../../node_modules/.pnpm/@aws-sdk+signature-v4-multi-region@3.750.0/node_modules/@aws-sdk/signature-v4-multi-region/dist-es/SignatureV4MultiRegion.js
1383
+ var SignatureV4MultiRegion = class {
1384
+ sigv4aSigner;
1385
+ sigv4Signer;
1386
+ signerOptions;
1387
+ constructor(options) {
1388
+ this.sigv4Signer = new SignatureV4S3Express(options);
1389
+ this.signerOptions = options;
1390
+ }
1391
+ async sign(requestToSign, options = {}) {
1392
+ if (options.signingRegion === "*") {
1393
+ if (this.signerOptions.runtime !== "node")
1394
+ throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");
1395
+ return this.getSigv4aSigner().sign(requestToSign, options);
1396
+ }
1397
+ return this.sigv4Signer.sign(requestToSign, options);
1398
+ }
1399
+ async signWithCredentials(requestToSign, credentials, options = {}) {
1400
+ if (options.signingRegion === "*") {
1401
+ if (this.signerOptions.runtime !== "node")
1402
+ throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");
1403
+ return this.getSigv4aSigner().signWithCredentials(requestToSign, credentials, options);
1404
+ }
1405
+ return this.sigv4Signer.signWithCredentials(requestToSign, credentials, options);
1406
+ }
1407
+ async presign(originalRequest, options = {}) {
1408
+ if (options.signingRegion === "*") {
1409
+ if (this.signerOptions.runtime !== "node")
1410
+ throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");
1411
+ return this.getSigv4aSigner().presign(originalRequest, options);
1412
+ }
1413
+ return this.sigv4Signer.presign(originalRequest, options);
1414
+ }
1415
+ async presignWithCredentials(originalRequest, credentials, options = {}) {
1416
+ if (options.signingRegion === "*") {
1417
+ throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");
1418
+ }
1419
+ return this.sigv4Signer.presignWithCredentials(originalRequest, credentials, options);
1420
+ }
1421
+ getSigv4aSigner() {
1422
+ if (!this.sigv4aSigner) {
1423
+ let CrtSignerV4 = null;
1424
+ try {
1425
+ CrtSignerV4 = signatureV4CrtContainer.CrtSignerV4;
1426
+ if (typeof CrtSignerV4 !== "function")
1427
+ throw new Error();
1428
+ } catch (e) {
1429
+ e.message = `${e.message}
1430
+ Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly.
1431
+ You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";].
1432
+ For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`;
1433
+ throw e;
1434
+ }
1435
+ this.sigv4aSigner = new CrtSignerV4({
1436
+ ...this.signerOptions,
1437
+ signingAlgorithm: 1
1438
+ });
1439
+ }
1440
+ return this.sigv4aSigner;
1441
+ }
1442
+ };
1443
+
1444
+ // ../../node_modules/.pnpm/@aws-sdk+s3-request-presigner@3.750.0/node_modules/@aws-sdk/s3-request-presigner/dist-es/constants.js
1445
+ var UNSIGNED_PAYLOAD2 = "UNSIGNED-PAYLOAD";
1446
+ var SHA256_HEADER2 = "X-Amz-Content-Sha256";
1447
+
1448
+ // ../../node_modules/.pnpm/@aws-sdk+s3-request-presigner@3.750.0/node_modules/@aws-sdk/s3-request-presigner/dist-es/presigner.js
1449
+ var S3RequestPresigner = class {
1450
+ signer;
1451
+ constructor(options) {
1452
+ const resolvedOptions = {
1453
+ service: options.signingName || options.service || "s3",
1454
+ uriEscapePath: options.uriEscapePath || false,
1455
+ applyChecksum: options.applyChecksum || false,
1456
+ ...options
1457
+ };
1458
+ this.signer = new SignatureV4MultiRegion(resolvedOptions);
1459
+ }
1460
+ presign(requestToSign, { unsignableHeaders = /* @__PURE__ */ new Set(), hoistableHeaders = /* @__PURE__ */ new Set(), unhoistableHeaders = /* @__PURE__ */ new Set(), ...options } = {}) {
1461
+ this.prepareRequest(requestToSign, {
1462
+ unsignableHeaders,
1463
+ unhoistableHeaders,
1464
+ hoistableHeaders
1465
+ });
1466
+ return this.signer.presign(requestToSign, {
1467
+ expiresIn: 900,
1468
+ unsignableHeaders,
1469
+ unhoistableHeaders,
1470
+ ...options
1471
+ });
1472
+ }
1473
+ presignWithCredentials(requestToSign, credentials, { unsignableHeaders = /* @__PURE__ */ new Set(), hoistableHeaders = /* @__PURE__ */ new Set(), unhoistableHeaders = /* @__PURE__ */ new Set(), ...options } = {}) {
1474
+ this.prepareRequest(requestToSign, {
1475
+ unsignableHeaders,
1476
+ unhoistableHeaders,
1477
+ hoistableHeaders
1478
+ });
1479
+ return this.signer.presignWithCredentials(requestToSign, credentials, {
1480
+ expiresIn: 900,
1481
+ unsignableHeaders,
1482
+ unhoistableHeaders,
1483
+ ...options
1484
+ });
1485
+ }
1486
+ prepareRequest(requestToSign, { unsignableHeaders = /* @__PURE__ */ new Set(), unhoistableHeaders = /* @__PURE__ */ new Set(), hoistableHeaders = /* @__PURE__ */ new Set() } = {}) {
1487
+ unsignableHeaders.add("content-type");
1488
+ Object.keys(requestToSign.headers).map((header) => header.toLowerCase()).filter((header) => header.startsWith("x-amz-server-side-encryption")).forEach((header) => {
1489
+ if (!hoistableHeaders.has(header)) {
1490
+ unhoistableHeaders.add(header);
1491
+ }
1492
+ });
1493
+ requestToSign.headers[SHA256_HEADER2] = UNSIGNED_PAYLOAD2;
1494
+ const currentHostHeader = requestToSign.headers.host;
1495
+ const port = requestToSign.port;
1496
+ const expectedHostHeader = `${requestToSign.hostname}${requestToSign.port != null ? ":" + port : ""}`;
1497
+ if (!currentHostHeader || currentHostHeader === requestToSign.hostname && requestToSign.port != null) {
1498
+ requestToSign.headers.host = expectedHostHeader;
1499
+ }
1500
+ }
1501
+ };
1502
+
1503
+ // ../../node_modules/.pnpm/@aws-sdk+s3-request-presigner@3.750.0/node_modules/@aws-sdk/s3-request-presigner/dist-es/getSignedUrl.js
1504
+ var getSignedUrl = async (client, command, options = {}) => {
1505
+ let s3Presigner;
1506
+ let region;
1507
+ if (typeof client.config.endpointProvider === "function") {
1508
+ const endpointV2 = await getEndpointFromInstructions(command.input, command.constructor, client.config);
1509
+ const authScheme = endpointV2.properties?.authSchemes?.[0];
1510
+ if (authScheme?.name === "sigv4a") {
1511
+ region = authScheme?.signingRegionSet?.join(",");
1512
+ } else {
1513
+ region = authScheme?.signingRegion;
1514
+ }
1515
+ s3Presigner = new S3RequestPresigner({
1516
+ ...client.config,
1517
+ signingName: authScheme?.signingName,
1518
+ region: async () => region
1519
+ });
1520
+ } else {
1521
+ s3Presigner = new S3RequestPresigner(client.config);
1522
+ }
1523
+ const presignInterceptMiddleware = (next, context) => async (args) => {
1524
+ const { request } = args;
1525
+ if (!HttpRequest.isInstance(request)) {
1526
+ throw new Error("Request to be presigned is not an valid HTTP request.");
1527
+ }
1528
+ delete request.headers["amz-sdk-invocation-id"];
1529
+ delete request.headers["amz-sdk-request"];
1530
+ delete request.headers["x-amz-user-agent"];
1531
+ let presigned2;
1532
+ const presignerOptions = {
1533
+ ...options,
1534
+ signingRegion: options.signingRegion ?? context["signing_region"] ?? region,
1535
+ signingService: options.signingService ?? context["signing_service"]
1536
+ };
1537
+ if (context.s3ExpressIdentity) {
1538
+ presigned2 = await s3Presigner.presignWithCredentials(request, context.s3ExpressIdentity, presignerOptions);
1539
+ } else {
1540
+ presigned2 = await s3Presigner.presign(request, presignerOptions);
1541
+ }
1542
+ return {
1543
+ response: {},
1544
+ output: {
1545
+ $metadata: { httpStatusCode: 200 },
1546
+ presigned: presigned2
1547
+ }
1548
+ };
1549
+ };
1550
+ const middlewareName = "presignInterceptMiddleware";
1551
+ const clientStack = client.middlewareStack.clone();
1552
+ clientStack.addRelativeTo(presignInterceptMiddleware, {
1553
+ name: middlewareName,
1554
+ relation: "before",
1555
+ toMiddleware: "awsAuthMiddleware",
1556
+ override: true
1557
+ });
1558
+ const handler2 = command.resolveMiddleware(clientStack, client.config, {});
1559
+ const { output } = await handler2({ input: command.input });
1560
+ const { presigned } = output;
1561
+ return formatUrl(presigned);
1562
+ };
1563
+
1564
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/body.js
1565
+ var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
1566
+ const { all = false, dot = false } = options;
1567
+ const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
1568
+ const contentType = headers.get("Content-Type");
1569
+ if (contentType?.startsWith("multipart/form-data") || contentType?.startsWith("application/x-www-form-urlencoded")) {
1570
+ return parseFormData(request, { all, dot });
1571
+ }
1572
+ return {};
1573
+ };
1574
+ async function parseFormData(request, options) {
1575
+ const formData = await request.formData();
1576
+ if (formData) {
1577
+ return convertFormDataToBodyData(formData, options);
1578
+ }
1579
+ return {};
1580
+ }
1581
+ function convertFormDataToBodyData(formData, options) {
1582
+ const form = /* @__PURE__ */ Object.create(null);
1583
+ formData.forEach((value, key) => {
1584
+ const shouldParseAllValues = options.all || key.endsWith("[]");
1585
+ if (!shouldParseAllValues) {
1586
+ form[key] = value;
1587
+ } else {
1588
+ handleParsingAllValues(form, key, value);
1589
+ }
1590
+ });
1591
+ if (options.dot) {
1592
+ Object.entries(form).forEach(([key, value]) => {
1593
+ const shouldParseDotValues = key.includes(".");
1594
+ if (shouldParseDotValues) {
1595
+ handleParsingNestedValues(form, key, value);
1596
+ delete form[key];
1597
+ }
1598
+ });
1599
+ }
1600
+ return form;
1601
+ }
1602
+ var handleParsingAllValues = (form, key, value) => {
1603
+ if (form[key] !== void 0) {
1604
+ if (Array.isArray(form[key])) {
1605
+ ;
1606
+ form[key].push(value);
1607
+ } else {
1608
+ form[key] = [form[key], value];
1609
+ }
1610
+ } else {
1611
+ form[key] = value;
1612
+ }
1613
+ };
1614
+ var handleParsingNestedValues = (form, key, value) => {
1615
+ let nestedForm = form;
1616
+ const keys = key.split(".");
1617
+ keys.forEach((key2, index) => {
1618
+ if (index === keys.length - 1) {
1619
+ nestedForm[key2] = value;
1620
+ } else {
1621
+ if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {
1622
+ nestedForm[key2] = /* @__PURE__ */ Object.create(null);
1623
+ }
1624
+ nestedForm = nestedForm[key2];
1625
+ }
1626
+ });
1627
+ };
1628
+
1629
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/url.js
1630
+ var splitPath = (path) => {
1631
+ const paths = path.split("/");
1632
+ if (paths[0] === "") {
1633
+ paths.shift();
1634
+ }
1635
+ return paths;
1636
+ };
1637
+ var splitRoutingPath = (routePath) => {
1638
+ const { groups, path } = extractGroupsFromPath(routePath);
1639
+ const paths = splitPath(path);
1640
+ return replaceGroupMarks(paths, groups);
1641
+ };
1642
+ var extractGroupsFromPath = (path) => {
1643
+ const groups = [];
1644
+ path = path.replace(/\{[^}]+\}/g, (match, index) => {
1645
+ const mark = `@${index}`;
1646
+ groups.push([mark, match]);
1647
+ return mark;
1648
+ });
1649
+ return { groups, path };
1650
+ };
1651
+ var replaceGroupMarks = (paths, groups) => {
1652
+ for (let i = groups.length - 1; i >= 0; i--) {
1653
+ const [mark] = groups[i];
1654
+ for (let j = paths.length - 1; j >= 0; j--) {
1655
+ if (paths[j].includes(mark)) {
1656
+ paths[j] = paths[j].replace(mark, groups[i][1]);
1657
+ break;
1658
+ }
1659
+ }
1660
+ }
1661
+ return paths;
1662
+ };
1663
+ var patternCache = {};
1664
+ var getPattern = (label) => {
1665
+ if (label === "*") {
1666
+ return "*";
1667
+ }
1668
+ const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
1669
+ if (match) {
1670
+ if (!patternCache[label]) {
1671
+ if (match[2]) {
1672
+ patternCache[label] = [label, match[1], new RegExp("^" + match[2] + "$")];
1673
+ } else {
1674
+ patternCache[label] = [label, match[1], true];
1675
+ }
1676
+ }
1677
+ return patternCache[label];
1678
+ }
1679
+ return null;
1680
+ };
1681
+ var tryDecodeURI = (str) => {
1682
+ try {
1683
+ return decodeURI(str);
1684
+ } catch {
1685
+ return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {
1686
+ try {
1687
+ return decodeURI(match);
1688
+ } catch {
1689
+ return match;
1690
+ }
1691
+ });
1692
+ }
1693
+ };
1694
+ var getPath = (request) => {
1695
+ const url = request.url;
1696
+ const start = url.indexOf("/", 8);
1697
+ let i = start;
1698
+ for (; i < url.length; i++) {
1699
+ const charCode = url.charCodeAt(i);
1700
+ if (charCode === 37) {
1701
+ const queryIndex = url.indexOf("?", i);
1702
+ const path = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);
1703
+ return tryDecodeURI(path.includes("%25") ? path.replace(/%25/g, "%2525") : path);
1704
+ } else if (charCode === 63) {
1705
+ break;
1706
+ }
1707
+ }
1708
+ return url.slice(start, i);
1709
+ };
1710
+ var getPathNoStrict = (request) => {
1711
+ const result = getPath(request);
1712
+ return result.length > 1 && result[result.length - 1] === "/" ? result.slice(0, -1) : result;
1713
+ };
1714
+ var mergePath = (...paths) => {
1715
+ let p = "";
1716
+ let endsWithSlash = false;
1717
+ for (let path of paths) {
1718
+ if (p[p.length - 1] === "/") {
1719
+ p = p.slice(0, -1);
1720
+ endsWithSlash = true;
1721
+ }
1722
+ if (path[0] !== "/") {
1723
+ path = `/${path}`;
1724
+ }
1725
+ if (path === "/" && endsWithSlash) {
1726
+ p = `${p}/`;
1727
+ } else if (path !== "/") {
1728
+ p = `${p}${path}`;
1729
+ }
1730
+ if (path === "/" && p === "") {
1731
+ p = "/";
1732
+ }
1733
+ }
1734
+ return p;
1735
+ };
1736
+ var checkOptionalParameter = (path) => {
1737
+ if (!path.match(/\:.+\?$/)) {
1738
+ return null;
1739
+ }
1740
+ const segments = path.split("/");
1741
+ const results = [];
1742
+ let basePath = "";
1743
+ segments.forEach((segment) => {
1744
+ if (segment !== "" && !/\:/.test(segment)) {
1745
+ basePath += "/" + segment;
1746
+ } else if (/\:/.test(segment)) {
1747
+ if (/\?/.test(segment)) {
1748
+ if (results.length === 0 && basePath === "") {
1749
+ results.push("/");
1750
+ } else {
1751
+ results.push(basePath);
1752
+ }
1753
+ const optionalSegment = segment.replace("?", "");
1754
+ basePath += "/" + optionalSegment;
1755
+ results.push(basePath);
1756
+ } else {
1757
+ basePath += "/" + segment;
1758
+ }
1759
+ }
1760
+ });
1761
+ return results.filter((v, i, a) => a.indexOf(v) === i);
1762
+ };
1763
+ var _decodeURI = (value) => {
1764
+ if (!/[%+]/.test(value)) {
1765
+ return value;
1766
+ }
1767
+ if (value.indexOf("+") !== -1) {
1768
+ value = value.replace(/\+/g, " ");
1769
+ }
1770
+ return /%/.test(value) ? decodeURIComponent_(value) : value;
1771
+ };
1772
+ var _getQueryParam = (url, key, multiple) => {
1773
+ let encoded;
1774
+ if (!multiple && key && !/[%+]/.test(key)) {
1775
+ let keyIndex2 = url.indexOf(`?${key}`, 8);
1776
+ if (keyIndex2 === -1) {
1777
+ keyIndex2 = url.indexOf(`&${key}`, 8);
1778
+ }
1779
+ while (keyIndex2 !== -1) {
1780
+ const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);
1781
+ if (trailingKeyCode === 61) {
1782
+ const valueIndex = keyIndex2 + key.length + 2;
1783
+ const endIndex = url.indexOf("&", valueIndex);
1784
+ return _decodeURI(url.slice(valueIndex, endIndex === -1 ? void 0 : endIndex));
1785
+ } else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) {
1786
+ return "";
1787
+ }
1788
+ keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);
1789
+ }
1790
+ encoded = /[%+]/.test(url);
1791
+ if (!encoded) {
1792
+ return void 0;
1793
+ }
1794
+ }
1795
+ const results = {};
1796
+ encoded ??= /[%+]/.test(url);
1797
+ let keyIndex = url.indexOf("?", 8);
1798
+ while (keyIndex !== -1) {
1799
+ const nextKeyIndex = url.indexOf("&", keyIndex + 1);
1800
+ let valueIndex = url.indexOf("=", keyIndex);
1801
+ if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) {
1802
+ valueIndex = -1;
1803
+ }
1804
+ let name = url.slice(
1805
+ keyIndex + 1,
1806
+ valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex
1807
+ );
1808
+ if (encoded) {
1809
+ name = _decodeURI(name);
1810
+ }
1811
+ keyIndex = nextKeyIndex;
1812
+ if (name === "") {
1813
+ continue;
1814
+ }
1815
+ let value;
1816
+ if (valueIndex === -1) {
1817
+ value = "";
1818
+ } else {
1819
+ value = url.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex);
1820
+ if (encoded) {
1821
+ value = _decodeURI(value);
1822
+ }
1823
+ }
1824
+ if (multiple) {
1825
+ if (!(results[name] && Array.isArray(results[name]))) {
1826
+ results[name] = [];
1827
+ }
1828
+ ;
1829
+ results[name].push(value);
1830
+ } else {
1831
+ results[name] ??= value;
1832
+ }
1833
+ }
1834
+ return key ? results[key] : results;
1835
+ };
1836
+ var getQueryParam = _getQueryParam;
1837
+ var getQueryParams = (url, key) => {
1838
+ return _getQueryParam(url, key, true);
1839
+ };
1840
+ var decodeURIComponent_ = decodeURIComponent;
1841
+
1842
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/request.js
1843
+ var HonoRequest = class {
1844
+ raw;
1845
+ #validatedData;
1846
+ #matchResult;
1847
+ routeIndex = 0;
1848
+ path;
1849
+ bodyCache = {};
1850
+ constructor(request, path = "/", matchResult = [[]]) {
1851
+ this.raw = request;
1852
+ this.path = path;
1853
+ this.#matchResult = matchResult;
1854
+ this.#validatedData = {};
1855
+ }
1856
+ param(key) {
1857
+ return key ? this.getDecodedParam(key) : this.getAllDecodedParams();
1858
+ }
1859
+ getDecodedParam(key) {
1860
+ const paramKey = this.#matchResult[0][this.routeIndex][1][key];
1861
+ const param = this.getParamValue(paramKey);
1862
+ return param ? /\%/.test(param) ? decodeURIComponent_(param) : param : void 0;
1863
+ }
1864
+ getAllDecodedParams() {
1865
+ const decoded = {};
1866
+ const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
1867
+ for (const key of keys) {
1868
+ const value = this.getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
1869
+ if (value && typeof value === "string") {
1870
+ decoded[key] = /\%/.test(value) ? decodeURIComponent_(value) : value;
1871
+ }
1872
+ }
1873
+ return decoded;
1874
+ }
1875
+ getParamValue(paramKey) {
1876
+ return this.#matchResult[1] ? this.#matchResult[1][paramKey] : paramKey;
1877
+ }
1878
+ query(key) {
1879
+ return getQueryParam(this.url, key);
1880
+ }
1881
+ queries(key) {
1882
+ return getQueryParams(this.url, key);
1883
+ }
1884
+ header(name) {
1885
+ if (name) {
1886
+ return this.raw.headers.get(name.toLowerCase()) ?? void 0;
1887
+ }
1888
+ const headerData = {};
1889
+ this.raw.headers.forEach((value, key) => {
1890
+ headerData[key] = value;
1891
+ });
1892
+ return headerData;
1893
+ }
1894
+ async parseBody(options) {
1895
+ return this.bodyCache.parsedBody ??= await parseBody(this, options);
1896
+ }
1897
+ cachedBody = (key) => {
1898
+ const { bodyCache, raw: raw2 } = this;
1899
+ const cachedBody = bodyCache[key];
1900
+ if (cachedBody) {
1901
+ return cachedBody;
1902
+ }
1903
+ const anyCachedKey = Object.keys(bodyCache)[0];
1904
+ if (anyCachedKey) {
1905
+ return bodyCache[anyCachedKey].then((body) => {
1906
+ if (anyCachedKey === "json") {
1907
+ body = JSON.stringify(body);
1908
+ }
1909
+ return new Response(body)[key]();
1910
+ });
1911
+ }
1912
+ return bodyCache[key] = raw2[key]();
1913
+ };
1914
+ json() {
1915
+ return this.cachedBody("json");
1916
+ }
1917
+ text() {
1918
+ return this.cachedBody("text");
1919
+ }
1920
+ arrayBuffer() {
1921
+ return this.cachedBody("arrayBuffer");
1922
+ }
1923
+ blob() {
1924
+ return this.cachedBody("blob");
1925
+ }
1926
+ formData() {
1927
+ return this.cachedBody("formData");
1928
+ }
1929
+ addValidatedData(target, data) {
1930
+ this.#validatedData[target] = data;
1931
+ }
1932
+ valid(target) {
1933
+ return this.#validatedData[target];
1934
+ }
1935
+ get url() {
1936
+ return this.raw.url;
1937
+ }
1938
+ get method() {
1939
+ return this.raw.method;
1940
+ }
1941
+ get matchedRoutes() {
1942
+ return this.#matchResult[0].map(([[, route]]) => route);
1943
+ }
1944
+ get routePath() {
1945
+ return this.#matchResult[0].map(([[, route]]) => route)[this.routeIndex].path;
1946
+ }
1947
+ };
1948
+
1949
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/html.js
1950
+ var HtmlEscapedCallbackPhase = {
1951
+ Stringify: 1,
1952
+ BeforeStream: 2,
1953
+ Stream: 3
1954
+ };
1955
+ var raw = (value, callbacks) => {
1956
+ const escapedString = new String(value);
1957
+ escapedString.isEscaped = true;
1958
+ escapedString.callbacks = callbacks;
1959
+ return escapedString;
1960
+ };
1961
+ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
1962
+ if (typeof str === "object" && !(str instanceof String)) {
1963
+ if (!(str instanceof Promise)) {
1964
+ str = str.toString();
1965
+ }
1966
+ if (str instanceof Promise) {
1967
+ str = await str;
1968
+ }
1969
+ }
1970
+ const callbacks = str.callbacks;
1971
+ if (!callbacks?.length) {
1972
+ return Promise.resolve(str);
1973
+ }
1974
+ if (buffer) {
1975
+ buffer[0] += str;
1976
+ } else {
1977
+ buffer = [str];
1978
+ }
1979
+ const resStr = Promise.all(callbacks.map((c) => c({ phase, buffer, context }))).then(
1980
+ (res) => Promise.all(
1981
+ res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context, buffer))
1982
+ ).then(() => buffer[0])
1983
+ );
1984
+ if (preserveCallbacks) {
1985
+ return raw(await resStr, callbacks);
1986
+ } else {
1987
+ return resStr;
1988
+ }
1989
+ };
1990
+
1991
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/context.js
1992
+ var TEXT_PLAIN = "text/plain; charset=UTF-8";
1993
+ var setHeaders = (headers, map = {}) => {
1994
+ Object.entries(map).forEach(([key, value]) => headers.set(key, value));
1995
+ return headers;
1996
+ };
1997
+ var Context = class {
1998
+ #rawRequest;
1999
+ #req;
2000
+ env = {};
2001
+ #var;
2002
+ finalized = false;
2003
+ error;
2004
+ #status = 200;
2005
+ #executionCtx;
2006
+ #headers;
2007
+ #preparedHeaders;
2008
+ #res;
2009
+ #isFresh = true;
2010
+ #layout;
2011
+ #renderer;
2012
+ #notFoundHandler;
2013
+ #matchResult;
2014
+ #path;
2015
+ constructor(req, options) {
2016
+ this.#rawRequest = req;
2017
+ if (options) {
2018
+ this.#executionCtx = options.executionCtx;
2019
+ this.env = options.env;
2020
+ this.#notFoundHandler = options.notFoundHandler;
2021
+ this.#path = options.path;
2022
+ this.#matchResult = options.matchResult;
2023
+ }
2024
+ }
2025
+ get req() {
2026
+ this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult);
2027
+ return this.#req;
2028
+ }
2029
+ get event() {
2030
+ if (this.#executionCtx && "respondWith" in this.#executionCtx) {
2031
+ return this.#executionCtx;
2032
+ } else {
2033
+ throw Error("This context has no FetchEvent");
2034
+ }
2035
+ }
2036
+ get executionCtx() {
2037
+ if (this.#executionCtx) {
2038
+ return this.#executionCtx;
2039
+ } else {
2040
+ throw Error("This context has no ExecutionContext");
2041
+ }
2042
+ }
2043
+ get res() {
2044
+ this.#isFresh = false;
2045
+ return this.#res ||= new Response("404 Not Found", { status: 404 });
2046
+ }
2047
+ set res(_res) {
2048
+ this.#isFresh = false;
2049
+ if (this.#res && _res) {
2050
+ try {
2051
+ for (const [k, v] of this.#res.headers.entries()) {
2052
+ if (k === "content-type") {
2053
+ continue;
2054
+ }
2055
+ if (k === "set-cookie") {
2056
+ const cookies = this.#res.headers.getSetCookie();
2057
+ _res.headers.delete("set-cookie");
2058
+ for (const cookie of cookies) {
2059
+ _res.headers.append("set-cookie", cookie);
2060
+ }
2061
+ } else {
2062
+ _res.headers.set(k, v);
2063
+ }
2064
+ }
2065
+ } catch (e) {
2066
+ if (e instanceof TypeError && e.message.includes("immutable")) {
2067
+ this.res = new Response(_res.body, {
2068
+ headers: _res.headers,
2069
+ status: _res.status
2070
+ });
2071
+ return;
2072
+ } else {
2073
+ throw e;
2074
+ }
2075
+ }
2076
+ }
2077
+ this.#res = _res;
2078
+ this.finalized = true;
2079
+ }
2080
+ render = (...args) => {
2081
+ this.#renderer ??= (content) => this.html(content);
2082
+ return this.#renderer(...args);
2083
+ };
2084
+ setLayout = (layout) => this.#layout = layout;
2085
+ getLayout = () => this.#layout;
2086
+ setRenderer = (renderer) => {
2087
+ this.#renderer = renderer;
2088
+ };
2089
+ header = (name, value, options) => {
2090
+ if (value === void 0) {
2091
+ if (this.#headers) {
2092
+ this.#headers.delete(name);
2093
+ } else if (this.#preparedHeaders) {
2094
+ delete this.#preparedHeaders[name.toLocaleLowerCase()];
2095
+ }
2096
+ if (this.finalized) {
2097
+ this.res.headers.delete(name);
2098
+ }
2099
+ return;
2100
+ }
2101
+ if (options?.append) {
2102
+ if (!this.#headers) {
2103
+ this.#isFresh = false;
2104
+ this.#headers = new Headers(this.#preparedHeaders);
2105
+ this.#preparedHeaders = {};
2106
+ }
2107
+ this.#headers.append(name, value);
2108
+ } else {
2109
+ if (this.#headers) {
2110
+ this.#headers.set(name, value);
2111
+ } else {
2112
+ this.#preparedHeaders ??= {};
2113
+ this.#preparedHeaders[name.toLowerCase()] = value;
2114
+ }
2115
+ }
2116
+ if (this.finalized) {
2117
+ if (options?.append) {
2118
+ this.res.headers.append(name, value);
2119
+ } else {
2120
+ this.res.headers.set(name, value);
2121
+ }
2122
+ }
2123
+ };
2124
+ status = (status) => {
2125
+ this.#isFresh = false;
2126
+ this.#status = status;
2127
+ };
2128
+ set = (key, value) => {
2129
+ this.#var ??= /* @__PURE__ */ new Map();
2130
+ this.#var.set(key, value);
2131
+ };
2132
+ get = (key) => {
2133
+ return this.#var ? this.#var.get(key) : void 0;
2134
+ };
2135
+ get var() {
2136
+ if (!this.#var) {
2137
+ return {};
2138
+ }
2139
+ return Object.fromEntries(this.#var);
2140
+ }
2141
+ newResponse = (data, arg, headers) => {
2142
+ if (this.#isFresh && !headers && !arg && this.#status === 200) {
2143
+ return new Response(data, {
2144
+ headers: this.#preparedHeaders
2145
+ });
2146
+ }
2147
+ if (arg && typeof arg !== "number") {
2148
+ const header = new Headers(arg.headers);
2149
+ if (this.#headers) {
2150
+ this.#headers.forEach((v, k) => {
2151
+ if (k === "set-cookie") {
2152
+ header.append(k, v);
2153
+ } else {
2154
+ header.set(k, v);
2155
+ }
2156
+ });
2157
+ }
2158
+ const headers2 = setHeaders(header, this.#preparedHeaders);
2159
+ return new Response(data, {
2160
+ headers: headers2,
2161
+ status: arg.status ?? this.#status
2162
+ });
2163
+ }
2164
+ const status = typeof arg === "number" ? arg : this.#status;
2165
+ this.#preparedHeaders ??= {};
2166
+ this.#headers ??= new Headers();
2167
+ setHeaders(this.#headers, this.#preparedHeaders);
2168
+ if (this.#res) {
2169
+ this.#res.headers.forEach((v, k) => {
2170
+ if (k === "set-cookie") {
2171
+ this.#headers?.append(k, v);
2172
+ } else {
2173
+ this.#headers?.set(k, v);
2174
+ }
2175
+ });
2176
+ setHeaders(this.#headers, this.#preparedHeaders);
2177
+ }
2178
+ headers ??= {};
2179
+ for (const [k, v] of Object.entries(headers)) {
2180
+ if (typeof v === "string") {
2181
+ this.#headers.set(k, v);
2182
+ } else {
2183
+ this.#headers.delete(k);
2184
+ for (const v2 of v) {
2185
+ this.#headers.append(k, v2);
2186
+ }
2187
+ }
2188
+ }
2189
+ return new Response(data, {
2190
+ status,
2191
+ headers: this.#headers
2192
+ });
2193
+ };
2194
+ body = (data, arg, headers) => {
2195
+ return typeof arg === "number" ? this.newResponse(data, arg, headers) : this.newResponse(data, arg);
2196
+ };
2197
+ text = (text, arg, headers) => {
2198
+ if (!this.#preparedHeaders) {
2199
+ if (this.#isFresh && !headers && !arg) {
2200
+ return new Response(text);
2201
+ }
2202
+ this.#preparedHeaders = {};
2203
+ }
2204
+ this.#preparedHeaders["content-type"] = TEXT_PLAIN;
2205
+ return typeof arg === "number" ? this.newResponse(text, arg, headers) : this.newResponse(text, arg);
2206
+ };
2207
+ json = (object, arg, headers) => {
2208
+ const body = JSON.stringify(object);
2209
+ this.#preparedHeaders ??= {};
2210
+ this.#preparedHeaders["content-type"] = "application/json; charset=UTF-8";
2211
+ return typeof arg === "number" ? this.newResponse(body, arg, headers) : this.newResponse(body, arg);
2212
+ };
2213
+ html = (html, arg, headers) => {
2214
+ this.#preparedHeaders ??= {};
2215
+ this.#preparedHeaders["content-type"] = "text/html; charset=UTF-8";
2216
+ if (typeof html === "object") {
2217
+ return resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then((html2) => {
2218
+ return typeof arg === "number" ? this.newResponse(html2, arg, headers) : this.newResponse(html2, arg);
2219
+ });
2220
+ }
2221
+ return typeof arg === "number" ? this.newResponse(html, arg, headers) : this.newResponse(html, arg);
2222
+ };
2223
+ redirect = (location, status) => {
2224
+ this.#headers ??= new Headers();
2225
+ this.#headers.set("Location", location);
2226
+ return this.newResponse(null, status ?? 302);
2227
+ };
2228
+ notFound = () => {
2229
+ this.#notFoundHandler ??= () => new Response();
2230
+ return this.#notFoundHandler(this);
2231
+ };
2232
+ };
2233
+
2234
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/compose.js
2235
+ var compose = (middleware, onError, onNotFound) => {
2236
+ return (context, next) => {
2237
+ let index = -1;
2238
+ return dispatch(0);
2239
+ async function dispatch(i) {
2240
+ if (i <= index) {
2241
+ throw new Error("next() called multiple times");
2242
+ }
2243
+ index = i;
2244
+ let res;
2245
+ let isError = false;
2246
+ let handler2;
2247
+ if (middleware[i]) {
2248
+ handler2 = middleware[i][0][0];
2249
+ if (context instanceof Context) {
2250
+ context.req.routeIndex = i;
2251
+ }
2252
+ } else {
2253
+ handler2 = i === middleware.length && next || void 0;
2254
+ }
2255
+ if (!handler2) {
2256
+ if (context instanceof Context && context.finalized === false && onNotFound) {
2257
+ res = await onNotFound(context);
2258
+ }
2259
+ } else {
2260
+ try {
2261
+ res = await handler2(context, () => {
2262
+ return dispatch(i + 1);
2263
+ });
2264
+ } catch (err) {
2265
+ if (err instanceof Error && context instanceof Context && onError) {
2266
+ context.error = err;
2267
+ res = await onError(err, context);
2268
+ isError = true;
2269
+ } else {
2270
+ throw err;
2271
+ }
2272
+ }
2273
+ }
2274
+ if (res && (context.finalized === false || isError)) {
2275
+ context.res = res;
2276
+ }
2277
+ return context;
2278
+ }
2279
+ };
2280
+ };
2281
+
2282
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router.js
2283
+ var METHOD_NAME_ALL = "ALL";
2284
+ var METHOD_NAME_ALL_LOWERCASE = "all";
2285
+ var METHODS = ["get", "post", "put", "delete", "options", "patch"];
2286
+ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
2287
+ var UnsupportedPathError = class extends Error {
2288
+ };
2289
+
2290
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/hono-base.js
2291
+ var COMPOSED_HANDLER = Symbol("composedHandler");
2292
+ var notFoundHandler = (c) => {
2293
+ return c.text("404 Not Found", 404);
2294
+ };
2295
+ var errorHandler = (err, c) => {
2296
+ if ("getResponse" in err) {
2297
+ return err.getResponse();
2298
+ }
2299
+ console.error(err);
2300
+ return c.text("Internal Server Error", 500);
2301
+ };
2302
+ var Hono = class {
2303
+ get;
2304
+ post;
2305
+ put;
2306
+ delete;
2307
+ options;
2308
+ patch;
2309
+ all;
2310
+ on;
2311
+ use;
2312
+ router;
2313
+ getPath;
2314
+ _basePath = "/";
2315
+ #path = "/";
2316
+ routes = [];
2317
+ constructor(options = {}) {
2318
+ const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];
2319
+ allMethods.forEach((method) => {
2320
+ this[method] = (args1, ...args) => {
2321
+ if (typeof args1 === "string") {
2322
+ this.#path = args1;
2323
+ } else {
2324
+ this.addRoute(method, this.#path, args1);
2325
+ }
2326
+ args.forEach((handler2) => {
2327
+ if (typeof handler2 !== "string") {
2328
+ this.addRoute(method, this.#path, handler2);
2329
+ }
2330
+ });
2331
+ return this;
2332
+ };
2333
+ });
2334
+ this.on = (method, path, ...handlers) => {
2335
+ for (const p of [path].flat()) {
2336
+ this.#path = p;
2337
+ for (const m of [method].flat()) {
2338
+ handlers.map((handler2) => {
2339
+ this.addRoute(m.toUpperCase(), this.#path, handler2);
2340
+ });
2341
+ }
2342
+ }
2343
+ return this;
2344
+ };
2345
+ this.use = (arg1, ...handlers) => {
2346
+ if (typeof arg1 === "string") {
2347
+ this.#path = arg1;
2348
+ } else {
2349
+ this.#path = "*";
2350
+ handlers.unshift(arg1);
2351
+ }
2352
+ handlers.forEach((handler2) => {
2353
+ this.addRoute(METHOD_NAME_ALL, this.#path, handler2);
2354
+ });
2355
+ return this;
2356
+ };
2357
+ const strict = options.strict ?? true;
2358
+ delete options.strict;
2359
+ Object.assign(this, options);
2360
+ this.getPath = strict ? options.getPath ?? getPath : getPathNoStrict;
2361
+ }
2362
+ clone() {
2363
+ const clone = new Hono({
2364
+ router: this.router,
2365
+ getPath: this.getPath
2366
+ });
2367
+ clone.routes = this.routes;
2368
+ return clone;
2369
+ }
2370
+ notFoundHandler = notFoundHandler;
2371
+ errorHandler = errorHandler;
2372
+ route(path, app2) {
2373
+ const subApp = this.basePath(path);
2374
+ app2.routes.map((r) => {
2375
+ let handler2;
2376
+ if (app2.errorHandler === errorHandler) {
2377
+ handler2 = r.handler;
2378
+ } else {
2379
+ handler2 = async (c, next) => (await compose([], app2.errorHandler)(c, () => r.handler(c, next))).res;
2380
+ handler2[COMPOSED_HANDLER] = r.handler;
2381
+ }
2382
+ subApp.addRoute(r.method, r.path, handler2);
2383
+ });
2384
+ return this;
2385
+ }
2386
+ basePath(path) {
2387
+ const subApp = this.clone();
2388
+ subApp._basePath = mergePath(this._basePath, path);
2389
+ return subApp;
2390
+ }
2391
+ onError = (handler2) => {
2392
+ this.errorHandler = handler2;
2393
+ return this;
2394
+ };
2395
+ notFound = (handler2) => {
2396
+ this.notFoundHandler = handler2;
2397
+ return this;
2398
+ };
2399
+ mount(path, applicationHandler, options) {
2400
+ let replaceRequest;
2401
+ let optionHandler;
2402
+ if (options) {
2403
+ if (typeof options === "function") {
2404
+ optionHandler = options;
2405
+ } else {
2406
+ optionHandler = options.optionHandler;
2407
+ replaceRequest = options.replaceRequest;
2408
+ }
2409
+ }
2410
+ const getOptions = optionHandler ? (c) => {
2411
+ const options2 = optionHandler(c);
2412
+ return Array.isArray(options2) ? options2 : [options2];
2413
+ } : (c) => {
2414
+ let executionContext = void 0;
2415
+ try {
2416
+ executionContext = c.executionCtx;
2417
+ } catch {
2418
+ }
2419
+ return [c.env, executionContext];
2420
+ };
2421
+ replaceRequest ||= (() => {
2422
+ const mergedPath = mergePath(this._basePath, path);
2423
+ const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
2424
+ return (request) => {
2425
+ const url = new URL(request.url);
2426
+ url.pathname = url.pathname.slice(pathPrefixLength) || "/";
2427
+ return new Request(url, request);
2428
+ };
2429
+ })();
2430
+ const handler2 = async (c, next) => {
2431
+ const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c));
2432
+ if (res) {
2433
+ return res;
2434
+ }
2435
+ await next();
2436
+ };
2437
+ this.addRoute(METHOD_NAME_ALL, mergePath(path, "*"), handler2);
2438
+ return this;
2439
+ }
2440
+ addRoute(method, path, handler2) {
2441
+ method = method.toUpperCase();
2442
+ path = mergePath(this._basePath, path);
2443
+ const r = { path, method, handler: handler2 };
2444
+ this.router.add(method, path, [handler2, r]);
2445
+ this.routes.push(r);
2446
+ }
2447
+ matchRoute(method, path) {
2448
+ return this.router.match(method, path);
2449
+ }
2450
+ handleError(err, c) {
2451
+ if (err instanceof Error) {
2452
+ return this.errorHandler(err, c);
2453
+ }
2454
+ throw err;
2455
+ }
2456
+ dispatch(request, executionCtx, env, method) {
2457
+ if (method === "HEAD") {
2458
+ return (async () => new Response(null, await this.dispatch(request, executionCtx, env, "GET")))();
2459
+ }
2460
+ const path = this.getPath(request, { env });
2461
+ const matchResult = this.matchRoute(method, path);
2462
+ const c = new Context(request, {
2463
+ path,
2464
+ matchResult,
2465
+ env,
2466
+ executionCtx,
2467
+ notFoundHandler: this.notFoundHandler
2468
+ });
2469
+ if (matchResult[0].length === 1) {
2470
+ let res;
2471
+ try {
2472
+ res = matchResult[0][0][0][0](c, async () => {
2473
+ c.res = await this.notFoundHandler(c);
2474
+ });
2475
+ } catch (err) {
2476
+ return this.handleError(err, c);
2477
+ }
2478
+ return res instanceof Promise ? res.then(
2479
+ (resolved) => resolved || (c.finalized ? c.res : this.notFoundHandler(c))
2480
+ ).catch((err) => this.handleError(err, c)) : res ?? this.notFoundHandler(c);
2481
+ }
2482
+ const composed = compose(matchResult[0], this.errorHandler, this.notFoundHandler);
2483
+ return (async () => {
2484
+ try {
2485
+ const context = await composed(c);
2486
+ if (!context.finalized) {
2487
+ throw new Error(
2488
+ "Context is not finalized. Did you forget to return a Response object or `await next()`?"
2489
+ );
2490
+ }
2491
+ return context.res;
2492
+ } catch (err) {
2493
+ return this.handleError(err, c);
2494
+ }
2495
+ })();
2496
+ }
2497
+ fetch = (request, ...rest) => {
2498
+ return this.dispatch(request, rest[1], rest[0], request.method);
2499
+ };
2500
+ request = (input, requestInit, Env, executionCtx) => {
2501
+ if (input instanceof Request) {
2502
+ if (requestInit !== void 0) {
2503
+ input = new Request(input, requestInit);
2504
+ }
2505
+ return this.fetch(input, Env, executionCtx);
2506
+ }
2507
+ input = input.toString();
2508
+ const path = /^https?:\/\//.test(input) ? input : `http://localhost${mergePath("/", input)}`;
2509
+ const req = new Request(path, requestInit);
2510
+ return this.fetch(req, Env, executionCtx);
2511
+ };
2512
+ fire = () => {
2513
+ addEventListener("fetch", (event) => {
2514
+ event.respondWith(this.dispatch(event.request, event, void 0, event.request.method));
2515
+ });
2516
+ };
2517
+ };
2518
+
2519
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/reg-exp-router/node.js
2520
+ var LABEL_REG_EXP_STR = "[^/]+";
2521
+ var ONLY_WILDCARD_REG_EXP_STR = ".*";
2522
+ var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
2523
+ var PATH_ERROR = Symbol();
2524
+ var regExpMetaChars = new Set(".\\+*[^]$()");
2525
+ function compareKey(a, b) {
2526
+ if (a.length === 1) {
2527
+ return b.length === 1 ? a < b ? -1 : 1 : -1;
2528
+ }
2529
+ if (b.length === 1) {
2530
+ return 1;
2531
+ }
2532
+ if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) {
2533
+ return 1;
2534
+ } else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) {
2535
+ return -1;
2536
+ }
2537
+ if (a === LABEL_REG_EXP_STR) {
2538
+ return 1;
2539
+ } else if (b === LABEL_REG_EXP_STR) {
2540
+ return -1;
2541
+ }
2542
+ return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;
2543
+ }
2544
+ var Node = class {
2545
+ index;
2546
+ varIndex;
2547
+ children = /* @__PURE__ */ Object.create(null);
2548
+ insert(tokens, index, paramMap, context, pathErrorCheckOnly) {
2549
+ if (tokens.length === 0) {
2550
+ if (this.index !== void 0) {
2551
+ throw PATH_ERROR;
2552
+ }
2553
+ if (pathErrorCheckOnly) {
2554
+ return;
2555
+ }
2556
+ this.index = index;
2557
+ return;
2558
+ }
2559
+ const [token, ...restTokens] = tokens;
2560
+ const pattern = token === "*" ? restTokens.length === 0 ? ["", "", ONLY_WILDCARD_REG_EXP_STR] : ["", "", LABEL_REG_EXP_STR] : token === "/*" ? ["", "", TAIL_WILDCARD_REG_EXP_STR] : token.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
2561
+ let node;
2562
+ if (pattern) {
2563
+ const name = pattern[1];
2564
+ let regexpStr = pattern[2] || LABEL_REG_EXP_STR;
2565
+ if (name && pattern[2]) {
2566
+ regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
2567
+ if (/\((?!\?:)/.test(regexpStr)) {
2568
+ throw PATH_ERROR;
2569
+ }
2570
+ }
2571
+ node = this.children[regexpStr];
2572
+ if (!node) {
2573
+ if (Object.keys(this.children).some(
2574
+ (k) => k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR
2575
+ )) {
2576
+ throw PATH_ERROR;
2577
+ }
2578
+ if (pathErrorCheckOnly) {
2579
+ return;
2580
+ }
2581
+ node = this.children[regexpStr] = new Node();
2582
+ if (name !== "") {
2583
+ node.varIndex = context.varIndex++;
2584
+ }
2585
+ }
2586
+ if (!pathErrorCheckOnly && name !== "") {
2587
+ paramMap.push([name, node.varIndex]);
2588
+ }
2589
+ } else {
2590
+ node = this.children[token];
2591
+ if (!node) {
2592
+ if (Object.keys(this.children).some(
2593
+ (k) => k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR
2594
+ )) {
2595
+ throw PATH_ERROR;
2596
+ }
2597
+ if (pathErrorCheckOnly) {
2598
+ return;
2599
+ }
2600
+ node = this.children[token] = new Node();
2601
+ }
2602
+ }
2603
+ node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);
2604
+ }
2605
+ buildRegExpStr() {
2606
+ const childKeys = Object.keys(this.children).sort(compareKey);
2607
+ const strList = childKeys.map((k) => {
2608
+ const c = this.children[k];
2609
+ return (typeof c.varIndex === "number" ? `(${k})@${c.varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + c.buildRegExpStr();
2610
+ });
2611
+ if (typeof this.index === "number") {
2612
+ strList.unshift(`#${this.index}`);
2613
+ }
2614
+ if (strList.length === 0) {
2615
+ return "";
2616
+ }
2617
+ if (strList.length === 1) {
2618
+ return strList[0];
2619
+ }
2620
+ return "(?:" + strList.join("|") + ")";
2621
+ }
2622
+ };
2623
+
2624
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/reg-exp-router/trie.js
2625
+ var Trie = class {
2626
+ context = { varIndex: 0 };
2627
+ root = new Node();
2628
+ insert(path, index, pathErrorCheckOnly) {
2629
+ const paramAssoc = [];
2630
+ const groups = [];
2631
+ for (let i = 0; ; ) {
2632
+ let replaced = false;
2633
+ path = path.replace(/\{[^}]+\}/g, (m) => {
2634
+ const mark = `@\\${i}`;
2635
+ groups[i] = [mark, m];
2636
+ i++;
2637
+ replaced = true;
2638
+ return mark;
2639
+ });
2640
+ if (!replaced) {
2641
+ break;
2642
+ }
2643
+ }
2644
+ const tokens = path.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
2645
+ for (let i = groups.length - 1; i >= 0; i--) {
2646
+ const [mark] = groups[i];
2647
+ for (let j = tokens.length - 1; j >= 0; j--) {
2648
+ if (tokens[j].indexOf(mark) !== -1) {
2649
+ tokens[j] = tokens[j].replace(mark, groups[i][1]);
2650
+ break;
2651
+ }
2652
+ }
2653
+ }
2654
+ this.root.insert(tokens, index, paramAssoc, this.context, pathErrorCheckOnly);
2655
+ return paramAssoc;
2656
+ }
2657
+ buildRegExp() {
2658
+ let regexp = this.root.buildRegExpStr();
2659
+ if (regexp === "") {
2660
+ return [/^$/, [], []];
2661
+ }
2662
+ let captureIndex = 0;
2663
+ const indexReplacementMap = [];
2664
+ const paramReplacementMap = [];
2665
+ regexp = regexp.replace(/#(\d+)|@(\d+)|\.\*\$/g, (_, handlerIndex, paramIndex) => {
2666
+ if (typeof handlerIndex !== "undefined") {
2667
+ indexReplacementMap[++captureIndex] = Number(handlerIndex);
2668
+ return "$()";
2669
+ }
2670
+ if (typeof paramIndex !== "undefined") {
2671
+ paramReplacementMap[Number(paramIndex)] = ++captureIndex;
2672
+ return "";
2673
+ }
2674
+ return "";
2675
+ });
2676
+ return [new RegExp(`^${regexp}`), indexReplacementMap, paramReplacementMap];
2677
+ }
2678
+ };
2679
+
2680
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/reg-exp-router/router.js
2681
+ var emptyParam = [];
2682
+ var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
2683
+ var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
2684
+ function buildWildcardRegExp(path) {
2685
+ return wildcardRegExpCache[path] ??= new RegExp(
2686
+ path === "*" ? "" : `^${path.replace(
2687
+ /\/\*$|([.\\+*[^\]$()])/g,
2688
+ (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
2689
+ )}$`
2690
+ );
2691
+ }
2692
+ function clearWildcardRegExpCache() {
2693
+ wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
2694
+ }
2695
+ function buildMatcherFromPreprocessedRoutes(routes) {
2696
+ const trie = new Trie();
2697
+ const handlerData = [];
2698
+ if (routes.length === 0) {
2699
+ return nullMatcher;
2700
+ }
2701
+ const routesWithStaticPathFlag = routes.map(
2702
+ (route) => [!/\*|\/:/.test(route[0]), ...route]
2703
+ ).sort(
2704
+ ([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length
2705
+ );
2706
+ const staticMap = /* @__PURE__ */ Object.create(null);
2707
+ for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
2708
+ const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];
2709
+ if (pathErrorCheckOnly) {
2710
+ staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
2711
+ } else {
2712
+ j++;
2713
+ }
2714
+ let paramAssoc;
2715
+ try {
2716
+ paramAssoc = trie.insert(path, j, pathErrorCheckOnly);
2717
+ } catch (e) {
2718
+ throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;
2719
+ }
2720
+ if (pathErrorCheckOnly) {
2721
+ continue;
2722
+ }
2723
+ handlerData[j] = handlers.map(([h, paramCount]) => {
2724
+ const paramIndexMap = /* @__PURE__ */ Object.create(null);
2725
+ paramCount -= 1;
2726
+ for (; paramCount >= 0; paramCount--) {
2727
+ const [key, value] = paramAssoc[paramCount];
2728
+ paramIndexMap[key] = value;
2729
+ }
2730
+ return [h, paramIndexMap];
2731
+ });
2732
+ }
2733
+ const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
2734
+ for (let i = 0, len = handlerData.length; i < len; i++) {
2735
+ for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
2736
+ const map = handlerData[i][j]?.[1];
2737
+ if (!map) {
2738
+ continue;
2739
+ }
2740
+ const keys = Object.keys(map);
2741
+ for (let k = 0, len3 = keys.length; k < len3; k++) {
2742
+ map[keys[k]] = paramReplacementMap[map[keys[k]]];
2743
+ }
2744
+ }
2745
+ }
2746
+ const handlerMap = [];
2747
+ for (const i in indexReplacementMap) {
2748
+ handlerMap[i] = handlerData[indexReplacementMap[i]];
2749
+ }
2750
+ return [regexp, handlerMap, staticMap];
2751
+ }
2752
+ function findMiddleware(middleware, path) {
2753
+ if (!middleware) {
2754
+ return void 0;
2755
+ }
2756
+ for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
2757
+ if (buildWildcardRegExp(k).test(path)) {
2758
+ return [...middleware[k]];
2759
+ }
2760
+ }
2761
+ return void 0;
2762
+ }
2763
+ var RegExpRouter = class {
2764
+ name = "RegExpRouter";
2765
+ middleware;
2766
+ routes;
2767
+ constructor() {
2768
+ this.middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
2769
+ this.routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
2770
+ }
2771
+ add(method, path, handler2) {
2772
+ const { middleware, routes } = this;
2773
+ if (!middleware || !routes) {
2774
+ throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
2775
+ }
2776
+ if (!middleware[method]) {
2777
+ ;
2778
+ [middleware, routes].forEach((handlerMap) => {
2779
+ handlerMap[method] = /* @__PURE__ */ Object.create(null);
2780
+ Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => {
2781
+ handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];
2782
+ });
2783
+ });
2784
+ }
2785
+ if (path === "/*") {
2786
+ path = "*";
2787
+ }
2788
+ const paramCount = (path.match(/\/:/g) || []).length;
2789
+ if (/\*$/.test(path)) {
2790
+ const re = buildWildcardRegExp(path);
2791
+ if (method === METHOD_NAME_ALL) {
2792
+ Object.keys(middleware).forEach((m) => {
2793
+ middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
2794
+ });
2795
+ } else {
2796
+ middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
2797
+ }
2798
+ Object.keys(middleware).forEach((m) => {
2799
+ if (method === METHOD_NAME_ALL || method === m) {
2800
+ Object.keys(middleware[m]).forEach((p) => {
2801
+ re.test(p) && middleware[m][p].push([handler2, paramCount]);
2802
+ });
2803
+ }
2804
+ });
2805
+ Object.keys(routes).forEach((m) => {
2806
+ if (method === METHOD_NAME_ALL || method === m) {
2807
+ Object.keys(routes[m]).forEach(
2808
+ (p) => re.test(p) && routes[m][p].push([handler2, paramCount])
2809
+ );
2810
+ }
2811
+ });
2812
+ return;
2813
+ }
2814
+ const paths = checkOptionalParameter(path) || [path];
2815
+ for (let i = 0, len = paths.length; i < len; i++) {
2816
+ const path2 = paths[i];
2817
+ Object.keys(routes).forEach((m) => {
2818
+ if (method === METHOD_NAME_ALL || method === m) {
2819
+ routes[m][path2] ||= [
2820
+ ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
2821
+ ];
2822
+ routes[m][path2].push([handler2, paramCount - len + i + 1]);
2823
+ }
2824
+ });
2825
+ }
2826
+ }
2827
+ match(method, path) {
2828
+ clearWildcardRegExpCache();
2829
+ const matchers = this.buildAllMatchers();
2830
+ this.match = (method2, path2) => {
2831
+ const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
2832
+ const staticMatch = matcher[2][path2];
2833
+ if (staticMatch) {
2834
+ return staticMatch;
2835
+ }
2836
+ const match = path2.match(matcher[0]);
2837
+ if (!match) {
2838
+ return [[], emptyParam];
2839
+ }
2840
+ const index = match.indexOf("", 1);
2841
+ return [matcher[1][index], match];
2842
+ };
2843
+ return this.match(method, path);
2844
+ }
2845
+ buildAllMatchers() {
2846
+ const matchers = /* @__PURE__ */ Object.create(null);
2847
+ [...Object.keys(this.routes), ...Object.keys(this.middleware)].forEach((method) => {
2848
+ matchers[method] ||= this.buildMatcher(method);
2849
+ });
2850
+ this.middleware = this.routes = void 0;
2851
+ return matchers;
2852
+ }
2853
+ buildMatcher(method) {
2854
+ const routes = [];
2855
+ let hasOwnRoute = method === METHOD_NAME_ALL;
2856
+ [this.middleware, this.routes].forEach((r) => {
2857
+ const ownRoute = r[method] ? Object.keys(r[method]).map((path) => [path, r[method][path]]) : [];
2858
+ if (ownRoute.length !== 0) {
2859
+ hasOwnRoute ||= true;
2860
+ routes.push(...ownRoute);
2861
+ } else if (method !== METHOD_NAME_ALL) {
2862
+ routes.push(
2863
+ ...Object.keys(r[METHOD_NAME_ALL]).map((path) => [path, r[METHOD_NAME_ALL][path]])
2864
+ );
2865
+ }
2866
+ });
2867
+ if (!hasOwnRoute) {
2868
+ return null;
2869
+ } else {
2870
+ return buildMatcherFromPreprocessedRoutes(routes);
2871
+ }
2872
+ }
2873
+ };
2874
+
2875
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/smart-router/router.js
2876
+ var SmartRouter = class {
2877
+ name = "SmartRouter";
2878
+ routers = [];
2879
+ routes = [];
2880
+ constructor(init) {
2881
+ Object.assign(this, init);
2882
+ }
2883
+ add(method, path, handler2) {
2884
+ if (!this.routes) {
2885
+ throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
2886
+ }
2887
+ this.routes.push([method, path, handler2]);
2888
+ }
2889
+ match(method, path) {
2890
+ if (!this.routes) {
2891
+ throw new Error("Fatal error");
2892
+ }
2893
+ const { routers, routes } = this;
2894
+ const len = routers.length;
2895
+ let i = 0;
2896
+ let res;
2897
+ for (; i < len; i++) {
2898
+ const router = routers[i];
2899
+ try {
2900
+ routes.forEach((args) => {
2901
+ router.add(...args);
2902
+ });
2903
+ res = router.match(method, path);
2904
+ } catch (e) {
2905
+ if (e instanceof UnsupportedPathError) {
2906
+ continue;
2907
+ }
2908
+ throw e;
2909
+ }
2910
+ this.match = router.match.bind(router);
2911
+ this.routers = [router];
2912
+ this.routes = void 0;
2913
+ break;
2914
+ }
2915
+ if (i === len) {
2916
+ throw new Error("Fatal error");
2917
+ }
2918
+ this.name = `SmartRouter + ${this.activeRouter.name}`;
2919
+ return res;
2920
+ }
2921
+ get activeRouter() {
2922
+ if (this.routes || this.routers.length !== 1) {
2923
+ throw new Error("No active router has been determined yet.");
2924
+ }
2925
+ return this.routers[0];
2926
+ }
2927
+ };
2928
+
2929
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/trie-router/node.js
2930
+ var Node2 = class {
2931
+ methods;
2932
+ children;
2933
+ patterns;
2934
+ order = 0;
2935
+ name;
2936
+ params = /* @__PURE__ */ Object.create(null);
2937
+ constructor(method, handler2, children) {
2938
+ this.children = children || /* @__PURE__ */ Object.create(null);
2939
+ this.methods = [];
2940
+ this.name = "";
2941
+ if (method && handler2) {
2942
+ const m = /* @__PURE__ */ Object.create(null);
2943
+ m[method] = { handler: handler2, possibleKeys: [], score: 0, name: this.name };
2944
+ this.methods = [m];
2945
+ }
2946
+ this.patterns = [];
2947
+ }
2948
+ insert(method, path, handler2) {
2949
+ this.name = `${method} ${path}`;
2950
+ this.order = ++this.order;
2951
+ let curNode = this;
2952
+ const parts = splitRoutingPath(path);
2953
+ const possibleKeys = [];
2954
+ for (let i = 0, len = parts.length; i < len; i++) {
2955
+ const p = parts[i];
2956
+ if (Object.keys(curNode.children).includes(p)) {
2957
+ curNode = curNode.children[p];
2958
+ const pattern2 = getPattern(p);
2959
+ if (pattern2) {
2960
+ possibleKeys.push(pattern2[1]);
2961
+ }
2962
+ continue;
2963
+ }
2964
+ curNode.children[p] = new Node2();
2965
+ const pattern = getPattern(p);
2966
+ if (pattern) {
2967
+ curNode.patterns.push(pattern);
2968
+ possibleKeys.push(pattern[1]);
2969
+ }
2970
+ curNode = curNode.children[p];
2971
+ }
2972
+ if (!curNode.methods.length) {
2973
+ curNode.methods = [];
2974
+ }
2975
+ const m = /* @__PURE__ */ Object.create(null);
2976
+ const handlerSet = {
2977
+ handler: handler2,
2978
+ possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),
2979
+ name: this.name,
2980
+ score: this.order
2981
+ };
2982
+ m[method] = handlerSet;
2983
+ curNode.methods.push(m);
2984
+ return curNode;
2985
+ }
2986
+ gHSets(node, method, nodeParams, params) {
2987
+ const handlerSets = [];
2988
+ for (let i = 0, len = node.methods.length; i < len; i++) {
2989
+ const m = node.methods[i];
2990
+ const handlerSet = m[method] || m[METHOD_NAME_ALL];
2991
+ const processedSet = /* @__PURE__ */ Object.create(null);
2992
+ if (handlerSet !== void 0) {
2993
+ handlerSet.params = /* @__PURE__ */ Object.create(null);
2994
+ handlerSet.possibleKeys.forEach((key) => {
2995
+ const processed = processedSet[handlerSet.name];
2996
+ handlerSet.params[key] = params[key] && !processed ? params[key] : nodeParams[key] ?? params[key];
2997
+ processedSet[handlerSet.name] = true;
2998
+ });
2999
+ handlerSets.push(handlerSet);
3000
+ }
3001
+ }
3002
+ return handlerSets;
3003
+ }
3004
+ search(method, path) {
3005
+ const handlerSets = [];
3006
+ this.params = /* @__PURE__ */ Object.create(null);
3007
+ const curNode = this;
3008
+ let curNodes = [curNode];
3009
+ const parts = splitPath(path);
3010
+ for (let i = 0, len = parts.length; i < len; i++) {
3011
+ const part = parts[i];
3012
+ const isLast = i === len - 1;
3013
+ const tempNodes = [];
3014
+ for (let j = 0, len2 = curNodes.length; j < len2; j++) {
3015
+ const node = curNodes[j];
3016
+ const nextNode = node.children[part];
3017
+ if (nextNode) {
3018
+ nextNode.params = node.params;
3019
+ if (isLast === true) {
3020
+ if (nextNode.children["*"]) {
3021
+ handlerSets.push(
3022
+ ...this.gHSets(nextNode.children["*"], method, node.params, /* @__PURE__ */ Object.create(null))
3023
+ );
3024
+ }
3025
+ handlerSets.push(...this.gHSets(nextNode, method, node.params, /* @__PURE__ */ Object.create(null)));
3026
+ } else {
3027
+ tempNodes.push(nextNode);
3028
+ }
3029
+ }
3030
+ for (let k = 0, len3 = node.patterns.length; k < len3; k++) {
3031
+ const pattern = node.patterns[k];
3032
+ const params = { ...node.params };
3033
+ if (pattern === "*") {
3034
+ const astNode = node.children["*"];
3035
+ if (astNode) {
3036
+ handlerSets.push(...this.gHSets(astNode, method, node.params, /* @__PURE__ */ Object.create(null)));
3037
+ tempNodes.push(astNode);
3038
+ }
3039
+ continue;
3040
+ }
3041
+ if (part === "") {
3042
+ continue;
3043
+ }
3044
+ const [key, name, matcher] = pattern;
3045
+ const child = node.children[key];
3046
+ const restPathString = parts.slice(i).join("/");
3047
+ if (matcher instanceof RegExp && matcher.test(restPathString)) {
3048
+ params[name] = restPathString;
3049
+ handlerSets.push(...this.gHSets(child, method, node.params, params));
3050
+ continue;
3051
+ }
3052
+ if (matcher === true || matcher instanceof RegExp && matcher.test(part)) {
3053
+ if (typeof key === "string") {
3054
+ params[name] = part;
3055
+ if (isLast === true) {
3056
+ handlerSets.push(...this.gHSets(child, method, params, node.params));
3057
+ if (child.children["*"]) {
3058
+ handlerSets.push(...this.gHSets(child.children["*"], method, params, node.params));
3059
+ }
3060
+ } else {
3061
+ child.params = params;
3062
+ tempNodes.push(child);
3063
+ }
3064
+ }
3065
+ }
3066
+ }
3067
+ }
3068
+ curNodes = tempNodes;
3069
+ }
3070
+ const results = handlerSets.sort((a, b) => {
3071
+ return a.score - b.score;
3072
+ });
3073
+ return [results.map(({ handler: handler2, params }) => [handler2, params])];
3074
+ }
3075
+ };
3076
+
3077
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/router/trie-router/router.js
3078
+ var TrieRouter = class {
3079
+ name = "TrieRouter";
3080
+ node;
3081
+ constructor() {
3082
+ this.node = new Node2();
3083
+ }
3084
+ add(method, path, handler2) {
3085
+ const results = checkOptionalParameter(path);
3086
+ if (results) {
3087
+ for (const p of results) {
3088
+ this.node.insert(method, p, handler2);
3089
+ }
3090
+ return;
3091
+ }
3092
+ this.node.insert(method, path, handler2);
3093
+ }
3094
+ match(method, path) {
3095
+ return this.node.search(method, path);
3096
+ }
3097
+ };
3098
+
3099
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/hono.js
3100
+ var Hono2 = class extends Hono {
3101
+ constructor(options = {}) {
3102
+ super(options);
3103
+ this.router = options.router ?? new SmartRouter({
3104
+ routers: [new RegExpRouter(), new TrieRouter()]
3105
+ });
3106
+ }
3107
+ };
3108
+
3109
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/adapter/lambda-edge/handler.js
3110
+ var import_node_crypto = __toESM(require("crypto"), 1);
3111
+
3112
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/encode.js
3113
+ var encodeBase64 = (buf) => {
3114
+ let binary = "";
3115
+ const bytes = new Uint8Array(buf);
3116
+ for (let i = 0, len = bytes.length; i < len; i++) {
3117
+ binary += String.fromCharCode(bytes[i]);
3118
+ }
3119
+ return btoa(binary);
3120
+ };
3121
+ var decodeBase64 = (str) => {
3122
+ const binary = atob(str);
3123
+ const bytes = new Uint8Array(new ArrayBuffer(binary.length));
3124
+ const half = binary.length / 2;
3125
+ for (let i = 0, j = binary.length - 1; i <= half; i++, j--) {
3126
+ bytes[i] = binary.charCodeAt(i);
3127
+ bytes[j] = binary.charCodeAt(j);
3128
+ }
3129
+ return bytes;
3130
+ };
3131
+
3132
+ // ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/adapter/lambda-edge/handler.js
3133
+ globalThis.crypto ??= import_node_crypto.default;
3134
+ var convertHeaders = (headers) => {
3135
+ const cfHeaders = {};
3136
+ headers.forEach((value, key) => {
3137
+ cfHeaders[key.toLowerCase()] = [{ key: key.toLowerCase(), value }];
3138
+ });
3139
+ return cfHeaders;
3140
+ };
3141
+ var handle = (app2) => {
3142
+ return async (event, context, callback) => {
3143
+ const res = await app2.fetch(createRequest2(event), {
3144
+ event,
3145
+ context,
3146
+ callback: (err, result) => {
3147
+ callback?.(err, result);
3148
+ },
3149
+ config: event.Records[0].cf.config,
3150
+ request: event.Records[0].cf.request,
3151
+ response: event.Records[0].cf.response
3152
+ });
3153
+ return createResult(res);
3154
+ };
3155
+ };
3156
+ var createResult = async (res) => {
3157
+ const isBase64Encoded = isContentTypeBinary(res.headers.get("content-type") || "");
3158
+ const body = isBase64Encoded ? encodeBase64(await res.arrayBuffer()) : await res.text();
3159
+ return {
3160
+ status: res.status.toString(),
3161
+ headers: convertHeaders(res.headers),
3162
+ body,
3163
+ ...isBase64Encoded ? { bodyEncoding: "base64" } : {}
3164
+ };
3165
+ };
3166
+ var createRequest2 = (event) => {
3167
+ const queryString = event.Records[0].cf.request.querystring;
3168
+ const urlPath = `https://${event.Records[0].cf.config.distributionDomainName}${event.Records[0].cf.request.uri}`;
3169
+ const url = queryString ? `${urlPath}?${queryString}` : urlPath;
3170
+ const headers = new Headers();
3171
+ Object.entries(event.Records[0].cf.request.headers).forEach(([k, v]) => {
3172
+ v.forEach((header) => headers.set(k, header.value));
3173
+ });
3174
+ const requestBody = event.Records[0].cf.request.body;
3175
+ const method = event.Records[0].cf.request.method;
3176
+ const body = createBody(method, requestBody);
3177
+ return new Request(url, {
3178
+ headers,
3179
+ method,
3180
+ body
3181
+ });
3182
+ };
3183
+ var createBody = (method, requestBody) => {
3184
+ if (!requestBody || !requestBody.data) {
3185
+ return void 0;
3186
+ }
3187
+ if (method === "GET" || method === "HEAD") {
3188
+ return void 0;
3189
+ }
3190
+ if (requestBody.encoding === "base64") {
3191
+ return decodeBase64(requestBody.data);
3192
+ }
3193
+ return requestBody.data;
3194
+ };
3195
+ var isContentTypeBinary = (contentType) => {
3196
+ return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml.*)$/.test(
3197
+ contentType
3198
+ );
3199
+ };
3200
+
3201
+ // lambda/getUpdateInfo.ts
3202
+ var import_client_s3 = require("@aws-sdk/client-s3");
3203
+
3204
+ // ../../packages/core/dist/index.js
3205
+ var NIL_UUID = "00000000-0000-0000-0000-000000000000";
3206
+
3207
+ // ../js/dist/index.js
3208
+ var __webpack_modules__ = {
3209
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/comparator.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3210
+ const ANY = Symbol("SemVer ANY");
3211
+ class Comparator {
3212
+ static get ANY() {
3213
+ return ANY;
3214
+ }
3215
+ constructor(comp, options) {
3216
+ options = parseOptions(options);
3217
+ if (comp instanceof Comparator) {
3218
+ if (!!options.loose === comp.loose) return comp;
3219
+ comp = comp.value;
3220
+ }
3221
+ comp = comp.trim().split(/\s+/).join(" ");
3222
+ debug("comparator", comp, options);
3223
+ this.options = options;
3224
+ this.loose = !!options.loose;
3225
+ this.parse(comp);
3226
+ if (this.semver === ANY) this.value = "";
3227
+ else this.value = this.operator + this.semver.version;
3228
+ debug("comp", this);
3229
+ }
3230
+ parse(comp) {
3231
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
3232
+ const m = comp.match(r);
3233
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
3234
+ this.operator = void 0 !== m[1] ? m[1] : "";
3235
+ if ("=" === this.operator) this.operator = "";
3236
+ if (m[2]) this.semver = new SemVer(m[2], this.options.loose);
3237
+ else this.semver = ANY;
3238
+ }
3239
+ toString() {
3240
+ return this.value;
3241
+ }
3242
+ test(version) {
3243
+ debug("Comparator.test", version, this.options.loose);
3244
+ if (this.semver === ANY || version === ANY) return true;
3245
+ if ("string" == typeof version) try {
3246
+ version = new SemVer(version, this.options);
3247
+ } catch (er) {
3248
+ return false;
3249
+ }
3250
+ return cmp(version, this.operator, this.semver, this.options);
3251
+ }
3252
+ intersects(comp, options) {
3253
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
3254
+ if ("" === this.operator) {
3255
+ if ("" === this.value) return true;
3256
+ return new Range(comp.value, options).test(this.value);
3257
+ }
3258
+ if ("" === comp.operator) {
3259
+ if ("" === comp.value) return true;
3260
+ return new Range(this.value, options).test(comp.semver);
3261
+ }
3262
+ options = parseOptions(options);
3263
+ if (options.includePrerelease && ("<0.0.0-0" === this.value || "<0.0.0-0" === comp.value)) return false;
3264
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
3265
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
3266
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
3267
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
3268
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
3269
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
3270
+ return false;
3271
+ }
3272
+ }
3273
+ module2.exports = Comparator;
3274
+ const parseOptions = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/parse-options.js");
3275
+ const { safeRe: re, t } = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js");
3276
+ const cmp = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/cmp.js");
3277
+ const debug = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js");
3278
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3279
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
3280
+ },
3281
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3282
+ const SPACE_CHARACTERS = /\s+/g;
3283
+ class Range {
3284
+ constructor(range, options) {
3285
+ options = parseOptions(options);
3286
+ if (range instanceof Range) {
3287
+ if (!!options.loose === range.loose && !!options.includePrerelease === range.includePrerelease) return range;
3288
+ return new Range(range.raw, options);
3289
+ }
3290
+ if (range instanceof Comparator) {
3291
+ this.raw = range.value;
3292
+ this.set = [
3293
+ [
3294
+ range
3295
+ ]
3296
+ ];
3297
+ this.formatted = void 0;
3298
+ return this;
3299
+ }
3300
+ this.options = options;
3301
+ this.loose = !!options.loose;
3302
+ this.includePrerelease = !!options.includePrerelease;
3303
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
3304
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
3305
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
3306
+ if (this.set.length > 1) {
3307
+ const first = this.set[0];
3308
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
3309
+ if (0 === this.set.length) this.set = [
3310
+ first
3311
+ ];
3312
+ else if (this.set.length > 1) {
3313
+ for (const c of this.set) if (1 === c.length && isAny(c[0])) {
3314
+ this.set = [
3315
+ c
3316
+ ];
3317
+ break;
3318
+ }
3319
+ }
3320
+ }
3321
+ this.formatted = void 0;
3322
+ }
3323
+ get range() {
3324
+ if (void 0 === this.formatted) {
3325
+ this.formatted = "";
3326
+ for (let i = 0; i < this.set.length; i++) {
3327
+ if (i > 0) this.formatted += "||";
3328
+ const comps = this.set[i];
3329
+ for (let k = 0; k < comps.length; k++) {
3330
+ if (k > 0) this.formatted += " ";
3331
+ this.formatted += comps[k].toString().trim();
3332
+ }
3333
+ }
3334
+ }
3335
+ return this.formatted;
3336
+ }
3337
+ format() {
3338
+ return this.range;
3339
+ }
3340
+ toString() {
3341
+ return this.range;
3342
+ }
3343
+ parseRange(range) {
3344
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
3345
+ const memoKey = memoOpts + ":" + range;
3346
+ const cached = cache.get(memoKey);
3347
+ if (cached) return cached;
3348
+ const loose = this.options.loose;
3349
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
3350
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
3351
+ debug("hyphen replace", range);
3352
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
3353
+ debug("comparator trim", range);
3354
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
3355
+ debug("tilde trim", range);
3356
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
3357
+ debug("caret trim", range);
3358
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
3359
+ if (loose) rangeList = rangeList.filter((comp) => {
3360
+ debug("loose invalid filter", comp, this.options);
3361
+ return !!comp.match(re[t.COMPARATORLOOSE]);
3362
+ });
3363
+ debug("range list", rangeList);
3364
+ const rangeMap = /* @__PURE__ */ new Map();
3365
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
3366
+ for (const comp of comparators) {
3367
+ if (isNullSet(comp)) return [
3368
+ comp
3369
+ ];
3370
+ rangeMap.set(comp.value, comp);
3371
+ }
3372
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
3373
+ const result = [
3374
+ ...rangeMap.values()
3375
+ ];
3376
+ cache.set(memoKey, result);
3377
+ return result;
3378
+ }
3379
+ intersects(range, options) {
3380
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
3381
+ return this.set.some((thisComparators) => isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => rangeComparators.every((rangeComparator) => thisComparator.intersects(rangeComparator, options)))));
3382
+ }
3383
+ test(version) {
3384
+ if (!version) return false;
3385
+ if ("string" == typeof version) try {
3386
+ version = new SemVer(version, this.options);
3387
+ } catch (er) {
3388
+ return false;
3389
+ }
3390
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
3391
+ return false;
3392
+ }
3393
+ }
3394
+ module2.exports = Range;
3395
+ const LRU = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/lrucache.js");
3396
+ const cache = new LRU();
3397
+ const parseOptions = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/parse-options.js");
3398
+ const Comparator = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/comparator.js");
3399
+ const debug = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js");
3400
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3401
+ const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js");
3402
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js");
3403
+ const isNullSet = (c) => "<0.0.0-0" === c.value;
3404
+ const isAny = (c) => "" === c.value;
3405
+ const isSatisfiable = (comparators, options) => {
3406
+ let result = true;
3407
+ const remainingComparators = comparators.slice();
3408
+ let testComparator = remainingComparators.pop();
3409
+ while (result && remainingComparators.length) {
3410
+ result = remainingComparators.every((otherComparator) => testComparator.intersects(otherComparator, options));
3411
+ testComparator = remainingComparators.pop();
3412
+ }
3413
+ return result;
3414
+ };
3415
+ const parseComparator = (comp, options) => {
3416
+ debug("comp", comp, options);
3417
+ comp = replaceCarets(comp, options);
3418
+ debug("caret", comp);
3419
+ comp = replaceTildes(comp, options);
3420
+ debug("tildes", comp);
3421
+ comp = replaceXRanges(comp, options);
3422
+ debug("xrange", comp);
3423
+ comp = replaceStars(comp, options);
3424
+ debug("stars", comp);
3425
+ return comp;
3426
+ };
3427
+ const isX = (id) => !id || "x" === id.toLowerCase() || "*" === id;
3428
+ const replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
3429
+ const replaceTilde = (comp, options) => {
3430
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
3431
+ return comp.replace(r, (_, M, m, p, pr) => {
3432
+ debug("tilde", comp, _, M, m, p, pr);
3433
+ let ret;
3434
+ if (isX(M)) ret = "";
3435
+ else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
3436
+ else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
3437
+ else if (pr) {
3438
+ debug("replaceTilde pr", pr);
3439
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
3440
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
3441
+ debug("tilde return", ret);
3442
+ return ret;
3443
+ });
3444
+ };
3445
+ const replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
3446
+ const replaceCaret = (comp, options) => {
3447
+ debug("caret", comp, options);
3448
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
3449
+ const z = options.includePrerelease ? "-0" : "";
3450
+ return comp.replace(r, (_, M, m, p, pr) => {
3451
+ debug("caret", comp, _, M, m, p, pr);
3452
+ let ret;
3453
+ if (isX(M)) ret = "";
3454
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
3455
+ else if (isX(p)) ret = "0" === M ? `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` : `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
3456
+ else if (pr) {
3457
+ debug("replaceCaret pr", pr);
3458
+ ret = "0" === M ? "0" === m ? `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0` : `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0` : `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
3459
+ } else {
3460
+ debug("no pr");
3461
+ ret = "0" === M ? "0" === m ? `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0` : `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0` : `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
3462
+ }
3463
+ debug("caret return", ret);
3464
+ return ret;
3465
+ });
3466
+ };
3467
+ const replaceXRanges = (comp, options) => {
3468
+ debug("replaceXRanges", comp, options);
3469
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
3470
+ };
3471
+ const replaceXRange = (comp, options) => {
3472
+ comp = comp.trim();
3473
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
3474
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
3475
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
3476
+ const xM = isX(M);
3477
+ const xm = xM || isX(m);
3478
+ const xp = xm || isX(p);
3479
+ const anyX = xp;
3480
+ if ("=" === gtlt && anyX) gtlt = "";
3481
+ pr = options.includePrerelease ? "-0" : "";
3482
+ if (xM) ret = ">" === gtlt || "<" === gtlt ? "<0.0.0-0" : "*";
3483
+ else if (gtlt && anyX) {
3484
+ if (xm) m = 0;
3485
+ p = 0;
3486
+ if (">" === gtlt) {
3487
+ gtlt = ">=";
3488
+ if (xm) {
3489
+ M = +M + 1;
3490
+ m = 0;
3491
+ p = 0;
3492
+ } else {
3493
+ m = +m + 1;
3494
+ p = 0;
3495
+ }
3496
+ } else if ("<=" === gtlt) {
3497
+ gtlt = "<";
3498
+ if (xm) M = +M + 1;
3499
+ else m = +m + 1;
3500
+ }
3501
+ if ("<" === gtlt) pr = "-0";
3502
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
3503
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
3504
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
3505
+ debug("xRange return", ret);
3506
+ return ret;
3507
+ });
3508
+ };
3509
+ const replaceStars = (comp, options) => {
3510
+ debug("replaceStars", comp, options);
3511
+ return comp.trim().replace(re[t.STAR], "");
3512
+ };
3513
+ const replaceGTE0 = (comp, options) => {
3514
+ debug("replaceGTE0", comp, options);
3515
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
3516
+ };
3517
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
3518
+ from = isX(fM) ? "" : isX(fm) ? `>=${fM}.0.0${incPr ? "-0" : ""}` : isX(fp) ? `>=${fM}.${fm}.0${incPr ? "-0" : ""}` : fpr ? `>=${from}` : `>=${from}${incPr ? "-0" : ""}`;
3519
+ to = isX(tM) ? "" : isX(tm) ? `<${+tM + 1}.0.0-0` : isX(tp) ? `<${tM}.${+tm + 1}.0-0` : tpr ? `<=${tM}.${tm}.${tp}-${tpr}` : incPr ? `<${tM}.${tm}.${+tp + 1}-0` : `<=${to}`;
3520
+ return `${from} ${to}`.trim();
3521
+ };
3522
+ const testSet = (set, version, options) => {
3523
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
3524
+ if (version.prerelease.length && !options.includePrerelease) {
3525
+ for (let i = 0; i < set.length; i++) {
3526
+ debug(set[i].semver);
3527
+ if (set[i].semver !== Comparator.ANY) {
3528
+ if (set[i].semver.prerelease.length > 0) {
3529
+ const allowed = set[i].semver;
3530
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
3531
+ }
3532
+ }
3533
+ }
3534
+ return false;
3535
+ }
3536
+ return true;
3537
+ };
3538
+ },
3539
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3540
+ const debug = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js");
3541
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js");
3542
+ const { safeRe: re, t } = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js");
3543
+ const parseOptions = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/parse-options.js");
3544
+ const { compareIdentifiers } = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/identifiers.js");
3545
+ class SemVer {
3546
+ constructor(version, options) {
3547
+ options = parseOptions(options);
3548
+ if (version instanceof SemVer) {
3549
+ if (!!options.loose === version.loose && !!options.includePrerelease === version.includePrerelease) return version;
3550
+ version = version.version;
3551
+ } else if ("string" != typeof version) throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
3552
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
3553
+ debug("SemVer", version, options);
3554
+ this.options = options;
3555
+ this.loose = !!options.loose;
3556
+ this.includePrerelease = !!options.includePrerelease;
3557
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
3558
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
3559
+ this.raw = version;
3560
+ this.major = +m[1];
3561
+ this.minor = +m[2];
3562
+ this.patch = +m[3];
3563
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
3564
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
3565
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
3566
+ if (m[4]) this.prerelease = m[4].split(".").map((id) => {
3567
+ if (/^[0-9]+$/.test(id)) {
3568
+ const num = +id;
3569
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
3570
+ }
3571
+ return id;
3572
+ });
3573
+ else this.prerelease = [];
3574
+ this.build = m[5] ? m[5].split(".") : [];
3575
+ this.format();
3576
+ }
3577
+ format() {
3578
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
3579
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
3580
+ return this.version;
3581
+ }
3582
+ toString() {
3583
+ return this.version;
3584
+ }
3585
+ compare(other) {
3586
+ debug("SemVer.compare", this.version, this.options, other);
3587
+ if (!(other instanceof SemVer)) {
3588
+ if ("string" == typeof other && other === this.version) return 0;
3589
+ other = new SemVer(other, this.options);
3590
+ }
3591
+ if (other.version === this.version) return 0;
3592
+ return this.compareMain(other) || this.comparePre(other);
3593
+ }
3594
+ compareMain(other) {
3595
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
3596
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
3597
+ }
3598
+ comparePre(other) {
3599
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
3600
+ if (this.prerelease.length && !other.prerelease.length) return -1;
3601
+ if (!this.prerelease.length && other.prerelease.length) return 1;
3602
+ if (!this.prerelease.length && !other.prerelease.length) return 0;
3603
+ let i = 0;
3604
+ do {
3605
+ const a = this.prerelease[i];
3606
+ const b = other.prerelease[i];
3607
+ debug("prerelease compare", i, a, b);
3608
+ if (void 0 === a && void 0 === b) return 0;
3609
+ if (void 0 === b) return 1;
3610
+ if (void 0 === a) return -1;
3611
+ else if (a === b) continue;
3612
+ else return compareIdentifiers(a, b);
3613
+ } while (++i);
3614
+ }
3615
+ compareBuild(other) {
3616
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
3617
+ let i = 0;
3618
+ do {
3619
+ const a = this.build[i];
3620
+ const b = other.build[i];
3621
+ debug("build compare", i, a, b);
3622
+ if (void 0 === a && void 0 === b) return 0;
3623
+ if (void 0 === b) return 1;
3624
+ if (void 0 === a) return -1;
3625
+ else if (a === b) continue;
3626
+ else return compareIdentifiers(a, b);
3627
+ } while (++i);
3628
+ }
3629
+ inc(release, identifier, identifierBase) {
3630
+ switch (release) {
3631
+ case "premajor":
3632
+ this.prerelease.length = 0;
3633
+ this.patch = 0;
3634
+ this.minor = 0;
3635
+ this.major++;
3636
+ this.inc("pre", identifier, identifierBase);
3637
+ break;
3638
+ case "preminor":
3639
+ this.prerelease.length = 0;
3640
+ this.patch = 0;
3641
+ this.minor++;
3642
+ this.inc("pre", identifier, identifierBase);
3643
+ break;
3644
+ case "prepatch":
3645
+ this.prerelease.length = 0;
3646
+ this.inc("patch", identifier, identifierBase);
3647
+ this.inc("pre", identifier, identifierBase);
3648
+ break;
3649
+ case "prerelease":
3650
+ if (0 === this.prerelease.length) this.inc("patch", identifier, identifierBase);
3651
+ this.inc("pre", identifier, identifierBase);
3652
+ break;
3653
+ case "major":
3654
+ if (0 !== this.minor || 0 !== this.patch || 0 === this.prerelease.length) this.major++;
3655
+ this.minor = 0;
3656
+ this.patch = 0;
3657
+ this.prerelease = [];
3658
+ break;
3659
+ case "minor":
3660
+ if (0 !== this.patch || 0 === this.prerelease.length) this.minor++;
3661
+ this.patch = 0;
3662
+ this.prerelease = [];
3663
+ break;
3664
+ case "patch":
3665
+ if (0 === this.prerelease.length) this.patch++;
3666
+ this.prerelease = [];
3667
+ break;
3668
+ case "pre": {
3669
+ const base = Number(identifierBase) ? 1 : 0;
3670
+ if (!identifier && false === identifierBase) throw new Error("invalid increment argument: identifier is empty");
3671
+ if (0 === this.prerelease.length) this.prerelease = [
3672
+ base
3673
+ ];
3674
+ else {
3675
+ let i = this.prerelease.length;
3676
+ while (--i >= 0) if ("number" == typeof this.prerelease[i]) {
3677
+ this.prerelease[i]++;
3678
+ i = -2;
3679
+ }
3680
+ if (-1 === i) {
3681
+ if (identifier === this.prerelease.join(".") && false === identifierBase) throw new Error("invalid increment argument: identifier already exists");
3682
+ this.prerelease.push(base);
3683
+ }
3684
+ }
3685
+ if (identifier) {
3686
+ let prerelease = [
3687
+ identifier,
3688
+ base
3689
+ ];
3690
+ if (false === identifierBase) prerelease = [
3691
+ identifier
3692
+ ];
3693
+ if (0 === compareIdentifiers(this.prerelease[0], identifier)) {
3694
+ if (isNaN(this.prerelease[1])) this.prerelease = prerelease;
3695
+ } else this.prerelease = prerelease;
3696
+ }
3697
+ break;
3698
+ }
3699
+ default:
3700
+ throw new Error(`invalid increment argument: ${release}`);
3701
+ }
3702
+ this.raw = this.format();
3703
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
3704
+ return this;
3705
+ }
3706
+ }
3707
+ module2.exports = SemVer;
3708
+ },
3709
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/clean.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3710
+ const parse = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js");
3711
+ const clean = (version, options) => {
3712
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
3713
+ return s ? s.version : null;
3714
+ };
3715
+ module2.exports = clean;
3716
+ },
3717
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/cmp.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3718
+ const eq = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/eq.js");
3719
+ const neq = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/neq.js");
3720
+ const gt = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gt.js");
3721
+ const gte = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gte.js");
3722
+ const lt = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lt.js");
3723
+ const lte = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lte.js");
3724
+ const cmp = (a, op, b, loose) => {
3725
+ switch (op) {
3726
+ case "===":
3727
+ if ("object" == typeof a) a = a.version;
3728
+ if ("object" == typeof b) b = b.version;
3729
+ return a === b;
3730
+ case "!==":
3731
+ if ("object" == typeof a) a = a.version;
3732
+ if ("object" == typeof b) b = b.version;
3733
+ return a !== b;
3734
+ case "":
3735
+ case "=":
3736
+ case "==":
3737
+ return eq(a, b, loose);
3738
+ case "!=":
3739
+ return neq(a, b, loose);
3740
+ case ">":
3741
+ return gt(a, b, loose);
3742
+ case ">=":
3743
+ return gte(a, b, loose);
3744
+ case "<":
3745
+ return lt(a, b, loose);
3746
+ case "<=":
3747
+ return lte(a, b, loose);
3748
+ default:
3749
+ throw new TypeError(`Invalid operator: ${op}`);
3750
+ }
3751
+ };
3752
+ module2.exports = cmp;
3753
+ },
3754
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/coerce.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3755
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3756
+ const parse = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js");
3757
+ const { safeRe: re, t } = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js");
3758
+ const coerce = (version, options) => {
3759
+ if (version instanceof SemVer) return version;
3760
+ if ("number" == typeof version) version = String(version);
3761
+ if ("string" != typeof version) return null;
3762
+ options = options || {};
3763
+ let match = null;
3764
+ if (options.rtl) {
3765
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
3766
+ let next;
3767
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
3768
+ if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
3769
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
3770
+ }
3771
+ coerceRtlRegex.lastIndex = -1;
3772
+ } else match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
3773
+ if (null === match) return null;
3774
+ const major = match[2];
3775
+ const minor = match[3] || "0";
3776
+ const patch = match[4] || "0";
3777
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
3778
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
3779
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
3780
+ };
3781
+ module2.exports = coerce;
3782
+ },
3783
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-build.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3784
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3785
+ const compareBuild = (a, b, loose) => {
3786
+ const versionA = new SemVer(a, loose);
3787
+ const versionB = new SemVer(b, loose);
3788
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
3789
+ };
3790
+ module2.exports = compareBuild;
3791
+ },
3792
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-loose.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3793
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
3794
+ const compareLoose = (a, b) => compare(a, b, true);
3795
+ module2.exports = compareLoose;
3796
+ },
3797
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3798
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3799
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
3800
+ module2.exports = compare;
3801
+ },
3802
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/diff.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3803
+ const parse = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js");
3804
+ const diff = (version1, version2) => {
3805
+ const v1 = parse(version1, null, true);
3806
+ const v2 = parse(version2, null, true);
3807
+ const comparison = v1.compare(v2);
3808
+ if (0 === comparison) return null;
3809
+ const v1Higher = comparison > 0;
3810
+ const highVersion = v1Higher ? v1 : v2;
3811
+ const lowVersion = v1Higher ? v2 : v1;
3812
+ const highHasPre = !!highVersion.prerelease.length;
3813
+ const lowHasPre = !!lowVersion.prerelease.length;
3814
+ if (lowHasPre && !highHasPre) {
3815
+ if (!lowVersion.patch && !lowVersion.minor) return "major";
3816
+ if (highVersion.patch) return "patch";
3817
+ if (highVersion.minor) return "minor";
3818
+ return "major";
3819
+ }
3820
+ const prefix = highHasPre ? "pre" : "";
3821
+ if (v1.major !== v2.major) return prefix + "major";
3822
+ if (v1.minor !== v2.minor) return prefix + "minor";
3823
+ if (v1.patch !== v2.patch) return prefix + "patch";
3824
+ return "prerelease";
3825
+ };
3826
+ module2.exports = diff;
3827
+ },
3828
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/eq.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3829
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
3830
+ const eq = (a, b, loose) => 0 === compare(a, b, loose);
3831
+ module2.exports = eq;
3832
+ },
3833
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gt.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3834
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
3835
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
3836
+ module2.exports = gt;
3837
+ },
3838
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gte.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3839
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
3840
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
3841
+ module2.exports = gte;
3842
+ },
3843
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/inc.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3844
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3845
+ const inc = (version, release, options, identifier, identifierBase) => {
3846
+ if ("string" == typeof options) {
3847
+ identifierBase = identifier;
3848
+ identifier = options;
3849
+ options = void 0;
3850
+ }
3851
+ try {
3852
+ return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
3853
+ } catch (er) {
3854
+ return null;
3855
+ }
3856
+ };
3857
+ module2.exports = inc;
3858
+ },
3859
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lt.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3860
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
3861
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
3862
+ module2.exports = lt;
3863
+ },
3864
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lte.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3865
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
3866
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
3867
+ module2.exports = lte;
3868
+ },
3869
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/major.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3870
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3871
+ const major = (a, loose) => new SemVer(a, loose).major;
3872
+ module2.exports = major;
3873
+ },
3874
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/minor.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3875
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3876
+ const minor = (a, loose) => new SemVer(a, loose).minor;
3877
+ module2.exports = minor;
3878
+ },
3879
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/neq.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3880
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
3881
+ const neq = (a, b, loose) => 0 !== compare(a, b, loose);
3882
+ module2.exports = neq;
3883
+ },
3884
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3885
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3886
+ const parse = (version, options, throwErrors = false) => {
3887
+ if (version instanceof SemVer) return version;
3888
+ try {
3889
+ return new SemVer(version, options);
3890
+ } catch (er) {
3891
+ if (!throwErrors) return null;
3892
+ throw er;
3893
+ }
3894
+ };
3895
+ module2.exports = parse;
3896
+ },
3897
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/patch.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3898
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3899
+ const patch = (a, loose) => new SemVer(a, loose).patch;
3900
+ module2.exports = patch;
3901
+ },
3902
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/prerelease.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3903
+ const parse = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js");
3904
+ const prerelease = (version, options) => {
3905
+ const parsed = parse(version, options);
3906
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
3907
+ };
3908
+ module2.exports = prerelease;
3909
+ },
3910
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rcompare.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3911
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
3912
+ const rcompare = (a, b, loose) => compare(b, a, loose);
3913
+ module2.exports = rcompare;
3914
+ },
3915
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rsort.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3916
+ const compareBuild = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-build.js");
3917
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
3918
+ module2.exports = rsort;
3919
+ },
3920
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/satisfies.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3921
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
3922
+ const satisfies = (version, range, options) => {
3923
+ try {
3924
+ range = new Range(range, options);
3925
+ } catch (er) {
3926
+ return false;
3927
+ }
3928
+ return range.test(version);
3929
+ };
3930
+ module2.exports = satisfies;
3931
+ },
3932
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/sort.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3933
+ const compareBuild = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-build.js");
3934
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
3935
+ module2.exports = sort;
3936
+ },
3937
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/valid.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3938
+ const parse = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js");
3939
+ const valid = (version, options) => {
3940
+ const v = parse(version, options);
3941
+ return v ? v.version : null;
3942
+ };
3943
+ module2.exports = valid;
3944
+ },
3945
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/index.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
3946
+ const internalRe = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js");
3947
+ const constants = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js");
3948
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
3949
+ const identifiers = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/identifiers.js");
3950
+ const parse = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js");
3951
+ const valid = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/valid.js");
3952
+ const clean = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/clean.js");
3953
+ const inc = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/inc.js");
3954
+ const diff = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/diff.js");
3955
+ const major = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/major.js");
3956
+ const minor = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/minor.js");
3957
+ const patch = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/patch.js");
3958
+ const prerelease = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/prerelease.js");
3959
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
3960
+ const rcompare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rcompare.js");
3961
+ const compareLoose = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-loose.js");
3962
+ const compareBuild = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-build.js");
3963
+ const sort = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/sort.js");
3964
+ const rsort = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rsort.js");
3965
+ const gt = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gt.js");
3966
+ const lt = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lt.js");
3967
+ const eq = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/eq.js");
3968
+ const neq = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/neq.js");
3969
+ const gte = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gte.js");
3970
+ const lte = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lte.js");
3971
+ const cmp = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/cmp.js");
3972
+ const coerce = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/coerce.js");
3973
+ const Comparator = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/comparator.js");
3974
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
3975
+ const satisfies = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/satisfies.js");
3976
+ const toComparators = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/to-comparators.js");
3977
+ const maxSatisfying = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/max-satisfying.js");
3978
+ const minSatisfying = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-satisfying.js");
3979
+ const minVersion = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-version.js");
3980
+ const validRange = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/valid.js");
3981
+ const outside = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/outside.js");
3982
+ const gtr = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/gtr.js");
3983
+ const ltr = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/ltr.js");
3984
+ const intersects = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/intersects.js");
3985
+ const simplifyRange = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/simplify.js");
3986
+ const subset = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/subset.js");
3987
+ module2.exports = {
3988
+ parse,
3989
+ valid,
3990
+ clean,
3991
+ inc,
3992
+ diff,
3993
+ major,
3994
+ minor,
3995
+ patch,
3996
+ prerelease,
3997
+ compare,
3998
+ rcompare,
3999
+ compareLoose,
4000
+ compareBuild,
4001
+ sort,
4002
+ rsort,
4003
+ gt,
4004
+ lt,
4005
+ eq,
4006
+ neq,
4007
+ gte,
4008
+ lte,
4009
+ cmp,
4010
+ coerce,
4011
+ Comparator,
4012
+ Range,
4013
+ satisfies,
4014
+ toComparators,
4015
+ maxSatisfying,
4016
+ minSatisfying,
4017
+ minVersion,
4018
+ validRange,
4019
+ outside,
4020
+ gtr,
4021
+ ltr,
4022
+ intersects,
4023
+ simplifyRange,
4024
+ subset,
4025
+ SemVer,
4026
+ re: internalRe.re,
4027
+ src: internalRe.src,
4028
+ tokens: internalRe.t,
4029
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
4030
+ RELEASE_TYPES: constants.RELEASE_TYPES,
4031
+ compareIdentifiers: identifiers.compareIdentifiers,
4032
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
4033
+ };
4034
+ },
4035
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js": function(module2) {
4036
+ const SEMVER_SPEC_VERSION = "2.0.0";
4037
+ const MAX_LENGTH = 256;
4038
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
4039
+ const MAX_SAFE_COMPONENT_LENGTH = 16;
4040
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
4041
+ const RELEASE_TYPES = [
4042
+ "major",
4043
+ "premajor",
4044
+ "minor",
4045
+ "preminor",
4046
+ "patch",
4047
+ "prepatch",
4048
+ "prerelease"
4049
+ ];
4050
+ module2.exports = {
4051
+ MAX_LENGTH,
4052
+ MAX_SAFE_COMPONENT_LENGTH,
4053
+ MAX_SAFE_BUILD_LENGTH,
4054
+ MAX_SAFE_INTEGER,
4055
+ RELEASE_TYPES,
4056
+ SEMVER_SPEC_VERSION,
4057
+ FLAG_INCLUDE_PRERELEASE: 1,
4058
+ FLAG_LOOSE: 2
4059
+ };
4060
+ },
4061
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js": function(module2) {
4062
+ const debug = "object" == typeof process && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
4063
+ };
4064
+ module2.exports = debug;
4065
+ },
4066
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/identifiers.js": function(module2) {
4067
+ const numeric = /^[0-9]+$/;
4068
+ const compareIdentifiers = (a, b) => {
4069
+ const anum = numeric.test(a);
4070
+ const bnum = numeric.test(b);
4071
+ if (anum && bnum) {
4072
+ a = +a;
4073
+ b = +b;
4074
+ }
4075
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
4076
+ };
4077
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
4078
+ module2.exports = {
4079
+ compareIdentifiers,
4080
+ rcompareIdentifiers
4081
+ };
4082
+ },
4083
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/lrucache.js": function(module2) {
4084
+ class LRUCache {
4085
+ constructor() {
4086
+ this.max = 1e3;
4087
+ this.map = /* @__PURE__ */ new Map();
4088
+ }
4089
+ get(key) {
4090
+ const value = this.map.get(key);
4091
+ if (void 0 === value) return;
4092
+ this.map.delete(key);
4093
+ this.map.set(key, value);
4094
+ return value;
4095
+ }
4096
+ delete(key) {
4097
+ return this.map.delete(key);
4098
+ }
4099
+ set(key, value) {
4100
+ const deleted = this.delete(key);
4101
+ if (!deleted && void 0 !== value) {
4102
+ if (this.map.size >= this.max) {
4103
+ const firstKey = this.map.keys().next().value;
4104
+ this.delete(firstKey);
4105
+ }
4106
+ this.map.set(key, value);
4107
+ }
4108
+ return this;
4109
+ }
4110
+ }
4111
+ module2.exports = LRUCache;
4112
+ },
4113
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/parse-options.js": function(module2) {
4114
+ const looseOption = Object.freeze({
4115
+ loose: true
4116
+ });
4117
+ const emptyOpts = Object.freeze({});
4118
+ const parseOptions = (options) => {
4119
+ if (!options) return emptyOpts;
4120
+ if ("object" != typeof options) return looseOption;
4121
+ return options;
4122
+ };
4123
+ module2.exports = parseOptions;
4124
+ },
4125
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js": function(module2, exports2, __webpack_require__2) {
4126
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js");
4127
+ const debug = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js");
4128
+ exports2 = module2.exports = {};
4129
+ const re = exports2.re = [];
4130
+ const safeRe = exports2.safeRe = [];
4131
+ const src = exports2.src = [];
4132
+ const t = exports2.t = {};
4133
+ let R = 0;
4134
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
4135
+ const safeRegexReplacements = [
4136
+ [
4137
+ "\\s",
4138
+ 1
4139
+ ],
4140
+ [
4141
+ "\\d",
4142
+ MAX_LENGTH
4143
+ ],
4144
+ [
4145
+ LETTERDASHNUMBER,
4146
+ MAX_SAFE_BUILD_LENGTH
4147
+ ]
4148
+ ];
4149
+ const makeSafeRegex = (value) => {
4150
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
4151
+ return value;
4152
+ };
4153
+ const createToken = (name, value, isGlobal) => {
4154
+ const safe = makeSafeRegex(value);
4155
+ const index = R++;
4156
+ debug(name, index, value);
4157
+ t[name] = index;
4158
+ src[index] = value;
4159
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
4160
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
4161
+ };
4162
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
4163
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
4164
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
4165
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
4166
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
4167
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
4168
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
4169
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
4170
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
4171
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
4172
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
4173
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
4174
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
4175
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
4176
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
4177
+ createToken("GTLT", "((?:<|>)?=?)");
4178
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
4179
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
4180
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
4181
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
4182
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
4183
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
4184
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
4185
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
4186
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
4187
+ createToken("COERCERTL", src[t.COERCE], true);
4188
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
4189
+ createToken("LONETILDE", "(?:~>?)");
4190
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
4191
+ exports2.tildeTrimReplace = "$1~";
4192
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
4193
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
4194
+ createToken("LONECARET", "(?:\\^)");
4195
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
4196
+ exports2.caretTrimReplace = "$1^";
4197
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
4198
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
4199
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
4200
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
4201
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
4202
+ exports2.comparatorTrimReplace = "$1$2$3";
4203
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
4204
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
4205
+ createToken("STAR", "(<|>)?=?\\s*\\*");
4206
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
4207
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
4208
+ },
4209
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/gtr.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4210
+ const outside = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/outside.js");
4211
+ const gtr = (version, range, options) => outside(version, range, ">", options);
4212
+ module2.exports = gtr;
4213
+ },
4214
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/intersects.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4215
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
4216
+ const intersects = (r1, r2, options) => {
4217
+ r1 = new Range(r1, options);
4218
+ r2 = new Range(r2, options);
4219
+ return r1.intersects(r2, options);
4220
+ };
4221
+ module2.exports = intersects;
4222
+ },
4223
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/ltr.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4224
+ const outside = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/outside.js");
4225
+ const ltr = (version, range, options) => outside(version, range, "<", options);
4226
+ module2.exports = ltr;
4227
+ },
4228
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/max-satisfying.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4229
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
4230
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
4231
+ const maxSatisfying = (versions, range, options) => {
4232
+ let max = null;
4233
+ let maxSV = null;
4234
+ let rangeObj = null;
4235
+ try {
4236
+ rangeObj = new Range(range, options);
4237
+ } catch (er) {
4238
+ return null;
4239
+ }
4240
+ versions.forEach((v) => {
4241
+ if (rangeObj.test(v)) {
4242
+ if (!max || -1 === maxSV.compare(v)) {
4243
+ max = v;
4244
+ maxSV = new SemVer(max, options);
4245
+ }
4246
+ }
4247
+ });
4248
+ return max;
4249
+ };
4250
+ module2.exports = maxSatisfying;
4251
+ },
4252
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-satisfying.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4253
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
4254
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
4255
+ const minSatisfying = (versions, range, options) => {
4256
+ let min = null;
4257
+ let minSV = null;
4258
+ let rangeObj = null;
4259
+ try {
4260
+ rangeObj = new Range(range, options);
4261
+ } catch (er) {
4262
+ return null;
4263
+ }
4264
+ versions.forEach((v) => {
4265
+ if (rangeObj.test(v)) {
4266
+ if (!min || 1 === minSV.compare(v)) {
4267
+ min = v;
4268
+ minSV = new SemVer(min, options);
4269
+ }
4270
+ }
4271
+ });
4272
+ return min;
4273
+ };
4274
+ module2.exports = minSatisfying;
4275
+ },
4276
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-version.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4277
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
4278
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
4279
+ const gt = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gt.js");
4280
+ const minVersion = (range, loose) => {
4281
+ range = new Range(range, loose);
4282
+ let minver = new SemVer("0.0.0");
4283
+ if (range.test(minver)) return minver;
4284
+ minver = new SemVer("0.0.0-0");
4285
+ if (range.test(minver)) return minver;
4286
+ minver = null;
4287
+ for (let i = 0; i < range.set.length; ++i) {
4288
+ const comparators = range.set[i];
4289
+ let setMin = null;
4290
+ comparators.forEach((comparator) => {
4291
+ const compver = new SemVer(comparator.semver.version);
4292
+ switch (comparator.operator) {
4293
+ case ">":
4294
+ if (0 === compver.prerelease.length) compver.patch++;
4295
+ else compver.prerelease.push(0);
4296
+ compver.raw = compver.format();
4297
+ case "":
4298
+ case ">=":
4299
+ if (!setMin || gt(compver, setMin)) setMin = compver;
4300
+ break;
4301
+ case "<":
4302
+ case "<=":
4303
+ break;
4304
+ default:
4305
+ throw new Error(`Unexpected operation: ${comparator.operator}`);
4306
+ }
4307
+ });
4308
+ if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
4309
+ }
4310
+ if (minver && range.test(minver)) return minver;
4311
+ return null;
4312
+ };
4313
+ module2.exports = minVersion;
4314
+ },
4315
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/outside.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4316
+ const SemVer = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js");
4317
+ const Comparator = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/comparator.js");
4318
+ const { ANY } = Comparator;
4319
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
4320
+ const satisfies = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/satisfies.js");
4321
+ const gt = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gt.js");
4322
+ const lt = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lt.js");
4323
+ const lte = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lte.js");
4324
+ const gte = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gte.js");
4325
+ const outside = (version, range, hilo, options) => {
4326
+ version = new SemVer(version, options);
4327
+ range = new Range(range, options);
4328
+ let gtfn, ltefn, ltfn, comp, ecomp;
4329
+ switch (hilo) {
4330
+ case ">":
4331
+ gtfn = gt;
4332
+ ltefn = lte;
4333
+ ltfn = lt;
4334
+ comp = ">";
4335
+ ecomp = ">=";
4336
+ break;
4337
+ case "<":
4338
+ gtfn = lt;
4339
+ ltefn = gte;
4340
+ ltfn = gt;
4341
+ comp = "<";
4342
+ ecomp = "<=";
4343
+ break;
4344
+ default:
4345
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
4346
+ }
4347
+ if (satisfies(version, range, options)) return false;
4348
+ for (let i = 0; i < range.set.length; ++i) {
4349
+ const comparators = range.set[i];
4350
+ let high = null;
4351
+ let low = null;
4352
+ comparators.forEach((comparator) => {
4353
+ if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
4354
+ high = high || comparator;
4355
+ low = low || comparator;
4356
+ if (gtfn(comparator.semver, high.semver, options)) high = comparator;
4357
+ else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
4358
+ });
4359
+ if (high.operator === comp || high.operator === ecomp) return false;
4360
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
4361
+ if (low.operator === ecomp && ltfn(version, low.semver)) return false;
4362
+ }
4363
+ return true;
4364
+ };
4365
+ module2.exports = outside;
4366
+ },
4367
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/simplify.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4368
+ const satisfies = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/satisfies.js");
4369
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
4370
+ module2.exports = (versions, range, options) => {
4371
+ const set = [];
4372
+ let first = null;
4373
+ let prev = null;
4374
+ const v = versions.sort((a, b) => compare(a, b, options));
4375
+ for (const version of v) {
4376
+ const included = satisfies(version, range, options);
4377
+ if (included) {
4378
+ prev = version;
4379
+ if (!first) first = version;
4380
+ } else {
4381
+ if (prev) set.push([
4382
+ first,
4383
+ prev
4384
+ ]);
4385
+ prev = null;
4386
+ first = null;
4387
+ }
4388
+ }
4389
+ if (first) set.push([
4390
+ first,
4391
+ null
4392
+ ]);
4393
+ const ranges = [];
4394
+ for (const [min, max] of set) if (min === max) ranges.push(min);
4395
+ else if (max || min !== v[0]) {
4396
+ if (max) {
4397
+ if (min === v[0]) ranges.push(`<=${max}`);
4398
+ else ranges.push(`${min} - ${max}`);
4399
+ } else ranges.push(`>=${min}`);
4400
+ } else ranges.push("*");
4401
+ const simplified = ranges.join(" || ");
4402
+ const original = "string" == typeof range.raw ? range.raw : String(range);
4403
+ return simplified.length < original.length ? simplified : range;
4404
+ };
4405
+ },
4406
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/subset.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4407
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
4408
+ const Comparator = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/comparator.js");
4409
+ const { ANY } = Comparator;
4410
+ const satisfies = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/satisfies.js");
4411
+ const compare = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js");
4412
+ const subset = (sub, dom, options = {}) => {
4413
+ if (sub === dom) return true;
4414
+ sub = new Range(sub, options);
4415
+ dom = new Range(dom, options);
4416
+ let sawNonNull = false;
4417
+ OUTER: for (const simpleSub of sub.set) {
4418
+ for (const simpleDom of dom.set) {
4419
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
4420
+ sawNonNull = sawNonNull || null !== isSub;
4421
+ if (isSub) continue OUTER;
4422
+ }
4423
+ if (sawNonNull) return false;
4424
+ }
4425
+ return true;
4426
+ };
4427
+ const minimumVersionWithPreRelease = [
4428
+ new Comparator(">=0.0.0-0")
4429
+ ];
4430
+ const minimumVersion = [
4431
+ new Comparator(">=0.0.0")
4432
+ ];
4433
+ const simpleSubset = (sub, dom, options) => {
4434
+ if (sub === dom) return true;
4435
+ if (1 === sub.length && sub[0].semver === ANY) {
4436
+ if (1 === dom.length && dom[0].semver === ANY) return true;
4437
+ sub = options.includePrerelease ? minimumVersionWithPreRelease : minimumVersion;
4438
+ }
4439
+ if (1 === dom.length && dom[0].semver === ANY) {
4440
+ if (options.includePrerelease) return true;
4441
+ dom = minimumVersion;
4442
+ }
4443
+ const eqSet = /* @__PURE__ */ new Set();
4444
+ let gt, lt;
4445
+ for (const c of sub) if (">" === c.operator || ">=" === c.operator) gt = higherGT(gt, c, options);
4446
+ else if ("<" === c.operator || "<=" === c.operator) lt = lowerLT(lt, c, options);
4447
+ else eqSet.add(c.semver);
4448
+ if (eqSet.size > 1) return null;
4449
+ let gtltComp;
4450
+ if (gt && lt) {
4451
+ gtltComp = compare(gt.semver, lt.semver, options);
4452
+ if (gtltComp > 0) return null;
4453
+ if (0 === gtltComp && (">=" !== gt.operator || "<=" !== lt.operator)) return null;
4454
+ }
4455
+ for (const eq of eqSet) {
4456
+ if (gt && !satisfies(eq, String(gt), options)) return null;
4457
+ if (lt && !satisfies(eq, String(lt), options)) return null;
4458
+ for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
4459
+ return true;
4460
+ }
4461
+ let higher, lower;
4462
+ let hasDomLT, hasDomGT;
4463
+ let needDomLTPre = !!lt && !options.includePrerelease && !!lt.semver.prerelease.length && lt.semver;
4464
+ let needDomGTPre = !!gt && !options.includePrerelease && !!gt.semver.prerelease.length && gt.semver;
4465
+ if (needDomLTPre && 1 === needDomLTPre.prerelease.length && "<" === lt.operator && 0 === needDomLTPre.prerelease[0]) needDomLTPre = false;
4466
+ for (const c of dom) {
4467
+ hasDomGT = hasDomGT || ">" === c.operator || ">=" === c.operator;
4468
+ hasDomLT = hasDomLT || "<" === c.operator || "<=" === c.operator;
4469
+ if (gt) {
4470
+ if (needDomGTPre) {
4471
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
4472
+ }
4473
+ if (">" === c.operator || ">=" === c.operator) {
4474
+ higher = higherGT(gt, c, options);
4475
+ if (higher === c && higher !== gt) return false;
4476
+ } else if (">=" === gt.operator && !satisfies(gt.semver, String(c), options)) return false;
4477
+ }
4478
+ if (lt) {
4479
+ if (needDomLTPre) {
4480
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
4481
+ }
4482
+ if ("<" === c.operator || "<=" === c.operator) {
4483
+ lower = lowerLT(lt, c, options);
4484
+ if (lower === c && lower !== lt) return false;
4485
+ } else if ("<=" === lt.operator && !satisfies(lt.semver, String(c), options)) return false;
4486
+ }
4487
+ if (!c.operator && (lt || gt) && 0 !== gtltComp) return false;
4488
+ }
4489
+ if (gt && hasDomLT && !lt && 0 !== gtltComp) return false;
4490
+ if (lt && hasDomGT && !gt && 0 !== gtltComp) return false;
4491
+ if (needDomGTPre || needDomLTPre) return false;
4492
+ return true;
4493
+ };
4494
+ const higherGT = (a, b, options) => {
4495
+ if (!a) return b;
4496
+ const comp = compare(a.semver, b.semver, options);
4497
+ return comp > 0 ? a : comp < 0 ? b : ">" === b.operator && ">=" === a.operator ? b : a;
4498
+ };
4499
+ const lowerLT = (a, b, options) => {
4500
+ if (!a) return b;
4501
+ const comp = compare(a.semver, b.semver, options);
4502
+ return comp < 0 ? a : comp > 0 ? b : "<" === b.operator && "<=" === a.operator ? b : a;
4503
+ };
4504
+ module2.exports = subset;
4505
+ },
4506
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/to-comparators.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4507
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
4508
+ const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
4509
+ module2.exports = toComparators;
4510
+ },
4511
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/valid.js": function(module2, __unused_webpack_exports, __webpack_require__2) {
4512
+ const Range = __webpack_require__2("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js");
4513
+ const validRange = (range, options) => {
4514
+ try {
4515
+ return new Range(range, options).range || "*";
4516
+ } catch (er) {
4517
+ return null;
4518
+ }
4519
+ };
4520
+ module2.exports = validRange;
4521
+ }
4522
+ };
4523
+ var __webpack_module_cache__ = {};
4524
+ function __webpack_require__(moduleId) {
4525
+ var cachedModule = __webpack_module_cache__[moduleId];
4526
+ if (void 0 !== cachedModule) return cachedModule.exports;
4527
+ var module2 = __webpack_module_cache__[moduleId] = {
4528
+ exports: {}
4529
+ };
4530
+ __webpack_modules__[moduleId](module2, module2.exports, __webpack_require__);
4531
+ return module2.exports;
4532
+ }
4533
+ (() => {
4534
+ __webpack_require__.n = function(module2) {
4535
+ var getter = module2 && module2.__esModule ? function() {
4536
+ return module2["default"];
4537
+ } : function() {
4538
+ return module2;
4539
+ };
4540
+ __webpack_require__.d(getter, {
4541
+ a: getter
4542
+ });
4543
+ return getter;
4544
+ };
4545
+ })();
4546
+ (() => {
4547
+ __webpack_require__.d = function(exports2, definition) {
4548
+ for (var key in definition) if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports2, key)) Object.defineProperty(exports2, key, {
4549
+ enumerable: true,
4550
+ get: definition[key]
4551
+ });
4552
+ };
4553
+ })();
4554
+ (() => {
4555
+ __webpack_require__.o = function(obj, prop) {
4556
+ return Object.prototype.hasOwnProperty.call(obj, prop);
4557
+ };
4558
+ })();
4559
+ var isNullable = (value) => null == value;
4560
+ var checkForRollback = (bundles, currentBundleId) => {
4561
+ if (currentBundleId === NIL_UUID) return false;
4562
+ if (0 === bundles.length) return true;
4563
+ const enabled = bundles.find((item) => item.id === currentBundleId)?.enabled;
4564
+ const availableOldVersion = bundles.find((item) => item.id.localeCompare(currentBundleId) < 0 && item.enabled)?.enabled;
4565
+ if (isNullable(enabled)) return Boolean(availableOldVersion);
4566
+ return !enabled;
4567
+ };
4568
+ var semver = __webpack_require__("../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/index.js");
4569
+ var semver_default = /* @__PURE__ */ __webpack_require__.n(semver);
4570
+ var semverSatisfies = (targetAppVersion, currentVersion) => {
4571
+ const currentCoerce = semver_default().coerce(currentVersion);
4572
+ if (!currentCoerce) return false;
4573
+ return semver_default().satisfies(currentCoerce.version, targetAppVersion);
4574
+ };
4575
+ var findLatestBundles = (bundles) => bundles?.filter((item) => item.enabled)?.sort((a, b) => b.id.localeCompare(a.id))?.[0] ?? null;
4576
+ var getUpdateInfo = async (bundles, { platform, bundleId, appVersion }) => {
4577
+ const filteredBundles = bundles.filter((b) => b.platform === platform && semverSatisfies(b.targetAppVersion, appVersion));
4578
+ const isRollback = checkForRollback(filteredBundles, bundleId);
4579
+ const latestBundle = await findLatestBundles(filteredBundles);
4580
+ if (!latestBundle) {
4581
+ if (isRollback) return {
4582
+ id: NIL_UUID,
4583
+ shouldForceUpdate: true,
4584
+ fileUrl: null,
4585
+ fileHash: null,
4586
+ status: "ROLLBACK"
4587
+ };
4588
+ return null;
4589
+ }
4590
+ if (latestBundle.fileUrl) {
4591
+ if (isRollback) {
4592
+ if (latestBundle.id === bundleId) return null;
4593
+ if (latestBundle.id.localeCompare(bundleId) > 0) return {
4594
+ id: latestBundle.id,
4595
+ shouldForceUpdate: Boolean(latestBundle.shouldForceUpdate),
4596
+ fileUrl: latestBundle.fileUrl,
4597
+ fileHash: latestBundle.fileHash,
4598
+ status: "UPDATE"
4599
+ };
4600
+ return {
4601
+ id: latestBundle.id,
4602
+ shouldForceUpdate: true,
4603
+ fileUrl: latestBundle.fileUrl,
4604
+ fileHash: latestBundle.fileHash,
4605
+ status: "ROLLBACK"
4606
+ };
4607
+ }
4608
+ }
4609
+ if (latestBundle.id.localeCompare(bundleId) > 0) return {
4610
+ id: latestBundle.id,
4611
+ shouldForceUpdate: Boolean(latestBundle.shouldForceUpdate),
4612
+ fileUrl: latestBundle.fileUrl,
4613
+ fileHash: latestBundle.fileHash,
4614
+ status: "UPDATE"
4615
+ };
4616
+ return null;
4617
+ };
4618
+ var filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {
4619
+ const compatibleAppVersionList = targetAppVersionList.filter((version) => semverSatisfies(version, currentVersion));
4620
+ return compatibleAppVersionList.sort((a, b) => b.localeCompare(a));
4621
+ };
4622
+
4623
+ // lambda/getUpdateInfo.ts
4624
+ var getS3Json = async (s32, bucket, key) => {
4625
+ try {
4626
+ const command = new import_client_s3.GetObjectCommand({ Bucket: bucket, Key: key });
4627
+ const { Body } = await s32.send(command);
4628
+ if (!Body) {
4629
+ return null;
4630
+ }
4631
+ const jsonString = await Body.transformToString();
4632
+ return JSON.parse(jsonString);
4633
+ } catch {
4634
+ return null;
4635
+ }
4636
+ };
4637
+ var getUpdateInfo2 = async (s32, bucketName, {
4638
+ platform,
4639
+ appVersion,
4640
+ bundleId
4641
+ }) => {
4642
+ const targetAppVersions = await getS3Json(
4643
+ s32,
4644
+ bucketName,
4645
+ `${platform}/target-app-versions.json`
4646
+ );
4647
+ const matchingVersions = filterCompatibleAppVersions(
4648
+ targetAppVersions ?? [],
4649
+ appVersion
4650
+ );
4651
+ const results = await Promise.allSettled(
4652
+ matchingVersions.map(
4653
+ (targetAppVersion) => getS3Json(s32, bucketName, `${platform}/${targetAppVersion}/update.json`)
4654
+ )
4655
+ );
4656
+ const bundles = results.filter(
4657
+ (r) => r.status === "fulfilled"
4658
+ ).flatMap((r) => r.value ?? []);
4659
+ return getUpdateInfo(bundles, {
4660
+ platform,
4661
+ bundleId,
4662
+ appVersion
4663
+ });
4664
+ };
4665
+
4666
+ // lambda/index.ts
4667
+ var s3 = new import_client_s32.S3Client();
4668
+ function parseS3Url(url) {
4669
+ try {
4670
+ const parsedUrl = new URL(url);
4671
+ const { hostname, pathname } = parsedUrl;
4672
+ if (!hostname.includes(".s3.")) return { isS3Url: false };
4673
+ const [bucket] = hostname.split(".s3");
4674
+ const key = pathname.startsWith("/") ? pathname.slice(1) : pathname;
4675
+ return { isS3Url: true, bucket, key };
4676
+ } catch {
4677
+ return { isS3Url: false };
4678
+ }
4679
+ }
4680
+ async function createPresignedUrl(url) {
4681
+ const { isS3Url, bucket, key } = parseS3Url(url);
4682
+ if (!isS3Url || !bucket || !key) {
4683
+ return url;
4684
+ }
4685
+ return getSignedUrl(s3, new import_client_s32.GetObjectCommand({ Bucket: bucket, Key: key }), {
4686
+ expiresIn: 60
4687
+ });
4688
+ }
4689
+ async function signUpdateInfoFileUrl(updateInfo) {
4690
+ if (updateInfo?.fileUrl) {
4691
+ updateInfo.fileUrl = await createPresignedUrl(updateInfo.fileUrl);
4692
+ }
4693
+ return updateInfo;
4694
+ }
4695
+ var app = new Hono2();
4696
+ app.get("/api/check-update", async (c) => {
4697
+ try {
4698
+ const { headers, origin } = c.env.request;
4699
+ let bucketName;
4700
+ if (origin?.s3?.domainName) {
4701
+ const domainName = origin.s3.domainName;
4702
+ [bucketName] = domainName.split(".s3");
4703
+ }
4704
+ if (!bucketName) {
4705
+ return c.json({ error: "Bucket name not found." }, 500);
4706
+ }
4707
+ const bundleId = headers["x-bundle-id"]?.[0]?.value;
4708
+ const appPlatform = headers["x-app-platform"]?.[0]?.value;
4709
+ const appVersion = headers["x-app-version"]?.[0]?.value;
4710
+ if (!bundleId || !appPlatform || !appVersion) {
4711
+ return c.json({ error: "Missing required headers." }, 400);
4712
+ }
4713
+ const updateInfo = await getUpdateInfo2(s3, bucketName, {
4714
+ platform: appPlatform,
4715
+ bundleId,
4716
+ appVersion
4717
+ });
4718
+ if (!updateInfo) {
4719
+ return c.json(null);
4720
+ }
4721
+ const finalInfo = await signUpdateInfoFileUrl(updateInfo);
4722
+ return c.json(finalInfo);
4723
+ } catch {
4724
+ return c.json({ error: "Internal Server Error" }, 500);
4725
+ }
4726
+ });
4727
+ app.get("*", async (c) => {
4728
+ c.env.callback(null, c.env.request);
4729
+ });
4730
+ var handler = handle(app);
4731
+ // Annotate the CommonJS export names for ESM import in node:
4732
+ 0 && (module.exports = {
4733
+ handler
4734
+ });