@hot-updater/cloudflare 0.36.12 → 0.36.14

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.
@@ -2,7 +2,7 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/_internal/utils.mjs", "../../../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/perf_hooks/performance.mjs", "../../../../node_modules/.pnpm/@cloudflare+unenv-preset@2.16.1_unenv@2.0.0-rc.24_workerd@1.20260609.1/node_modules/@cloudflare/unenv-preset/dist/runtime/polyfill/performance.mjs", "../../../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/console.mjs", "../../../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/mock/noop.mjs", "../../../../node_modules/.pnpm/@cloudflare+unenv-preset@2.16.1_unenv@2.0.0-rc.24_workerd@1.20260609.1/node_modules/@cloudflare/unenv-preset/dist/runtime/node/console.mjs", "../../../../node_modules/.pnpm/wrangler@4.99.0_@cloudflare+workers-types@4.20260611.1/node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-console", "../../../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/process/hrtime.mjs", "../../../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/process/process.mjs", "../../../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/tty/read-stream.mjs", "../../../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/tty/write-stream.mjs", "../../../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/process/node-version.mjs", "../../../../node_modules/.pnpm/@cloudflare+unenv-preset@2.16.1_unenv@2.0.0-rc.24_workerd@1.20260609.1/node_modules/@cloudflare/unenv-preset/dist/runtime/node/process.mjs", "../../../../node_modules/.pnpm/wrangler@4.99.0_@cloudflare+workers-types@4.20260611.1/node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-process", "../../../plugin-core/dist/calculatePagination.mjs", "../../../plugin-core/dist/contentAddressedAssets.mjs", "../../../plugin-core/dist/legacyAssetStorageLayout.mjs", "../../../plugin-core/dist/assetStorageLayout.mjs", "../../../plugin-core/dist/queryBundles.mjs", "../../../plugin-core/dist/bundleUnitOfWork.mjs", "../../../plugin-core/dist/bundleUnitOfWorkStore.mjs", "../../../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs", "../../../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs", "../../../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/object/mergeWith.mjs", "../../../plugin-core/dist/createDatabasePlugin.mjs", "../../../../node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.js", "../../../plugin-core/dist/semverSatisfies.mjs", "../../../plugin-core/dist/filterCompatibleAppVersions.mjs", "../../../plugin-core/dist/requestUpdateBundleState.mjs", "../../../../packages/core/dist/index.mjs", "../../../js/dist/index.mjs", "../../../plugin-core/dist/resolveUpdateInfoFromBundles.mjs", "../../../plugin-core/dist/createStoragePlugin.mjs", "../../../plugin-core/dist/parseStorageUri.mjs", "../../../plugin-core/dist/storageProfile.mjs", "../../../../packages/server/dist/package.mjs", "../../../../packages/server/dist/version.mjs", "../../../../packages/server/dist/internalRouter.mjs", "../../../../packages/server/dist/handler.mjs", "../../../../packages/server/dist/db/schemaEnhancements.mjs", "../../../../packages/server/dist/db/updateArtifacts.mjs", "../../../../packages/server/dist/db/pluginCore.mjs", "../../../../packages/server/dist/schema/types.mjs", "../../../../packages/server/dist/db/schemaReadiness.mjs", "../../../../packages/server/dist/db/types.mjs", "../../../../packages/server/dist/route.mjs", "../../../../packages/server/dist/storageAccess.mjs", "../../../../packages/server/dist/createHotUpdaterCore.mjs", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/compose.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/request/constants.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/utils/buffer.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/utils/body.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/utils/url.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/request.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/utils/html.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/context.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/router.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/utils/constants.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/hono-base.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/router/reg-exp-router/matcher.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/router/reg-exp-router/node.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/router/reg-exp-router/trie.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/router/reg-exp-router/router.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/router/smart-router/router.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/router/trie-router/node.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/router/trie-router/router.js", "../../../../node_modules/.pnpm/hono@4.12.34/node_modules/hono/dist/hono.js", "../../src/cloudflareWorkerDatabase.ts", "../../src/r2WorkerStorage.ts", "../../src/worker/index.ts", "../src/index.ts"],
4
4
  "sourceRoot": "./worker/dist",
5
- "sourcesContent": ["/* @__NO_SIDE_EFFECTS__ */\nexport function rawHeaders(headers) {\n\tconst rawHeaders = [];\n\tfor (const key in headers) {\n\t\tif (Array.isArray(headers[key])) {\n\t\t\tfor (const h of headers[key]) {\n\t\t\t\trawHeaders.push(key, h);\n\t\t\t}\n\t\t} else {\n\t\t\trawHeaders.push(key, headers[key]);\n\t\t}\n\t}\n\treturn rawHeaders;\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function mergeFns(...functions) {\n\treturn function(...args) {\n\t\tfor (const fn of functions) {\n\t\t\tfn(...args);\n\t\t}\n\t};\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function createNotImplementedError(name) {\n\treturn new Error(`[unenv] ${name} is not implemented yet!`);\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function notImplemented(name) {\n\tconst fn = () => {\n\t\tthrow createNotImplementedError(name);\n\t};\n\treturn Object.assign(fn, { __unenv__: true });\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function notImplementedAsync(name) {\n\tconst fn = notImplemented(name);\n\tfn.__promisify__ = () => notImplemented(name + \".__promisify__\");\n\tfn.native = fn;\n\treturn fn;\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function notImplementedClass(name) {\n\treturn class {\n\t\t__unenv__ = true;\n\t\tconstructor() {\n\t\t\tthrow new Error(`[unenv] ${name} is not implemented yet!`);\n\t\t}\n\t};\n}\n", "import { createNotImplementedError } from \"../../../_internal/utils.mjs\";\nconst _timeOrigin = globalThis.performance?.timeOrigin ?? Date.now();\nconst _performanceNow = globalThis.performance?.now ? globalThis.performance.now.bind(globalThis.performance) : () => Date.now() - _timeOrigin;\nconst nodeTiming = {\n\tname: \"node\",\n\tentryType: \"node\",\n\tstartTime: 0,\n\tduration: 0,\n\tnodeStart: 0,\n\tv8Start: 0,\n\tbootstrapComplete: 0,\n\tenvironment: 0,\n\tloopStart: 0,\n\tloopExit: 0,\n\tidleTime: 0,\n\tuvMetricsInfo: {\n\t\tloopCount: 0,\n\t\tevents: 0,\n\t\teventsWaiting: 0\n\t},\n\tdetail: undefined,\n\ttoJSON() {\n\t\treturn this;\n\t}\n};\n// PerformanceEntry\nexport class PerformanceEntry {\n\t__unenv__ = true;\n\tdetail;\n\tentryType = \"event\";\n\tname;\n\tstartTime;\n\tconstructor(name, options) {\n\t\tthis.name = name;\n\t\tthis.startTime = options?.startTime || _performanceNow();\n\t\tthis.detail = options?.detail;\n\t}\n\tget duration() {\n\t\treturn _performanceNow() - this.startTime;\n\t}\n\ttoJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tentryType: this.entryType,\n\t\t\tstartTime: this.startTime,\n\t\t\tduration: this.duration,\n\t\t\tdetail: this.detail\n\t\t};\n\t}\n}\n// PerformanceMark\nexport const PerformanceMark = class PerformanceMark extends PerformanceEntry {\n\tentryType = \"mark\";\n\tconstructor() {\n\t\t// @ts-ignore\n\t\tsuper(...arguments);\n\t}\n\tget duration() {\n\t\treturn 0;\n\t}\n};\n// PerformanceMark\nexport class PerformanceMeasure extends PerformanceEntry {\n\tentryType = \"measure\";\n}\n// PerformanceResourceTiming\nexport class PerformanceResourceTiming extends PerformanceEntry {\n\tentryType = \"resource\";\n\tserverTiming = [];\n\tconnectEnd = 0;\n\tconnectStart = 0;\n\tdecodedBodySize = 0;\n\tdomainLookupEnd = 0;\n\tdomainLookupStart = 0;\n\tencodedBodySize = 0;\n\tfetchStart = 0;\n\tinitiatorType = \"\";\n\tname = \"\";\n\tnextHopProtocol = \"\";\n\tredirectEnd = 0;\n\tredirectStart = 0;\n\trequestStart = 0;\n\tresponseEnd = 0;\n\tresponseStart = 0;\n\tsecureConnectionStart = 0;\n\tstartTime = 0;\n\ttransferSize = 0;\n\tworkerStart = 0;\n\tresponseStatus = 0;\n}\n// PerformanceObserverEntryList\nexport class PerformanceObserverEntryList {\n\t__unenv__ = true;\n\tgetEntries() {\n\t\treturn [];\n\t}\n\tgetEntriesByName(_name, _type) {\n\t\treturn [];\n\t}\n\tgetEntriesByType(type) {\n\t\treturn [];\n\t}\n}\n// Performance\nexport class Performance {\n\t__unenv__ = true;\n\ttimeOrigin = _timeOrigin;\n\teventCounts = new Map();\n\t_entries = [];\n\t_resourceTimingBufferSize = 0;\n\tnavigation = undefined;\n\ttiming = undefined;\n\ttimerify(_fn, _options) {\n\t\tthrow createNotImplementedError(\"Performance.timerify\");\n\t}\n\tget nodeTiming() {\n\t\treturn nodeTiming;\n\t}\n\teventLoopUtilization() {\n\t\treturn {};\n\t}\n\tmarkResourceTiming() {\n\t\t// TODO: create a new PerformanceResourceTiming entry\n\t\t// so that performance.getEntries, getEntriesByName, and getEntriesByType return it\n\t\t// see: https://nodejs.org/api/perf_hooks.html#performancemarkresourcetimingtiminginfo-requestedurl-initiatortype-global-cachemode-bodyinfo-responsestatus-deliverytype\n\t\treturn new PerformanceResourceTiming(\"\");\n\t}\n\tonresourcetimingbufferfull = null;\n\tnow() {\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Performance/now\n\t\tif (this.timeOrigin === _timeOrigin) {\n\t\t\treturn _performanceNow();\n\t\t}\n\t\treturn Date.now() - this.timeOrigin;\n\t}\n\tclearMarks(markName) {\n\t\tthis._entries = markName ? this._entries.filter((e) => e.name !== markName) : this._entries.filter((e) => e.entryType !== \"mark\");\n\t}\n\tclearMeasures(measureName) {\n\t\tthis._entries = measureName ? this._entries.filter((e) => e.name !== measureName) : this._entries.filter((e) => e.entryType !== \"measure\");\n\t}\n\tclearResourceTimings() {\n\t\tthis._entries = this._entries.filter((e) => e.entryType !== \"resource\" || e.entryType !== \"navigation\");\n\t}\n\tgetEntries() {\n\t\treturn this._entries;\n\t}\n\tgetEntriesByName(name, type) {\n\t\treturn this._entries.filter((e) => e.name === name && (!type || e.entryType === type));\n\t}\n\tgetEntriesByType(type) {\n\t\treturn this._entries.filter((e) => e.entryType === type);\n\t}\n\tmark(name, options) {\n\t\t// @ts-expect-error constructor is not protected\n\t\tconst entry = new PerformanceMark(name, options);\n\t\tthis._entries.push(entry);\n\t\treturn entry;\n\t}\n\tmeasure(measureName, startOrMeasureOptions, endMark) {\n\t\tlet start;\n\t\tlet end;\n\t\tif (typeof startOrMeasureOptions === \"string\") {\n\t\t\tstart = this.getEntriesByName(startOrMeasureOptions, \"mark\")[0]?.startTime;\n\t\t\tend = this.getEntriesByName(endMark, \"mark\")[0]?.startTime;\n\t\t} else {\n\t\t\tstart = Number.parseFloat(startOrMeasureOptions?.start) || this.now();\n\t\t\tend = Number.parseFloat(startOrMeasureOptions?.end) || this.now();\n\t\t}\n\t\tconst entry = new PerformanceMeasure(measureName, {\n\t\t\tstartTime: start,\n\t\t\tdetail: {\n\t\t\t\tstart,\n\t\t\t\tend\n\t\t\t}\n\t\t});\n\t\tthis._entries.push(entry);\n\t\treturn entry;\n\t}\n\tsetResourceTimingBufferSize(maxSize) {\n\t\tthis._resourceTimingBufferSize = maxSize;\n\t}\n\taddEventListener(type, listener, options) {\n\t\tthrow createNotImplementedError(\"Performance.addEventListener\");\n\t}\n\tremoveEventListener(type, listener, options) {\n\t\tthrow createNotImplementedError(\"Performance.removeEventListener\");\n\t}\n\tdispatchEvent(event) {\n\t\tthrow createNotImplementedError(\"Performance.dispatchEvent\");\n\t}\n\ttoJSON() {\n\t\treturn this;\n\t}\n}\n// PerformanceObserver\nexport class PerformanceObserver {\n\t__unenv__ = true;\n\tstatic supportedEntryTypes = [];\n\t_callback = null;\n\tconstructor(callback) {\n\t\tthis._callback = callback;\n\t}\n\ttakeRecords() {\n\t\treturn [];\n\t}\n\tdisconnect() {\n\t\tthrow createNotImplementedError(\"PerformanceObserver.disconnect\");\n\t}\n\tobserve(options) {\n\t\tthrow createNotImplementedError(\"PerformanceObserver.observe\");\n\t}\n\tbind(fn) {\n\t\treturn fn;\n\t}\n\trunInAsyncScope(fn, thisArg, ...args) {\n\t\treturn fn.call(thisArg, ...args);\n\t}\n\tasyncId() {\n\t\treturn 0;\n\t}\n\ttriggerAsyncId() {\n\t\treturn 0;\n\t}\n\temitDestroy() {\n\t\treturn this;\n\t}\n}\n// workerd implements a subset of globalThis.performance (as of last check, only timeOrigin set to 0 + now() implemented)\n// We already use performance.now() from globalThis.performance, if provided (see top of this file)\n// If we detect this condition, we can just use polyfill instead.\nexport const performance = globalThis.performance && \"addEventListener\" in globalThis.performance ? globalThis.performance : new Performance();\n", "import {\n performance,\n Performance,\n PerformanceEntry,\n PerformanceMark,\n PerformanceMeasure,\n PerformanceObserver,\n PerformanceObserverEntryList,\n PerformanceResourceTiming\n} from \"node:perf_hooks\";\nif (!(\"__unenv__\" in performance)) {\n const proto = Performance.prototype;\n for (const key of Object.getOwnPropertyNames(proto)) {\n if (key !== \"constructor\" && !(key in performance)) {\n const desc = Object.getOwnPropertyDescriptor(proto, key);\n if (desc) {\n Object.defineProperty(performance, key, desc);\n }\n }\n }\n}\nglobalThis.performance = performance;\nglobalThis.Performance = Performance;\nglobalThis.PerformanceEntry = PerformanceEntry;\nglobalThis.PerformanceMark = PerformanceMark;\nglobalThis.PerformanceMeasure = PerformanceMeasure;\nglobalThis.PerformanceObserver = PerformanceObserver;\nglobalThis.PerformanceObserverEntryList = PerformanceObserverEntryList;\nglobalThis.PerformanceResourceTiming = PerformanceResourceTiming;\n", "import { Writable } from \"node:stream\";\nimport noop from \"../mock/noop.mjs\";\nimport { notImplemented, notImplementedClass } from \"../_internal/utils.mjs\";\nconst _console = globalThis.console;\n// undocumented public APIs\nexport const _ignoreErrors = true;\nexport const _stderr = new Writable();\nexport const _stdout = new Writable();\nexport const log = _console?.log ?? noop;\nexport const info = _console?.info ?? log;\nexport const trace = _console?.trace ?? info;\nexport const debug = _console?.debug ?? log;\nexport const table = _console?.table ?? log;\nexport const error = _console?.error ?? log;\nexport const warn = _console?.warn ?? error;\n// https://developer.chrome.com/docs/devtools/console/api#createtask\nexport const createTask = _console?.createTask ?? /* @__PURE__ */ notImplemented(\"console.createTask\");\nexport const assert = /* @__PURE__ */ notImplemented(\"console.assert\");\n// noop\nexport const clear = _console?.clear ?? noop;\nexport const count = _console?.count ?? noop;\nexport const countReset = _console?.countReset ?? noop;\nexport const dir = _console?.dir ?? noop;\nexport const dirxml = _console?.dirxml ?? noop;\nexport const group = _console?.group ?? noop;\nexport const groupEnd = _console?.groupEnd ?? noop;\nexport const groupCollapsed = _console?.groupCollapsed ?? noop;\nexport const profile = _console?.profile ?? noop;\nexport const profileEnd = _console?.profileEnd ?? noop;\nexport const time = _console?.time ?? noop;\nexport const timeEnd = _console?.timeEnd ?? noop;\nexport const timeLog = _console?.timeLog ?? noop;\nexport const timeStamp = _console?.timeStamp ?? noop;\nexport const Console = _console?.Console ?? /* @__PURE__ */ notImplementedClass(\"console.Console\");\nexport const _times = /* @__PURE__ */ new Map();\nexport function context() {\n\t// TODO: Should be Console with all the methods\n\treturn _console;\n}\nexport const _stdoutErrorHandler = noop;\nexport const _stderrErrorHandler = noop;\nexport default {\n\t_times,\n\t_ignoreErrors,\n\t_stdoutErrorHandler,\n\t_stderrErrorHandler,\n\t_stdout,\n\t_stderr,\n\tassert,\n\tclear,\n\tConsole,\n\tcount,\n\tcountReset,\n\tdebug,\n\tdir,\n\tdirxml,\n\terror,\n\tcontext,\n\tcreateTask,\n\tgroup,\n\tgroupEnd,\n\tgroupCollapsed,\n\tinfo,\n\tlog,\n\tprofile,\n\tprofileEnd,\n\ttable,\n\ttime,\n\ttimeEnd,\n\ttimeLog,\n\ttimeStamp,\n\ttrace,\n\twarn\n};\n", "export default Object.assign(() => {}, { __unenv__: true });\n", "import {\n _ignoreErrors,\n _stderr,\n _stderrErrorHandler,\n _stdout,\n _stdoutErrorHandler,\n _times,\n Console\n} from \"unenv/node/console\";\nexport {\n Console,\n _ignoreErrors,\n _stderr,\n _stderrErrorHandler,\n _stdout,\n _stdoutErrorHandler,\n _times\n} from \"unenv/node/console\";\nconst workerdConsole = globalThis[\"console\"];\nexport const {\n assert,\n clear,\n // @ts-expect-error undocumented public API\n context,\n count,\n countReset,\n // @ts-expect-error undocumented public API\n createTask,\n debug,\n dir,\n dirxml,\n error,\n group,\n groupCollapsed,\n groupEnd,\n info,\n log,\n profile,\n profileEnd,\n table,\n time,\n timeEnd,\n timeLog,\n timeStamp,\n trace,\n warn\n} = workerdConsole;\nObject.assign(workerdConsole, {\n Console,\n _ignoreErrors,\n _stderr,\n _stderrErrorHandler,\n _stdout,\n _stdoutErrorHandler,\n _times\n});\nexport default workerdConsole;\n", "import { default as defaultExport } from \"@cloudflare/unenv-preset/node/console\";\nglobalThis.console = defaultExport;", "// https://nodejs.org/api/process.html#processhrtime\nexport const hrtime = /* @__PURE__ */ Object.assign(function hrtime(startTime) {\n\tconst now = Date.now();\n\t// millis to seconds\n\tconst seconds = Math.trunc(now / 1e3);\n\t// convert millis to nanos\n\tconst nanos = now % 1e3 * 1e6;\n\tif (startTime) {\n\t\tlet diffSeconds = seconds - startTime[0];\n\t\tlet diffNanos = nanos - startTime[0];\n\t\tif (diffNanos < 0) {\n\t\t\tdiffSeconds = diffSeconds - 1;\n\t\t\tdiffNanos = 1e9 + diffNanos;\n\t\t}\n\t\treturn [diffSeconds, diffNanos];\n\t}\n\treturn [seconds, nanos];\n}, { bigint: function bigint() {\n\t// Convert milliseconds to nanoseconds\n\treturn BigInt(Date.now() * 1e6);\n} });\n", "import { EventEmitter } from \"node:events\";\nimport { ReadStream, WriteStream } from \"node:tty\";\nimport { notImplemented, createNotImplementedError } from \"../../../_internal/utils.mjs\";\n// node-version.ts is generated at build time\nimport { NODE_VERSION } from \"./node-version.mjs\";\nexport class Process extends EventEmitter {\n\tenv;\n\thrtime;\n\tnextTick;\n\tconstructor(impl) {\n\t\tsuper();\n\t\tthis.env = impl.env;\n\t\tthis.hrtime = impl.hrtime;\n\t\tthis.nextTick = impl.nextTick;\n\t\tfor (const prop of [...Object.getOwnPropertyNames(Process.prototype), ...Object.getOwnPropertyNames(EventEmitter.prototype)]) {\n\t\t\tconst value = this[prop];\n\t\t\tif (typeof value === \"function\") {\n\t\t\t\tthis[prop] = value.bind(this);\n\t\t\t}\n\t\t}\n\t}\n\t// --- event emitter ---\n\temitWarning(warning, type, code) {\n\t\tconsole.warn(`${code ? `[${code}] ` : \"\"}${type ? `${type}: ` : \"\"}${warning}`);\n\t}\n\temit(...args) {\n\t\t// @ts-ignore\n\t\treturn super.emit(...args);\n\t}\n\tlisteners(eventName) {\n\t\treturn super.listeners(eventName);\n\t}\n\t// --- stdio (lazy initializers) ---\n\t#stdin;\n\t#stdout;\n\t#stderr;\n\tget stdin() {\n\t\treturn this.#stdin ??= new ReadStream(0);\n\t}\n\tget stdout() {\n\t\treturn this.#stdout ??= new WriteStream(1);\n\t}\n\tget stderr() {\n\t\treturn this.#stderr ??= new WriteStream(2);\n\t}\n\t// --- cwd ---\n\t#cwd = \"/\";\n\tchdir(cwd) {\n\t\tthis.#cwd = cwd;\n\t}\n\tcwd() {\n\t\treturn this.#cwd;\n\t}\n\t// --- dummy props and getters ---\n\tarch = \"\";\n\tplatform = \"\";\n\targv = [];\n\targv0 = \"\";\n\texecArgv = [];\n\texecPath = \"\";\n\ttitle = \"\";\n\tpid = 200;\n\tppid = 100;\n\tget version() {\n\t\treturn `v${NODE_VERSION}`;\n\t}\n\tget versions() {\n\t\treturn { node: NODE_VERSION };\n\t}\n\tget allowedNodeEnvironmentFlags() {\n\t\treturn new Set();\n\t}\n\tget sourceMapsEnabled() {\n\t\treturn false;\n\t}\n\tget debugPort() {\n\t\treturn 0;\n\t}\n\tget throwDeprecation() {\n\t\treturn false;\n\t}\n\tget traceDeprecation() {\n\t\treturn false;\n\t}\n\tget features() {\n\t\treturn {};\n\t}\n\tget release() {\n\t\treturn {};\n\t}\n\tget connected() {\n\t\treturn false;\n\t}\n\tget config() {\n\t\treturn {};\n\t}\n\tget moduleLoadList() {\n\t\treturn [];\n\t}\n\tconstrainedMemory() {\n\t\treturn 0;\n\t}\n\tavailableMemory() {\n\t\treturn 0;\n\t}\n\tuptime() {\n\t\treturn 0;\n\t}\n\tresourceUsage() {\n\t\treturn {};\n\t}\n\t// --- noop methods ---\n\tref() {\n\t\t// noop\n\t}\n\tunref() {\n\t\t// noop\n\t}\n\t// --- unimplemented methods ---\n\tumask() {\n\t\tthrow createNotImplementedError(\"process.umask\");\n\t}\n\tgetBuiltinModule() {\n\t\treturn undefined;\n\t}\n\tgetActiveResourcesInfo() {\n\t\tthrow createNotImplementedError(\"process.getActiveResourcesInfo\");\n\t}\n\texit() {\n\t\tthrow createNotImplementedError(\"process.exit\");\n\t}\n\treallyExit() {\n\t\tthrow createNotImplementedError(\"process.reallyExit\");\n\t}\n\tkill() {\n\t\tthrow createNotImplementedError(\"process.kill\");\n\t}\n\tabort() {\n\t\tthrow createNotImplementedError(\"process.abort\");\n\t}\n\tdlopen() {\n\t\tthrow createNotImplementedError(\"process.dlopen\");\n\t}\n\tsetSourceMapsEnabled() {\n\t\tthrow createNotImplementedError(\"process.setSourceMapsEnabled\");\n\t}\n\tloadEnvFile() {\n\t\tthrow createNotImplementedError(\"process.loadEnvFile\");\n\t}\n\tdisconnect() {\n\t\tthrow createNotImplementedError(\"process.disconnect\");\n\t}\n\tcpuUsage() {\n\t\tthrow createNotImplementedError(\"process.cpuUsage\");\n\t}\n\tsetUncaughtExceptionCaptureCallback() {\n\t\tthrow createNotImplementedError(\"process.setUncaughtExceptionCaptureCallback\");\n\t}\n\thasUncaughtExceptionCaptureCallback() {\n\t\tthrow createNotImplementedError(\"process.hasUncaughtExceptionCaptureCallback\");\n\t}\n\tinitgroups() {\n\t\tthrow createNotImplementedError(\"process.initgroups\");\n\t}\n\topenStdin() {\n\t\tthrow createNotImplementedError(\"process.openStdin\");\n\t}\n\tassert() {\n\t\tthrow createNotImplementedError(\"process.assert\");\n\t}\n\tbinding() {\n\t\tthrow createNotImplementedError(\"process.binding\");\n\t}\n\t// --- attached interfaces ---\n\tpermission = { has: /* @__PURE__ */ notImplemented(\"process.permission.has\") };\n\treport = {\n\t\tdirectory: \"\",\n\t\tfilename: \"\",\n\t\tsignal: \"SIGUSR2\",\n\t\tcompact: false,\n\t\treportOnFatalError: false,\n\t\treportOnSignal: false,\n\t\treportOnUncaughtException: false,\n\t\tgetReport: /* @__PURE__ */ notImplemented(\"process.report.getReport\"),\n\t\twriteReport: /* @__PURE__ */ notImplemented(\"process.report.writeReport\")\n\t};\n\tfinalization = {\n\t\tregister: /* @__PURE__ */ notImplemented(\"process.finalization.register\"),\n\t\tunregister: /* @__PURE__ */ notImplemented(\"process.finalization.unregister\"),\n\t\tregisterBeforeExit: /* @__PURE__ */ notImplemented(\"process.finalization.registerBeforeExit\")\n\t};\n\tmemoryUsage = Object.assign(() => ({\n\t\tarrayBuffers: 0,\n\t\trss: 0,\n\t\texternal: 0,\n\t\theapTotal: 0,\n\t\theapUsed: 0\n\t}), { rss: () => 0 });\n\t// --- undefined props ---\n\tmainModule = undefined;\n\tdomain = undefined;\n\t// optional\n\tsend = undefined;\n\texitCode = undefined;\n\tchannel = undefined;\n\tgetegid = undefined;\n\tgeteuid = undefined;\n\tgetgid = undefined;\n\tgetgroups = undefined;\n\tgetuid = undefined;\n\tsetegid = undefined;\n\tseteuid = undefined;\n\tsetgid = undefined;\n\tsetgroups = undefined;\n\tsetuid = undefined;\n\t// internals\n\t_events = undefined;\n\t_eventsCount = undefined;\n\t_exiting = undefined;\n\t_maxListeners = undefined;\n\t_debugEnd = undefined;\n\t_debugProcess = undefined;\n\t_fatalException = undefined;\n\t_getActiveHandles = undefined;\n\t_getActiveRequests = undefined;\n\t_kill = undefined;\n\t_preload_modules = undefined;\n\t_rawDebug = undefined;\n\t_startProfilerIdleNotifier = undefined;\n\t_stopProfilerIdleNotifier = undefined;\n\t_tickCallback = undefined;\n\t_disconnect = undefined;\n\t_handleQueue = undefined;\n\t_pendingMessage = undefined;\n\t_channel = undefined;\n\t_send = undefined;\n\t_linkedBinding = undefined;\n}\n", "export class ReadStream {\n\tfd;\n\tisRaw = false;\n\tisTTY = false;\n\tconstructor(fd) {\n\t\tthis.fd = fd;\n\t}\n\tsetRawMode(mode) {\n\t\tthis.isRaw = mode;\n\t\treturn this;\n\t}\n}\n", "export class WriteStream {\n\tfd;\n\tcolumns = 80;\n\trows = 24;\n\tisTTY = false;\n\tconstructor(fd) {\n\t\tthis.fd = fd;\n\t}\n\tclearLine(dir, callback) {\n\t\tcallback && callback();\n\t\treturn false;\n\t}\n\tclearScreenDown(callback) {\n\t\tcallback && callback();\n\t\treturn false;\n\t}\n\tcursorTo(x, y, callback) {\n\t\tcallback && typeof callback === \"function\" && callback();\n\t\treturn false;\n\t}\n\tmoveCursor(dx, dy, callback) {\n\t\tcallback && callback();\n\t\treturn false;\n\t}\n\tgetColorDepth(env) {\n\t\treturn 1;\n\t}\n\thasColors(count, env) {\n\t\treturn false;\n\t}\n\tgetWindowSize() {\n\t\treturn [this.columns, this.rows];\n\t}\n\twrite(str, encoding, cb) {\n\t\tif (str instanceof Uint8Array) {\n\t\t\tstr = new TextDecoder().decode(str);\n\t\t}\n\t\ttry {\n\t\t\tconsole.log(str);\n\t\t} catch {}\n\t\tcb && typeof cb === \"function\" && cb();\n\t\treturn false;\n\t}\n}\n", "// Extracted from .nvmrc\nexport const NODE_VERSION = \"22.14.0\";\n", "import { hrtime as UnenvHrTime } from \"unenv/node/internal/process/hrtime\";\nimport { Process as UnenvProcess } from \"unenv/node/internal/process/process\";\nconst globalProcess = globalThis[\"process\"];\nexport const getBuiltinModule = globalProcess.getBuiltinModule;\nconst workerdProcess = getBuiltinModule(\"node:process\");\nconst unenvProcess = new UnenvProcess({\n env: globalProcess.env,\n hrtime: UnenvHrTime,\n // `nextTick` is available from workerd process v1\n nextTick: workerdProcess.nextTick\n});\nexport const { exit, features, platform } = workerdProcess;\nexport const {\n _channel,\n _debugEnd,\n _debugProcess,\n _disconnect,\n _events,\n _eventsCount,\n _exiting,\n _fatalException,\n _getActiveHandles,\n _getActiveRequests,\n _handleQueue,\n _kill,\n _linkedBinding,\n _maxListeners,\n _pendingMessage,\n _preload_modules,\n _rawDebug,\n _send,\n _startProfilerIdleNotifier,\n _stopProfilerIdleNotifier,\n _tickCallback,\n abort,\n addListener,\n allowedNodeEnvironmentFlags,\n arch,\n argv,\n argv0,\n assert,\n availableMemory,\n binding,\n channel,\n chdir,\n config,\n connected,\n constrainedMemory,\n cpuUsage,\n cwd,\n debugPort,\n disconnect,\n dlopen,\n domain,\n emit,\n emitWarning,\n env,\n eventNames,\n execArgv,\n execPath,\n exitCode,\n finalization,\n getActiveResourcesInfo,\n getegid,\n geteuid,\n getgid,\n getgroups,\n getMaxListeners,\n getuid,\n hasUncaughtExceptionCaptureCallback,\n hrtime,\n initgroups,\n kill,\n listenerCount,\n listeners,\n loadEnvFile,\n mainModule,\n memoryUsage,\n moduleLoadList,\n nextTick,\n off,\n on,\n once,\n openStdin,\n permission,\n pid,\n ppid,\n prependListener,\n prependOnceListener,\n rawListeners,\n reallyExit,\n ref,\n release,\n removeAllListeners,\n removeListener,\n report,\n resourceUsage,\n send,\n setegid,\n seteuid,\n setgid,\n setgroups,\n setMaxListeners,\n setSourceMapsEnabled,\n setuid,\n setUncaughtExceptionCaptureCallback,\n sourceMapsEnabled,\n stderr,\n stdin,\n stdout,\n throwDeprecation,\n title,\n traceDeprecation,\n umask,\n unref,\n uptime,\n version,\n versions\n} = unenvProcess;\nconst _process = {\n abort,\n addListener,\n allowedNodeEnvironmentFlags,\n hasUncaughtExceptionCaptureCallback,\n setUncaughtExceptionCaptureCallback,\n loadEnvFile,\n sourceMapsEnabled,\n arch,\n argv,\n argv0,\n chdir,\n config,\n connected,\n constrainedMemory,\n availableMemory,\n cpuUsage,\n cwd,\n debugPort,\n dlopen,\n disconnect,\n emit,\n emitWarning,\n env,\n eventNames,\n execArgv,\n execPath,\n exit,\n finalization,\n features,\n getBuiltinModule,\n getActiveResourcesInfo,\n getMaxListeners,\n hrtime,\n kill,\n listeners,\n listenerCount,\n memoryUsage,\n nextTick,\n on,\n off,\n once,\n pid,\n platform,\n ppid,\n prependListener,\n prependOnceListener,\n rawListeners,\n release,\n removeAllListeners,\n removeListener,\n report,\n resourceUsage,\n setMaxListeners,\n setSourceMapsEnabled,\n stderr,\n stdin,\n stdout,\n title,\n throwDeprecation,\n traceDeprecation,\n umask,\n uptime,\n version,\n versions,\n // @ts-expect-error old API\n domain,\n initgroups,\n moduleLoadList,\n reallyExit,\n openStdin,\n assert,\n binding,\n send,\n exitCode,\n channel,\n getegid,\n geteuid,\n getgid,\n getgroups,\n getuid,\n setegid,\n seteuid,\n setgid,\n setgroups,\n setuid,\n permission,\n mainModule,\n _events,\n _eventsCount,\n _exiting,\n _maxListeners,\n _debugEnd,\n _debugProcess,\n _fatalException,\n _getActiveHandles,\n _getActiveRequests,\n _kill,\n _preload_modules,\n _rawDebug,\n _startProfilerIdleNotifier,\n _stopProfilerIdleNotifier,\n _tickCallback,\n _disconnect,\n _handleQueue,\n _pendingMessage,\n _channel,\n _send,\n _linkedBinding\n};\nexport default _process;\n", "import { default as defaultExport } from \"@cloudflare/unenv-preset/node/process\";\nglobalThis.process = defaultExport;", "//#region src/calculatePagination.ts\n/**\n* Calculate pagination information based on total count, limit, and offset\n*/\nfunction calculatePagination(total, options) {\n\tconst { limit, offset } = options;\n\tif (total === 0) return {\n\t\ttotal: 0,\n\t\thasNextPage: false,\n\t\thasPreviousPage: false,\n\t\tcurrentPage: 1,\n\t\ttotalPages: 0\n\t};\n\tconst currentPage = Math.floor(offset / limit) + 1;\n\tconst totalPages = Math.ceil(total / limit);\n\treturn {\n\t\ttotal,\n\t\thasNextPage: offset + limit < total,\n\t\thasPreviousPage: offset > 0,\n\t\tcurrentPage,\n\t\ttotalPages\n\t};\n}\n//#endregion\nexport { calculatePagination };\n", "//#region src/contentAddressedAssets.ts\nconst CONTENT_ADDRESSED_ASSET_PREFIX = \"assets\";\nconst getContentAddressedAssetStoragePath = ({ assetPath, fileHash }) => {\n\tconst extension = assetPath.endsWith(\".br\") ? \".br\" : assetPath.includes(\".\") ? `.${assetPath.split(\".\").pop()}` : \"\";\n\treturn `sha256/${fileHash.slice(0, 2)}/${fileHash}${extension}`;\n};\n//#endregion\nexport { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath };\n", "//#region src/legacyAssetStorageLayout.ts\n/**\n* @internal\n*\n* Legacy manifest assets were stored below each bundle's `/files` directory\n* using their manifest-relative path. Keep all old-layout path decisions here\n* so support can be removed by deleting this module and the entrypoint branch\n* that imports it.\n*/\nconst getLegacyManifestAssetStoragePath = ({ assetPath }) => assetPath;\n//#endregion\nexport { getLegacyManifestAssetStoragePath };\n", "import { getContentAddressedAssetStoragePath } from \"./contentAddressedAssets.mjs\";\nimport { getLegacyManifestAssetStoragePath } from \"./legacyAssetStorageLayout.mjs\";\n//#region src/assetStorageLayout.ts\nconst isBrotliManifestAssetPath = (assetPath) => /(^|\\/)index\\.[^/]+\\.bundle$/.test(assetPath.replace(/\\\\/g, \"/\"));\nconst getManifestAssetDownloadPath = (assetPath) => isBrotliManifestAssetPath(assetPath) ? `${assetPath}.br` : assetPath;\nconst createStorageUriWithRelativePath = ({ baseStorageUri, relativePath }) => {\n\tconst storageUrl = new URL(baseStorageUri);\n\tstorageUrl.pathname = `${storageUrl.pathname.replace(/\\/+$/, \"\")}/${relativePath.replace(/\\\\/g, \"/\").split(\"/\").filter(Boolean).map((segment) => encodeURIComponent(segment)).join(\"/\")}`;\n\treturn storageUrl.toString();\n};\nconst getAssetStorageLayout = (assetBaseStorageUri) => {\n\tconst pathname = new URL(assetBaseStorageUri).pathname.replace(/\\/+$/, \"\");\n\treturn pathname.endsWith(\"/assets\") || pathname === \"/assets\" ? \"content-addressed\" : \"legacy-files\";\n};\nconst isContentAddressedAssetBaseStorageUri = (assetBaseStorageUri) => getAssetStorageLayout(assetBaseStorageUri) === \"content-addressed\";\nconst getManifestAssetStoragePath = ({ assetBaseStorageUri, assetPath, fileHash }) => {\n\tif (getAssetStorageLayout(assetBaseStorageUri) === \"content-addressed\") return getContentAddressedAssetStoragePath({\n\t\tassetPath,\n\t\tfileHash\n\t});\n\treturn getLegacyManifestAssetStoragePath({ assetPath });\n};\nconst resolveManifestAssetStorageUri = ({ assetBaseStorageUri, assetPath, fileHash }) => createStorageUriWithRelativePath({\n\tbaseStorageUri: assetBaseStorageUri,\n\trelativePath: getManifestAssetStoragePath({\n\t\tassetBaseStorageUri,\n\t\tassetPath,\n\t\tfileHash\n\t})\n});\n//#endregion\nexport { createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };\n", "//#region src/queryBundles.ts\nconst compareValue = (value, expected, comparator) => {\n\tif (expected === void 0) return true;\n\tswitch (comparator) {\n\t\tcase \"eq\": return value === expected;\n\t\tcase \"gt\": return value.localeCompare(expected) > 0;\n\t\tcase \"gte\": return value.localeCompare(expected) >= 0;\n\t\tcase \"lt\": return value.localeCompare(expected) < 0;\n\t\tcase \"lte\": return value.localeCompare(expected) <= 0;\n\t}\n};\nfunction bundleIdMatchesFilter(id, filter) {\n\tif (!filter) return true;\n\tif (filter.in && !filter.in.includes(id)) return false;\n\treturn compareValue(id, filter.eq, \"eq\") && compareValue(id, filter.gt, \"gt\") && compareValue(id, filter.gte, \"gte\") && compareValue(id, filter.lt, \"lt\") && compareValue(id, filter.lte, \"lte\");\n}\nfunction bundleMatchesQueryWhere(bundle, where) {\n\tif (!where) return true;\n\tif (where.channel !== void 0 && bundle.channel !== where.channel) return false;\n\tif (where.platform !== void 0 && bundle.platform !== where.platform) return false;\n\tif (where.enabled !== void 0 && bundle.enabled !== where.enabled) return false;\n\tif (!bundleIdMatchesFilter(bundle.id, where.id)) return false;\n\tif (where.targetAppVersionNotNull === true && bundle.targetAppVersion === null) return false;\n\tif (where.targetAppVersion !== void 0 && bundle.targetAppVersion !== where.targetAppVersion) return false;\n\tif (where.targetAppVersionIn && !where.targetAppVersionIn.includes(bundle.targetAppVersion ?? \"\")) return false;\n\tif (where.fingerprintHash !== void 0 && bundle.fingerprintHash !== where.fingerprintHash) return false;\n\treturn true;\n}\nfunction sortBundles(bundles, orderBy) {\n\tconst direction = orderBy?.direction ?? \"desc\";\n\tif (orderBy && orderBy.field !== \"id\") return bundles;\n\treturn bundles.slice().sort((a, b) => {\n\t\tconst result = a.id.localeCompare(b.id);\n\t\treturn direction === \"asc\" ? result : -result;\n\t});\n}\n//#endregion\nexport { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles };\n", "import { bundleMatchesQueryWhere, sortBundles } from \"./queryBundles.mjs\";\n//#region src/bundleUnitOfWork.ts\nconst resolveEntryValue = (entry) => entry.kind === \"present\" ? entry.bundle : null;\nvar BundleUnitOfWork = class {\n\tentries = /* @__PURE__ */ new Map();\n\tpendingLoads = /* @__PURE__ */ new Map();\n\tchanges = /* @__PURE__ */ new Map();\n\tseededIds = /* @__PURE__ */ new Set();\n\tseed(seeds) {\n\t\tfor (const seed of seeds) {\n\t\t\tif (!seed) continue;\n\t\t\tthis.seededIds.add(seed.id);\n\t\t\tif (!this.changes.has(seed.id)) this.entries.set(seed.id, {\n\t\t\t\tkind: \"present\",\n\t\t\t\tbundle: seed\n\t\t\t});\n\t\t}\n\t}\n\thasSeeds() {\n\t\treturn this.seededIds.size > 0;\n\t}\n\tseededBundles() {\n\t\tconst bundles = [];\n\t\tfor (const bundleId of this.seededIds) {\n\t\t\tconst entry = this.entries.get(bundleId);\n\t\t\tif (entry?.kind === \"present\") bundles.push(entry.bundle);\n\t\t}\n\t\treturn bundles;\n\t}\n\tpeek(bundleId) {\n\t\tconst entry = this.entries.get(bundleId);\n\t\tif (entry?.kind === \"present\") return entry.bundle;\n\t\treturn null;\n\t}\n\tpeekChanged(bundleId) {\n\t\tif (!this.changes.has(bundleId)) return { found: false };\n\t\tconst entry = this.entries.get(bundleId);\n\t\treturn {\n\t\t\tfound: true,\n\t\t\tvalue: entry ? resolveEntryValue(entry) : null\n\t\t};\n\t}\n\tasync getById(bundleId, loadBundleById) {\n\t\tconst entry = this.entries.get(bundleId);\n\t\tif (entry) return resolveEntryValue(entry);\n\t\tconst pendingLoad = this.pendingLoads.get(bundleId);\n\t\tif (pendingLoad) return pendingLoad;\n\t\tconst load = loadBundleById().then((bundle) => {\n\t\t\tthis.pendingLoads.delete(bundleId);\n\t\t\tconst currentEntry = this.entries.get(bundleId);\n\t\t\tif (currentEntry) return resolveEntryValue(currentEntry);\n\t\t\tthis.entries.set(bundleId, bundle ? {\n\t\t\t\tkind: \"present\",\n\t\t\t\tbundle\n\t\t\t} : { kind: \"missing\" });\n\t\t\treturn bundle;\n\t\t}, (error) => {\n\t\t\tthis.pendingLoads.delete(bundleId);\n\t\t\tthrow error;\n\t\t});\n\t\tthis.pendingLoads.set(bundleId, load);\n\t\treturn load;\n\t}\n\toverlayList(bundles, options) {\n\t\tconst dataById = /* @__PURE__ */ new Map();\n\t\tfor (const bundle of bundles) {\n\t\t\tconst entry = this.entries.get(bundle.id);\n\t\t\tif (entry?.kind === \"deleted\") continue;\n\t\t\tif (entry?.kind === \"present\") {\n\t\t\t\tif (bundleMatchesQueryWhere(entry.bundle, options.where)) dataById.set(entry.bundle.id, entry.bundle);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.entries.set(bundle.id, {\n\t\t\t\tkind: \"present\",\n\t\t\t\tbundle\n\t\t\t});\n\t\t\tdataById.set(bundle.id, bundle);\n\t\t}\n\t\tfor (const change of this.changes.values()) {\n\t\t\tif (change.operation === \"delete\" || change.operation === \"insert\") {\n\t\t\t\tdataById.delete(change.data.id);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (bundleMatchesQueryWhere(change.data, options.where)) dataById.set(change.data.id, change.data);\n\t\t\telse dataById.delete(change.data.id);\n\t\t}\n\t\treturn sortBundles(Array.from(dataById.values()), options.orderBy).slice(0, options.limit);\n\t}\n\tmarkInsert(bundle) {\n\t\tthis.entries.set(bundle.id, {\n\t\t\tkind: \"present\",\n\t\t\tbundle\n\t\t});\n\t\tthis.changes.set(bundle.id, {\n\t\t\toperation: \"insert\",\n\t\t\tdata: bundle,\n\t\t\tbefore: null\n\t\t});\n\t}\n\tmarkUpdate(bundle) {\n\t\tconst previousChange = this.changes.get(bundle.id);\n\t\tconst previousEntry = this.entries.get(bundle.id);\n\t\tconst operation = previousChange?.operation ?? \"update\";\n\t\tthis.entries.set(bundle.id, {\n\t\t\tkind: \"present\",\n\t\t\tbundle\n\t\t});\n\t\tthis.changes.set(bundle.id, {\n\t\t\toperation,\n\t\t\tdata: bundle,\n\t\t\tbefore: previousChange?.before ?? (previousEntry ? resolveEntryValue(previousEntry) : null)\n\t\t});\n\t}\n\tmarkDelete(bundle) {\n\t\tconst previousChange = this.changes.get(bundle.id);\n\t\tconst previousEntry = this.entries.get(bundle.id);\n\t\tthis.entries.set(bundle.id, {\n\t\t\tkind: \"deleted\",\n\t\t\tbundle\n\t\t});\n\t\tthis.changes.set(bundle.id, {\n\t\t\toperation: \"delete\",\n\t\t\tdata: bundle,\n\t\t\tbefore: previousChange?.before ?? (previousEntry ? resolveEntryValue(previousEntry) : bundle)\n\t\t});\n\t}\n\tchangedSets() {\n\t\treturn Array.from(this.changes.values(), ({ data, operation }) => ({\n\t\t\toperation,\n\t\t\tdata\n\t\t}));\n\t}\n\thasChanges() {\n\t\treturn this.changes.size > 0;\n\t}\n\tlistFetchExtraCount() {\n\t\treturn Array.from(this.changes.values()).filter((change) => change.operation === \"update\" || change.operation === \"delete\").length;\n\t}\n\ttotalDelta(where) {\n\t\tlet total = 0;\n\t\tfor (const change of this.changes.values()) {\n\t\t\tif (change.operation === \"insert\") continue;\n\t\t\tconst matchedBefore = change.before !== null && bundleMatchesQueryWhere(change.before, where);\n\t\t\tconst matchesAfter = change.operation === \"update\" && bundleMatchesQueryWhere(change.data, where);\n\t\t\tif (matchedBefore && !matchesAfter) total -= 1;\n\t\t\telse if (!matchedBefore && matchesAfter) total += 1;\n\t\t}\n\t\treturn total;\n\t}\n\tclear() {\n\t\tthis.entries.clear();\n\t\tthis.pendingLoads.clear();\n\t\tthis.changes.clear();\n\t\tthis.seededIds.clear();\n\t}\n};\n//#endregion\nexport { BundleUnitOfWork };\n", "import { BundleUnitOfWork } from \"./bundleUnitOfWork.mjs\";\n//#region src/bundleUnitOfWorkStore.ts\nconst requestUnitOfWorks = /* @__PURE__ */ new WeakMap();\nconst isUnitOfWorkContext = (value) => typeof value === \"object\" && value !== null || typeof value === \"function\";\nconst getRequestBundleUnitOfWork = (context) => {\n\tif (!isUnitOfWorkContext(context)) return null;\n\tlet unitOfWork = requestUnitOfWorks.get(context);\n\tif (!unitOfWork) {\n\t\tunitOfWork = new BundleUnitOfWork();\n\t\trequestUnitOfWorks.set(context, unitOfWork);\n\t}\n\treturn unitOfWork;\n};\n//#endregion\nexport { getRequestBundleUnitOfWork };\n", "//#region src/predicate/isPlainObject.ts\n/**\n* Checks if a given value is a plain object.\n*\n* @param {object} value - The value to check.\n* @returns {value is Record<PropertyKey, any>} - True if the value is a plain object, otherwise false.\n*\n* @example\n* ```typescript\n* // \u2705\uD83D\uDC47 True\n*\n* isPlainObject({ }); // \u2705\n* isPlainObject({ key: 'value' }); // \u2705\n* isPlainObject({ key: new Date() }); // \u2705\n* isPlainObject(new Object()); // \u2705\n* isPlainObject(Object.create(null)); // \u2705\n* isPlainObject({ nested: { key: true} }); // \u2705\n* isPlainObject(new Proxy({}, {})); // \u2705\n* isPlainObject({ [Symbol('tag')]: 'A' }); // \u2705\n*\n* // \u2705\uD83D\uDC47 (cross-realms, node context, workers, ...)\n* const runInNewContext = await import('node:vm').then(\n* (mod) => mod.runInNewContext\n* );\n* isPlainObject(runInNewContext('({})')); // \u2705\n*\n* // \u274C\uD83D\uDC47 False\n*\n* class Test { };\n* isPlainObject(new Test()) // \u274C\n* isPlainObject(10); // \u274C\n* isPlainObject(null); // \u274C\n* isPlainObject('hello'); // \u274C\n* isPlainObject([]); // \u274C\n* isPlainObject(new Date()); // \u274C\n* isPlainObject(new Uint8Array([1])); // \u274C\n* isPlainObject(Buffer.from('ABC')); // \u274C\n* isPlainObject(Promise.resolve({})); // \u274C\n* isPlainObject(Object.create({})); // \u274C\n* isPlainObject(new (class Cls {})); // \u274C\n* isPlainObject(globalThis); // \u274C,\n* ```\n*/\nfunction isPlainObject(value) {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst proto = Object.getPrototypeOf(value);\n\tif (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;\n\treturn Object.prototype.toString.call(value) === \"[object Object]\";\n}\n//#endregion\nexport { isPlainObject };\n", "//#region src/_internal/isUnsafeProperty.ts\n/**\n* Checks if a property key is unsafe to modify directly.\n*\n* This function is used in functions like `merge` to prevent prototype pollution attacks\n* by identifying property keys that could modify the object's prototype chain or constructor.\n*\n* @param key - The property key to check\n* @returns `true` if the property is unsafe to modify directly, `false` otherwise\n* @internal\n*/\nfunction isUnsafeProperty(key) {\n\treturn key === \"__proto__\";\n}\n//#endregion\nexport { isUnsafeProperty };\n", "import { isPlainObject } from \"../predicate/isPlainObject.mjs\";\nimport { isUnsafeProperty } from \"../_internal/isUnsafeProperty.mjs\";\n//#region src/object/mergeWith.ts\n/**\n* Merges the properties of the source object into the target object.\n*\n* You can provide a custom `merge` function to control how properties are merged. It should return the value to be set in the target object.\n*\n* If it returns `undefined`, a default deep merge will be applied for arrays and objects:\n*\n* - If a property in the source object is an array or an object and the corresponding property in the target object is also an array or object, they will be merged.\n* - If a property in the source object is undefined, it will not overwrite a defined property in the target object.\n*\n* Note that this function mutates the target object.\n*\n* @param {T} target - The target object into which the source object properties will be merged. This object is modified in place.\n* @param {S} source - The source object whose properties will be merged into the target object.\n* @param {(targetValue: any, sourceValue: any, key: string, target: T, source: S) => any} merge - A custom merge function that defines how properties should be combined. It receives the following arguments:\n* - `targetValue`: The current value of the property in the target object.\n* - `sourceValue`: The value of the property in the source object.\n* - `key`: The key of the property being merged.\n* - `target`: The target object.\n* - `source`: The source object.\n*\n* @returns {T & S} The updated target object with properties from the source object merged in.\n*\n* @template T - Type of the target object.\n* @template S - Type of the source object.\n*\n* @example\n* const target = { a: 1, b: 2 };\n* const source = { b: 3, c: 4 };\n*\n* mergeWith(target, source, (targetValue, sourceValue) => {\n* if (typeof targetValue === 'number' && typeof sourceValue === 'number') {\n* return targetValue + sourceValue;\n* }\n* });\n* // Returns { a: 1, b: 5, c: 4 }\n* @example\n* const target = { a: [1], b: [2] };\n* const source = { a: [3], b: [4] };\n*\n* const result = mergeWith(target, source, (objValue, srcValue) => {\n* if (Array.isArray(objValue)) {\n* return objValue.concat(srcValue);\n* }\n* });\n*\n* expect(result).toEqual({ a: [1, 3], b: [2, 4] });\n*/\nfunction mergeWith(target, source, merge) {\n\tconst sourceKeys = Object.keys(source);\n\tfor (let i = 0; i < sourceKeys.length; i++) {\n\t\tconst key = sourceKeys[i];\n\t\tif (isUnsafeProperty(key)) continue;\n\t\tconst sourceValue = source[key];\n\t\tconst targetValue = target[key];\n\t\tconst merged = merge(targetValue, sourceValue, key, target, source);\n\t\tif (merged !== void 0) target[key] = merged;\n\t\telse if (Array.isArray(sourceValue)) if (Array.isArray(targetValue)) target[key] = mergeWith(targetValue, sourceValue, merge);\n\t\telse target[key] = mergeWith([], sourceValue, merge);\n\t\telse if (isPlainObject(sourceValue)) if (isPlainObject(targetValue)) target[key] = mergeWith(targetValue, sourceValue, merge);\n\t\telse target[key] = mergeWith({}, sourceValue, merge);\n\t\telse if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;\n\t}\n\treturn target;\n}\n//#endregion\nexport { mergeWith };\n", "import { calculatePagination } from \"./calculatePagination.mjs\";\nimport { BundleUnitOfWork } from \"./bundleUnitOfWork.mjs\";\nimport { getRequestBundleUnitOfWork } from \"./bundleUnitOfWorkStore.mjs\";\nimport { mergeWith } from \"es-toolkit\";\n//#region src/createDatabasePlugin.ts\nconst REPLACE_ON_UPDATE_KEYS = [\"patches\", \"targetCohorts\"];\nconst DEFAULT_DESC_ORDER = {\n\tfield: \"id\",\n\tdirection: \"desc\"\n};\nfunction normalizePage(value) {\n\tif (!Number.isInteger(value) || value === void 0 || value < 1) return;\n\treturn value;\n}\nfunction mergeBundleUpdate(baseBundle, patch) {\n\treturn mergeWith({ ...baseBundle }, patch, (_targetValue, sourceValue, key) => {\n\t\tif (REPLACE_ON_UPDATE_KEYS.includes(key)) return sourceValue;\n\t});\n}\nfunction mergeIdFilter(base, patch) {\n\treturn {\n\t\t...base,\n\t\t...patch\n\t};\n}\nfunction mergeWhereWithIdFilter(where, idFilter) {\n\treturn {\n\t\t...where,\n\t\tid: mergeIdFilter(where?.id, idFilter)\n\t};\n}\nfunction buildCursorPageQuery(where, cursor, orderBy) {\n\tconst direction = orderBy.direction;\n\tif (cursor.after) return {\n\t\treverseData: false,\n\t\twhere: mergeWhereWithIdFilter(where, { [direction === \"desc\" ? \"lt\" : \"gt\"]: cursor.after }),\n\t\torderBy\n\t};\n\tif (cursor.before) return {\n\t\treverseData: true,\n\t\twhere: mergeWhereWithIdFilter(where, { [direction === \"desc\" ? \"gt\" : \"lt\"]: cursor.before }),\n\t\torderBy: {\n\t\t\tfield: orderBy.field,\n\t\t\tdirection: direction === \"desc\" ? \"asc\" : \"desc\"\n\t\t}\n\t};\n\treturn {\n\t\treverseData: false,\n\t\twhere: where ?? {},\n\t\torderBy\n\t};\n}\nfunction buildCountBeforeWhere(where, firstBundleId, orderBy) {\n\treturn mergeWhereWithIdFilter(where, { [orderBy.direction === \"desc\" ? \"gt\" : \"lt\"]: firstBundleId });\n}\nfunction createPaginatedResult(total, limit, startIndex, data) {\n\tconst pagination = calculatePagination(total, {\n\t\tlimit,\n\t\toffset: startIndex\n\t});\n\tconst nextCursor = data.length > 0 && startIndex + data.length < total ? data.at(-1)?.id : void 0;\n\tconst previousCursor = data.length > 0 && startIndex > 0 ? data[0]?.id : void 0;\n\treturn {\n\t\tdata,\n\t\tpagination: {\n\t\t\t...pagination,\n\t\t\t...nextCursor ? { nextCursor } : {},\n\t\t\t...previousCursor ? { previousCursor } : {}\n\t\t}\n\t};\n}\nfunction expandLimitForUnitOfWork(options, unitOfWork) {\n\tconst extraLimit = unitOfWork.listFetchExtraCount();\n\tif (extraLimit === 0) return options;\n\treturn {\n\t\t...options,\n\t\tlimit: options.limit + extraLimit\n\t};\n}\nfunction adjustPaginationTotal(pagination, options) {\n\tif (options.totalDelta === 0) return pagination;\n\tconst total = Math.max(0, pagination.total + options.totalDelta);\n\tconst hasPreviousPage = pagination.currentPage > 1;\n\tconst hasNextPage = pagination.currentPage * options.limit < total;\n\treturn {\n\t\t...pagination,\n\t\ttotal,\n\t\thasNextPage,\n\t\thasPreviousPage,\n\t\ttotalPages: total === 0 ? 0 : Math.ceil(total / options.limit)\n\t};\n}\n/**\n* Creates a database plugin with lazy initialization and automatic hook execution.\n*\n* This factory function abstracts the double currying pattern used by all database plugins,\n* ensuring consistent lazy initialization behavior across different database providers.\n* Hooks are automatically executed at appropriate times without requiring manual invocation.\n*\n* @param options - Configuration options for the database plugin\n* @returns A double-curried function that lazily initializes the database plugin\n*\n* @example\n* ```typescript\n* export const postgres = createDatabasePlugin<PostgresConfig>({\n* name: \"postgres\",\n* factory: (config) => {\n* const db = new Kysely(config);\n* return {\n* async getBundleById(bundleId) { ... },\n* async getBundles(options) { ... },\n* async getChannels() { ... },\n* async commitBundle({ changedSets }) { ... }\n* };\n* }\n* });\n* ```\n*/\nfunction createDatabasePlugin(options) {\n\treturn (config, hooks) => {\n\t\tlet cachedMethods = null;\n\t\tconst getMethods = () => {\n\t\t\tif (!cachedMethods) cachedMethods = options.factory(config);\n\t\t\treturn cachedMethods;\n\t\t};\n\t\treturn () => {\n\t\t\tconst instanceMutationUnitOfWork = new BundleUnitOfWork();\n\t\t\tconst getRequestUnitOfWork = (context) => {\n\t\t\t\treturn getRequestBundleUnitOfWork(context);\n\t\t\t};\n\t\t\tconst getMutationUnitOfWork = (context) => {\n\t\t\t\treturn getRequestUnitOfWork(context) ?? instanceMutationUnitOfWork;\n\t\t\t};\n\t\t\tconst runGetBundles = async (options, context) => {\n\t\t\t\tif (context === void 0) return getMethods().getBundles(options);\n\t\t\t\treturn getMethods().getBundles(options, context);\n\t\t\t};\n\t\t\tconst getBundlesWithLegacyCursorFallback = async (options, context) => {\n\t\t\t\tconst orderBy = options.orderBy ?? DEFAULT_DESC_ORDER;\n\t\t\t\tconst baseWhere = options.where;\n\t\t\t\tconst total = (await runGetBundles({\n\t\t\t\t\twhere: baseWhere,\n\t\t\t\t\tlimit: 1,\n\t\t\t\t\toffset: 0,\n\t\t\t\t\torderBy\n\t\t\t\t}, context)).pagination.total;\n\t\t\t\tif (!options.cursor?.after && !options.cursor?.before) {\n\t\t\t\t\tconst firstPage = await runGetBundles({\n\t\t\t\t\t\twhere: baseWhere,\n\t\t\t\t\t\tlimit: options.limit,\n\t\t\t\t\t\toffset: 0,\n\t\t\t\t\t\torderBy\n\t\t\t\t\t}, context);\n\t\t\t\t\treturn createPaginatedResult(total, options.limit, 0, firstPage.data);\n\t\t\t\t}\n\t\t\t\tconst { where, orderBy: queryOrderBy, reverseData } = buildCursorPageQuery(baseWhere, options.cursor, orderBy);\n\t\t\t\tconst cursorPage = await runGetBundles({\n\t\t\t\t\twhere,\n\t\t\t\t\tlimit: options.limit,\n\t\t\t\t\toffset: 0,\n\t\t\t\t\torderBy: queryOrderBy\n\t\t\t\t}, context);\n\t\t\t\tconst data = reverseData ? cursorPage.data.slice().reverse() : cursorPage.data;\n\t\t\t\tif (data.length === 0) {\n\t\t\t\t\tconst emptyStartIndex = options.cursor.after ? total : 0;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata,\n\t\t\t\t\t\tpagination: {\n\t\t\t\t\t\t\t...calculatePagination(total, {\n\t\t\t\t\t\t\t\tlimit: options.limit,\n\t\t\t\t\t\t\t\toffset: emptyStartIndex\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t...options.cursor.after ? { previousCursor: options.cursor.after } : {},\n\t\t\t\t\t\t\t...options.cursor.before ? { nextCursor: options.cursor.before } : {}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst firstBundleId = data[0].id;\n\t\t\t\tconst countBeforeResult = await runGetBundles({\n\t\t\t\t\twhere: buildCountBeforeWhere(baseWhere, firstBundleId, orderBy),\n\t\t\t\t\tlimit: 1,\n\t\t\t\t\toffset: 0,\n\t\t\t\t\torderBy\n\t\t\t\t}, context);\n\t\t\t\treturn createPaginatedResult(total, options.limit, countBeforeResult.pagination.total, data);\n\t\t\t};\n\t\t\tconst plugin = {\n\t\t\t\tname: options.name,\n\t\t\t\tasync getBundleById(bundleId, context) {\n\t\t\t\t\tconst requestUnitOfWork = getRequestUnitOfWork(context);\n\t\t\t\t\tif (requestUnitOfWork) return requestUnitOfWork.getById(bundleId, () => getMethods().getBundleById(bundleId, context));\n\t\t\t\t\tconst pendingMutation = instanceMutationUnitOfWork.peekChanged(bundleId);\n\t\t\t\t\tif (pendingMutation.found) return pendingMutation.value;\n\t\t\t\t\treturn getMethods().getBundleById(bundleId);\n\t\t\t\t},\n\t\t\t\tasync getBundles(options, context) {\n\t\t\t\t\tif (typeof options === \"object\" && options !== null && \"offset\" in options && options.offset !== void 0) throw new Error(\"Bundle offset pagination has been removed. Use cursor.after or cursor.before instead.\");\n\t\t\t\t\tconst methods = getMethods();\n\t\t\t\t\tconst requestUnitOfWork = getRequestUnitOfWork(context);\n\t\t\t\t\tconst unitOfWork = requestUnitOfWork ?? instanceMutationUnitOfWork;\n\t\t\t\t\tconst shouldOverlay = requestUnitOfWork !== null || instanceMutationUnitOfWork.hasChanges();\n\t\t\t\t\tconst normalizedOptions = {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tpage: normalizePage(options.page),\n\t\t\t\t\t\torderBy: options.orderBy ?? DEFAULT_DESC_ORDER\n\t\t\t\t\t};\n\t\t\t\t\tconst overlayResult = (result) => ({\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tdata: unitOfWork.overlayList(result.data, {\n\t\t\t\t\t\t\tlimit: normalizedOptions.limit,\n\t\t\t\t\t\t\torderBy: normalizedOptions.orderBy,\n\t\t\t\t\t\t\twhere: normalizedOptions.where\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tpagination: adjustPaginationTotal(result.pagination, {\n\t\t\t\t\t\t\tlimit: normalizedOptions.limit,\n\t\t\t\t\t\t\ttotalDelta: unitOfWork.totalDelta(normalizedOptions.where)\n\t\t\t\t\t\t})\n\t\t\t\t\t});\n\t\t\t\t\tif (normalizedOptions.page !== void 0) {\n\t\t\t\t\t\tconst { page, ...pageOptions } = normalizedOptions;\n\t\t\t\t\t\tconst requestedOffset = (page - 1) * normalizedOptions.limit;\n\t\t\t\t\t\tconst fetchPageOptions = expandLimitForUnitOfWork(pageOptions, unitOfWork);\n\t\t\t\t\t\tlet pageResult = await runGetBundles({\n\t\t\t\t\t\t\t...fetchPageOptions,\n\t\t\t\t\t\t\toffset: requestedOffset\n\t\t\t\t\t\t}, context);\n\t\t\t\t\t\tconst total = pageResult.pagination.total;\n\t\t\t\t\t\tconst totalPages = total === 0 ? 0 : Math.ceil(total / normalizedOptions.limit);\n\t\t\t\t\t\tconst maxOffset = totalPages === 0 ? 0 : (Math.max(1, totalPages) - 1) * normalizedOptions.limit;\n\t\t\t\t\t\tconst resolvedOffset = Math.min(requestedOffset, maxOffset);\n\t\t\t\t\t\tif (resolvedOffset !== requestedOffset) pageResult = await runGetBundles({\n\t\t\t\t\t\t\t...fetchPageOptions,\n\t\t\t\t\t\t\toffset: resolvedOffset\n\t\t\t\t\t\t}, context);\n\t\t\t\t\t\tconst result = { ...createPaginatedResult(total, normalizedOptions.limit, resolvedOffset, pageResult.data) };\n\t\t\t\t\t\treturn shouldOverlay ? overlayResult(result) : result;\n\t\t\t\t\t}\n\t\t\t\t\tif (methods.supportsCursorPagination) {\n\t\t\t\t\t\tconst fetchOptions = expandLimitForUnitOfWork(normalizedOptions, unitOfWork);\n\t\t\t\t\t\tconst result = context === void 0 ? await methods.getBundles(fetchOptions) : await methods.getBundles(fetchOptions, context);\n\t\t\t\t\t\treturn shouldOverlay ? overlayResult(result) : result;\n\t\t\t\t\t}\n\t\t\t\t\tconst result = await getBundlesWithLegacyCursorFallback(shouldOverlay ? expandLimitForUnitOfWork(normalizedOptions, unitOfWork) : normalizedOptions, context);\n\t\t\t\t\treturn shouldOverlay ? overlayResult(result) : result;\n\t\t\t\t},\n\t\t\t\tasync getChannels(context) {\n\t\t\t\t\tif (context === void 0) return getMethods().getChannels();\n\t\t\t\t\treturn getMethods().getChannels(context);\n\t\t\t\t},\n\t\t\t\tasync onUnmount() {\n\t\t\t\t\tconst methods = getMethods();\n\t\t\t\t\tif (methods.onUnmount) return methods.onUnmount();\n\t\t\t\t},\n\t\t\t\tasync commitBundle(context) {\n\t\t\t\t\tconst methods = getMethods();\n\t\t\t\t\tconst unitOfWork = getMutationUnitOfWork(context);\n\t\t\t\t\tconst params = { changedSets: unitOfWork.changedSets() };\n\t\t\t\t\tif (context === void 0) await methods.commitBundle(params);\n\t\t\t\t\telse await methods.commitBundle(params, context);\n\t\t\t\t\tunitOfWork.clear();\n\t\t\t\t\tawait hooks?.onDatabaseUpdated?.();\n\t\t\t\t},\n\t\t\t\tasync updateBundle(targetBundleId, newBundle, context) {\n\t\t\t\t\tconst unitOfWork = getMutationUnitOfWork(context);\n\t\t\t\t\tconst currentBundle = await unitOfWork.getById(targetBundleId, () => context === void 0 ? getMethods().getBundleById(targetBundleId) : getMethods().getBundleById(targetBundleId, context));\n\t\t\t\t\tif (!currentBundle) throw new Error(\"targetBundleId not found\");\n\t\t\t\t\tconst updatedBundle = mergeBundleUpdate(currentBundle, newBundle);\n\t\t\t\t\tunitOfWork.markUpdate(updatedBundle);\n\t\t\t\t},\n\t\t\t\tasync appendBundle(inputBundle, context) {\n\t\t\t\t\tgetMutationUnitOfWork(context).markInsert(inputBundle);\n\t\t\t\t},\n\t\t\t\tasync deleteBundle(deleteBundle, context) {\n\t\t\t\t\tgetMutationUnitOfWork(context).markDelete(deleteBundle);\n\t\t\t\t}\n\t\t\t};\n\t\t\tObject.defineProperty(plugin, \"getUpdateInfo\", {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tget() {\n\t\t\t\t\tconst directGetUpdateInfo = getMethods().getUpdateInfo;\n\t\t\t\t\tif (!directGetUpdateInfo) {\n\t\t\t\t\t\tObject.defineProperty(plugin, \"getUpdateInfo\", {\n\t\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\t\tvalue: void 0\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst wrappedGetUpdateInfo = async (args, context) => {\n\t\t\t\t\t\tif (context === void 0) return directGetUpdateInfo(args);\n\t\t\t\t\t\treturn directGetUpdateInfo(args, context);\n\t\t\t\t\t};\n\t\t\t\t\tObject.defineProperty(plugin, \"getUpdateInfo\", {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tvalue: wrappedGetUpdateInfo\n\t\t\t\t\t});\n\t\t\t\t\treturn wrappedGetUpdateInfo;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn plugin;\n\t\t};\n\t};\n}\n//#endregion\nexport { createDatabasePlugin };\n", "//#region src/constants.ts\nconst SEMVER_SPEC_VERSION = \"2.0.0\";\nconst INCREMENT_TYPES = [\n\t\"major\",\n\t\"premajor\",\n\t\"minor\",\n\t\"preminor\",\n\t\"patch\",\n\t\"prepatch\",\n\t\"prerelease\",\n\t\"release\"\n];\nconst TRUNCATION_TYPES = [\n\t\"major\",\n\t\"premajor\",\n\t\"minor\",\n\t\"preminor\",\n\t\"patch\",\n\t\"prepatch\",\n\t\"prerelease\"\n];\n//#endregion\n//#region src/internal/patterns.ts\nconst LETTER_DASH_NUMBER = \"[a-zA-Z0-9-]\";\nconst NUMERIC_IDENTIFIER = String.raw`0|[1-9]\\d*`;\nconst NUMERIC_IDENTIFIER_LOOSE = String.raw`\\d+`;\nconst NON_NUMERIC_IDENTIFIER = String.raw`\\d*[a-zA-Z-]${LETTER_DASH_NUMBER}*`;\nconst MAIN_VERSION = String.raw`(${NUMERIC_IDENTIFIER})\\.(${NUMERIC_IDENTIFIER})\\.(${NUMERIC_IDENTIFIER})`;\nconst MAIN_VERSION_LOOSE = String.raw`(${NUMERIC_IDENTIFIER_LOOSE})\\.(${NUMERIC_IDENTIFIER_LOOSE})\\.(${NUMERIC_IDENTIFIER_LOOSE})`;\nconst PRERELEASE_IDENTIFIER = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER})`;\nconst PRERELEASE_IDENTIFIER_LOOSE = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER_LOOSE})`;\nconst PRERELEASE = String.raw`(?:-(${PRERELEASE_IDENTIFIER}(?:\\.${PRERELEASE_IDENTIFIER})*))`;\nconst PRERELEASE_LOOSE = String.raw`(?:-?(${PRERELEASE_IDENTIFIER_LOOSE}(?:\\.${PRERELEASE_IDENTIFIER_LOOSE})*))`;\nconst BUILD_IDENTIFIER = `${LETTER_DASH_NUMBER}+`;\nconst BUILD = String.raw`(?:\\+(${BUILD_IDENTIFIER}(?:\\.${BUILD_IDENTIFIER})*))`;\nconst FULL_PLAIN = `v?${MAIN_VERSION}${PRERELEASE}?${BUILD}?`;\nconst LOOSE_PLAIN = String.raw`[v=\\s]*${MAIN_VERSION_LOOSE}${PRERELEASE_LOOSE}?${BUILD}?`;\nconst GREATER_LESS_THAN = \"((?:<|>)?=?)\";\nconst XRANGE_IDENTIFIER = String.raw`${NUMERIC_IDENTIFIER}|x|X|\\*`;\nconst XRANGE_IDENTIFIER_LOOSE = String.raw`${NUMERIC_IDENTIFIER_LOOSE}|x|X|\\*`;\nconst XRANGE_PLAIN = String.raw`[v=\\s]*(${XRANGE_IDENTIFIER})(?:\\.(${XRANGE_IDENTIFIER})(?:\\.(${XRANGE_IDENTIFIER})(?:${PRERELEASE})?${BUILD}?)?)?`;\nconst XRANGE_PLAIN_LOOSE = String.raw`[v=\\s]*(${XRANGE_IDENTIFIER_LOOSE})(?:\\.(${XRANGE_IDENTIFIER_LOOSE})(?:\\.(${XRANGE_IDENTIFIER_LOOSE})(?:${PRERELEASE_LOOSE})?${BUILD}?)?)?`;\nconst LONE_TILDE = \"(?:~>?)\";\nconst LONE_CARET = String.raw`(?:\\^)`;\nconst COERCE_PLAIN = String.raw`(^|[^\\d])(\\d{1,${16}})(?:\\.(\\d{1,${16}}))?(?:\\.(\\d{1,${16}}))?`;\nconst COERCE = String.raw`${COERCE_PLAIN}(?:$|[^\\d])`;\nconst COERCE_FULL = String.raw`${COERCE_PLAIN}(?:${PRERELEASE})?(?:${BUILD})?(?:$|[^\\d])`;\nfunction makeSafeRegexSource(source) {\n\tconst replacements = [\n\t\t[String.raw`\\s`, 1],\n\t\t[String.raw`\\d`, 256],\n\t\t[LETTER_DASH_NUMBER, 250]\n\t];\n\tfor (const [token, maximum] of replacements) source = source.split(`${token}*`).join(`${token}{0,${maximum}}`).split(`${token}+`).join(`${token}{1,${maximum}}`);\n\treturn source;\n}\nfunction safeRegex(source, flags) {\n\treturn new RegExp(makeSafeRegexSource(source), flags);\n}\n//#endregion\n//#region src/identifiers.ts\nconst NUMERIC$1 = /^\\d+$/;\nfunction compareIdentifiers(left, right) {\n\tif (typeof left === \"number\" && typeof right === \"number\") return left === right ? 0 : left < right ? -1 : 1;\n\tconst leftNumeric = NUMERIC$1.test(String(left));\n\tconst rightNumeric = NUMERIC$1.test(String(right));\n\tconst normalizedLeft = leftNumeric ? Number(left) : left;\n\tconst normalizedRight = rightNumeric ? Number(right) : right;\n\treturn normalizedLeft === normalizedRight ? 0 : leftNumeric && !rightNumeric ? -1 : rightNumeric && !leftNumeric ? 1 : normalizedLeft < normalizedRight ? -1 : 1;\n}\nfunction compareIdentifiersReversed(left, right) {\n\treturn compareIdentifiers(right, left);\n}\n//#endregion\n//#region src/internal/version.ts\nconst FULL = safeRegex(`^${FULL_PLAIN}$`);\nconst LOOSE = safeRegex(`^${LOOSE_PLAIN}$`);\nconst PRERELEASE_EXACT = safeRegex(`^${PRERELEASE}$`);\nconst PRERELEASE_LOOSE_EXACT = safeRegex(`^${PRERELEASE_LOOSE}$`);\nconst COERCE_EXACT = safeRegex(COERCE);\nconst COERCE_FULL_EXACT = safeRegex(COERCE_FULL);\nconst NUMERIC = /^\\d+$/;\nfunction formatComparableVersion(version) {\n\tconst base = `${version.major}.${version.minor}.${version.patch}`;\n\treturn version.prerelease?.length ? `${base}-${version.prerelease.join(\".\")}` : base;\n}\nfunction formatFullVersion(version) {\n\tconst comparable = formatComparableVersion(version);\n\treturn version.build?.length ? `${comparable}+${version.build.join(\".\")}` : comparable;\n}\nfunction parse(version, options = {}) {\n\tif (typeof version !== \"string\") return version;\n\tif (version.length > 256) throw new TypeError(`Version exceeds the maximum length of 256 characters`);\n\tconst match = version.trim().match(options.loose ? LOOSE : FULL);\n\tif (!match) throw new TypeError(`Invalid version syntax: ${version}`);\n\tconst major = Number(match[1]);\n\tconst minor = Number(match[2]);\n\tconst patch = Number(match[3]);\n\tif (major > Number.MAX_SAFE_INTEGER || major < 0) throw new TypeError(`Invalid major version: ${match[1]}`);\n\tif (minor > Number.MAX_SAFE_INTEGER || minor < 0) throw new TypeError(`Invalid minor version: ${match[2]}`);\n\tif (patch > Number.MAX_SAFE_INTEGER || patch < 0) throw new TypeError(`Invalid patch version: ${match[3]}`);\n\tconst prerelease = match[4] ? match[4].split(\".\").map((identifier) => {\n\t\tif (NUMERIC.test(identifier)) {\n\t\t\tconst numeric = Number(identifier);\n\t\t\tif (numeric >= 0 && numeric < Number.MAX_SAFE_INTEGER) return numeric;\n\t\t}\n\t\treturn identifier;\n\t}) : void 0;\n\treturn {\n\t\tbuild: match[5]?.split(\".\"),\n\t\tmajor,\n\t\tminor,\n\t\tpatch,\n\t\tprerelease\n\t};\n}\nfunction tryParse(version, options = {}) {\n\ttry {\n\t\treturn parse(version, options);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction compareMainParsed(left, right) {\n\treturn left.major === right.major ? left.minor === right.minor ? left.patch === right.patch ? 0 : left.patch < right.patch ? -1 : 1 : left.minor < right.minor ? -1 : 1 : left.major < right.major ? -1 : 1;\n}\nfunction comparePrereleaseParsed(left, right) {\n\tconst leftPrerelease = left.prerelease;\n\tconst rightPrerelease = right.prerelease;\n\tif (leftPrerelease?.length && !rightPrerelease?.length) return -1;\n\tif (!leftPrerelease?.length && rightPrerelease?.length) return 1;\n\tif (!leftPrerelease?.length && !rightPrerelease?.length) return 0;\n\tfor (let index = 0;; index++) {\n\t\tconst leftIdentifier = leftPrerelease?.[index];\n\t\tconst rightIdentifier = rightPrerelease?.[index];\n\t\tif (leftIdentifier === void 0 && rightIdentifier === void 0) return 0;\n\t\tif (rightIdentifier === void 0) return 1;\n\t\tif (leftIdentifier === void 0) return -1;\n\t\tif (leftIdentifier !== rightIdentifier) return compareIdentifiers(leftIdentifier, rightIdentifier);\n\t}\n}\nfunction compareParsed(left, right) {\n\treturn compareMainParsed(left, right) || comparePrereleaseParsed(left, right);\n}\nfunction compareBuildParsed(left, right) {\n\tconst precedence = compareParsed(left, right);\n\tif (precedence !== 0) return precedence;\n\tfor (let index = 0;; index++) {\n\t\tconst leftIdentifier = left.build?.[index];\n\t\tconst rightIdentifier = right.build?.[index];\n\t\tif (leftIdentifier === void 0 && rightIdentifier === void 0) return 0;\n\t\tif (rightIdentifier === void 0) return 1;\n\t\tif (leftIdentifier === void 0) return -1;\n\t\tif (leftIdentifier !== rightIdentifier) return compareIdentifiers(leftIdentifier, rightIdentifier);\n\t}\n}\nfunction isPrereleasePrefix(prerelease, identifier) {\n\tconst identifiers = identifier.split(\".\");\n\treturn identifiers.length <= prerelease.length && identifiers.every((part, index) => compareIdentifiers(prerelease[index], part) === 0);\n}\nfunction incrementPrerelease(version, identifier, identifierBase) {\n\tconst base = Number(identifierBase) ? 1 : 0;\n\tlet prerelease = version.prerelease;\n\tif (prerelease?.length) {\n\t\tlet foundNumeric = false;\n\t\tfor (let index = prerelease.length - 1; index >= 0; index--) if (typeof prerelease[index] === \"number\") {\n\t\t\tprerelease[index] = Number(prerelease[index]) + 1;\n\t\t\tfoundNumeric = true;\n\t\t\tbreak;\n\t\t}\n\t\tif (!foundNumeric) {\n\t\t\tif (identifier === prerelease.join(\".\") && identifierBase === false) throw new Error(\"invalid increment argument: identifier already exists\");\n\t\t\tprerelease.push(base);\n\t\t}\n\t} else {\n\t\tprerelease = [base];\n\t\tversion.prerelease = prerelease;\n\t}\n\tif (!identifier) return;\n\tconst reset = identifierBase === false ? [identifier] : [identifier, base];\n\tif (isPrereleasePrefix(prerelease, identifier)) {\n\t\tconst next = prerelease[identifier.split(\".\").length];\n\t\tif (Number.isNaN(Number(next))) version.prerelease = reset;\n\t} else version.prerelease = reset;\n}\nfunction incrementMutable(version, release, identifier, identifierBase) {\n\tswitch (release) {\n\t\tcase \"premajor\":\n\t\t\tversion.prerelease = void 0;\n\t\t\tversion.patch = 0;\n\t\t\tversion.minor = 0;\n\t\t\tversion.major++;\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tcase \"preminor\":\n\t\t\tversion.prerelease = void 0;\n\t\t\tversion.patch = 0;\n\t\t\tversion.minor++;\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tcase \"prepatch\":\n\t\t\tversion.prerelease = void 0;\n\t\t\tincrementMutable(version, \"patch\", identifier, identifierBase);\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tcase \"prerelease\":\n\t\t\tif (!version.prerelease?.length) incrementMutable(version, \"patch\", identifier, identifierBase);\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tcase \"release\":\n\t\t\tif (!version.prerelease?.length) throw new Error(`version ${formatFullVersion(version)} is not a prerelease`);\n\t\t\tversion.prerelease = void 0;\n\t\t\tbreak;\n\t\tcase \"major\":\n\t\t\tif (version.minor !== 0 || version.patch !== 0 || !version.prerelease?.length) version.major++;\n\t\t\tversion.minor = 0;\n\t\t\tversion.patch = 0;\n\t\t\tversion.prerelease = void 0;\n\t\t\tbreak;\n\t\tcase \"minor\":\n\t\t\tif (version.patch !== 0 || !version.prerelease?.length) version.minor++;\n\t\t\tversion.patch = 0;\n\t\t\tversion.prerelease = void 0;\n\t\t\tbreak;\n\t\tcase \"patch\":\n\t\t\tif (!version.prerelease?.length) version.patch++;\n\t\t\tversion.prerelease = void 0;\n\t\t\tbreak;\n\t\tcase \"pre\":\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tdefault: throw new Error(`invalid increment argument: ${release}`);\n\t}\n}\nfunction incrementParsedVersion(parsed, release, identifier, identifierBase, loose = false) {\n\tif (release.startsWith(\"pre\")) {\n\t\tif (!identifier && identifierBase === false) throw new Error(\"invalid increment argument: identifier is empty\");\n\t\tif (identifier) {\n\t\t\tconst expression = loose ? PRERELEASE_LOOSE_EXACT : PRERELEASE_EXACT;\n\t\t\tconst match = `-${identifier}`.match(expression);\n\t\t\tif (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);\n\t\t}\n\t}\n\tconst mutable = {\n\t\tbuild: parsed.build ? [...parsed.build] : void 0,\n\t\tmajor: parsed.major,\n\t\tminor: parsed.minor,\n\t\tpatch: parsed.patch,\n\t\tprerelease: parsed.prerelease ? [...parsed.prerelease] : void 0\n\t};\n\tincrementMutable(mutable, release, identifier, identifierBase);\n\treturn formatComparableVersion(mutable);\n}\nfunction coerceParsedVersion(value, options = {}) {\n\tif (typeof value === \"object\") return value;\n\tconst input = typeof value === \"number\" ? String(value) : value;\n\tif (typeof input !== \"string\") return null;\n\tlet match = null;\n\tif (options.rtl) {\n\t\tconst expression = safeRegex(options.includePrerelease ? COERCE_FULL : COERCE, \"g\");\n\t\tlet next;\n\t\twhile ((next = expression.exec(input)) && (!match || match.index + match[0].length !== input.length)) {\n\t\t\tif (!match || next.index + next[0].length !== match.index + match[0].length) match = next;\n\t\t\texpression.lastIndex = next.index + next[1].length + next[2].length;\n\t\t}\n\t} else match = (options.includePrerelease ? COERCE_FULL_EXACT : COERCE_EXACT).exec(input);\n\tif (!match) return null;\n\tconst major = match[2];\n\treturn tryParse(`${major}.${match[3] || \"0\"}.${match[4] || \"0\"}${options.includePrerelease && match[5] ? `-${match[5]}` : \"\"}${options.includePrerelease && match[6] ? `+${match[6]}` : \"\"}`, options);\n}\n//#endregion\n//#region src/internal/comparator.ts\nconst STRICT_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${FULL_PLAIN})$|^$`);\nconst LOOSE_COMPARATOR$1 = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN})$|^$`);\nfunction parseComparator(comparator, options = {}) {\n\tconst normalized = comparator.trim().replaceAll(/\\s+/g, \" \");\n\tconst match = normalized.match(options.loose ? LOOSE_COMPARATOR$1 : STRICT_COMPARATOR);\n\tif (!match) throw new TypeError(`Invalid comparator: ${normalized}`);\n\tconst operator = match[1] === \"=\" ? \"\" : match[1] || \"\";\n\tconst version = match[2] ? parse(match[2], options) : null;\n\treturn {\n\t\toperator,\n\t\toptions,\n\t\tvalue: version ? `${operator}${formatComparableVersion(version)}` : \"\",\n\t\tversion\n\t};\n}\nfunction testParsedComparator(comparator, version) {\n\tif (!comparator.version) return true;\n\tconst comparison = compareParsed(version, comparator.version);\n\tswitch (comparator.operator) {\n\t\tcase \"\": return comparison === 0;\n\t\tcase \">\": return comparison > 0;\n\t\tcase \">=\": return comparison >= 0;\n\t\tcase \"<\": return comparison < 0;\n\t\tcase \"<=\": return comparison <= 0;\n\t}\n}\nfunction testComparatorVersion(comparator, version) {\n\tconst parsed = tryParse(version, comparator.options);\n\treturn parsed ? testParsedComparator(comparator, parsed) : false;\n}\nfunction comparatorAllowsPrerelease(comparator, version) {\n\tconst allowed = comparator.version;\n\treturn allowed !== null && !!allowed.prerelease?.length && allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch;\n}\nfunction testComparatorSet(set, version, options) {\n\tif (set.some((comparator) => !testParsedComparator(comparator, version))) return false;\n\treturn !version.prerelease?.length || !!options.includePrerelease || set.some((comparator) => comparatorAllowsPrerelease(comparator, version));\n}\nfunction parsedComparatorsIntersect(left, right, options = {}) {\n\tif (!left.version || !right.version) return true;\n\tif (left.operator === \"\") return testComparatorSet([right], left.version, options);\n\tif (right.operator === \"\") return testComparatorSet([left], right.version, options);\n\tif (options.includePrerelease && (left.value === \"<0.0.0-0\" || right.value === \"<0.0.0-0\")) return false;\n\tif (!options.includePrerelease && (left.value.startsWith(\"<0.0.0\") || right.value.startsWith(\"<0.0.0\"))) return false;\n\tif (left.operator.startsWith(\">\") && right.operator.startsWith(\">\")) return true;\n\tif (left.operator.startsWith(\"<\") && right.operator.startsWith(\"<\")) return true;\n\tconst comparison = compareParsed(left.version, right.version);\n\tif (comparison === 0 && left.operator.includes(\"=\") && right.operator.includes(\"=\")) return true;\n\tif (comparison < 0 && left.operator.startsWith(\">\") && right.operator.startsWith(\"<\")) return true;\n\treturn comparison > 0 && left.operator.startsWith(\"<\") && right.operator.startsWith(\">\");\n}\n//#endregion\n//#region src/comparator.ts\nfunction normalizeComparator(comparator, options = {}) {\n\treturn parseComparator(comparator, options).value;\n}\nfunction satisfiesComparator(version, comparator, options = {}) {\n\treturn testComparatorVersion(parseComparator(comparator, options), version);\n}\nfunction comparatorsIntersect(left, right, options = {}) {\n\treturn parsedComparatorsIntersect(parseComparator(left, options), parseComparator(right, options), options);\n}\n//#endregion\n//#region src/comparison.ts\nfunction compare(left, right, options = {}) {\n\treturn compareParsed(parse(left, options), parse(right, options));\n}\nfunction compareReversed(left, right, options = {}) {\n\treturn compare(right, left, options);\n}\nfunction compareMain(left, right, options = {}) {\n\treturn compareMainParsed(parse(left, options), parse(right, options));\n}\nfunction comparePrerelease(left, right, options = {}) {\n\treturn comparePrereleaseParsed(parse(left, options), parse(right, options));\n}\nfunction compareBuild(left, right, options = {}) {\n\treturn compareBuildParsed(parse(left, options), parse(right, options));\n}\nfunction compareWithOperator(left, operator, right, options = {}) {\n\tif (operator === \"===\") return left === right;\n\tif (operator === \"!==\") return left !== right;\n\tconst comparison = compare(left, right, options);\n\tswitch (operator) {\n\t\tcase \"\":\n\t\tcase \"=\":\n\t\tcase \"==\": return comparison === 0;\n\t\tcase \"!=\": return comparison !== 0;\n\t\tcase \">\": return comparison > 0;\n\t\tcase \">=\": return comparison >= 0;\n\t\tcase \"<\": return comparison < 0;\n\t\tcase \"<=\": return comparison <= 0;\n\t\tdefault: throw new TypeError(`Invalid operator: ${operator}`);\n\t}\n}\nfunction isEqual(left, right, options = {}) {\n\treturn compare(left, right, options) === 0;\n}\nfunction isNotEqual(left, right, options = {}) {\n\treturn compare(left, right, options) !== 0;\n}\nfunction isGreater(left, right, options = {}) {\n\treturn compare(left, right, options) > 0;\n}\nfunction isGreaterOrEqual(left, right, options = {}) {\n\treturn compare(left, right, options) >= 0;\n}\nfunction isLess(left, right, options = {}) {\n\treturn compare(left, right, options) < 0;\n}\nfunction isLessOrEqual(left, right, options = {}) {\n\treturn compare(left, right, options) <= 0;\n}\nfunction sort(versions, options = {}) {\n\treturn [...versions].sort((left, right) => compareBuild(left, right, options));\n}\nfunction sortReversed(versions, options = {}) {\n\treturn [...versions].sort((left, right) => compareBuild(right, left, options));\n}\n//#endregion\n//#region src/internal/range.ts\nconst BUILD_STRIP = new RegExp(BUILD, \"g\");\nconst BUILD_SAFE = safeRegex(BUILD);\nconst STRICT_HYPHEN = safeRegex(String.raw`^\\s*(${XRANGE_PLAIN})\\s+-\\s+(${XRANGE_PLAIN})\\s*$`);\nconst LOOSE_HYPHEN = safeRegex(String.raw`^\\s*(${XRANGE_PLAIN_LOOSE})\\s+-\\s+(${XRANGE_PLAIN_LOOSE})\\s*$`);\nconst COMPARATOR_TRIM = safeRegex(String.raw`(\\s*)${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN}|${XRANGE_PLAIN})`, \"g\");\nconst TILDE_TRIM = safeRegex(String.raw`(\\s*)${LONE_TILDE}\\s+`, \"g\");\nconst CARET_TRIM = safeRegex(String.raw`(\\s*)${LONE_CARET}\\s+`, \"g\");\nconst STRICT_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN}$`);\nconst LOOSE_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN_LOOSE}$`);\nconst STRICT_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN}$`);\nconst LOOSE_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN_LOOSE}$`);\nconst STRICT_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*${XRANGE_PLAIN}$`);\nconst LOOSE_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*${XRANGE_PLAIN_LOOSE}$`);\nconst STAR = safeRegex(String.raw`(<|>)?=?\\s*\\*`);\nconst GTE_ZERO = /^\\s*>=\\s*0\\.0\\.0\\s*$/;\nconst GTE_ZERO_PRERELEASE = /^\\s*>=\\s*0\\.0\\.0-0\\s*$/;\nconst LOOSE_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN})$|^$`);\nfunction isWildcard(value) {\n\treturn !value || String(value).toLowerCase() === \"x\" || String(value) === \"*\";\n}\nfunction hasInvalidWildcardOrder(major, minor, patch) {\n\treturn isWildcard(major) && !isWildcard(minor) || isWildcard(minor) && Boolean(patch) && !isWildcard(patch);\n}\nfunction replaceTilde(comparator, options) {\n\tconst expression = options.loose ? LOOSE_TILDE : STRICT_TILDE;\n\tconst lowerPrerelease = options.includePrerelease ? \"-0\" : \"\";\n\treturn comparator.replace(expression, (_match, major, minor, patch, prerelease) => {\n\t\tif (isWildcard(major)) return \"\";\n\t\tif (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (isWildcard(patch)) return `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0`;\n\t\treturn prerelease ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0`;\n\t});\n}\nfunction replaceTildes(comparator, options) {\n\treturn comparator.trim().split(/\\s+/).map((part) => replaceTilde(part, options)).join(\" \");\n}\nfunction replaceCaret(comparator, options) {\n\tconst expression = options.loose ? LOOSE_CARET : STRICT_CARET;\n\tconst lowerPrerelease = options.includePrerelease ? \"-0\" : \"\";\n\treturn comparator.replace(expression, (_match, major, minor, patch, prerelease) => {\n\t\tif (isWildcard(major)) return \"\";\n\t\tif (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (isWildcard(patch)) return major === \"0\" ? `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (prerelease) return major === \"0\" ? minor === \"0\" ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch}-${prerelease} <${Number(major) + 1}.0.0-0`;\n\t\treturn major === \"0\" ? minor === \"0\" ? `>=${major}.${minor}.${patch} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${Number(major) + 1}.0.0-0`;\n\t});\n}\nfunction replaceCarets(comparator, options) {\n\treturn comparator.trim().split(/\\s+/).map((part) => replaceCaret(part, options)).join(\" \");\n}\nfunction replaceXRange(comparator, options) {\n\tconst expression = options.loose ? LOOSE_XRANGE : STRICT_XRANGE;\n\treturn comparator.trim().replace(expression, (match, rawOperator, rawMajor, rawMinor, rawPatch) => {\n\t\tlet operator = rawOperator;\n\t\tlet major = rawMajor;\n\t\tlet minor = rawMinor;\n\t\tlet patch = rawPatch;\n\t\tif (hasInvalidWildcardOrder(String(major), minor === void 0 ? void 0 : String(minor), patch === void 0 ? void 0 : String(patch))) return comparator;\n\t\tconst wildcardMajor = isWildcard(major);\n\t\tconst wildcardMinor = wildcardMajor || isWildcard(minor);\n\t\tconst wildcardPatch = wildcardMinor || isWildcard(patch);\n\t\tif (operator === \"=\" && wildcardPatch) operator = \"\";\n\t\tif (wildcardMajor) return operator === \">\" || operator === \"<\" ? \"<0.0.0-0\" : \"*\";\n\t\tlet prerelease = options.includePrerelease ? \"-0\" : \"\";\n\t\tif (operator && wildcardPatch) {\n\t\t\tif (wildcardMinor) minor = 0;\n\t\t\tpatch = 0;\n\t\t\tif (operator === \">\") {\n\t\t\t\toperator = \">=\";\n\t\t\t\tif (wildcardMinor) {\n\t\t\t\t\tmajor = Number(major) + 1;\n\t\t\t\t\tminor = 0;\n\t\t\t\t} else minor = Number(minor) + 1;\n\t\t\t} else if (operator === \"<=\") {\n\t\t\t\toperator = \"<\";\n\t\t\t\tif (wildcardMinor) major = Number(major) + 1;\n\t\t\t\telse minor = Number(minor) + 1;\n\t\t\t}\n\t\t\tif (operator === \"<\") prerelease = \"-0\";\n\t\t\treturn `${operator}${major}.${minor}.${patch}${prerelease}`;\n\t\t}\n\t\tif (wildcardMinor) return `>=${major}.0.0${prerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (wildcardPatch) return `>=${major}.${minor}.0${prerelease} <${major}.${Number(minor) + 1}.0-0`;\n\t\treturn match;\n\t});\n}\nfunction replaceXRanges(comparator, options) {\n\treturn comparator.split(/\\s+/).map((part) => replaceXRange(part, options)).join(\" \");\n}\nfunction replaceHyphenRange(range, options) {\n\tconst expression = options.loose ? LOOSE_HYPHEN : STRICT_HYPHEN;\n\treturn range.replace(expression, (_match, rawFrom, fromMajor, fromMinor, fromPatch, fromPrerelease, _fromBuild, rawTo, toMajor, toMinor, toPatch, toPrerelease) => {\n\t\tlet from = rawFrom;\n\t\tlet to = rawTo;\n\t\tif (isWildcard(fromMajor)) from = \"\";\n\t\telse if (isWildcard(fromMinor)) from = `>=${fromMajor}.0.0${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\telse if (isWildcard(fromPatch)) from = `>=${fromMajor}.${fromMinor}.0${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\telse if (fromPrerelease) from = `>=${from}`;\n\t\telse from = `>=${from}${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\tif (isWildcard(toMajor)) to = \"\";\n\t\telse if (isWildcard(toMinor)) to = `<${Number(toMajor) + 1}.0.0-0`;\n\t\telse if (isWildcard(toPatch)) to = `<${toMajor}.${Number(toMinor) + 1}.0-0`;\n\t\telse if (toPrerelease) to = `<=${toMajor}.${toMinor}.${toPatch}-${toPrerelease}`;\n\t\telse if (options.includePrerelease) to = `<${toMajor}.${toMinor}.${Number(toPatch) + 1}-0`;\n\t\telse to = `<=${to}`;\n\t\treturn `${from} ${to}`.trim();\n\t});\n}\nfunction expandComparator(comparator, options) {\n\treturn replaceXRanges(replaceTildes(replaceCarets(comparator.replace(BUILD_SAFE, \"\"), options), options), options).trim().replace(STAR, \"\");\n}\nfunction parseSimpleRange(input, options) {\n\tlet parts = replaceHyphenRange(input.replace(BUILD_STRIP, \"\"), options).replace(COMPARATOR_TRIM, \"$1$2$3\").replace(TILDE_TRIM, \"$1~\").replace(CARET_TRIM, \"$1^\").split(\" \").map((part) => expandComparator(part, options)).join(\" \").split(/\\s+/).map((part) => part.trim().replace(options.includePrerelease ? GTE_ZERO_PRERELEASE : GTE_ZERO, \"\"));\n\tif (options.loose) parts = parts.filter((part) => LOOSE_COMPARATOR.test(part));\n\tconst unique = /* @__PURE__ */ new Map();\n\tfor (const comparator of parts.map((part) => parseComparator(part, options))) {\n\t\tif (comparator.value === \"<0.0.0-0\") return [comparator];\n\t\tunique.set(comparator.value, comparator);\n\t}\n\tif (unique.size > 1) unique.delete(\"\");\n\treturn [...unique.values()];\n}\nfunction parseRange(range, options = {}) {\n\tif (typeof range !== \"string\") return range;\n\tconst parsedOptions = { ...options };\n\tconst raw = range.trim().replaceAll(/\\s+/g, \" \");\n\tlet sets = raw.split(\"||\").map((part) => parseSimpleRange(part.trim(), parsedOptions)).filter((set) => set.length);\n\tif (!sets.length) throw new TypeError(`Range contains no valid comparator sets: ${raw}`);\n\tif (sets.length > 1) {\n\t\tconst first = sets[0];\n\t\tsets = sets.filter((set) => set[0]?.value !== \"<0.0.0-0\");\n\t\tif (!sets.length) sets = [first];\n\t\telse if (sets.length > 1) {\n\t\t\tconst any = sets.find((set) => set.length === 1 && set[0]?.value === \"\");\n\t\t\tif (any) sets = [any];\n\t\t}\n\t}\n\treturn {\n\t\tnormalized: sets.map((set) => set.map((comparator) => comparator.value).join(\" \")).join(\"||\"),\n\t\toptions: parsedOptions,\n\t\traw,\n\t\tsets\n\t};\n}\nfunction tryParseRange(range, options = {}) {\n\ttry {\n\t\treturn parseRange(range, options);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction testParsedRange(range, version) {\n\treturn range.sets.some((set) => testComparatorSet(set, version, range.options));\n}\nfunction testRangeVersion(range, version) {\n\tconst parsed = tryParse(version, range.options);\n\treturn parsed ? testParsedRange(range, parsed) : false;\n}\nfunction exactVersion(set) {\n\tfor (const comparator of set) if (comparator.operator === \"\" && comparator.version) return comparator.version;\n\treturn null;\n}\nfunction isSatisfiable(comparators, options) {\n\tconst exact = exactVersion(comparators);\n\tif (exact) return testComparatorSet(comparators, exact, options);\n\tconst remaining = [...comparators];\n\tlet current = remaining.pop();\n\twhile (current && remaining.length) {\n\t\tif (remaining.some((other) => !parsedComparatorsIntersect(current, other, options))) return false;\n\t\tcurrent = remaining.pop();\n\t}\n\treturn true;\n}\nfunction setsIntersect(left, right, options) {\n\tconst leftExact = exactVersion(left);\n\tif (leftExact) return testComparatorSet(right, leftExact, options);\n\tconst rightExact = exactVersion(right);\n\tif (rightExact) return testComparatorSet(left, rightExact, options);\n\treturn left.every((leftComparator) => right.every((rightComparator) => parsedComparatorsIntersect(leftComparator, rightComparator, options)));\n}\nfunction parsedRangesIntersect(left, right, options = {}) {\n\treturn left.sets.some((leftSet) => isSatisfiable(leftSet, options) && right.sets.some((rightSet) => isSatisfiable(rightSet, options) && setsIntersect(leftSet, rightSet, options)));\n}\n//#endregion\n//#region src/range.ts\nfunction isValidRange(range, options = {}) {\n\treturn tryParseRange(range, options) !== null;\n}\nfunction normalizeRange(range, options = {}) {\n\tconst parsed = tryParseRange(range, options);\n\treturn parsed ? parsed.normalized || \"*\" : null;\n}\nfunction satisfies(version, range, options = {}) {\n\tconst parsed = tryParseRange(range, options);\n\treturn parsed ? testRangeVersion(parsed, version) : false;\n}\nfunction rangeToComparators(range, options = {}) {\n\treturn parseRange(range, options).sets.map((set) => set.map((comparator) => comparator.value).join(\" \").trim().split(\" \"));\n}\nfunction findMaxSatisfying(versions, range, options = {}) {\n\tconst parsedRange = tryParseRange(range, options);\n\tif (!parsedRange) return null;\n\tlet maximum = null;\n\tlet maximumParsed = null;\n\tfor (const version of versions) {\n\t\tconst parsedVersion = tryParse(version, parsedRange.options);\n\t\tif (!parsedVersion || !testParsedRange(parsedRange, parsedVersion)) continue;\n\t\tif (!maximumParsed || compareParsed(maximumParsed, parsedVersion) < 0) {\n\t\t\tmaximum = version;\n\t\t\tmaximumParsed = parsedVersion;\n\t\t}\n\t}\n\treturn maximum;\n}\nfunction findMinSatisfying(versions, range, options = {}) {\n\tconst parsedRange = tryParseRange(range, options);\n\tif (!parsedRange) return null;\n\tlet minimum = null;\n\tlet minimumParsed = null;\n\tfor (const version of versions) {\n\t\tconst parsedVersion = tryParse(version, parsedRange.options);\n\t\tif (!parsedVersion || !testParsedRange(parsedRange, parsedVersion)) continue;\n\t\tif (!minimumParsed || compareParsed(minimumParsed, parsedVersion) > 0) {\n\t\t\tminimum = version;\n\t\t\tminimumParsed = parsedVersion;\n\t\t}\n\t}\n\treturn minimum;\n}\nfunction nextVersionAfter(version) {\n\tconst { prerelease } = version;\n\treturn parse(formatComparableVersion(prerelease?.length ? {\n\t\tmajor: version.major,\n\t\tminor: version.minor,\n\t\tpatch: version.patch,\n\t\tprerelease: [...prerelease, 0]\n\t} : {\n\t\tmajor: version.major,\n\t\tminor: version.minor,\n\t\tpatch: version.patch + 1\n\t}));\n}\nfunction findMinimumForRange(range, options = {}) {\n\tconst parsedRange = parseRange(range, options);\n\tconst zero = parse(\"0.0.0\");\n\tif (testParsedRange(parsedRange, zero)) return formatComparableVersion(zero);\n\tconst zeroPrerelease = parse(\"0.0.0-0\");\n\tif (testParsedRange(parsedRange, zeroPrerelease)) return formatComparableVersion(zeroPrerelease);\n\tlet minimum = null;\n\tfor (const set of parsedRange.sets) {\n\t\tlet setMinimum = null;\n\t\tfor (const comparator of set) {\n\t\t\tif (!comparator.version) continue;\n\t\t\tconst candidate = comparator.operator === \">\" ? nextVersionAfter(comparator.version) : comparator.operator === \"\" || comparator.operator === \">=\" ? comparator.version : null;\n\t\t\tif (candidate && (!setMinimum || compareParsed(candidate, setMinimum) > 0)) setMinimum = candidate;\n\t\t}\n\t\tif (setMinimum && (!minimum || compareParsed(minimum, setMinimum) > 0)) minimum = setMinimum;\n\t}\n\treturn minimum && testParsedRange(parsedRange, minimum) ? formatComparableVersion(minimum) : null;\n}\nfunction compareInDirection(left, right, direction) {\n\tconst comparison = compareParsed(left, right);\n\treturn direction === \">\" ? comparison > 0 : comparison < 0;\n}\nfunction compareOppositeOrEqual(left, right, direction) {\n\tconst comparison = compareParsed(left, right);\n\treturn direction === \">\" ? comparison <= 0 : comparison >= 0;\n}\nfunction compareOpposite(left, right, direction) {\n\tconst comparison = compareParsed(left, right);\n\treturn direction === \">\" ? comparison < 0 : comparison > 0;\n}\nfunction isOutsideRange(version, range, direction, options = {}) {\n\tif (direction !== \">\" && direction !== \"<\") throw new TypeError(\"Must provide a direction of \\\"<\\\" or \\\">\\\"\");\n\tconst parsedRange = parseRange(range, options);\n\tconst parsedVersion = parse(version, parsedRange.options);\n\tif (testParsedRange(parsedRange, parsedVersion)) return false;\n\tconst inclusiveDirection = direction === \">\" ? \">=\" : \"<=\";\n\tfor (const set of parsedRange.sets) {\n\t\tconst concrete = set.map((comparator) => comparator.version ? comparator : parseComparator(\">=0.0.0\"));\n\t\tlet high = concrete[0];\n\t\tlet low = concrete[0];\n\t\tfor (const comparator of concrete) if (compareInDirection(comparator.version, high.version, direction)) high = comparator;\n\t\telse if (compareOpposite(comparator.version, low.version, direction)) low = comparator;\n\t\tif (high.operator === direction || high.operator === inclusiveDirection) return false;\n\t\tif ((!low.operator || low.operator === direction) && compareOppositeOrEqual(parsedVersion, low.version, direction)) return false;\n\t\tif (low.operator === inclusiveDirection && compareOpposite(parsedVersion, low.version, direction)) return false;\n\t}\n\treturn true;\n}\nfunction isGreaterThanRange(version, range, options = {}) {\n\treturn isOutsideRange(version, range, \">\", options);\n}\nfunction isLessThanRange(version, range, options = {}) {\n\treturn isOutsideRange(version, range, \"<\", options);\n}\nfunction rangesIntersect(left, right, options = {}) {\n\tconst parsedLeft = parseRange(left, options);\n\tconst parsedRight = parseRange(right, options);\n\treturn parsedRangesIntersect(parsedLeft, parsedRight, {\n\t\t...parsedLeft.options,\n\t\t...parsedRight.options,\n\t\t...options\n\t});\n}\nfunction simplifyRange(versions, range, options = {}) {\n\tconst parsedRange = parseRange(range, options);\n\tconst sorted = sort(versions, parsedRange.options);\n\tconst sets = [];\n\tlet first = null;\n\tlet previous = null;\n\tfor (const version of sorted) if (testRangeVersion(parsedRange, version)) {\n\t\tprevious = version;\n\t\tfirst ??= version;\n\t} else if (previous) {\n\t\tsets.push([first, previous]);\n\t\tfirst = null;\n\t\tprevious = null;\n\t}\n\tif (first) sets.push([first, null]);\n\tconst simplified = sets.map(([minimum, maximum]) => {\n\t\tconst minimumValue = formatComparableVersion(parse(minimum, parsedRange.options));\n\t\tconst maximumValue = maximum ? formatComparableVersion(parse(maximum, parsedRange.options)) : null;\n\t\tif (minimumValue === maximumValue) return minimumValue;\n\t\tif (!maximum && minimum === sorted[0]) return \"*\";\n\t\tif (!maximumValue) return `>=${minimumValue}`;\n\t\tif (minimum === sorted[0]) return `<=${maximumValue}`;\n\t\treturn `${minimumValue} - ${maximumValue}`;\n\t}).join(\" || \");\n\tconst original = typeof range === \"string\" ? range : range.raw;\n\treturn simplified.length < original.length ? simplified : original;\n}\nfunction higherLowerBound(left, right) {\n\tif (!left) return right;\n\tconst comparison = compareParsed(left.version, right.version);\n\treturn comparison > 0 ? left : comparison < 0 || right.operator === \">\" && left.operator === \">=\" ? right : left;\n}\nfunction lowerUpperBound(left, right) {\n\tif (!left) return right;\n\tconst comparison = compareParsed(left.version, right.version);\n\treturn comparison < 0 ? left : comparison > 0 || right.operator === \"<\" && left.operator === \"<=\" ? right : left;\n}\nfunction simpleRangeSubset(rawSubset, rawSuperset, options) {\n\tlet subset = rawSubset;\n\tlet superset = rawSuperset;\n\tconst subsetAny = subset.length === 1 && !subset[0].version;\n\tconst supersetAny = superset.length === 1 && !superset[0].version;\n\tif (subsetAny) {\n\t\tif (supersetAny) return true;\n\t\tsubset = [parseComparator(options.includePrerelease ? \">=0.0.0-0\" : \">=0.0.0\")];\n\t}\n\tif (supersetAny) {\n\t\tif (options.includePrerelease) return true;\n\t\tsuperset = [parseComparator(\">=0.0.0\")];\n\t}\n\tconst equal = /* @__PURE__ */ new Map();\n\tlet lower;\n\tlet upper;\n\tfor (const comparator of subset) if (comparator.operator === \">\" || comparator.operator === \">=\") lower = higherLowerBound(lower, comparator);\n\telse if (comparator.operator === \"<\" || comparator.operator === \"<=\") upper = lowerUpperBound(upper, comparator);\n\telse if (comparator.version) equal.set(formatComparableVersion(comparator.version), comparator.version);\n\tif (equal.size > 1) return null;\n\tlet boundsComparison;\n\tif (lower && upper) {\n\t\tboundsComparison = compareParsed(lower.version, upper.version);\n\t\tif (boundsComparison > 0) return null;\n\t\tif (boundsComparison === 0 && (lower.operator !== \">=\" || upper.operator !== \"<=\")) return null;\n\t}\n\tfor (const version of equal.values()) {\n\t\tif (lower && !testParsedComparator(lower, version)) return null;\n\t\tif (upper && !testParsedComparator(upper, version)) return null;\n\t\treturn testComparatorSet(superset, version, options);\n\t}\n\tlet needsLowerPrerelease = lower && !options.includePrerelease && lower.version.prerelease?.length ? lower.version : null;\n\tlet needsUpperPrerelease = upper && !options.includePrerelease && upper.version.prerelease?.length ? upper.version : null;\n\tconst upperPrerelease = needsUpperPrerelease?.prerelease;\n\tif (upperPrerelease?.length === 1 && upper?.operator === \"<\" && upperPrerelease[0] === 0) needsUpperPrerelease = null;\n\tlet hasSupersetLower = false;\n\tlet hasSupersetUpper = false;\n\tfor (const comparator of superset) {\n\t\thasSupersetLower ||= comparator.operator === \">\" || comparator.operator === \">=\";\n\t\thasSupersetUpper ||= comparator.operator === \"<\" || comparator.operator === \"<=\";\n\t\tif (lower) {\n\t\t\tif (needsLowerPrerelease && comparatorAllowsPrerelease(comparator, needsLowerPrerelease)) needsLowerPrerelease = null;\n\t\t\tif (comparator.operator === \">\" || comparator.operator === \">=\") {\n\t\t\t\tconst higher = higherLowerBound(lower, comparator);\n\t\t\t\tif (higher === comparator && higher !== lower) return false;\n\t\t\t} else if (lower.operator === \">=\" && !testParsedComparator(comparator, lower.version)) return false;\n\t\t}\n\t\tif (upper) {\n\t\t\tif (needsUpperPrerelease && comparatorAllowsPrerelease(comparator, needsUpperPrerelease)) needsUpperPrerelease = null;\n\t\t\tif (comparator.operator === \"<\" || comparator.operator === \"<=\") {\n\t\t\t\tconst lowerBound = lowerUpperBound(upper, comparator);\n\t\t\t\tif (lowerBound === comparator && lowerBound !== upper) return false;\n\t\t\t} else if (upper.operator === \"<=\" && !testParsedComparator(comparator, upper.version)) return false;\n\t\t}\n\t\tif (comparator.operator === \"\" && (lower || upper) && boundsComparison !== 0) return false;\n\t}\n\tif (lower && hasSupersetUpper && !upper && boundsComparison !== 0) return false;\n\tif (upper && hasSupersetLower && !lower && boundsComparison !== 0) return false;\n\treturn !needsLowerPrerelease && !needsUpperPrerelease;\n}\nfunction isRangeSubset(subset, superset, options = {}) {\n\tif (subset === superset) return true;\n\tconst parsedSubset = parseRange(subset, options);\n\tconst parsedSuperset = parseRange(superset, options);\n\tconst effectiveOptions = {\n\t\t...parsedSubset.options,\n\t\t...parsedSuperset.options,\n\t\t...options\n\t};\n\tlet sawNonNull = false;\n\tfor (const subsetSet of parsedSubset.sets) {\n\t\tlet matched = false;\n\t\tfor (const supersetSet of parsedSuperset.sets) {\n\t\t\tconst result = simpleRangeSubset(subsetSet, supersetSet, effectiveOptions);\n\t\t\tsawNonNull ||= result !== null;\n\t\t\tif (result) {\n\t\t\t\tmatched = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!matched && sawNonNull) return false;\n\t}\n\treturn true;\n}\n//#endregion\n//#region src/version.ts\nfunction isValid(version, options = {}) {\n\treturn tryParse(version, options) !== null;\n}\nfunction isPrerelease(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\tif (!parsed) return null;\n\treturn !!parsed.prerelease?.length;\n}\nfunction isStable(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\tif (!parsed) return null;\n\treturn !parsed.prerelease?.length;\n}\nfunction normalizeFull(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\treturn parsed ? formatFullVersion(parsed) : null;\n}\nfunction normalize(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\treturn parsed ? formatComparableVersion(parsed) : null;\n}\nfunction clean(version, options = {}) {\n\tif (typeof version !== \"string\") return normalize(version, options);\n\treturn normalize(version.trim().replace(/^[=v]+/, \"\"), options);\n}\nfunction coerce(value, options = {}) {\n\tconst parsed = coerceParsedVersion(value, options);\n\treturn parsed ? formatFullVersion(parsed) : null;\n}\nfunction increment(version, release, options = {}) {\n\ttry {\n\t\treturn incrementParsedVersion(parse(version, options), release, options.identifier, options.identifierBase, options.loose);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction truncate(version, truncation, options = {}) {\n\tif (!TRUNCATION_TYPES.includes(truncation)) return null;\n\tconst parsed = tryParse(version, options);\n\tif (!parsed) return null;\n\tif (truncation.startsWith(\"pre\")) return formatComparableVersion(parsed);\n\treturn formatComparableVersion({\n\t\tmajor: parsed.major,\n\t\tminor: truncation === \"major\" ? 0 : parsed.minor,\n\t\tpatch: truncation === \"major\" || truncation === \"minor\" ? 0 : parsed.patch\n\t});\n}\nfunction difference(left, right) {\n\tconst leftVersion = parse(left);\n\tconst rightVersion = parse(right);\n\tconst comparison = compareParsed(leftVersion, rightVersion);\n\tif (comparison === 0) return null;\n\tconst high = comparison > 0 ? leftVersion : rightVersion;\n\tconst low = comparison > 0 ? rightVersion : leftVersion;\n\tconst highHasPrerelease = high.prerelease?.length;\n\tif (low.prerelease?.length && !highHasPrerelease) {\n\t\tif (low.patch === 0 && low.minor === 0) return \"major\";\n\t\tif (compareMainParsed(low, high) === 0) return low.minor !== 0 && low.patch === 0 ? \"minor\" : \"patch\";\n\t}\n\tconst prefix = highHasPrerelease ? \"pre\" : \"\";\n\tif (leftVersion.major !== rightVersion.major) return `${prefix}major`;\n\tif (leftVersion.minor !== rightVersion.minor) return `${prefix}minor`;\n\tif (leftVersion.patch !== rightVersion.patch) return `${prefix}patch`;\n\treturn \"prerelease\";\n}\nfunction getMajor(version, options = {}) {\n\treturn parse(version, options).major;\n}\nfunction getMinor(version, options = {}) {\n\treturn parse(version, options).minor;\n}\nfunction getPatch(version, options = {}) {\n\treturn parse(version, options).patch;\n}\nfunction getPrerelease(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\treturn parsed ? [...parsed.prerelease || []] : null;\n}\nfunction getBuild(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\treturn parsed ? [...parsed.build || []] : null;\n}\n//#endregion\nexport { INCREMENT_TYPES, SEMVER_SPEC_VERSION, TRUNCATION_TYPES, clean, coerce, comparatorsIntersect, compare, compareBuild, compareIdentifiers, compareIdentifiersReversed, compareMain, comparePrerelease, compareReversed, compareWithOperator, difference, findMaxSatisfying, findMinSatisfying, findMinimumForRange, getBuild, getMajor, getMinor, getPatch, getPrerelease, increment, isEqual, isGreater, isGreaterOrEqual, isGreaterThanRange, isLess, isLessOrEqual, isLessThanRange, isNotEqual, isOutsideRange, isPrerelease, isRangeSubset, isStable, isValid, isValidRange, normalize, normalizeComparator, normalizeFull, normalizeRange, parse, parseRange, rangeToComparators, rangesIntersect, satisfies, satisfiesComparator, simplifyRange, sort, sortReversed, truncate, tryParse, tryParseRange };\n", "import { coerce, satisfies } from \"verkit\";\n//#region src/semverSatisfies.ts\nconst semverSatisfies = (targetAppVersion, currentVersion) => {\n\tconst currentCoerce = coerce(currentVersion);\n\tif (!currentCoerce) return false;\n\treturn satisfies(currentCoerce, targetAppVersion);\n};\n//#endregion\nexport { semverSatisfies };\n", "import { semverSatisfies } from \"./semverSatisfies.mjs\";\n//#region src/filterCompatibleAppVersions.ts\n/**\n* Filters target app versions that are compatible with the current app version.\n* Returns only versions that are compatible with the current version according to semver rules.\n*\n* @param targetAppVersionList - List of target app versions to filter\n* @param currentVersion - Current app version\n* @returns Array of target app versions compatible with the current version\n*/\nconst filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {\n\treturn targetAppVersionList.filter((version) => semverSatisfies(version, currentVersion)).sort((a, b) => b.localeCompare(a));\n};\n//#endregion\nexport { filterCompatibleAppVersions };\n", "import { BundleUnitOfWork } from \"./bundleUnitOfWork.mjs\";\nimport { getRequestBundleUnitOfWork } from \"./bundleUnitOfWorkStore.mjs\";\n//#region src/requestUpdateBundleState.ts\nconst toBundleSeeds = (seeds) => seeds.filter((seed) => !!seed);\nconst seedRequestUpdateBundles = (context, seeds) => {\n\tconst unitOfWork = getRequestBundleUnitOfWork(context);\n\tif (!unitOfWork) return;\n\tconst nextSeeds = toBundleSeeds(seeds);\n\tif (nextSeeds.length === 0) return;\n\tunitOfWork.seed(nextSeeds);\n};\nconst getRequestUpdateBundleSeeds = (context) => {\n\treturn getRequestBundleUnitOfWork(context)?.seededBundles() ?? [];\n};\nconst createRequestUpdateBundleResolver = (context) => {\n\tconst unitOfWork = getRequestBundleUnitOfWork(context) ?? new BundleUnitOfWork();\n\treturn {\n\t\thasSeededBundles: () => unitOfWork.hasSeeds(),\n\t\tpeek: (bundleId) => unitOfWork.peek(bundleId),\n\t\tgetById: (bundleId, loadBundleById) => unitOfWork.getById(bundleId, loadBundleById)\n\t};\n};\n//#endregion\nexport { createRequestUpdateBundleResolver, getRequestUpdateBundleSeeds, seedRequestUpdateBundles };\n", "//#region src/bundleArtifacts.ts\nconst stripBundleArtifactMetadata = (metadata) => metadata;\nconst getManifestStorageUri = (bundle) => bundle.manifestStorageUri ?? null;\nconst getManifestFileHash = (bundle) => bundle.manifestFileHash ?? null;\nconst getAssetBaseStorageUri = (bundle) => bundle.assetBaseStorageUri ?? null;\nconst isBundlePatchArtifact = (value) => {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst candidate = value;\n\treturn typeof candidate.baseBundleId === \"string\" && typeof candidate.baseFileHash === \"string\" && typeof candidate.patchFileHash === \"string\" && typeof candidate.patchStorageUri === \"string\";\n};\nconst readBundlePatchArray = (patches) => {\n\tif (!Array.isArray(patches)) return [];\n\treturn patches.filter(isBundlePatchArtifact);\n};\nconst getBundlePatches = (bundle) => {\n\tconst patches = readBundlePatchArray(bundle.patches);\n\tconst seenBaseBundleIds = /* @__PURE__ */ new Set();\n\treturn patches.filter((patch) => {\n\t\tif (seenBaseBundleIds.has(patch.baseBundleId)) return false;\n\t\tseenBaseBundleIds.add(patch.baseBundleId);\n\t\treturn true;\n\t});\n};\nconst getBundlePatch = (bundle, baseBundleId) => {\n\treturn getBundlePatches(bundle).find((patch) => patch.baseBundleId === baseBundleId) ?? null;\n};\nconst getPrimaryPatch = (bundle) => {\n\treturn getBundlePatches(bundle)[0] ?? null;\n};\nconst getPatchBaseBundleId = (bundle) => bundle.patchBaseBundleId ?? getPrimaryPatch(bundle)?.baseBundleId ?? null;\nconst getPatchBaseFileHash = (bundle) => bundle.patchBaseFileHash ?? getPrimaryPatch(bundle)?.baseFileHash ?? null;\nconst getPatchFileHash = (bundle) => bundle.patchFileHash ?? getPrimaryPatch(bundle)?.patchFileHash ?? null;\nconst getPatchStorageUri = (bundle) => bundle.patchStorageUri ?? getPrimaryPatch(bundle)?.patchStorageUri ?? null;\n//#endregion\n//#region src/rollout.ts\nconst NUMERIC_COHORT_SIZE = 1e3;\nconst DEFAULT_ROLLOUT_COHORT_COUNT = NUMERIC_COHORT_SIZE;\nconst MAX_COHORT_LENGTH = 64;\nconst INVALID_COHORT_ERROR_MESSAGE = `Invalid cohort. Use 1-1000 or a lowercase slug without spaces, up to 64 characters.`;\nconst CUSTOM_COHORT_PATTERN = /^[a-z0-9-]+$/;\nfunction parseNumericCohortValue(cohort) {\n\tif (!/^\\d+$/.test(cohort)) return null;\n\tconst parsed = Number.parseInt(cohort, 10);\n\tif (Number.isNaN(parsed) || parsed < 1 || parsed > 1e3) return null;\n\treturn parsed;\n}\nfunction positiveMod(value, modulus) {\n\treturn (value % modulus + modulus) % modulus;\n}\nfunction hashString(value) {\n\tlet hash = 0;\n\tfor (let i = 0; i < value.length; i++) {\n\t\tconst char = value.charCodeAt(i);\n\t\thash = (hash << 5) - hash + char;\n\t\thash |= 0;\n\t}\n\treturn hash;\n}\nfunction gcd(a, b) {\n\tlet x = Math.abs(a);\n\tlet y = Math.abs(b);\n\twhile (y !== 0) {\n\t\tconst next = x % y;\n\t\tx = y;\n\t\ty = next;\n\t}\n\treturn x;\n}\nfunction modularInverse(value, modulus) {\n\tlet t = 0;\n\tlet newT = 1;\n\tlet r = modulus;\n\tlet newR = positiveMod(value, modulus);\n\twhile (newR !== 0) {\n\t\tconst quotient = Math.floor(r / newR);\n\t\t[t, newT] = [newT, t - quotient * newT];\n\t\t[r, newR] = [newR, r - quotient * newR];\n\t}\n\tif (r > 1) throw new Error(`No modular inverse for ${value} mod ${modulus}`);\n\treturn positiveMod(t, modulus);\n}\nfunction getRolloutShuffleParameters(bundleId) {\n\tlet multiplier = positiveMod(hashString(`${bundleId}:multiplier`), 997);\n\tif (multiplier === 0) multiplier = 1;\n\twhile (gcd(multiplier, NUMERIC_COHORT_SIZE) !== 1) {\n\t\tmultiplier = positiveMod(multiplier + 1, NUMERIC_COHORT_SIZE);\n\t\tif (multiplier === 0) multiplier = 1;\n\t}\n\tconst offset = positiveMod(hashString(`${bundleId}:offset`), NUMERIC_COHORT_SIZE);\n\treturn {\n\t\tmultiplier,\n\t\toffset,\n\t\tinverseMultiplier: modularInverse(multiplier, NUMERIC_COHORT_SIZE)\n\t};\n}\nfunction normalizeRolloutCohortCount(rolloutCohortCount) {\n\tif (rolloutCohortCount === null || rolloutCohortCount === void 0) return DEFAULT_ROLLOUT_COHORT_COUNT;\n\tif (rolloutCohortCount <= 0) return 0;\n\tif (rolloutCohortCount >= 1e3) return NUMERIC_COHORT_SIZE;\n\treturn Math.floor(rolloutCohortCount);\n}\nfunction normalizeCohortValue(cohort) {\n\tconst normalized = cohort.trim().toLowerCase();\n\tconst numericCohort = parseNumericCohortValue(normalized);\n\tif (numericCohort !== null) return String(numericCohort);\n\treturn normalized;\n}\nfunction getNumericCohortValue(cohort) {\n\treturn parseNumericCohortValue(normalizeCohortValue(cohort));\n}\nfunction isNumericCohort(cohort) {\n\treturn getNumericCohortValue(cohort) !== null;\n}\nfunction isCustomCohort(cohort) {\n\tconst normalized = normalizeCohortValue(cohort);\n\treturn normalized.length > 0 && normalized.length <= 64 && !/^\\d+$/.test(normalized) && CUSTOM_COHORT_PATTERN.test(normalized);\n}\nfunction isValidCohort(cohort) {\n\tconst normalized = normalizeCohortValue(cohort);\n\treturn isNumericCohort(normalized) || isCustomCohort(normalized);\n}\nfunction getDefaultNumericCohort(identifier) {\n\tconst cohortValue = positiveMod(hashString(identifier), NUMERIC_COHORT_SIZE) + 1;\n\treturn String(cohortValue);\n}\nfunction getNumericCohortRolloutPosition(bundleId, cohortValue) {\n\tif (cohortValue < 1 || cohortValue > 1e3) throw new Error(`Invalid numeric cohort: ${cohortValue}`);\n\tconst { offset, inverseMultiplier } = getRolloutShuffleParameters(bundleId);\n\treturn positiveMod(inverseMultiplier * (cohortValue - 1 - offset), NUMERIC_COHORT_SIZE);\n}\nfunction getRolledOutNumericCohorts(bundleId, rolloutCohortCount) {\n\tconst normalizedRolloutCount = normalizeRolloutCohortCount(rolloutCohortCount);\n\tif (normalizedRolloutCount <= 0) return [];\n\treturn Array.from({ length: NUMERIC_COHORT_SIZE }, (_, index) => index + 1).filter((cohortValue) => {\n\t\tif (normalizedRolloutCount >= 1e3) return true;\n\t\treturn getNumericCohortRolloutPosition(bundleId, cohortValue) < normalizedRolloutCount;\n\t});\n}\nfunction isCohortEligibleForUpdate(bundleId, cohort, rolloutCohortCount, targetCohorts) {\n\tconst normalizedCohort = cohort === null || cohort === void 0 ? void 0 : normalizeCohortValue(cohort);\n\tconst normalizedTargetCohorts = targetCohorts?.map((targetCohort) => normalizeCohortValue(targetCohort)) ?? [];\n\tif (normalizedCohort !== void 0 && normalizedTargetCohorts.includes(normalizedCohort)) return true;\n\tconst normalizedRolloutCount = normalizeRolloutCohortCount(rolloutCohortCount);\n\tif (normalizedRolloutCount <= 0) return false;\n\tif (normalizedCohort === void 0) return normalizedRolloutCount >= NUMERIC_COHORT_SIZE;\n\tconst numericCohort = getNumericCohortValue(normalizedCohort);\n\tif (numericCohort === null) return false;\n\tif (normalizedRolloutCount >= 1e3) return true;\n\treturn getNumericCohortRolloutPosition(bundleId, numericCohort) < normalizedRolloutCount;\n}\n//#endregion\n//#region src/uuid.ts\nconst NIL_UUID = \"00000000-0000-0000-0000-000000000000\";\n//#endregion\nexport { DEFAULT_ROLLOUT_COHORT_COUNT, INVALID_COHORT_ERROR_MESSAGE, MAX_COHORT_LENGTH, NIL_UUID, NUMERIC_COHORT_SIZE, getAssetBaseStorageUri, getBundlePatch, getBundlePatches, getDefaultNumericCohort, getManifestFileHash, getManifestStorageUri, getNumericCohortRolloutPosition, getNumericCohortValue, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, getRolledOutNumericCohorts, isCohortEligibleForUpdate, isCustomCohort, isNumericCohort, isValidCohort, normalizeCohortValue, normalizeRolloutCohortCount, stripBundleArtifactMetadata };\n", "import { NIL_UUID, isCohortEligibleForUpdate } from \"@hot-updater/core\";\n//#region ../../node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.js\nconst LETTER_DASH_NUMBER = \"[a-zA-Z0-9-]\";\nconst NUMERIC_IDENTIFIER = String.raw`0|[1-9]\\d*`;\nconst NUMERIC_IDENTIFIER_LOOSE = String.raw`\\d+`;\nconst NON_NUMERIC_IDENTIFIER = String.raw`\\d*[a-zA-Z-]${LETTER_DASH_NUMBER}*`;\nconst MAIN_VERSION = String.raw`(${NUMERIC_IDENTIFIER})\\.(${NUMERIC_IDENTIFIER})\\.(${NUMERIC_IDENTIFIER})`;\nconst MAIN_VERSION_LOOSE = String.raw`(${NUMERIC_IDENTIFIER_LOOSE})\\.(${NUMERIC_IDENTIFIER_LOOSE})\\.(${NUMERIC_IDENTIFIER_LOOSE})`;\nconst PRERELEASE_IDENTIFIER = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER})`;\nconst PRERELEASE_IDENTIFIER_LOOSE = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER_LOOSE})`;\nconst PRERELEASE = String.raw`(?:-(${PRERELEASE_IDENTIFIER}(?:\\.${PRERELEASE_IDENTIFIER})*))`;\nconst PRERELEASE_LOOSE = String.raw`(?:-?(${PRERELEASE_IDENTIFIER_LOOSE}(?:\\.${PRERELEASE_IDENTIFIER_LOOSE})*))`;\nconst BUILD_IDENTIFIER = `${LETTER_DASH_NUMBER}+`;\nconst BUILD = String.raw`(?:\\+(${BUILD_IDENTIFIER}(?:\\.${BUILD_IDENTIFIER})*))`;\nconst FULL_PLAIN = `v?${MAIN_VERSION}${PRERELEASE}?${BUILD}?`;\nconst LOOSE_PLAIN = String.raw`[v=\\s]*${MAIN_VERSION_LOOSE}${PRERELEASE_LOOSE}?${BUILD}?`;\nconst GREATER_LESS_THAN = \"((?:<|>)?=?)\";\nconst XRANGE_IDENTIFIER = String.raw`${NUMERIC_IDENTIFIER}|x|X|\\*`;\nconst XRANGE_IDENTIFIER_LOOSE = String.raw`${NUMERIC_IDENTIFIER_LOOSE}|x|X|\\*`;\nconst XRANGE_PLAIN = String.raw`[v=\\s]*(${XRANGE_IDENTIFIER})(?:\\.(${XRANGE_IDENTIFIER})(?:\\.(${XRANGE_IDENTIFIER})(?:${PRERELEASE})?${BUILD}?)?)?`;\nconst XRANGE_PLAIN_LOOSE = String.raw`[v=\\s]*(${XRANGE_IDENTIFIER_LOOSE})(?:\\.(${XRANGE_IDENTIFIER_LOOSE})(?:\\.(${XRANGE_IDENTIFIER_LOOSE})(?:${PRERELEASE_LOOSE})?${BUILD}?)?)?`;\nconst LONE_TILDE = \"(?:~>?)\";\nconst LONE_CARET = String.raw`(?:\\^)`;\nconst COERCE_PLAIN = String.raw`(^|[^\\d])(\\d{1,${16}})(?:\\.(\\d{1,${16}}))?(?:\\.(\\d{1,${16}}))?`;\nconst COERCE = String.raw`${COERCE_PLAIN}(?:$|[^\\d])`;\nconst COERCE_FULL = String.raw`${COERCE_PLAIN}(?:${PRERELEASE})?(?:${BUILD})?(?:$|[^\\d])`;\nfunction makeSafeRegexSource(source) {\n\tconst replacements = [\n\t\t[String.raw`\\s`, 1],\n\t\t[String.raw`\\d`, 256],\n\t\t[LETTER_DASH_NUMBER, 250]\n\t];\n\tfor (const [token, maximum] of replacements) source = source.split(`${token}*`).join(`${token}{0,${maximum}}`).split(`${token}+`).join(`${token}{1,${maximum}}`);\n\treturn source;\n}\nfunction safeRegex(source, flags) {\n\treturn new RegExp(makeSafeRegexSource(source), flags);\n}\nconst NUMERIC$1 = /^\\d+$/;\nfunction compareIdentifiers(left, right) {\n\tif (typeof left === \"number\" && typeof right === \"number\") return left === right ? 0 : left < right ? -1 : 1;\n\tconst leftNumeric = NUMERIC$1.test(String(left));\n\tconst rightNumeric = NUMERIC$1.test(String(right));\n\tconst normalizedLeft = leftNumeric ? Number(left) : left;\n\tconst normalizedRight = rightNumeric ? Number(right) : right;\n\treturn normalizedLeft === normalizedRight ? 0 : leftNumeric && !rightNumeric ? -1 : rightNumeric && !leftNumeric ? 1 : normalizedLeft < normalizedRight ? -1 : 1;\n}\nconst FULL = safeRegex(`^${FULL_PLAIN}$`);\nconst LOOSE = safeRegex(`^${LOOSE_PLAIN}$`);\nsafeRegex(`^${PRERELEASE}$`);\nsafeRegex(`^${PRERELEASE_LOOSE}$`);\nconst COERCE_EXACT = safeRegex(COERCE);\nconst COERCE_FULL_EXACT = safeRegex(COERCE_FULL);\nconst NUMERIC = /^\\d+$/;\nfunction formatComparableVersion(version) {\n\tconst base = `${version.major}.${version.minor}.${version.patch}`;\n\treturn version.prerelease?.length ? `${base}-${version.prerelease.join(\".\")}` : base;\n}\nfunction formatFullVersion(version) {\n\tconst comparable = formatComparableVersion(version);\n\treturn version.build?.length ? `${comparable}+${version.build.join(\".\")}` : comparable;\n}\nfunction parse(version, options = {}) {\n\tif (typeof version !== \"string\") return version;\n\tif (version.length > 256) throw new TypeError(`Version exceeds the maximum length of 256 characters`);\n\tconst match = version.trim().match(options.loose ? LOOSE : FULL);\n\tif (!match) throw new TypeError(`Invalid version syntax: ${version}`);\n\tconst major = Number(match[1]);\n\tconst minor = Number(match[2]);\n\tconst patch = Number(match[3]);\n\tif (major > Number.MAX_SAFE_INTEGER || major < 0) throw new TypeError(`Invalid major version: ${match[1]}`);\n\tif (minor > Number.MAX_SAFE_INTEGER || minor < 0) throw new TypeError(`Invalid minor version: ${match[2]}`);\n\tif (patch > Number.MAX_SAFE_INTEGER || patch < 0) throw new TypeError(`Invalid patch version: ${match[3]}`);\n\tconst prerelease = match[4] ? match[4].split(\".\").map((identifier) => {\n\t\tif (NUMERIC.test(identifier)) {\n\t\t\tconst numeric = Number(identifier);\n\t\t\tif (numeric >= 0 && numeric < Number.MAX_SAFE_INTEGER) return numeric;\n\t\t}\n\t\treturn identifier;\n\t}) : void 0;\n\treturn {\n\t\tbuild: match[5]?.split(\".\"),\n\t\tmajor,\n\t\tminor,\n\t\tpatch,\n\t\tprerelease\n\t};\n}\nfunction tryParse(version, options = {}) {\n\ttry {\n\t\treturn parse(version, options);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction compareMainParsed(left, right) {\n\treturn left.major === right.major ? left.minor === right.minor ? left.patch === right.patch ? 0 : left.patch < right.patch ? -1 : 1 : left.minor < right.minor ? -1 : 1 : left.major < right.major ? -1 : 1;\n}\nfunction comparePrereleaseParsed(left, right) {\n\tconst leftPrerelease = left.prerelease;\n\tconst rightPrerelease = right.prerelease;\n\tif (leftPrerelease?.length && !rightPrerelease?.length) return -1;\n\tif (!leftPrerelease?.length && rightPrerelease?.length) return 1;\n\tif (!leftPrerelease?.length && !rightPrerelease?.length) return 0;\n\tfor (let index = 0;; index++) {\n\t\tconst leftIdentifier = leftPrerelease?.[index];\n\t\tconst rightIdentifier = rightPrerelease?.[index];\n\t\tif (leftIdentifier === void 0 && rightIdentifier === void 0) return 0;\n\t\tif (rightIdentifier === void 0) return 1;\n\t\tif (leftIdentifier === void 0) return -1;\n\t\tif (leftIdentifier !== rightIdentifier) return compareIdentifiers(leftIdentifier, rightIdentifier);\n\t}\n}\nfunction compareParsed(left, right) {\n\treturn compareMainParsed(left, right) || comparePrereleaseParsed(left, right);\n}\nfunction coerceParsedVersion(value, options = {}) {\n\tif (typeof value === \"object\") return value;\n\tconst input = typeof value === \"number\" ? String(value) : value;\n\tif (typeof input !== \"string\") return null;\n\tlet match = null;\n\tif (options.rtl) {\n\t\tconst expression = safeRegex(options.includePrerelease ? COERCE_FULL : COERCE, \"g\");\n\t\tlet next;\n\t\twhile ((next = expression.exec(input)) && (!match || match.index + match[0].length !== input.length)) {\n\t\t\tif (!match || next.index + next[0].length !== match.index + match[0].length) match = next;\n\t\t\texpression.lastIndex = next.index + next[1].length + next[2].length;\n\t\t}\n\t} else match = (options.includePrerelease ? COERCE_FULL_EXACT : COERCE_EXACT).exec(input);\n\tif (!match) return null;\n\tconst major = match[2];\n\treturn tryParse(`${major}.${match[3] || \"0\"}.${match[4] || \"0\"}${options.includePrerelease && match[5] ? `-${match[5]}` : \"\"}${options.includePrerelease && match[6] ? `+${match[6]}` : \"\"}`, options);\n}\nconst STRICT_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${FULL_PLAIN})$|^$`);\nconst LOOSE_COMPARATOR$1 = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN})$|^$`);\nfunction parseComparator(comparator, options = {}) {\n\tconst normalized = comparator.trim().replaceAll(/\\s+/g, \" \");\n\tconst match = normalized.match(options.loose ? LOOSE_COMPARATOR$1 : STRICT_COMPARATOR);\n\tif (!match) throw new TypeError(`Invalid comparator: ${normalized}`);\n\tconst operator = match[1] === \"=\" ? \"\" : match[1] || \"\";\n\tconst version = match[2] ? parse(match[2], options) : null;\n\treturn {\n\t\toperator,\n\t\toptions,\n\t\tvalue: version ? `${operator}${formatComparableVersion(version)}` : \"\",\n\t\tversion\n\t};\n}\nfunction testParsedComparator(comparator, version) {\n\tif (!comparator.version) return true;\n\tconst comparison = compareParsed(version, comparator.version);\n\tswitch (comparator.operator) {\n\t\tcase \"\": return comparison === 0;\n\t\tcase \">\": return comparison > 0;\n\t\tcase \">=\": return comparison >= 0;\n\t\tcase \"<\": return comparison < 0;\n\t\tcase \"<=\": return comparison <= 0;\n\t}\n}\nfunction comparatorAllowsPrerelease(comparator, version) {\n\tconst allowed = comparator.version;\n\treturn allowed !== null && !!allowed.prerelease?.length && allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch;\n}\nfunction testComparatorSet(set, version, options) {\n\tif (set.some((comparator) => !testParsedComparator(comparator, version))) return false;\n\treturn !version.prerelease?.length || !!options.includePrerelease || set.some((comparator) => comparatorAllowsPrerelease(comparator, version));\n}\nconst BUILD_STRIP = new RegExp(BUILD, \"g\");\nconst BUILD_SAFE = safeRegex(BUILD);\nconst STRICT_HYPHEN = safeRegex(String.raw`^\\s*(${XRANGE_PLAIN})\\s+-\\s+(${XRANGE_PLAIN})\\s*$`);\nconst LOOSE_HYPHEN = safeRegex(String.raw`^\\s*(${XRANGE_PLAIN_LOOSE})\\s+-\\s+(${XRANGE_PLAIN_LOOSE})\\s*$`);\nconst COMPARATOR_TRIM = safeRegex(String.raw`(\\s*)${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN}|${XRANGE_PLAIN})`, \"g\");\nconst TILDE_TRIM = safeRegex(String.raw`(\\s*)${LONE_TILDE}\\s+`, \"g\");\nconst CARET_TRIM = safeRegex(String.raw`(\\s*)${LONE_CARET}\\s+`, \"g\");\nconst STRICT_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN}$`);\nconst LOOSE_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN_LOOSE}$`);\nconst STRICT_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN}$`);\nconst LOOSE_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN_LOOSE}$`);\nconst STRICT_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*${XRANGE_PLAIN}$`);\nconst LOOSE_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*${XRANGE_PLAIN_LOOSE}$`);\nconst STAR = safeRegex(String.raw`(<|>)?=?\\s*\\*`);\nconst GTE_ZERO = /^\\s*>=\\s*0\\.0\\.0\\s*$/;\nconst GTE_ZERO_PRERELEASE = /^\\s*>=\\s*0\\.0\\.0-0\\s*$/;\nconst LOOSE_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN})$|^$`);\nfunction isWildcard(value) {\n\treturn !value || String(value).toLowerCase() === \"x\" || String(value) === \"*\";\n}\nfunction hasInvalidWildcardOrder(major, minor, patch) {\n\treturn isWildcard(major) && !isWildcard(minor) || isWildcard(minor) && Boolean(patch) && !isWildcard(patch);\n}\nfunction replaceTilde(comparator, options) {\n\tconst expression = options.loose ? LOOSE_TILDE : STRICT_TILDE;\n\tconst lowerPrerelease = options.includePrerelease ? \"-0\" : \"\";\n\treturn comparator.replace(expression, (_match, major, minor, patch, prerelease) => {\n\t\tif (isWildcard(major)) return \"\";\n\t\tif (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (isWildcard(patch)) return `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0`;\n\t\treturn prerelease ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0`;\n\t});\n}\nfunction replaceTildes(comparator, options) {\n\treturn comparator.trim().split(/\\s+/).map((part) => replaceTilde(part, options)).join(\" \");\n}\nfunction replaceCaret(comparator, options) {\n\tconst expression = options.loose ? LOOSE_CARET : STRICT_CARET;\n\tconst lowerPrerelease = options.includePrerelease ? \"-0\" : \"\";\n\treturn comparator.replace(expression, (_match, major, minor, patch, prerelease) => {\n\t\tif (isWildcard(major)) return \"\";\n\t\tif (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (isWildcard(patch)) return major === \"0\" ? `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (prerelease) return major === \"0\" ? minor === \"0\" ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch}-${prerelease} <${Number(major) + 1}.0.0-0`;\n\t\treturn major === \"0\" ? minor === \"0\" ? `>=${major}.${minor}.${patch} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${Number(major) + 1}.0.0-0`;\n\t});\n}\nfunction replaceCarets(comparator, options) {\n\treturn comparator.trim().split(/\\s+/).map((part) => replaceCaret(part, options)).join(\" \");\n}\nfunction replaceXRange(comparator, options) {\n\tconst expression = options.loose ? LOOSE_XRANGE : STRICT_XRANGE;\n\treturn comparator.trim().replace(expression, (match, rawOperator, rawMajor, rawMinor, rawPatch) => {\n\t\tlet operator = rawOperator;\n\t\tlet major = rawMajor;\n\t\tlet minor = rawMinor;\n\t\tlet patch = rawPatch;\n\t\tif (hasInvalidWildcardOrder(String(major), minor === void 0 ? void 0 : String(minor), patch === void 0 ? void 0 : String(patch))) return comparator;\n\t\tconst wildcardMajor = isWildcard(major);\n\t\tconst wildcardMinor = wildcardMajor || isWildcard(minor);\n\t\tconst wildcardPatch = wildcardMinor || isWildcard(patch);\n\t\tif (operator === \"=\" && wildcardPatch) operator = \"\";\n\t\tif (wildcardMajor) return operator === \">\" || operator === \"<\" ? \"<0.0.0-0\" : \"*\";\n\t\tlet prerelease = options.includePrerelease ? \"-0\" : \"\";\n\t\tif (operator && wildcardPatch) {\n\t\t\tif (wildcardMinor) minor = 0;\n\t\t\tpatch = 0;\n\t\t\tif (operator === \">\") {\n\t\t\t\toperator = \">=\";\n\t\t\t\tif (wildcardMinor) {\n\t\t\t\t\tmajor = Number(major) + 1;\n\t\t\t\t\tminor = 0;\n\t\t\t\t} else minor = Number(minor) + 1;\n\t\t\t} else if (operator === \"<=\") {\n\t\t\t\toperator = \"<\";\n\t\t\t\tif (wildcardMinor) major = Number(major) + 1;\n\t\t\t\telse minor = Number(minor) + 1;\n\t\t\t}\n\t\t\tif (operator === \"<\") prerelease = \"-0\";\n\t\t\treturn `${operator}${major}.${minor}.${patch}${prerelease}`;\n\t\t}\n\t\tif (wildcardMinor) return `>=${major}.0.0${prerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (wildcardPatch) return `>=${major}.${minor}.0${prerelease} <${major}.${Number(minor) + 1}.0-0`;\n\t\treturn match;\n\t});\n}\nfunction replaceXRanges(comparator, options) {\n\treturn comparator.split(/\\s+/).map((part) => replaceXRange(part, options)).join(\" \");\n}\nfunction replaceHyphenRange(range, options) {\n\tconst expression = options.loose ? LOOSE_HYPHEN : STRICT_HYPHEN;\n\treturn range.replace(expression, (_match, rawFrom, fromMajor, fromMinor, fromPatch, fromPrerelease, _fromBuild, rawTo, toMajor, toMinor, toPatch, toPrerelease) => {\n\t\tlet from = rawFrom;\n\t\tlet to = rawTo;\n\t\tif (isWildcard(fromMajor)) from = \"\";\n\t\telse if (isWildcard(fromMinor)) from = `>=${fromMajor}.0.0${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\telse if (isWildcard(fromPatch)) from = `>=${fromMajor}.${fromMinor}.0${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\telse if (fromPrerelease) from = `>=${from}`;\n\t\telse from = `>=${from}${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\tif (isWildcard(toMajor)) to = \"\";\n\t\telse if (isWildcard(toMinor)) to = `<${Number(toMajor) + 1}.0.0-0`;\n\t\telse if (isWildcard(toPatch)) to = `<${toMajor}.${Number(toMinor) + 1}.0-0`;\n\t\telse if (toPrerelease) to = `<=${toMajor}.${toMinor}.${toPatch}-${toPrerelease}`;\n\t\telse if (options.includePrerelease) to = `<${toMajor}.${toMinor}.${Number(toPatch) + 1}-0`;\n\t\telse to = `<=${to}`;\n\t\treturn `${from} ${to}`.trim();\n\t});\n}\nfunction expandComparator(comparator, options) {\n\treturn replaceXRanges(replaceTildes(replaceCarets(comparator.replace(BUILD_SAFE, \"\"), options), options), options).trim().replace(STAR, \"\");\n}\nfunction parseSimpleRange(input, options) {\n\tlet parts = replaceHyphenRange(input.replace(BUILD_STRIP, \"\"), options).replace(COMPARATOR_TRIM, \"$1$2$3\").replace(TILDE_TRIM, \"$1~\").replace(CARET_TRIM, \"$1^\").split(\" \").map((part) => expandComparator(part, options)).join(\" \").split(/\\s+/).map((part) => part.trim().replace(options.includePrerelease ? GTE_ZERO_PRERELEASE : GTE_ZERO, \"\"));\n\tif (options.loose) parts = parts.filter((part) => LOOSE_COMPARATOR.test(part));\n\tconst unique = /* @__PURE__ */ new Map();\n\tfor (const comparator of parts.map((part) => parseComparator(part, options))) {\n\t\tif (comparator.value === \"<0.0.0-0\") return [comparator];\n\t\tunique.set(comparator.value, comparator);\n\t}\n\tif (unique.size > 1) unique.delete(\"\");\n\treturn [...unique.values()];\n}\nfunction parseRange(range, options = {}) {\n\tif (typeof range !== \"string\") return range;\n\tconst parsedOptions = { ...options };\n\tconst raw = range.trim().replaceAll(/\\s+/g, \" \");\n\tlet sets = raw.split(\"||\").map((part) => parseSimpleRange(part.trim(), parsedOptions)).filter((set) => set.length);\n\tif (!sets.length) throw new TypeError(`Range contains no valid comparator sets: ${raw}`);\n\tif (sets.length > 1) {\n\t\tconst first = sets[0];\n\t\tsets = sets.filter((set) => set[0]?.value !== \"<0.0.0-0\");\n\t\tif (!sets.length) sets = [first];\n\t\telse if (sets.length > 1) {\n\t\t\tconst any = sets.find((set) => set.length === 1 && set[0]?.value === \"\");\n\t\t\tif (any) sets = [any];\n\t\t}\n\t}\n\treturn {\n\t\tnormalized: sets.map((set) => set.map((comparator) => comparator.value).join(\" \")).join(\"||\"),\n\t\toptions: parsedOptions,\n\t\traw,\n\t\tsets\n\t};\n}\nfunction tryParseRange(range, options = {}) {\n\ttry {\n\t\treturn parseRange(range, options);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction testParsedRange(range, version) {\n\treturn range.sets.some((set) => testComparatorSet(set, version, range.options));\n}\nfunction testRangeVersion(range, version) {\n\tconst parsed = tryParse(version, range.options);\n\treturn parsed ? testParsedRange(range, parsed) : false;\n}\nfunction satisfies(version, range, options = {}) {\n\tconst parsed = tryParseRange(range, options);\n\treturn parsed ? testRangeVersion(parsed, version) : false;\n}\nfunction coerce(value, options = {}) {\n\tconst parsed = coerceParsedVersion(value, options);\n\treturn parsed ? formatFullVersion(parsed) : null;\n}\n//#endregion\n//#region src/semverSatisfies.ts\nconst semverSatisfies = (targetAppVersion, currentVersion) => {\n\tconst currentCoerce = coerce(currentVersion);\n\tif (!currentCoerce) return false;\n\treturn satisfies(currentCoerce, targetAppVersion);\n};\n//#endregion\n//#region src/filterCompatibleAppVersions.ts\n/**\n* Filters target app versions that are compatible with the current app version.\n* Returns only versions that are compatible with the current version according to semver rules.\n*\n* @param targetAppVersionList - List of target app versions to filter\n* @param currentVersion - Current app version\n* @returns Array of target app versions compatible with the current version\n*/\nconst filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {\n\treturn targetAppVersionList.filter((version) => semverSatisfies(version, currentVersion)).sort((a, b) => b.localeCompare(a));\n};\n//#endregion\n//#region src/getUpdateInfo.ts\nconst INIT_BUNDLE_ROLLBACK_UPDATE_INFO = {\n\tmessage: null,\n\tid: NIL_UUID,\n\tshouldForceUpdate: true,\n\tstatus: \"ROLLBACK\",\n\tstorageUri: null,\n\tfileHash: null\n};\nconst makeResponse = (bundle, status) => ({\n\tid: bundle.id,\n\tmessage: bundle.message,\n\tshouldForceUpdate: status === \"ROLLBACK\" ? true : bundle.shouldForceUpdate,\n\tstatus,\n\tstorageUri: bundle.storageUri,\n\tfileHash: bundle.fileHash\n});\nconst isEligibleUpdateCandidate = (bundle, cohort) => {\n\treturn isCohortEligibleForUpdate(bundle.id, cohort, bundle.rolloutCohortCount, bundle.targetCohorts);\n};\nconst findLatestEligibleUpdateCandidate = (bundles, bundleId, cohort) => {\n\tlet updateCandidate = null;\n\tfor (const bundle of bundles) if (bundle.id.localeCompare(bundleId) > 0 && isEligibleUpdateCandidate(bundle, cohort) && (!updateCandidate || bundle.id.localeCompare(updateCandidate.id) > 0)) updateCandidate = bundle;\n\treturn updateCandidate;\n};\nconst getUpdateInfo = async (bundles, args) => {\n\tswitch (args._updateStrategy) {\n\t\tcase \"appVersion\": return appVersionStrategy(bundles, args);\n\t\tcase \"fingerprint\": return fingerprintStrategy(bundles, args);\n\t\tdefault: return null;\n\t}\n};\nconst appVersionStrategy = async (bundles, { channel = \"production\", minBundleId = NIL_UUID, platform, appVersion, bundleId, cohort }) => {\n\tconst candidateBundles = [];\n\tfor (const b of bundles) {\n\t\tif (b.platform !== platform || b.channel !== channel || !b.targetAppVersion || !semverSatisfies(b.targetAppVersion, appVersion) || !b.enabled || minBundleId && b.id.localeCompare(minBundleId) < 0) continue;\n\t\tcandidateBundles.push(b);\n\t}\n\tif (candidateBundles.length === 0) {\n\t\tif (bundleId === NIL_UUID || minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;\n\t\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n\t}\n\tlet rollbackCandidate = null;\n\tlet currentBundle;\n\tfor (const b of candidateBundles) if (b.id === bundleId) currentBundle = b;\n\telse if (bundleId !== NIL_UUID && b.id.localeCompare(bundleId) < 0) {\n\t\tif (!rollbackCandidate || b.id.localeCompare(rollbackCandidate.id) > 0) rollbackCandidate = b;\n\t}\n\tconst updateCandidate = findLatestEligibleUpdateCandidate(candidateBundles, bundleId, cohort);\n\tconst currentBundleEligible = currentBundle ? isEligibleUpdateCandidate(currentBundle, cohort) : false;\n\tif (bundleId === NIL_UUID) {\n\t\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\t\treturn null;\n\t}\n\tif (currentBundleEligible) {\n\t\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\t\treturn null;\n\t}\n\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\tif (rollbackCandidate) return makeResponse(rollbackCandidate, \"ROLLBACK\");\n\tif (minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;\n\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n};\nconst fingerprintStrategy = async (bundles, { channel = \"production\", minBundleId = NIL_UUID, platform, fingerprintHash, bundleId, cohort }) => {\n\tconst candidateBundles = [];\n\tfor (const b of bundles) {\n\t\tif (b.platform !== platform || b.channel !== channel || !b.fingerprintHash || b.fingerprintHash !== fingerprintHash || !b.enabled || minBundleId && b.id.localeCompare(minBundleId) < 0) continue;\n\t\tcandidateBundles.push(b);\n\t}\n\tif (candidateBundles.length === 0) {\n\t\tif (bundleId === NIL_UUID || minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;\n\t\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n\t}\n\tlet rollbackCandidate = null;\n\tlet currentBundle;\n\tfor (const b of candidateBundles) if (b.id === bundleId) currentBundle = b;\n\telse if (bundleId !== NIL_UUID && b.id.localeCompare(bundleId) < 0) {\n\t\tif (!rollbackCandidate || b.id.localeCompare(rollbackCandidate.id) > 0) rollbackCandidate = b;\n\t}\n\tconst updateCandidate = findLatestEligibleUpdateCandidate(candidateBundles, bundleId, cohort);\n\tconst currentBundleEligible = currentBundle ? isEligibleUpdateCandidate(currentBundle, cohort) : false;\n\tif (bundleId === NIL_UUID) {\n\t\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\t\treturn null;\n\t}\n\tif (currentBundleEligible) {\n\t\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\t\treturn null;\n\t}\n\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\tif (rollbackCandidate) return makeResponse(rollbackCandidate, \"ROLLBACK\");\n\tif (minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;\n\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/buffer_utils.js\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\nfunction concat(...buffers) {\n\tconst size = buffers.reduce((acc, { length }) => acc + length, 0);\n\tconst buf = new Uint8Array(size);\n\tlet i = 0;\n\tfor (const buffer of buffers) {\n\t\tbuf.set(buffer, i);\n\t\ti += buffer.length;\n\t}\n\treturn buf;\n}\nfunction encode$1(string) {\n\tconst bytes = new Uint8Array(string.length);\n\tfor (let i = 0; i < string.length; i++) {\n\t\tconst code = string.charCodeAt(i);\n\t\tif (code > 127) throw new TypeError(\"non-ASCII string encountered in encode()\");\n\t\tbytes[i] = code;\n\t}\n\treturn bytes;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/base64.js\nfunction encodeBase64(input) {\n\tif (Uint8Array.prototype.toBase64) return input.toBase64();\n\tconst CHUNK_SIZE = 32768;\n\tconst arr = [];\n\tfor (let i = 0; i < input.length; i += CHUNK_SIZE) arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));\n\treturn btoa(arr.join(\"\"));\n}\nfunction decodeBase64(encoded) {\n\tif (Uint8Array.fromBase64) return Uint8Array.fromBase64(encoded);\n\tconst binary = atob(encoded);\n\tconst bytes = new Uint8Array(binary.length);\n\tfor (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n\treturn bytes;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/util/base64url.js\nfunction decode(input) {\n\tif (Uint8Array.fromBase64) return Uint8Array.fromBase64(typeof input === \"string\" ? input : decoder.decode(input), { alphabet: \"base64url\" });\n\tlet encoded = input;\n\tif (encoded instanceof Uint8Array) encoded = decoder.decode(encoded);\n\tencoded = encoded.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\ttry {\n\t\treturn decodeBase64(encoded);\n\t} catch {\n\t\tthrow new TypeError(\"The input to be decoded is not correctly encoded.\");\n\t}\n}\nfunction encode(input) {\n\tlet unencoded = input;\n\tif (typeof unencoded === \"string\") unencoded = encoder.encode(unencoded);\n\tif (Uint8Array.prototype.toBase64) return unencoded.toBase64({\n\t\talphabet: \"base64url\",\n\t\tomitPadding: true\n\t});\n\treturn encodeBase64(unencoded).replace(/=/g, \"\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\");\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/crypto_key.js\nconst unusable = (name, prop = \"algorithm.name\") => /* @__PURE__ */ new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);\nconst isAlgorithm = (algorithm, name) => algorithm.name === name;\nfunction getHashLength(hash) {\n\treturn parseInt(hash.name.slice(4), 10);\n}\nfunction checkHashLength(algorithm, expected) {\n\tif (getHashLength(algorithm.hash) !== expected) throw unusable(`SHA-${expected}`, \"algorithm.hash\");\n}\nfunction getNamedCurve(alg) {\n\tswitch (alg) {\n\t\tcase \"ES256\": return \"P-256\";\n\t\tcase \"ES384\": return \"P-384\";\n\t\tcase \"ES512\": return \"P-521\";\n\t\tdefault: throw new Error(\"unreachable\");\n\t}\n}\nfunction checkUsage(key, usage) {\n\tif (usage && !key.usages.includes(usage)) throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);\n}\nfunction checkSigCryptoKey(key, alg, usage) {\n\tswitch (alg) {\n\t\tcase \"HS256\":\n\t\tcase \"HS384\":\n\t\tcase \"HS512\":\n\t\t\tif (!isAlgorithm(key.algorithm, \"HMAC\")) throw unusable(\"HMAC\");\n\t\t\tcheckHashLength(key.algorithm, parseInt(alg.slice(2), 10));\n\t\t\tbreak;\n\t\tcase \"RS256\":\n\t\tcase \"RS384\":\n\t\tcase \"RS512\":\n\t\t\tif (!isAlgorithm(key.algorithm, \"RSASSA-PKCS1-v1_5\")) throw unusable(\"RSASSA-PKCS1-v1_5\");\n\t\t\tcheckHashLength(key.algorithm, parseInt(alg.slice(2), 10));\n\t\t\tbreak;\n\t\tcase \"PS256\":\n\t\tcase \"PS384\":\n\t\tcase \"PS512\":\n\t\t\tif (!isAlgorithm(key.algorithm, \"RSA-PSS\")) throw unusable(\"RSA-PSS\");\n\t\t\tcheckHashLength(key.algorithm, parseInt(alg.slice(2), 10));\n\t\t\tbreak;\n\t\tcase \"Ed25519\":\n\t\tcase \"EdDSA\":\n\t\t\tif (!isAlgorithm(key.algorithm, \"Ed25519\")) throw unusable(\"Ed25519\");\n\t\t\tbreak;\n\t\tcase \"ML-DSA-44\":\n\t\tcase \"ML-DSA-65\":\n\t\tcase \"ML-DSA-87\":\n\t\t\tif (!isAlgorithm(key.algorithm, alg)) throw unusable(alg);\n\t\t\tbreak;\n\t\tcase \"ES256\":\n\t\tcase \"ES384\":\n\t\tcase \"ES512\": {\n\t\t\tif (!isAlgorithm(key.algorithm, \"ECDSA\")) throw unusable(\"ECDSA\");\n\t\t\tconst expected = getNamedCurve(alg);\n\t\t\tif (key.algorithm.namedCurve !== expected) throw unusable(expected, \"algorithm.namedCurve\");\n\t\t\tbreak;\n\t\t}\n\t\tdefault: throw new TypeError(\"CryptoKey does not support this operation\");\n\t}\n\tcheckUsage(key, usage);\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/invalid_key_input.js\nfunction message(msg, actual, ...types) {\n\ttypes = types.filter(Boolean);\n\tif (types.length > 2) {\n\t\tconst last = types.pop();\n\t\tmsg += `one of type ${types.join(\", \")}, or ${last}.`;\n\t} else if (types.length === 2) msg += `one of type ${types[0]} or ${types[1]}.`;\n\telse msg += `of type ${types[0]}.`;\n\tif (actual == null) msg += ` Received ${actual}`;\n\telse if (typeof actual === \"function\" && actual.name) msg += ` Received function ${actual.name}`;\n\telse if (typeof actual === \"object\" && actual != null) {\n\t\tif (actual.constructor?.name) msg += ` Received an instance of ${actual.constructor.name}`;\n\t}\n\treturn msg;\n}\nconst invalidKeyInput = (actual, ...types) => message(\"Key must be \", actual, ...types);\nconst withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/util/errors.js\nvar JOSEError = class extends Error {\n\tstatic code = \"ERR_JOSE_GENERIC\";\n\tcode = \"ERR_JOSE_GENERIC\";\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tthis.name = this.constructor.name;\n\t\tError.captureStackTrace?.(this, this.constructor);\n\t}\n};\nvar JWTClaimValidationFailed = class extends JOSEError {\n\tstatic code = \"ERR_JWT_CLAIM_VALIDATION_FAILED\";\n\tcode = \"ERR_JWT_CLAIM_VALIDATION_FAILED\";\n\tclaim;\n\treason;\n\tpayload;\n\tconstructor(message, payload, claim = \"unspecified\", reason = \"unspecified\") {\n\t\tsuper(message, { cause: {\n\t\t\tclaim,\n\t\t\treason,\n\t\t\tpayload\n\t\t} });\n\t\tthis.claim = claim;\n\t\tthis.reason = reason;\n\t\tthis.payload = payload;\n\t}\n};\nvar JWTExpired = class extends JOSEError {\n\tstatic code = \"ERR_JWT_EXPIRED\";\n\tcode = \"ERR_JWT_EXPIRED\";\n\tclaim;\n\treason;\n\tpayload;\n\tconstructor(message, payload, claim = \"unspecified\", reason = \"unspecified\") {\n\t\tsuper(message, { cause: {\n\t\t\tclaim,\n\t\t\treason,\n\t\t\tpayload\n\t\t} });\n\t\tthis.claim = claim;\n\t\tthis.reason = reason;\n\t\tthis.payload = payload;\n\t}\n};\nvar JOSEAlgNotAllowed = class extends JOSEError {\n\tstatic code = \"ERR_JOSE_ALG_NOT_ALLOWED\";\n\tcode = \"ERR_JOSE_ALG_NOT_ALLOWED\";\n};\nvar JOSENotSupported = class extends JOSEError {\n\tstatic code = \"ERR_JOSE_NOT_SUPPORTED\";\n\tcode = \"ERR_JOSE_NOT_SUPPORTED\";\n};\nvar JWSInvalid = class extends JOSEError {\n\tstatic code = \"ERR_JWS_INVALID\";\n\tcode = \"ERR_JWS_INVALID\";\n};\nvar JWTInvalid = class extends JOSEError {\n\tstatic code = \"ERR_JWT_INVALID\";\n\tcode = \"ERR_JWT_INVALID\";\n};\nvar JWSSignatureVerificationFailed = class extends JOSEError {\n\tstatic code = \"ERR_JWS_SIGNATURE_VERIFICATION_FAILED\";\n\tcode = \"ERR_JWS_SIGNATURE_VERIFICATION_FAILED\";\n\tconstructor(message = \"signature verification failed\", options) {\n\t\tsuper(message, options);\n\t}\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/is_key_like.js\nconst isCryptoKey = (key) => {\n\tif (key?.[Symbol.toStringTag] === \"CryptoKey\") return true;\n\ttry {\n\t\treturn key instanceof CryptoKey;\n\t} catch {\n\t\treturn false;\n\t}\n};\nconst isKeyObject = (key) => key?.[Symbol.toStringTag] === \"KeyObject\";\nconst isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/helpers.js\nfunction assertNotSet(value, name) {\n\tif (value) throw new TypeError(`${name} can only be called once`);\n}\nfunction decodeBase64url(value, label, ErrorClass) {\n\ttry {\n\t\treturn decode(value);\n\t} catch {\n\t\tthrow new ErrorClass(`Failed to base64url decode the ${label}`);\n\t}\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/type_checks.js\nconst isObjectLike = (value) => typeof value === \"object\" && value !== null;\nfunction isObject(input) {\n\tif (!isObjectLike(input) || Object.prototype.toString.call(input) !== \"[object Object]\") return false;\n\tif (Object.getPrototypeOf(input) === null) return true;\n\tlet proto = input;\n\twhile (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);\n\treturn Object.getPrototypeOf(input) === proto;\n}\nfunction isDisjoint(...headers) {\n\tconst sources = headers.filter(Boolean);\n\tif (sources.length === 0 || sources.length === 1) return true;\n\tlet acc;\n\tfor (const header of sources) {\n\t\tconst parameters = Object.keys(header);\n\t\tif (!acc || acc.size === 0) {\n\t\t\tacc = new Set(parameters);\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const parameter of parameters) {\n\t\t\tif (acc.has(parameter)) return false;\n\t\t\tacc.add(parameter);\n\t\t}\n\t}\n\treturn true;\n}\nconst isJWK = (key) => isObject(key) && typeof key.kty === \"string\";\nconst isPrivateJWK = (key) => key.kty !== \"oct\" && (key.kty === \"AKP\" && typeof key.priv === \"string\" || typeof key.d === \"string\");\nconst isPublicJWK = (key) => key.kty !== \"oct\" && key.d === void 0 && key.priv === void 0;\nconst isSecretJWK = (key) => key.kty === \"oct\" && typeof key.k === \"string\";\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/signing.js\nfunction checkKeyLength(alg, key) {\n\tif (alg.startsWith(\"RS\") || alg.startsWith(\"PS\")) {\n\t\tconst { modulusLength } = key.algorithm;\n\t\tif (typeof modulusLength !== \"number\" || modulusLength < 2048) throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);\n\t}\n}\nfunction subtleAlgorithm(alg, algorithm) {\n\tconst hash = `SHA-${alg.slice(-3)}`;\n\tswitch (alg) {\n\t\tcase \"HS256\":\n\t\tcase \"HS384\":\n\t\tcase \"HS512\": return {\n\t\t\thash,\n\t\t\tname: \"HMAC\"\n\t\t};\n\t\tcase \"PS256\":\n\t\tcase \"PS384\":\n\t\tcase \"PS512\": return {\n\t\t\thash,\n\t\t\tname: \"RSA-PSS\",\n\t\t\tsaltLength: parseInt(alg.slice(-3), 10) >> 3\n\t\t};\n\t\tcase \"RS256\":\n\t\tcase \"RS384\":\n\t\tcase \"RS512\": return {\n\t\t\thash,\n\t\t\tname: \"RSASSA-PKCS1-v1_5\"\n\t\t};\n\t\tcase \"ES256\":\n\t\tcase \"ES384\":\n\t\tcase \"ES512\": return {\n\t\t\thash,\n\t\t\tname: \"ECDSA\",\n\t\t\tnamedCurve: algorithm.namedCurve\n\t\t};\n\t\tcase \"Ed25519\":\n\t\tcase \"EdDSA\": return { name: \"Ed25519\" };\n\t\tcase \"ML-DSA-44\":\n\t\tcase \"ML-DSA-65\":\n\t\tcase \"ML-DSA-87\": return { name: alg };\n\t\tdefault: throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);\n\t}\n}\nasync function getSigKey(alg, key, usage) {\n\tif (key instanceof Uint8Array) {\n\t\tif (!alg.startsWith(\"HS\")) throw new TypeError(invalidKeyInput(key, \"CryptoKey\", \"KeyObject\", \"JSON Web Key\"));\n\t\treturn crypto.subtle.importKey(\"raw\", key, {\n\t\t\thash: `SHA-${alg.slice(-3)}`,\n\t\t\tname: \"HMAC\"\n\t\t}, false, [usage]);\n\t}\n\tcheckSigCryptoKey(key, alg, usage);\n\treturn key;\n}\nasync function sign(alg, key, data) {\n\tconst cryptoKey = await getSigKey(alg, key, \"sign\");\n\tcheckKeyLength(alg, cryptoKey);\n\tconst signature = await crypto.subtle.sign(subtleAlgorithm(alg, cryptoKey.algorithm), cryptoKey, data);\n\treturn new Uint8Array(signature);\n}\nasync function verify(alg, key, signature, data) {\n\tconst cryptoKey = await getSigKey(alg, key, \"verify\");\n\tcheckKeyLength(alg, cryptoKey);\n\tconst algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);\n\ttry {\n\t\treturn await crypto.subtle.verify(algorithm, cryptoKey, signature, data);\n\t} catch {\n\t\treturn false;\n\t}\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/jwk_to_key.js\nconst unsupportedAlg = \"Invalid or unsupported JWK \\\"alg\\\" (Algorithm) Parameter value\";\nfunction subtleMapping(jwk) {\n\tlet algorithm;\n\tlet keyUsages;\n\tswitch (jwk.kty) {\n\t\tcase \"AKP\":\n\t\t\tswitch (jwk.alg) {\n\t\t\t\tcase \"ML-DSA-44\":\n\t\t\t\tcase \"ML-DSA-65\":\n\t\t\t\tcase \"ML-DSA-87\":\n\t\t\t\t\talgorithm = { name: jwk.alg };\n\t\t\t\t\tkeyUsages = jwk.priv ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: throw new JOSENotSupported(unsupportedAlg);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"RSA\":\n\t\t\tswitch (jwk.alg) {\n\t\t\t\tcase \"PS256\":\n\t\t\t\tcase \"PS384\":\n\t\t\t\tcase \"PS512\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"RSA-PSS\",\n\t\t\t\t\t\thash: `SHA-${jwk.alg.slice(-3)}`\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"RS256\":\n\t\t\t\tcase \"RS384\":\n\t\t\t\tcase \"RS512\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"RSASSA-PKCS1-v1_5\",\n\t\t\t\t\t\thash: `SHA-${jwk.alg.slice(-3)}`\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"RSA-OAEP\":\n\t\t\t\tcase \"RSA-OAEP-256\":\n\t\t\t\tcase \"RSA-OAEP-384\":\n\t\t\t\tcase \"RSA-OAEP-512\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"RSA-OAEP\",\n\t\t\t\t\t\thash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"decrypt\", \"unwrapKey\"] : [\"encrypt\", \"wrapKey\"];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: throw new JOSENotSupported(unsupportedAlg);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"EC\":\n\t\t\tswitch (jwk.alg) {\n\t\t\t\tcase \"ES256\":\n\t\t\t\tcase \"ES384\":\n\t\t\t\tcase \"ES512\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"ECDSA\",\n\t\t\t\t\t\tnamedCurve: {\n\t\t\t\t\t\t\tES256: \"P-256\",\n\t\t\t\t\t\t\tES384: \"P-384\",\n\t\t\t\t\t\t\tES512: \"P-521\"\n\t\t\t\t\t\t}[jwk.alg]\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ECDH-ES\":\n\t\t\t\tcase \"ECDH-ES+A128KW\":\n\t\t\t\tcase \"ECDH-ES+A192KW\":\n\t\t\t\tcase \"ECDH-ES+A256KW\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"ECDH\",\n\t\t\t\t\t\tnamedCurve: jwk.crv\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"deriveBits\"] : [];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: throw new JOSENotSupported(unsupportedAlg);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"OKP\":\n\t\t\tswitch (jwk.alg) {\n\t\t\t\tcase \"Ed25519\":\n\t\t\t\tcase \"EdDSA\":\n\t\t\t\t\talgorithm = { name: \"Ed25519\" };\n\t\t\t\t\tkeyUsages = jwk.d ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ECDH-ES\":\n\t\t\t\tcase \"ECDH-ES+A128KW\":\n\t\t\t\tcase \"ECDH-ES+A192KW\":\n\t\t\t\tcase \"ECDH-ES+A256KW\":\n\t\t\t\t\talgorithm = { name: jwk.crv };\n\t\t\t\t\tkeyUsages = jwk.d ? [\"deriveBits\"] : [];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: throw new JOSENotSupported(unsupportedAlg);\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault: throw new JOSENotSupported(\"Invalid or unsupported JWK \\\"kty\\\" (Key Type) Parameter value\");\n\t}\n\treturn {\n\t\talgorithm,\n\t\tkeyUsages\n\t};\n}\nasync function jwkToKey(jwk) {\n\tif (!jwk.alg) throw new TypeError(\"\\\"alg\\\" argument is required when \\\"jwk.alg\\\" is not present\");\n\tconst { algorithm, keyUsages } = subtleMapping(jwk);\n\tconst keyData = { ...jwk };\n\tif (keyData.kty !== \"AKP\") delete keyData.alg;\n\tdelete keyData.use;\n\treturn crypto.subtle.importKey(\"jwk\", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/normalize_key.js\nconst unusableForAlg = \"given KeyObject instance cannot be used for this algorithm\";\nlet cache;\nconst handleJWK = async (key, jwk, alg, freeze = false) => {\n\tcache ||= /* @__PURE__ */ new WeakMap();\n\tlet cached = cache.get(key);\n\tif (cached?.[alg]) return cached[alg];\n\tconst cryptoKey = await jwkToKey({\n\t\t...jwk,\n\t\talg\n\t});\n\tif (freeze) Object.freeze(key);\n\tif (!cached) cache.set(key, { [alg]: cryptoKey });\n\telse cached[alg] = cryptoKey;\n\treturn cryptoKey;\n};\nconst handleKeyObject = (keyObject, alg) => {\n\tcache ||= /* @__PURE__ */ new WeakMap();\n\tlet cached = cache.get(keyObject);\n\tif (cached?.[alg]) return cached[alg];\n\tconst isPublic = keyObject.type === \"public\";\n\tconst extractable = isPublic ? true : false;\n\tlet cryptoKey;\n\tif (keyObject.asymmetricKeyType === \"x25519\") {\n\t\tswitch (alg) {\n\t\t\tcase \"ECDH-ES\":\n\t\t\tcase \"ECDH-ES+A128KW\":\n\t\t\tcase \"ECDH-ES+A192KW\":\n\t\t\tcase \"ECDH-ES+A256KW\": break;\n\t\t\tdefault: throw new TypeError(unusableForAlg);\n\t\t}\n\t\tcryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : [\"deriveBits\"]);\n\t}\n\tif (keyObject.asymmetricKeyType === \"ed25519\") {\n\t\tif (alg !== \"EdDSA\" && alg !== \"Ed25519\") throw new TypeError(unusableForAlg);\n\t\tcryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [isPublic ? \"verify\" : \"sign\"]);\n\t}\n\tswitch (keyObject.asymmetricKeyType) {\n\t\tcase \"ml-dsa-44\":\n\t\tcase \"ml-dsa-65\":\n\t\tcase \"ml-dsa-87\":\n\t\t\tif (alg !== keyObject.asymmetricKeyType.toUpperCase()) throw new TypeError(unusableForAlg);\n\t\t\tcryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [isPublic ? \"verify\" : \"sign\"]);\n\t}\n\tif (keyObject.asymmetricKeyType === \"rsa\") {\n\t\tlet hash;\n\t\tswitch (alg) {\n\t\t\tcase \"RSA-OAEP\":\n\t\t\t\thash = \"SHA-1\";\n\t\t\t\tbreak;\n\t\t\tcase \"RS256\":\n\t\t\tcase \"PS256\":\n\t\t\tcase \"RSA-OAEP-256\":\n\t\t\t\thash = \"SHA-256\";\n\t\t\t\tbreak;\n\t\t\tcase \"RS384\":\n\t\t\tcase \"PS384\":\n\t\t\tcase \"RSA-OAEP-384\":\n\t\t\t\thash = \"SHA-384\";\n\t\t\t\tbreak;\n\t\t\tcase \"RS512\":\n\t\t\tcase \"PS512\":\n\t\t\tcase \"RSA-OAEP-512\":\n\t\t\t\thash = \"SHA-512\";\n\t\t\t\tbreak;\n\t\t\tdefault: throw new TypeError(unusableForAlg);\n\t\t}\n\t\tif (alg.startsWith(\"RSA-OAEP\")) return keyObject.toCryptoKey({\n\t\t\tname: \"RSA-OAEP\",\n\t\t\thash\n\t\t}, extractable, isPublic ? [\"encrypt\"] : [\"decrypt\"]);\n\t\tcryptoKey = keyObject.toCryptoKey({\n\t\t\tname: alg.startsWith(\"PS\") ? \"RSA-PSS\" : \"RSASSA-PKCS1-v1_5\",\n\t\t\thash\n\t\t}, extractable, [isPublic ? \"verify\" : \"sign\"]);\n\t}\n\tif (keyObject.asymmetricKeyType === \"ec\") {\n\t\tconst namedCurve = new Map([\n\t\t\t[\"prime256v1\", \"P-256\"],\n\t\t\t[\"secp384r1\", \"P-384\"],\n\t\t\t[\"secp521r1\", \"P-521\"]\n\t\t]).get(keyObject.asymmetricKeyDetails?.namedCurve);\n\t\tif (!namedCurve) throw new TypeError(unusableForAlg);\n\t\tconst expectedCurve = {\n\t\t\tES256: \"P-256\",\n\t\t\tES384: \"P-384\",\n\t\t\tES512: \"P-521\"\n\t\t};\n\t\tif (expectedCurve[alg] && namedCurve === expectedCurve[alg]) cryptoKey = keyObject.toCryptoKey({\n\t\t\tname: \"ECDSA\",\n\t\t\tnamedCurve\n\t\t}, extractable, [isPublic ? \"verify\" : \"sign\"]);\n\t\tif (alg.startsWith(\"ECDH-ES\")) cryptoKey = keyObject.toCryptoKey({\n\t\t\tname: \"ECDH\",\n\t\t\tnamedCurve\n\t\t}, extractable, isPublic ? [] : [\"deriveBits\"]);\n\t}\n\tif (!cryptoKey) throw new TypeError(unusableForAlg);\n\tif (!cached) cache.set(keyObject, { [alg]: cryptoKey });\n\telse cached[alg] = cryptoKey;\n\treturn cryptoKey;\n};\nasync function normalizeKey(key, alg) {\n\tif (key instanceof Uint8Array) return key;\n\tif (isCryptoKey(key)) return key;\n\tif (isKeyObject(key)) {\n\t\tif (key.type === \"secret\") return key.export();\n\t\tif (\"toCryptoKey\" in key && typeof key.toCryptoKey === \"function\") try {\n\t\t\treturn handleKeyObject(key, alg);\n\t\t} catch (err) {\n\t\t\tif (err instanceof TypeError) throw err;\n\t\t}\n\t\treturn handleJWK(key, key.export({ format: \"jwk\" }), alg);\n\t}\n\tif (isJWK(key)) {\n\t\tif (key.k) return decode(key.k);\n\t\treturn handleJWK(key, key, alg, true);\n\t}\n\tthrow new Error(\"unreachable\");\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/validate_crit.js\nfunction validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {\n\tif (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) throw new Err(\"\\\"crit\\\" (Critical) Header Parameter MUST be integrity protected\");\n\tif (!protectedHeader || protectedHeader.crit === void 0) return /* @__PURE__ */ new Set();\n\tif (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== \"string\" || input.length === 0)) throw new Err(\"\\\"crit\\\" (Critical) Header Parameter MUST be an array of non-empty strings when present\");\n\tlet recognized;\n\tif (recognizedOption !== void 0) recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);\n\telse recognized = recognizedDefault;\n\tfor (const parameter of protectedHeader.crit) {\n\t\tif (!recognized.has(parameter)) throw new JOSENotSupported(`Extension Header Parameter \"${parameter}\" is not recognized`);\n\t\tif (joseHeader[parameter] === void 0) throw new Err(`Extension Header Parameter \"${parameter}\" is missing`);\n\t\tif (recognized.get(parameter) && protectedHeader[parameter] === void 0) throw new Err(`Extension Header Parameter \"${parameter}\" MUST be integrity protected`);\n\t}\n\treturn new Set(protectedHeader.crit);\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/validate_algorithms.js\nfunction validateAlgorithms(option, algorithms) {\n\tif (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== \"string\"))) throw new TypeError(`\"${option}\" option must be an array of strings`);\n\tif (!algorithms) return;\n\treturn new Set(algorithms);\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/check_key_type.js\nconst tag = (key) => key?.[Symbol.toStringTag];\nconst jwkMatchesOp = (alg, key, usage) => {\n\tif (key.use !== void 0) {\n\t\tlet expected;\n\t\tswitch (usage) {\n\t\t\tcase \"sign\":\n\t\t\tcase \"verify\":\n\t\t\t\texpected = \"sig\";\n\t\t\t\tbreak;\n\t\t\tcase \"encrypt\":\n\t\t\tcase \"decrypt\":\n\t\t\t\texpected = \"enc\";\n\t\t\t\tbreak;\n\t\t}\n\t\tif (key.use !== expected) throw new TypeError(`Invalid key for this operation, its \"use\" must be \"${expected}\" when present`);\n\t}\n\tif (key.alg !== void 0 && key.alg !== alg) throw new TypeError(`Invalid key for this operation, its \"alg\" must be \"${alg}\" when present`);\n\tif (Array.isArray(key.key_ops)) {\n\t\tlet expectedKeyOp;\n\t\tswitch (true) {\n\t\t\tcase usage === \"sign\" || usage === \"verify\":\n\t\t\tcase alg === \"dir\":\n\t\t\tcase alg.includes(\"CBC-HS\"):\n\t\t\t\texpectedKeyOp = usage;\n\t\t\t\tbreak;\n\t\t\tcase alg.startsWith(\"PBES2\"):\n\t\t\t\texpectedKeyOp = \"deriveBits\";\n\t\t\t\tbreak;\n\t\t\tcase /^A\\d{3}(?:GCM)?(?:KW)?$/.test(alg):\n\t\t\t\tif (!alg.includes(\"GCM\") && alg.endsWith(\"KW\")) expectedKeyOp = usage === \"encrypt\" ? \"wrapKey\" : \"unwrapKey\";\n\t\t\t\telse expectedKeyOp = usage;\n\t\t\t\tbreak;\n\t\t\tcase usage === \"encrypt\" && alg.startsWith(\"RSA\"):\n\t\t\t\texpectedKeyOp = \"wrapKey\";\n\t\t\t\tbreak;\n\t\t\tcase usage === \"decrypt\":\n\t\t\t\texpectedKeyOp = alg.startsWith(\"RSA\") ? \"unwrapKey\" : \"deriveBits\";\n\t\t\t\tbreak;\n\t\t}\n\t\tif (expectedKeyOp && key.key_ops?.includes?.(expectedKeyOp) === false) throw new TypeError(`Invalid key for this operation, its \"key_ops\" must include \"${expectedKeyOp}\" when present`);\n\t}\n\treturn true;\n};\nconst symmetricTypeCheck = (alg, key, usage) => {\n\tif (key instanceof Uint8Array) return;\n\tif (isJWK(key)) {\n\t\tif (isSecretJWK(key) && jwkMatchesOp(alg, key, usage)) return;\n\t\tthrow new TypeError(`JSON Web Key for symmetric algorithms must have JWK \"kty\" (Key Type) equal to \"oct\" and the JWK \"k\" (Key Value) present`);\n\t}\n\tif (!isKeyLike(key)) throw new TypeError(withAlg(alg, key, \"CryptoKey\", \"KeyObject\", \"JSON Web Key\", \"Uint8Array\"));\n\tif (key.type !== \"secret\") throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type \"secret\"`);\n};\nconst asymmetricTypeCheck = (alg, key, usage) => {\n\tif (isJWK(key)) switch (usage) {\n\t\tcase \"decrypt\":\n\t\tcase \"sign\":\n\t\t\tif (isPrivateJWK(key) && jwkMatchesOp(alg, key, usage)) return;\n\t\t\tthrow new TypeError(`JSON Web Key for this operation must be a private JWK`);\n\t\tcase \"encrypt\":\n\t\tcase \"verify\":\n\t\t\tif (isPublicJWK(key) && jwkMatchesOp(alg, key, usage)) return;\n\t\t\tthrow new TypeError(`JSON Web Key for this operation must be a public JWK`);\n\t}\n\tif (!isKeyLike(key)) throw new TypeError(withAlg(alg, key, \"CryptoKey\", \"KeyObject\", \"JSON Web Key\"));\n\tif (key.type === \"secret\") throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type \"secret\"`);\n\tif (key.type === \"public\") switch (usage) {\n\t\tcase \"sign\": throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type \"private\"`);\n\t\tcase \"decrypt\": throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type \"private\"`);\n\t}\n\tif (key.type === \"private\") switch (usage) {\n\t\tcase \"verify\": throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type \"public\"`);\n\t\tcase \"encrypt\": throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type \"public\"`);\n\t}\n};\nfunction checkKeyType(alg, key, usage) {\n\tswitch (alg.substring(0, 2)) {\n\t\tcase \"A1\":\n\t\tcase \"A2\":\n\t\tcase \"di\":\n\t\tcase \"HS\":\n\t\tcase \"PB\":\n\t\t\tsymmetricTypeCheck(alg, key, usage);\n\t\t\tbreak;\n\t\tdefault: asymmetricTypeCheck(alg, key, usage);\n\t}\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jws/flattened/verify.js\nasync function flattenedVerify(jws, key, options) {\n\tif (!isObject(jws)) throw new JWSInvalid(\"Flattened JWS must be an object\");\n\tif (jws.protected === void 0 && jws.header === void 0) throw new JWSInvalid(\"Flattened JWS must have either of the \\\"protected\\\" or \\\"header\\\" members\");\n\tif (jws.protected !== void 0 && typeof jws.protected !== \"string\") throw new JWSInvalid(\"JWS Protected Header incorrect type\");\n\tif (jws.payload === void 0) throw new JWSInvalid(\"JWS Payload missing\");\n\tif (typeof jws.signature !== \"string\") throw new JWSInvalid(\"JWS Signature missing or incorrect type\");\n\tif (jws.header !== void 0 && !isObject(jws.header)) throw new JWSInvalid(\"JWS Unprotected Header incorrect type\");\n\tlet parsedProt = {};\n\tif (jws.protected) try {\n\t\tconst protectedHeader = decode(jws.protected);\n\t\tparsedProt = JSON.parse(decoder.decode(protectedHeader));\n\t} catch {\n\t\tthrow new JWSInvalid(\"JWS Protected Header is invalid\");\n\t}\n\tif (!isDisjoint(parsedProt, jws.header)) throw new JWSInvalid(\"JWS Protected and JWS Unprotected Header Parameter names must be disjoint\");\n\tconst joseHeader = {\n\t\t...parsedProt,\n\t\t...jws.header\n\t};\n\tconst extensions = validateCrit(JWSInvalid, new Map([[\"b64\", true]]), options?.crit, parsedProt, joseHeader);\n\tlet b64 = true;\n\tif (extensions.has(\"b64\")) {\n\t\tb64 = parsedProt.b64;\n\t\tif (typeof b64 !== \"boolean\") throw new JWSInvalid(\"The \\\"b64\\\" (base64url-encode payload) Header Parameter must be a boolean\");\n\t}\n\tconst { alg } = joseHeader;\n\tif (typeof alg !== \"string\" || !alg) throw new JWSInvalid(\"JWS \\\"alg\\\" (Algorithm) Header Parameter missing or invalid\");\n\tconst algorithms = options && validateAlgorithms(\"algorithms\", options.algorithms);\n\tif (algorithms && !algorithms.has(alg)) throw new JOSEAlgNotAllowed(\"\\\"alg\\\" (Algorithm) Header Parameter value not allowed\");\n\tif (b64) {\n\t\tif (typeof jws.payload !== \"string\") throw new JWSInvalid(\"JWS Payload must be a string\");\n\t} else if (typeof jws.payload !== \"string\" && !(jws.payload instanceof Uint8Array)) throw new JWSInvalid(\"JWS Payload must be a string or an Uint8Array instance\");\n\tlet resolvedKey = false;\n\tif (typeof key === \"function\") {\n\t\tkey = await key(parsedProt, jws);\n\t\tresolvedKey = true;\n\t}\n\tcheckKeyType(alg, key, \"verify\");\n\tconst data = concat(jws.protected !== void 0 ? encode$1(jws.protected) : new Uint8Array(), encode$1(\".\"), typeof jws.payload === \"string\" ? b64 ? encode$1(jws.payload) : encoder.encode(jws.payload) : jws.payload);\n\tconst signature = decodeBase64url(jws.signature, \"signature\", JWSInvalid);\n\tconst k = await normalizeKey(key, alg);\n\tif (!await verify(alg, k, signature, data)) throw new JWSSignatureVerificationFailed();\n\tlet payload;\n\tif (b64) payload = decodeBase64url(jws.payload, \"payload\", JWSInvalid);\n\telse if (typeof jws.payload === \"string\") payload = encoder.encode(jws.payload);\n\telse payload = jws.payload;\n\tconst result = { payload };\n\tif (jws.protected !== void 0) result.protectedHeader = parsedProt;\n\tif (jws.header !== void 0) result.unprotectedHeader = jws.header;\n\tif (resolvedKey) return {\n\t\t...result,\n\t\tkey: k\n\t};\n\treturn result;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jws/compact/verify.js\nasync function compactVerify(jws, key, options) {\n\tif (jws instanceof Uint8Array) jws = decoder.decode(jws);\n\tif (typeof jws !== \"string\") throw new JWSInvalid(\"Compact JWS must be a string or Uint8Array\");\n\tconst { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split(\".\");\n\tif (length !== 3) throw new JWSInvalid(\"Invalid Compact JWS\");\n\tconst verified = await flattenedVerify({\n\t\tpayload,\n\t\tprotected: protectedHeader,\n\t\tsignature\n\t}, key, options);\n\tconst result = {\n\t\tpayload: verified.payload,\n\t\tprotectedHeader: verified.protectedHeader\n\t};\n\tif (typeof key === \"function\") return {\n\t\t...result,\n\t\tkey: verified.key\n\t};\n\treturn result;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/jwt_claims_set.js\nconst epoch = (date) => Math.floor(date.getTime() / 1e3);\nconst minute = 60;\nconst hour = minute * 60;\nconst day = hour * 24;\nconst week = day * 7;\nconst year = day * 365.25;\nconst REGEX = /^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;\nfunction secs(str) {\n\tconst matched = REGEX.exec(str);\n\tif (!matched || matched[4] && matched[1]) throw new TypeError(\"Invalid time period format\");\n\tconst value = parseFloat(matched[2]);\n\tconst unit = matched[3].toLowerCase();\n\tlet numericDate;\n\tswitch (unit) {\n\t\tcase \"sec\":\n\t\tcase \"secs\":\n\t\tcase \"second\":\n\t\tcase \"seconds\":\n\t\tcase \"s\":\n\t\t\tnumericDate = Math.round(value);\n\t\t\tbreak;\n\t\tcase \"minute\":\n\t\tcase \"minutes\":\n\t\tcase \"min\":\n\t\tcase \"mins\":\n\t\tcase \"m\":\n\t\t\tnumericDate = Math.round(value * minute);\n\t\t\tbreak;\n\t\tcase \"hour\":\n\t\tcase \"hours\":\n\t\tcase \"hr\":\n\t\tcase \"hrs\":\n\t\tcase \"h\":\n\t\t\tnumericDate = Math.round(value * hour);\n\t\t\tbreak;\n\t\tcase \"day\":\n\t\tcase \"days\":\n\t\tcase \"d\":\n\t\t\tnumericDate = Math.round(value * day);\n\t\t\tbreak;\n\t\tcase \"week\":\n\t\tcase \"weeks\":\n\t\tcase \"w\":\n\t\t\tnumericDate = Math.round(value * week);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tnumericDate = Math.round(value * year);\n\t\t\tbreak;\n\t}\n\tif (matched[1] === \"-\" || matched[4] === \"ago\") return -numericDate;\n\treturn numericDate;\n}\nfunction validateInput(label, input) {\n\tif (!Number.isFinite(input)) throw new TypeError(`Invalid ${label} input`);\n\treturn input;\n}\nconst normalizeTyp = (value) => {\n\tif (value.includes(\"/\")) return value.toLowerCase();\n\treturn `application/${value.toLowerCase()}`;\n};\nconst checkAudiencePresence = (audPayload, audOption) => {\n\tif (typeof audPayload === \"string\") return audOption.includes(audPayload);\n\tif (Array.isArray(audPayload)) return audOption.some(Set.prototype.has.bind(new Set(audPayload)));\n\treturn false;\n};\nfunction validateClaimsSet(protectedHeader, encodedPayload, options = {}) {\n\tlet payload;\n\ttry {\n\t\tpayload = JSON.parse(decoder.decode(encodedPayload));\n\t} catch {}\n\tif (!isObject(payload)) throw new JWTInvalid(\"JWT Claims Set must be a top-level JSON object\");\n\tconst { typ } = options;\n\tif (typ && (typeof protectedHeader.typ !== \"string\" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) throw new JWTClaimValidationFailed(\"unexpected \\\"typ\\\" JWT header value\", payload, \"typ\", \"check_failed\");\n\tconst { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;\n\tconst presenceCheck = [...requiredClaims];\n\tif (maxTokenAge !== void 0) presenceCheck.push(\"iat\");\n\tif (audience !== void 0) presenceCheck.push(\"aud\");\n\tif (subject !== void 0) presenceCheck.push(\"sub\");\n\tif (issuer !== void 0) presenceCheck.push(\"iss\");\n\tfor (const claim of new Set(presenceCheck.reverse())) if (!(claim in payload)) throw new JWTClaimValidationFailed(`missing required \"${claim}\" claim`, payload, claim, \"missing\");\n\tif (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) throw new JWTClaimValidationFailed(\"unexpected \\\"iss\\\" claim value\", payload, \"iss\", \"check_failed\");\n\tif (subject && payload.sub !== subject) throw new JWTClaimValidationFailed(\"unexpected \\\"sub\\\" claim value\", payload, \"sub\", \"check_failed\");\n\tif (audience && !checkAudiencePresence(payload.aud, typeof audience === \"string\" ? [audience] : audience)) throw new JWTClaimValidationFailed(\"unexpected \\\"aud\\\" claim value\", payload, \"aud\", \"check_failed\");\n\tlet tolerance;\n\tswitch (typeof options.clockTolerance) {\n\t\tcase \"string\":\n\t\t\ttolerance = secs(options.clockTolerance);\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\t\ttolerance = options.clockTolerance;\n\t\t\tbreak;\n\t\tcase \"undefined\":\n\t\t\ttolerance = 0;\n\t\t\tbreak;\n\t\tdefault: throw new TypeError(\"Invalid clockTolerance option type\");\n\t}\n\tconst { currentDate } = options;\n\tconst now = epoch(currentDate || /* @__PURE__ */ new Date());\n\tif ((payload.iat !== void 0 || maxTokenAge) && typeof payload.iat !== \"number\") throw new JWTClaimValidationFailed(\"\\\"iat\\\" claim must be a number\", payload, \"iat\", \"invalid\");\n\tif (payload.nbf !== void 0) {\n\t\tif (typeof payload.nbf !== \"number\") throw new JWTClaimValidationFailed(\"\\\"nbf\\\" claim must be a number\", payload, \"nbf\", \"invalid\");\n\t\tif (payload.nbf > now + tolerance) throw new JWTClaimValidationFailed(\"\\\"nbf\\\" claim timestamp check failed\", payload, \"nbf\", \"check_failed\");\n\t}\n\tif (payload.exp !== void 0) {\n\t\tif (typeof payload.exp !== \"number\") throw new JWTClaimValidationFailed(\"\\\"exp\\\" claim must be a number\", payload, \"exp\", \"invalid\");\n\t\tif (payload.exp <= now - tolerance) throw new JWTExpired(\"\\\"exp\\\" claim timestamp check failed\", payload, \"exp\", \"check_failed\");\n\t}\n\tif (maxTokenAge) {\n\t\tconst age = now - payload.iat;\n\t\tconst max = typeof maxTokenAge === \"number\" ? maxTokenAge : secs(maxTokenAge);\n\t\tif (age - tolerance > max) throw new JWTExpired(\"\\\"iat\\\" claim timestamp check failed (too far in the past)\", payload, \"iat\", \"check_failed\");\n\t\tif (age < 0 - tolerance) throw new JWTClaimValidationFailed(\"\\\"iat\\\" claim timestamp check failed (it should be in the past)\", payload, \"iat\", \"check_failed\");\n\t}\n\treturn payload;\n}\nvar JWTClaimsBuilder = class {\n\t#payload;\n\tconstructor(payload) {\n\t\tif (!isObject(payload)) throw new TypeError(\"JWT Claims Set MUST be an object\");\n\t\tthis.#payload = structuredClone(payload);\n\t}\n\tdata() {\n\t\treturn encoder.encode(JSON.stringify(this.#payload));\n\t}\n\tget iss() {\n\t\treturn this.#payload.iss;\n\t}\n\tset iss(value) {\n\t\tthis.#payload.iss = value;\n\t}\n\tget sub() {\n\t\treturn this.#payload.sub;\n\t}\n\tset sub(value) {\n\t\tthis.#payload.sub = value;\n\t}\n\tget aud() {\n\t\treturn this.#payload.aud;\n\t}\n\tset aud(value) {\n\t\tthis.#payload.aud = value;\n\t}\n\tset jti(value) {\n\t\tthis.#payload.jti = value;\n\t}\n\tset nbf(value) {\n\t\tif (typeof value === \"number\") this.#payload.nbf = validateInput(\"setNotBefore\", value);\n\t\telse if (value instanceof Date) this.#payload.nbf = validateInput(\"setNotBefore\", epoch(value));\n\t\telse this.#payload.nbf = epoch(/* @__PURE__ */ new Date()) + secs(value);\n\t}\n\tset exp(value) {\n\t\tif (typeof value === \"number\") this.#payload.exp = validateInput(\"setExpirationTime\", value);\n\t\telse if (value instanceof Date) this.#payload.exp = validateInput(\"setExpirationTime\", epoch(value));\n\t\telse this.#payload.exp = epoch(/* @__PURE__ */ new Date()) + secs(value);\n\t}\n\tset iat(value) {\n\t\tif (value === void 0) this.#payload.iat = epoch(/* @__PURE__ */ new Date());\n\t\telse if (value instanceof Date) this.#payload.iat = validateInput(\"setIssuedAt\", epoch(value));\n\t\telse if (typeof value === \"string\") this.#payload.iat = validateInput(\"setIssuedAt\", epoch(/* @__PURE__ */ new Date()) + secs(value));\n\t\telse this.#payload.iat = validateInput(\"setIssuedAt\", value);\n\t}\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jwt/verify.js\nasync function jwtVerify(jwt, key, options) {\n\tconst verified = await compactVerify(jwt, key, options);\n\tif (verified.protectedHeader.crit?.includes(\"b64\") && verified.protectedHeader.b64 === false) throw new JWTInvalid(\"JWTs MUST NOT use unencoded payload\");\n\tconst result = {\n\t\tpayload: validateClaimsSet(verified.protectedHeader, verified.payload, options),\n\t\tprotectedHeader: verified.protectedHeader\n\t};\n\tif (typeof key === \"function\") return {\n\t\t...result,\n\t\tkey: verified.key\n\t};\n\treturn result;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jws/flattened/sign.js\nvar FlattenedSign = class {\n\t#payload;\n\t#protectedHeader;\n\t#unprotectedHeader;\n\tconstructor(payload) {\n\t\tif (!(payload instanceof Uint8Array)) throw new TypeError(\"payload must be an instance of Uint8Array\");\n\t\tthis.#payload = payload;\n\t}\n\tsetProtectedHeader(protectedHeader) {\n\t\tassertNotSet(this.#protectedHeader, \"setProtectedHeader\");\n\t\tthis.#protectedHeader = protectedHeader;\n\t\treturn this;\n\t}\n\tsetUnprotectedHeader(unprotectedHeader) {\n\t\tassertNotSet(this.#unprotectedHeader, \"setUnprotectedHeader\");\n\t\tthis.#unprotectedHeader = unprotectedHeader;\n\t\treturn this;\n\t}\n\tasync sign(key, options) {\n\t\tif (!this.#protectedHeader && !this.#unprotectedHeader) throw new JWSInvalid(\"either setProtectedHeader or setUnprotectedHeader must be called before #sign()\");\n\t\tif (!isDisjoint(this.#protectedHeader, this.#unprotectedHeader)) throw new JWSInvalid(\"JWS Protected and JWS Unprotected Header Parameter names must be disjoint\");\n\t\tconst joseHeader = {\n\t\t\t...this.#protectedHeader,\n\t\t\t...this.#unprotectedHeader\n\t\t};\n\t\tconst extensions = validateCrit(JWSInvalid, new Map([[\"b64\", true]]), options?.crit, this.#protectedHeader, joseHeader);\n\t\tlet b64 = true;\n\t\tif (extensions.has(\"b64\")) {\n\t\t\tb64 = this.#protectedHeader.b64;\n\t\t\tif (typeof b64 !== \"boolean\") throw new JWSInvalid(\"The \\\"b64\\\" (base64url-encode payload) Header Parameter must be a boolean\");\n\t\t}\n\t\tconst { alg } = joseHeader;\n\t\tif (typeof alg !== \"string\" || !alg) throw new JWSInvalid(\"JWS \\\"alg\\\" (Algorithm) Header Parameter missing or invalid\");\n\t\tcheckKeyType(alg, key, \"sign\");\n\t\tlet payloadS;\n\t\tlet payloadB;\n\t\tif (b64) {\n\t\t\tpayloadS = encode(this.#payload);\n\t\t\tpayloadB = encode$1(payloadS);\n\t\t} else {\n\t\t\tpayloadB = this.#payload;\n\t\t\tpayloadS = \"\";\n\t\t}\n\t\tlet protectedHeaderString;\n\t\tlet protectedHeaderBytes;\n\t\tif (this.#protectedHeader) {\n\t\t\tprotectedHeaderString = encode(JSON.stringify(this.#protectedHeader));\n\t\t\tprotectedHeaderBytes = encode$1(protectedHeaderString);\n\t\t} else {\n\t\t\tprotectedHeaderString = \"\";\n\t\t\tprotectedHeaderBytes = new Uint8Array();\n\t\t}\n\t\tconst data = concat(protectedHeaderBytes, encode$1(\".\"), payloadB);\n\t\tconst jws = {\n\t\t\tsignature: encode(await sign(alg, await normalizeKey(key, alg), data)),\n\t\t\tpayload: payloadS\n\t\t};\n\t\tif (this.#unprotectedHeader) jws.header = this.#unprotectedHeader;\n\t\tif (this.#protectedHeader) jws.protected = protectedHeaderString;\n\t\treturn jws;\n\t}\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jws/compact/sign.js\nvar CompactSign = class {\n\t#flattened;\n\tconstructor(payload) {\n\t\tthis.#flattened = new FlattenedSign(payload);\n\t}\n\tsetProtectedHeader(protectedHeader) {\n\t\tthis.#flattened.setProtectedHeader(protectedHeader);\n\t\treturn this;\n\t}\n\tasync sign(key, options) {\n\t\tconst jws = await this.#flattened.sign(key, options);\n\t\tif (jws.payload === void 0) throw new TypeError(\"use the flattened module for creating JWS with b64: false\");\n\t\treturn `${jws.protected}.${jws.payload}.${jws.signature}`;\n\t}\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jwt/sign.js\nvar SignJWT = class {\n\t#protectedHeader;\n\t#jwt;\n\tconstructor(payload = {}) {\n\t\tthis.#jwt = new JWTClaimsBuilder(payload);\n\t}\n\tsetIssuer(issuer) {\n\t\tthis.#jwt.iss = issuer;\n\t\treturn this;\n\t}\n\tsetSubject(subject) {\n\t\tthis.#jwt.sub = subject;\n\t\treturn this;\n\t}\n\tsetAudience(audience) {\n\t\tthis.#jwt.aud = audience;\n\t\treturn this;\n\t}\n\tsetJti(jwtId) {\n\t\tthis.#jwt.jti = jwtId;\n\t\treturn this;\n\t}\n\tsetNotBefore(input) {\n\t\tthis.#jwt.nbf = input;\n\t\treturn this;\n\t}\n\tsetExpirationTime(input) {\n\t\tthis.#jwt.exp = input;\n\t\treturn this;\n\t}\n\tsetIssuedAt(input) {\n\t\tthis.#jwt.iat = input;\n\t\treturn this;\n\t}\n\tsetProtectedHeader(protectedHeader) {\n\t\tthis.#protectedHeader = protectedHeader;\n\t\treturn this;\n\t}\n\tasync sign(key, options) {\n\t\tconst sig = new CompactSign(this.#jwt.data());\n\t\tsig.setProtectedHeader(this.#protectedHeader);\n\t\tif (Array.isArray(this.#protectedHeader?.crit) && this.#protectedHeader.crit.includes(\"b64\") && this.#protectedHeader.b64 === false) throw new JWTInvalid(\"JWTs MUST NOT use unencoded payload\");\n\t\treturn sig.sign(key, options);\n\t}\n};\n//#endregion\n//#region src/verifyJwtSignedUrl.ts\n/**\n* Verifies JWT token only and returns the file key (path with leading slashes removed) if valid.\n*/\nconst verifyJwtToken = async ({ path, token, jwtSecret }) => {\n\tconst key = path.replace(/^\\/+/, \"\");\n\tif (!token) return {\n\t\tvalid: false,\n\t\terror: \"Missing token\"\n\t};\n\ttry {\n\t\tconst { payload } = await jwtVerify(token, new TextEncoder().encode(jwtSecret));\n\t\tif (!payload || payload.key !== key) return {\n\t\t\tvalid: false,\n\t\t\terror: \"Token does not match requested file\"\n\t\t};\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\tkey\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terror: \"Invalid or expired token\"\n\t\t};\n\t}\n};\n/**\n* Retrieves file data through the handler and constructs a response object with appropriate headers for download.\n*/\nconst getFileResponse = async ({ key, handler }) => {\n\tconst object = await handler(key);\n\tif (!object) return {\n\t\tstatus: 404,\n\t\terror: \"File not found\"\n\t};\n\tconst pathParts = key.split(\"/\");\n\tconst fileName = pathParts[pathParts.length - 1];\n\treturn {\n\t\tstatus: 200,\n\t\tresponseHeaders: {\n\t\t\t\"Content-Type\": object.contentType || \"application/octet-stream\",\n\t\t\t\"Content-Disposition\": `attachment; filename=${fileName}`\n\t\t},\n\t\tresponseBody: object.body\n\t};\n};\n/**\n* Integrated function for JWT verification and file handling.\n* - Returns error response if token is missing or validation fails.\n* - On success, retrieves file data through the handler and constructs a response object.\n*/\nconst verifyJwtSignedUrl = async ({ path, token, jwtSecret, handler }) => {\n\tconst result = await verifyJwtToken({\n\t\tpath,\n\t\ttoken,\n\t\tjwtSecret\n\t});\n\tif (!result.valid) {\n\t\tif (result.error === \"Missing token\") return {\n\t\t\tstatus: 400,\n\t\t\terror: result.error\n\t\t};\n\t\treturn {\n\t\t\tstatus: 403,\n\t\t\terror: result.error || \"Unauthorized\"\n\t\t};\n\t}\n\treturn getFileResponse({\n\t\tkey: result.key,\n\t\thandler\n\t});\n};\n//#endregion\n//#region src/withJwtSignedUrl.ts\n/**\n* Creates a JWT-signed download URL based on the provided update information.\n*\n* @param {Object} options - Function options\n* @param {T|null} options.data - Update information (null if none)\n* @param {string} options.reqUrl - Request URL (base URL for token generation)\n* @param {string} options.jwtSecret - Secret key for JWT signing\n* @returns {Promise<T|null>} - Update response object with fileUrl or null\n*/\nconst withJwtSignedUrl = async ({ data, reqUrl, jwtSecret }) => {\n\tif (!data) return null;\n\tconst { storageUri, ...rest } = data;\n\tif (data.id === NIL_UUID || !storageUri) return {\n\t\t...rest,\n\t\tfileUrl: null\n\t};\n\tconst storageUrl = new URL(storageUri);\n\tconst key = `${storageUrl.host}${storageUrl.pathname}`;\n\tconst token = await signToken(key, jwtSecret);\n\tconst url = new URL(reqUrl);\n\turl.pathname = key;\n\turl.searchParams.set(\"token\", token);\n\treturn {\n\t\t...rest,\n\t\tfileUrl: url.toString()\n\t};\n};\nconst signToken = async (key, jwtSecret) => {\n\tconst secretKey = new TextEncoder().encode(jwtSecret);\n\treturn await new SignJWT({ key }).setProtectedHeader({ alg: \"HS256\" }).setExpirationTime(\"60s\").sign(secretKey);\n};\n//#endregion\nexport { filterCompatibleAppVersions, getUpdateInfo, semverSatisfies, signToken, verifyJwtSignedUrl, verifyJwtToken, withJwtSignedUrl };\n", "import { seedRequestUpdateBundles } from \"./requestUpdateBundleState.mjs\";\nimport { NIL_UUID } from \"@hot-updater/core\";\nimport { getUpdateInfo } from \"@hot-updater/js\";\n//#region src/resolveUpdateInfoFromBundles.ts\nconst findSeedBundle = (bundles, bundleId) => bundles.find((bundle) => bundle.id === bundleId);\nconst resolveUpdateInfoFromBundles = async ({ args, bundles, context }) => {\n\tconst info = await getUpdateInfo(bundles, args);\n\tif (!info) return null;\n\tseedRequestUpdateBundles(context, [findSeedBundle(bundles, info.id), args.bundleId === NIL_UUID ? null : findSeedBundle(bundles, args.bundleId)]);\n\treturn info;\n};\n//#endregion\nexport { resolveUpdateInfoFromBundles };\n", "//#region src/createStoragePlugin.ts\nconst wrapNodeProfile = (node, hooks) => ({\n\t...node,\n\tasync upload(key, filePath) {\n\t\tconst result = await node.upload(key, filePath);\n\t\tawait hooks?.onStorageUploaded?.();\n\t\treturn result;\n\t}\n});\nconst createProfiledStoragePlugin = ({ createProfiles, name, profileShape, supportedProtocol }, hooks) => {\n\tlet cachedProfiles = null;\n\tlet cachedNodeProfile;\n\tlet cachedRuntimeProfile;\n\tconst getProfiles = () => {\n\t\tcachedProfiles ??= createProfiles();\n\t\treturn cachedProfiles;\n\t};\n\tconst getNodeProfile = () => {\n\t\tconst node = getProfiles().node;\n\t\tif (!node) return;\n\t\tcachedNodeProfile ??= wrapNodeProfile(node, hooks);\n\t\treturn cachedNodeProfile;\n\t};\n\tconst requireNodeProfile = () => {\n\t\tconst node = getNodeProfile();\n\t\tif (!node) throw new Error(`${name} does not implement the node storage profile for protocol \"${supportedProtocol}\".`);\n\t\treturn node;\n\t};\n\tconst getRuntimeProfile = () => {\n\t\tconst runtime = getProfiles().runtime;\n\t\tif (!runtime) return;\n\t\tcachedRuntimeProfile ??= runtime;\n\t\treturn cachedRuntimeProfile;\n\t};\n\tconst requireRuntimeProfile = () => {\n\t\tconst runtime = getRuntimeProfile();\n\t\tif (!runtime) throw new Error(`${name} does not implement the runtime storage profile for protocol \"${supportedProtocol}\".`);\n\t\treturn runtime;\n\t};\n\tconst profiles = {};\n\tif (profileShape?.node) {\n\t\tconst nodeProfile = {\n\t\t\tasync delete(storageUri) {\n\t\t\t\treturn requireNodeProfile().delete(storageUri);\n\t\t\t},\n\t\t\tasync downloadFile(storageUri, filePath) {\n\t\t\t\treturn requireNodeProfile().downloadFile(storageUri, filePath);\n\t\t\t},\n\t\t\tasync exists(storageUri) {\n\t\t\t\treturn requireNodeProfile().exists(storageUri);\n\t\t\t},\n\t\t\tasync upload(key, filePath) {\n\t\t\t\treturn requireNodeProfile().upload(key, filePath);\n\t\t\t}\n\t\t};\n\t\tObject.defineProperties(nodeProfile, {\n\t\t\tdeleteObjects: {\n\t\t\t\tenumerable: true,\n\t\t\t\tget: () => {\n\t\t\t\t\tconst deleteObjects = requireNodeProfile().deleteObjects;\n\t\t\t\t\treturn deleteObjects ? (keys) => deleteObjects(keys) : void 0;\n\t\t\t\t}\n\t\t\t},\n\t\t\tlistObjects: {\n\t\t\t\tenumerable: true,\n\t\t\t\tget: () => {\n\t\t\t\t\tconst listObjects = requireNodeProfile().listObjects;\n\t\t\t\t\treturn listObjects ? (prefix) => listObjects(prefix) : void 0;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tprofiles.node = nodeProfile;\n\t} else if (profileShape?.node !== false) Object.defineProperty(profiles, \"node\", {\n\t\tenumerable: true,\n\t\tget: getNodeProfile\n\t});\n\tif (profileShape?.runtime) profiles.runtime = {\n\t\tasync getDownloadUrl(storageUri, context) {\n\t\t\treturn requireRuntimeProfile().getDownloadUrl(storageUri, context);\n\t\t},\n\t\tasync readText(storageUri, context) {\n\t\t\treturn requireRuntimeProfile().readText(storageUri, context);\n\t\t}\n\t};\n\telse if (profileShape?.runtime !== false) Object.defineProperty(profiles, \"runtime\", {\n\t\tenumerable: true,\n\t\tget: getRuntimeProfile\n\t});\n\treturn {\n\t\tname,\n\t\tsupportedProtocol,\n\t\tprofiles\n\t};\n};\n/**\n* Creates a deploy/CLI/console storage plugin.\n*/\nconst createNodeStoragePlugin = (options) => {\n\treturn (config, hooks) => {\n\t\treturn () => createProfiledStoragePlugin({\n\t\t\tcreateProfiles: () => ({ node: options.factory(config) }),\n\t\t\tname: options.name,\n\t\t\tprofileShape: {\n\t\t\t\tnode: true,\n\t\t\t\truntime: false\n\t\t\t},\n\t\t\tsupportedProtocol: options.supportedProtocol\n\t\t}, hooks);\n\t};\n};\n/**\n* Creates an update-check runtime storage plugin.\n*/\nconst createRuntimeStoragePlugin = (options) => {\n\treturn (config, hooks) => {\n\t\treturn () => createProfiledStoragePlugin({\n\t\t\tcreateProfiles: () => ({ runtime: options.factory(config) }),\n\t\t\tname: options.name,\n\t\t\tprofileShape: {\n\t\t\t\tnode: false,\n\t\t\t\truntime: true\n\t\t\t},\n\t\t\tsupportedProtocol: options.supportedProtocol\n\t\t}, hooks);\n\t};\n};\n/**\n* Creates a storage plugin that can be used by both Node tooling and update\n* check runtimes.\n*/\nconst createUniversalStoragePlugin = (options) => {\n\treturn (config, hooks) => {\n\t\treturn () => createProfiledStoragePlugin({\n\t\t\tcreateProfiles: () => options.factory(config),\n\t\t\tname: options.name,\n\t\t\tprofileShape: {\n\t\t\t\tnode: true,\n\t\t\t\truntime: true\n\t\t\t},\n\t\t\tsupportedProtocol: options.supportedProtocol\n\t\t}, hooks);\n\t};\n};\n//#endregion\nexport { createNodeStoragePlugin, createRuntimeStoragePlugin, createUniversalStoragePlugin };\n", "//#region src/parseStorageUri.ts\nconst decodeStorageObjectKey = (key) => {\n\ttry {\n\t\treturn decodeURIComponent(key);\n\t} catch {\n\t\treturn key;\n\t}\n};\n/**\n* Parses a storage URI and validates the protocol.\n*\n* @param storageUri - The storage URI to parse (e.g., \"s3://bucket/path/to/file\")\n* @param expectedProtocol - The expected protocol without colon (e.g., \"s3\", \"r2\", \"gs\")\n* @returns Parsed storage URI components\n* @throws Error if the URI is invalid or protocol doesn't match\n*\n* @example\n* ```typescript\n* const { bucket, key } = parseStorageUri(\"s3://my-bucket/path/to/file.zip\", \"s3\");\n* // bucket: \"my-bucket\"\n* // key: \"path/to/file.zip\"\n* ```\n*/\nfunction parseStorageUri(storageUri, expectedProtocol) {\n\ttry {\n\t\tconst url = new URL(storageUri);\n\t\tconst protocol = url.protocol.replace(\":\", \"\");\n\t\tif (protocol !== expectedProtocol) throw new Error(`Invalid storage URI protocol. Expected ${expectedProtocol}, got ${protocol}`);\n\t\treturn {\n\t\t\tprotocol,\n\t\t\tbucket: url.hostname,\n\t\t\tkey: decodeStorageObjectKey(url.pathname.slice(1))\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof TypeError) throw new Error(`Invalid storage URI format: ${storageUri}`);\n\t\tthrow error;\n\t}\n}\n//#endregion\nexport { decodeStorageObjectKey, parseStorageUri };\n", "//#region src/storageProfile.ts\nconst createMissingProfileError = (plugin, profile) => /* @__PURE__ */ new Error(`${plugin.name} does not implement the ${profile} storage profile for protocol \"${plugin.supportedProtocol}\".`);\nconst isNodeStoragePlugin = (plugin) => Boolean(plugin.profiles.node);\nconst isRuntimeStoragePlugin = (plugin) => Boolean(plugin.profiles.runtime);\nfunction assertNodeStoragePlugin(plugin) {\n\tif (!isNodeStoragePlugin(plugin)) throw createMissingProfileError(plugin, \"node\");\n}\nfunction assertRuntimeStoragePlugin(plugin) {\n\tif (!isRuntimeStoragePlugin(plugin)) throw createMissingProfileError(plugin, \"runtime\");\n}\n//#endregion\nexport { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin };\n", "//#region package.json\nvar version = \"0.36.12\";\n//#endregion\nexport { version };\n", "import { version } from \"./package.mjs\";\n//#region src/version.ts\nconst HOT_UPDATER_SERVER_VERSION = version;\n//#endregion\nexport { HOT_UPDATER_SERVER_VERSION };\n", "//#region src/internalRouter.ts\nconst normalizePath = (path) => {\n\tif (!path) return \"/\";\n\tif (path === \"/\") return path;\n\tconst withLeadingSlash = path.startsWith(\"/\") ? path : `/${path}`;\n\treturn withLeadingSlash.endsWith(\"/\") ? withLeadingSlash.slice(0, -1) : withLeadingSlash;\n};\nconst toSegments = (path) => {\n\tconst normalized = normalizePath(path);\n\treturn normalized === \"/\" ? [] : normalized.slice(1).split(\"/\");\n};\nfunction createRouter() {\n\treturn { routes: [] };\n}\nfunction addRoute(router, method, path, data) {\n\tconst segments = toSegments(path);\n\tconst paramNames = segments.filter((segment) => segment.startsWith(\":\")).map((segment) => segment.slice(1));\n\trouter.routes.push({\n\t\tdata,\n\t\tmethod: method.toUpperCase(),\n\t\tparamNames,\n\t\tsegments\n\t});\n}\nfunction findRoute(router, method, path) {\n\tconst normalizedMethod = method.toUpperCase();\n\tconst pathSegments = toSegments(path);\n\tfor (const route of router.routes) {\n\t\tif (route.method !== normalizedMethod) continue;\n\t\tif (route.segments.length !== pathSegments.length) continue;\n\t\tconst params = {};\n\t\tlet matched = true;\n\t\tfor (let index = 0; index < route.segments.length; index += 1) {\n\t\t\tconst routeSegment = route.segments[index];\n\t\t\tconst pathSegment = pathSegments[index];\n\t\t\tif (routeSegment.startsWith(\":\")) {\n\t\t\t\tparams[routeSegment.slice(1)] = pathSegment;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (routeSegment !== pathSegment) {\n\t\t\t\tmatched = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (matched) return {\n\t\t\tdata: route.data,\n\t\t\tparams\n\t\t};\n\t}\n}\n//#endregion\nexport { addRoute, createRouter, findRoute };\n", "import { addRoute, createRouter, findRoute } from \"./internalRouter.mjs\";\nimport { HOT_UPDATER_SERVER_VERSION } from \"./version.mjs\";\nimport { isGreaterOrEqual, normalize } from \"verkit\";\n//#region src/handler.ts\nvar HandlerBadRequestError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"HandlerBadRequestError\";\n\t}\n};\nconst SDK_VERSION_HEADER = \"Hot-Updater-SDK-Version\";\nconst EXPLICIT_NO_UPDATE_MIN_SDK_VERSION = \"0.31.0\";\nconst DEFAULT_BUNDLE_LIST_LIMIT = 50;\nconst MAX_BUNDLE_LIST_LIMIT = 100;\nconst supportsExplicitNoUpdateResponse = (request) => {\n\tconst sdkVersion = request.headers.get(SDK_VERSION_HEADER)?.trim();\n\tif (!sdkVersion) return false;\n\tconst normalizedSdkVersion = normalize(sdkVersion);\n\treturn normalizedSdkVersion !== null && isGreaterOrEqual(normalizedSdkVersion, EXPLICIT_NO_UPDATE_MIN_SDK_VERSION);\n};\nconst serializeUpdateInfo = (updateInfo, request) => {\n\tif (updateInfo) return JSON.stringify(updateInfo);\n\tif (supportsExplicitNoUpdateResponse(request)) return JSON.stringify({ status: \"UP_TO_DATE\" });\n\treturn JSON.stringify(null);\n};\nconst handleVersion = async () => {\n\treturn new Response(JSON.stringify({ version: HOT_UPDATER_SERVER_VERSION }), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst decodeMaybe = (value) => {\n\tif (value === void 0) return void 0;\n\ttry {\n\t\treturn decodeURIComponent(value);\n\t} catch {\n\t\treturn value;\n\t}\n};\nconst isPlatform = (value) => {\n\treturn value === \"ios\" || value === \"android\";\n};\nconst requireRouteParam = (params, key) => {\n\tconst value = params[key];\n\tif (!value) throw new HandlerBadRequestError(`Missing route parameter: ${key}`);\n\treturn value;\n};\nconst parseBooleanSearchParam = (url, key) => {\n\tconst value = url.searchParams.get(key);\n\tif (value === null) return;\n\tif (value === \"true\") return true;\n\tif (value === \"false\") return false;\n\tthrow new HandlerBadRequestError(`The '${key}' query parameter must be 'true' or 'false'.`);\n};\nconst parseNullableStringSearchParam = (url, key) => {\n\tconst value = url.searchParams.get(key);\n\tif (value === null) return;\n\treturn value === \"null\" ? null : value;\n};\nconst parseStringArraySearchParam = (url, key) => {\n\tconst values = url.searchParams.getAll(key);\n\treturn values.length > 0 ? values : void 0;\n};\nconst parsePositiveIntegerSearchParam = (url, key, defaultValue, maxValue) => {\n\tconst value = url.searchParams.get(key);\n\tif (value === null) return defaultValue;\n\tconst parsed = Number(value);\n\tif (!Number.isInteger(parsed) || parsed < 1 || parsed > maxValue) throw new HandlerBadRequestError(`The '${key}' query parameter must be a positive integer between 1 and ${maxValue}.`);\n\treturn parsed;\n};\nconst requirePlatformParam = (params) => {\n\tconst platform = requireRouteParam(params, \"platform\");\n\tif (!isPlatform(platform)) throw new HandlerBadRequestError(`Invalid platform: ${platform}. Expected 'ios' or 'android'.`);\n\treturn platform;\n};\nconst requireBundlePatchPayload = (payload, bundleId) => {\n\tif (!payload || typeof payload !== \"object\" || Array.isArray(payload)) throw new HandlerBadRequestError(\"Invalid bundle payload\");\n\tconst bundlePatch = payload;\n\tif (bundlePatch.id !== void 0 && bundlePatch.id !== bundleId) throw new HandlerBadRequestError(\"Bundle id mismatch\");\n\tconst { id: _ignoredId, ...rest } = bundlePatch;\n\treturn rest;\n};\nconst handleFingerprintUpdateWithCohort = async (params, request, api, context) => {\n\tconst platform = requirePlatformParam(params);\n\tconst fingerprintHash = requireRouteParam(params, \"fingerprintHash\");\n\tconst channel = requireRouteParam(params, \"channel\");\n\tconst minBundleId = requireRouteParam(params, \"minBundleId\");\n\tconst bundleId = requireRouteParam(params, \"bundleId\");\n\tconst updateInfo = await api.getAppUpdateInfo({\n\t\t_updateStrategy: \"fingerprint\",\n\t\tplatform,\n\t\tfingerprintHash,\n\t\tchannel,\n\t\tminBundleId,\n\t\tbundleId,\n\t\tcohort: decodeMaybe(params.cohort)\n\t}, context);\n\treturn new Response(serializeUpdateInfo(updateInfo, request), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleAppVersionUpdateWithCohort = async (params, request, api, context) => {\n\tconst platform = requirePlatformParam(params);\n\tconst appVersion = requireRouteParam(params, \"appVersion\");\n\tconst channel = requireRouteParam(params, \"channel\");\n\tconst minBundleId = requireRouteParam(params, \"minBundleId\");\n\tconst bundleId = requireRouteParam(params, \"bundleId\");\n\tconst updateInfo = await api.getAppUpdateInfo({\n\t\t_updateStrategy: \"appVersion\",\n\t\tplatform,\n\t\tappVersion,\n\t\tchannel,\n\t\tminBundleId,\n\t\tbundleId,\n\t\tcohort: decodeMaybe(params.cohort)\n\t}, context);\n\treturn new Response(serializeUpdateInfo(updateInfo, request), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleGetBundle = async (params, _request, api, context) => {\n\tconst bundleId = requireRouteParam(params, \"id\");\n\tconst bundle = await api.getBundleById(bundleId, context);\n\tif (!bundle) return new Response(JSON.stringify({ error: \"Bundle not found\" }), {\n\t\tstatus: 404,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n\treturn new Response(JSON.stringify(bundle), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleGetBundles = async (_params, request, api, context) => {\n\tconst url = new URL(request.url);\n\tconst channel = url.searchParams.get(\"channel\") ?? void 0;\n\tconst platform = url.searchParams.get(\"platform\");\n\tconst limit = parsePositiveIntegerSearchParam(url, \"limit\", DEFAULT_BUNDLE_LIST_LIMIT, MAX_BUNDLE_LIST_LIMIT);\n\tconst pageParam = url.searchParams.get(\"page\");\n\tconst offset = url.searchParams.get(\"offset\");\n\tconst after = url.searchParams.get(\"after\") ?? void 0;\n\tconst before = url.searchParams.get(\"before\") ?? void 0;\n\tconst enabled = parseBooleanSearchParam(url, \"enabled\");\n\tconst targetAppVersion = parseNullableStringSearchParam(url, \"targetAppVersion\");\n\tconst targetAppVersionIn = parseStringArraySearchParam(url, \"targetAppVersionIn\");\n\tconst targetAppVersionNotNull = parseBooleanSearchParam(url, \"targetAppVersionNotNull\");\n\tconst fingerprintHash = parseNullableStringSearchParam(url, \"fingerprintHash\");\n\tconst idEq = url.searchParams.get(\"idEq\") ?? void 0;\n\tconst idGt = url.searchParams.get(\"idGt\") ?? void 0;\n\tconst idGte = url.searchParams.get(\"idGte\") ?? void 0;\n\tconst idLt = url.searchParams.get(\"idLt\") ?? void 0;\n\tconst idLte = url.searchParams.get(\"idLte\") ?? void 0;\n\tconst idIn = parseStringArraySearchParam(url, \"idIn\");\n\tconst page = pageParam === null ? void 0 : Number.isInteger(Number(pageParam)) && Number(pageParam) > 0 ? Number(pageParam) : null;\n\tif (offset !== null) throw new HandlerBadRequestError(\"The 'offset' query parameter has been removed. Use 'after' or 'before' cursor pagination instead.\");\n\tif (page === null) throw new HandlerBadRequestError(\"The 'page' query parameter must be a positive integer.\");\n\tif (platform !== null && !isPlatform(platform)) throw new HandlerBadRequestError(`Invalid platform: ${platform}. Expected 'ios' or 'android'.`);\n\tconst result = await api.getBundles({\n\t\twhere: {\n\t\t\t...channel && { channel },\n\t\t\t...platform && { platform },\n\t\t\t...enabled !== void 0 && { enabled },\n\t\t\t...idEq || idGt || idGte || idLt || idLte || idIn && idIn.length > 0 ? { id: {\n\t\t\t\t...idEq && { eq: idEq },\n\t\t\t\t...idGt && { gt: idGt },\n\t\t\t\t...idGte && { gte: idGte },\n\t\t\t\t...idLt && { lt: idLt },\n\t\t\t\t...idLte && { lte: idLte },\n\t\t\t\t...idIn && idIn.length > 0 && { in: idIn }\n\t\t\t} } : {},\n\t\t\t...targetAppVersion !== void 0 && { targetAppVersion },\n\t\t\t...targetAppVersionIn && { targetAppVersionIn },\n\t\t\t...targetAppVersionNotNull !== void 0 && { targetAppVersionNotNull },\n\t\t\t...fingerprintHash !== void 0 && { fingerprintHash }\n\t\t},\n\t\tlimit,\n\t\tpage,\n\t\tcursor: after || before ? {\n\t\t\tafter,\n\t\t\tbefore\n\t\t} : void 0\n\t}, context);\n\treturn new Response(JSON.stringify(result), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleCreateBundles = async (_params, request, api, context) => {\n\tconst body = await request.json();\n\tconst bundles = Array.isArray(body) ? body : [body];\n\tfor (const bundle of bundles) await api.insertBundle(bundle, context);\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\tstatus: 201,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleUpdateBundle = async (params, request, api, context) => {\n\tconst bundleId = requireRouteParam(params, \"id\");\n\tconst body = await request.json();\n\tconst bundlePatch = requireBundlePatchPayload(Array.isArray(body) ? body[0] : body, bundleId);\n\tawait api.updateBundleById(bundleId, bundlePatch, context);\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleDeleteBundle = async (params, _request, api, context) => {\n\tconst bundleId = requireRouteParam(params, \"id\");\n\tawait api.deleteBundleById(bundleId, context);\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleGetChannels = async (_params, _request, api, context) => {\n\tconst response = { data: { channels: await api.getChannels(context) } };\n\treturn new Response(JSON.stringify(response), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst routes = {\n\tversion: handleVersion,\n\tfingerprintUpdateWithCohort: handleFingerprintUpdateWithCohort,\n\tappVersionUpdateWithCohort: handleAppVersionUpdateWithCohort,\n\tgetBundle: handleGetBundle,\n\tgetBundles: handleGetBundles,\n\tcreateBundles: handleCreateBundles,\n\tupdateBundle: handleUpdateBundle,\n\tdeleteBundle: handleDeleteBundle,\n\tgetChannels: handleGetChannels\n};\n/**\n* Creates a Web Standard Request handler for Hot Updater API\n* This handler is framework-agnostic and works with any runtime that\n* supports standard Request/Response objects.\n*/\nfunction createHandler(api, options = {}) {\n\tconst basePath = options.basePath ?? \"/api\";\n\tconst routeOptions = {\n\t\tupdateCheck: options.routes?.updateCheck ?? true,\n\t\tbundles: options.routes?.bundles ?? false\n\t};\n\tconst router = createRouter();\n\taddRoute(router, \"GET\", \"/version\", \"version\");\n\tif (routeOptions.updateCheck) {\n\t\taddRoute(router, \"GET\", \"/fingerprint/:platform/:fingerprintHash/:channel/:minBundleId/:bundleId\", \"fingerprintUpdateWithCohort\");\n\t\taddRoute(router, \"GET\", \"/fingerprint/:platform/:fingerprintHash/:channel/:minBundleId/:bundleId/:cohort\", \"fingerprintUpdateWithCohort\");\n\t\taddRoute(router, \"GET\", \"/app-version/:platform/:appVersion/:channel/:minBundleId/:bundleId\", \"appVersionUpdateWithCohort\");\n\t\taddRoute(router, \"GET\", \"/app-version/:platform/:appVersion/:channel/:minBundleId/:bundleId/:cohort\", \"appVersionUpdateWithCohort\");\n\t}\n\tif (routeOptions.bundles) {\n\t\taddRoute(router, \"GET\", \"/api/bundles/channels\", \"getChannels\");\n\t\taddRoute(router, \"GET\", \"/api/bundles/:id\", \"getBundle\");\n\t\taddRoute(router, \"GET\", \"/api/bundles\", \"getBundles\");\n\t\taddRoute(router, \"POST\", \"/api/bundles\", \"createBundles\");\n\t\taddRoute(router, \"PATCH\", \"/api/bundles/:id\", \"updateBundle\");\n\t\taddRoute(router, \"DELETE\", \"/api/bundles/:id\", \"deleteBundle\");\n\t}\n\treturn async (request, context) => {\n\t\ttry {\n\t\t\tconst path = new URL(request.url).pathname;\n\t\t\tconst method = request.method;\n\t\t\tconst match = findRoute(router, method, path.startsWith(basePath) ? path.slice(basePath.length) : path);\n\t\t\tif (!match) return new Response(JSON.stringify({ error: \"Not found\" }), {\n\t\t\t\tstatus: 404,\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" }\n\t\t\t});\n\t\t\tconst handler = routes[match.data];\n\t\t\tif (!handler) return new Response(JSON.stringify({ error: \"Handler not found\" }), {\n\t\t\t\tstatus: 500,\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" }\n\t\t\t});\n\t\t\treturn await handler(match.params || {}, request, api, context);\n\t\t} catch (error) {\n\t\t\tif (error instanceof HandlerBadRequestError) return new Response(JSON.stringify({ error: error.message }), {\n\t\t\t\tstatus: 400,\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" }\n\t\t\t});\n\t\t\tconsole.error(\"Hot Updater handler error:\", error);\n\t\t\treturn new Response(JSON.stringify({\n\t\t\t\terror: \"Internal server error\",\n\t\t\t\tmessage: error instanceof Error ? error.message : \"Unknown error\"\n\t\t\t}), {\n\t\t\t\tstatus: 500,\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" }\n\t\t\t});\n\t\t}\n\t};\n}\n//#endregion\nexport { createHandler };\n", "import { DEFAULT_ROLLOUT_COHORT_COUNT, INVALID_COHORT_ERROR_MESSAGE, isValidCohort } from \"@hot-updater/core\";\n//#region src/db/schemaEnhancements.ts\nconst normalizeNullableString = (value) => {\n\tif (value === null || value === void 0) return null;\n\tconst normalized = value.trim();\n\treturn normalized.length > 0 ? normalized : null;\n};\nconst assertBundlePersistenceConstraints = (bundle) => {\n\tconst targetAppVersion = normalizeNullableString(bundle.targetAppVersion);\n\tconst fingerprintHash = normalizeNullableString(bundle.fingerprintHash);\n\tif (!targetAppVersion && !fingerprintHash) throw new Error(\"Bundle must define either targetAppVersion or fingerprintHash.\");\n\tconst rolloutCohortCount = bundle.rolloutCohortCount;\n\tif (rolloutCohortCount !== null && rolloutCohortCount !== void 0) {\n\t\tif (!Number.isInteger(rolloutCohortCount) || rolloutCohortCount < 0 || rolloutCohortCount > DEFAULT_ROLLOUT_COHORT_COUNT) throw new Error(`rolloutCohortCount must be an integer between 0 and ${DEFAULT_ROLLOUT_COHORT_COUNT}.`);\n\t}\n\tfor (const cohort of bundle.targetCohorts ?? []) if (!isValidCohort(cohort)) throw new Error(`Invalid target cohort \"${cohort}\". ${INVALID_COHORT_ERROR_MESSAGE}`);\n};\n//#endregion\nexport { assertBundlePersistenceConstraints };\n", "import { getManifestAssetDownloadPath, resolveManifestAssetStorageUri } from \"@hot-updater/plugin-core\";\nimport { getAssetBaseStorageUri, getBundlePatch, getManifestFileHash, getManifestStorageUri, stripBundleArtifactMetadata } from \"@hot-updater/core\";\n//#region src/db/updateArtifacts.ts\nconst HBC_ASSET_PATH_RE = /\\.bundle$/;\nconst resolveUniqueHbcAssetPath = (manifest) => {\n\tconst candidates = Object.keys(manifest.assets).sort((left, right) => left.localeCompare(right)).filter((candidate) => HBC_ASSET_PATH_RE.test(candidate));\n\treturn candidates.length === 1 ? candidates[0] : null;\n};\nconst isBundleManifest = (value) => {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst manifest = value;\n\tif (typeof manifest.bundleId !== \"string\") return false;\n\tif (!manifest.assets || typeof manifest.assets !== \"object\") return false;\n\treturn Object.values(manifest.assets).every((asset) => {\n\t\tif (!asset || typeof asset !== \"object\" || Array.isArray(asset)) return false;\n\t\tconst manifestAsset = asset;\n\t\treturn typeof manifestAsset.fileHash === \"string\" && (manifestAsset.signature === void 0 || typeof manifestAsset.signature === \"string\");\n\t});\n};\nconst parseBundleMetadata = (value) => {\n\tif (!value) return;\n\tlet parsedValue = value;\n\tif (typeof parsedValue === \"string\") try {\n\t\tparsedValue = JSON.parse(parsedValue);\n\t} catch {\n\t\treturn;\n\t}\n\tif (!parsedValue || typeof parsedValue !== \"object\" || Array.isArray(parsedValue)) return;\n\treturn stripBundleArtifactMetadata(parsedValue);\n};\nasync function fetchBundleManifest(storageUri, readStorageText, resolveFileUrl, context) {\n\tconst [storageText, fileUrl] = await Promise.all([readStorageText(storageUri, context), resolveFileUrl(storageUri, context)]);\n\tif (storageText === null) return null;\n\tlet payload;\n\ttry {\n\t\tpayload = JSON.parse(storageText);\n\t} catch {\n\t\treturn null;\n\t}\n\tif (!isBundleManifest(payload)) return null;\n\tif (!fileUrl) return null;\n\treturn {\n\t\tfileUrl,\n\t\tmanifest: payload\n\t};\n}\nasync function resolveChangedAssets({ assetBaseStorageUri, currentManifest, currentBundle, resolveFileUrl, targetBundle, targetManifest, context }) {\n\tconst patchDescriptor = await resolveHbcPatchDescriptor({\n\t\tcurrentBundle,\n\t\tresolveFileUrl,\n\t\ttargetBundle,\n\t\ttargetManifest,\n\t\tcontext\n\t});\n\tconst changedEntries = await Promise.all(Object.entries(targetManifest.assets).map(async ([assetPath, asset]) => {\n\t\tif ((currentManifest?.assets[assetPath])?.fileHash === asset.fileHash) return null;\n\t\tconst downloadPath = getManifestAssetDownloadPath(assetPath);\n\t\tconst usesBrotliAsset = downloadPath !== assetPath;\n\t\tconst storageUri = resolveManifestAssetStorageUri({\n\t\t\tassetBaseStorageUri,\n\t\t\tassetPath: downloadPath,\n\t\t\tfileHash: asset.fileHash\n\t\t});\n\t\tconst patch = patchDescriptor?.assetPath === assetPath ? patchDescriptor.patch : null;\n\t\tlet fileUrl = null;\n\t\ttry {\n\t\t\tfileUrl = await resolveFileUrl(storageUri, context);\n\t\t} catch (error) {\n\t\t\tif (!patch) throw error;\n\t\t}\n\t\tif (!fileUrl && !patch) return false;\n\t\tconst changedAsset = { fileHash: asset.fileHash };\n\t\tif (fileUrl) {\n\t\t\tchangedAsset.file = { url: fileUrl };\n\t\t\tif (usesBrotliAsset) changedAsset.file.compression = \"br\";\n\t\t}\n\t\tif (patch) changedAsset.patch = patch;\n\t\treturn [assetPath, changedAsset];\n\t}));\n\tif (changedEntries.some((entry) => entry === false)) return null;\n\treturn Object.fromEntries(changedEntries.filter((entry) => entry !== null));\n}\nasync function resolveHbcPatchDescriptor({ currentBundle, resolveFileUrl, targetBundle, targetManifest, context }) {\n\tconst matchingPatch = targetBundle && currentBundle ? getBundlePatch(targetBundle, currentBundle.id) : null;\n\tconst patchAssetPath = resolveUniqueHbcAssetPath(targetManifest);\n\tif (!currentBundle || !matchingPatch || !patchAssetPath || !matchingPatch.patchStorageUri || !matchingPatch.patchFileHash || !matchingPatch.baseFileHash) return null;\n\tconst patchUrl = await resolveFileUrl(matchingPatch.patchStorageUri, context);\n\tif (!patchUrl) return null;\n\treturn {\n\t\tassetPath: patchAssetPath,\n\t\tpatch: {\n\t\t\talgorithm: \"bsdiff\",\n\t\t\tbaseBundleId: matchingPatch.baseBundleId,\n\t\t\tbaseFileHash: matchingPatch.baseFileHash,\n\t\t\tpatchFileHash: matchingPatch.patchFileHash,\n\t\t\tpatchUrl\n\t\t}\n\t};\n}\nasync function resolveManifestArtifacts({ currentBundle, resolveFileUrl, readStorageText, targetBundle, context }) {\n\tconst manifestStorageUri = targetBundle ? getManifestStorageUri(targetBundle) : null;\n\tconst manifestFileHash = targetBundle ? getManifestFileHash(targetBundle) : null;\n\tconst assetBaseStorageUri = targetBundle ? getAssetBaseStorageUri(targetBundle) : null;\n\tif (!manifestStorageUri || !manifestFileHash || !assetBaseStorageUri) return null;\n\tconst currentManifestStorageUri = currentBundle ? getManifestStorageUri(currentBundle) : null;\n\tconst [targetManifestResult, currentManifestResult] = await Promise.all([fetchBundleManifest(manifestStorageUri, readStorageText, resolveFileUrl, context), currentManifestStorageUri ? fetchBundleManifest(currentManifestStorageUri, readStorageText, resolveFileUrl, context) : null]);\n\tif (!targetManifestResult) return null;\n\tconst changedAssets = await resolveChangedAssets({\n\t\tassetBaseStorageUri,\n\t\tcurrentManifest: currentManifestResult?.manifest ?? null,\n\t\tcurrentBundle,\n\t\tresolveFileUrl,\n\t\ttargetBundle,\n\t\ttargetManifest: targetManifestResult.manifest,\n\t\tcontext\n\t});\n\tif (!changedAssets) return null;\n\treturn {\n\t\tchangedAssets,\n\t\tmanifestFileHash,\n\t\tmanifestUrl: targetManifestResult.fileUrl\n\t};\n}\n//#endregion\nexport { parseBundleMetadata, resolveManifestArtifacts };\n", "import { assertBundlePersistenceConstraints } from \"./schemaEnhancements.mjs\";\nimport { resolveManifestArtifacts } from \"./updateArtifacts.mjs\";\nimport { createRequestUpdateBundleResolver, semverSatisfies } from \"@hot-updater/plugin-core\";\nimport { NIL_UUID, isCohortEligibleForUpdate } from \"@hot-updater/core\";\n//#region src/db/pluginCore.ts\nconst PAGE_SIZE = 100;\nconst DESC_ORDER = {\n\tfield: \"id\",\n\tdirection: \"desc\"\n};\nconst bundleMatchesQueryWhere = (bundle, where) => {\n\tif (!where) return true;\n\tif (where.channel !== void 0 && bundle.channel !== where.channel) return false;\n\tif (where.platform !== void 0 && bundle.platform !== where.platform) return false;\n\tif (where.enabled !== void 0 && bundle.enabled !== where.enabled) return false;\n\tif (where.id?.eq !== void 0 && bundle.id !== where.id.eq) return false;\n\tif (where.id?.gt !== void 0 && bundle.id.localeCompare(where.id.gt) <= 0) return false;\n\tif (where.id?.gte !== void 0 && bundle.id.localeCompare(where.id.gte) < 0) return false;\n\tif (where.id?.lt !== void 0 && bundle.id.localeCompare(where.id.lt) >= 0) return false;\n\tif (where.id?.lte !== void 0 && bundle.id.localeCompare(where.id.lte) > 0) return false;\n\tif (where.id?.in && !where.id.in.includes(bundle.id)) return false;\n\tif (where.targetAppVersionNotNull && bundle.targetAppVersion === null) return false;\n\tif (where.targetAppVersion !== void 0 && bundle.targetAppVersion !== where.targetAppVersion) return false;\n\tif (where.targetAppVersionIn && !where.targetAppVersionIn.includes(bundle.targetAppVersion ?? \"\")) return false;\n\tif (where.fingerprintHash !== void 0 && bundle.fingerprintHash !== where.fingerprintHash) return false;\n\treturn true;\n};\nconst sortBundles = (bundles, orderBy) => {\n\tconst direction = orderBy?.direction ?? \"desc\";\n\treturn bundles.slice().sort((a, b) => {\n\t\tconst result = a.id.localeCompare(b.id);\n\t\treturn direction === \"asc\" ? result : -result;\n\t});\n};\nconst makeResponse = (bundle, status) => ({\n\tid: bundle.id,\n\tmessage: bundle.message,\n\tshouldForceUpdate: status === \"ROLLBACK\" ? true : bundle.shouldForceUpdate,\n\tstatus,\n\tstorageUri: bundle.storageUri,\n\tfileHash: bundle.fileHash\n});\nconst INIT_BUNDLE_ROLLBACK_UPDATE_INFO = {\n\tmessage: null,\n\tid: NIL_UUID,\n\tshouldForceUpdate: true,\n\tstatus: \"ROLLBACK\",\n\tstorageUri: null,\n\tfileHash: null\n};\nfunction createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {\n\tconst coreOptions = options;\n\tconst runWithMutationPlugin = async (operation) => {\n\t\tconst plugin = coreOptions?.createMutationPlugin?.() ?? getPlugin();\n\t\ttry {\n\t\t\treturn await operation(plugin);\n\t\t} finally {\n\t\t\tif (coreOptions?.createMutationPlugin) await coreOptions.cleanupMutationPlugin?.(plugin);\n\t\t}\n\t};\n\tconst getSortedBundlePage = async (options, context) => {\n\t\tconst result = await getPlugin().getBundles({\n\t\t\t...options,\n\t\t\torderBy: options.orderBy ?? DESC_ORDER\n\t\t}, context);\n\t\treturn {\n\t\t\t...result,\n\t\t\tdata: sortBundles(result.data, options.orderBy ?? DESC_ORDER)\n\t\t};\n\t};\n\tconst isEligibleForUpdate = (bundle, cohort) => {\n\t\treturn isCohortEligibleForUpdate(bundle.id, cohort, bundle.rolloutCohortCount, bundle.targetCohorts);\n\t};\n\tconst findUpdateInfoByScanning = async ({ args, queryWhere, isCandidate, context }) => {\n\t\tlet after;\n\t\twhile (true) {\n\t\t\tconst { data, pagination } = await getSortedBundlePage({\n\t\t\t\twhere: queryWhere,\n\t\t\t\tlimit: PAGE_SIZE,\n\t\t\t\torderBy: DESC_ORDER,\n\t\t\t\t...after ? { cursor: { after } } : {}\n\t\t\t}, context);\n\t\t\tfor (const bundle of data) {\n\t\t\t\tif (!bundleMatchesQueryWhere(bundle, queryWhere) || !isCandidate(bundle)) continue;\n\t\t\t\tif (args.bundleId === NIL_UUID) {\n\t\t\t\t\tif (isEligibleForUpdate(bundle, args.cohort)) return makeResponse(bundle, \"UPDATE\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst compareResult = bundle.id.localeCompare(args.bundleId);\n\t\t\t\tif (compareResult > 0) {\n\t\t\t\t\tif (isEligibleForUpdate(bundle, args.cohort)) return makeResponse(bundle, \"UPDATE\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (compareResult === 0) {\n\t\t\t\t\tif (isEligibleForUpdate(bundle, args.cohort)) return null;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\treturn makeResponse(bundle, \"ROLLBACK\");\n\t\t\t}\n\t\t\tif (!pagination.hasNextPage) break;\n\t\t\tafter = data.at(-1)?.id;\n\t\t\tif (!after) break;\n\t\t}\n\t\tif (args.bundleId === NIL_UUID) return null;\n\t\tif (args.minBundleId && args.bundleId.localeCompare(args.minBundleId) <= 0) return null;\n\t\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n\t};\n\tconst getBaseWhere = ({ platform, channel, minBundleId }) => ({\n\t\tplatform,\n\t\tchannel,\n\t\tenabled: true,\n\t\tid: { gte: minBundleId }\n\t});\n\treturn {\n\t\tapi: {\n\t\t\tasync getBundleById(id, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\treturn getPlugin().getBundleById(id, context);\n\t\t\t},\n\t\t\tasync getUpdateInfo(args, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\tconst directGetUpdateInfo = getPlugin().getUpdateInfo;\n\t\t\t\tif (directGetUpdateInfo) return context === void 0 ? await directGetUpdateInfo(args) : await directGetUpdateInfo(args, context);\n\t\t\t\tconst channel = args.channel ?? \"production\";\n\t\t\t\tconst minBundleId = args.minBundleId ?? NIL_UUID;\n\t\t\t\tconst baseWhere = getBaseWhere({\n\t\t\t\t\tplatform: args.platform,\n\t\t\t\t\tchannel,\n\t\t\t\t\tminBundleId\n\t\t\t\t});\n\t\t\t\tif (args._updateStrategy === \"fingerprint\") return findUpdateInfoByScanning({\n\t\t\t\t\targs,\n\t\t\t\t\tqueryWhere: {\n\t\t\t\t\t\t...baseWhere,\n\t\t\t\t\t\tfingerprintHash: args.fingerprintHash\n\t\t\t\t\t},\n\t\t\t\t\tcontext,\n\t\t\t\t\tisCandidate: (bundle) => {\n\t\t\t\t\t\treturn bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && bundle.fingerprintHash === args.fingerprintHash;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn findUpdateInfoByScanning({\n\t\t\t\t\targs,\n\t\t\t\t\tqueryWhere: { ...baseWhere },\n\t\t\t\t\tcontext,\n\t\t\t\t\tisCandidate: (bundle) => {\n\t\t\t\t\t\treturn bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && !!bundle.targetAppVersion && semverSatisfies(bundle.targetAppVersion, args.appVersion);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync getAppUpdateInfo(args, context) {\n\t\t\t\tconst info = await this.getUpdateInfo(args, context);\n\t\t\t\tif (!info) return null;\n\t\t\t\tconst { storageUri, ...rest } = info;\n\t\t\t\tconst readStorageText = coreOptions?.readStorageText;\n\t\t\t\tif (info.id === NIL_UUID || !readStorageText) {\n\t\t\t\t\tconst fileUrl = await resolveFileUrl(storageUri ?? null, context);\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...rest,\n\t\t\t\t\t\tfileUrl\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst requestBundles = createRequestUpdateBundleResolver(context);\n\t\t\t\tconst getCurrentBundle = () => {\n\t\t\t\t\tif (args.bundleId === NIL_UUID) return null;\n\t\t\t\t\tconst seededCurrentBundle = requestBundles.peek(args.bundleId);\n\t\t\t\t\tif (seededCurrentBundle || requestBundles.hasSeededBundles()) return seededCurrentBundle;\n\t\t\t\t\treturn requestBundles.getById(args.bundleId, () => getPlugin().getBundleById(args.bundleId, context));\n\t\t\t\t};\n\t\t\t\tconst [fileUrl, targetBundle, currentBundle] = await Promise.all([\n\t\t\t\t\tresolveFileUrl(storageUri ?? null, context),\n\t\t\t\t\trequestBundles.getById(info.id, () => getPlugin().getBundleById(info.id, context)),\n\t\t\t\t\tgetCurrentBundle()\n\t\t\t\t]);\n\t\t\t\tconst baseResponse = {\n\t\t\t\t\t...rest,\n\t\t\t\t\tfileUrl\n\t\t\t\t};\n\t\t\t\tconst manifestArtifacts = await resolveManifestArtifacts({\n\t\t\t\t\tcurrentBundle,\n\t\t\t\t\tresolveFileUrl,\n\t\t\t\t\treadStorageText,\n\t\t\t\t\ttargetBundle,\n\t\t\t\t\tcontext\n\t\t\t\t});\n\t\t\t\tif (!manifestArtifacts) return baseResponse;\n\t\t\t\treturn {\n\t\t\t\t\t...baseResponse,\n\t\t\t\t\t...manifestArtifacts\n\t\t\t\t};\n\t\t\t},\n\t\t\tasync getChannels(context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\treturn getPlugin().getChannels(context);\n\t\t\t},\n\t\t\tasync getBundles(options, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\treturn getPlugin().getBundles(options, context);\n\t\t\t},\n\t\t\tasync insertBundle(bundle, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\tassertBundlePersistenceConstraints(bundle);\n\t\t\t\tawait runWithMutationPlugin(async (plugin) => {\n\t\t\t\t\tawait plugin.appendBundle(bundle, context);\n\t\t\t\t\tawait plugin.commitBundle(context);\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync updateBundleById(bundleId, newBundle, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\tawait runWithMutationPlugin(async (plugin) => {\n\t\t\t\t\tconst current = await plugin.getBundleById(bundleId, context);\n\t\t\t\t\tif (!current) throw new Error(\"targetBundleId not found\");\n\t\t\t\t\tassertBundlePersistenceConstraints({\n\t\t\t\t\t\t...current,\n\t\t\t\t\t\t...newBundle\n\t\t\t\t\t});\n\t\t\t\t\tawait plugin.updateBundle(bundleId, newBundle, context);\n\t\t\t\t\tawait plugin.commitBundle(context);\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync deleteBundleById(bundleId, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\tawait runWithMutationPlugin(async (plugin) => {\n\t\t\t\t\tconst bundle = await plugin.getBundleById(bundleId, context);\n\t\t\t\t\tif (!bundle) return;\n\t\t\t\t\tawait plugin.deleteBundle(bundle, context);\n\t\t\t\t\tawait plugin.commitBundle(context);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tadapterName: getPlugin().name,\n\t\tcreateMigrator: () => {\n\t\t\tthrow new Error(\"createMigrator is only available for Kysely/MongoDB database adapters.\");\n\t\t},\n\t\tgenerateSchema: () => {\n\t\t\tthrow new Error(\"generateSchema is only available for Drizzle/Prisma database adapters.\");\n\t\t}\n\t};\n}\n//#endregion\nexport { createPluginDatabaseCore };\n", "//#region src/schema/types.ts\nconst HOT_UPDATER_SCHEMA_VERSION = \"0.31.0\";\nconst HOT_UPDATER_SETTINGS_TABLE = \"private_hot_updater_settings\";\n//#endregion\nexport { HOT_UPDATER_SCHEMA_VERSION, HOT_UPDATER_SETTINGS_TABLE };\n", "import { HOT_UPDATER_SCHEMA_VERSION } from \"../schema/types.mjs\";\n//#region src/db/schemaReadiness.ts\nvar HotUpdaterSchemaMigrationRequiredError = class extends Error {\n\tconstructor(adapterName, currentVersion) {\n\t\tsuper(currentVersion === void 0 ? `Hot Updater database schema is not initialized for ${adapterName}. Run \\`hot-updater db migrate\\` before using this adapter.` : `Hot Updater database schema version ${currentVersion} is not supported by ${adapterName}. Run \\`hot-updater db migrate\\` to upgrade to ${HOT_UPDATER_SCHEMA_VERSION}.`);\n\t\tthis.adapterName = adapterName;\n\t\tthis.currentVersion = currentVersion;\n\t\tthis.name = \"HotUpdaterSchemaMigrationRequiredError\";\n\t}\n};\nconst createSchemaReadinessChecker = (adapterName, createMigrator) => {\n\tif (!createMigrator) return async () => {};\n\tlet ready = false;\n\treturn async () => {\n\t\tif (ready) return;\n\t\tconst version = await createMigrator().getVersion();\n\t\tif (version !== \"0.31.0\") throw new HotUpdaterSchemaMigrationRequiredError(adapterName, version);\n\t\tready = true;\n\t};\n};\n//#endregion\nexport { HotUpdaterSchemaMigrationRequiredError, createSchemaReadinessChecker };\n", "//#region src/db/types.ts\nconst sqlProviders = [\n\t\"sqlite\",\n\t\"cockroachdb\",\n\t\"mysql\",\n\t\"postgresql\",\n\t\"mssql\"\n];\nconst noSqlProviders = [\"mongodb\"];\n[...sqlProviders, ...noSqlProviders];\nfunction isDatabasePluginFactory(adapter) {\n\treturn typeof adapter === \"function\";\n}\nfunction isDatabasePlugin(adapter) {\n\treturn typeof adapter === \"object\" && adapter !== null && \"getBundleById\" in adapter && \"getBundles\" in adapter && \"getChannels\" in adapter;\n}\nfunction getSQLProvider(provider) {\n\tif (!provider) return;\n\treturn sqlProviders.includes(provider) ? provider : void 0;\n}\n//#endregion\nexport { getSQLProvider, isDatabasePlugin, isDatabasePluginFactory };\n", "//#region src/route.ts\nconst normalizeBasePath = (basePath) => {\n\tif (!basePath || basePath === \"/\") return \"/\";\n\treturn basePath.endsWith(\"/\") ? basePath.slice(0, -1) : basePath;\n};\n//#endregion\nexport { normalizeBasePath };\n", "//#region src/storageAccess.ts\nconst assertRemoteDownloadUrl = (fileUrl) => {\n\ttry {\n\t\tconst protocol = new URL(fileUrl).protocol.replace(\":\", \"\");\n\t\tif (protocol === \"http\" || protocol === \"https\") return fileUrl;\n\t} catch {}\n\tthrow new Error(\"Storage plugin returned a local file path; runtime update checks require an HTTP(S) download URL.\");\n};\nconst getStorageProtocol = (storageUri) => new URL(storageUri).protocol.replace(\":\", \"\");\nconst isRemoteUrlProtocol = (protocol) => protocol === \"http\" || protocol === \"https\";\nconst createStorageAccess = (storagePlugins) => {\n\tconst findStoragePlugin = (protocol) => {\n\t\treturn storagePlugins.find((item) => item.supportedProtocol === protocol);\n\t};\n\tconst resolveFileUrl = async (storageUri, context) => {\n\t\tif (!storageUri) return null;\n\t\tconst protocol = getStorageProtocol(storageUri);\n\t\tconst plugin = findStoragePlugin(protocol);\n\t\tif (plugin) {\n\t\t\tconst { fileUrl } = await plugin.profiles.runtime.getDownloadUrl(storageUri, context);\n\t\t\tif (!fileUrl) throw new Error(\"Storage plugin returned empty fileUrl\");\n\t\t\treturn assertRemoteDownloadUrl(fileUrl);\n\t\t}\n\t\tif (isRemoteUrlProtocol(protocol)) return storageUri;\n\t\tthrow new Error(`No storage plugin for protocol: ${protocol}`);\n\t};\n\tconst readStorageText = async (storageUri, context) => {\n\t\tconst protocol = getStorageProtocol(storageUri);\n\t\tconst plugin = findStoragePlugin(protocol);\n\t\tif (plugin) return plugin.profiles.runtime.readText(storageUri, context);\n\t\tif (isRemoteUrlProtocol(protocol)) {\n\t\t\tconst response = await fetch(storageUri);\n\t\t\tif (!response.ok) return null;\n\t\t\treturn response.text();\n\t\t}\n\t\tthrow new Error(`No storage plugin for protocol: ${protocol}`);\n\t};\n\treturn {\n\t\treadStorageText,\n\t\tresolveFileUrl\n\t};\n};\n//#endregion\nexport { createStorageAccess };\n", "import { createHandler } from \"./handler.mjs\";\nimport { createPluginDatabaseCore } from \"./db/pluginCore.mjs\";\nimport { createSchemaReadinessChecker } from \"./db/schemaReadiness.mjs\";\nimport { isDatabasePlugin, isDatabasePluginFactory } from \"./db/types.mjs\";\nimport { normalizeBasePath } from \"./route.mjs\";\nimport { createStorageAccess } from \"./storageAccess.mjs\";\nimport { assertRuntimeStoragePlugin } from \"@hot-updater/plugin-core\";\n//#region src/createHotUpdaterCore.ts\nconst hotUpdaterCoreMetadata = Symbol.for(\"@hot-updater/server/core-metadata\");\nfunction getHotUpdaterCoreMetadata(hotUpdater) {\n\treturn hotUpdater[hotUpdaterCoreMetadata];\n}\nfunction createHotUpdaterCore(options) {\n\tconst database = options.database;\n\tconst basePath = normalizeBasePath(options.basePath ?? \"/api\");\n\tconst { readStorageText, resolveFileUrl } = createStorageAccess((options.storages ?? options.storagePlugins ?? []).map((plugin) => {\n\t\tconst storagePlugin = typeof plugin === \"function\" ? plugin() : plugin;\n\t\tassertRuntimeStoragePlugin(storagePlugin);\n\t\treturn storagePlugin;\n\t}));\n\tif (!isDatabasePluginFactory(database) && !isDatabasePlugin(database)) throw new Error(\"@hot-updater/server only supports database plugins.\");\n\tconst adapterCapabilities = database;\n\tconst plugin = isDatabasePluginFactory(database) ? database() : database;\n\tconst assertSchemaReady = createSchemaReadinessChecker(adapterCapabilities.adapterName ?? plugin.name, adapterCapabilities.createMigrator);\n\tconst core = createPluginDatabaseCore(() => plugin, resolveFileUrl, isDatabasePluginFactory(database) ? {\n\t\tcreateMutationPlugin: () => database(),\n\t\tbeforeOperation: assertSchemaReady,\n\t\treadStorageText\n\t} : {\n\t\tbeforeOperation: assertSchemaReady,\n\t\treadStorageText\n\t});\n\tconst internalHandler = createHandler(core.api, {\n\t\tbasePath,\n\t\troutes: options.routes\n\t});\n\tconst handler = (request, context, ...extraArgs) => {\n\t\tif (extraArgs.length > 0) return internalHandler(request);\n\t\treturn internalHandler(request, context);\n\t};\n\tconst api = {\n\t\tbasePath,\n\t\tadapterName: adapterCapabilities.adapterName ?? core.adapterName,\n\t\thandler\n\t};\n\tObject.defineProperties(api, Object.getOwnPropertyDescriptors(core.api));\n\tObject.defineProperty(api, hotUpdaterCoreMetadata, {\n\t\tenumerable: false,\n\t\tvalue: {\n\t\t\tadapterCapabilities,\n\t\t\tcore\n\t\t}\n\t});\n\treturn {\n\t\tapi,\n\t\tadapterCapabilities,\n\t\tcore\n\t};\n}\nfunction createHotUpdater(options) {\n\treturn createHotUpdaterCore(options).api;\n}\n//#endregion\nexport { createHotUpdater, getHotUpdaterCoreMetadata };\n", "// src/compose.ts\nvar compose = (middleware, onError, onNotFound) => {\n return (context, next) => {\n let index = -1;\n return dispatch(0);\n async function dispatch(i) {\n if (i <= index) {\n throw new Error(\"next() called multiple times\");\n }\n index = i;\n let res;\n let isError = false;\n let handler;\n if (middleware[i]) {\n handler = middleware[i][0][0];\n context.req.routeIndex = i;\n } else {\n handler = i === middleware.length && next || void 0;\n }\n if (handler) {\n try {\n res = await handler(context, () => dispatch(i + 1));\n } catch (err) {\n if (err instanceof Error && onError) {\n context.error = err;\n res = await onError(err, context);\n isError = true;\n } else {\n throw err;\n }\n }\n } else {\n if (context.finalized === false && onNotFound) {\n res = await onNotFound(context);\n }\n }\n if (res && (context.finalized === false || isError)) {\n context.res = res;\n }\n return context;\n }\n };\n};\nexport {\n compose\n};\n", "// src/request/constants.ts\nvar GET_MATCH_RESULT = /* @__PURE__ */ Symbol();\nexport {\n GET_MATCH_RESULT\n};\n", "// src/utils/buffer.ts\nimport { sha256 } from \"./crypto.js\";\nvar equal = (a, b) => {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n const va = new DataView(a);\n const vb = new DataView(b);\n let i = va.byteLength;\n while (i--) {\n if (va.getUint8(i) !== vb.getUint8(i)) {\n return false;\n }\n }\n return true;\n};\nvar constantTimeEqualString = (a, b) => {\n const aLen = a.length;\n const bLen = b.length;\n const maxLen = Math.max(aLen, bLen);\n let out = aLen ^ bLen;\n for (let i = 0; i < maxLen; i++) {\n const aChar = i < aLen ? a.charCodeAt(i) : 0;\n const bChar = i < bLen ? b.charCodeAt(i) : 0;\n out |= aChar ^ bChar;\n }\n return out === 0;\n};\nvar timingSafeEqualString = async (a, b, hashFunction) => {\n if (!hashFunction) {\n hashFunction = sha256;\n }\n const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)]);\n if (sa == null || sb == null || typeof sa !== \"string\" || typeof sb !== \"string\") {\n return false;\n }\n const hashEqual = constantTimeEqualString(sa, sb);\n const originalEqual = constantTimeEqualString(a, b);\n return hashEqual && originalEqual;\n};\nvar timingSafeEqual = async (a, b, hashFunction) => {\n if (typeof a === \"string\" && typeof b === \"string\") {\n return timingSafeEqualString(a, b, hashFunction);\n }\n if (!hashFunction) {\n hashFunction = sha256;\n }\n const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)]);\n if (!sa || !sb || typeof sa !== \"string\" || typeof sb !== \"string\") {\n return false;\n }\n return timingSafeEqualString(sa, sb);\n};\nvar bufferToString = (buffer) => {\n if (buffer instanceof ArrayBuffer) {\n const enc = new TextDecoder(\"utf-8\");\n return enc.decode(buffer);\n }\n return buffer;\n};\nvar bufferToFormData = (arrayBuffer, contentType) => {\n const response = new Response(arrayBuffer, {\n headers: {\n // Normalize the media type (case-insensitive) while keeping parameters like the boundary\n \"Content-Type\": contentType.replace(/^[^;]+/, (mediaType) => mediaType.toLowerCase())\n }\n });\n return response.formData();\n};\nexport {\n bufferToFormData,\n bufferToString,\n equal,\n timingSafeEqual\n};\n", "// src/utils/body.ts\nimport { bufferToFormData } from \"./buffer.js\";\nvar isRawRequest = (request) => \"headers\" in request;\nvar parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {\n const { all = false, dot = false } = options;\n const headers = isRawRequest(request) ? request.headers : request.raw.headers;\n const contentType = headers.get(\"Content-Type\");\n const mediaType = contentType?.split(\";\")[0].trim().toLowerCase();\n if (mediaType === \"multipart/form-data\" || mediaType === \"application/x-www-form-urlencoded\") {\n return parseFormData(request, { all, dot });\n }\n return {};\n};\nasync function parseFormData(request, options) {\n if (!isRawRequest(request) && request.bodyCache.formData) {\n return convertFormDataToBodyData(\n await request.bodyCache.formData,\n options\n );\n }\n const headers = isRawRequest(request) ? request.headers : request.raw.headers;\n const arrayBuffer = await request.arrayBuffer();\n const formDataPromise = bufferToFormData(arrayBuffer, headers.get(\"Content-Type\") || \"\");\n if (!isRawRequest(request)) {\n request.bodyCache.formData = formDataPromise;\n }\n const formData = await formDataPromise;\n if (formData) {\n return convertFormDataToBodyData(formData, options);\n }\n return {};\n}\nfunction convertFormDataToBodyData(formData, options) {\n const form = /* @__PURE__ */ Object.create(null);\n formData.forEach((value, key) => {\n const shouldParseAllValues = options.all || key.endsWith(\"[]\");\n if (!shouldParseAllValues) {\n form[key] = value;\n } else {\n handleParsingAllValues(form, key, value);\n }\n });\n if (options.dot) {\n Object.entries(form).forEach(([key, value]) => {\n const shouldParseDotValues = key.includes(\".\");\n if (shouldParseDotValues) {\n handleParsingNestedValues(form, key, value);\n delete form[key];\n }\n });\n }\n return form;\n}\nvar handleParsingAllValues = (form, key, value) => {\n if (form[key] !== void 0) {\n if (Array.isArray(form[key])) {\n ;\n form[key].push(value);\n } else {\n form[key] = [form[key], value];\n }\n } else {\n if (!key.endsWith(\"[]\")) {\n form[key] = value;\n } else {\n form[key] = [value];\n }\n }\n};\nvar handleParsingNestedValues = (form, key, value) => {\n if (/(?:^|\\.)__proto__\\./.test(key)) {\n return;\n }\n let nestedForm = form;\n const keys = key.split(\".\");\n keys.forEach((key2, index) => {\n if (index === keys.length - 1) {\n nestedForm[key2] = value;\n } else {\n if (!nestedForm[key2] || typeof nestedForm[key2] !== \"object\" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {\n nestedForm[key2] = /* @__PURE__ */ Object.create(null);\n }\n nestedForm = nestedForm[key2];\n }\n });\n};\nexport {\n parseBody\n};\n", "// src/utils/url.ts\nvar splitPath = (path) => {\n const paths = path.split(\"/\");\n if (paths[0] === \"\") {\n paths.shift();\n }\n return paths;\n};\nvar splitRoutingPath = (routePath) => {\n const { groups, path } = extractGroupsFromPath(routePath);\n const paths = splitPath(path);\n return replaceGroupMarks(paths, groups);\n};\nvar extractGroupsFromPath = (path) => {\n const groups = [];\n path = path.replace(/\\{[^}]+\\}/g, (match, index) => {\n const mark = `@${index}`;\n groups.push([mark, match]);\n return mark;\n });\n return { groups, path };\n};\nvar replaceGroupMarks = (paths, groups) => {\n for (let i = groups.length - 1; i >= 0; i--) {\n const [mark] = groups[i];\n for (let j = paths.length - 1; j >= 0; j--) {\n if (paths[j].includes(mark)) {\n paths[j] = paths[j].replace(mark, groups[i][1]);\n break;\n }\n }\n }\n return paths;\n};\nvar patternCache = {};\nvar getPattern = (label, next) => {\n if (label === \"*\") {\n return \"*\";\n }\n const match = label.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);\n if (match) {\n const cacheKey = `${label}#${next}`;\n if (!patternCache[cacheKey]) {\n if (match[2]) {\n patternCache[cacheKey] = next && next[0] !== \":\" && next[0] !== \"*\" ? [cacheKey, match[1], new RegExp(`^${match[2]}(?=/${next})`)] : [label, match[1], new RegExp(`^${match[2]}$`)];\n } else {\n patternCache[cacheKey] = [label, match[1], true];\n }\n }\n return patternCache[cacheKey];\n }\n return null;\n};\nvar tryDecode = (str, decoder) => {\n try {\n return decoder(str);\n } catch {\n return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {\n try {\n return decoder(match);\n } catch {\n return match;\n }\n });\n }\n};\nvar tryDecodeURI = (str) => tryDecode(str, decodeURI);\nvar getPath = (request) => {\n const url = request.url;\n const start = url.indexOf(\"/\", url.indexOf(\":\") + 4);\n let i = start;\n for (; i < url.length; i++) {\n const charCode = url.charCodeAt(i);\n if (charCode === 37) {\n const queryIndex = url.indexOf(\"?\", i);\n const hashIndex = url.indexOf(\"#\", i);\n const end = queryIndex === -1 ? hashIndex === -1 ? void 0 : hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);\n const path = url.slice(start, end);\n return tryDecodeURI(path.includes(\"%25\") ? path.replace(/%25/g, \"%2525\") : path);\n } else if (charCode === 63 || charCode === 35) {\n break;\n }\n }\n return url.slice(start, i);\n};\nvar getQueryStrings = (url) => {\n const queryIndex = url.indexOf(\"?\", 8);\n return queryIndex === -1 ? \"\" : \"?\" + url.slice(queryIndex + 1);\n};\nvar getPathNoStrict = (request) => {\n const result = getPath(request);\n return result.length > 1 && result.at(-1) === \"/\" ? result.slice(0, -1) : result;\n};\nvar mergePath = (base, sub, ...rest) => {\n if (rest.length) {\n sub = mergePath(sub, ...rest);\n }\n return `${base?.[0] === \"/\" ? \"\" : \"/\"}${base}${sub === \"/\" ? \"\" : `${base?.at(-1) === \"/\" ? \"\" : \"/\"}${sub?.[0] === \"/\" ? sub.slice(1) : sub}`}`;\n};\nvar checkOptionalParameter = (path) => {\n if (path.charCodeAt(path.length - 1) !== 63 || !path.includes(\":\")) {\n return null;\n }\n const segments = path.split(\"/\");\n const results = [];\n let basePath = \"\";\n segments.forEach((segment) => {\n if (segment !== \"\" && !/\\:/.test(segment)) {\n basePath += \"/\" + segment;\n } else if (/\\:/.test(segment)) {\n if (/\\?/.test(segment)) {\n if (results.length === 0 && basePath === \"\") {\n results.push(\"/\");\n } else {\n results.push(basePath);\n }\n const optionalSegment = segment.replace(\"?\", \"\");\n basePath += \"/\" + optionalSegment;\n results.push(basePath);\n } else {\n basePath += \"/\" + segment;\n }\n }\n });\n return results.filter((v, i, a) => a.indexOf(v) === i);\n};\nvar _decodeURI = (value) => {\n if (!/[%+]/.test(value)) {\n return value;\n }\n if (value.indexOf(\"+\") !== -1) {\n value = value.replace(/\\+/g, \" \");\n }\n return value.indexOf(\"%\") !== -1 ? tryDecode(value, decodeURIComponent_) : value;\n};\nvar _getQueryParam = (url, key, multiple) => {\n let encoded;\n if (!multiple && key && !/[%+]/.test(key)) {\n let keyIndex2 = url.indexOf(\"?\", 8);\n if (keyIndex2 === -1) {\n return void 0;\n }\n if (!url.startsWith(key, keyIndex2 + 1)) {\n keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);\n }\n while (keyIndex2 !== -1) {\n const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);\n if (trailingKeyCode === 61) {\n const valueIndex = keyIndex2 + key.length + 2;\n const endIndex = url.indexOf(\"&\", valueIndex);\n return _decodeURI(url.slice(valueIndex, endIndex === -1 ? void 0 : endIndex));\n } else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) {\n return \"\";\n }\n keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);\n }\n encoded = /[%+]/.test(url);\n if (!encoded) {\n return void 0;\n }\n }\n const results = /* @__PURE__ */ Object.create(null);\n encoded ??= /[%+]/.test(url);\n let keyIndex = url.indexOf(\"?\", 8);\n while (keyIndex !== -1) {\n const nextKeyIndex = url.indexOf(\"&\", keyIndex + 1);\n let valueIndex = url.indexOf(\"=\", keyIndex);\n if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) {\n valueIndex = -1;\n }\n let name = url.slice(\n keyIndex + 1,\n valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex\n );\n if (encoded) {\n name = _decodeURI(name);\n }\n keyIndex = nextKeyIndex;\n if (name === \"\") {\n continue;\n }\n let value;\n if (valueIndex === -1) {\n value = \"\";\n } else {\n value = url.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex);\n if (encoded) {\n value = _decodeURI(value);\n }\n }\n if (multiple) {\n if (!(results[name] && Array.isArray(results[name]))) {\n results[name] = [];\n }\n ;\n results[name].push(value);\n } else {\n results[name] ??= value;\n }\n }\n return key ? results[key] : results;\n};\nvar getQueryParam = _getQueryParam;\nvar getQueryParams = (url, key) => {\n return _getQueryParam(url, key, true);\n};\nvar decodeURIComponent_ = decodeURIComponent;\nexport {\n checkOptionalParameter,\n decodeURIComponent_,\n getPath,\n getPathNoStrict,\n getPattern,\n getQueryParam,\n getQueryParams,\n getQueryStrings,\n mergePath,\n splitPath,\n splitRoutingPath,\n tryDecode,\n tryDecodeURI\n};\n", "// src/request.ts\nimport { HTTPException } from \"./http-exception.js\";\nimport { GET_MATCH_RESULT } from \"./request/constants.js\";\nimport { parseBody } from \"./utils/body.js\";\nimport { decodeURIComponent_, getQueryParam, getQueryParams, tryDecode } from \"./utils/url.js\";\nvar tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);\nvar HonoRequest = class {\n /**\n * `.raw` can get the raw Request object.\n *\n * @see {@link https://hono.dev/docs/api/request#raw}\n *\n * @example\n * ```ts\n * // For Cloudflare Workers\n * app.post('/', async (c) => {\n * const metadata = c.req.raw.cf?.hostMetadata?\n * ...\n * })\n * ```\n */\n raw;\n #validatedData;\n // Short name of validatedData\n #matchResult;\n routeIndex = 0;\n /**\n * `.path` can get the pathname of the request.\n *\n * @see {@link https://hono.dev/docs/api/request#path}\n *\n * @example\n * ```ts\n * app.get('/about/me', (c) => {\n * const pathname = c.req.path // `/about/me`\n * })\n * ```\n */\n path;\n bodyCache = {};\n constructor(request, path = \"/\", matchResult = [[]]) {\n this.raw = request;\n this.path = path;\n this.#matchResult = matchResult;\n this.#validatedData = {};\n }\n param(key) {\n return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();\n }\n #getDecodedParam(key) {\n const paramKey = this.#matchResult[0][this.routeIndex][1][key];\n const param = this.#getParamValue(paramKey);\n return param && /\\%/.test(param) ? tryDecodeURIComponent(param) : param;\n }\n #getAllDecodedParams() {\n const decoded = {};\n const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);\n for (const key of keys) {\n const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);\n if (value !== void 0) {\n decoded[key] = /\\%/.test(value) ? tryDecodeURIComponent(value) : value;\n }\n }\n return decoded;\n }\n #getParamValue(paramKey) {\n return this.#matchResult[1] ? this.#matchResult[1][paramKey] : paramKey;\n }\n query(key) {\n return getQueryParam(this.url, key);\n }\n queries(key) {\n return getQueryParams(this.url, key);\n }\n header(name) {\n if (name) {\n return this.raw.headers.get(name) ?? void 0;\n }\n const headerData = /* @__PURE__ */ Object.create(null);\n this.raw.headers.forEach((value, key) => {\n headerData[key] = value;\n });\n return headerData;\n }\n async parseBody(options) {\n return parseBody(this, options);\n }\n #cachedBody = (key) => {\n const { bodyCache, raw } = this;\n const cachedBody = bodyCache[key];\n if (cachedBody) {\n return cachedBody;\n }\n const anyCachedKey = Object.keys(bodyCache)[0];\n if (anyCachedKey) {\n return bodyCache[anyCachedKey].then((body) => {\n if (anyCachedKey === \"json\") {\n body = JSON.stringify(body);\n }\n return new Response(body)[key]();\n });\n }\n return bodyCache[key] = raw[key]();\n };\n /**\n * `.json()` can parse Request body of type `application/json`\n *\n * @see {@link https://hono.dev/docs/api/request#json}\n *\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.json()\n * })\n * ```\n */\n json() {\n return this.#cachedBody(\"text\").then((text) => JSON.parse(text));\n }\n /**\n * `.text()` can parse Request body of type `text/plain`\n *\n * @see {@link https://hono.dev/docs/api/request#text}\n *\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.text()\n * })\n * ```\n */\n text() {\n return this.#cachedBody(\"text\");\n }\n /**\n * `.arrayBuffer()` parse Request body as an `ArrayBuffer`\n *\n * @see {@link https://hono.dev/docs/api/request#arraybuffer}\n *\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.arrayBuffer()\n * })\n * ```\n */\n arrayBuffer() {\n return this.#cachedBody(\"arrayBuffer\");\n }\n /**\n * `.bytes()` parses the request body as a `Uint8Array`.\n *\n * @see {@link https://hono.dev/docs/api/request#bytes}\n *\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.bytes()\n * })\n * ```\n */\n bytes() {\n return this.#cachedBody(\"arrayBuffer\").then((buffer) => new Uint8Array(buffer));\n }\n /**\n * Parses the request body as a `Blob`.\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.blob();\n * });\n * ```\n * @see https://hono.dev/docs/api/request#blob\n */\n blob() {\n return this.#cachedBody(\"blob\");\n }\n /**\n * Parses the request body as `FormData`.\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.formData();\n * });\n * ```\n * @see https://hono.dev/docs/api/request#formdata\n */\n formData() {\n return this.#cachedBody(\"formData\");\n }\n /**\n * Adds validated data to the request.\n *\n * @param target - The target of the validation.\n * @param data - The validated data to add.\n */\n addValidatedData(target, data) {\n this.#validatedData[target] = data;\n }\n valid(target) {\n return this.#validatedData[target];\n }\n /**\n * `.url()` can get the request url strings.\n *\n * @see {@link https://hono.dev/docs/api/request#url}\n *\n * @example\n * ```ts\n * app.get('/about/me', (c) => {\n * const url = c.req.url // `http://localhost:8787/about/me`\n * ...\n * })\n * ```\n */\n get url() {\n return this.raw.url;\n }\n /**\n * `.method()` can get the method name of the request.\n *\n * @see {@link https://hono.dev/docs/api/request#method}\n *\n * @example\n * ```ts\n * app.get('/about/me', (c) => {\n * const method = c.req.method // `GET`\n * })\n * ```\n */\n get method() {\n return this.raw.method;\n }\n get [GET_MATCH_RESULT]() {\n return this.#matchResult;\n }\n /**\n * `.matchedRoutes()` can return a matched route in the handler\n *\n * @deprecated\n *\n * Use matchedRoutes helper defined in \"hono/route\" instead.\n *\n * @see {@link https://hono.dev/docs/api/request#matchedroutes}\n *\n * @example\n * ```ts\n * app.use('*', async function logger(c, next) {\n * await next()\n * c.req.matchedRoutes.forEach(({ handler, method, path }, i) => {\n * const name = handler.name || (handler.length < 2 ? '[handler]' : '[middleware]')\n * console.log(\n * method,\n * ' ',\n * path,\n * ' '.repeat(Math.max(10 - path.length, 0)),\n * name,\n * i === c.req.routeIndex ? '<- respond from here' : ''\n * )\n * })\n * })\n * ```\n */\n get matchedRoutes() {\n return this.#matchResult[0].map(([[, route]]) => route);\n }\n /**\n * `routePath()` can retrieve the path registered within the handler\n *\n * @deprecated\n *\n * Use routePath helper defined in \"hono/route\" instead.\n *\n * @see {@link https://hono.dev/docs/api/request#routepath}\n *\n * @example\n * ```ts\n * app.get('/posts/:id', (c) => {\n * return c.json({ path: c.req.routePath })\n * })\n * ```\n */\n get routePath() {\n return this.#matchResult[0].map(([[, route]]) => route)[this.routeIndex].path;\n }\n};\nvar cloneRawRequest = async (req) => {\n if (!req.raw.bodyUsed) {\n return req.raw.clone();\n }\n const cacheKey = Object.keys(req.bodyCache)[0];\n if (!cacheKey) {\n throw new HTTPException(500, {\n message: \"Cannot clone request: body was already consumed and not cached. Please use HonoRequest methods (e.g., req.json(), req.text()) instead of consuming req.raw directly.\"\n });\n }\n const body = await req[cacheKey]();\n const headers = req.header();\n if (body instanceof FormData) {\n delete headers[\"content-type\"];\n }\n const requestInit = {\n body,\n cache: req.raw.cache,\n credentials: req.raw.credentials,\n headers,\n integrity: req.raw.integrity,\n keepalive: req.raw.keepalive,\n method: req.method,\n mode: req.raw.mode,\n redirect: req.raw.redirect,\n referrer: req.raw.referrer,\n referrerPolicy: req.raw.referrerPolicy,\n signal: req.raw.signal\n };\n return new Request(req.url, requestInit);\n};\nexport {\n HonoRequest,\n cloneRawRequest\n};\n", "// src/utils/html.ts\nvar HtmlEscapedCallbackPhase = {\n Stringify: 1,\n BeforeStream: 2,\n Stream: 3\n};\nvar raw = (value, callbacks) => {\n const escapedString = new String(value);\n escapedString.isEscaped = true;\n escapedString.callbacks = callbacks;\n return escapedString;\n};\nvar escapeRe = /[&<>'\"]/;\nvar stringBufferToString = async (buffer, callbacks) => {\n let str = \"\";\n callbacks ||= [];\n const resolvedBuffer = await Promise.all(buffer);\n for (let i = resolvedBuffer.length - 1; ; i--) {\n str += resolvedBuffer[i];\n i--;\n if (i < 0) {\n break;\n }\n let r = resolvedBuffer[i];\n if (typeof r === \"object\") {\n callbacks.push(...r.callbacks || []);\n }\n const isEscaped = r.isEscaped;\n r = await (typeof r === \"object\" ? r.toString() : r);\n if (typeof r === \"object\") {\n callbacks.push(...r.callbacks || []);\n }\n if (r.isEscaped ?? isEscaped) {\n str += r;\n } else {\n const buf = [str];\n escapeToBuffer(r, buf);\n str = buf[0];\n }\n }\n return raw(str, callbacks);\n};\nvar escapeToBuffer = (str, buffer) => {\n const match = str.search(escapeRe);\n if (match === -1) {\n buffer[0] += str;\n return;\n }\n let escape;\n let index;\n let lastIndex = 0;\n for (index = match; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34:\n escape = \"&quot;\";\n break;\n case 39:\n escape = \"&#39;\";\n break;\n case 38:\n escape = \"&amp;\";\n break;\n case 60:\n escape = \"&lt;\";\n break;\n case 62:\n escape = \"&gt;\";\n break;\n default:\n continue;\n }\n buffer[0] += str.substring(lastIndex, index) + escape;\n lastIndex = index + 1;\n }\n buffer[0] += str.substring(lastIndex, index);\n};\nvar resolveCallbackSync = (str) => {\n const callbacks = str.callbacks;\n if (!callbacks?.length) {\n return str;\n }\n const buffer = [str];\n const context = {};\n callbacks.forEach((c) => c({ phase: HtmlEscapedCallbackPhase.Stringify, buffer, context }));\n return buffer[0];\n};\nvar resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {\n if (typeof str === \"object\" && !(str instanceof String)) {\n if (!(str instanceof Promise)) {\n str = str.toString();\n }\n if (str instanceof Promise) {\n str = await str;\n }\n }\n const callbacks = str.callbacks;\n if (!callbacks?.length) {\n return Promise.resolve(str);\n }\n if (buffer) {\n buffer[0] += str;\n } else {\n buffer = [str];\n }\n const resStr = Promise.all(callbacks.map((c) => c({ phase, buffer, context }))).then(\n (res) => Promise.all(\n res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context, buffer))\n ).then(() => buffer[0])\n );\n if (preserveCallbacks) {\n return raw(await resStr, callbacks);\n } else {\n return resStr;\n }\n};\nexport {\n HtmlEscapedCallbackPhase,\n escapeToBuffer,\n raw,\n resolveCallback,\n resolveCallbackSync,\n stringBufferToString\n};\n", "// src/context.ts\nimport { HonoRequest } from \"./request.js\";\nimport { HtmlEscapedCallbackPhase, resolveCallback } from \"./utils/html.js\";\nvar TEXT_PLAIN = \"text/plain; charset=UTF-8\";\nvar setDefaultContentType = (contentType, headers) => {\n return {\n \"Content-Type\": contentType,\n ...headers\n };\n};\nvar createResponseInstance = (body, init) => new Response(body, init);\nvar Context = class {\n #rawRequest;\n #req;\n /**\n * `.env` can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.\n *\n * @see {@link https://hono.dev/docs/api/context#env}\n *\n * @example\n * ```ts\n * // Environment object for Cloudflare Workers\n * app.get('*', async c => {\n * const counter = c.env.COUNTER\n * })\n * ```\n */\n env = {};\n #var;\n finalized = false;\n /**\n * `.error` can get the error object from the middleware if the Handler throws an error.\n *\n * @see {@link https://hono.dev/docs/api/context#error}\n *\n * @example\n * ```ts\n * app.use('*', async (c, next) => {\n * await next()\n * if (c.error) {\n * // do something...\n * }\n * })\n * ```\n */\n error;\n #status;\n #executionCtx;\n #res;\n #layout;\n #renderer;\n #notFoundHandler;\n #preparedHeaders;\n #matchResult;\n #path;\n /**\n * Creates an instance of the Context class.\n *\n * @param req - The Request object.\n * @param options - Optional configuration options for the context.\n */\n constructor(req, options) {\n this.#rawRequest = req;\n if (options) {\n this.#executionCtx = options.executionCtx;\n this.env = options.env;\n this.#notFoundHandler = options.notFoundHandler;\n this.#path = options.path;\n this.#matchResult = options.matchResult;\n }\n }\n /**\n * `.req` is the instance of {@link HonoRequest}.\n */\n get req() {\n this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult);\n return this.#req;\n }\n /**\n * @see {@link https://hono.dev/docs/api/context#event}\n * The FetchEvent associated with the current request.\n *\n * @throws Will throw an error if the context does not have a FetchEvent.\n */\n get event() {\n if (this.#executionCtx && \"respondWith\" in this.#executionCtx) {\n return this.#executionCtx;\n } else {\n throw Error(\"This context has no FetchEvent\");\n }\n }\n /**\n * @see {@link https://hono.dev/docs/api/context#executionctx}\n * The ExecutionContext associated with the current request.\n *\n * @throws Will throw an error if the context does not have an ExecutionContext.\n */\n get executionCtx() {\n if (this.#executionCtx) {\n return this.#executionCtx;\n } else {\n throw Error(\"This context has no ExecutionContext\");\n }\n }\n /**\n * @see {@link https://hono.dev/docs/api/context#res}\n * The Response object for the current request.\n */\n get res() {\n return this.#res ||= createResponseInstance(null, {\n headers: this.#preparedHeaders ??= new Headers()\n });\n }\n /**\n * Sets the Response object for the current request.\n *\n * @param _res - The Response object to set.\n */\n set res(_res) {\n if (this.#res && _res) {\n _res = createResponseInstance(_res.body, _res);\n for (const [k, v] of this.#res.headers.entries()) {\n if (k === \"content-type\") {\n continue;\n }\n if (k === \"set-cookie\") {\n const cookies = this.#res.headers.getSetCookie();\n _res.headers.delete(\"set-cookie\");\n for (const cookie of cookies) {\n _res.headers.append(\"set-cookie\", cookie);\n }\n } else {\n _res.headers.set(k, v);\n }\n }\n }\n this.#res = _res;\n this.finalized = true;\n }\n /**\n * `.render()` can create a response within a layout.\n *\n * @see {@link https://hono.dev/docs/api/context#render-setrenderer}\n *\n * @example\n * ```ts\n * app.get('/', (c) => {\n * return c.render('Hello!')\n * })\n * ```\n */\n render = (...args) => {\n this.#renderer ??= (content) => this.html(content);\n return this.#renderer(...args);\n };\n /**\n * Sets the layout for the response.\n *\n * @param layout - The layout to set.\n * @returns The layout function.\n */\n setLayout = (layout) => this.#layout = layout;\n /**\n * Gets the current layout for the response.\n *\n * @returns The current layout function.\n */\n getLayout = () => this.#layout;\n /**\n * `.setRenderer()` can set the layout in the custom middleware.\n *\n * @see {@link https://hono.dev/docs/api/context#render-setrenderer}\n *\n * @example\n * ```tsx\n * app.use('*', async (c, next) => {\n * c.setRenderer((content) => {\n * return c.html(\n * <html>\n * <body>\n * <p>{content}</p>\n * </body>\n * </html>\n * )\n * })\n * await next()\n * })\n * ```\n */\n setRenderer = (renderer) => {\n this.#renderer = renderer;\n };\n /**\n * `.header()` can set headers.\n *\n * @see {@link https://hono.dev/docs/api/context#header}\n *\n * @example\n * ```ts\n * app.get('/welcome', (c) => {\n * // Set headers\n * c.header('X-Message', 'Hello!')\n * c.header('Content-Type', 'text/plain')\n *\n * return c.body('Thank you for coming')\n * })\n * ```\n */\n header = (name, value, options) => {\n if (this.finalized) {\n this.#res = createResponseInstance(this.#res.body, this.#res);\n }\n const headers = this.#res ? this.#res.headers : this.#preparedHeaders ??= new Headers();\n if (value === void 0) {\n headers.delete(name);\n } else if (options?.append) {\n headers.append(name, value);\n } else {\n headers.set(name, value);\n }\n };\n status = (status) => {\n this.#status = status;\n };\n /**\n * `.set()` can set the value specified by the key.\n *\n * @see {@link https://hono.dev/docs/api/context#set-get}\n *\n * @example\n * ```ts\n * app.use('*', async (c, next) => {\n * c.set('message', 'Hono is hot!!')\n * await next()\n * })\n * ```\n */\n set = (key, value) => {\n this.#var ??= /* @__PURE__ */ new Map();\n this.#var.set(key, value);\n };\n /**\n * `.get()` can use the value specified by the key.\n *\n * @see {@link https://hono.dev/docs/api/context#set-get}\n *\n * @example\n * ```ts\n * app.get('/', (c) => {\n * const message = c.get('message')\n * return c.text(`The message is \"${message}\"`)\n * })\n * ```\n */\n get = (key) => {\n return this.#var ? this.#var.get(key) : void 0;\n };\n /**\n * `.var` can access the value of a variable.\n *\n * @see {@link https://hono.dev/docs/api/context#var}\n *\n * @example\n * ```ts\n * const result = c.var.client.oneMethod()\n * ```\n */\n // c.var.propName is a read-only\n get var() {\n if (!this.#var) {\n return {};\n }\n return Object.fromEntries(this.#var);\n }\n #newResponse(data, arg, headers) {\n const responseHeaders = this.#res ? new Headers(this.#res.headers) : this.#preparedHeaders ?? new Headers();\n if (typeof arg === \"object\" && \"headers\" in arg) {\n const argHeaders = arg.headers instanceof Headers ? arg.headers : new Headers(arg.headers);\n for (const [key, value] of argHeaders) {\n if (key.toLowerCase() === \"set-cookie\") {\n responseHeaders.append(key, value);\n } else {\n responseHeaders.set(key, value);\n }\n }\n }\n if (headers) {\n for (const [k, v] of Object.entries(headers)) {\n if (typeof v === \"string\") {\n responseHeaders.set(k, v);\n } else {\n responseHeaders.delete(k);\n for (const v2 of v) {\n responseHeaders.append(k, v2);\n }\n }\n }\n }\n const status = typeof arg === \"number\" ? arg : arg?.status ?? this.#status;\n return createResponseInstance(data, { status, headers: responseHeaders });\n }\n newResponse = (...args) => this.#newResponse(...args);\n /**\n * `.body()` can return the HTTP response.\n * You can set headers with `.header()` and set HTTP status code with `.status`.\n * This can also be set in `.text()`, `.json()` and so on.\n *\n * @see {@link https://hono.dev/docs/api/context#body}\n *\n * @example\n * ```ts\n * app.get('/welcome', (c) => {\n * // Set headers\n * c.header('X-Message', 'Hello!')\n * c.header('Content-Type', 'text/plain')\n * // Set HTTP status code\n * c.status(201)\n *\n * // Return the response body\n * return c.body('Thank you for coming')\n * })\n * ```\n */\n body = (data, arg, headers) => this.#newResponse(data, arg, headers);\n /**\n * `.text()` can render text as `Content-Type:text/plain`.\n *\n * @see {@link https://hono.dev/docs/api/context#text}\n *\n * @example\n * ```ts\n * app.get('/say', (c) => {\n * return c.text('Hello!')\n * })\n * ```\n */\n text = (text, arg, headers) => {\n return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized ? new Response(text) : this.#newResponse(\n text,\n arg,\n setDefaultContentType(TEXT_PLAIN, headers)\n );\n };\n /**\n * `.json()` can render JSON as `Content-Type:application/json`.\n *\n * @see {@link https://hono.dev/docs/api/context#json}\n *\n * @example\n * ```ts\n * app.get('/api', (c) => {\n * return c.json({ message: 'Hello!' })\n * })\n * ```\n */\n json = (object, arg, headers) => {\n return this.#newResponse(\n JSON.stringify(object),\n arg,\n setDefaultContentType(\"application/json\", headers)\n );\n };\n html = (html, arg, headers) => {\n const res = (html2) => this.#newResponse(html2, arg, setDefaultContentType(\"text/html; charset=UTF-8\", headers));\n return typeof html === \"object\" ? resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html);\n };\n /**\n * `.redirect()` can Redirect, default status code is 302.\n *\n * @see {@link https://hono.dev/docs/api/context#redirect}\n *\n * @example\n * ```ts\n * app.get('/redirect', (c) => {\n * return c.redirect('/')\n * })\n * app.get('/redirect-permanently', (c) => {\n * return c.redirect('/', 301)\n * })\n * ```\n */\n redirect = (location, status) => {\n const locationString = String(location);\n this.header(\n \"Location\",\n // Multibyes should be encoded\n // eslint-disable-next-line no-control-regex\n !/[^\\x00-\\xFF]/.test(locationString) ? locationString : encodeURI(locationString)\n );\n return this.newResponse(null, status ?? 302);\n };\n /**\n * `.notFound()` can return the Not Found Response.\n *\n * @see {@link https://hono.dev/docs/api/context#notfound}\n *\n * @example\n * ```ts\n * app.get('/notfound', (c) => {\n * return c.notFound()\n * })\n * ```\n */\n notFound = () => {\n this.#notFoundHandler ??= () => createResponseInstance();\n return this.#notFoundHandler(this);\n };\n};\nexport {\n Context,\n TEXT_PLAIN\n};\n", "// src/router.ts\nvar METHOD_NAME_ALL = \"ALL\";\nvar METHOD_NAME_ALL_LOWERCASE = \"all\";\nvar METHODS = [\"get\", \"post\", \"put\", \"delete\", \"options\", \"patch\"];\nvar MESSAGE_MATCHER_IS_ALREADY_BUILT = \"Can not add a route since the matcher is already built.\";\nvar UnsupportedPathError = class extends Error {\n};\nexport {\n MESSAGE_MATCHER_IS_ALREADY_BUILT,\n METHODS,\n METHOD_NAME_ALL,\n METHOD_NAME_ALL_LOWERCASE,\n UnsupportedPathError\n};\n", "// src/utils/constants.ts\nvar COMPOSED_HANDLER = \"__COMPOSED_HANDLER\";\nexport {\n COMPOSED_HANDLER\n};\n", "// src/hono-base.ts\nimport { compose } from \"./compose.js\";\nimport { Context } from \"./context.js\";\nimport { METHODS, METHOD_NAME_ALL, METHOD_NAME_ALL_LOWERCASE } from \"./router.js\";\nimport { COMPOSED_HANDLER } from \"./utils/constants.js\";\nimport { getPath, getPathNoStrict, mergePath } from \"./utils/url.js\";\nvar notFoundHandler = (c) => {\n return c.text(\"404 Not Found\", 404);\n};\nvar errorHandler = (err, c) => {\n if (\"getResponse\" in err) {\n const res = err.getResponse();\n return c.newResponse(res.body, res);\n }\n console.error(err);\n return c.text(\"Internal Server Error\", 500);\n};\nvar Hono = class _Hono {\n get;\n post;\n put;\n delete;\n options;\n patch;\n all;\n on;\n use;\n /*\n This class is like an abstract class and does not have a router.\n To use it, inherit the class and implement router in the constructor.\n */\n router;\n getPath;\n // Cannot use `#` because it requires visibility at JavaScript runtime.\n _basePath = \"/\";\n #path = \"/\";\n routes = [];\n constructor(options = {}) {\n const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];\n allMethods.forEach((method) => {\n this[method] = (args1, ...args) => {\n if (typeof args1 === \"string\") {\n this.#path = args1;\n } else {\n this.#addRoute(method, this.#path, args1);\n }\n args.forEach((handler) => {\n this.#addRoute(method, this.#path, handler);\n });\n return this;\n };\n });\n this.on = (method, path, ...handlers) => {\n for (const p of [path].flat()) {\n this.#path = p;\n for (const m of [method].flat()) {\n handlers.map((handler) => {\n this.#addRoute(m.toUpperCase(), this.#path, handler);\n });\n }\n }\n return this;\n };\n this.use = (arg1, ...handlers) => {\n if (typeof arg1 === \"string\") {\n this.#path = arg1;\n } else {\n this.#path = \"*\";\n handlers.unshift(arg1);\n }\n handlers.forEach((handler) => {\n this.#addRoute(METHOD_NAME_ALL, this.#path, handler);\n });\n return this;\n };\n const { strict, ...optionsWithoutStrict } = options;\n Object.assign(this, optionsWithoutStrict);\n this.getPath = strict ?? true ? options.getPath ?? getPath : getPathNoStrict;\n }\n #clone() {\n const clone = new _Hono({\n router: this.router,\n getPath: this.getPath\n });\n clone.errorHandler = this.errorHandler;\n clone.#notFoundHandler = this.#notFoundHandler;\n clone.routes = this.routes;\n return clone;\n }\n #notFoundHandler = notFoundHandler;\n // Cannot use `#` because it requires visibility at JavaScript runtime.\n errorHandler = errorHandler;\n /**\n * `.route()` allows grouping other Hono instance in routes.\n *\n * @see {@link https://hono.dev/docs/api/routing#grouping}\n *\n * @param {string} path - base Path\n * @param {Hono} app - other Hono instance\n * @returns {Hono} routed Hono instance\n *\n * @example\n * ```ts\n * const app = new Hono()\n * const app2 = new Hono()\n *\n * app2.get(\"/user\", (c) => c.text(\"user\"))\n * app.route(\"/api\", app2) // GET /api/user\n * ```\n */\n route(path, app) {\n const subApp = this.basePath(path);\n app.routes.map((r) => {\n let handler;\n if (app.errorHandler === errorHandler) {\n handler = r.handler;\n } else {\n handler = async (c, next) => (await compose([], app.errorHandler)(c, () => r.handler(c, next))).res;\n handler[COMPOSED_HANDLER] = r.handler;\n }\n subApp.#addRoute(r.method, r.path, handler, r.basePath);\n });\n return this;\n }\n /**\n * `.basePath()` allows base paths to be specified.\n *\n * @see {@link https://hono.dev/docs/api/routing#base-path}\n *\n * @param {string} path - base Path\n * @returns {Hono} changed Hono instance\n *\n * @example\n * ```ts\n * const api = new Hono().basePath('/api')\n * ```\n */\n basePath(path) {\n const subApp = this.#clone();\n subApp._basePath = mergePath(this._basePath, path);\n return subApp;\n }\n /**\n * `.onError()` handles an error and returns a customized Response.\n *\n * @see {@link https://hono.dev/docs/api/hono#error-handling}\n *\n * @param {ErrorHandler} handler - request Handler for error\n * @returns {Hono} changed Hono instance\n *\n * @example\n * ```ts\n * app.onError((err, c) => {\n * console.error(`${err}`)\n * return c.text('Custom Error Message', 500)\n * })\n * ```\n */\n onError = (handler) => {\n this.errorHandler = handler;\n return this;\n };\n /**\n * `.notFound()` allows you to customize a Not Found Response.\n *\n * @see {@link https://hono.dev/docs/api/hono#not-found}\n *\n * @param {NotFoundHandler} handler - request handler for not-found\n * @returns {Hono} changed Hono instance\n *\n * @example\n * ```ts\n * app.notFound((c) => {\n * return c.text('Custom 404 Message', 404)\n * })\n * ```\n */\n notFound = (handler) => {\n this.#notFoundHandler = handler;\n return this;\n };\n /**\n * `.mount()` allows you to mount applications built with other frameworks into your Hono application.\n *\n * @see {@link https://hono.dev/docs/api/hono#mount}\n *\n * @param {string} path - base Path\n * @param {Function} applicationHandler - other Request Handler\n * @param {MountOptions} [options] - options of `.mount()`\n * @returns {Hono} mounted Hono instance\n *\n * @example\n * ```ts\n * import { Router as IttyRouter } from 'itty-router'\n * import { Hono } from 'hono'\n * // Create itty-router application\n * const ittyRouter = IttyRouter()\n * // GET /itty-router/hello\n * ittyRouter.get('/hello', () => new Response('Hello from itty-router'))\n *\n * const app = new Hono()\n * app.mount('/itty-router', ittyRouter.handle)\n * ```\n *\n * @example\n * ```ts\n * const app = new Hono()\n * // Send the request to another application without modification.\n * app.mount('/app', anotherApp, {\n * replaceRequest: (req) => req,\n * })\n * ```\n */\n mount(path, applicationHandler, options) {\n let replaceRequest;\n let optionHandler;\n if (options) {\n if (typeof options === \"function\") {\n optionHandler = options;\n } else {\n optionHandler = options.optionHandler;\n if (options.replaceRequest === false) {\n replaceRequest = (request) => request;\n } else {\n replaceRequest = options.replaceRequest;\n }\n }\n }\n const getOptions = optionHandler ? (c) => {\n const options2 = optionHandler(c);\n return Array.isArray(options2) ? options2 : [options2];\n } : (c) => {\n let executionContext = void 0;\n try {\n executionContext = c.executionCtx;\n } catch {\n }\n return [c.env, executionContext];\n };\n replaceRequest ||= (() => {\n const mergedPath = mergePath(this._basePath, path);\n const pathPrefixLength = mergedPath === \"/\" ? 0 : mergedPath.length;\n return (request) => {\n const url = new URL(request.url);\n url.pathname = this.getPath(request).slice(pathPrefixLength) || \"/\";\n return new Request(url, request);\n };\n })();\n const handler = async (c, next) => {\n const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c));\n if (res) {\n return res;\n }\n await next();\n };\n this.#addRoute(METHOD_NAME_ALL, mergePath(path, \"*\"), handler);\n return this;\n }\n #addRoute(method, path, handler, baseRoutePath) {\n method = method.toUpperCase();\n path = mergePath(this._basePath, path);\n const r = {\n basePath: baseRoutePath !== void 0 ? mergePath(this._basePath, baseRoutePath) : this._basePath,\n path,\n method,\n handler\n };\n this.router.add(method, path, [handler, r]);\n this.routes.push(r);\n }\n #handleError(err, c) {\n if (err instanceof Error) {\n return this.errorHandler(err, c);\n }\n throw err;\n }\n #dispatch(request, executionCtx, env, method) {\n if (method === \"HEAD\") {\n return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, \"GET\")))();\n }\n const path = this.getPath(request, { env });\n const matchResult = this.router.match(method, path);\n const c = new Context(request, {\n path,\n matchResult,\n env,\n executionCtx,\n notFoundHandler: this.#notFoundHandler\n });\n if (matchResult[0].length === 1) {\n let res;\n try {\n res = matchResult[0][0][0][0](c, async () => {\n c.res = await this.#notFoundHandler(c);\n });\n } catch (err) {\n return this.#handleError(err, c);\n }\n return res instanceof Promise ? res.then(\n (resolved) => resolved || (c.finalized ? c.res : this.#notFoundHandler(c))\n ).catch((err) => this.#handleError(err, c)) : res ?? this.#notFoundHandler(c);\n }\n const composed = compose(matchResult[0], this.errorHandler, this.#notFoundHandler);\n return (async () => {\n try {\n const context = await composed(c);\n if (!context.finalized) {\n throw new Error(\n \"Context is not finalized. Did you forget to return a Response object or `await next()`?\"\n );\n }\n return context.res;\n } catch (err) {\n return this.#handleError(err, c);\n }\n })();\n }\n /**\n * `.fetch()` will be entry point of your app.\n *\n * @see {@link https://hono.dev/docs/api/hono#fetch}\n *\n * @param {Request} request - request Object of request\n * @param {Env} Env - env Object\n * @param {ExecutionContext} - context of execution\n * @returns {Response | Promise<Response>} response of request\n *\n */\n fetch = (request, ...rest) => {\n return this.#dispatch(request, rest[1], rest[0], request.method);\n };\n /**\n * `.request()` is a useful method for testing.\n * You can pass a URL or pathname to send a GET request.\n * app will return a Response object.\n * ```ts\n * test('GET /hello is ok', async () => {\n * const res = await app.request('/hello')\n * expect(res.status).toBe(200)\n * })\n * ```\n * @see https://hono.dev/docs/api/hono#request\n */\n request = (input, requestInit, Env, executionCtx) => {\n if (input instanceof Request) {\n return this.fetch(requestInit ? new Request(input, requestInit) : input, Env, executionCtx);\n }\n input = input.toString();\n return this.fetch(\n new Request(\n /^https?:\\/\\//.test(input) ? input : `http://localhost${mergePath(\"/\", input)}`,\n requestInit\n ),\n Env,\n executionCtx\n );\n };\n /**\n * `.fire()` automatically adds a global fetch event listener.\n * This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers.\n * @deprecated\n * Use `fire` from `hono/service-worker` instead.\n * ```ts\n * import { Hono } from 'hono'\n * import { fire } from 'hono/service-worker'\n *\n * const app = new Hono()\n * // ...\n * fire(app)\n * ```\n * @see https://hono.dev/docs/api/hono#fire\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\n * @see https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/\n */\n fire = () => {\n addEventListener(\"fetch\", (event) => {\n event.respondWith(this.#dispatch(event.request, event, void 0, event.request.method));\n });\n };\n};\nexport {\n Hono as HonoBase\n};\n", "// src/router/reg-exp-router/matcher.ts\nimport { METHOD_NAME_ALL } from \"../../router.js\";\nvar emptyParam = [];\nfunction match(method, path) {\n const matchers = this.buildAllMatchers();\n const match2 = ((method2, path2) => {\n const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];\n const staticMatch = matcher[2][path2];\n if (staticMatch) {\n return staticMatch;\n }\n const match3 = path2.match(matcher[0]);\n if (!match3) {\n return [[], emptyParam];\n }\n const index = match3.indexOf(\"\", 1);\n return [matcher[1][index], match3];\n });\n this.match = match2;\n return match2(method, path);\n}\nexport {\n emptyParam,\n match\n};\n", "// src/router/reg-exp-router/node.ts\nvar LABEL_REG_EXP_STR = \"[^/]+\";\nvar ONLY_WILDCARD_REG_EXP_STR = \".*\";\nvar TAIL_WILDCARD_REG_EXP_STR = \"(?:|/.*)\";\nvar PATH_ERROR = /* @__PURE__ */ Symbol();\nvar regExpMetaChars = new Set(\".\\\\+*[^]$()\");\nfunction compareKey(a, b) {\n if (a.length === 1) {\n return b.length === 1 ? a < b ? -1 : 1 : -1;\n }\n if (b.length === 1) {\n return 1;\n }\n if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) {\n return 1;\n } else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) {\n return -1;\n }\n if (a === LABEL_REG_EXP_STR) {\n return 1;\n } else if (b === LABEL_REG_EXP_STR) {\n return -1;\n }\n return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;\n}\nvar Node = class _Node {\n #index;\n #varIndex;\n #children = /* @__PURE__ */ Object.create(null);\n insert(tokens, index, paramMap, context, pathErrorCheckOnly) {\n if (tokens.length === 0) {\n if (this.#index !== void 0) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n this.#index = index;\n return;\n }\n const [token, ...restTokens] = tokens;\n const pattern = token === \"*\" ? restTokens.length === 0 ? [\"\", \"\", ONLY_WILDCARD_REG_EXP_STR] : [\"\", \"\", LABEL_REG_EXP_STR] : token === \"/*\" ? [\"\", \"\", TAIL_WILDCARD_REG_EXP_STR] : token.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);\n let node;\n if (pattern) {\n const name = pattern[1];\n let regexpStr = pattern[2] || LABEL_REG_EXP_STR;\n if (name && pattern[2]) {\n if (regexpStr === \".*\") {\n throw PATH_ERROR;\n }\n regexpStr = regexpStr.replace(/^\\((?!\\?:)(?=[^)]+\\)$)/, \"(?:\");\n if (/\\((?!\\?:)/.test(regexpStr)) {\n throw PATH_ERROR;\n }\n }\n node = this.#children[regexpStr];\n if (!node) {\n if (Object.keys(this.#children).some(\n (k) => k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR\n )) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n node = this.#children[regexpStr] = new _Node();\n if (name !== \"\") {\n node.#varIndex = context.varIndex++;\n }\n }\n if (!pathErrorCheckOnly && name !== \"\") {\n paramMap.push([name, node.#varIndex]);\n }\n } else {\n node = this.#children[token];\n if (!node) {\n if (Object.keys(this.#children).some(\n (k) => k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR\n )) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n node = this.#children[token] = new _Node();\n }\n }\n node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);\n }\n buildRegExpStr() {\n const childKeys = Object.keys(this.#children).sort(compareKey);\n const strList = childKeys.map((k) => {\n const c = this.#children[k];\n return (typeof c.#varIndex === \"number\" ? `(${k})@${c.#varIndex}` : regExpMetaChars.has(k) ? `\\\\${k}` : k) + c.buildRegExpStr();\n });\n if (typeof this.#index === \"number\") {\n strList.unshift(`#${this.#index}`);\n }\n if (strList.length === 0) {\n return \"\";\n }\n if (strList.length === 1) {\n return strList[0];\n }\n return \"(?:\" + strList.join(\"|\") + \")\";\n }\n};\nexport {\n Node,\n PATH_ERROR\n};\n", "// src/router/reg-exp-router/trie.ts\nimport { Node } from \"./node.js\";\nvar Trie = class {\n #context = { varIndex: 0 };\n #root = new Node();\n insert(path, index, pathErrorCheckOnly) {\n const paramAssoc = [];\n const groups = [];\n for (let i = 0; ; ) {\n let replaced = false;\n path = path.replace(/\\{[^}]+\\}/g, (m) => {\n const mark = `@\\\\${i}`;\n groups[i] = [mark, m];\n i++;\n replaced = true;\n return mark;\n });\n if (!replaced) {\n break;\n }\n }\n const tokens = path.match(/(?::[^\\/]+)|(?:\\/\\*$)|./g) || [];\n for (let i = groups.length - 1; i >= 0; i--) {\n const [mark] = groups[i];\n for (let j = tokens.length - 1; j >= 0; j--) {\n if (tokens[j].indexOf(mark) !== -1) {\n tokens[j] = tokens[j].replace(mark, groups[i][1]);\n break;\n }\n }\n }\n this.#root.insert(tokens, index, paramAssoc, this.#context, pathErrorCheckOnly);\n return paramAssoc;\n }\n buildRegExp() {\n let regexp = this.#root.buildRegExpStr();\n if (regexp === \"\") {\n return [/^$/, [], []];\n }\n let captureIndex = 0;\n const indexReplacementMap = [];\n const paramReplacementMap = [];\n regexp = regexp.replace(/#(\\d+)|@(\\d+)|\\.\\*\\$/g, (_, handlerIndex, paramIndex) => {\n if (handlerIndex !== void 0) {\n indexReplacementMap[++captureIndex] = Number(handlerIndex);\n return \"$()\";\n }\n if (paramIndex !== void 0) {\n paramReplacementMap[Number(paramIndex)] = ++captureIndex;\n return \"\";\n }\n return \"\";\n });\n return [new RegExp(`^${regexp}`), indexReplacementMap, paramReplacementMap];\n }\n};\nexport {\n Trie\n};\n", "// src/router/reg-exp-router/router.ts\nimport {\n MESSAGE_MATCHER_IS_ALREADY_BUILT,\n METHOD_NAME_ALL,\n UnsupportedPathError\n} from \"../../router.js\";\nimport { checkOptionalParameter } from \"../../utils/url.js\";\nimport { match, emptyParam } from \"./matcher.js\";\nimport { PATH_ERROR } from \"./node.js\";\nimport { Trie } from \"./trie.js\";\nvar nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];\nvar wildcardRegExpCache = /* @__PURE__ */ Object.create(null);\nfunction buildWildcardRegExp(path) {\n return wildcardRegExpCache[path] ??= new RegExp(\n path === \"*\" ? \"\" : `^${path.replace(\n /\\/\\*$|([.\\\\+*[^\\]$()])/g,\n (_, metaChar) => metaChar ? `\\\\${metaChar}` : \"(?:|/.*)\"\n )}$`\n );\n}\nfunction clearWildcardRegExpCache() {\n wildcardRegExpCache = /* @__PURE__ */ Object.create(null);\n}\nfunction buildMatcherFromPreprocessedRoutes(routes) {\n const trie = new Trie();\n const handlerData = [];\n if (routes.length === 0) {\n return nullMatcher;\n }\n const routesWithStaticPathFlag = routes.map(\n (route) => [!/\\*|\\/:/.test(route[0]), ...route]\n ).sort(\n ([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length\n );\n const staticMap = /* @__PURE__ */ Object.create(null);\n for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {\n const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];\n if (pathErrorCheckOnly) {\n staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];\n } else {\n j++;\n }\n let paramAssoc;\n try {\n paramAssoc = trie.insert(path, j, pathErrorCheckOnly);\n } catch (e) {\n throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;\n }\n if (pathErrorCheckOnly) {\n continue;\n }\n handlerData[j] = handlers.map(([h, paramCount]) => {\n const paramIndexMap = /* @__PURE__ */ Object.create(null);\n paramCount -= 1;\n for (; paramCount >= 0; paramCount--) {\n const [key, value] = paramAssoc[paramCount];\n paramIndexMap[key] = value;\n }\n return [h, paramIndexMap];\n });\n }\n const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();\n for (let i = 0, len = handlerData.length; i < len; i++) {\n for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {\n const map = handlerData[i][j]?.[1];\n if (!map) {\n continue;\n }\n const keys = Object.keys(map);\n for (let k = 0, len3 = keys.length; k < len3; k++) {\n map[keys[k]] = paramReplacementMap[map[keys[k]]];\n }\n }\n }\n const handlerMap = [];\n for (const i in indexReplacementMap) {\n handlerMap[i] = handlerData[indexReplacementMap[i]];\n }\n return [regexp, handlerMap, staticMap];\n}\nfunction findMiddleware(middleware, path) {\n if (!middleware) {\n return void 0;\n }\n for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {\n if (buildWildcardRegExp(k).test(path)) {\n return [...middleware[k]];\n }\n }\n return void 0;\n}\nvar RegExpRouter = class {\n name = \"RegExpRouter\";\n #middleware;\n #routes;\n constructor() {\n this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };\n this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };\n }\n add(method, path, handler) {\n const middleware = this.#middleware;\n const routes = this.#routes;\n if (!middleware || !routes) {\n throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);\n }\n if (!middleware[method]) {\n ;\n [middleware, routes].forEach((handlerMap) => {\n handlerMap[method] = /* @__PURE__ */ Object.create(null);\n Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => {\n handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];\n });\n });\n }\n if (path === \"/*\") {\n path = \"*\";\n }\n const paramCount = (path.match(/\\/:/g) || []).length;\n if (/\\*$/.test(path)) {\n const re = buildWildcardRegExp(path);\n if (method === METHOD_NAME_ALL) {\n Object.keys(middleware).forEach((m) => {\n middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];\n });\n } else {\n middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];\n }\n Object.keys(middleware).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n Object.keys(middleware[m]).forEach((p) => {\n re.test(p) && middleware[m][p].push([handler, paramCount]);\n });\n }\n });\n Object.keys(routes).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n Object.keys(routes[m]).forEach(\n (p) => re.test(p) && routes[m][p].push([handler, paramCount])\n );\n }\n });\n return;\n }\n const paths = checkOptionalParameter(path) || [path];\n for (let i = 0, len = paths.length; i < len; i++) {\n const path2 = paths[i];\n Object.keys(routes).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n routes[m][path2] ||= [\n ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []\n ];\n routes[m][path2].push([handler, paramCount - len + i + 1]);\n }\n });\n }\n }\n match = match;\n buildAllMatchers() {\n const matchers = /* @__PURE__ */ Object.create(null);\n Object.keys(this.#routes).concat(Object.keys(this.#middleware)).forEach((method) => {\n matchers[method] ||= this.#buildMatcher(method);\n });\n this.#middleware = this.#routes = void 0;\n clearWildcardRegExpCache();\n return matchers;\n }\n #buildMatcher(method) {\n const routes = [];\n let hasOwnRoute = method === METHOD_NAME_ALL;\n [this.#middleware, this.#routes].forEach((r) => {\n const ownRoute = r[method] ? Object.keys(r[method]).map((path) => [path, r[method][path]]) : [];\n if (ownRoute.length !== 0) {\n hasOwnRoute ||= true;\n routes.push(...ownRoute);\n } else if (method !== METHOD_NAME_ALL) {\n routes.push(\n ...Object.keys(r[METHOD_NAME_ALL]).map((path) => [path, r[METHOD_NAME_ALL][path]])\n );\n }\n });\n if (!hasOwnRoute) {\n return null;\n } else {\n return buildMatcherFromPreprocessedRoutes(routes);\n }\n }\n};\nexport {\n RegExpRouter\n};\n", "// src/router/smart-router/router.ts\nimport { MESSAGE_MATCHER_IS_ALREADY_BUILT, UnsupportedPathError } from \"../../router.js\";\nvar SmartRouter = class {\n name = \"SmartRouter\";\n #routers = [];\n #routes = [];\n constructor(init) {\n this.#routers = init.routers;\n }\n add(method, path, handler) {\n if (!this.#routes) {\n throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);\n }\n this.#routes.push([method, path, handler]);\n }\n match(method, path) {\n if (!this.#routes) {\n throw new Error(\"Fatal error\");\n }\n const routers = this.#routers;\n const routes = this.#routes;\n const len = routers.length;\n let i = 0;\n let res;\n for (; i < len; i++) {\n const router = routers[i];\n try {\n for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {\n router.add(...routes[i2]);\n }\n res = router.match(method, path);\n } catch (e) {\n if (e instanceof UnsupportedPathError) {\n continue;\n }\n throw e;\n }\n this.match = router.match.bind(router);\n this.#routers = [router];\n this.#routes = void 0;\n break;\n }\n if (i === len) {\n throw new Error(\"Fatal error\");\n }\n this.name = `SmartRouter + ${this.activeRouter.name}`;\n return res;\n }\n get activeRouter() {\n if (this.#routes || this.#routers.length !== 1) {\n throw new Error(\"No active router has been determined yet.\");\n }\n return this.#routers[0];\n }\n};\nexport {\n SmartRouter\n};\n", "// src/router/trie-router/node.ts\nimport { METHOD_NAME_ALL } from \"../../router.js\";\nimport { getPattern, splitPath, splitRoutingPath } from \"../../utils/url.js\";\nvar emptyParams = /* @__PURE__ */ Object.create(null);\nvar hasChildren = (children) => {\n for (const _ in children) {\n return true;\n }\n return false;\n};\nvar Node = class _Node {\n #methods;\n #children;\n #patterns;\n #order = 0;\n #params = emptyParams;\n constructor(method, handler, children) {\n this.#children = children || /* @__PURE__ */ Object.create(null);\n this.#methods = [];\n if (method && handler) {\n const m = /* @__PURE__ */ Object.create(null);\n m[method] = { handler, possibleKeys: [], score: 0 };\n this.#methods = [m];\n }\n this.#patterns = [];\n }\n insert(method, path, handler) {\n this.#order = ++this.#order;\n let curNode = this;\n const parts = splitRoutingPath(path);\n const possibleKeys = [];\n for (let i = 0, len = parts.length; i < len; i++) {\n const p = parts[i];\n const nextP = parts[i + 1];\n const pattern = getPattern(p, nextP);\n const key = Array.isArray(pattern) ? pattern[0] : p;\n if (key in curNode.#children) {\n curNode = curNode.#children[key];\n if (pattern) {\n possibleKeys.push(pattern[1]);\n }\n continue;\n }\n curNode.#children[key] = new _Node();\n if (pattern) {\n curNode.#patterns.push(pattern);\n possibleKeys.push(pattern[1]);\n }\n curNode = curNode.#children[key];\n }\n curNode.#methods.push({\n [method]: {\n handler,\n possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),\n score: this.#order\n }\n });\n return curNode;\n }\n #pushHandlerSets(handlerSets, node, method, nodeParams, params) {\n for (let i = 0, len = node.#methods.length; i < len; i++) {\n const m = node.#methods[i];\n const handlerSet = m[method] || m[METHOD_NAME_ALL];\n const processedSet = {};\n if (handlerSet !== void 0) {\n handlerSet.params = /* @__PURE__ */ Object.create(null);\n handlerSets.push(handlerSet);\n if (nodeParams !== emptyParams || params && params !== emptyParams) {\n for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {\n const key = handlerSet.possibleKeys[i2];\n const processed = processedSet[handlerSet.score];\n handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];\n processedSet[handlerSet.score] = true;\n }\n }\n }\n }\n }\n search(method, path) {\n const handlerSets = [];\n this.#params = emptyParams;\n const curNode = this;\n let curNodes = [curNode];\n const parts = splitPath(path);\n const curNodesQueue = [];\n const len = parts.length;\n let partOffsets = null;\n for (let i = 0; i < len; i++) {\n const part = parts[i];\n const isLast = i === len - 1;\n const tempNodes = [];\n for (let j = 0, len2 = curNodes.length; j < len2; j++) {\n const node = curNodes[j];\n const nextNode = node.#children[part];\n if (nextNode) {\n nextNode.#params = node.#params;\n if (isLast) {\n if (nextNode.#children[\"*\"]) {\n this.#pushHandlerSets(handlerSets, nextNode.#children[\"*\"], method, node.#params);\n }\n this.#pushHandlerSets(handlerSets, nextNode, method, node.#params);\n } else {\n tempNodes.push(nextNode);\n }\n }\n for (let k = 0, len3 = node.#patterns.length; k < len3; k++) {\n const pattern = node.#patterns[k];\n const params = node.#params === emptyParams ? {} : { ...node.#params };\n if (pattern === \"*\") {\n const astNode = node.#children[\"*\"];\n if (astNode) {\n this.#pushHandlerSets(handlerSets, astNode, method, node.#params);\n astNode.#params = params;\n tempNodes.push(astNode);\n }\n continue;\n }\n const [key, name, matcher] = pattern;\n if (!part && !(matcher instanceof RegExp)) {\n continue;\n }\n const child = node.#children[key];\n if (matcher instanceof RegExp) {\n if (partOffsets === null) {\n partOffsets = new Array(len);\n let offset = path[0] === \"/\" ? 1 : 0;\n for (let p = 0; p < len; p++) {\n partOffsets[p] = offset;\n offset += parts[p].length + 1;\n }\n }\n const restPathString = path.substring(partOffsets[i]);\n const m = matcher.exec(restPathString);\n if (m) {\n params[name] = m[0];\n this.#pushHandlerSets(handlerSets, child, method, node.#params, params);\n if (m[0].length === restPathString.length && child.#children[\"*\"]) {\n this.#pushHandlerSets(\n handlerSets,\n child.#children[\"*\"],\n method,\n node.#params,\n params\n );\n }\n if (hasChildren(child.#children)) {\n child.#params = params;\n const componentCount = m[0].match(/\\//)?.length ?? 0;\n const targetCurNodes = curNodesQueue[componentCount] ||= [];\n targetCurNodes.push(child);\n }\n continue;\n }\n }\n if (matcher === true || matcher.test(part)) {\n params[name] = part;\n if (isLast) {\n this.#pushHandlerSets(handlerSets, child, method, params, node.#params);\n if (child.#children[\"*\"]) {\n this.#pushHandlerSets(\n handlerSets,\n child.#children[\"*\"],\n method,\n params,\n node.#params\n );\n }\n } else {\n child.#params = params;\n tempNodes.push(child);\n }\n }\n }\n }\n const shifted = curNodesQueue.shift();\n curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;\n }\n if (handlerSets.length > 1) {\n handlerSets.sort((a, b) => {\n return a.score - b.score;\n });\n }\n return [handlerSets.map(({ handler, params }) => [handler, params])];\n }\n};\nexport {\n Node\n};\n", "// src/router/trie-router/router.ts\nimport { checkOptionalParameter } from \"../../utils/url.js\";\nimport { Node } from \"./node.js\";\nvar TrieRouter = class {\n name = \"TrieRouter\";\n #node;\n constructor() {\n this.#node = new Node();\n }\n add(method, path, handler) {\n const results = checkOptionalParameter(path);\n if (results) {\n for (let i = 0, len = results.length; i < len; i++) {\n this.#node.insert(method, results[i], handler);\n }\n return;\n }\n this.#node.insert(method, path, handler);\n }\n match(method, path) {\n return this.#node.search(method, path);\n }\n};\nexport {\n TrieRouter\n};\n", "// src/hono.ts\nimport { HonoBase } from \"./hono-base.js\";\nimport { RegExpRouter } from \"./router/reg-exp-router/index.js\";\nimport { SmartRouter } from \"./router/smart-router/index.js\";\nimport { TrieRouter } from \"./router/trie-router/index.js\";\nvar Hono = class extends HonoBase {\n /**\n * Creates an instance of the Hono class.\n *\n * @param options - Optional configuration options for the Hono instance.\n */\n constructor(options = {}) {\n super(options);\n this.router = options.router ?? new SmartRouter({\n routers: [new RegExpRouter(), new TrieRouter()]\n });\n }\n};\nexport {\n Hono\n};\n", "import {\n DEFAULT_ROLLOUT_COHORT_COUNT,\n getAssetBaseStorageUri,\n getBundlePatches,\n getManifestFileHash,\n getManifestStorageUri,\n NIL_UUID,\n stripBundleArtifactMetadata,\n} from \"@hot-updater/core\";\nimport type {\n Bundle,\n DatabaseBundleQueryWhere,\n HotUpdaterContext,\n PaginationOptions,\n RequestEnvContext,\n} from \"@hot-updater/plugin-core\";\nimport {\n calculatePagination,\n createDatabasePlugin,\n filterCompatibleAppVersions,\n resolveUpdateInfoFromBundles,\n} from \"@hot-updater/plugin-core\";\n\ntype D1Result<T> = {\n results?: T[];\n};\n\ntype D1PreparedStatement = {\n bind: (...values: unknown[]) => {\n all: <T>() => Promise<D1Result<T>>;\n first: <T>() => Promise<T | null>;\n run: () => Promise<unknown>;\n };\n};\n\ntype D1Like = {\n prepare: (sql: string) => D1PreparedStatement;\n};\n\nexport interface CloudflareWorkerDatabaseEnv {\n DB: D1Like;\n}\n\ninterface CloudflareWorkerDatabaseConfig<\n TContext extends RequestEnvContext<CloudflareWorkerDatabaseEnv>,\n> {\n getDb: (context?: HotUpdaterContext<TContext>) => D1Like;\n}\n\ntype QueryConditions = DatabaseBundleQueryWhere;\n\ninterface BuildQueryResult {\n sql: string;\n params: unknown[];\n}\n\nconst buildJsonEachInClause = (\n columnName: string,\n values: string[],\n params: unknown[],\n) => {\n if (values.length === 0) {\n return \"1 = 0\";\n }\n\n params.push(JSON.stringify(values));\n return `${columnName} IN (SELECT value FROM json_each(?))`;\n};\n\ninterface D1WorkerBundleRow {\n id: string;\n channel: string;\n enabled: number | boolean;\n should_force_update: number | boolean;\n file_hash: string;\n git_commit_hash: string | null;\n message: string | null;\n platform: \"ios\" | \"android\";\n target_app_version: string | null;\n storage_uri: string;\n fingerprint_hash: string | null;\n metadata: unknown;\n manifest_storage_uri?: string | null;\n manifest_file_hash?: string | null;\n asset_base_storage_uri?: string | null;\n rollout_cohort_count: number | null;\n target_cohorts: string | null;\n}\n\ninterface D1WorkerBundlePatchRow {\n id: string;\n bundle_id: string;\n base_bundle_id: string;\n base_file_hash: string;\n patch_file_hash: string;\n patch_storage_uri: string;\n order_index: number | null;\n}\n\nfunction buildWhereClause(\n conditions: QueryConditions | undefined,\n): BuildQueryResult {\n if (!conditions) {\n return { sql: \"\", params: [] };\n }\n\n const clauses: string[] = [];\n const params: unknown[] = [];\n\n if (conditions.channel) {\n clauses.push(\"channel = ?\");\n params.push(conditions.channel);\n }\n\n if (conditions.platform) {\n clauses.push(\"platform = ?\");\n params.push(conditions.platform);\n }\n\n if (conditions.enabled !== undefined) {\n clauses.push(\"enabled = ?\");\n params.push(conditions.enabled ? 1 : 0);\n }\n\n if (conditions.id?.in) {\n clauses.push(buildJsonEachInClause(\"id\", conditions.id.in, params));\n }\n\n if (conditions.id?.eq) {\n clauses.push(\"id = ?\");\n params.push(conditions.id.eq);\n }\n\n if (conditions.id?.gt) {\n clauses.push(\"id > ?\");\n params.push(conditions.id.gt);\n }\n\n if (conditions.id?.gte) {\n clauses.push(\"id >= ?\");\n params.push(conditions.id.gte);\n }\n\n if (conditions.id?.lt) {\n clauses.push(\"id < ?\");\n params.push(conditions.id.lt);\n }\n\n if (conditions.id?.lte) {\n clauses.push(\"id <= ?\");\n params.push(conditions.id.lte);\n }\n\n if (conditions.targetAppVersionNotNull) {\n clauses.push(\"target_app_version IS NOT NULL\");\n }\n\n if (conditions.targetAppVersion !== undefined) {\n if (conditions.targetAppVersion === null) {\n clauses.push(\"target_app_version IS NULL\");\n } else {\n clauses.push(\"target_app_version = ?\");\n params.push(conditions.targetAppVersion);\n }\n }\n\n if (conditions.targetAppVersionIn) {\n clauses.push(\n buildJsonEachInClause(\n \"target_app_version\",\n conditions.targetAppVersionIn,\n params,\n ),\n );\n }\n\n if (conditions.fingerprintHash !== undefined) {\n if (conditions.fingerprintHash === null) {\n clauses.push(\"fingerprint_hash IS NULL\");\n } else {\n clauses.push(\"fingerprint_hash = ?\");\n params.push(conditions.fingerprintHash);\n }\n }\n\n const whereClause =\n clauses.length > 0 ? ` WHERE ${clauses.join(\" AND \")}` : \"\";\n\n return { sql: whereClause, params };\n}\n\nfunction parseTargetCohorts(value: unknown): string[] | null {\n if (!value) return null;\n if (Array.isArray(value)) {\n return value.filter((item): item is string => typeof item === \"string\");\n }\n if (typeof value === \"string\") {\n try {\n const parsed = JSON.parse(value) as unknown;\n if (Array.isArray(parsed)) {\n return parsed.filter(\n (item): item is string => typeof item === \"string\",\n );\n }\n } catch {\n return null;\n }\n }\n return null;\n}\n\nconst parseMetadata = (value: unknown): Bundle[\"metadata\"] => {\n if (!value) return undefined;\n if (typeof value === \"string\") {\n try {\n return parseMetadata(JSON.parse(value) as unknown);\n } catch {\n return undefined;\n }\n }\n return typeof value === \"object\" && !Array.isArray(value)\n ? (value as Bundle[\"metadata\"])\n : undefined;\n};\n\nconst buildBundlePatchId = (bundleId: string, baseBundleId: string) =>\n `${bundleId}:${baseBundleId}`;\n\nconst bundleToPatchRows = (bundle: Bundle): D1WorkerBundlePatchRow[] =>\n getBundlePatches(bundle).map((patch, index) => ({\n id: buildBundlePatchId(bundle.id, patch.baseBundleId),\n bundle_id: bundle.id,\n base_bundle_id: patch.baseBundleId,\n base_file_hash: patch.baseFileHash,\n patch_file_hash: patch.patchFileHash,\n patch_storage_uri: patch.patchStorageUri,\n order_index: index,\n }));\n\nfunction transformRowToBundle(\n row: D1WorkerBundleRow,\n patchRows: D1WorkerBundlePatchRow[] = [],\n): Bundle {\n const rawMetadata = parseMetadata(row.metadata);\n const patches = patchRows\n .slice()\n .sort(\n (left, right) =>\n (left.order_index ?? 0) - (right.order_index ?? 0) ||\n left.base_bundle_id.localeCompare(right.base_bundle_id),\n )\n .map((patch) => ({\n baseBundleId: patch.base_bundle_id,\n baseFileHash: patch.base_file_hash,\n patchFileHash: patch.patch_file_hash,\n patchStorageUri: patch.patch_storage_uri,\n }));\n const primaryPatch = patches[0] ?? null;\n\n return {\n id: row.id,\n channel: row.channel,\n enabled: Boolean(row.enabled),\n shouldForceUpdate: Boolean(row.should_force_update),\n fileHash: row.file_hash,\n gitCommitHash: row.git_commit_hash,\n message: row.message,\n platform: row.platform,\n targetAppVersion: row.target_app_version,\n storageUri: row.storage_uri,\n fingerprintHash: row.fingerprint_hash,\n metadata: stripBundleArtifactMetadata(rawMetadata),\n manifestStorageUri: row.manifest_storage_uri ?? null,\n manifestFileHash: row.manifest_file_hash ?? null,\n assetBaseStorageUri: row.asset_base_storage_uri ?? null,\n patches,\n patchBaseBundleId: primaryPatch?.baseBundleId ?? null,\n patchBaseFileHash: primaryPatch?.baseFileHash ?? null,\n patchFileHash: primaryPatch?.patchFileHash ?? null,\n patchStorageUri: primaryPatch?.patchStorageUri ?? null,\n rolloutCohortCount:\n (row.rollout_cohort_count as number | null) ??\n DEFAULT_ROLLOUT_COHORT_COUNT,\n targetCohorts: parseTargetCohorts(row.target_cohorts as unknown),\n };\n}\n\nconst resolveDbFromContext = (\n context?: RequestEnvContext<CloudflareWorkerDatabaseEnv>,\n) => {\n const db = context?.env?.DB;\n\n if (!db) {\n throw new Error(\n \"d1WorkerDatabase requires env.DB in the hot updater context.\",\n );\n }\n\n return db;\n};\n\nexport const d1WorkerDatabase = <\n TContext extends RequestEnvContext<CloudflareWorkerDatabaseEnv> =\n RequestEnvContext<CloudflareWorkerDatabaseEnv>,\n>() =>\n createDatabasePlugin<CloudflareWorkerDatabaseConfig<TContext>, TContext>({\n name: \"d1WorkerDatabase\",\n factory: (config) => {\n const queryAll = async <TRow>(\n sql: string,\n params: unknown[] = [],\n context?: HotUpdaterContext<TContext>,\n ): Promise<TRow[]> => {\n const result = await config\n .getDb(context)\n .prepare(sql)\n .bind(...params)\n .all<TRow>();\n return result.results ?? [];\n };\n\n const queryFirst = async <TRow>(\n sql: string,\n params: unknown[] = [],\n context?: HotUpdaterContext<TContext>,\n ): Promise<TRow | null> => {\n const result = await config\n .getDb(context)\n .prepare(sql)\n .bind(...params)\n .first<TRow>();\n return result ?? null;\n };\n\n const getPatchMap = async (\n bundleIds: string[],\n context?: HotUpdaterContext<TContext>,\n ) => {\n const patchMap = new Map<string, D1WorkerBundlePatchRow[]>();\n\n if (bundleIds.length === 0) {\n return patchMap;\n }\n\n const rows = await queryAll<D1WorkerBundlePatchRow>(\n `\n SELECT *\n FROM bundle_patches\n WHERE bundle_id IN (SELECT value FROM json_each(?))\n ORDER BY order_index ASC, base_bundle_id ASC\n `,\n [JSON.stringify(bundleIds)],\n context,\n );\n\n for (const row of rows) {\n const current = patchMap.get(row.bundle_id) ?? [];\n current.push(row);\n patchMap.set(row.bundle_id, current);\n }\n\n return patchMap;\n };\n\n const queryBundlesForUpdateInfo = async (\n conditions: QueryConditions,\n context?: HotUpdaterContext<TContext>,\n ): Promise<Bundle[]> => {\n const { sql: whereClause, params } = buildWhereClause(conditions);\n const rows = await queryAll<D1WorkerBundleRow>(\n `\n SELECT * FROM bundles\n ${whereClause}\n `,\n params,\n context,\n );\n const patchMap = await getPatchMap(\n rows.map((row) => row.id),\n context,\n );\n\n return rows.map((row) =>\n transformRowToBundle(row, patchMap.get(row.id)),\n );\n };\n\n const getTargetAppVersionsForUpdateInfo = async (\n {\n platform,\n channel,\n minBundleId,\n }: {\n platform: Bundle[\"platform\"];\n channel: string;\n minBundleId: string;\n },\n context?: HotUpdaterContext<TContext>,\n ): Promise<string[]> => {\n const rows = await queryAll<{ target_app_version: string }>(\n `\n SELECT target_app_version\n FROM bundles\n WHERE channel = ?\n AND platform = ?\n AND enabled = 1\n AND id >= ?\n AND target_app_version IS NOT NULL\n GROUP BY target_app_version\n `,\n [channel, platform, minBundleId],\n context,\n );\n\n return rows.map((row) => row.target_app_version);\n };\n\n return {\n async getUpdateInfo(args, context) {\n const channel = args.channel ?? \"production\";\n const minBundleId = args.minBundleId ?? NIL_UUID;\n\n if (args._updateStrategy === \"appVersion\") {\n const targetAppVersions = await getTargetAppVersionsForUpdateInfo(\n {\n platform: args.platform,\n channel,\n minBundleId,\n },\n context,\n );\n const compatibleAppVersions = filterCompatibleAppVersions(\n targetAppVersions,\n args.appVersion,\n );\n const bundles =\n compatibleAppVersions.length > 0\n ? await queryBundlesForUpdateInfo(\n {\n enabled: true,\n platform: args.platform,\n channel,\n id: {\n gte: minBundleId,\n },\n targetAppVersionIn: compatibleAppVersions,\n },\n context,\n )\n : [];\n\n return resolveUpdateInfoFromBundles({\n args: { ...args, channel, minBundleId },\n bundles,\n context,\n });\n }\n\n const bundles = await queryBundlesForUpdateInfo(\n {\n enabled: true,\n platform: args.platform,\n channel,\n id: {\n gte: minBundleId,\n },\n fingerprintHash: args.fingerprintHash,\n },\n context,\n );\n\n return resolveUpdateInfoFromBundles({\n args: { ...args, channel, minBundleId },\n bundles,\n context,\n });\n },\n\n async getBundleById(bundleId, context) {\n const [row, patchMap] = await Promise.all([\n queryFirst<D1WorkerBundleRow>(\n \"SELECT * FROM bundles WHERE id = ? LIMIT 1\",\n [bundleId],\n context,\n ),\n getPatchMap([bundleId], context),\n ]);\n\n return row ? transformRowToBundle(row, patchMap.get(bundleId)) : null;\n },\n\n async getBundles(options, context) {\n const { where, limit, orderBy } = options;\n const offset =\n ((\"offset\" in options ? options.offset : undefined) as\n | number\n | undefined) ?? 0;\n const { sql: whereClause, params } = buildWhereClause(where);\n const orderSql =\n orderBy?.direction === \"asc\"\n ? \"ORDER BY id ASC\"\n : \"ORDER BY id DESC\";\n\n const countRows = await queryAll<{ total: number }>(\n `SELECT COUNT(*) as total FROM bundles${whereClause}`,\n params,\n context,\n );\n const total = countRows[0]?.total ?? 0;\n\n const rows = await queryAll<D1WorkerBundleRow>(\n `SELECT * FROM bundles${whereClause} ${orderSql} LIMIT ? OFFSET ?`,\n [...params, limit, offset],\n context,\n );\n\n const patchMap = await getPatchMap(\n rows.map((row) => row.id),\n context,\n );\n const bundles = rows.map((row) =>\n transformRowToBundle(row, patchMap.get(row.id)),\n );\n\n const paginationOptions: PaginationOptions = { limit, offset };\n return {\n data: bundles,\n pagination: calculatePagination(total, paginationOptions),\n };\n },\n\n async getChannels(context) {\n const rows = await queryAll<{ channel: string }>(\n \"SELECT channel FROM bundles GROUP BY channel\",\n [],\n context,\n );\n return rows.map((row) => row.channel);\n },\n\n async commitBundle({ changedSets }, context) {\n if (changedSets.length === 0) {\n return;\n }\n\n const db = config.getDb(context);\n\n for (const operation of changedSets) {\n if (operation.operation === \"delete\") {\n await db\n .prepare(\"DELETE FROM bundle_patches WHERE bundle_id = ?\")\n .bind(operation.data.id)\n .run();\n await db\n .prepare(\"DELETE FROM bundle_patches WHERE base_bundle_id = ?\")\n .bind(operation.data.id)\n .run();\n await db\n .prepare(\"DELETE FROM bundles WHERE id = ?\")\n .bind(operation.data.id)\n .run();\n continue;\n }\n\n const bundle = operation.data;\n await db\n .prepare(`\n INSERT OR REPLACE INTO bundles (\n id,\n channel,\n enabled,\n should_force_update,\n file_hash,\n git_commit_hash,\n message,\n platform,\n target_app_version,\n storage_uri,\n fingerprint_hash,\n metadata,\n manifest_storage_uri,\n manifest_file_hash,\n asset_base_storage_uri,\n rollout_cohort_count,\n target_cohorts\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n `)\n .bind(\n bundle.id,\n bundle.channel,\n bundle.enabled ? 1 : 0,\n bundle.shouldForceUpdate ? 1 : 0,\n bundle.fileHash,\n bundle.gitCommitHash || null,\n bundle.message || null,\n bundle.platform,\n bundle.targetAppVersion,\n bundle.storageUri,\n bundle.fingerprintHash,\n JSON.stringify(\n stripBundleArtifactMetadata(bundle.metadata) ?? {},\n ),\n getManifestStorageUri(bundle),\n getManifestFileHash(bundle),\n getAssetBaseStorageUri(bundle),\n bundle.rolloutCohortCount ?? DEFAULT_ROLLOUT_COHORT_COUNT,\n bundle.targetCohorts\n ? JSON.stringify(bundle.targetCohorts)\n : null,\n )\n .run();\n\n await db\n .prepare(\"DELETE FROM bundle_patches WHERE bundle_id = ?\")\n .bind(bundle.id)\n .run();\n\n const patchRows = bundleToPatchRows(bundle);\n for (const patchRow of patchRows) {\n await db\n .prepare(`\n INSERT OR REPLACE INTO bundle_patches (\n id,\n bundle_id,\n base_bundle_id,\n base_file_hash,\n patch_file_hash,\n patch_storage_uri,\n order_index\n )\n VALUES (?, ?, ?, ?, ?, ?, ?)\n `)\n .bind(\n patchRow.id,\n patchRow.bundle_id,\n patchRow.base_bundle_id,\n patchRow.base_file_hash,\n patchRow.patch_file_hash,\n patchRow.patch_storage_uri,\n patchRow.order_index ?? 0,\n )\n .run();\n }\n }\n },\n };\n },\n })({\n getDb: resolveDbFromContext,\n });\n", "import { signToken } from \"@hot-updater/js\";\nimport {\n createRuntimeStoragePlugin,\n decodeStorageObjectKey,\n type HotUpdaterContext,\n type RequestEnvContext,\n} from \"@hot-updater/plugin-core\";\n\nexport interface CloudflareWorkerStorageEnv {\n JWT_SECRET: string;\n BUCKET: {\n get: (key: string) => Promise<{ text: () => Promise<string> } | null>;\n };\n}\n\ntype ContextResolver<TContext, TValue> = (\n context?: HotUpdaterContext<TContext>,\n) => TValue | Promise<TValue>;\n\nexport interface CloudflareWorkerStorageConfig<\n TContext extends RequestEnvContext<CloudflareWorkerStorageEnv>,\n> {\n jwtSecret?: string | ContextResolver<TContext, string>;\n publicBaseUrl: string | ContextResolver<TContext, string>;\n}\n\nconst resolveContextValue = async <TContext, TValue>(\n value: TValue | ContextResolver<TContext, TValue>,\n context?: HotUpdaterContext<TContext>,\n) => {\n return typeof value === \"function\"\n ? await (value as ContextResolver<TContext, TValue>)(context)\n : value;\n};\n\nconst resolveJwtSecretFromContext = (\n context?: RequestEnvContext<CloudflareWorkerStorageEnv>,\n) => {\n const jwtSecret = context?.env?.JWT_SECRET;\n\n if (!jwtSecret) {\n throw new Error(\n \"r2WorkerStorage requires env.JWT_SECRET in the hot updater context.\",\n );\n }\n\n return jwtSecret;\n};\n\nconst resolveR2BucketFromContext = (\n context?: RequestEnvContext<CloudflareWorkerStorageEnv>,\n) => {\n const bucket = context?.env?.BUCKET;\n\n if (!bucket) {\n throw new Error(\n \"r2WorkerStorage requires env.BUCKET in the hot updater context.\",\n );\n }\n\n return bucket;\n};\n\nconst createPublicObjectPath = (storageUrl: URL) =>\n `${storageUrl.host}${storageUrl.pathname}`;\n\nconst createR2ObjectKey = (storageUrl: URL) =>\n decodeStorageObjectKey(storageUrl.pathname.replace(/^\\/+/, \"\"));\n\nexport const r2WorkerStorage = <\n TContext extends RequestEnvContext<CloudflareWorkerStorageEnv> =\n RequestEnvContext<CloudflareWorkerStorageEnv>,\n>(\n config: CloudflareWorkerStorageConfig<TContext>,\n) => {\n return createRuntimeStoragePlugin<\n CloudflareWorkerStorageConfig<TContext>,\n TContext\n >({\n name: \"r2WorkerStorage\",\n supportedProtocol: \"r2\",\n factory: (config) => ({\n async readText(storageUri, context) {\n const storageUrl = new URL(storageUri);\n\n if (storageUrl.protocol !== \"r2:\") {\n throw new Error(\"Invalid R2 storage URI protocol\");\n }\n\n const bucket = resolveR2BucketFromContext(context);\n const key = createR2ObjectKey(storageUrl);\n const object = await bucket.get(key);\n if (!object) {\n return null;\n }\n\n return object.text();\n },\n async getDownloadUrl(storageUri, context) {\n const storageUrl = new URL(storageUri);\n\n if (storageUrl.protocol !== \"r2:\") {\n throw new Error(\"Invalid R2 storage URI protocol\");\n }\n\n const key = createPublicObjectPath(storageUrl);\n const [jwtSecret, publicBaseUrl] = await Promise.all([\n resolveContextValue(\n config.jwtSecret ?? resolveJwtSecretFromContext,\n context,\n ),\n resolveContextValue(config.publicBaseUrl, context),\n ]);\n const token = await signToken(key, jwtSecret);\n const url = new URL(publicBaseUrl);\n\n url.pathname = key;\n url.search = \"\";\n url.searchParams.set(\"token\", token);\n\n return {\n fileUrl: url.toString(),\n };\n },\n }),\n })(config);\n};\n", "export { verifyJwtSignedUrl } from \"@hot-updater/js\";\n\nimport type { RequestEnvContext as BaseRequestEnvContext } from \"@hot-updater/plugin-core\";\n\nimport {\n type CloudflareWorkerDatabaseEnv,\n d1WorkerDatabase,\n} from \"../cloudflareWorkerDatabase\";\nimport {\n type CloudflareWorkerStorageConfig,\n type CloudflareWorkerStorageEnv,\n r2WorkerStorage,\n} from \"../r2WorkerStorage\";\n\nexport type { CloudflareWorkerDatabaseEnv, CloudflareWorkerStorageEnv };\n\nexport interface CloudflareWorkerRuntimeEnv\n extends CloudflareWorkerDatabaseEnv, CloudflareWorkerStorageEnv {}\n\nexport type RequestEnvContext<TEnv = CloudflareWorkerRuntimeEnv> =\n BaseRequestEnvContext<TEnv>;\n\nexport const d1Database = <\n TContext extends RequestEnvContext<CloudflareWorkerRuntimeEnv> =\n RequestEnvContext<CloudflareWorkerRuntimeEnv>,\n>() => d1WorkerDatabase<TContext>();\n\nexport const r2Storage = <\n TContext extends RequestEnvContext<CloudflareWorkerRuntimeEnv> =\n RequestEnvContext<CloudflareWorkerRuntimeEnv>,\n>(\n config: CloudflareWorkerStorageConfig<TContext>,\n) => r2WorkerStorage<TContext>(config);\n", "import { decodeStorageObjectKey } from \"@hot-updater/plugin-core\";\nimport { createHotUpdater } from \"@hot-updater/server\";\nimport { Hono } from \"hono\";\n\nimport {\n d1Database,\n type RequestEnvContext,\n r2Storage,\n verifyJwtSignedUrl,\n} from \"../../src/worker\";\n\nexport type CloudflareWorkerEnv = {\n DB: {\n prepare: D1Database[\"prepare\"];\n };\n BUCKET: R2Bucket;\n JWT_SECRET: string;\n};\n\nexport const HOT_UPDATER_BASE_PATH = \"/api/check-update\";\n\nconst resolveRequestOrigin = (context?: RequestEnvContext) => {\n const request = context?.request;\n\n if (!request) {\n throw new Error(\n \"r2WorkerStorage requires a request to resolve publicBaseUrl.\",\n );\n }\n\n return new URL(request.url).origin;\n};\n\nconst hotUpdater = createHotUpdater({\n database: d1Database(),\n storages: [\n r2Storage({\n publicBaseUrl: resolveRequestOrigin,\n }),\n ],\n basePath: HOT_UPDATER_BASE_PATH,\n routes: {\n updateCheck: true,\n bundles: false,\n },\n});\n\nconst app = new Hono<{ Bindings: CloudflareWorkerEnv }>();\n\napp.mount(\n HOT_UPDATER_BASE_PATH,\n (request: Request, env: CloudflareWorkerEnv) => {\n return hotUpdater.handler(request, {\n request,\n env,\n });\n },\n {\n optionHandler: (c) => [c.env],\n },\n);\n\napp.get(\"*\", async (c) => {\n const result = await verifyJwtSignedUrl({\n path: new URL(c.req.url).pathname,\n token: c.req.query(\"token\"),\n jwtSecret: c.env.JWT_SECRET,\n handler: async (storageUri) => {\n const [, ...key] = decodeStorageObjectKey(storageUri).split(\"/\");\n const object = await c.env.BUCKET.get(key.join(\"/\"));\n if (!object) {\n return null;\n }\n\n return {\n body: object.body,\n contentType: object.httpMetadata?.contentType,\n };\n },\n });\n\n if (result.status !== 200) {\n return c.json({ error: result.error }, result.status);\n }\n\n return c.body(result.responseBody, 200, result.responseHeaders);\n});\n\nexport default app;\n"],
5
+ "sourcesContent": ["/* @__NO_SIDE_EFFECTS__ */\nexport function rawHeaders(headers) {\n\tconst rawHeaders = [];\n\tfor (const key in headers) {\n\t\tif (Array.isArray(headers[key])) {\n\t\t\tfor (const h of headers[key]) {\n\t\t\t\trawHeaders.push(key, h);\n\t\t\t}\n\t\t} else {\n\t\t\trawHeaders.push(key, headers[key]);\n\t\t}\n\t}\n\treturn rawHeaders;\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function mergeFns(...functions) {\n\treturn function(...args) {\n\t\tfor (const fn of functions) {\n\t\t\tfn(...args);\n\t\t}\n\t};\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function createNotImplementedError(name) {\n\treturn new Error(`[unenv] ${name} is not implemented yet!`);\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function notImplemented(name) {\n\tconst fn = () => {\n\t\tthrow createNotImplementedError(name);\n\t};\n\treturn Object.assign(fn, { __unenv__: true });\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function notImplementedAsync(name) {\n\tconst fn = notImplemented(name);\n\tfn.__promisify__ = () => notImplemented(name + \".__promisify__\");\n\tfn.native = fn;\n\treturn fn;\n}\n/* @__NO_SIDE_EFFECTS__ */\nexport function notImplementedClass(name) {\n\treturn class {\n\t\t__unenv__ = true;\n\t\tconstructor() {\n\t\t\tthrow new Error(`[unenv] ${name} is not implemented yet!`);\n\t\t}\n\t};\n}\n", "import { createNotImplementedError } from \"../../../_internal/utils.mjs\";\nconst _timeOrigin = globalThis.performance?.timeOrigin ?? Date.now();\nconst _performanceNow = globalThis.performance?.now ? globalThis.performance.now.bind(globalThis.performance) : () => Date.now() - _timeOrigin;\nconst nodeTiming = {\n\tname: \"node\",\n\tentryType: \"node\",\n\tstartTime: 0,\n\tduration: 0,\n\tnodeStart: 0,\n\tv8Start: 0,\n\tbootstrapComplete: 0,\n\tenvironment: 0,\n\tloopStart: 0,\n\tloopExit: 0,\n\tidleTime: 0,\n\tuvMetricsInfo: {\n\t\tloopCount: 0,\n\t\tevents: 0,\n\t\teventsWaiting: 0\n\t},\n\tdetail: undefined,\n\ttoJSON() {\n\t\treturn this;\n\t}\n};\n// PerformanceEntry\nexport class PerformanceEntry {\n\t__unenv__ = true;\n\tdetail;\n\tentryType = \"event\";\n\tname;\n\tstartTime;\n\tconstructor(name, options) {\n\t\tthis.name = name;\n\t\tthis.startTime = options?.startTime || _performanceNow();\n\t\tthis.detail = options?.detail;\n\t}\n\tget duration() {\n\t\treturn _performanceNow() - this.startTime;\n\t}\n\ttoJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tentryType: this.entryType,\n\t\t\tstartTime: this.startTime,\n\t\t\tduration: this.duration,\n\t\t\tdetail: this.detail\n\t\t};\n\t}\n}\n// PerformanceMark\nexport const PerformanceMark = class PerformanceMark extends PerformanceEntry {\n\tentryType = \"mark\";\n\tconstructor() {\n\t\t// @ts-ignore\n\t\tsuper(...arguments);\n\t}\n\tget duration() {\n\t\treturn 0;\n\t}\n};\n// PerformanceMark\nexport class PerformanceMeasure extends PerformanceEntry {\n\tentryType = \"measure\";\n}\n// PerformanceResourceTiming\nexport class PerformanceResourceTiming extends PerformanceEntry {\n\tentryType = \"resource\";\n\tserverTiming = [];\n\tconnectEnd = 0;\n\tconnectStart = 0;\n\tdecodedBodySize = 0;\n\tdomainLookupEnd = 0;\n\tdomainLookupStart = 0;\n\tencodedBodySize = 0;\n\tfetchStart = 0;\n\tinitiatorType = \"\";\n\tname = \"\";\n\tnextHopProtocol = \"\";\n\tredirectEnd = 0;\n\tredirectStart = 0;\n\trequestStart = 0;\n\tresponseEnd = 0;\n\tresponseStart = 0;\n\tsecureConnectionStart = 0;\n\tstartTime = 0;\n\ttransferSize = 0;\n\tworkerStart = 0;\n\tresponseStatus = 0;\n}\n// PerformanceObserverEntryList\nexport class PerformanceObserverEntryList {\n\t__unenv__ = true;\n\tgetEntries() {\n\t\treturn [];\n\t}\n\tgetEntriesByName(_name, _type) {\n\t\treturn [];\n\t}\n\tgetEntriesByType(type) {\n\t\treturn [];\n\t}\n}\n// Performance\nexport class Performance {\n\t__unenv__ = true;\n\ttimeOrigin = _timeOrigin;\n\teventCounts = new Map();\n\t_entries = [];\n\t_resourceTimingBufferSize = 0;\n\tnavigation = undefined;\n\ttiming = undefined;\n\ttimerify(_fn, _options) {\n\t\tthrow createNotImplementedError(\"Performance.timerify\");\n\t}\n\tget nodeTiming() {\n\t\treturn nodeTiming;\n\t}\n\teventLoopUtilization() {\n\t\treturn {};\n\t}\n\tmarkResourceTiming() {\n\t\t// TODO: create a new PerformanceResourceTiming entry\n\t\t// so that performance.getEntries, getEntriesByName, and getEntriesByType return it\n\t\t// see: https://nodejs.org/api/perf_hooks.html#performancemarkresourcetimingtiminginfo-requestedurl-initiatortype-global-cachemode-bodyinfo-responsestatus-deliverytype\n\t\treturn new PerformanceResourceTiming(\"\");\n\t}\n\tonresourcetimingbufferfull = null;\n\tnow() {\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Performance/now\n\t\tif (this.timeOrigin === _timeOrigin) {\n\t\t\treturn _performanceNow();\n\t\t}\n\t\treturn Date.now() - this.timeOrigin;\n\t}\n\tclearMarks(markName) {\n\t\tthis._entries = markName ? this._entries.filter((e) => e.name !== markName) : this._entries.filter((e) => e.entryType !== \"mark\");\n\t}\n\tclearMeasures(measureName) {\n\t\tthis._entries = measureName ? this._entries.filter((e) => e.name !== measureName) : this._entries.filter((e) => e.entryType !== \"measure\");\n\t}\n\tclearResourceTimings() {\n\t\tthis._entries = this._entries.filter((e) => e.entryType !== \"resource\" || e.entryType !== \"navigation\");\n\t}\n\tgetEntries() {\n\t\treturn this._entries;\n\t}\n\tgetEntriesByName(name, type) {\n\t\treturn this._entries.filter((e) => e.name === name && (!type || e.entryType === type));\n\t}\n\tgetEntriesByType(type) {\n\t\treturn this._entries.filter((e) => e.entryType === type);\n\t}\n\tmark(name, options) {\n\t\t// @ts-expect-error constructor is not protected\n\t\tconst entry = new PerformanceMark(name, options);\n\t\tthis._entries.push(entry);\n\t\treturn entry;\n\t}\n\tmeasure(measureName, startOrMeasureOptions, endMark) {\n\t\tlet start;\n\t\tlet end;\n\t\tif (typeof startOrMeasureOptions === \"string\") {\n\t\t\tstart = this.getEntriesByName(startOrMeasureOptions, \"mark\")[0]?.startTime;\n\t\t\tend = this.getEntriesByName(endMark, \"mark\")[0]?.startTime;\n\t\t} else {\n\t\t\tstart = Number.parseFloat(startOrMeasureOptions?.start) || this.now();\n\t\t\tend = Number.parseFloat(startOrMeasureOptions?.end) || this.now();\n\t\t}\n\t\tconst entry = new PerformanceMeasure(measureName, {\n\t\t\tstartTime: start,\n\t\t\tdetail: {\n\t\t\t\tstart,\n\t\t\t\tend\n\t\t\t}\n\t\t});\n\t\tthis._entries.push(entry);\n\t\treturn entry;\n\t}\n\tsetResourceTimingBufferSize(maxSize) {\n\t\tthis._resourceTimingBufferSize = maxSize;\n\t}\n\taddEventListener(type, listener, options) {\n\t\tthrow createNotImplementedError(\"Performance.addEventListener\");\n\t}\n\tremoveEventListener(type, listener, options) {\n\t\tthrow createNotImplementedError(\"Performance.removeEventListener\");\n\t}\n\tdispatchEvent(event) {\n\t\tthrow createNotImplementedError(\"Performance.dispatchEvent\");\n\t}\n\ttoJSON() {\n\t\treturn this;\n\t}\n}\n// PerformanceObserver\nexport class PerformanceObserver {\n\t__unenv__ = true;\n\tstatic supportedEntryTypes = [];\n\t_callback = null;\n\tconstructor(callback) {\n\t\tthis._callback = callback;\n\t}\n\ttakeRecords() {\n\t\treturn [];\n\t}\n\tdisconnect() {\n\t\tthrow createNotImplementedError(\"PerformanceObserver.disconnect\");\n\t}\n\tobserve(options) {\n\t\tthrow createNotImplementedError(\"PerformanceObserver.observe\");\n\t}\n\tbind(fn) {\n\t\treturn fn;\n\t}\n\trunInAsyncScope(fn, thisArg, ...args) {\n\t\treturn fn.call(thisArg, ...args);\n\t}\n\tasyncId() {\n\t\treturn 0;\n\t}\n\ttriggerAsyncId() {\n\t\treturn 0;\n\t}\n\temitDestroy() {\n\t\treturn this;\n\t}\n}\n// workerd implements a subset of globalThis.performance (as of last check, only timeOrigin set to 0 + now() implemented)\n// We already use performance.now() from globalThis.performance, if provided (see top of this file)\n// If we detect this condition, we can just use polyfill instead.\nexport const performance = globalThis.performance && \"addEventListener\" in globalThis.performance ? globalThis.performance : new Performance();\n", "import {\n performance,\n Performance,\n PerformanceEntry,\n PerformanceMark,\n PerformanceMeasure,\n PerformanceObserver,\n PerformanceObserverEntryList,\n PerformanceResourceTiming\n} from \"node:perf_hooks\";\nif (!(\"__unenv__\" in performance)) {\n const proto = Performance.prototype;\n for (const key of Object.getOwnPropertyNames(proto)) {\n if (key !== \"constructor\" && !(key in performance)) {\n const desc = Object.getOwnPropertyDescriptor(proto, key);\n if (desc) {\n Object.defineProperty(performance, key, desc);\n }\n }\n }\n}\nglobalThis.performance = performance;\nglobalThis.Performance = Performance;\nglobalThis.PerformanceEntry = PerformanceEntry;\nglobalThis.PerformanceMark = PerformanceMark;\nglobalThis.PerformanceMeasure = PerformanceMeasure;\nglobalThis.PerformanceObserver = PerformanceObserver;\nglobalThis.PerformanceObserverEntryList = PerformanceObserverEntryList;\nglobalThis.PerformanceResourceTiming = PerformanceResourceTiming;\n", "import { Writable } from \"node:stream\";\nimport noop from \"../mock/noop.mjs\";\nimport { notImplemented, notImplementedClass } from \"../_internal/utils.mjs\";\nconst _console = globalThis.console;\n// undocumented public APIs\nexport const _ignoreErrors = true;\nexport const _stderr = new Writable();\nexport const _stdout = new Writable();\nexport const log = _console?.log ?? noop;\nexport const info = _console?.info ?? log;\nexport const trace = _console?.trace ?? info;\nexport const debug = _console?.debug ?? log;\nexport const table = _console?.table ?? log;\nexport const error = _console?.error ?? log;\nexport const warn = _console?.warn ?? error;\n// https://developer.chrome.com/docs/devtools/console/api#createtask\nexport const createTask = _console?.createTask ?? /* @__PURE__ */ notImplemented(\"console.createTask\");\nexport const assert = /* @__PURE__ */ notImplemented(\"console.assert\");\n// noop\nexport const clear = _console?.clear ?? noop;\nexport const count = _console?.count ?? noop;\nexport const countReset = _console?.countReset ?? noop;\nexport const dir = _console?.dir ?? noop;\nexport const dirxml = _console?.dirxml ?? noop;\nexport const group = _console?.group ?? noop;\nexport const groupEnd = _console?.groupEnd ?? noop;\nexport const groupCollapsed = _console?.groupCollapsed ?? noop;\nexport const profile = _console?.profile ?? noop;\nexport const profileEnd = _console?.profileEnd ?? noop;\nexport const time = _console?.time ?? noop;\nexport const timeEnd = _console?.timeEnd ?? noop;\nexport const timeLog = _console?.timeLog ?? noop;\nexport const timeStamp = _console?.timeStamp ?? noop;\nexport const Console = _console?.Console ?? /* @__PURE__ */ notImplementedClass(\"console.Console\");\nexport const _times = /* @__PURE__ */ new Map();\nexport function context() {\n\t// TODO: Should be Console with all the methods\n\treturn _console;\n}\nexport const _stdoutErrorHandler = noop;\nexport const _stderrErrorHandler = noop;\nexport default {\n\t_times,\n\t_ignoreErrors,\n\t_stdoutErrorHandler,\n\t_stderrErrorHandler,\n\t_stdout,\n\t_stderr,\n\tassert,\n\tclear,\n\tConsole,\n\tcount,\n\tcountReset,\n\tdebug,\n\tdir,\n\tdirxml,\n\terror,\n\tcontext,\n\tcreateTask,\n\tgroup,\n\tgroupEnd,\n\tgroupCollapsed,\n\tinfo,\n\tlog,\n\tprofile,\n\tprofileEnd,\n\ttable,\n\ttime,\n\ttimeEnd,\n\ttimeLog,\n\ttimeStamp,\n\ttrace,\n\twarn\n};\n", "export default Object.assign(() => {}, { __unenv__: true });\n", "import {\n _ignoreErrors,\n _stderr,\n _stderrErrorHandler,\n _stdout,\n _stdoutErrorHandler,\n _times,\n Console\n} from \"unenv/node/console\";\nexport {\n Console,\n _ignoreErrors,\n _stderr,\n _stderrErrorHandler,\n _stdout,\n _stdoutErrorHandler,\n _times\n} from \"unenv/node/console\";\nconst workerdConsole = globalThis[\"console\"];\nexport const {\n assert,\n clear,\n // @ts-expect-error undocumented public API\n context,\n count,\n countReset,\n // @ts-expect-error undocumented public API\n createTask,\n debug,\n dir,\n dirxml,\n error,\n group,\n groupCollapsed,\n groupEnd,\n info,\n log,\n profile,\n profileEnd,\n table,\n time,\n timeEnd,\n timeLog,\n timeStamp,\n trace,\n warn\n} = workerdConsole;\nObject.assign(workerdConsole, {\n Console,\n _ignoreErrors,\n _stderr,\n _stderrErrorHandler,\n _stdout,\n _stdoutErrorHandler,\n _times\n});\nexport default workerdConsole;\n", "import { default as defaultExport } from \"@cloudflare/unenv-preset/node/console\";\nglobalThis.console = defaultExport;", "// https://nodejs.org/api/process.html#processhrtime\nexport const hrtime = /* @__PURE__ */ Object.assign(function hrtime(startTime) {\n\tconst now = Date.now();\n\t// millis to seconds\n\tconst seconds = Math.trunc(now / 1e3);\n\t// convert millis to nanos\n\tconst nanos = now % 1e3 * 1e6;\n\tif (startTime) {\n\t\tlet diffSeconds = seconds - startTime[0];\n\t\tlet diffNanos = nanos - startTime[0];\n\t\tif (diffNanos < 0) {\n\t\t\tdiffSeconds = diffSeconds - 1;\n\t\t\tdiffNanos = 1e9 + diffNanos;\n\t\t}\n\t\treturn [diffSeconds, diffNanos];\n\t}\n\treturn [seconds, nanos];\n}, { bigint: function bigint() {\n\t// Convert milliseconds to nanoseconds\n\treturn BigInt(Date.now() * 1e6);\n} });\n", "import { EventEmitter } from \"node:events\";\nimport { ReadStream, WriteStream } from \"node:tty\";\nimport { notImplemented, createNotImplementedError } from \"../../../_internal/utils.mjs\";\n// node-version.ts is generated at build time\nimport { NODE_VERSION } from \"./node-version.mjs\";\nexport class Process extends EventEmitter {\n\tenv;\n\thrtime;\n\tnextTick;\n\tconstructor(impl) {\n\t\tsuper();\n\t\tthis.env = impl.env;\n\t\tthis.hrtime = impl.hrtime;\n\t\tthis.nextTick = impl.nextTick;\n\t\tfor (const prop of [...Object.getOwnPropertyNames(Process.prototype), ...Object.getOwnPropertyNames(EventEmitter.prototype)]) {\n\t\t\tconst value = this[prop];\n\t\t\tif (typeof value === \"function\") {\n\t\t\t\tthis[prop] = value.bind(this);\n\t\t\t}\n\t\t}\n\t}\n\t// --- event emitter ---\n\temitWarning(warning, type, code) {\n\t\tconsole.warn(`${code ? `[${code}] ` : \"\"}${type ? `${type}: ` : \"\"}${warning}`);\n\t}\n\temit(...args) {\n\t\t// @ts-ignore\n\t\treturn super.emit(...args);\n\t}\n\tlisteners(eventName) {\n\t\treturn super.listeners(eventName);\n\t}\n\t// --- stdio (lazy initializers) ---\n\t#stdin;\n\t#stdout;\n\t#stderr;\n\tget stdin() {\n\t\treturn this.#stdin ??= new ReadStream(0);\n\t}\n\tget stdout() {\n\t\treturn this.#stdout ??= new WriteStream(1);\n\t}\n\tget stderr() {\n\t\treturn this.#stderr ??= new WriteStream(2);\n\t}\n\t// --- cwd ---\n\t#cwd = \"/\";\n\tchdir(cwd) {\n\t\tthis.#cwd = cwd;\n\t}\n\tcwd() {\n\t\treturn this.#cwd;\n\t}\n\t// --- dummy props and getters ---\n\tarch = \"\";\n\tplatform = \"\";\n\targv = [];\n\targv0 = \"\";\n\texecArgv = [];\n\texecPath = \"\";\n\ttitle = \"\";\n\tpid = 200;\n\tppid = 100;\n\tget version() {\n\t\treturn `v${NODE_VERSION}`;\n\t}\n\tget versions() {\n\t\treturn { node: NODE_VERSION };\n\t}\n\tget allowedNodeEnvironmentFlags() {\n\t\treturn new Set();\n\t}\n\tget sourceMapsEnabled() {\n\t\treturn false;\n\t}\n\tget debugPort() {\n\t\treturn 0;\n\t}\n\tget throwDeprecation() {\n\t\treturn false;\n\t}\n\tget traceDeprecation() {\n\t\treturn false;\n\t}\n\tget features() {\n\t\treturn {};\n\t}\n\tget release() {\n\t\treturn {};\n\t}\n\tget connected() {\n\t\treturn false;\n\t}\n\tget config() {\n\t\treturn {};\n\t}\n\tget moduleLoadList() {\n\t\treturn [];\n\t}\n\tconstrainedMemory() {\n\t\treturn 0;\n\t}\n\tavailableMemory() {\n\t\treturn 0;\n\t}\n\tuptime() {\n\t\treturn 0;\n\t}\n\tresourceUsage() {\n\t\treturn {};\n\t}\n\t// --- noop methods ---\n\tref() {\n\t\t// noop\n\t}\n\tunref() {\n\t\t// noop\n\t}\n\t// --- unimplemented methods ---\n\tumask() {\n\t\tthrow createNotImplementedError(\"process.umask\");\n\t}\n\tgetBuiltinModule() {\n\t\treturn undefined;\n\t}\n\tgetActiveResourcesInfo() {\n\t\tthrow createNotImplementedError(\"process.getActiveResourcesInfo\");\n\t}\n\texit() {\n\t\tthrow createNotImplementedError(\"process.exit\");\n\t}\n\treallyExit() {\n\t\tthrow createNotImplementedError(\"process.reallyExit\");\n\t}\n\tkill() {\n\t\tthrow createNotImplementedError(\"process.kill\");\n\t}\n\tabort() {\n\t\tthrow createNotImplementedError(\"process.abort\");\n\t}\n\tdlopen() {\n\t\tthrow createNotImplementedError(\"process.dlopen\");\n\t}\n\tsetSourceMapsEnabled() {\n\t\tthrow createNotImplementedError(\"process.setSourceMapsEnabled\");\n\t}\n\tloadEnvFile() {\n\t\tthrow createNotImplementedError(\"process.loadEnvFile\");\n\t}\n\tdisconnect() {\n\t\tthrow createNotImplementedError(\"process.disconnect\");\n\t}\n\tcpuUsage() {\n\t\tthrow createNotImplementedError(\"process.cpuUsage\");\n\t}\n\tsetUncaughtExceptionCaptureCallback() {\n\t\tthrow createNotImplementedError(\"process.setUncaughtExceptionCaptureCallback\");\n\t}\n\thasUncaughtExceptionCaptureCallback() {\n\t\tthrow createNotImplementedError(\"process.hasUncaughtExceptionCaptureCallback\");\n\t}\n\tinitgroups() {\n\t\tthrow createNotImplementedError(\"process.initgroups\");\n\t}\n\topenStdin() {\n\t\tthrow createNotImplementedError(\"process.openStdin\");\n\t}\n\tassert() {\n\t\tthrow createNotImplementedError(\"process.assert\");\n\t}\n\tbinding() {\n\t\tthrow createNotImplementedError(\"process.binding\");\n\t}\n\t// --- attached interfaces ---\n\tpermission = { has: /* @__PURE__ */ notImplemented(\"process.permission.has\") };\n\treport = {\n\t\tdirectory: \"\",\n\t\tfilename: \"\",\n\t\tsignal: \"SIGUSR2\",\n\t\tcompact: false,\n\t\treportOnFatalError: false,\n\t\treportOnSignal: false,\n\t\treportOnUncaughtException: false,\n\t\tgetReport: /* @__PURE__ */ notImplemented(\"process.report.getReport\"),\n\t\twriteReport: /* @__PURE__ */ notImplemented(\"process.report.writeReport\")\n\t};\n\tfinalization = {\n\t\tregister: /* @__PURE__ */ notImplemented(\"process.finalization.register\"),\n\t\tunregister: /* @__PURE__ */ notImplemented(\"process.finalization.unregister\"),\n\t\tregisterBeforeExit: /* @__PURE__ */ notImplemented(\"process.finalization.registerBeforeExit\")\n\t};\n\tmemoryUsage = Object.assign(() => ({\n\t\tarrayBuffers: 0,\n\t\trss: 0,\n\t\texternal: 0,\n\t\theapTotal: 0,\n\t\theapUsed: 0\n\t}), { rss: () => 0 });\n\t// --- undefined props ---\n\tmainModule = undefined;\n\tdomain = undefined;\n\t// optional\n\tsend = undefined;\n\texitCode = undefined;\n\tchannel = undefined;\n\tgetegid = undefined;\n\tgeteuid = undefined;\n\tgetgid = undefined;\n\tgetgroups = undefined;\n\tgetuid = undefined;\n\tsetegid = undefined;\n\tseteuid = undefined;\n\tsetgid = undefined;\n\tsetgroups = undefined;\n\tsetuid = undefined;\n\t// internals\n\t_events = undefined;\n\t_eventsCount = undefined;\n\t_exiting = undefined;\n\t_maxListeners = undefined;\n\t_debugEnd = undefined;\n\t_debugProcess = undefined;\n\t_fatalException = undefined;\n\t_getActiveHandles = undefined;\n\t_getActiveRequests = undefined;\n\t_kill = undefined;\n\t_preload_modules = undefined;\n\t_rawDebug = undefined;\n\t_startProfilerIdleNotifier = undefined;\n\t_stopProfilerIdleNotifier = undefined;\n\t_tickCallback = undefined;\n\t_disconnect = undefined;\n\t_handleQueue = undefined;\n\t_pendingMessage = undefined;\n\t_channel = undefined;\n\t_send = undefined;\n\t_linkedBinding = undefined;\n}\n", "export class ReadStream {\n\tfd;\n\tisRaw = false;\n\tisTTY = false;\n\tconstructor(fd) {\n\t\tthis.fd = fd;\n\t}\n\tsetRawMode(mode) {\n\t\tthis.isRaw = mode;\n\t\treturn this;\n\t}\n}\n", "export class WriteStream {\n\tfd;\n\tcolumns = 80;\n\trows = 24;\n\tisTTY = false;\n\tconstructor(fd) {\n\t\tthis.fd = fd;\n\t}\n\tclearLine(dir, callback) {\n\t\tcallback && callback();\n\t\treturn false;\n\t}\n\tclearScreenDown(callback) {\n\t\tcallback && callback();\n\t\treturn false;\n\t}\n\tcursorTo(x, y, callback) {\n\t\tcallback && typeof callback === \"function\" && callback();\n\t\treturn false;\n\t}\n\tmoveCursor(dx, dy, callback) {\n\t\tcallback && callback();\n\t\treturn false;\n\t}\n\tgetColorDepth(env) {\n\t\treturn 1;\n\t}\n\thasColors(count, env) {\n\t\treturn false;\n\t}\n\tgetWindowSize() {\n\t\treturn [this.columns, this.rows];\n\t}\n\twrite(str, encoding, cb) {\n\t\tif (str instanceof Uint8Array) {\n\t\t\tstr = new TextDecoder().decode(str);\n\t\t}\n\t\ttry {\n\t\t\tconsole.log(str);\n\t\t} catch {}\n\t\tcb && typeof cb === \"function\" && cb();\n\t\treturn false;\n\t}\n}\n", "// Extracted from .nvmrc\nexport const NODE_VERSION = \"22.14.0\";\n", "import { hrtime as UnenvHrTime } from \"unenv/node/internal/process/hrtime\";\nimport { Process as UnenvProcess } from \"unenv/node/internal/process/process\";\nconst globalProcess = globalThis[\"process\"];\nexport const getBuiltinModule = globalProcess.getBuiltinModule;\nconst workerdProcess = getBuiltinModule(\"node:process\");\nconst unenvProcess = new UnenvProcess({\n env: globalProcess.env,\n hrtime: UnenvHrTime,\n // `nextTick` is available from workerd process v1\n nextTick: workerdProcess.nextTick\n});\nexport const { exit, features, platform } = workerdProcess;\nexport const {\n _channel,\n _debugEnd,\n _debugProcess,\n _disconnect,\n _events,\n _eventsCount,\n _exiting,\n _fatalException,\n _getActiveHandles,\n _getActiveRequests,\n _handleQueue,\n _kill,\n _linkedBinding,\n _maxListeners,\n _pendingMessage,\n _preload_modules,\n _rawDebug,\n _send,\n _startProfilerIdleNotifier,\n _stopProfilerIdleNotifier,\n _tickCallback,\n abort,\n addListener,\n allowedNodeEnvironmentFlags,\n arch,\n argv,\n argv0,\n assert,\n availableMemory,\n binding,\n channel,\n chdir,\n config,\n connected,\n constrainedMemory,\n cpuUsage,\n cwd,\n debugPort,\n disconnect,\n dlopen,\n domain,\n emit,\n emitWarning,\n env,\n eventNames,\n execArgv,\n execPath,\n exitCode,\n finalization,\n getActiveResourcesInfo,\n getegid,\n geteuid,\n getgid,\n getgroups,\n getMaxListeners,\n getuid,\n hasUncaughtExceptionCaptureCallback,\n hrtime,\n initgroups,\n kill,\n listenerCount,\n listeners,\n loadEnvFile,\n mainModule,\n memoryUsage,\n moduleLoadList,\n nextTick,\n off,\n on,\n once,\n openStdin,\n permission,\n pid,\n ppid,\n prependListener,\n prependOnceListener,\n rawListeners,\n reallyExit,\n ref,\n release,\n removeAllListeners,\n removeListener,\n report,\n resourceUsage,\n send,\n setegid,\n seteuid,\n setgid,\n setgroups,\n setMaxListeners,\n setSourceMapsEnabled,\n setuid,\n setUncaughtExceptionCaptureCallback,\n sourceMapsEnabled,\n stderr,\n stdin,\n stdout,\n throwDeprecation,\n title,\n traceDeprecation,\n umask,\n unref,\n uptime,\n version,\n versions\n} = unenvProcess;\nconst _process = {\n abort,\n addListener,\n allowedNodeEnvironmentFlags,\n hasUncaughtExceptionCaptureCallback,\n setUncaughtExceptionCaptureCallback,\n loadEnvFile,\n sourceMapsEnabled,\n arch,\n argv,\n argv0,\n chdir,\n config,\n connected,\n constrainedMemory,\n availableMemory,\n cpuUsage,\n cwd,\n debugPort,\n dlopen,\n disconnect,\n emit,\n emitWarning,\n env,\n eventNames,\n execArgv,\n execPath,\n exit,\n finalization,\n features,\n getBuiltinModule,\n getActiveResourcesInfo,\n getMaxListeners,\n hrtime,\n kill,\n listeners,\n listenerCount,\n memoryUsage,\n nextTick,\n on,\n off,\n once,\n pid,\n platform,\n ppid,\n prependListener,\n prependOnceListener,\n rawListeners,\n release,\n removeAllListeners,\n removeListener,\n report,\n resourceUsage,\n setMaxListeners,\n setSourceMapsEnabled,\n stderr,\n stdin,\n stdout,\n title,\n throwDeprecation,\n traceDeprecation,\n umask,\n uptime,\n version,\n versions,\n // @ts-expect-error old API\n domain,\n initgroups,\n moduleLoadList,\n reallyExit,\n openStdin,\n assert,\n binding,\n send,\n exitCode,\n channel,\n getegid,\n geteuid,\n getgid,\n getgroups,\n getuid,\n setegid,\n seteuid,\n setgid,\n setgroups,\n setuid,\n permission,\n mainModule,\n _events,\n _eventsCount,\n _exiting,\n _maxListeners,\n _debugEnd,\n _debugProcess,\n _fatalException,\n _getActiveHandles,\n _getActiveRequests,\n _kill,\n _preload_modules,\n _rawDebug,\n _startProfilerIdleNotifier,\n _stopProfilerIdleNotifier,\n _tickCallback,\n _disconnect,\n _handleQueue,\n _pendingMessage,\n _channel,\n _send,\n _linkedBinding\n};\nexport default _process;\n", "import { default as defaultExport } from \"@cloudflare/unenv-preset/node/process\";\nglobalThis.process = defaultExport;", "//#region src/calculatePagination.ts\n/**\n* Calculate pagination information based on total count, limit, and offset\n*/\nfunction calculatePagination(total, options) {\n\tconst { limit, offset } = options;\n\tif (total === 0) return {\n\t\ttotal: 0,\n\t\thasNextPage: false,\n\t\thasPreviousPage: false,\n\t\tcurrentPage: 1,\n\t\ttotalPages: 0\n\t};\n\tconst currentPage = Math.floor(offset / limit) + 1;\n\tconst totalPages = Math.ceil(total / limit);\n\treturn {\n\t\ttotal,\n\t\thasNextPage: offset + limit < total,\n\t\thasPreviousPage: offset > 0,\n\t\tcurrentPage,\n\t\ttotalPages\n\t};\n}\n//#endregion\nexport { calculatePagination };\n", "//#region src/contentAddressedAssets.ts\nconst CONTENT_ADDRESSED_ASSET_PREFIX = \"assets\";\nconst getContentAddressedAssetStoragePath = ({ assetPath, fileHash }) => {\n\tconst extension = assetPath.endsWith(\".br\") ? \".br\" : assetPath.includes(\".\") ? `.${assetPath.split(\".\").pop()}` : \"\";\n\treturn `sha256/${fileHash.slice(0, 2)}/${fileHash}${extension}`;\n};\n//#endregion\nexport { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath };\n", "//#region src/legacyAssetStorageLayout.ts\n/**\n* @internal\n*\n* Legacy manifest assets were stored below each bundle's `/files` directory\n* using their manifest-relative path. Keep all old-layout path decisions here\n* so support can be removed by deleting this module and the entrypoint branch\n* that imports it.\n*/\nconst getLegacyManifestAssetStoragePath = ({ assetPath }) => assetPath;\n//#endregion\nexport { getLegacyManifestAssetStoragePath };\n", "import { getContentAddressedAssetStoragePath } from \"./contentAddressedAssets.mjs\";\nimport { getLegacyManifestAssetStoragePath } from \"./legacyAssetStorageLayout.mjs\";\n//#region src/assetStorageLayout.ts\nconst isBrotliManifestAssetPath = (assetPath) => /(^|\\/)index\\.[^/]+\\.bundle$/.test(assetPath.replace(/\\\\/g, \"/\"));\nconst getManifestAssetDownloadPath = (assetPath) => isBrotliManifestAssetPath(assetPath) ? `${assetPath}.br` : assetPath;\nconst createStorageUriWithRelativePath = ({ baseStorageUri, relativePath }) => {\n\tconst storageUrl = new URL(baseStorageUri);\n\tstorageUrl.pathname = `${storageUrl.pathname.replace(/\\/+$/, \"\")}/${relativePath.replace(/\\\\/g, \"/\").split(\"/\").filter(Boolean).map((segment) => encodeURIComponent(segment)).join(\"/\")}`;\n\treturn storageUrl.toString();\n};\nconst getAssetStorageLayout = (assetBaseStorageUri) => {\n\tconst pathname = new URL(assetBaseStorageUri).pathname.replace(/\\/+$/, \"\");\n\treturn pathname.endsWith(\"/assets\") || pathname === \"/assets\" ? \"content-addressed\" : \"legacy-files\";\n};\nconst isContentAddressedAssetBaseStorageUri = (assetBaseStorageUri) => getAssetStorageLayout(assetBaseStorageUri) === \"content-addressed\";\nconst getManifestAssetStoragePath = ({ assetBaseStorageUri, assetPath, fileHash }) => {\n\tif (getAssetStorageLayout(assetBaseStorageUri) === \"content-addressed\") return getContentAddressedAssetStoragePath({\n\t\tassetPath,\n\t\tfileHash\n\t});\n\treturn getLegacyManifestAssetStoragePath({ assetPath });\n};\nconst resolveManifestAssetStorageUri = ({ assetBaseStorageUri, assetPath, fileHash }) => createStorageUriWithRelativePath({\n\tbaseStorageUri: assetBaseStorageUri,\n\trelativePath: getManifestAssetStoragePath({\n\t\tassetBaseStorageUri,\n\t\tassetPath,\n\t\tfileHash\n\t})\n});\n//#endregion\nexport { createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };\n", "//#region src/queryBundles.ts\nconst compareValue = (value, expected, comparator) => {\n\tif (expected === void 0) return true;\n\tswitch (comparator) {\n\t\tcase \"eq\": return value === expected;\n\t\tcase \"gt\": return value.localeCompare(expected) > 0;\n\t\tcase \"gte\": return value.localeCompare(expected) >= 0;\n\t\tcase \"lt\": return value.localeCompare(expected) < 0;\n\t\tcase \"lte\": return value.localeCompare(expected) <= 0;\n\t}\n};\nfunction bundleIdMatchesFilter(id, filter) {\n\tif (!filter) return true;\n\tif (filter.in && !filter.in.includes(id)) return false;\n\treturn compareValue(id, filter.eq, \"eq\") && compareValue(id, filter.gt, \"gt\") && compareValue(id, filter.gte, \"gte\") && compareValue(id, filter.lt, \"lt\") && compareValue(id, filter.lte, \"lte\");\n}\nfunction bundleMatchesQueryWhere(bundle, where) {\n\tif (!where) return true;\n\tif (where.channel !== void 0 && bundle.channel !== where.channel) return false;\n\tif (where.platform !== void 0 && bundle.platform !== where.platform) return false;\n\tif (where.enabled !== void 0 && bundle.enabled !== where.enabled) return false;\n\tif (!bundleIdMatchesFilter(bundle.id, where.id)) return false;\n\tif (where.targetAppVersionNotNull === true && bundle.targetAppVersion === null) return false;\n\tif (where.targetAppVersion !== void 0 && bundle.targetAppVersion !== where.targetAppVersion) return false;\n\tif (where.targetAppVersionIn && !where.targetAppVersionIn.includes(bundle.targetAppVersion ?? \"\")) return false;\n\tif (where.fingerprintHash !== void 0 && bundle.fingerprintHash !== where.fingerprintHash) return false;\n\treturn true;\n}\nfunction sortBundles(bundles, orderBy) {\n\tconst direction = orderBy?.direction ?? \"desc\";\n\tif (orderBy && orderBy.field !== \"id\") return bundles;\n\treturn bundles.slice().sort((a, b) => {\n\t\tconst result = a.id.localeCompare(b.id);\n\t\treturn direction === \"asc\" ? result : -result;\n\t});\n}\n//#endregion\nexport { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles };\n", "import { bundleMatchesQueryWhere, sortBundles } from \"./queryBundles.mjs\";\n//#region src/bundleUnitOfWork.ts\nconst resolveEntryValue = (entry) => entry.kind === \"present\" ? entry.bundle : null;\nvar BundleUnitOfWork = class {\n\tentries = /* @__PURE__ */ new Map();\n\tpendingLoads = /* @__PURE__ */ new Map();\n\tchanges = /* @__PURE__ */ new Map();\n\tseededIds = /* @__PURE__ */ new Set();\n\tseed(seeds) {\n\t\tfor (const seed of seeds) {\n\t\t\tif (!seed) continue;\n\t\t\tthis.seededIds.add(seed.id);\n\t\t\tif (!this.changes.has(seed.id)) this.entries.set(seed.id, {\n\t\t\t\tkind: \"present\",\n\t\t\t\tbundle: seed\n\t\t\t});\n\t\t}\n\t}\n\thasSeeds() {\n\t\treturn this.seededIds.size > 0;\n\t}\n\tseededBundles() {\n\t\tconst bundles = [];\n\t\tfor (const bundleId of this.seededIds) {\n\t\t\tconst entry = this.entries.get(bundleId);\n\t\t\tif (entry?.kind === \"present\") bundles.push(entry.bundle);\n\t\t}\n\t\treturn bundles;\n\t}\n\tpeek(bundleId) {\n\t\tconst entry = this.entries.get(bundleId);\n\t\tif (entry?.kind === \"present\") return entry.bundle;\n\t\treturn null;\n\t}\n\tpeekChanged(bundleId) {\n\t\tif (!this.changes.has(bundleId)) return { found: false };\n\t\tconst entry = this.entries.get(bundleId);\n\t\treturn {\n\t\t\tfound: true,\n\t\t\tvalue: entry ? resolveEntryValue(entry) : null\n\t\t};\n\t}\n\tasync getById(bundleId, loadBundleById) {\n\t\tconst entry = this.entries.get(bundleId);\n\t\tif (entry) return resolveEntryValue(entry);\n\t\tconst pendingLoad = this.pendingLoads.get(bundleId);\n\t\tif (pendingLoad) return pendingLoad;\n\t\tconst load = loadBundleById().then((bundle) => {\n\t\t\tthis.pendingLoads.delete(bundleId);\n\t\t\tconst currentEntry = this.entries.get(bundleId);\n\t\t\tif (currentEntry) return resolveEntryValue(currentEntry);\n\t\t\tthis.entries.set(bundleId, bundle ? {\n\t\t\t\tkind: \"present\",\n\t\t\t\tbundle\n\t\t\t} : { kind: \"missing\" });\n\t\t\treturn bundle;\n\t\t}, (error) => {\n\t\t\tthis.pendingLoads.delete(bundleId);\n\t\t\tthrow error;\n\t\t});\n\t\tthis.pendingLoads.set(bundleId, load);\n\t\treturn load;\n\t}\n\toverlayList(bundles, options) {\n\t\tconst dataById = /* @__PURE__ */ new Map();\n\t\tfor (const bundle of bundles) {\n\t\t\tconst entry = this.entries.get(bundle.id);\n\t\t\tif (entry?.kind === \"deleted\") continue;\n\t\t\tif (entry?.kind === \"present\") {\n\t\t\t\tif (bundleMatchesQueryWhere(entry.bundle, options.where)) dataById.set(entry.bundle.id, entry.bundle);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.entries.set(bundle.id, {\n\t\t\t\tkind: \"present\",\n\t\t\t\tbundle\n\t\t\t});\n\t\t\tdataById.set(bundle.id, bundle);\n\t\t}\n\t\tfor (const change of this.changes.values()) {\n\t\t\tif (change.operation === \"delete\" || change.operation === \"insert\") {\n\t\t\t\tdataById.delete(change.data.id);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (bundleMatchesQueryWhere(change.data, options.where)) dataById.set(change.data.id, change.data);\n\t\t\telse dataById.delete(change.data.id);\n\t\t}\n\t\treturn sortBundles(Array.from(dataById.values()), options.orderBy).slice(0, options.limit);\n\t}\n\tmarkInsert(bundle) {\n\t\tthis.entries.set(bundle.id, {\n\t\t\tkind: \"present\",\n\t\t\tbundle\n\t\t});\n\t\tthis.changes.set(bundle.id, {\n\t\t\toperation: \"insert\",\n\t\t\tdata: bundle,\n\t\t\tbefore: null\n\t\t});\n\t}\n\tmarkUpdate(bundle) {\n\t\tconst previousChange = this.changes.get(bundle.id);\n\t\tconst previousEntry = this.entries.get(bundle.id);\n\t\tconst operation = previousChange?.operation ?? \"update\";\n\t\tthis.entries.set(bundle.id, {\n\t\t\tkind: \"present\",\n\t\t\tbundle\n\t\t});\n\t\tthis.changes.set(bundle.id, {\n\t\t\toperation,\n\t\t\tdata: bundle,\n\t\t\tbefore: previousChange?.before ?? (previousEntry ? resolveEntryValue(previousEntry) : null)\n\t\t});\n\t}\n\tmarkDelete(bundle) {\n\t\tconst previousChange = this.changes.get(bundle.id);\n\t\tconst previousEntry = this.entries.get(bundle.id);\n\t\tthis.entries.set(bundle.id, {\n\t\t\tkind: \"deleted\",\n\t\t\tbundle\n\t\t});\n\t\tthis.changes.set(bundle.id, {\n\t\t\toperation: \"delete\",\n\t\t\tdata: bundle,\n\t\t\tbefore: previousChange?.before ?? (previousEntry ? resolveEntryValue(previousEntry) : bundle)\n\t\t});\n\t}\n\tchangedSets() {\n\t\treturn Array.from(this.changes.values(), ({ data, operation }) => ({\n\t\t\toperation,\n\t\t\tdata\n\t\t}));\n\t}\n\thasChanges() {\n\t\treturn this.changes.size > 0;\n\t}\n\tlistFetchExtraCount() {\n\t\treturn Array.from(this.changes.values()).filter((change) => change.operation === \"update\" || change.operation === \"delete\").length;\n\t}\n\ttotalDelta(where) {\n\t\tlet total = 0;\n\t\tfor (const change of this.changes.values()) {\n\t\t\tif (change.operation === \"insert\") continue;\n\t\t\tconst matchedBefore = change.before !== null && bundleMatchesQueryWhere(change.before, where);\n\t\t\tconst matchesAfter = change.operation === \"update\" && bundleMatchesQueryWhere(change.data, where);\n\t\t\tif (matchedBefore && !matchesAfter) total -= 1;\n\t\t\telse if (!matchedBefore && matchesAfter) total += 1;\n\t\t}\n\t\treturn total;\n\t}\n\tclear() {\n\t\tthis.entries.clear();\n\t\tthis.pendingLoads.clear();\n\t\tthis.changes.clear();\n\t\tthis.seededIds.clear();\n\t}\n};\n//#endregion\nexport { BundleUnitOfWork };\n", "import { BundleUnitOfWork } from \"./bundleUnitOfWork.mjs\";\n//#region src/bundleUnitOfWorkStore.ts\nconst requestUnitOfWorks = /* @__PURE__ */ new WeakMap();\nconst isUnitOfWorkContext = (value) => typeof value === \"object\" && value !== null || typeof value === \"function\";\nconst getRequestBundleUnitOfWork = (context) => {\n\tif (!isUnitOfWorkContext(context)) return null;\n\tlet unitOfWork = requestUnitOfWorks.get(context);\n\tif (!unitOfWork) {\n\t\tunitOfWork = new BundleUnitOfWork();\n\t\trequestUnitOfWorks.set(context, unitOfWork);\n\t}\n\treturn unitOfWork;\n};\n//#endregion\nexport { getRequestBundleUnitOfWork };\n", "//#region src/predicate/isPlainObject.ts\n/**\n* Checks if a given value is a plain object.\n*\n* @param {object} value - The value to check.\n* @returns {value is Record<PropertyKey, any>} - True if the value is a plain object, otherwise false.\n*\n* @example\n* ```typescript\n* // \u2705\uD83D\uDC47 True\n*\n* isPlainObject({ }); // \u2705\n* isPlainObject({ key: 'value' }); // \u2705\n* isPlainObject({ key: new Date() }); // \u2705\n* isPlainObject(new Object()); // \u2705\n* isPlainObject(Object.create(null)); // \u2705\n* isPlainObject({ nested: { key: true} }); // \u2705\n* isPlainObject(new Proxy({}, {})); // \u2705\n* isPlainObject({ [Symbol('tag')]: 'A' }); // \u2705\n*\n* // \u2705\uD83D\uDC47 (cross-realms, node context, workers, ...)\n* const runInNewContext = await import('node:vm').then(\n* (mod) => mod.runInNewContext\n* );\n* isPlainObject(runInNewContext('({})')); // \u2705\n*\n* // \u274C\uD83D\uDC47 False\n*\n* class Test { };\n* isPlainObject(new Test()) // \u274C\n* isPlainObject(10); // \u274C\n* isPlainObject(null); // \u274C\n* isPlainObject('hello'); // \u274C\n* isPlainObject([]); // \u274C\n* isPlainObject(new Date()); // \u274C\n* isPlainObject(new Uint8Array([1])); // \u274C\n* isPlainObject(Buffer.from('ABC')); // \u274C\n* isPlainObject(Promise.resolve({})); // \u274C\n* isPlainObject(Object.create({})); // \u274C\n* isPlainObject(new (class Cls {})); // \u274C\n* isPlainObject(globalThis); // \u274C,\n* ```\n*/\nfunction isPlainObject(value) {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst proto = Object.getPrototypeOf(value);\n\tif (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;\n\treturn Object.prototype.toString.call(value) === \"[object Object]\";\n}\n//#endregion\nexport { isPlainObject };\n", "//#region src/_internal/isUnsafeProperty.ts\n/**\n* Checks if a property key is unsafe to modify directly.\n*\n* This function is used in functions like `merge` to prevent prototype pollution attacks\n* by identifying property keys that could modify the object's prototype chain or constructor.\n*\n* @param key - The property key to check\n* @returns `true` if the property is unsafe to modify directly, `false` otherwise\n* @internal\n*/\nfunction isUnsafeProperty(key) {\n\treturn key === \"__proto__\";\n}\n//#endregion\nexport { isUnsafeProperty };\n", "import { isPlainObject } from \"../predicate/isPlainObject.mjs\";\nimport { isUnsafeProperty } from \"../_internal/isUnsafeProperty.mjs\";\n//#region src/object/mergeWith.ts\n/**\n* Merges the properties of the source object into the target object.\n*\n* You can provide a custom `merge` function to control how properties are merged. It should return the value to be set in the target object.\n*\n* If it returns `undefined`, a default deep merge will be applied for arrays and objects:\n*\n* - If a property in the source object is an array or an object and the corresponding property in the target object is also an array or object, they will be merged.\n* - If a property in the source object is undefined, it will not overwrite a defined property in the target object.\n*\n* Note that this function mutates the target object.\n*\n* @param {T} target - The target object into which the source object properties will be merged. This object is modified in place.\n* @param {S} source - The source object whose properties will be merged into the target object.\n* @param {(targetValue: any, sourceValue: any, key: string, target: T, source: S) => any} merge - A custom merge function that defines how properties should be combined. It receives the following arguments:\n* - `targetValue`: The current value of the property in the target object.\n* - `sourceValue`: The value of the property in the source object.\n* - `key`: The key of the property being merged.\n* - `target`: The target object.\n* - `source`: The source object.\n*\n* @returns {T & S} The updated target object with properties from the source object merged in.\n*\n* @template T - Type of the target object.\n* @template S - Type of the source object.\n*\n* @example\n* const target = { a: 1, b: 2 };\n* const source = { b: 3, c: 4 };\n*\n* mergeWith(target, source, (targetValue, sourceValue) => {\n* if (typeof targetValue === 'number' && typeof sourceValue === 'number') {\n* return targetValue + sourceValue;\n* }\n* });\n* // Returns { a: 1, b: 5, c: 4 }\n* @example\n* const target = { a: [1], b: [2] };\n* const source = { a: [3], b: [4] };\n*\n* const result = mergeWith(target, source, (objValue, srcValue) => {\n* if (Array.isArray(objValue)) {\n* return objValue.concat(srcValue);\n* }\n* });\n*\n* expect(result).toEqual({ a: [1, 3], b: [2, 4] });\n*/\nfunction mergeWith(target, source, merge) {\n\tconst sourceKeys = Object.keys(source);\n\tfor (let i = 0; i < sourceKeys.length; i++) {\n\t\tconst key = sourceKeys[i];\n\t\tif (isUnsafeProperty(key)) continue;\n\t\tconst sourceValue = source[key];\n\t\tconst targetValue = target[key];\n\t\tconst merged = merge(targetValue, sourceValue, key, target, source);\n\t\tif (merged !== void 0) target[key] = merged;\n\t\telse if (Array.isArray(sourceValue)) if (Array.isArray(targetValue)) target[key] = mergeWith(targetValue, sourceValue, merge);\n\t\telse target[key] = mergeWith([], sourceValue, merge);\n\t\telse if (isPlainObject(sourceValue)) if (isPlainObject(targetValue)) target[key] = mergeWith(targetValue, sourceValue, merge);\n\t\telse target[key] = mergeWith({}, sourceValue, merge);\n\t\telse if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;\n\t}\n\treturn target;\n}\n//#endregion\nexport { mergeWith };\n", "import { calculatePagination } from \"./calculatePagination.mjs\";\nimport { BundleUnitOfWork } from \"./bundleUnitOfWork.mjs\";\nimport { getRequestBundleUnitOfWork } from \"./bundleUnitOfWorkStore.mjs\";\nimport { mergeWith } from \"es-toolkit\";\n//#region src/createDatabasePlugin.ts\nconst REPLACE_ON_UPDATE_KEYS = [\"patches\", \"targetCohorts\"];\nconst DEFAULT_DESC_ORDER = {\n\tfield: \"id\",\n\tdirection: \"desc\"\n};\nfunction normalizePage(value) {\n\tif (!Number.isInteger(value) || value === void 0 || value < 1) return;\n\treturn value;\n}\nfunction mergeBundleUpdate(baseBundle, patch) {\n\treturn mergeWith({ ...baseBundle }, patch, (_targetValue, sourceValue, key) => {\n\t\tif (REPLACE_ON_UPDATE_KEYS.includes(key)) return sourceValue;\n\t});\n}\nfunction mergeIdFilter(base, patch) {\n\treturn {\n\t\t...base,\n\t\t...patch\n\t};\n}\nfunction mergeWhereWithIdFilter(where, idFilter) {\n\treturn {\n\t\t...where,\n\t\tid: mergeIdFilter(where?.id, idFilter)\n\t};\n}\nfunction buildCursorPageQuery(where, cursor, orderBy) {\n\tconst direction = orderBy.direction;\n\tif (cursor.after) return {\n\t\treverseData: false,\n\t\twhere: mergeWhereWithIdFilter(where, { [direction === \"desc\" ? \"lt\" : \"gt\"]: cursor.after }),\n\t\torderBy\n\t};\n\tif (cursor.before) return {\n\t\treverseData: true,\n\t\twhere: mergeWhereWithIdFilter(where, { [direction === \"desc\" ? \"gt\" : \"lt\"]: cursor.before }),\n\t\torderBy: {\n\t\t\tfield: orderBy.field,\n\t\t\tdirection: direction === \"desc\" ? \"asc\" : \"desc\"\n\t\t}\n\t};\n\treturn {\n\t\treverseData: false,\n\t\twhere: where ?? {},\n\t\torderBy\n\t};\n}\nfunction buildCountBeforeWhere(where, firstBundleId, orderBy) {\n\treturn mergeWhereWithIdFilter(where, { [orderBy.direction === \"desc\" ? \"gt\" : \"lt\"]: firstBundleId });\n}\nfunction createPaginatedResult(total, limit, startIndex, data) {\n\tconst pagination = calculatePagination(total, {\n\t\tlimit,\n\t\toffset: startIndex\n\t});\n\tconst nextCursor = data.length > 0 && startIndex + data.length < total ? data.at(-1)?.id : void 0;\n\tconst previousCursor = data.length > 0 && startIndex > 0 ? data[0]?.id : void 0;\n\treturn {\n\t\tdata,\n\t\tpagination: {\n\t\t\t...pagination,\n\t\t\t...nextCursor ? { nextCursor } : {},\n\t\t\t...previousCursor ? { previousCursor } : {}\n\t\t}\n\t};\n}\nfunction expandLimitForUnitOfWork(options, unitOfWork) {\n\tconst extraLimit = unitOfWork.listFetchExtraCount();\n\tif (extraLimit === 0) return options;\n\treturn {\n\t\t...options,\n\t\tlimit: options.limit + extraLimit\n\t};\n}\nfunction adjustPaginationTotal(pagination, options) {\n\tif (options.totalDelta === 0) return pagination;\n\tconst total = Math.max(0, pagination.total + options.totalDelta);\n\tconst hasPreviousPage = pagination.currentPage > 1;\n\tconst hasNextPage = pagination.currentPage * options.limit < total;\n\treturn {\n\t\t...pagination,\n\t\ttotal,\n\t\thasNextPage,\n\t\thasPreviousPage,\n\t\ttotalPages: total === 0 ? 0 : Math.ceil(total / options.limit)\n\t};\n}\n/**\n* Creates a database plugin with lazy initialization and automatic hook execution.\n*\n* This factory function abstracts the double currying pattern used by all database plugins,\n* ensuring consistent lazy initialization behavior across different database providers.\n* Hooks are automatically executed at appropriate times without requiring manual invocation.\n*\n* @param options - Configuration options for the database plugin\n* @returns A double-curried function that lazily initializes the database plugin\n*\n* @example\n* ```typescript\n* export const postgres = createDatabasePlugin<PostgresConfig>({\n* name: \"postgres\",\n* factory: (config) => {\n* const db = new Kysely(config);\n* return {\n* async getBundleById(bundleId) { ... },\n* async getBundles(options) { ... },\n* async getChannels() { ... },\n* async commitBundle({ changedSets }) { ... }\n* };\n* }\n* });\n* ```\n*/\nfunction createDatabasePlugin(options) {\n\treturn (config, hooks) => {\n\t\tlet cachedMethods = null;\n\t\tconst getMethods = () => {\n\t\t\tif (!cachedMethods) cachedMethods = options.factory(config);\n\t\t\treturn cachedMethods;\n\t\t};\n\t\treturn () => {\n\t\t\tconst instanceMutationUnitOfWork = new BundleUnitOfWork();\n\t\t\tconst getRequestUnitOfWork = (context) => {\n\t\t\t\treturn getRequestBundleUnitOfWork(context);\n\t\t\t};\n\t\t\tconst getMutationUnitOfWork = (context) => {\n\t\t\t\treturn getRequestUnitOfWork(context) ?? instanceMutationUnitOfWork;\n\t\t\t};\n\t\t\tconst runGetBundles = async (options, context) => {\n\t\t\t\tif (context === void 0) return getMethods().getBundles(options);\n\t\t\t\treturn getMethods().getBundles(options, context);\n\t\t\t};\n\t\t\tconst getBundlesWithLegacyCursorFallback = async (options, context) => {\n\t\t\t\tconst orderBy = options.orderBy ?? DEFAULT_DESC_ORDER;\n\t\t\t\tconst baseWhere = options.where;\n\t\t\t\tconst total = (await runGetBundles({\n\t\t\t\t\twhere: baseWhere,\n\t\t\t\t\tlimit: 1,\n\t\t\t\t\toffset: 0,\n\t\t\t\t\torderBy\n\t\t\t\t}, context)).pagination.total;\n\t\t\t\tif (!options.cursor?.after && !options.cursor?.before) {\n\t\t\t\t\tconst firstPage = await runGetBundles({\n\t\t\t\t\t\twhere: baseWhere,\n\t\t\t\t\t\tlimit: options.limit,\n\t\t\t\t\t\toffset: 0,\n\t\t\t\t\t\torderBy\n\t\t\t\t\t}, context);\n\t\t\t\t\treturn createPaginatedResult(total, options.limit, 0, firstPage.data);\n\t\t\t\t}\n\t\t\t\tconst { where, orderBy: queryOrderBy, reverseData } = buildCursorPageQuery(baseWhere, options.cursor, orderBy);\n\t\t\t\tconst cursorPage = await runGetBundles({\n\t\t\t\t\twhere,\n\t\t\t\t\tlimit: options.limit,\n\t\t\t\t\toffset: 0,\n\t\t\t\t\torderBy: queryOrderBy\n\t\t\t\t}, context);\n\t\t\t\tconst data = reverseData ? cursorPage.data.slice().reverse() : cursorPage.data;\n\t\t\t\tif (data.length === 0) {\n\t\t\t\t\tconst emptyStartIndex = options.cursor.after ? total : 0;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata,\n\t\t\t\t\t\tpagination: {\n\t\t\t\t\t\t\t...calculatePagination(total, {\n\t\t\t\t\t\t\t\tlimit: options.limit,\n\t\t\t\t\t\t\t\toffset: emptyStartIndex\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t...options.cursor.after ? { previousCursor: options.cursor.after } : {},\n\t\t\t\t\t\t\t...options.cursor.before ? { nextCursor: options.cursor.before } : {}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst firstBundleId = data[0].id;\n\t\t\t\tconst countBeforeResult = await runGetBundles({\n\t\t\t\t\twhere: buildCountBeforeWhere(baseWhere, firstBundleId, orderBy),\n\t\t\t\t\tlimit: 1,\n\t\t\t\t\toffset: 0,\n\t\t\t\t\torderBy\n\t\t\t\t}, context);\n\t\t\t\treturn createPaginatedResult(total, options.limit, countBeforeResult.pagination.total, data);\n\t\t\t};\n\t\t\tconst plugin = {\n\t\t\t\tname: options.name,\n\t\t\t\tasync getBundleById(bundleId, context) {\n\t\t\t\t\tconst requestUnitOfWork = getRequestUnitOfWork(context);\n\t\t\t\t\tif (requestUnitOfWork) return requestUnitOfWork.getById(bundleId, () => getMethods().getBundleById(bundleId, context));\n\t\t\t\t\tconst pendingMutation = instanceMutationUnitOfWork.peekChanged(bundleId);\n\t\t\t\t\tif (pendingMutation.found) return pendingMutation.value;\n\t\t\t\t\treturn getMethods().getBundleById(bundleId);\n\t\t\t\t},\n\t\t\t\tasync getBundles(options, context) {\n\t\t\t\t\tif (typeof options === \"object\" && options !== null && \"offset\" in options && options.offset !== void 0) throw new Error(\"Bundle offset pagination has been removed. Use cursor.after or cursor.before instead.\");\n\t\t\t\t\tconst methods = getMethods();\n\t\t\t\t\tconst requestUnitOfWork = getRequestUnitOfWork(context);\n\t\t\t\t\tconst unitOfWork = requestUnitOfWork ?? instanceMutationUnitOfWork;\n\t\t\t\t\tconst shouldOverlay = requestUnitOfWork !== null || instanceMutationUnitOfWork.hasChanges();\n\t\t\t\t\tconst normalizedOptions = {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tpage: normalizePage(options.page),\n\t\t\t\t\t\torderBy: options.orderBy ?? DEFAULT_DESC_ORDER\n\t\t\t\t\t};\n\t\t\t\t\tconst overlayResult = (result) => ({\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tdata: unitOfWork.overlayList(result.data, {\n\t\t\t\t\t\t\tlimit: normalizedOptions.limit,\n\t\t\t\t\t\t\torderBy: normalizedOptions.orderBy,\n\t\t\t\t\t\t\twhere: normalizedOptions.where\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tpagination: adjustPaginationTotal(result.pagination, {\n\t\t\t\t\t\t\tlimit: normalizedOptions.limit,\n\t\t\t\t\t\t\ttotalDelta: unitOfWork.totalDelta(normalizedOptions.where)\n\t\t\t\t\t\t})\n\t\t\t\t\t});\n\t\t\t\t\tif (normalizedOptions.page !== void 0) {\n\t\t\t\t\t\tconst { page, ...pageOptions } = normalizedOptions;\n\t\t\t\t\t\tconst requestedOffset = (page - 1) * normalizedOptions.limit;\n\t\t\t\t\t\tconst fetchPageOptions = expandLimitForUnitOfWork(pageOptions, unitOfWork);\n\t\t\t\t\t\tlet pageResult = await runGetBundles({\n\t\t\t\t\t\t\t...fetchPageOptions,\n\t\t\t\t\t\t\toffset: requestedOffset\n\t\t\t\t\t\t}, context);\n\t\t\t\t\t\tconst total = pageResult.pagination.total;\n\t\t\t\t\t\tconst totalPages = total === 0 ? 0 : Math.ceil(total / normalizedOptions.limit);\n\t\t\t\t\t\tconst maxOffset = totalPages === 0 ? 0 : (Math.max(1, totalPages) - 1) * normalizedOptions.limit;\n\t\t\t\t\t\tconst resolvedOffset = Math.min(requestedOffset, maxOffset);\n\t\t\t\t\t\tif (resolvedOffset !== requestedOffset) pageResult = await runGetBundles({\n\t\t\t\t\t\t\t...fetchPageOptions,\n\t\t\t\t\t\t\toffset: resolvedOffset\n\t\t\t\t\t\t}, context);\n\t\t\t\t\t\tconst result = { ...createPaginatedResult(total, normalizedOptions.limit, resolvedOffset, pageResult.data) };\n\t\t\t\t\t\treturn shouldOverlay ? overlayResult(result) : result;\n\t\t\t\t\t}\n\t\t\t\t\tif (methods.supportsCursorPagination) {\n\t\t\t\t\t\tconst fetchOptions = expandLimitForUnitOfWork(normalizedOptions, unitOfWork);\n\t\t\t\t\t\tconst result = context === void 0 ? await methods.getBundles(fetchOptions) : await methods.getBundles(fetchOptions, context);\n\t\t\t\t\t\treturn shouldOverlay ? overlayResult(result) : result;\n\t\t\t\t\t}\n\t\t\t\t\tconst result = await getBundlesWithLegacyCursorFallback(shouldOverlay ? expandLimitForUnitOfWork(normalizedOptions, unitOfWork) : normalizedOptions, context);\n\t\t\t\t\treturn shouldOverlay ? overlayResult(result) : result;\n\t\t\t\t},\n\t\t\t\tasync getChannels(context) {\n\t\t\t\t\tif (context === void 0) return getMethods().getChannels();\n\t\t\t\t\treturn getMethods().getChannels(context);\n\t\t\t\t},\n\t\t\t\tasync onUnmount() {\n\t\t\t\t\tconst methods = getMethods();\n\t\t\t\t\tif (methods.onUnmount) return methods.onUnmount();\n\t\t\t\t},\n\t\t\t\tasync commitBundle(context) {\n\t\t\t\t\tconst methods = getMethods();\n\t\t\t\t\tconst unitOfWork = getMutationUnitOfWork(context);\n\t\t\t\t\tconst params = { changedSets: unitOfWork.changedSets() };\n\t\t\t\t\tif (context === void 0) await methods.commitBundle(params);\n\t\t\t\t\telse await methods.commitBundle(params, context);\n\t\t\t\t\tunitOfWork.clear();\n\t\t\t\t\tawait hooks?.onDatabaseUpdated?.();\n\t\t\t\t},\n\t\t\t\tasync updateBundle(targetBundleId, newBundle, context) {\n\t\t\t\t\tconst unitOfWork = getMutationUnitOfWork(context);\n\t\t\t\t\tconst currentBundle = await unitOfWork.getById(targetBundleId, () => context === void 0 ? getMethods().getBundleById(targetBundleId) : getMethods().getBundleById(targetBundleId, context));\n\t\t\t\t\tif (!currentBundle) throw new Error(\"targetBundleId not found\");\n\t\t\t\t\tconst updatedBundle = mergeBundleUpdate(currentBundle, newBundle);\n\t\t\t\t\tunitOfWork.markUpdate(updatedBundle);\n\t\t\t\t},\n\t\t\t\tasync appendBundle(inputBundle, context) {\n\t\t\t\t\tgetMutationUnitOfWork(context).markInsert(inputBundle);\n\t\t\t\t},\n\t\t\t\tasync deleteBundle(deleteBundle, context) {\n\t\t\t\t\tgetMutationUnitOfWork(context).markDelete(deleteBundle);\n\t\t\t\t}\n\t\t\t};\n\t\t\tObject.defineProperty(plugin, \"getUpdateInfo\", {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tget() {\n\t\t\t\t\tconst directGetUpdateInfo = getMethods().getUpdateInfo;\n\t\t\t\t\tif (!directGetUpdateInfo) {\n\t\t\t\t\t\tObject.defineProperty(plugin, \"getUpdateInfo\", {\n\t\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\t\tvalue: void 0\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst wrappedGetUpdateInfo = async (args, context) => {\n\t\t\t\t\t\tif (context === void 0) return directGetUpdateInfo(args);\n\t\t\t\t\t\treturn directGetUpdateInfo(args, context);\n\t\t\t\t\t};\n\t\t\t\t\tObject.defineProperty(plugin, \"getUpdateInfo\", {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tvalue: wrappedGetUpdateInfo\n\t\t\t\t\t});\n\t\t\t\t\treturn wrappedGetUpdateInfo;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn plugin;\n\t\t};\n\t};\n}\n//#endregion\nexport { createDatabasePlugin };\n", "//#region src/constants.ts\nconst SEMVER_SPEC_VERSION = \"2.0.0\";\nconst INCREMENT_TYPES = [\n\t\"major\",\n\t\"premajor\",\n\t\"minor\",\n\t\"preminor\",\n\t\"patch\",\n\t\"prepatch\",\n\t\"prerelease\",\n\t\"release\"\n];\nconst TRUNCATION_TYPES = [\n\t\"major\",\n\t\"premajor\",\n\t\"minor\",\n\t\"preminor\",\n\t\"patch\",\n\t\"prepatch\",\n\t\"prerelease\"\n];\n//#endregion\n//#region src/internal/patterns.ts\nconst LETTER_DASH_NUMBER = \"[a-zA-Z0-9-]\";\nconst NUMERIC_IDENTIFIER = String.raw`0|[1-9]\\d*`;\nconst NUMERIC_IDENTIFIER_LOOSE = String.raw`\\d+`;\nconst NON_NUMERIC_IDENTIFIER = String.raw`\\d*[a-zA-Z-]${LETTER_DASH_NUMBER}*`;\nconst MAIN_VERSION = String.raw`(${NUMERIC_IDENTIFIER})\\.(${NUMERIC_IDENTIFIER})\\.(${NUMERIC_IDENTIFIER})`;\nconst MAIN_VERSION_LOOSE = String.raw`(${NUMERIC_IDENTIFIER_LOOSE})\\.(${NUMERIC_IDENTIFIER_LOOSE})\\.(${NUMERIC_IDENTIFIER_LOOSE})`;\nconst PRERELEASE_IDENTIFIER = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER})`;\nconst PRERELEASE_IDENTIFIER_LOOSE = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER_LOOSE})`;\nconst PRERELEASE = String.raw`(?:-(${PRERELEASE_IDENTIFIER}(?:\\.${PRERELEASE_IDENTIFIER})*))`;\nconst PRERELEASE_LOOSE = String.raw`(?:-?(${PRERELEASE_IDENTIFIER_LOOSE}(?:\\.${PRERELEASE_IDENTIFIER_LOOSE})*))`;\nconst BUILD_IDENTIFIER = `${LETTER_DASH_NUMBER}+`;\nconst BUILD = String.raw`(?:\\+(${BUILD_IDENTIFIER}(?:\\.${BUILD_IDENTIFIER})*))`;\nconst FULL_PLAIN = `v?${MAIN_VERSION}${PRERELEASE}?${BUILD}?`;\nconst LOOSE_PLAIN = String.raw`[v=\\s]*${MAIN_VERSION_LOOSE}${PRERELEASE_LOOSE}?${BUILD}?`;\nconst GREATER_LESS_THAN = \"((?:<|>)?=?)\";\nconst XRANGE_IDENTIFIER = String.raw`${NUMERIC_IDENTIFIER}|x|X|\\*`;\nconst XRANGE_IDENTIFIER_LOOSE = String.raw`${NUMERIC_IDENTIFIER_LOOSE}|x|X|\\*`;\nconst XRANGE_PLAIN = String.raw`[v=\\s]*(${XRANGE_IDENTIFIER})(?:\\.(${XRANGE_IDENTIFIER})(?:\\.(${XRANGE_IDENTIFIER})(?:${PRERELEASE})?${BUILD}?)?)?`;\nconst XRANGE_PLAIN_LOOSE = String.raw`[v=\\s]*(${XRANGE_IDENTIFIER_LOOSE})(?:\\.(${XRANGE_IDENTIFIER_LOOSE})(?:\\.(${XRANGE_IDENTIFIER_LOOSE})(?:${PRERELEASE_LOOSE})?${BUILD}?)?)?`;\nconst LONE_TILDE = \"(?:~>?)\";\nconst LONE_CARET = String.raw`(?:\\^)`;\nconst COERCE_PLAIN = String.raw`(^|[^\\d])(\\d{1,${16}})(?:\\.(\\d{1,${16}}))?(?:\\.(\\d{1,${16}}))?`;\nconst COERCE = String.raw`${COERCE_PLAIN}(?:$|[^\\d])`;\nconst COERCE_FULL = String.raw`${COERCE_PLAIN}(?:${PRERELEASE})?(?:${BUILD})?(?:$|[^\\d])`;\nfunction makeSafeRegexSource(source) {\n\tconst replacements = [\n\t\t[String.raw`\\s`, 1],\n\t\t[String.raw`\\d`, 256],\n\t\t[LETTER_DASH_NUMBER, 250]\n\t];\n\tfor (const [token, maximum] of replacements) source = source.split(`${token}*`).join(`${token}{0,${maximum}}`).split(`${token}+`).join(`${token}{1,${maximum}}`);\n\treturn source;\n}\nfunction safeRegex(source, flags) {\n\treturn new RegExp(makeSafeRegexSource(source), flags);\n}\n//#endregion\n//#region src/identifiers.ts\nconst NUMERIC$1 = /^\\d+$/;\nfunction compareIdentifiers(left, right) {\n\tif (typeof left === \"number\" && typeof right === \"number\") return left === right ? 0 : left < right ? -1 : 1;\n\tconst leftNumeric = NUMERIC$1.test(String(left));\n\tconst rightNumeric = NUMERIC$1.test(String(right));\n\tconst normalizedLeft = leftNumeric ? Number(left) : left;\n\tconst normalizedRight = rightNumeric ? Number(right) : right;\n\treturn normalizedLeft === normalizedRight ? 0 : leftNumeric && !rightNumeric ? -1 : rightNumeric && !leftNumeric ? 1 : normalizedLeft < normalizedRight ? -1 : 1;\n}\nfunction compareIdentifiersReversed(left, right) {\n\treturn compareIdentifiers(right, left);\n}\n//#endregion\n//#region src/internal/version.ts\nconst FULL = safeRegex(`^${FULL_PLAIN}$`);\nconst LOOSE = safeRegex(`^${LOOSE_PLAIN}$`);\nconst PRERELEASE_EXACT = safeRegex(`^${PRERELEASE}$`);\nconst PRERELEASE_LOOSE_EXACT = safeRegex(`^${PRERELEASE_LOOSE}$`);\nconst COERCE_EXACT = safeRegex(COERCE);\nconst COERCE_FULL_EXACT = safeRegex(COERCE_FULL);\nconst NUMERIC = /^\\d+$/;\nfunction formatComparableVersion(version) {\n\tconst base = `${version.major}.${version.minor}.${version.patch}`;\n\treturn version.prerelease?.length ? `${base}-${version.prerelease.join(\".\")}` : base;\n}\nfunction formatFullVersion(version) {\n\tconst comparable = formatComparableVersion(version);\n\treturn version.build?.length ? `${comparable}+${version.build.join(\".\")}` : comparable;\n}\nfunction parse(version, options = {}) {\n\tif (typeof version !== \"string\") return version;\n\tif (version.length > 256) throw new TypeError(`Version exceeds the maximum length of 256 characters`);\n\tconst match = version.trim().match(options.loose ? LOOSE : FULL);\n\tif (!match) throw new TypeError(`Invalid version syntax: ${version}`);\n\tconst major = Number(match[1]);\n\tconst minor = Number(match[2]);\n\tconst patch = Number(match[3]);\n\tif (major > Number.MAX_SAFE_INTEGER || major < 0) throw new TypeError(`Invalid major version: ${match[1]}`);\n\tif (minor > Number.MAX_SAFE_INTEGER || minor < 0) throw new TypeError(`Invalid minor version: ${match[2]}`);\n\tif (patch > Number.MAX_SAFE_INTEGER || patch < 0) throw new TypeError(`Invalid patch version: ${match[3]}`);\n\tconst prerelease = match[4] ? match[4].split(\".\").map((identifier) => {\n\t\tif (NUMERIC.test(identifier)) {\n\t\t\tconst numeric = Number(identifier);\n\t\t\tif (numeric >= 0 && numeric < Number.MAX_SAFE_INTEGER) return numeric;\n\t\t}\n\t\treturn identifier;\n\t}) : void 0;\n\treturn {\n\t\tbuild: match[5]?.split(\".\"),\n\t\tmajor,\n\t\tminor,\n\t\tpatch,\n\t\tprerelease\n\t};\n}\nfunction tryParse(version, options = {}) {\n\ttry {\n\t\treturn parse(version, options);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction compareMainParsed(left, right) {\n\treturn left.major === right.major ? left.minor === right.minor ? left.patch === right.patch ? 0 : left.patch < right.patch ? -1 : 1 : left.minor < right.minor ? -1 : 1 : left.major < right.major ? -1 : 1;\n}\nfunction comparePrereleaseParsed(left, right) {\n\tconst leftPrerelease = left.prerelease;\n\tconst rightPrerelease = right.prerelease;\n\tif (leftPrerelease?.length && !rightPrerelease?.length) return -1;\n\tif (!leftPrerelease?.length && rightPrerelease?.length) return 1;\n\tif (!leftPrerelease?.length && !rightPrerelease?.length) return 0;\n\tfor (let index = 0;; index++) {\n\t\tconst leftIdentifier = leftPrerelease?.[index];\n\t\tconst rightIdentifier = rightPrerelease?.[index];\n\t\tif (leftIdentifier === void 0 && rightIdentifier === void 0) return 0;\n\t\tif (rightIdentifier === void 0) return 1;\n\t\tif (leftIdentifier === void 0) return -1;\n\t\tif (leftIdentifier !== rightIdentifier) return compareIdentifiers(leftIdentifier, rightIdentifier);\n\t}\n}\nfunction compareParsed(left, right) {\n\treturn compareMainParsed(left, right) || comparePrereleaseParsed(left, right);\n}\nfunction compareBuildParsed(left, right) {\n\tconst precedence = compareParsed(left, right);\n\tif (precedence !== 0) return precedence;\n\tfor (let index = 0;; index++) {\n\t\tconst leftIdentifier = left.build?.[index];\n\t\tconst rightIdentifier = right.build?.[index];\n\t\tif (leftIdentifier === void 0 && rightIdentifier === void 0) return 0;\n\t\tif (rightIdentifier === void 0) return 1;\n\t\tif (leftIdentifier === void 0) return -1;\n\t\tif (leftIdentifier !== rightIdentifier) return compareIdentifiers(leftIdentifier, rightIdentifier);\n\t}\n}\nfunction isPrereleasePrefix(prerelease, identifier) {\n\tconst identifiers = identifier.split(\".\");\n\treturn identifiers.length <= prerelease.length && identifiers.every((part, index) => compareIdentifiers(prerelease[index], part) === 0);\n}\nfunction incrementPrerelease(version, identifier, identifierBase) {\n\tconst base = Number(identifierBase) ? 1 : 0;\n\tlet prerelease = version.prerelease;\n\tif (prerelease?.length) {\n\t\tlet foundNumeric = false;\n\t\tfor (let index = prerelease.length - 1; index >= 0; index--) if (typeof prerelease[index] === \"number\") {\n\t\t\tprerelease[index] = Number(prerelease[index]) + 1;\n\t\t\tfoundNumeric = true;\n\t\t\tbreak;\n\t\t}\n\t\tif (!foundNumeric) {\n\t\t\tif (identifier === prerelease.join(\".\") && identifierBase === false) throw new Error(\"invalid increment argument: identifier already exists\");\n\t\t\tprerelease.push(base);\n\t\t}\n\t} else {\n\t\tprerelease = [base];\n\t\tversion.prerelease = prerelease;\n\t}\n\tif (!identifier) return;\n\tconst reset = identifierBase === false ? [identifier] : [identifier, base];\n\tif (isPrereleasePrefix(prerelease, identifier)) {\n\t\tconst next = prerelease[identifier.split(\".\").length];\n\t\tif (Number.isNaN(Number(next))) version.prerelease = reset;\n\t} else version.prerelease = reset;\n}\nfunction incrementMutable(version, release, identifier, identifierBase) {\n\tswitch (release) {\n\t\tcase \"premajor\":\n\t\t\tversion.prerelease = void 0;\n\t\t\tversion.patch = 0;\n\t\t\tversion.minor = 0;\n\t\t\tversion.major++;\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tcase \"preminor\":\n\t\t\tversion.prerelease = void 0;\n\t\t\tversion.patch = 0;\n\t\t\tversion.minor++;\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tcase \"prepatch\":\n\t\t\tversion.prerelease = void 0;\n\t\t\tincrementMutable(version, \"patch\", identifier, identifierBase);\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tcase \"prerelease\":\n\t\t\tif (!version.prerelease?.length) incrementMutable(version, \"patch\", identifier, identifierBase);\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tcase \"release\":\n\t\t\tif (!version.prerelease?.length) throw new Error(`version ${formatFullVersion(version)} is not a prerelease`);\n\t\t\tversion.prerelease = void 0;\n\t\t\tbreak;\n\t\tcase \"major\":\n\t\t\tif (version.minor !== 0 || version.patch !== 0 || !version.prerelease?.length) version.major++;\n\t\t\tversion.minor = 0;\n\t\t\tversion.patch = 0;\n\t\t\tversion.prerelease = void 0;\n\t\t\tbreak;\n\t\tcase \"minor\":\n\t\t\tif (version.patch !== 0 || !version.prerelease?.length) version.minor++;\n\t\t\tversion.patch = 0;\n\t\t\tversion.prerelease = void 0;\n\t\t\tbreak;\n\t\tcase \"patch\":\n\t\t\tif (!version.prerelease?.length) version.patch++;\n\t\t\tversion.prerelease = void 0;\n\t\t\tbreak;\n\t\tcase \"pre\":\n\t\t\tincrementPrerelease(version, identifier, identifierBase);\n\t\t\tbreak;\n\t\tdefault: throw new Error(`invalid increment argument: ${release}`);\n\t}\n}\nfunction incrementParsedVersion(parsed, release, identifier, identifierBase, loose = false) {\n\tif (release.startsWith(\"pre\")) {\n\t\tif (!identifier && identifierBase === false) throw new Error(\"invalid increment argument: identifier is empty\");\n\t\tif (identifier) {\n\t\t\tconst expression = loose ? PRERELEASE_LOOSE_EXACT : PRERELEASE_EXACT;\n\t\t\tconst match = `-${identifier}`.match(expression);\n\t\t\tif (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);\n\t\t}\n\t}\n\tconst mutable = {\n\t\tbuild: parsed.build ? [...parsed.build] : void 0,\n\t\tmajor: parsed.major,\n\t\tminor: parsed.minor,\n\t\tpatch: parsed.patch,\n\t\tprerelease: parsed.prerelease ? [...parsed.prerelease] : void 0\n\t};\n\tincrementMutable(mutable, release, identifier, identifierBase);\n\treturn formatComparableVersion(mutable);\n}\nfunction coerceParsedVersion(value, options = {}) {\n\tif (typeof value === \"object\") return value;\n\tconst input = typeof value === \"number\" ? String(value) : value;\n\tif (typeof input !== \"string\") return null;\n\tlet match = null;\n\tif (options.rtl) {\n\t\tconst expression = safeRegex(options.includePrerelease ? COERCE_FULL : COERCE, \"g\");\n\t\tlet next;\n\t\twhile ((next = expression.exec(input)) && (!match || match.index + match[0].length !== input.length)) {\n\t\t\tif (!match || next.index + next[0].length !== match.index + match[0].length) match = next;\n\t\t\texpression.lastIndex = next.index + next[1].length + next[2].length;\n\t\t}\n\t} else match = (options.includePrerelease ? COERCE_FULL_EXACT : COERCE_EXACT).exec(input);\n\tif (!match) return null;\n\tconst major = match[2];\n\treturn tryParse(`${major}.${match[3] || \"0\"}.${match[4] || \"0\"}${options.includePrerelease && match[5] ? `-${match[5]}` : \"\"}${options.includePrerelease && match[6] ? `+${match[6]}` : \"\"}`, options);\n}\n//#endregion\n//#region src/internal/comparator.ts\nconst STRICT_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${FULL_PLAIN})$|^$`);\nconst LOOSE_COMPARATOR$1 = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN})$|^$`);\nfunction parseComparator(comparator, options = {}) {\n\tconst normalized = comparator.trim().replaceAll(/\\s+/g, \" \");\n\tconst match = normalized.match(options.loose ? LOOSE_COMPARATOR$1 : STRICT_COMPARATOR);\n\tif (!match) throw new TypeError(`Invalid comparator: ${normalized}`);\n\tconst operator = match[1] === \"=\" ? \"\" : match[1] || \"\";\n\tconst version = match[2] ? parse(match[2], options) : null;\n\treturn {\n\t\toperator,\n\t\toptions,\n\t\tvalue: version ? `${operator}${formatComparableVersion(version)}` : \"\",\n\t\tversion\n\t};\n}\nfunction testParsedComparator(comparator, version) {\n\tif (!comparator.version) return true;\n\tconst comparison = compareParsed(version, comparator.version);\n\tswitch (comparator.operator) {\n\t\tcase \"\": return comparison === 0;\n\t\tcase \">\": return comparison > 0;\n\t\tcase \">=\": return comparison >= 0;\n\t\tcase \"<\": return comparison < 0;\n\t\tcase \"<=\": return comparison <= 0;\n\t}\n}\nfunction testComparatorVersion(comparator, version) {\n\tconst parsed = tryParse(version, comparator.options);\n\treturn parsed ? testParsedComparator(comparator, parsed) : false;\n}\nfunction comparatorAllowsPrerelease(comparator, version) {\n\tconst allowed = comparator.version;\n\treturn allowed !== null && !!allowed.prerelease?.length && allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch;\n}\nfunction testComparatorSet(set, version, options) {\n\tif (set.some((comparator) => !testParsedComparator(comparator, version))) return false;\n\treturn !version.prerelease?.length || !!options.includePrerelease || set.some((comparator) => comparatorAllowsPrerelease(comparator, version));\n}\nfunction parsedComparatorsIntersect(left, right, options = {}) {\n\tif (!left.version || !right.version) return true;\n\tif (left.operator === \"\") return testComparatorSet([right], left.version, options);\n\tif (right.operator === \"\") return testComparatorSet([left], right.version, options);\n\tif (options.includePrerelease && (left.value === \"<0.0.0-0\" || right.value === \"<0.0.0-0\")) return false;\n\tif (!options.includePrerelease && (left.value.startsWith(\"<0.0.0\") || right.value.startsWith(\"<0.0.0\"))) return false;\n\tif (left.operator.startsWith(\">\") && right.operator.startsWith(\">\")) return true;\n\tif (left.operator.startsWith(\"<\") && right.operator.startsWith(\"<\")) return true;\n\tconst comparison = compareParsed(left.version, right.version);\n\tif (comparison === 0 && left.operator.includes(\"=\") && right.operator.includes(\"=\")) return true;\n\tif (comparison < 0 && left.operator.startsWith(\">\") && right.operator.startsWith(\"<\")) return true;\n\treturn comparison > 0 && left.operator.startsWith(\"<\") && right.operator.startsWith(\">\");\n}\n//#endregion\n//#region src/comparator.ts\nfunction normalizeComparator(comparator, options = {}) {\n\treturn parseComparator(comparator, options).value;\n}\nfunction satisfiesComparator(version, comparator, options = {}) {\n\treturn testComparatorVersion(parseComparator(comparator, options), version);\n}\nfunction comparatorsIntersect(left, right, options = {}) {\n\treturn parsedComparatorsIntersect(parseComparator(left, options), parseComparator(right, options), options);\n}\n//#endregion\n//#region src/comparison.ts\nfunction compare(left, right, options = {}) {\n\treturn compareParsed(parse(left, options), parse(right, options));\n}\nfunction compareReversed(left, right, options = {}) {\n\treturn compare(right, left, options);\n}\nfunction compareMain(left, right, options = {}) {\n\treturn compareMainParsed(parse(left, options), parse(right, options));\n}\nfunction comparePrerelease(left, right, options = {}) {\n\treturn comparePrereleaseParsed(parse(left, options), parse(right, options));\n}\nfunction compareBuild(left, right, options = {}) {\n\treturn compareBuildParsed(parse(left, options), parse(right, options));\n}\nfunction compareWithOperator(left, operator, right, options = {}) {\n\tif (operator === \"===\") return left === right;\n\tif (operator === \"!==\") return left !== right;\n\tconst comparison = compare(left, right, options);\n\tswitch (operator) {\n\t\tcase \"\":\n\t\tcase \"=\":\n\t\tcase \"==\": return comparison === 0;\n\t\tcase \"!=\": return comparison !== 0;\n\t\tcase \">\": return comparison > 0;\n\t\tcase \">=\": return comparison >= 0;\n\t\tcase \"<\": return comparison < 0;\n\t\tcase \"<=\": return comparison <= 0;\n\t\tdefault: throw new TypeError(`Invalid operator: ${operator}`);\n\t}\n}\nfunction isEqual(left, right, options = {}) {\n\treturn compare(left, right, options) === 0;\n}\nfunction isNotEqual(left, right, options = {}) {\n\treturn compare(left, right, options) !== 0;\n}\nfunction isGreater(left, right, options = {}) {\n\treturn compare(left, right, options) > 0;\n}\nfunction isGreaterOrEqual(left, right, options = {}) {\n\treturn compare(left, right, options) >= 0;\n}\nfunction isLess(left, right, options = {}) {\n\treturn compare(left, right, options) < 0;\n}\nfunction isLessOrEqual(left, right, options = {}) {\n\treturn compare(left, right, options) <= 0;\n}\nfunction sort(versions, options = {}) {\n\treturn [...versions].sort((left, right) => compareBuild(left, right, options));\n}\nfunction sortReversed(versions, options = {}) {\n\treturn [...versions].sort((left, right) => compareBuild(right, left, options));\n}\n//#endregion\n//#region src/internal/range.ts\nconst BUILD_STRIP = new RegExp(BUILD, \"g\");\nconst BUILD_SAFE = safeRegex(BUILD);\nconst STRICT_HYPHEN = safeRegex(String.raw`^\\s*(${XRANGE_PLAIN})\\s+-\\s+(${XRANGE_PLAIN})\\s*$`);\nconst LOOSE_HYPHEN = safeRegex(String.raw`^\\s*(${XRANGE_PLAIN_LOOSE})\\s+-\\s+(${XRANGE_PLAIN_LOOSE})\\s*$`);\nconst COMPARATOR_TRIM = safeRegex(String.raw`(\\s*)${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN}|${XRANGE_PLAIN})`, \"g\");\nconst TILDE_TRIM = safeRegex(String.raw`(\\s*)${LONE_TILDE}\\s+`, \"g\");\nconst CARET_TRIM = safeRegex(String.raw`(\\s*)${LONE_CARET}\\s+`, \"g\");\nconst STRICT_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN}$`);\nconst LOOSE_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN_LOOSE}$`);\nconst STRICT_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN}$`);\nconst LOOSE_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN_LOOSE}$`);\nconst STRICT_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*${XRANGE_PLAIN}$`);\nconst LOOSE_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*${XRANGE_PLAIN_LOOSE}$`);\nconst STAR = safeRegex(String.raw`(<|>)?=?\\s*\\*`);\nconst GTE_ZERO = /^\\s*>=\\s*0\\.0\\.0\\s*$/;\nconst GTE_ZERO_PRERELEASE = /^\\s*>=\\s*0\\.0\\.0-0\\s*$/;\nconst LOOSE_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN})$|^$`);\nfunction isWildcard(value) {\n\treturn !value || String(value).toLowerCase() === \"x\" || String(value) === \"*\";\n}\nfunction hasInvalidWildcardOrder(major, minor, patch) {\n\treturn isWildcard(major) && !isWildcard(minor) || isWildcard(minor) && Boolean(patch) && !isWildcard(patch);\n}\nfunction replaceTilde(comparator, options) {\n\tconst expression = options.loose ? LOOSE_TILDE : STRICT_TILDE;\n\tconst lowerPrerelease = options.includePrerelease ? \"-0\" : \"\";\n\treturn comparator.replace(expression, (_match, major, minor, patch, prerelease) => {\n\t\tif (isWildcard(major)) return \"\";\n\t\tif (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (isWildcard(patch)) return `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0`;\n\t\treturn prerelease ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0`;\n\t});\n}\nfunction replaceTildes(comparator, options) {\n\treturn comparator.trim().split(/\\s+/).map((part) => replaceTilde(part, options)).join(\" \");\n}\nfunction replaceCaret(comparator, options) {\n\tconst expression = options.loose ? LOOSE_CARET : STRICT_CARET;\n\tconst lowerPrerelease = options.includePrerelease ? \"-0\" : \"\";\n\treturn comparator.replace(expression, (_match, major, minor, patch, prerelease) => {\n\t\tif (isWildcard(major)) return \"\";\n\t\tif (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (isWildcard(patch)) return major === \"0\" ? `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (prerelease) return major === \"0\" ? minor === \"0\" ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch}-${prerelease} <${Number(major) + 1}.0.0-0`;\n\t\treturn major === \"0\" ? minor === \"0\" ? `>=${major}.${minor}.${patch} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${Number(major) + 1}.0.0-0`;\n\t});\n}\nfunction replaceCarets(comparator, options) {\n\treturn comparator.trim().split(/\\s+/).map((part) => replaceCaret(part, options)).join(\" \");\n}\nfunction replaceXRange(comparator, options) {\n\tconst expression = options.loose ? LOOSE_XRANGE : STRICT_XRANGE;\n\treturn comparator.trim().replace(expression, (match, rawOperator, rawMajor, rawMinor, rawPatch) => {\n\t\tlet operator = rawOperator;\n\t\tlet major = rawMajor;\n\t\tlet minor = rawMinor;\n\t\tlet patch = rawPatch;\n\t\tif (hasInvalidWildcardOrder(String(major), minor === void 0 ? void 0 : String(minor), patch === void 0 ? void 0 : String(patch))) return comparator;\n\t\tconst wildcardMajor = isWildcard(major);\n\t\tconst wildcardMinor = wildcardMajor || isWildcard(minor);\n\t\tconst wildcardPatch = wildcardMinor || isWildcard(patch);\n\t\tif (operator === \"=\" && wildcardPatch) operator = \"\";\n\t\tif (wildcardMajor) return operator === \">\" || operator === \"<\" ? \"<0.0.0-0\" : \"*\";\n\t\tlet prerelease = options.includePrerelease ? \"-0\" : \"\";\n\t\tif (operator && wildcardPatch) {\n\t\t\tif (wildcardMinor) minor = 0;\n\t\t\tpatch = 0;\n\t\t\tif (operator === \">\") {\n\t\t\t\toperator = \">=\";\n\t\t\t\tif (wildcardMinor) {\n\t\t\t\t\tmajor = Number(major) + 1;\n\t\t\t\t\tminor = 0;\n\t\t\t\t} else minor = Number(minor) + 1;\n\t\t\t} else if (operator === \"<=\") {\n\t\t\t\toperator = \"<\";\n\t\t\t\tif (wildcardMinor) major = Number(major) + 1;\n\t\t\t\telse minor = Number(minor) + 1;\n\t\t\t}\n\t\t\tif (operator === \"<\") prerelease = \"-0\";\n\t\t\treturn `${operator}${major}.${minor}.${patch}${prerelease}`;\n\t\t}\n\t\tif (wildcardMinor) return `>=${major}.0.0${prerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (wildcardPatch) return `>=${major}.${minor}.0${prerelease} <${major}.${Number(minor) + 1}.0-0`;\n\t\treturn match;\n\t});\n}\nfunction replaceXRanges(comparator, options) {\n\treturn comparator.split(/\\s+/).map((part) => replaceXRange(part, options)).join(\" \");\n}\nfunction replaceHyphenRange(range, options) {\n\tconst expression = options.loose ? LOOSE_HYPHEN : STRICT_HYPHEN;\n\treturn range.replace(expression, (_match, rawFrom, fromMajor, fromMinor, fromPatch, fromPrerelease, _fromBuild, rawTo, toMajor, toMinor, toPatch, toPrerelease) => {\n\t\tlet from = rawFrom;\n\t\tlet to = rawTo;\n\t\tif (isWildcard(fromMajor)) from = \"\";\n\t\telse if (isWildcard(fromMinor)) from = `>=${fromMajor}.0.0${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\telse if (isWildcard(fromPatch)) from = `>=${fromMajor}.${fromMinor}.0${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\telse if (fromPrerelease) from = `>=${from}`;\n\t\telse from = `>=${from}${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\tif (isWildcard(toMajor)) to = \"\";\n\t\telse if (isWildcard(toMinor)) to = `<${Number(toMajor) + 1}.0.0-0`;\n\t\telse if (isWildcard(toPatch)) to = `<${toMajor}.${Number(toMinor) + 1}.0-0`;\n\t\telse if (toPrerelease) to = `<=${toMajor}.${toMinor}.${toPatch}-${toPrerelease}`;\n\t\telse if (options.includePrerelease) to = `<${toMajor}.${toMinor}.${Number(toPatch) + 1}-0`;\n\t\telse to = `<=${to}`;\n\t\treturn `${from} ${to}`.trim();\n\t});\n}\nfunction expandComparator(comparator, options) {\n\treturn replaceXRanges(replaceTildes(replaceCarets(comparator.replace(BUILD_SAFE, \"\"), options), options), options).trim().replace(STAR, \"\");\n}\nfunction parseSimpleRange(input, options) {\n\tlet parts = replaceHyphenRange(input.replace(BUILD_STRIP, \"\"), options).replace(COMPARATOR_TRIM, \"$1$2$3\").replace(TILDE_TRIM, \"$1~\").replace(CARET_TRIM, \"$1^\").split(\" \").map((part) => expandComparator(part, options)).join(\" \").split(/\\s+/).map((part) => part.trim().replace(options.includePrerelease ? GTE_ZERO_PRERELEASE : GTE_ZERO, \"\"));\n\tif (options.loose) parts = parts.filter((part) => LOOSE_COMPARATOR.test(part));\n\tconst unique = /* @__PURE__ */ new Map();\n\tfor (const comparator of parts.map((part) => parseComparator(part, options))) {\n\t\tif (comparator.value === \"<0.0.0-0\") return [comparator];\n\t\tunique.set(comparator.value, comparator);\n\t}\n\tif (unique.size > 1) unique.delete(\"\");\n\treturn [...unique.values()];\n}\nfunction parseRange(range, options = {}) {\n\tif (typeof range !== \"string\") return range;\n\tconst parsedOptions = { ...options };\n\tconst raw = range.trim().replaceAll(/\\s+/g, \" \");\n\tlet sets = raw.split(\"||\").map((part) => parseSimpleRange(part.trim(), parsedOptions)).filter((set) => set.length);\n\tif (!sets.length) throw new TypeError(`Range contains no valid comparator sets: ${raw}`);\n\tif (sets.length > 1) {\n\t\tconst first = sets[0];\n\t\tsets = sets.filter((set) => set[0]?.value !== \"<0.0.0-0\");\n\t\tif (!sets.length) sets = [first];\n\t\telse if (sets.length > 1) {\n\t\t\tconst any = sets.find((set) => set.length === 1 && set[0]?.value === \"\");\n\t\t\tif (any) sets = [any];\n\t\t}\n\t}\n\treturn {\n\t\tnormalized: sets.map((set) => set.map((comparator) => comparator.value).join(\" \")).join(\"||\"),\n\t\toptions: parsedOptions,\n\t\traw,\n\t\tsets\n\t};\n}\nfunction tryParseRange(range, options = {}) {\n\ttry {\n\t\treturn parseRange(range, options);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction testParsedRange(range, version) {\n\treturn range.sets.some((set) => testComparatorSet(set, version, range.options));\n}\nfunction testRangeVersion(range, version) {\n\tconst parsed = tryParse(version, range.options);\n\treturn parsed ? testParsedRange(range, parsed) : false;\n}\nfunction exactVersion(set) {\n\tfor (const comparator of set) if (comparator.operator === \"\" && comparator.version) return comparator.version;\n\treturn null;\n}\nfunction isSatisfiable(comparators, options) {\n\tconst exact = exactVersion(comparators);\n\tif (exact) return testComparatorSet(comparators, exact, options);\n\tconst remaining = [...comparators];\n\tlet current = remaining.pop();\n\twhile (current && remaining.length) {\n\t\tif (remaining.some((other) => !parsedComparatorsIntersect(current, other, options))) return false;\n\t\tcurrent = remaining.pop();\n\t}\n\treturn true;\n}\nfunction setsIntersect(left, right, options) {\n\tconst leftExact = exactVersion(left);\n\tif (leftExact) return testComparatorSet(right, leftExact, options);\n\tconst rightExact = exactVersion(right);\n\tif (rightExact) return testComparatorSet(left, rightExact, options);\n\treturn left.every((leftComparator) => right.every((rightComparator) => parsedComparatorsIntersect(leftComparator, rightComparator, options)));\n}\nfunction parsedRangesIntersect(left, right, options = {}) {\n\treturn left.sets.some((leftSet) => isSatisfiable(leftSet, options) && right.sets.some((rightSet) => isSatisfiable(rightSet, options) && setsIntersect(leftSet, rightSet, options)));\n}\n//#endregion\n//#region src/range.ts\nfunction isValidRange(range, options = {}) {\n\treturn tryParseRange(range, options) !== null;\n}\nfunction normalizeRange(range, options = {}) {\n\tconst parsed = tryParseRange(range, options);\n\treturn parsed ? parsed.normalized || \"*\" : null;\n}\nfunction satisfies(version, range, options = {}) {\n\tconst parsed = tryParseRange(range, options);\n\treturn parsed ? testRangeVersion(parsed, version) : false;\n}\nfunction rangeToComparators(range, options = {}) {\n\treturn parseRange(range, options).sets.map((set) => set.map((comparator) => comparator.value).join(\" \").trim().split(\" \"));\n}\nfunction findMaxSatisfying(versions, range, options = {}) {\n\tconst parsedRange = tryParseRange(range, options);\n\tif (!parsedRange) return null;\n\tlet maximum = null;\n\tlet maximumParsed = null;\n\tfor (const version of versions) {\n\t\tconst parsedVersion = tryParse(version, parsedRange.options);\n\t\tif (!parsedVersion || !testParsedRange(parsedRange, parsedVersion)) continue;\n\t\tif (!maximumParsed || compareParsed(maximumParsed, parsedVersion) < 0) {\n\t\t\tmaximum = version;\n\t\t\tmaximumParsed = parsedVersion;\n\t\t}\n\t}\n\treturn maximum;\n}\nfunction findMinSatisfying(versions, range, options = {}) {\n\tconst parsedRange = tryParseRange(range, options);\n\tif (!parsedRange) return null;\n\tlet minimum = null;\n\tlet minimumParsed = null;\n\tfor (const version of versions) {\n\t\tconst parsedVersion = tryParse(version, parsedRange.options);\n\t\tif (!parsedVersion || !testParsedRange(parsedRange, parsedVersion)) continue;\n\t\tif (!minimumParsed || compareParsed(minimumParsed, parsedVersion) > 0) {\n\t\t\tminimum = version;\n\t\t\tminimumParsed = parsedVersion;\n\t\t}\n\t}\n\treturn minimum;\n}\nfunction nextVersionAfter(version) {\n\tconst { prerelease } = version;\n\treturn parse(formatComparableVersion(prerelease?.length ? {\n\t\tmajor: version.major,\n\t\tminor: version.minor,\n\t\tpatch: version.patch,\n\t\tprerelease: [...prerelease, 0]\n\t} : {\n\t\tmajor: version.major,\n\t\tminor: version.minor,\n\t\tpatch: version.patch + 1\n\t}));\n}\nfunction findMinimumForRange(range, options = {}) {\n\tconst parsedRange = parseRange(range, options);\n\tconst zero = parse(\"0.0.0\");\n\tif (testParsedRange(parsedRange, zero)) return formatComparableVersion(zero);\n\tconst zeroPrerelease = parse(\"0.0.0-0\");\n\tif (testParsedRange(parsedRange, zeroPrerelease)) return formatComparableVersion(zeroPrerelease);\n\tlet minimum = null;\n\tfor (const set of parsedRange.sets) {\n\t\tlet setMinimum = null;\n\t\tfor (const comparator of set) {\n\t\t\tif (!comparator.version) continue;\n\t\t\tconst candidate = comparator.operator === \">\" ? nextVersionAfter(comparator.version) : comparator.operator === \"\" || comparator.operator === \">=\" ? comparator.version : null;\n\t\t\tif (candidate && (!setMinimum || compareParsed(candidate, setMinimum) > 0)) setMinimum = candidate;\n\t\t}\n\t\tif (setMinimum && (!minimum || compareParsed(minimum, setMinimum) > 0)) minimum = setMinimum;\n\t}\n\treturn minimum && testParsedRange(parsedRange, minimum) ? formatComparableVersion(minimum) : null;\n}\nfunction compareInDirection(left, right, direction) {\n\tconst comparison = compareParsed(left, right);\n\treturn direction === \">\" ? comparison > 0 : comparison < 0;\n}\nfunction compareOppositeOrEqual(left, right, direction) {\n\tconst comparison = compareParsed(left, right);\n\treturn direction === \">\" ? comparison <= 0 : comparison >= 0;\n}\nfunction compareOpposite(left, right, direction) {\n\tconst comparison = compareParsed(left, right);\n\treturn direction === \">\" ? comparison < 0 : comparison > 0;\n}\nfunction isOutsideRange(version, range, direction, options = {}) {\n\tif (direction !== \">\" && direction !== \"<\") throw new TypeError(\"Must provide a direction of \\\"<\\\" or \\\">\\\"\");\n\tconst parsedRange = parseRange(range, options);\n\tconst parsedVersion = parse(version, parsedRange.options);\n\tif (testParsedRange(parsedRange, parsedVersion)) return false;\n\tconst inclusiveDirection = direction === \">\" ? \">=\" : \"<=\";\n\tfor (const set of parsedRange.sets) {\n\t\tconst concrete = set.map((comparator) => comparator.version ? comparator : parseComparator(\">=0.0.0\"));\n\t\tlet high = concrete[0];\n\t\tlet low = concrete[0];\n\t\tfor (const comparator of concrete) if (compareInDirection(comparator.version, high.version, direction)) high = comparator;\n\t\telse if (compareOpposite(comparator.version, low.version, direction)) low = comparator;\n\t\tif (high.operator === direction || high.operator === inclusiveDirection) return false;\n\t\tif ((!low.operator || low.operator === direction) && compareOppositeOrEqual(parsedVersion, low.version, direction)) return false;\n\t\tif (low.operator === inclusiveDirection && compareOpposite(parsedVersion, low.version, direction)) return false;\n\t}\n\treturn true;\n}\nfunction isGreaterThanRange(version, range, options = {}) {\n\treturn isOutsideRange(version, range, \">\", options);\n}\nfunction isLessThanRange(version, range, options = {}) {\n\treturn isOutsideRange(version, range, \"<\", options);\n}\nfunction rangesIntersect(left, right, options = {}) {\n\tconst parsedLeft = parseRange(left, options);\n\tconst parsedRight = parseRange(right, options);\n\treturn parsedRangesIntersect(parsedLeft, parsedRight, {\n\t\t...parsedLeft.options,\n\t\t...parsedRight.options,\n\t\t...options\n\t});\n}\nfunction simplifyRange(versions, range, options = {}) {\n\tconst parsedRange = parseRange(range, options);\n\tconst sorted = sort(versions, parsedRange.options);\n\tconst sets = [];\n\tlet first = null;\n\tlet previous = null;\n\tfor (const version of sorted) if (testRangeVersion(parsedRange, version)) {\n\t\tprevious = version;\n\t\tfirst ??= version;\n\t} else if (previous) {\n\t\tsets.push([first, previous]);\n\t\tfirst = null;\n\t\tprevious = null;\n\t}\n\tif (first) sets.push([first, null]);\n\tconst simplified = sets.map(([minimum, maximum]) => {\n\t\tconst minimumValue = formatComparableVersion(parse(minimum, parsedRange.options));\n\t\tconst maximumValue = maximum ? formatComparableVersion(parse(maximum, parsedRange.options)) : null;\n\t\tif (minimumValue === maximumValue) return minimumValue;\n\t\tif (!maximum && minimum === sorted[0]) return \"*\";\n\t\tif (!maximumValue) return `>=${minimumValue}`;\n\t\tif (minimum === sorted[0]) return `<=${maximumValue}`;\n\t\treturn `${minimumValue} - ${maximumValue}`;\n\t}).join(\" || \");\n\tconst original = typeof range === \"string\" ? range : range.raw;\n\treturn simplified.length < original.length ? simplified : original;\n}\nfunction higherLowerBound(left, right) {\n\tif (!left) return right;\n\tconst comparison = compareParsed(left.version, right.version);\n\treturn comparison > 0 ? left : comparison < 0 || right.operator === \">\" && left.operator === \">=\" ? right : left;\n}\nfunction lowerUpperBound(left, right) {\n\tif (!left) return right;\n\tconst comparison = compareParsed(left.version, right.version);\n\treturn comparison < 0 ? left : comparison > 0 || right.operator === \"<\" && left.operator === \"<=\" ? right : left;\n}\nfunction simpleRangeSubset(rawSubset, rawSuperset, options) {\n\tlet subset = rawSubset;\n\tlet superset = rawSuperset;\n\tconst subsetAny = subset.length === 1 && !subset[0].version;\n\tconst supersetAny = superset.length === 1 && !superset[0].version;\n\tif (subsetAny) {\n\t\tif (supersetAny) return true;\n\t\tsubset = [parseComparator(options.includePrerelease ? \">=0.0.0-0\" : \">=0.0.0\")];\n\t}\n\tif (supersetAny) {\n\t\tif (options.includePrerelease) return true;\n\t\tsuperset = [parseComparator(\">=0.0.0\")];\n\t}\n\tconst equal = /* @__PURE__ */ new Map();\n\tlet lower;\n\tlet upper;\n\tfor (const comparator of subset) if (comparator.operator === \">\" || comparator.operator === \">=\") lower = higherLowerBound(lower, comparator);\n\telse if (comparator.operator === \"<\" || comparator.operator === \"<=\") upper = lowerUpperBound(upper, comparator);\n\telse if (comparator.version) equal.set(formatComparableVersion(comparator.version), comparator.version);\n\tif (equal.size > 1) return null;\n\tlet boundsComparison;\n\tif (lower && upper) {\n\t\tboundsComparison = compareParsed(lower.version, upper.version);\n\t\tif (boundsComparison > 0) return null;\n\t\tif (boundsComparison === 0 && (lower.operator !== \">=\" || upper.operator !== \"<=\")) return null;\n\t}\n\tfor (const version of equal.values()) {\n\t\tif (lower && !testParsedComparator(lower, version)) return null;\n\t\tif (upper && !testParsedComparator(upper, version)) return null;\n\t\treturn testComparatorSet(superset, version, options);\n\t}\n\tlet needsLowerPrerelease = lower && !options.includePrerelease && lower.version.prerelease?.length ? lower.version : null;\n\tlet needsUpperPrerelease = upper && !options.includePrerelease && upper.version.prerelease?.length ? upper.version : null;\n\tconst upperPrerelease = needsUpperPrerelease?.prerelease;\n\tif (upperPrerelease?.length === 1 && upper?.operator === \"<\" && upperPrerelease[0] === 0) needsUpperPrerelease = null;\n\tlet hasSupersetLower = false;\n\tlet hasSupersetUpper = false;\n\tfor (const comparator of superset) {\n\t\thasSupersetLower ||= comparator.operator === \">\" || comparator.operator === \">=\";\n\t\thasSupersetUpper ||= comparator.operator === \"<\" || comparator.operator === \"<=\";\n\t\tif (lower) {\n\t\t\tif (needsLowerPrerelease && comparatorAllowsPrerelease(comparator, needsLowerPrerelease)) needsLowerPrerelease = null;\n\t\t\tif (comparator.operator === \">\" || comparator.operator === \">=\") {\n\t\t\t\tconst higher = higherLowerBound(lower, comparator);\n\t\t\t\tif (higher === comparator && higher !== lower) return false;\n\t\t\t} else if (lower.operator === \">=\" && !testParsedComparator(comparator, lower.version)) return false;\n\t\t}\n\t\tif (upper) {\n\t\t\tif (needsUpperPrerelease && comparatorAllowsPrerelease(comparator, needsUpperPrerelease)) needsUpperPrerelease = null;\n\t\t\tif (comparator.operator === \"<\" || comparator.operator === \"<=\") {\n\t\t\t\tconst lowerBound = lowerUpperBound(upper, comparator);\n\t\t\t\tif (lowerBound === comparator && lowerBound !== upper) return false;\n\t\t\t} else if (upper.operator === \"<=\" && !testParsedComparator(comparator, upper.version)) return false;\n\t\t}\n\t\tif (comparator.operator === \"\" && (lower || upper) && boundsComparison !== 0) return false;\n\t}\n\tif (lower && hasSupersetUpper && !upper && boundsComparison !== 0) return false;\n\tif (upper && hasSupersetLower && !lower && boundsComparison !== 0) return false;\n\treturn !needsLowerPrerelease && !needsUpperPrerelease;\n}\nfunction isRangeSubset(subset, superset, options = {}) {\n\tif (subset === superset) return true;\n\tconst parsedSubset = parseRange(subset, options);\n\tconst parsedSuperset = parseRange(superset, options);\n\tconst effectiveOptions = {\n\t\t...parsedSubset.options,\n\t\t...parsedSuperset.options,\n\t\t...options\n\t};\n\tlet sawNonNull = false;\n\tfor (const subsetSet of parsedSubset.sets) {\n\t\tlet matched = false;\n\t\tfor (const supersetSet of parsedSuperset.sets) {\n\t\t\tconst result = simpleRangeSubset(subsetSet, supersetSet, effectiveOptions);\n\t\t\tsawNonNull ||= result !== null;\n\t\t\tif (result) {\n\t\t\t\tmatched = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!matched && sawNonNull) return false;\n\t}\n\treturn true;\n}\n//#endregion\n//#region src/version.ts\nfunction isValid(version, options = {}) {\n\treturn tryParse(version, options) !== null;\n}\nfunction isPrerelease(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\tif (!parsed) return null;\n\treturn !!parsed.prerelease?.length;\n}\nfunction isStable(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\tif (!parsed) return null;\n\treturn !parsed.prerelease?.length;\n}\nfunction normalizeFull(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\treturn parsed ? formatFullVersion(parsed) : null;\n}\nfunction normalize(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\treturn parsed ? formatComparableVersion(parsed) : null;\n}\nfunction clean(version, options = {}) {\n\tif (typeof version !== \"string\") return normalize(version, options);\n\treturn normalize(version.trim().replace(/^[=v]+/, \"\"), options);\n}\nfunction coerce(value, options = {}) {\n\tconst parsed = coerceParsedVersion(value, options);\n\treturn parsed ? formatFullVersion(parsed) : null;\n}\nfunction increment(version, release, options = {}) {\n\ttry {\n\t\treturn incrementParsedVersion(parse(version, options), release, options.identifier, options.identifierBase, options.loose);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction truncate(version, truncation, options = {}) {\n\tif (!TRUNCATION_TYPES.includes(truncation)) return null;\n\tconst parsed = tryParse(version, options);\n\tif (!parsed) return null;\n\tif (truncation.startsWith(\"pre\")) return formatComparableVersion(parsed);\n\treturn formatComparableVersion({\n\t\tmajor: parsed.major,\n\t\tminor: truncation === \"major\" ? 0 : parsed.minor,\n\t\tpatch: truncation === \"major\" || truncation === \"minor\" ? 0 : parsed.patch\n\t});\n}\nfunction difference(left, right) {\n\tconst leftVersion = parse(left);\n\tconst rightVersion = parse(right);\n\tconst comparison = compareParsed(leftVersion, rightVersion);\n\tif (comparison === 0) return null;\n\tconst high = comparison > 0 ? leftVersion : rightVersion;\n\tconst low = comparison > 0 ? rightVersion : leftVersion;\n\tconst highHasPrerelease = high.prerelease?.length;\n\tif (low.prerelease?.length && !highHasPrerelease) {\n\t\tif (low.patch === 0 && low.minor === 0) return \"major\";\n\t\tif (compareMainParsed(low, high) === 0) return low.minor !== 0 && low.patch === 0 ? \"minor\" : \"patch\";\n\t}\n\tconst prefix = highHasPrerelease ? \"pre\" : \"\";\n\tif (leftVersion.major !== rightVersion.major) return `${prefix}major`;\n\tif (leftVersion.minor !== rightVersion.minor) return `${prefix}minor`;\n\tif (leftVersion.patch !== rightVersion.patch) return `${prefix}patch`;\n\treturn \"prerelease\";\n}\nfunction getMajor(version, options = {}) {\n\treturn parse(version, options).major;\n}\nfunction getMinor(version, options = {}) {\n\treturn parse(version, options).minor;\n}\nfunction getPatch(version, options = {}) {\n\treturn parse(version, options).patch;\n}\nfunction getPrerelease(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\treturn parsed ? [...parsed.prerelease || []] : null;\n}\nfunction getBuild(version, options = {}) {\n\tconst parsed = tryParse(version, options);\n\treturn parsed ? [...parsed.build || []] : null;\n}\n//#endregion\nexport { INCREMENT_TYPES, SEMVER_SPEC_VERSION, TRUNCATION_TYPES, clean, coerce, comparatorsIntersect, compare, compareBuild, compareIdentifiers, compareIdentifiersReversed, compareMain, comparePrerelease, compareReversed, compareWithOperator, difference, findMaxSatisfying, findMinSatisfying, findMinimumForRange, getBuild, getMajor, getMinor, getPatch, getPrerelease, increment, isEqual, isGreater, isGreaterOrEqual, isGreaterThanRange, isLess, isLessOrEqual, isLessThanRange, isNotEqual, isOutsideRange, isPrerelease, isRangeSubset, isStable, isValid, isValidRange, normalize, normalizeComparator, normalizeFull, normalizeRange, parse, parseRange, rangeToComparators, rangesIntersect, satisfies, satisfiesComparator, simplifyRange, sort, sortReversed, truncate, tryParse, tryParseRange };\n", "import { coerce, satisfies } from \"verkit\";\n//#region src/semverSatisfies.ts\nconst semverSatisfies = (targetAppVersion, currentVersion) => {\n\tconst currentCoerce = coerce(currentVersion);\n\tif (!currentCoerce) return false;\n\treturn satisfies(currentCoerce, targetAppVersion);\n};\n//#endregion\nexport { semverSatisfies };\n", "import { semverSatisfies } from \"./semverSatisfies.mjs\";\n//#region src/filterCompatibleAppVersions.ts\n/**\n* Filters target app versions that are compatible with the current app version.\n* Returns only versions that are compatible with the current version according to semver rules.\n*\n* @param targetAppVersionList - List of target app versions to filter\n* @param currentVersion - Current app version\n* @returns Array of target app versions compatible with the current version\n*/\nconst filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {\n\treturn targetAppVersionList.filter((version) => semverSatisfies(version, currentVersion)).sort((a, b) => b.localeCompare(a));\n};\n//#endregion\nexport { filterCompatibleAppVersions };\n", "import { BundleUnitOfWork } from \"./bundleUnitOfWork.mjs\";\nimport { getRequestBundleUnitOfWork } from \"./bundleUnitOfWorkStore.mjs\";\n//#region src/requestUpdateBundleState.ts\nconst toBundleSeeds = (seeds) => seeds.filter((seed) => !!seed);\nconst seedRequestUpdateBundles = (context, seeds) => {\n\tconst unitOfWork = getRequestBundleUnitOfWork(context);\n\tif (!unitOfWork) return;\n\tconst nextSeeds = toBundleSeeds(seeds);\n\tif (nextSeeds.length === 0) return;\n\tunitOfWork.seed(nextSeeds);\n};\nconst getRequestUpdateBundleSeeds = (context) => {\n\treturn getRequestBundleUnitOfWork(context)?.seededBundles() ?? [];\n};\nconst createRequestUpdateBundleResolver = (context) => {\n\tconst unitOfWork = getRequestBundleUnitOfWork(context) ?? new BundleUnitOfWork();\n\treturn {\n\t\thasSeededBundles: () => unitOfWork.hasSeeds(),\n\t\tpeek: (bundleId) => unitOfWork.peek(bundleId),\n\t\tgetById: (bundleId, loadBundleById) => unitOfWork.getById(bundleId, loadBundleById)\n\t};\n};\n//#endregion\nexport { createRequestUpdateBundleResolver, getRequestUpdateBundleSeeds, seedRequestUpdateBundles };\n", "//#region src/bundleArtifacts.ts\nconst stripBundleArtifactMetadata = (metadata) => metadata;\nconst getManifestStorageUri = (bundle) => bundle.manifestStorageUri ?? null;\nconst getManifestFileHash = (bundle) => bundle.manifestFileHash ?? null;\nconst getAssetBaseStorageUri = (bundle) => bundle.assetBaseStorageUri ?? null;\nconst isBundlePatchArtifact = (value) => {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst candidate = value;\n\treturn typeof candidate.baseBundleId === \"string\" && typeof candidate.baseFileHash === \"string\" && typeof candidate.patchFileHash === \"string\" && typeof candidate.patchStorageUri === \"string\";\n};\nconst readBundlePatchArray = (patches) => {\n\tif (!Array.isArray(patches)) return [];\n\treturn patches.filter(isBundlePatchArtifact);\n};\nconst getBundlePatches = (bundle) => {\n\tconst patches = readBundlePatchArray(bundle.patches);\n\tconst seenBaseBundleIds = /* @__PURE__ */ new Set();\n\treturn patches.filter((patch) => {\n\t\tif (seenBaseBundleIds.has(patch.baseBundleId)) return false;\n\t\tseenBaseBundleIds.add(patch.baseBundleId);\n\t\treturn true;\n\t});\n};\nconst getBundlePatch = (bundle, baseBundleId) => {\n\treturn getBundlePatches(bundle).find((patch) => patch.baseBundleId === baseBundleId) ?? null;\n};\nconst getPrimaryPatch = (bundle) => {\n\treturn getBundlePatches(bundle)[0] ?? null;\n};\nconst getPatchBaseBundleId = (bundle) => bundle.patchBaseBundleId ?? getPrimaryPatch(bundle)?.baseBundleId ?? null;\nconst getPatchBaseFileHash = (bundle) => bundle.patchBaseFileHash ?? getPrimaryPatch(bundle)?.baseFileHash ?? null;\nconst getPatchFileHash = (bundle) => bundle.patchFileHash ?? getPrimaryPatch(bundle)?.patchFileHash ?? null;\nconst getPatchStorageUri = (bundle) => bundle.patchStorageUri ?? getPrimaryPatch(bundle)?.patchStorageUri ?? null;\n//#endregion\n//#region src/rollout.ts\nconst NUMERIC_COHORT_SIZE = 1e3;\nconst DEFAULT_ROLLOUT_COHORT_COUNT = NUMERIC_COHORT_SIZE;\nconst MAX_COHORT_LENGTH = 64;\nconst INVALID_COHORT_ERROR_MESSAGE = `Invalid cohort. Use 1-1000 or a lowercase slug without spaces, up to 64 characters.`;\nconst CUSTOM_COHORT_PATTERN = /^[a-z0-9-]+$/;\nfunction parseNumericCohortValue(cohort) {\n\tif (!/^\\d+$/.test(cohort)) return null;\n\tconst parsed = Number.parseInt(cohort, 10);\n\tif (Number.isNaN(parsed) || parsed < 1 || parsed > 1e3) return null;\n\treturn parsed;\n}\nfunction positiveMod(value, modulus) {\n\treturn (value % modulus + modulus) % modulus;\n}\nfunction hashString(value) {\n\tlet hash = 0;\n\tfor (let i = 0; i < value.length; i++) {\n\t\tconst char = value.charCodeAt(i);\n\t\thash = (hash << 5) - hash + char;\n\t\thash |= 0;\n\t}\n\treturn hash;\n}\nfunction gcd(a, b) {\n\tlet x = Math.abs(a);\n\tlet y = Math.abs(b);\n\twhile (y !== 0) {\n\t\tconst next = x % y;\n\t\tx = y;\n\t\ty = next;\n\t}\n\treturn x;\n}\nfunction modularInverse(value, modulus) {\n\tlet t = 0;\n\tlet newT = 1;\n\tlet r = modulus;\n\tlet newR = positiveMod(value, modulus);\n\twhile (newR !== 0) {\n\t\tconst quotient = Math.floor(r / newR);\n\t\t[t, newT] = [newT, t - quotient * newT];\n\t\t[r, newR] = [newR, r - quotient * newR];\n\t}\n\tif (r > 1) throw new Error(`No modular inverse for ${value} mod ${modulus}`);\n\treturn positiveMod(t, modulus);\n}\nfunction getRolloutShuffleParameters(bundleId) {\n\tlet multiplier = positiveMod(hashString(`${bundleId}:multiplier`), 997);\n\tif (multiplier === 0) multiplier = 1;\n\twhile (gcd(multiplier, NUMERIC_COHORT_SIZE) !== 1) {\n\t\tmultiplier = positiveMod(multiplier + 1, NUMERIC_COHORT_SIZE);\n\t\tif (multiplier === 0) multiplier = 1;\n\t}\n\tconst offset = positiveMod(hashString(`${bundleId}:offset`), NUMERIC_COHORT_SIZE);\n\treturn {\n\t\tmultiplier,\n\t\toffset,\n\t\tinverseMultiplier: modularInverse(multiplier, NUMERIC_COHORT_SIZE)\n\t};\n}\nfunction normalizeRolloutCohortCount(rolloutCohortCount) {\n\tif (rolloutCohortCount === null || rolloutCohortCount === void 0) return DEFAULT_ROLLOUT_COHORT_COUNT;\n\tif (rolloutCohortCount <= 0) return 0;\n\tif (rolloutCohortCount >= 1e3) return NUMERIC_COHORT_SIZE;\n\treturn Math.floor(rolloutCohortCount);\n}\nfunction normalizeCohortValue(cohort) {\n\tconst normalized = cohort.trim().toLowerCase();\n\tconst numericCohort = parseNumericCohortValue(normalized);\n\tif (numericCohort !== null) return String(numericCohort);\n\treturn normalized;\n}\nfunction getNumericCohortValue(cohort) {\n\treturn parseNumericCohortValue(normalizeCohortValue(cohort));\n}\nfunction isNumericCohort(cohort) {\n\treturn getNumericCohortValue(cohort) !== null;\n}\nfunction isCustomCohort(cohort) {\n\tconst normalized = normalizeCohortValue(cohort);\n\treturn normalized.length > 0 && normalized.length <= 64 && !/^\\d+$/.test(normalized) && CUSTOM_COHORT_PATTERN.test(normalized);\n}\nfunction isValidCohort(cohort) {\n\tconst normalized = normalizeCohortValue(cohort);\n\treturn isNumericCohort(normalized) || isCustomCohort(normalized);\n}\nfunction getDefaultNumericCohort(identifier) {\n\tconst cohortValue = positiveMod(hashString(identifier), NUMERIC_COHORT_SIZE) + 1;\n\treturn String(cohortValue);\n}\nfunction getNumericCohortRolloutPosition(bundleId, cohortValue) {\n\tif (cohortValue < 1 || cohortValue > 1e3) throw new Error(`Invalid numeric cohort: ${cohortValue}`);\n\tconst { offset, inverseMultiplier } = getRolloutShuffleParameters(bundleId);\n\treturn positiveMod(inverseMultiplier * (cohortValue - 1 - offset), NUMERIC_COHORT_SIZE);\n}\nfunction getRolledOutNumericCohorts(bundleId, rolloutCohortCount) {\n\tconst normalizedRolloutCount = normalizeRolloutCohortCount(rolloutCohortCount);\n\tif (normalizedRolloutCount <= 0) return [];\n\treturn Array.from({ length: NUMERIC_COHORT_SIZE }, (_, index) => index + 1).filter((cohortValue) => {\n\t\tif (normalizedRolloutCount >= 1e3) return true;\n\t\treturn getNumericCohortRolloutPosition(bundleId, cohortValue) < normalizedRolloutCount;\n\t});\n}\nfunction isCohortEligibleForUpdate(bundleId, cohort, rolloutCohortCount, targetCohorts) {\n\tconst normalizedCohort = cohort === null || cohort === void 0 ? void 0 : normalizeCohortValue(cohort);\n\tconst normalizedTargetCohorts = targetCohorts?.map((targetCohort) => normalizeCohortValue(targetCohort)) ?? [];\n\tif (normalizedCohort !== void 0 && normalizedTargetCohorts.includes(normalizedCohort)) return true;\n\tconst normalizedRolloutCount = normalizeRolloutCohortCount(rolloutCohortCount);\n\tif (normalizedRolloutCount <= 0) return false;\n\tif (normalizedCohort === void 0) return normalizedRolloutCount >= NUMERIC_COHORT_SIZE;\n\tconst numericCohort = getNumericCohortValue(normalizedCohort);\n\tif (numericCohort === null) return false;\n\tif (normalizedRolloutCount >= 1e3) return true;\n\treturn getNumericCohortRolloutPosition(bundleId, numericCohort) < normalizedRolloutCount;\n}\n//#endregion\n//#region src/uuid.ts\nconst NIL_UUID = \"00000000-0000-0000-0000-000000000000\";\n//#endregion\nexport { DEFAULT_ROLLOUT_COHORT_COUNT, INVALID_COHORT_ERROR_MESSAGE, MAX_COHORT_LENGTH, NIL_UUID, NUMERIC_COHORT_SIZE, getAssetBaseStorageUri, getBundlePatch, getBundlePatches, getDefaultNumericCohort, getManifestFileHash, getManifestStorageUri, getNumericCohortRolloutPosition, getNumericCohortValue, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, getRolledOutNumericCohorts, isCohortEligibleForUpdate, isCustomCohort, isNumericCohort, isValidCohort, normalizeCohortValue, normalizeRolloutCohortCount, stripBundleArtifactMetadata };\n", "import { NIL_UUID, isCohortEligibleForUpdate } from \"@hot-updater/core\";\n//#region ../../node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.js\nconst LETTER_DASH_NUMBER = \"[a-zA-Z0-9-]\";\nconst NUMERIC_IDENTIFIER = String.raw`0|[1-9]\\d*`;\nconst NUMERIC_IDENTIFIER_LOOSE = String.raw`\\d+`;\nconst NON_NUMERIC_IDENTIFIER = String.raw`\\d*[a-zA-Z-]${LETTER_DASH_NUMBER}*`;\nconst MAIN_VERSION = String.raw`(${NUMERIC_IDENTIFIER})\\.(${NUMERIC_IDENTIFIER})\\.(${NUMERIC_IDENTIFIER})`;\nconst MAIN_VERSION_LOOSE = String.raw`(${NUMERIC_IDENTIFIER_LOOSE})\\.(${NUMERIC_IDENTIFIER_LOOSE})\\.(${NUMERIC_IDENTIFIER_LOOSE})`;\nconst PRERELEASE_IDENTIFIER = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER})`;\nconst PRERELEASE_IDENTIFIER_LOOSE = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER_LOOSE})`;\nconst PRERELEASE = String.raw`(?:-(${PRERELEASE_IDENTIFIER}(?:\\.${PRERELEASE_IDENTIFIER})*))`;\nconst PRERELEASE_LOOSE = String.raw`(?:-?(${PRERELEASE_IDENTIFIER_LOOSE}(?:\\.${PRERELEASE_IDENTIFIER_LOOSE})*))`;\nconst BUILD_IDENTIFIER = `${LETTER_DASH_NUMBER}+`;\nconst BUILD = String.raw`(?:\\+(${BUILD_IDENTIFIER}(?:\\.${BUILD_IDENTIFIER})*))`;\nconst FULL_PLAIN = `v?${MAIN_VERSION}${PRERELEASE}?${BUILD}?`;\nconst LOOSE_PLAIN = String.raw`[v=\\s]*${MAIN_VERSION_LOOSE}${PRERELEASE_LOOSE}?${BUILD}?`;\nconst GREATER_LESS_THAN = \"((?:<|>)?=?)\";\nconst XRANGE_IDENTIFIER = String.raw`${NUMERIC_IDENTIFIER}|x|X|\\*`;\nconst XRANGE_IDENTIFIER_LOOSE = String.raw`${NUMERIC_IDENTIFIER_LOOSE}|x|X|\\*`;\nconst XRANGE_PLAIN = String.raw`[v=\\s]*(${XRANGE_IDENTIFIER})(?:\\.(${XRANGE_IDENTIFIER})(?:\\.(${XRANGE_IDENTIFIER})(?:${PRERELEASE})?${BUILD}?)?)?`;\nconst XRANGE_PLAIN_LOOSE = String.raw`[v=\\s]*(${XRANGE_IDENTIFIER_LOOSE})(?:\\.(${XRANGE_IDENTIFIER_LOOSE})(?:\\.(${XRANGE_IDENTIFIER_LOOSE})(?:${PRERELEASE_LOOSE})?${BUILD}?)?)?`;\nconst LONE_TILDE = \"(?:~>?)\";\nconst LONE_CARET = String.raw`(?:\\^)`;\nconst COERCE_PLAIN = String.raw`(^|[^\\d])(\\d{1,${16}})(?:\\.(\\d{1,${16}}))?(?:\\.(\\d{1,${16}}))?`;\nconst COERCE = String.raw`${COERCE_PLAIN}(?:$|[^\\d])`;\nconst COERCE_FULL = String.raw`${COERCE_PLAIN}(?:${PRERELEASE})?(?:${BUILD})?(?:$|[^\\d])`;\nfunction makeSafeRegexSource(source) {\n\tconst replacements = [\n\t\t[String.raw`\\s`, 1],\n\t\t[String.raw`\\d`, 256],\n\t\t[LETTER_DASH_NUMBER, 250]\n\t];\n\tfor (const [token, maximum] of replacements) source = source.split(`${token}*`).join(`${token}{0,${maximum}}`).split(`${token}+`).join(`${token}{1,${maximum}}`);\n\treturn source;\n}\nfunction safeRegex(source, flags) {\n\treturn new RegExp(makeSafeRegexSource(source), flags);\n}\nconst NUMERIC$1 = /^\\d+$/;\nfunction compareIdentifiers(left, right) {\n\tif (typeof left === \"number\" && typeof right === \"number\") return left === right ? 0 : left < right ? -1 : 1;\n\tconst leftNumeric = NUMERIC$1.test(String(left));\n\tconst rightNumeric = NUMERIC$1.test(String(right));\n\tconst normalizedLeft = leftNumeric ? Number(left) : left;\n\tconst normalizedRight = rightNumeric ? Number(right) : right;\n\treturn normalizedLeft === normalizedRight ? 0 : leftNumeric && !rightNumeric ? -1 : rightNumeric && !leftNumeric ? 1 : normalizedLeft < normalizedRight ? -1 : 1;\n}\nconst FULL = safeRegex(`^${FULL_PLAIN}$`);\nconst LOOSE = safeRegex(`^${LOOSE_PLAIN}$`);\nsafeRegex(`^${PRERELEASE}$`);\nsafeRegex(`^${PRERELEASE_LOOSE}$`);\nconst COERCE_EXACT = safeRegex(COERCE);\nconst COERCE_FULL_EXACT = safeRegex(COERCE_FULL);\nconst NUMERIC = /^\\d+$/;\nfunction formatComparableVersion(version) {\n\tconst base = `${version.major}.${version.minor}.${version.patch}`;\n\treturn version.prerelease?.length ? `${base}-${version.prerelease.join(\".\")}` : base;\n}\nfunction formatFullVersion(version) {\n\tconst comparable = formatComparableVersion(version);\n\treturn version.build?.length ? `${comparable}+${version.build.join(\".\")}` : comparable;\n}\nfunction parse(version, options = {}) {\n\tif (typeof version !== \"string\") return version;\n\tif (version.length > 256) throw new TypeError(`Version exceeds the maximum length of 256 characters`);\n\tconst match = version.trim().match(options.loose ? LOOSE : FULL);\n\tif (!match) throw new TypeError(`Invalid version syntax: ${version}`);\n\tconst major = Number(match[1]);\n\tconst minor = Number(match[2]);\n\tconst patch = Number(match[3]);\n\tif (major > Number.MAX_SAFE_INTEGER || major < 0) throw new TypeError(`Invalid major version: ${match[1]}`);\n\tif (minor > Number.MAX_SAFE_INTEGER || minor < 0) throw new TypeError(`Invalid minor version: ${match[2]}`);\n\tif (patch > Number.MAX_SAFE_INTEGER || patch < 0) throw new TypeError(`Invalid patch version: ${match[3]}`);\n\tconst prerelease = match[4] ? match[4].split(\".\").map((identifier) => {\n\t\tif (NUMERIC.test(identifier)) {\n\t\t\tconst numeric = Number(identifier);\n\t\t\tif (numeric >= 0 && numeric < Number.MAX_SAFE_INTEGER) return numeric;\n\t\t}\n\t\treturn identifier;\n\t}) : void 0;\n\treturn {\n\t\tbuild: match[5]?.split(\".\"),\n\t\tmajor,\n\t\tminor,\n\t\tpatch,\n\t\tprerelease\n\t};\n}\nfunction tryParse(version, options = {}) {\n\ttry {\n\t\treturn parse(version, options);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction compareMainParsed(left, right) {\n\treturn left.major === right.major ? left.minor === right.minor ? left.patch === right.patch ? 0 : left.patch < right.patch ? -1 : 1 : left.minor < right.minor ? -1 : 1 : left.major < right.major ? -1 : 1;\n}\nfunction comparePrereleaseParsed(left, right) {\n\tconst leftPrerelease = left.prerelease;\n\tconst rightPrerelease = right.prerelease;\n\tif (leftPrerelease?.length && !rightPrerelease?.length) return -1;\n\tif (!leftPrerelease?.length && rightPrerelease?.length) return 1;\n\tif (!leftPrerelease?.length && !rightPrerelease?.length) return 0;\n\tfor (let index = 0;; index++) {\n\t\tconst leftIdentifier = leftPrerelease?.[index];\n\t\tconst rightIdentifier = rightPrerelease?.[index];\n\t\tif (leftIdentifier === void 0 && rightIdentifier === void 0) return 0;\n\t\tif (rightIdentifier === void 0) return 1;\n\t\tif (leftIdentifier === void 0) return -1;\n\t\tif (leftIdentifier !== rightIdentifier) return compareIdentifiers(leftIdentifier, rightIdentifier);\n\t}\n}\nfunction compareParsed(left, right) {\n\treturn compareMainParsed(left, right) || comparePrereleaseParsed(left, right);\n}\nfunction coerceParsedVersion(value, options = {}) {\n\tif (typeof value === \"object\") return value;\n\tconst input = typeof value === \"number\" ? String(value) : value;\n\tif (typeof input !== \"string\") return null;\n\tlet match = null;\n\tif (options.rtl) {\n\t\tconst expression = safeRegex(options.includePrerelease ? COERCE_FULL : COERCE, \"g\");\n\t\tlet next;\n\t\twhile ((next = expression.exec(input)) && (!match || match.index + match[0].length !== input.length)) {\n\t\t\tif (!match || next.index + next[0].length !== match.index + match[0].length) match = next;\n\t\t\texpression.lastIndex = next.index + next[1].length + next[2].length;\n\t\t}\n\t} else match = (options.includePrerelease ? COERCE_FULL_EXACT : COERCE_EXACT).exec(input);\n\tif (!match) return null;\n\tconst major = match[2];\n\treturn tryParse(`${major}.${match[3] || \"0\"}.${match[4] || \"0\"}${options.includePrerelease && match[5] ? `-${match[5]}` : \"\"}${options.includePrerelease && match[6] ? `+${match[6]}` : \"\"}`, options);\n}\nconst STRICT_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${FULL_PLAIN})$|^$`);\nconst LOOSE_COMPARATOR$1 = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN})$|^$`);\nfunction parseComparator(comparator, options = {}) {\n\tconst normalized = comparator.trim().replaceAll(/\\s+/g, \" \");\n\tconst match = normalized.match(options.loose ? LOOSE_COMPARATOR$1 : STRICT_COMPARATOR);\n\tif (!match) throw new TypeError(`Invalid comparator: ${normalized}`);\n\tconst operator = match[1] === \"=\" ? \"\" : match[1] || \"\";\n\tconst version = match[2] ? parse(match[2], options) : null;\n\treturn {\n\t\toperator,\n\t\toptions,\n\t\tvalue: version ? `${operator}${formatComparableVersion(version)}` : \"\",\n\t\tversion\n\t};\n}\nfunction testParsedComparator(comparator, version) {\n\tif (!comparator.version) return true;\n\tconst comparison = compareParsed(version, comparator.version);\n\tswitch (comparator.operator) {\n\t\tcase \"\": return comparison === 0;\n\t\tcase \">\": return comparison > 0;\n\t\tcase \">=\": return comparison >= 0;\n\t\tcase \"<\": return comparison < 0;\n\t\tcase \"<=\": return comparison <= 0;\n\t}\n}\nfunction comparatorAllowsPrerelease(comparator, version) {\n\tconst allowed = comparator.version;\n\treturn allowed !== null && !!allowed.prerelease?.length && allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch;\n}\nfunction testComparatorSet(set, version, options) {\n\tif (set.some((comparator) => !testParsedComparator(comparator, version))) return false;\n\treturn !version.prerelease?.length || !!options.includePrerelease || set.some((comparator) => comparatorAllowsPrerelease(comparator, version));\n}\nconst BUILD_STRIP = new RegExp(BUILD, \"g\");\nconst BUILD_SAFE = safeRegex(BUILD);\nconst STRICT_HYPHEN = safeRegex(String.raw`^\\s*(${XRANGE_PLAIN})\\s+-\\s+(${XRANGE_PLAIN})\\s*$`);\nconst LOOSE_HYPHEN = safeRegex(String.raw`^\\s*(${XRANGE_PLAIN_LOOSE})\\s+-\\s+(${XRANGE_PLAIN_LOOSE})\\s*$`);\nconst COMPARATOR_TRIM = safeRegex(String.raw`(\\s*)${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN}|${XRANGE_PLAIN})`, \"g\");\nconst TILDE_TRIM = safeRegex(String.raw`(\\s*)${LONE_TILDE}\\s+`, \"g\");\nconst CARET_TRIM = safeRegex(String.raw`(\\s*)${LONE_CARET}\\s+`, \"g\");\nconst STRICT_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN}$`);\nconst LOOSE_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN_LOOSE}$`);\nconst STRICT_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN}$`);\nconst LOOSE_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN_LOOSE}$`);\nconst STRICT_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*${XRANGE_PLAIN}$`);\nconst LOOSE_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*${XRANGE_PLAIN_LOOSE}$`);\nconst STAR = safeRegex(String.raw`(<|>)?=?\\s*\\*`);\nconst GTE_ZERO = /^\\s*>=\\s*0\\.0\\.0\\s*$/;\nconst GTE_ZERO_PRERELEASE = /^\\s*>=\\s*0\\.0\\.0-0\\s*$/;\nconst LOOSE_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\\s*(${LOOSE_PLAIN})$|^$`);\nfunction isWildcard(value) {\n\treturn !value || String(value).toLowerCase() === \"x\" || String(value) === \"*\";\n}\nfunction hasInvalidWildcardOrder(major, minor, patch) {\n\treturn isWildcard(major) && !isWildcard(minor) || isWildcard(minor) && Boolean(patch) && !isWildcard(patch);\n}\nfunction replaceTilde(comparator, options) {\n\tconst expression = options.loose ? LOOSE_TILDE : STRICT_TILDE;\n\tconst lowerPrerelease = options.includePrerelease ? \"-0\" : \"\";\n\treturn comparator.replace(expression, (_match, major, minor, patch, prerelease) => {\n\t\tif (isWildcard(major)) return \"\";\n\t\tif (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (isWildcard(patch)) return `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0`;\n\t\treturn prerelease ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0`;\n\t});\n}\nfunction replaceTildes(comparator, options) {\n\treturn comparator.trim().split(/\\s+/).map((part) => replaceTilde(part, options)).join(\" \");\n}\nfunction replaceCaret(comparator, options) {\n\tconst expression = options.loose ? LOOSE_CARET : STRICT_CARET;\n\tconst lowerPrerelease = options.includePrerelease ? \"-0\" : \"\";\n\treturn comparator.replace(expression, (_match, major, minor, patch, prerelease) => {\n\t\tif (isWildcard(major)) return \"\";\n\t\tif (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (isWildcard(patch)) return major === \"0\" ? `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (prerelease) return major === \"0\" ? minor === \"0\" ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch}-${prerelease} <${Number(major) + 1}.0.0-0`;\n\t\treturn major === \"0\" ? minor === \"0\" ? `>=${major}.${minor}.${patch} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${Number(major) + 1}.0.0-0`;\n\t});\n}\nfunction replaceCarets(comparator, options) {\n\treturn comparator.trim().split(/\\s+/).map((part) => replaceCaret(part, options)).join(\" \");\n}\nfunction replaceXRange(comparator, options) {\n\tconst expression = options.loose ? LOOSE_XRANGE : STRICT_XRANGE;\n\treturn comparator.trim().replace(expression, (match, rawOperator, rawMajor, rawMinor, rawPatch) => {\n\t\tlet operator = rawOperator;\n\t\tlet major = rawMajor;\n\t\tlet minor = rawMinor;\n\t\tlet patch = rawPatch;\n\t\tif (hasInvalidWildcardOrder(String(major), minor === void 0 ? void 0 : String(minor), patch === void 0 ? void 0 : String(patch))) return comparator;\n\t\tconst wildcardMajor = isWildcard(major);\n\t\tconst wildcardMinor = wildcardMajor || isWildcard(minor);\n\t\tconst wildcardPatch = wildcardMinor || isWildcard(patch);\n\t\tif (operator === \"=\" && wildcardPatch) operator = \"\";\n\t\tif (wildcardMajor) return operator === \">\" || operator === \"<\" ? \"<0.0.0-0\" : \"*\";\n\t\tlet prerelease = options.includePrerelease ? \"-0\" : \"\";\n\t\tif (operator && wildcardPatch) {\n\t\t\tif (wildcardMinor) minor = 0;\n\t\t\tpatch = 0;\n\t\t\tif (operator === \">\") {\n\t\t\t\toperator = \">=\";\n\t\t\t\tif (wildcardMinor) {\n\t\t\t\t\tmajor = Number(major) + 1;\n\t\t\t\t\tminor = 0;\n\t\t\t\t} else minor = Number(minor) + 1;\n\t\t\t} else if (operator === \"<=\") {\n\t\t\t\toperator = \"<\";\n\t\t\t\tif (wildcardMinor) major = Number(major) + 1;\n\t\t\t\telse minor = Number(minor) + 1;\n\t\t\t}\n\t\t\tif (operator === \"<\") prerelease = \"-0\";\n\t\t\treturn `${operator}${major}.${minor}.${patch}${prerelease}`;\n\t\t}\n\t\tif (wildcardMinor) return `>=${major}.0.0${prerelease} <${Number(major) + 1}.0.0-0`;\n\t\tif (wildcardPatch) return `>=${major}.${minor}.0${prerelease} <${major}.${Number(minor) + 1}.0-0`;\n\t\treturn match;\n\t});\n}\nfunction replaceXRanges(comparator, options) {\n\treturn comparator.split(/\\s+/).map((part) => replaceXRange(part, options)).join(\" \");\n}\nfunction replaceHyphenRange(range, options) {\n\tconst expression = options.loose ? LOOSE_HYPHEN : STRICT_HYPHEN;\n\treturn range.replace(expression, (_match, rawFrom, fromMajor, fromMinor, fromPatch, fromPrerelease, _fromBuild, rawTo, toMajor, toMinor, toPatch, toPrerelease) => {\n\t\tlet from = rawFrom;\n\t\tlet to = rawTo;\n\t\tif (isWildcard(fromMajor)) from = \"\";\n\t\telse if (isWildcard(fromMinor)) from = `>=${fromMajor}.0.0${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\telse if (isWildcard(fromPatch)) from = `>=${fromMajor}.${fromMinor}.0${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\telse if (fromPrerelease) from = `>=${from}`;\n\t\telse from = `>=${from}${options.includePrerelease ? \"-0\" : \"\"}`;\n\t\tif (isWildcard(toMajor)) to = \"\";\n\t\telse if (isWildcard(toMinor)) to = `<${Number(toMajor) + 1}.0.0-0`;\n\t\telse if (isWildcard(toPatch)) to = `<${toMajor}.${Number(toMinor) + 1}.0-0`;\n\t\telse if (toPrerelease) to = `<=${toMajor}.${toMinor}.${toPatch}-${toPrerelease}`;\n\t\telse if (options.includePrerelease) to = `<${toMajor}.${toMinor}.${Number(toPatch) + 1}-0`;\n\t\telse to = `<=${to}`;\n\t\treturn `${from} ${to}`.trim();\n\t});\n}\nfunction expandComparator(comparator, options) {\n\treturn replaceXRanges(replaceTildes(replaceCarets(comparator.replace(BUILD_SAFE, \"\"), options), options), options).trim().replace(STAR, \"\");\n}\nfunction parseSimpleRange(input, options) {\n\tlet parts = replaceHyphenRange(input.replace(BUILD_STRIP, \"\"), options).replace(COMPARATOR_TRIM, \"$1$2$3\").replace(TILDE_TRIM, \"$1~\").replace(CARET_TRIM, \"$1^\").split(\" \").map((part) => expandComparator(part, options)).join(\" \").split(/\\s+/).map((part) => part.trim().replace(options.includePrerelease ? GTE_ZERO_PRERELEASE : GTE_ZERO, \"\"));\n\tif (options.loose) parts = parts.filter((part) => LOOSE_COMPARATOR.test(part));\n\tconst unique = /* @__PURE__ */ new Map();\n\tfor (const comparator of parts.map((part) => parseComparator(part, options))) {\n\t\tif (comparator.value === \"<0.0.0-0\") return [comparator];\n\t\tunique.set(comparator.value, comparator);\n\t}\n\tif (unique.size > 1) unique.delete(\"\");\n\treturn [...unique.values()];\n}\nfunction parseRange(range, options = {}) {\n\tif (typeof range !== \"string\") return range;\n\tconst parsedOptions = { ...options };\n\tconst raw = range.trim().replaceAll(/\\s+/g, \" \");\n\tlet sets = raw.split(\"||\").map((part) => parseSimpleRange(part.trim(), parsedOptions)).filter((set) => set.length);\n\tif (!sets.length) throw new TypeError(`Range contains no valid comparator sets: ${raw}`);\n\tif (sets.length > 1) {\n\t\tconst first = sets[0];\n\t\tsets = sets.filter((set) => set[0]?.value !== \"<0.0.0-0\");\n\t\tif (!sets.length) sets = [first];\n\t\telse if (sets.length > 1) {\n\t\t\tconst any = sets.find((set) => set.length === 1 && set[0]?.value === \"\");\n\t\t\tif (any) sets = [any];\n\t\t}\n\t}\n\treturn {\n\t\tnormalized: sets.map((set) => set.map((comparator) => comparator.value).join(\" \")).join(\"||\"),\n\t\toptions: parsedOptions,\n\t\traw,\n\t\tsets\n\t};\n}\nfunction tryParseRange(range, options = {}) {\n\ttry {\n\t\treturn parseRange(range, options);\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction testParsedRange(range, version) {\n\treturn range.sets.some((set) => testComparatorSet(set, version, range.options));\n}\nfunction testRangeVersion(range, version) {\n\tconst parsed = tryParse(version, range.options);\n\treturn parsed ? testParsedRange(range, parsed) : false;\n}\nfunction satisfies(version, range, options = {}) {\n\tconst parsed = tryParseRange(range, options);\n\treturn parsed ? testRangeVersion(parsed, version) : false;\n}\nfunction coerce(value, options = {}) {\n\tconst parsed = coerceParsedVersion(value, options);\n\treturn parsed ? formatFullVersion(parsed) : null;\n}\n//#endregion\n//#region src/semverSatisfies.ts\nconst semverSatisfies = (targetAppVersion, currentVersion) => {\n\tconst currentCoerce = coerce(currentVersion);\n\tif (!currentCoerce) return false;\n\treturn satisfies(currentCoerce, targetAppVersion);\n};\n//#endregion\n//#region src/filterCompatibleAppVersions.ts\n/**\n* Filters target app versions that are compatible with the current app version.\n* Returns only versions that are compatible with the current version according to semver rules.\n*\n* @param targetAppVersionList - List of target app versions to filter\n* @param currentVersion - Current app version\n* @returns Array of target app versions compatible with the current version\n*/\nconst filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {\n\treturn targetAppVersionList.filter((version) => semverSatisfies(version, currentVersion)).sort((a, b) => b.localeCompare(a));\n};\n//#endregion\n//#region src/getUpdateInfo.ts\nconst INIT_BUNDLE_ROLLBACK_UPDATE_INFO = {\n\tmessage: null,\n\tid: NIL_UUID,\n\tshouldForceUpdate: true,\n\tstatus: \"ROLLBACK\",\n\tstorageUri: null,\n\tfileHash: null\n};\nconst makeResponse = (bundle, status) => ({\n\tid: bundle.id,\n\tmessage: bundle.message,\n\tshouldForceUpdate: status === \"ROLLBACK\" ? true : bundle.shouldForceUpdate,\n\tstatus,\n\tstorageUri: bundle.storageUri,\n\tfileHash: bundle.fileHash\n});\nconst isEligibleUpdateCandidate = (bundle, cohort) => {\n\treturn isCohortEligibleForUpdate(bundle.id, cohort, bundle.rolloutCohortCount, bundle.targetCohorts);\n};\nconst findLatestEligibleUpdateCandidate = (bundles, bundleId, cohort) => {\n\tlet updateCandidate = null;\n\tfor (const bundle of bundles) if (bundle.id.localeCompare(bundleId) > 0 && isEligibleUpdateCandidate(bundle, cohort) && (!updateCandidate || bundle.id.localeCompare(updateCandidate.id) > 0)) updateCandidate = bundle;\n\treturn updateCandidate;\n};\nconst getUpdateInfo = async (bundles, args) => {\n\tswitch (args._updateStrategy) {\n\t\tcase \"appVersion\": return appVersionStrategy(bundles, args);\n\t\tcase \"fingerprint\": return fingerprintStrategy(bundles, args);\n\t\tdefault: return null;\n\t}\n};\nconst appVersionStrategy = async (bundles, { channel = \"production\", minBundleId = NIL_UUID, platform, appVersion, bundleId, cohort }) => {\n\tconst candidateBundles = [];\n\tfor (const b of bundles) {\n\t\tif (b.platform !== platform || b.channel !== channel || !b.targetAppVersion || !semverSatisfies(b.targetAppVersion, appVersion) || !b.enabled || minBundleId && b.id.localeCompare(minBundleId) < 0) continue;\n\t\tcandidateBundles.push(b);\n\t}\n\tif (candidateBundles.length === 0) {\n\t\tif (bundleId === NIL_UUID || minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;\n\t\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n\t}\n\tlet rollbackCandidate = null;\n\tlet currentBundle;\n\tfor (const b of candidateBundles) if (b.id === bundleId) currentBundle = b;\n\telse if (bundleId !== NIL_UUID && b.id.localeCompare(bundleId) < 0) {\n\t\tif (!rollbackCandidate || b.id.localeCompare(rollbackCandidate.id) > 0) rollbackCandidate = b;\n\t}\n\tconst updateCandidate = findLatestEligibleUpdateCandidate(candidateBundles, bundleId, cohort);\n\tconst currentBundleEligible = currentBundle ? isEligibleUpdateCandidate(currentBundle, cohort) : false;\n\tif (bundleId === NIL_UUID) {\n\t\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\t\treturn null;\n\t}\n\tif (currentBundleEligible) {\n\t\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\t\treturn null;\n\t}\n\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\tif (rollbackCandidate) return makeResponse(rollbackCandidate, \"ROLLBACK\");\n\tif (minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;\n\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n};\nconst fingerprintStrategy = async (bundles, { channel = \"production\", minBundleId = NIL_UUID, platform, fingerprintHash, bundleId, cohort }) => {\n\tconst candidateBundles = [];\n\tfor (const b of bundles) {\n\t\tif (b.platform !== platform || b.channel !== channel || !b.fingerprintHash || b.fingerprintHash !== fingerprintHash || !b.enabled || minBundleId && b.id.localeCompare(minBundleId) < 0) continue;\n\t\tcandidateBundles.push(b);\n\t}\n\tif (candidateBundles.length === 0) {\n\t\tif (bundleId === NIL_UUID || minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;\n\t\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n\t}\n\tlet rollbackCandidate = null;\n\tlet currentBundle;\n\tfor (const b of candidateBundles) if (b.id === bundleId) currentBundle = b;\n\telse if (bundleId !== NIL_UUID && b.id.localeCompare(bundleId) < 0) {\n\t\tif (!rollbackCandidate || b.id.localeCompare(rollbackCandidate.id) > 0) rollbackCandidate = b;\n\t}\n\tconst updateCandidate = findLatestEligibleUpdateCandidate(candidateBundles, bundleId, cohort);\n\tconst currentBundleEligible = currentBundle ? isEligibleUpdateCandidate(currentBundle, cohort) : false;\n\tif (bundleId === NIL_UUID) {\n\t\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\t\treturn null;\n\t}\n\tif (currentBundleEligible) {\n\t\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\t\treturn null;\n\t}\n\tif (updateCandidate) return makeResponse(updateCandidate, \"UPDATE\");\n\tif (rollbackCandidate) return makeResponse(rollbackCandidate, \"ROLLBACK\");\n\tif (minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;\n\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/buffer_utils.js\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\nfunction concat(...buffers) {\n\tconst size = buffers.reduce((acc, { length }) => acc + length, 0);\n\tconst buf = new Uint8Array(size);\n\tlet i = 0;\n\tfor (const buffer of buffers) {\n\t\tbuf.set(buffer, i);\n\t\ti += buffer.length;\n\t}\n\treturn buf;\n}\nfunction encode$1(string) {\n\tconst bytes = new Uint8Array(string.length);\n\tfor (let i = 0; i < string.length; i++) {\n\t\tconst code = string.charCodeAt(i);\n\t\tif (code > 127) throw new TypeError(\"non-ASCII string encountered in encode()\");\n\t\tbytes[i] = code;\n\t}\n\treturn bytes;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/base64.js\nfunction encodeBase64(input) {\n\tif (Uint8Array.prototype.toBase64) return input.toBase64();\n\tconst CHUNK_SIZE = 32768;\n\tconst arr = [];\n\tfor (let i = 0; i < input.length; i += CHUNK_SIZE) arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));\n\treturn btoa(arr.join(\"\"));\n}\nfunction decodeBase64(encoded) {\n\tif (Uint8Array.fromBase64) return Uint8Array.fromBase64(encoded);\n\tconst binary = atob(encoded);\n\tconst bytes = new Uint8Array(binary.length);\n\tfor (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n\treturn bytes;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/util/base64url.js\nfunction decode(input) {\n\tif (Uint8Array.fromBase64) return Uint8Array.fromBase64(typeof input === \"string\" ? input : decoder.decode(input), { alphabet: \"base64url\" });\n\tlet encoded = input;\n\tif (encoded instanceof Uint8Array) encoded = decoder.decode(encoded);\n\tencoded = encoded.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\ttry {\n\t\treturn decodeBase64(encoded);\n\t} catch {\n\t\tthrow new TypeError(\"The input to be decoded is not correctly encoded.\");\n\t}\n}\nfunction encode(input) {\n\tlet unencoded = input;\n\tif (typeof unencoded === \"string\") unencoded = encoder.encode(unencoded);\n\tif (Uint8Array.prototype.toBase64) return unencoded.toBase64({\n\t\talphabet: \"base64url\",\n\t\tomitPadding: true\n\t});\n\treturn encodeBase64(unencoded).replace(/=/g, \"\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\");\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/crypto_key.js\nconst unusable = (name, prop = \"algorithm.name\") => /* @__PURE__ */ new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);\nconst isAlgorithm = (algorithm, name) => algorithm.name === name;\nfunction getHashLength(hash) {\n\treturn parseInt(hash.name.slice(4), 10);\n}\nfunction checkHashLength(algorithm, expected) {\n\tif (getHashLength(algorithm.hash) !== expected) throw unusable(`SHA-${expected}`, \"algorithm.hash\");\n}\nfunction getNamedCurve(alg) {\n\tswitch (alg) {\n\t\tcase \"ES256\": return \"P-256\";\n\t\tcase \"ES384\": return \"P-384\";\n\t\tcase \"ES512\": return \"P-521\";\n\t\tdefault: throw new Error(\"unreachable\");\n\t}\n}\nfunction checkUsage(key, usage) {\n\tif (usage && !key.usages.includes(usage)) throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);\n}\nfunction checkSigCryptoKey(key, alg, usage) {\n\tswitch (alg) {\n\t\tcase \"HS256\":\n\t\tcase \"HS384\":\n\t\tcase \"HS512\":\n\t\t\tif (!isAlgorithm(key.algorithm, \"HMAC\")) throw unusable(\"HMAC\");\n\t\t\tcheckHashLength(key.algorithm, parseInt(alg.slice(2), 10));\n\t\t\tbreak;\n\t\tcase \"RS256\":\n\t\tcase \"RS384\":\n\t\tcase \"RS512\":\n\t\t\tif (!isAlgorithm(key.algorithm, \"RSASSA-PKCS1-v1_5\")) throw unusable(\"RSASSA-PKCS1-v1_5\");\n\t\t\tcheckHashLength(key.algorithm, parseInt(alg.slice(2), 10));\n\t\t\tbreak;\n\t\tcase \"PS256\":\n\t\tcase \"PS384\":\n\t\tcase \"PS512\":\n\t\t\tif (!isAlgorithm(key.algorithm, \"RSA-PSS\")) throw unusable(\"RSA-PSS\");\n\t\t\tcheckHashLength(key.algorithm, parseInt(alg.slice(2), 10));\n\t\t\tbreak;\n\t\tcase \"Ed25519\":\n\t\tcase \"EdDSA\":\n\t\t\tif (!isAlgorithm(key.algorithm, \"Ed25519\")) throw unusable(\"Ed25519\");\n\t\t\tbreak;\n\t\tcase \"ML-DSA-44\":\n\t\tcase \"ML-DSA-65\":\n\t\tcase \"ML-DSA-87\":\n\t\t\tif (!isAlgorithm(key.algorithm, alg)) throw unusable(alg);\n\t\t\tbreak;\n\t\tcase \"ES256\":\n\t\tcase \"ES384\":\n\t\tcase \"ES512\": {\n\t\t\tif (!isAlgorithm(key.algorithm, \"ECDSA\")) throw unusable(\"ECDSA\");\n\t\t\tconst expected = getNamedCurve(alg);\n\t\t\tif (key.algorithm.namedCurve !== expected) throw unusable(expected, \"algorithm.namedCurve\");\n\t\t\tbreak;\n\t\t}\n\t\tdefault: throw new TypeError(\"CryptoKey does not support this operation\");\n\t}\n\tcheckUsage(key, usage);\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/invalid_key_input.js\nfunction message(msg, actual, ...types) {\n\ttypes = types.filter(Boolean);\n\tif (types.length > 2) {\n\t\tconst last = types.pop();\n\t\tmsg += `one of type ${types.join(\", \")}, or ${last}.`;\n\t} else if (types.length === 2) msg += `one of type ${types[0]} or ${types[1]}.`;\n\telse msg += `of type ${types[0]}.`;\n\tif (actual == null) msg += ` Received ${actual}`;\n\telse if (typeof actual === \"function\" && actual.name) msg += ` Received function ${actual.name}`;\n\telse if (typeof actual === \"object\" && actual != null) {\n\t\tif (actual.constructor?.name) msg += ` Received an instance of ${actual.constructor.name}`;\n\t}\n\treturn msg;\n}\nconst invalidKeyInput = (actual, ...types) => message(\"Key must be \", actual, ...types);\nconst withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/util/errors.js\nvar JOSEError = class extends Error {\n\tstatic code = \"ERR_JOSE_GENERIC\";\n\tcode = \"ERR_JOSE_GENERIC\";\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tthis.name = this.constructor.name;\n\t\tError.captureStackTrace?.(this, this.constructor);\n\t}\n};\nvar JWTClaimValidationFailed = class extends JOSEError {\n\tstatic code = \"ERR_JWT_CLAIM_VALIDATION_FAILED\";\n\tcode = \"ERR_JWT_CLAIM_VALIDATION_FAILED\";\n\tclaim;\n\treason;\n\tpayload;\n\tconstructor(message, payload, claim = \"unspecified\", reason = \"unspecified\") {\n\t\tsuper(message, { cause: {\n\t\t\tclaim,\n\t\t\treason,\n\t\t\tpayload\n\t\t} });\n\t\tthis.claim = claim;\n\t\tthis.reason = reason;\n\t\tthis.payload = payload;\n\t}\n};\nvar JWTExpired = class extends JOSEError {\n\tstatic code = \"ERR_JWT_EXPIRED\";\n\tcode = \"ERR_JWT_EXPIRED\";\n\tclaim;\n\treason;\n\tpayload;\n\tconstructor(message, payload, claim = \"unspecified\", reason = \"unspecified\") {\n\t\tsuper(message, { cause: {\n\t\t\tclaim,\n\t\t\treason,\n\t\t\tpayload\n\t\t} });\n\t\tthis.claim = claim;\n\t\tthis.reason = reason;\n\t\tthis.payload = payload;\n\t}\n};\nvar JOSEAlgNotAllowed = class extends JOSEError {\n\tstatic code = \"ERR_JOSE_ALG_NOT_ALLOWED\";\n\tcode = \"ERR_JOSE_ALG_NOT_ALLOWED\";\n};\nvar JOSENotSupported = class extends JOSEError {\n\tstatic code = \"ERR_JOSE_NOT_SUPPORTED\";\n\tcode = \"ERR_JOSE_NOT_SUPPORTED\";\n};\nvar JWSInvalid = class extends JOSEError {\n\tstatic code = \"ERR_JWS_INVALID\";\n\tcode = \"ERR_JWS_INVALID\";\n};\nvar JWTInvalid = class extends JOSEError {\n\tstatic code = \"ERR_JWT_INVALID\";\n\tcode = \"ERR_JWT_INVALID\";\n};\nvar JWSSignatureVerificationFailed = class extends JOSEError {\n\tstatic code = \"ERR_JWS_SIGNATURE_VERIFICATION_FAILED\";\n\tcode = \"ERR_JWS_SIGNATURE_VERIFICATION_FAILED\";\n\tconstructor(message = \"signature verification failed\", options) {\n\t\tsuper(message, options);\n\t}\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/is_key_like.js\nconst isCryptoKey = (key) => {\n\tif (key?.[Symbol.toStringTag] === \"CryptoKey\") return true;\n\ttry {\n\t\treturn key instanceof CryptoKey;\n\t} catch {\n\t\treturn false;\n\t}\n};\nconst isKeyObject = (key) => key?.[Symbol.toStringTag] === \"KeyObject\";\nconst isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/helpers.js\nfunction assertNotSet(value, name) {\n\tif (value) throw new TypeError(`${name} can only be called once`);\n}\nfunction decodeBase64url(value, label, ErrorClass) {\n\ttry {\n\t\treturn decode(value);\n\t} catch {\n\t\tthrow new ErrorClass(`Failed to base64url decode the ${label}`);\n\t}\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/type_checks.js\nconst isObjectLike = (value) => typeof value === \"object\" && value !== null;\nfunction isObject(input) {\n\tif (!isObjectLike(input) || Object.prototype.toString.call(input) !== \"[object Object]\") return false;\n\tif (Object.getPrototypeOf(input) === null) return true;\n\tlet proto = input;\n\twhile (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);\n\treturn Object.getPrototypeOf(input) === proto;\n}\nfunction isDisjoint(...headers) {\n\tconst sources = headers.filter(Boolean);\n\tif (sources.length === 0 || sources.length === 1) return true;\n\tlet acc;\n\tfor (const header of sources) {\n\t\tconst parameters = Object.keys(header);\n\t\tif (!acc || acc.size === 0) {\n\t\t\tacc = new Set(parameters);\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const parameter of parameters) {\n\t\t\tif (acc.has(parameter)) return false;\n\t\t\tacc.add(parameter);\n\t\t}\n\t}\n\treturn true;\n}\nconst isJWK = (key) => isObject(key) && typeof key.kty === \"string\";\nconst isPrivateJWK = (key) => key.kty !== \"oct\" && (key.kty === \"AKP\" && typeof key.priv === \"string\" || typeof key.d === \"string\");\nconst isPublicJWK = (key) => key.kty !== \"oct\" && key.d === void 0 && key.priv === void 0;\nconst isSecretJWK = (key) => key.kty === \"oct\" && typeof key.k === \"string\";\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/signing.js\nfunction checkKeyLength(alg, key) {\n\tif (alg.startsWith(\"RS\") || alg.startsWith(\"PS\")) {\n\t\tconst { modulusLength } = key.algorithm;\n\t\tif (typeof modulusLength !== \"number\" || modulusLength < 2048) throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);\n\t}\n}\nfunction subtleAlgorithm(alg, algorithm) {\n\tconst hash = `SHA-${alg.slice(-3)}`;\n\tswitch (alg) {\n\t\tcase \"HS256\":\n\t\tcase \"HS384\":\n\t\tcase \"HS512\": return {\n\t\t\thash,\n\t\t\tname: \"HMAC\"\n\t\t};\n\t\tcase \"PS256\":\n\t\tcase \"PS384\":\n\t\tcase \"PS512\": return {\n\t\t\thash,\n\t\t\tname: \"RSA-PSS\",\n\t\t\tsaltLength: parseInt(alg.slice(-3), 10) >> 3\n\t\t};\n\t\tcase \"RS256\":\n\t\tcase \"RS384\":\n\t\tcase \"RS512\": return {\n\t\t\thash,\n\t\t\tname: \"RSASSA-PKCS1-v1_5\"\n\t\t};\n\t\tcase \"ES256\":\n\t\tcase \"ES384\":\n\t\tcase \"ES512\": return {\n\t\t\thash,\n\t\t\tname: \"ECDSA\",\n\t\t\tnamedCurve: algorithm.namedCurve\n\t\t};\n\t\tcase \"Ed25519\":\n\t\tcase \"EdDSA\": return { name: \"Ed25519\" };\n\t\tcase \"ML-DSA-44\":\n\t\tcase \"ML-DSA-65\":\n\t\tcase \"ML-DSA-87\": return { name: alg };\n\t\tdefault: throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);\n\t}\n}\nasync function getSigKey(alg, key, usage) {\n\tif (key instanceof Uint8Array) {\n\t\tif (!alg.startsWith(\"HS\")) throw new TypeError(invalidKeyInput(key, \"CryptoKey\", \"KeyObject\", \"JSON Web Key\"));\n\t\treturn crypto.subtle.importKey(\"raw\", key, {\n\t\t\thash: `SHA-${alg.slice(-3)}`,\n\t\t\tname: \"HMAC\"\n\t\t}, false, [usage]);\n\t}\n\tcheckSigCryptoKey(key, alg, usage);\n\treturn key;\n}\nasync function sign(alg, key, data) {\n\tconst cryptoKey = await getSigKey(alg, key, \"sign\");\n\tcheckKeyLength(alg, cryptoKey);\n\tconst signature = await crypto.subtle.sign(subtleAlgorithm(alg, cryptoKey.algorithm), cryptoKey, data);\n\treturn new Uint8Array(signature);\n}\nasync function verify(alg, key, signature, data) {\n\tconst cryptoKey = await getSigKey(alg, key, \"verify\");\n\tcheckKeyLength(alg, cryptoKey);\n\tconst algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);\n\ttry {\n\t\treturn await crypto.subtle.verify(algorithm, cryptoKey, signature, data);\n\t} catch {\n\t\treturn false;\n\t}\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/jwk_to_key.js\nconst unsupportedAlg = \"Invalid or unsupported JWK \\\"alg\\\" (Algorithm) Parameter value\";\nfunction subtleMapping(jwk) {\n\tlet algorithm;\n\tlet keyUsages;\n\tswitch (jwk.kty) {\n\t\tcase \"AKP\":\n\t\t\tswitch (jwk.alg) {\n\t\t\t\tcase \"ML-DSA-44\":\n\t\t\t\tcase \"ML-DSA-65\":\n\t\t\t\tcase \"ML-DSA-87\":\n\t\t\t\t\talgorithm = { name: jwk.alg };\n\t\t\t\t\tkeyUsages = jwk.priv ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: throw new JOSENotSupported(unsupportedAlg);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"RSA\":\n\t\t\tswitch (jwk.alg) {\n\t\t\t\tcase \"PS256\":\n\t\t\t\tcase \"PS384\":\n\t\t\t\tcase \"PS512\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"RSA-PSS\",\n\t\t\t\t\t\thash: `SHA-${jwk.alg.slice(-3)}`\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"RS256\":\n\t\t\t\tcase \"RS384\":\n\t\t\t\tcase \"RS512\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"RSASSA-PKCS1-v1_5\",\n\t\t\t\t\t\thash: `SHA-${jwk.alg.slice(-3)}`\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"RSA-OAEP\":\n\t\t\t\tcase \"RSA-OAEP-256\":\n\t\t\t\tcase \"RSA-OAEP-384\":\n\t\t\t\tcase \"RSA-OAEP-512\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"RSA-OAEP\",\n\t\t\t\t\t\thash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"decrypt\", \"unwrapKey\"] : [\"encrypt\", \"wrapKey\"];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: throw new JOSENotSupported(unsupportedAlg);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"EC\":\n\t\t\tswitch (jwk.alg) {\n\t\t\t\tcase \"ES256\":\n\t\t\t\tcase \"ES384\":\n\t\t\t\tcase \"ES512\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"ECDSA\",\n\t\t\t\t\t\tnamedCurve: {\n\t\t\t\t\t\t\tES256: \"P-256\",\n\t\t\t\t\t\t\tES384: \"P-384\",\n\t\t\t\t\t\t\tES512: \"P-521\"\n\t\t\t\t\t\t}[jwk.alg]\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ECDH-ES\":\n\t\t\t\tcase \"ECDH-ES+A128KW\":\n\t\t\t\tcase \"ECDH-ES+A192KW\":\n\t\t\t\tcase \"ECDH-ES+A256KW\":\n\t\t\t\t\talgorithm = {\n\t\t\t\t\t\tname: \"ECDH\",\n\t\t\t\t\t\tnamedCurve: jwk.crv\n\t\t\t\t\t};\n\t\t\t\t\tkeyUsages = jwk.d ? [\"deriveBits\"] : [];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: throw new JOSENotSupported(unsupportedAlg);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"OKP\":\n\t\t\tswitch (jwk.alg) {\n\t\t\t\tcase \"Ed25519\":\n\t\t\t\tcase \"EdDSA\":\n\t\t\t\t\talgorithm = { name: \"Ed25519\" };\n\t\t\t\t\tkeyUsages = jwk.d ? [\"sign\"] : [\"verify\"];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ECDH-ES\":\n\t\t\t\tcase \"ECDH-ES+A128KW\":\n\t\t\t\tcase \"ECDH-ES+A192KW\":\n\t\t\t\tcase \"ECDH-ES+A256KW\":\n\t\t\t\t\talgorithm = { name: jwk.crv };\n\t\t\t\t\tkeyUsages = jwk.d ? [\"deriveBits\"] : [];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: throw new JOSENotSupported(unsupportedAlg);\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault: throw new JOSENotSupported(\"Invalid or unsupported JWK \\\"kty\\\" (Key Type) Parameter value\");\n\t}\n\treturn {\n\t\talgorithm,\n\t\tkeyUsages\n\t};\n}\nasync function jwkToKey(jwk) {\n\tif (!jwk.alg) throw new TypeError(\"\\\"alg\\\" argument is required when \\\"jwk.alg\\\" is not present\");\n\tconst { algorithm, keyUsages } = subtleMapping(jwk);\n\tconst keyData = { ...jwk };\n\tif (keyData.kty !== \"AKP\") delete keyData.alg;\n\tdelete keyData.use;\n\treturn crypto.subtle.importKey(\"jwk\", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/normalize_key.js\nconst unusableForAlg = \"given KeyObject instance cannot be used for this algorithm\";\nlet cache;\nconst handleJWK = async (key, jwk, alg, freeze = false) => {\n\tcache ||= /* @__PURE__ */ new WeakMap();\n\tlet cached = cache.get(key);\n\tif (cached?.[alg]) return cached[alg];\n\tconst cryptoKey = await jwkToKey({\n\t\t...jwk,\n\t\talg\n\t});\n\tif (freeze) Object.freeze(key);\n\tif (!cached) cache.set(key, { [alg]: cryptoKey });\n\telse cached[alg] = cryptoKey;\n\treturn cryptoKey;\n};\nconst handleKeyObject = (keyObject, alg) => {\n\tcache ||= /* @__PURE__ */ new WeakMap();\n\tlet cached = cache.get(keyObject);\n\tif (cached?.[alg]) return cached[alg];\n\tconst isPublic = keyObject.type === \"public\";\n\tconst extractable = isPublic ? true : false;\n\tlet cryptoKey;\n\tif (keyObject.asymmetricKeyType === \"x25519\") {\n\t\tswitch (alg) {\n\t\t\tcase \"ECDH-ES\":\n\t\t\tcase \"ECDH-ES+A128KW\":\n\t\t\tcase \"ECDH-ES+A192KW\":\n\t\t\tcase \"ECDH-ES+A256KW\": break;\n\t\t\tdefault: throw new TypeError(unusableForAlg);\n\t\t}\n\t\tcryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : [\"deriveBits\"]);\n\t}\n\tif (keyObject.asymmetricKeyType === \"ed25519\") {\n\t\tif (alg !== \"EdDSA\" && alg !== \"Ed25519\") throw new TypeError(unusableForAlg);\n\t\tcryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [isPublic ? \"verify\" : \"sign\"]);\n\t}\n\tswitch (keyObject.asymmetricKeyType) {\n\t\tcase \"ml-dsa-44\":\n\t\tcase \"ml-dsa-65\":\n\t\tcase \"ml-dsa-87\":\n\t\t\tif (alg !== keyObject.asymmetricKeyType.toUpperCase()) throw new TypeError(unusableForAlg);\n\t\t\tcryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [isPublic ? \"verify\" : \"sign\"]);\n\t}\n\tif (keyObject.asymmetricKeyType === \"rsa\") {\n\t\tlet hash;\n\t\tswitch (alg) {\n\t\t\tcase \"RSA-OAEP\":\n\t\t\t\thash = \"SHA-1\";\n\t\t\t\tbreak;\n\t\t\tcase \"RS256\":\n\t\t\tcase \"PS256\":\n\t\t\tcase \"RSA-OAEP-256\":\n\t\t\t\thash = \"SHA-256\";\n\t\t\t\tbreak;\n\t\t\tcase \"RS384\":\n\t\t\tcase \"PS384\":\n\t\t\tcase \"RSA-OAEP-384\":\n\t\t\t\thash = \"SHA-384\";\n\t\t\t\tbreak;\n\t\t\tcase \"RS512\":\n\t\t\tcase \"PS512\":\n\t\t\tcase \"RSA-OAEP-512\":\n\t\t\t\thash = \"SHA-512\";\n\t\t\t\tbreak;\n\t\t\tdefault: throw new TypeError(unusableForAlg);\n\t\t}\n\t\tif (alg.startsWith(\"RSA-OAEP\")) return keyObject.toCryptoKey({\n\t\t\tname: \"RSA-OAEP\",\n\t\t\thash\n\t\t}, extractable, isPublic ? [\"encrypt\"] : [\"decrypt\"]);\n\t\tcryptoKey = keyObject.toCryptoKey({\n\t\t\tname: alg.startsWith(\"PS\") ? \"RSA-PSS\" : \"RSASSA-PKCS1-v1_5\",\n\t\t\thash\n\t\t}, extractable, [isPublic ? \"verify\" : \"sign\"]);\n\t}\n\tif (keyObject.asymmetricKeyType === \"ec\") {\n\t\tconst namedCurve = new Map([\n\t\t\t[\"prime256v1\", \"P-256\"],\n\t\t\t[\"secp384r1\", \"P-384\"],\n\t\t\t[\"secp521r1\", \"P-521\"]\n\t\t]).get(keyObject.asymmetricKeyDetails?.namedCurve);\n\t\tif (!namedCurve) throw new TypeError(unusableForAlg);\n\t\tconst expectedCurve = {\n\t\t\tES256: \"P-256\",\n\t\t\tES384: \"P-384\",\n\t\t\tES512: \"P-521\"\n\t\t};\n\t\tif (expectedCurve[alg] && namedCurve === expectedCurve[alg]) cryptoKey = keyObject.toCryptoKey({\n\t\t\tname: \"ECDSA\",\n\t\t\tnamedCurve\n\t\t}, extractable, [isPublic ? \"verify\" : \"sign\"]);\n\t\tif (alg.startsWith(\"ECDH-ES\")) cryptoKey = keyObject.toCryptoKey({\n\t\t\tname: \"ECDH\",\n\t\t\tnamedCurve\n\t\t}, extractable, isPublic ? [] : [\"deriveBits\"]);\n\t}\n\tif (!cryptoKey) throw new TypeError(unusableForAlg);\n\tif (!cached) cache.set(keyObject, { [alg]: cryptoKey });\n\telse cached[alg] = cryptoKey;\n\treturn cryptoKey;\n};\nasync function normalizeKey(key, alg) {\n\tif (key instanceof Uint8Array) return key;\n\tif (isCryptoKey(key)) return key;\n\tif (isKeyObject(key)) {\n\t\tif (key.type === \"secret\") return key.export();\n\t\tif (\"toCryptoKey\" in key && typeof key.toCryptoKey === \"function\") try {\n\t\t\treturn handleKeyObject(key, alg);\n\t\t} catch (err) {\n\t\t\tif (err instanceof TypeError) throw err;\n\t\t}\n\t\treturn handleJWK(key, key.export({ format: \"jwk\" }), alg);\n\t}\n\tif (isJWK(key)) {\n\t\tif (key.k) return decode(key.k);\n\t\treturn handleJWK(key, key, alg, true);\n\t}\n\tthrow new Error(\"unreachable\");\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/validate_crit.js\nfunction validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {\n\tif (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) throw new Err(\"\\\"crit\\\" (Critical) Header Parameter MUST be integrity protected\");\n\tif (!protectedHeader || protectedHeader.crit === void 0) return /* @__PURE__ */ new Set();\n\tif (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== \"string\" || input.length === 0)) throw new Err(\"\\\"crit\\\" (Critical) Header Parameter MUST be an array of non-empty strings when present\");\n\tlet recognized;\n\tif (recognizedOption !== void 0) recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);\n\telse recognized = recognizedDefault;\n\tfor (const parameter of protectedHeader.crit) {\n\t\tif (!recognized.has(parameter)) throw new JOSENotSupported(`Extension Header Parameter \"${parameter}\" is not recognized`);\n\t\tif (joseHeader[parameter] === void 0) throw new Err(`Extension Header Parameter \"${parameter}\" is missing`);\n\t\tif (recognized.get(parameter) && protectedHeader[parameter] === void 0) throw new Err(`Extension Header Parameter \"${parameter}\" MUST be integrity protected`);\n\t}\n\treturn new Set(protectedHeader.crit);\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/validate_algorithms.js\nfunction validateAlgorithms(option, algorithms) {\n\tif (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== \"string\"))) throw new TypeError(`\"${option}\" option must be an array of strings`);\n\tif (!algorithms) return;\n\treturn new Set(algorithms);\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/check_key_type.js\nconst tag = (key) => key?.[Symbol.toStringTag];\nconst jwkMatchesOp = (alg, key, usage) => {\n\tif (key.use !== void 0) {\n\t\tlet expected;\n\t\tswitch (usage) {\n\t\t\tcase \"sign\":\n\t\t\tcase \"verify\":\n\t\t\t\texpected = \"sig\";\n\t\t\t\tbreak;\n\t\t\tcase \"encrypt\":\n\t\t\tcase \"decrypt\":\n\t\t\t\texpected = \"enc\";\n\t\t\t\tbreak;\n\t\t}\n\t\tif (key.use !== expected) throw new TypeError(`Invalid key for this operation, its \"use\" must be \"${expected}\" when present`);\n\t}\n\tif (key.alg !== void 0 && key.alg !== alg) throw new TypeError(`Invalid key for this operation, its \"alg\" must be \"${alg}\" when present`);\n\tif (Array.isArray(key.key_ops)) {\n\t\tlet expectedKeyOp;\n\t\tswitch (true) {\n\t\t\tcase usage === \"sign\" || usage === \"verify\":\n\t\t\tcase alg === \"dir\":\n\t\t\tcase alg.includes(\"CBC-HS\"):\n\t\t\t\texpectedKeyOp = usage;\n\t\t\t\tbreak;\n\t\t\tcase alg.startsWith(\"PBES2\"):\n\t\t\t\texpectedKeyOp = \"deriveBits\";\n\t\t\t\tbreak;\n\t\t\tcase /^A\\d{3}(?:GCM)?(?:KW)?$/.test(alg):\n\t\t\t\tif (!alg.includes(\"GCM\") && alg.endsWith(\"KW\")) expectedKeyOp = usage === \"encrypt\" ? \"wrapKey\" : \"unwrapKey\";\n\t\t\t\telse expectedKeyOp = usage;\n\t\t\t\tbreak;\n\t\t\tcase usage === \"encrypt\" && alg.startsWith(\"RSA\"):\n\t\t\t\texpectedKeyOp = \"wrapKey\";\n\t\t\t\tbreak;\n\t\t\tcase usage === \"decrypt\":\n\t\t\t\texpectedKeyOp = alg.startsWith(\"RSA\") ? \"unwrapKey\" : \"deriveBits\";\n\t\t\t\tbreak;\n\t\t}\n\t\tif (expectedKeyOp && key.key_ops?.includes?.(expectedKeyOp) === false) throw new TypeError(`Invalid key for this operation, its \"key_ops\" must include \"${expectedKeyOp}\" when present`);\n\t}\n\treturn true;\n};\nconst symmetricTypeCheck = (alg, key, usage) => {\n\tif (key instanceof Uint8Array) return;\n\tif (isJWK(key)) {\n\t\tif (isSecretJWK(key) && jwkMatchesOp(alg, key, usage)) return;\n\t\tthrow new TypeError(`JSON Web Key for symmetric algorithms must have JWK \"kty\" (Key Type) equal to \"oct\" and the JWK \"k\" (Key Value) present`);\n\t}\n\tif (!isKeyLike(key)) throw new TypeError(withAlg(alg, key, \"CryptoKey\", \"KeyObject\", \"JSON Web Key\", \"Uint8Array\"));\n\tif (key.type !== \"secret\") throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type \"secret\"`);\n};\nconst asymmetricTypeCheck = (alg, key, usage) => {\n\tif (isJWK(key)) switch (usage) {\n\t\tcase \"decrypt\":\n\t\tcase \"sign\":\n\t\t\tif (isPrivateJWK(key) && jwkMatchesOp(alg, key, usage)) return;\n\t\t\tthrow new TypeError(`JSON Web Key for this operation must be a private JWK`);\n\t\tcase \"encrypt\":\n\t\tcase \"verify\":\n\t\t\tif (isPublicJWK(key) && jwkMatchesOp(alg, key, usage)) return;\n\t\t\tthrow new TypeError(`JSON Web Key for this operation must be a public JWK`);\n\t}\n\tif (!isKeyLike(key)) throw new TypeError(withAlg(alg, key, \"CryptoKey\", \"KeyObject\", \"JSON Web Key\"));\n\tif (key.type === \"secret\") throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type \"secret\"`);\n\tif (key.type === \"public\") switch (usage) {\n\t\tcase \"sign\": throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type \"private\"`);\n\t\tcase \"decrypt\": throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type \"private\"`);\n\t}\n\tif (key.type === \"private\") switch (usage) {\n\t\tcase \"verify\": throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type \"public\"`);\n\t\tcase \"encrypt\": throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type \"public\"`);\n\t}\n};\nfunction checkKeyType(alg, key, usage) {\n\tswitch (alg.substring(0, 2)) {\n\t\tcase \"A1\":\n\t\tcase \"A2\":\n\t\tcase \"di\":\n\t\tcase \"HS\":\n\t\tcase \"PB\":\n\t\t\tsymmetricTypeCheck(alg, key, usage);\n\t\t\tbreak;\n\t\tdefault: asymmetricTypeCheck(alg, key, usage);\n\t}\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jws/flattened/verify.js\nasync function flattenedVerify(jws, key, options) {\n\tif (!isObject(jws)) throw new JWSInvalid(\"Flattened JWS must be an object\");\n\tif (jws.protected === void 0 && jws.header === void 0) throw new JWSInvalid(\"Flattened JWS must have either of the \\\"protected\\\" or \\\"header\\\" members\");\n\tif (jws.protected !== void 0 && typeof jws.protected !== \"string\") throw new JWSInvalid(\"JWS Protected Header incorrect type\");\n\tif (jws.payload === void 0) throw new JWSInvalid(\"JWS Payload missing\");\n\tif (typeof jws.signature !== \"string\") throw new JWSInvalid(\"JWS Signature missing or incorrect type\");\n\tif (jws.header !== void 0 && !isObject(jws.header)) throw new JWSInvalid(\"JWS Unprotected Header incorrect type\");\n\tlet parsedProt = {};\n\tif (jws.protected) try {\n\t\tconst protectedHeader = decode(jws.protected);\n\t\tparsedProt = JSON.parse(decoder.decode(protectedHeader));\n\t} catch {\n\t\tthrow new JWSInvalid(\"JWS Protected Header is invalid\");\n\t}\n\tif (!isDisjoint(parsedProt, jws.header)) throw new JWSInvalid(\"JWS Protected and JWS Unprotected Header Parameter names must be disjoint\");\n\tconst joseHeader = {\n\t\t...parsedProt,\n\t\t...jws.header\n\t};\n\tconst extensions = validateCrit(JWSInvalid, new Map([[\"b64\", true]]), options?.crit, parsedProt, joseHeader);\n\tlet b64 = true;\n\tif (extensions.has(\"b64\")) {\n\t\tb64 = parsedProt.b64;\n\t\tif (typeof b64 !== \"boolean\") throw new JWSInvalid(\"The \\\"b64\\\" (base64url-encode payload) Header Parameter must be a boolean\");\n\t}\n\tconst { alg } = joseHeader;\n\tif (typeof alg !== \"string\" || !alg) throw new JWSInvalid(\"JWS \\\"alg\\\" (Algorithm) Header Parameter missing or invalid\");\n\tconst algorithms = options && validateAlgorithms(\"algorithms\", options.algorithms);\n\tif (algorithms && !algorithms.has(alg)) throw new JOSEAlgNotAllowed(\"\\\"alg\\\" (Algorithm) Header Parameter value not allowed\");\n\tif (b64) {\n\t\tif (typeof jws.payload !== \"string\") throw new JWSInvalid(\"JWS Payload must be a string\");\n\t} else if (typeof jws.payload !== \"string\" && !(jws.payload instanceof Uint8Array)) throw new JWSInvalid(\"JWS Payload must be a string or an Uint8Array instance\");\n\tlet resolvedKey = false;\n\tif (typeof key === \"function\") {\n\t\tkey = await key(parsedProt, jws);\n\t\tresolvedKey = true;\n\t}\n\tcheckKeyType(alg, key, \"verify\");\n\tconst data = concat(jws.protected !== void 0 ? encode$1(jws.protected) : new Uint8Array(), encode$1(\".\"), typeof jws.payload === \"string\" ? b64 ? encode$1(jws.payload) : encoder.encode(jws.payload) : jws.payload);\n\tconst signature = decodeBase64url(jws.signature, \"signature\", JWSInvalid);\n\tconst k = await normalizeKey(key, alg);\n\tif (!await verify(alg, k, signature, data)) throw new JWSSignatureVerificationFailed();\n\tlet payload;\n\tif (b64) payload = decodeBase64url(jws.payload, \"payload\", JWSInvalid);\n\telse if (typeof jws.payload === \"string\") payload = encoder.encode(jws.payload);\n\telse payload = jws.payload;\n\tconst result = { payload };\n\tif (jws.protected !== void 0) result.protectedHeader = parsedProt;\n\tif (jws.header !== void 0) result.unprotectedHeader = jws.header;\n\tif (resolvedKey) return {\n\t\t...result,\n\t\tkey: k\n\t};\n\treturn result;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jws/compact/verify.js\nasync function compactVerify(jws, key, options) {\n\tif (jws instanceof Uint8Array) jws = decoder.decode(jws);\n\tif (typeof jws !== \"string\") throw new JWSInvalid(\"Compact JWS must be a string or Uint8Array\");\n\tconst { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split(\".\");\n\tif (length !== 3) throw new JWSInvalid(\"Invalid Compact JWS\");\n\tconst verified = await flattenedVerify({\n\t\tpayload,\n\t\tprotected: protectedHeader,\n\t\tsignature\n\t}, key, options);\n\tconst result = {\n\t\tpayload: verified.payload,\n\t\tprotectedHeader: verified.protectedHeader\n\t};\n\tif (typeof key === \"function\") return {\n\t\t...result,\n\t\tkey: verified.key\n\t};\n\treturn result;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/lib/jwt_claims_set.js\nconst epoch = (date) => Math.floor(date.getTime() / 1e3);\nconst minute = 60;\nconst hour = minute * 60;\nconst day = hour * 24;\nconst week = day * 7;\nconst year = day * 365.25;\nconst REGEX = /^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;\nfunction secs(str) {\n\tconst matched = REGEX.exec(str);\n\tif (!matched || matched[4] && matched[1]) throw new TypeError(\"Invalid time period format\");\n\tconst value = parseFloat(matched[2]);\n\tconst unit = matched[3].toLowerCase();\n\tlet numericDate;\n\tswitch (unit) {\n\t\tcase \"sec\":\n\t\tcase \"secs\":\n\t\tcase \"second\":\n\t\tcase \"seconds\":\n\t\tcase \"s\":\n\t\t\tnumericDate = Math.round(value);\n\t\t\tbreak;\n\t\tcase \"minute\":\n\t\tcase \"minutes\":\n\t\tcase \"min\":\n\t\tcase \"mins\":\n\t\tcase \"m\":\n\t\t\tnumericDate = Math.round(value * minute);\n\t\t\tbreak;\n\t\tcase \"hour\":\n\t\tcase \"hours\":\n\t\tcase \"hr\":\n\t\tcase \"hrs\":\n\t\tcase \"h\":\n\t\t\tnumericDate = Math.round(value * hour);\n\t\t\tbreak;\n\t\tcase \"day\":\n\t\tcase \"days\":\n\t\tcase \"d\":\n\t\t\tnumericDate = Math.round(value * day);\n\t\t\tbreak;\n\t\tcase \"week\":\n\t\tcase \"weeks\":\n\t\tcase \"w\":\n\t\t\tnumericDate = Math.round(value * week);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tnumericDate = Math.round(value * year);\n\t\t\tbreak;\n\t}\n\tif (matched[1] === \"-\" || matched[4] === \"ago\") return -numericDate;\n\treturn numericDate;\n}\nfunction validateInput(label, input) {\n\tif (!Number.isFinite(input)) throw new TypeError(`Invalid ${label} input`);\n\treturn input;\n}\nconst normalizeTyp = (value) => {\n\tif (value.includes(\"/\")) return value.toLowerCase();\n\treturn `application/${value.toLowerCase()}`;\n};\nconst checkAudiencePresence = (audPayload, audOption) => {\n\tif (typeof audPayload === \"string\") return audOption.includes(audPayload);\n\tif (Array.isArray(audPayload)) return audOption.some(Set.prototype.has.bind(new Set(audPayload)));\n\treturn false;\n};\nfunction validateClaimsSet(protectedHeader, encodedPayload, options = {}) {\n\tlet payload;\n\ttry {\n\t\tpayload = JSON.parse(decoder.decode(encodedPayload));\n\t} catch {}\n\tif (!isObject(payload)) throw new JWTInvalid(\"JWT Claims Set must be a top-level JSON object\");\n\tconst { typ } = options;\n\tif (typ && (typeof protectedHeader.typ !== \"string\" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) throw new JWTClaimValidationFailed(\"unexpected \\\"typ\\\" JWT header value\", payload, \"typ\", \"check_failed\");\n\tconst { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;\n\tconst presenceCheck = [...requiredClaims];\n\tif (maxTokenAge !== void 0) presenceCheck.push(\"iat\");\n\tif (audience !== void 0) presenceCheck.push(\"aud\");\n\tif (subject !== void 0) presenceCheck.push(\"sub\");\n\tif (issuer !== void 0) presenceCheck.push(\"iss\");\n\tfor (const claim of new Set(presenceCheck.reverse())) if (!(claim in payload)) throw new JWTClaimValidationFailed(`missing required \"${claim}\" claim`, payload, claim, \"missing\");\n\tif (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) throw new JWTClaimValidationFailed(\"unexpected \\\"iss\\\" claim value\", payload, \"iss\", \"check_failed\");\n\tif (subject && payload.sub !== subject) throw new JWTClaimValidationFailed(\"unexpected \\\"sub\\\" claim value\", payload, \"sub\", \"check_failed\");\n\tif (audience && !checkAudiencePresence(payload.aud, typeof audience === \"string\" ? [audience] : audience)) throw new JWTClaimValidationFailed(\"unexpected \\\"aud\\\" claim value\", payload, \"aud\", \"check_failed\");\n\tlet tolerance;\n\tswitch (typeof options.clockTolerance) {\n\t\tcase \"string\":\n\t\t\ttolerance = secs(options.clockTolerance);\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\t\ttolerance = options.clockTolerance;\n\t\t\tbreak;\n\t\tcase \"undefined\":\n\t\t\ttolerance = 0;\n\t\t\tbreak;\n\t\tdefault: throw new TypeError(\"Invalid clockTolerance option type\");\n\t}\n\tconst { currentDate } = options;\n\tconst now = epoch(currentDate || /* @__PURE__ */ new Date());\n\tif ((payload.iat !== void 0 || maxTokenAge) && typeof payload.iat !== \"number\") throw new JWTClaimValidationFailed(\"\\\"iat\\\" claim must be a number\", payload, \"iat\", \"invalid\");\n\tif (payload.nbf !== void 0) {\n\t\tif (typeof payload.nbf !== \"number\") throw new JWTClaimValidationFailed(\"\\\"nbf\\\" claim must be a number\", payload, \"nbf\", \"invalid\");\n\t\tif (payload.nbf > now + tolerance) throw new JWTClaimValidationFailed(\"\\\"nbf\\\" claim timestamp check failed\", payload, \"nbf\", \"check_failed\");\n\t}\n\tif (payload.exp !== void 0) {\n\t\tif (typeof payload.exp !== \"number\") throw new JWTClaimValidationFailed(\"\\\"exp\\\" claim must be a number\", payload, \"exp\", \"invalid\");\n\t\tif (payload.exp <= now - tolerance) throw new JWTExpired(\"\\\"exp\\\" claim timestamp check failed\", payload, \"exp\", \"check_failed\");\n\t}\n\tif (maxTokenAge) {\n\t\tconst age = now - payload.iat;\n\t\tconst max = typeof maxTokenAge === \"number\" ? maxTokenAge : secs(maxTokenAge);\n\t\tif (age - tolerance > max) throw new JWTExpired(\"\\\"iat\\\" claim timestamp check failed (too far in the past)\", payload, \"iat\", \"check_failed\");\n\t\tif (age < 0 - tolerance) throw new JWTClaimValidationFailed(\"\\\"iat\\\" claim timestamp check failed (it should be in the past)\", payload, \"iat\", \"check_failed\");\n\t}\n\treturn payload;\n}\nvar JWTClaimsBuilder = class {\n\t#payload;\n\tconstructor(payload) {\n\t\tif (!isObject(payload)) throw new TypeError(\"JWT Claims Set MUST be an object\");\n\t\tthis.#payload = structuredClone(payload);\n\t}\n\tdata() {\n\t\treturn encoder.encode(JSON.stringify(this.#payload));\n\t}\n\tget iss() {\n\t\treturn this.#payload.iss;\n\t}\n\tset iss(value) {\n\t\tthis.#payload.iss = value;\n\t}\n\tget sub() {\n\t\treturn this.#payload.sub;\n\t}\n\tset sub(value) {\n\t\tthis.#payload.sub = value;\n\t}\n\tget aud() {\n\t\treturn this.#payload.aud;\n\t}\n\tset aud(value) {\n\t\tthis.#payload.aud = value;\n\t}\n\tset jti(value) {\n\t\tthis.#payload.jti = value;\n\t}\n\tset nbf(value) {\n\t\tif (typeof value === \"number\") this.#payload.nbf = validateInput(\"setNotBefore\", value);\n\t\telse if (value instanceof Date) this.#payload.nbf = validateInput(\"setNotBefore\", epoch(value));\n\t\telse this.#payload.nbf = epoch(/* @__PURE__ */ new Date()) + secs(value);\n\t}\n\tset exp(value) {\n\t\tif (typeof value === \"number\") this.#payload.exp = validateInput(\"setExpirationTime\", value);\n\t\telse if (value instanceof Date) this.#payload.exp = validateInput(\"setExpirationTime\", epoch(value));\n\t\telse this.#payload.exp = epoch(/* @__PURE__ */ new Date()) + secs(value);\n\t}\n\tset iat(value) {\n\t\tif (value === void 0) this.#payload.iat = epoch(/* @__PURE__ */ new Date());\n\t\telse if (value instanceof Date) this.#payload.iat = validateInput(\"setIssuedAt\", epoch(value));\n\t\telse if (typeof value === \"string\") this.#payload.iat = validateInput(\"setIssuedAt\", epoch(/* @__PURE__ */ new Date()) + secs(value));\n\t\telse this.#payload.iat = validateInput(\"setIssuedAt\", value);\n\t}\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jwt/verify.js\nasync function jwtVerify(jwt, key, options) {\n\tconst verified = await compactVerify(jwt, key, options);\n\tif (verified.protectedHeader.crit?.includes(\"b64\") && verified.protectedHeader.b64 === false) throw new JWTInvalid(\"JWTs MUST NOT use unencoded payload\");\n\tconst result = {\n\t\tpayload: validateClaimsSet(verified.protectedHeader, verified.payload, options),\n\t\tprotectedHeader: verified.protectedHeader\n\t};\n\tif (typeof key === \"function\") return {\n\t\t...result,\n\t\tkey: verified.key\n\t};\n\treturn result;\n}\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jws/flattened/sign.js\nvar FlattenedSign = class {\n\t#payload;\n\t#protectedHeader;\n\t#unprotectedHeader;\n\tconstructor(payload) {\n\t\tif (!(payload instanceof Uint8Array)) throw new TypeError(\"payload must be an instance of Uint8Array\");\n\t\tthis.#payload = payload;\n\t}\n\tsetProtectedHeader(protectedHeader) {\n\t\tassertNotSet(this.#protectedHeader, \"setProtectedHeader\");\n\t\tthis.#protectedHeader = protectedHeader;\n\t\treturn this;\n\t}\n\tsetUnprotectedHeader(unprotectedHeader) {\n\t\tassertNotSet(this.#unprotectedHeader, \"setUnprotectedHeader\");\n\t\tthis.#unprotectedHeader = unprotectedHeader;\n\t\treturn this;\n\t}\n\tasync sign(key, options) {\n\t\tif (!this.#protectedHeader && !this.#unprotectedHeader) throw new JWSInvalid(\"either setProtectedHeader or setUnprotectedHeader must be called before #sign()\");\n\t\tif (!isDisjoint(this.#protectedHeader, this.#unprotectedHeader)) throw new JWSInvalid(\"JWS Protected and JWS Unprotected Header Parameter names must be disjoint\");\n\t\tconst joseHeader = {\n\t\t\t...this.#protectedHeader,\n\t\t\t...this.#unprotectedHeader\n\t\t};\n\t\tconst extensions = validateCrit(JWSInvalid, new Map([[\"b64\", true]]), options?.crit, this.#protectedHeader, joseHeader);\n\t\tlet b64 = true;\n\t\tif (extensions.has(\"b64\")) {\n\t\t\tb64 = this.#protectedHeader.b64;\n\t\t\tif (typeof b64 !== \"boolean\") throw new JWSInvalid(\"The \\\"b64\\\" (base64url-encode payload) Header Parameter must be a boolean\");\n\t\t}\n\t\tconst { alg } = joseHeader;\n\t\tif (typeof alg !== \"string\" || !alg) throw new JWSInvalid(\"JWS \\\"alg\\\" (Algorithm) Header Parameter missing or invalid\");\n\t\tcheckKeyType(alg, key, \"sign\");\n\t\tlet payloadS;\n\t\tlet payloadB;\n\t\tif (b64) {\n\t\t\tpayloadS = encode(this.#payload);\n\t\t\tpayloadB = encode$1(payloadS);\n\t\t} else {\n\t\t\tpayloadB = this.#payload;\n\t\t\tpayloadS = \"\";\n\t\t}\n\t\tlet protectedHeaderString;\n\t\tlet protectedHeaderBytes;\n\t\tif (this.#protectedHeader) {\n\t\t\tprotectedHeaderString = encode(JSON.stringify(this.#protectedHeader));\n\t\t\tprotectedHeaderBytes = encode$1(protectedHeaderString);\n\t\t} else {\n\t\t\tprotectedHeaderString = \"\";\n\t\t\tprotectedHeaderBytes = new Uint8Array();\n\t\t}\n\t\tconst data = concat(protectedHeaderBytes, encode$1(\".\"), payloadB);\n\t\tconst jws = {\n\t\t\tsignature: encode(await sign(alg, await normalizeKey(key, alg), data)),\n\t\t\tpayload: payloadS\n\t\t};\n\t\tif (this.#unprotectedHeader) jws.header = this.#unprotectedHeader;\n\t\tif (this.#protectedHeader) jws.protected = protectedHeaderString;\n\t\treturn jws;\n\t}\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jws/compact/sign.js\nvar CompactSign = class {\n\t#flattened;\n\tconstructor(payload) {\n\t\tthis.#flattened = new FlattenedSign(payload);\n\t}\n\tsetProtectedHeader(protectedHeader) {\n\t\tthis.#flattened.setProtectedHeader(protectedHeader);\n\t\treturn this;\n\t}\n\tasync sign(key, options) {\n\t\tconst jws = await this.#flattened.sign(key, options);\n\t\tif (jws.payload === void 0) throw new TypeError(\"use the flattened module for creating JWS with b64: false\");\n\t\treturn `${jws.protected}.${jws.payload}.${jws.signature}`;\n\t}\n};\n//#endregion\n//#region ../../node_modules/.pnpm/jose@6.2.3/node_modules/jose/dist/webapi/jwt/sign.js\nvar SignJWT = class {\n\t#protectedHeader;\n\t#jwt;\n\tconstructor(payload = {}) {\n\t\tthis.#jwt = new JWTClaimsBuilder(payload);\n\t}\n\tsetIssuer(issuer) {\n\t\tthis.#jwt.iss = issuer;\n\t\treturn this;\n\t}\n\tsetSubject(subject) {\n\t\tthis.#jwt.sub = subject;\n\t\treturn this;\n\t}\n\tsetAudience(audience) {\n\t\tthis.#jwt.aud = audience;\n\t\treturn this;\n\t}\n\tsetJti(jwtId) {\n\t\tthis.#jwt.jti = jwtId;\n\t\treturn this;\n\t}\n\tsetNotBefore(input) {\n\t\tthis.#jwt.nbf = input;\n\t\treturn this;\n\t}\n\tsetExpirationTime(input) {\n\t\tthis.#jwt.exp = input;\n\t\treturn this;\n\t}\n\tsetIssuedAt(input) {\n\t\tthis.#jwt.iat = input;\n\t\treturn this;\n\t}\n\tsetProtectedHeader(protectedHeader) {\n\t\tthis.#protectedHeader = protectedHeader;\n\t\treturn this;\n\t}\n\tasync sign(key, options) {\n\t\tconst sig = new CompactSign(this.#jwt.data());\n\t\tsig.setProtectedHeader(this.#protectedHeader);\n\t\tif (Array.isArray(this.#protectedHeader?.crit) && this.#protectedHeader.crit.includes(\"b64\") && this.#protectedHeader.b64 === false) throw new JWTInvalid(\"JWTs MUST NOT use unencoded payload\");\n\t\treturn sig.sign(key, options);\n\t}\n};\n//#endregion\n//#region src/verifyJwtSignedUrl.ts\n/**\n* Verifies JWT token only and returns the file key (path with leading slashes removed) if valid.\n*/\nconst verifyJwtToken = async ({ path, token, jwtSecret }) => {\n\tconst key = path.replace(/^\\/+/, \"\");\n\tif (!token) return {\n\t\tvalid: false,\n\t\terror: \"Missing token\"\n\t};\n\ttry {\n\t\tconst { payload } = await jwtVerify(token, new TextEncoder().encode(jwtSecret));\n\t\tif (!payload || payload.key !== key) return {\n\t\t\tvalid: false,\n\t\t\terror: \"Token does not match requested file\"\n\t\t};\n\t\treturn {\n\t\t\tvalid: true,\n\t\t\tkey\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terror: \"Invalid or expired token\"\n\t\t};\n\t}\n};\n/**\n* Retrieves file data through the handler and constructs a response object with appropriate headers for download.\n*/\nconst getFileResponse = async ({ key, handler }) => {\n\tconst object = await handler(key);\n\tif (!object) return {\n\t\tstatus: 404,\n\t\terror: \"File not found\"\n\t};\n\tconst pathParts = key.split(\"/\");\n\tconst fileName = pathParts[pathParts.length - 1];\n\treturn {\n\t\tstatus: 200,\n\t\tresponseHeaders: {\n\t\t\t\"Content-Type\": object.contentType || \"application/octet-stream\",\n\t\t\t\"Content-Disposition\": `attachment; filename=${fileName}`\n\t\t},\n\t\tresponseBody: object.body\n\t};\n};\n/**\n* Integrated function for JWT verification and file handling.\n* - Returns error response if token is missing or validation fails.\n* - On success, retrieves file data through the handler and constructs a response object.\n*/\nconst verifyJwtSignedUrl = async ({ path, token, jwtSecret, handler }) => {\n\tconst result = await verifyJwtToken({\n\t\tpath,\n\t\ttoken,\n\t\tjwtSecret\n\t});\n\tif (!result.valid) {\n\t\tif (result.error === \"Missing token\") return {\n\t\t\tstatus: 400,\n\t\t\terror: result.error\n\t\t};\n\t\treturn {\n\t\t\tstatus: 403,\n\t\t\terror: result.error || \"Unauthorized\"\n\t\t};\n\t}\n\treturn getFileResponse({\n\t\tkey: result.key,\n\t\thandler\n\t});\n};\n//#endregion\n//#region src/withJwtSignedUrl.ts\n/**\n* Creates a JWT-signed download URL based on the provided update information.\n*\n* @param {Object} options - Function options\n* @param {T|null} options.data - Update information (null if none)\n* @param {string} options.reqUrl - Request URL (base URL for token generation)\n* @param {string} options.jwtSecret - Secret key for JWT signing\n* @returns {Promise<T|null>} - Update response object with fileUrl or null\n*/\nconst withJwtSignedUrl = async ({ data, reqUrl, jwtSecret }) => {\n\tif (!data) return null;\n\tconst { storageUri, ...rest } = data;\n\tif (data.id === NIL_UUID || !storageUri) return {\n\t\t...rest,\n\t\tfileUrl: null\n\t};\n\tconst storageUrl = new URL(storageUri);\n\tconst key = `${storageUrl.host}${storageUrl.pathname}`;\n\tconst token = await signToken(key, jwtSecret);\n\tconst url = new URL(reqUrl);\n\turl.pathname = key;\n\turl.searchParams.set(\"token\", token);\n\treturn {\n\t\t...rest,\n\t\tfileUrl: url.toString()\n\t};\n};\nconst signToken = async (key, jwtSecret) => {\n\tconst secretKey = new TextEncoder().encode(jwtSecret);\n\treturn await new SignJWT({ key }).setProtectedHeader({ alg: \"HS256\" }).setExpirationTime(\"60s\").sign(secretKey);\n};\n//#endregion\nexport { filterCompatibleAppVersions, getUpdateInfo, semverSatisfies, signToken, verifyJwtSignedUrl, verifyJwtToken, withJwtSignedUrl };\n", "import { seedRequestUpdateBundles } from \"./requestUpdateBundleState.mjs\";\nimport { NIL_UUID } from \"@hot-updater/core\";\nimport { getUpdateInfo } from \"@hot-updater/js\";\n//#region src/resolveUpdateInfoFromBundles.ts\nconst findSeedBundle = (bundles, bundleId) => bundles.find((bundle) => bundle.id === bundleId);\nconst resolveUpdateInfoFromBundles = async ({ args, bundles, context }) => {\n\tconst info = await getUpdateInfo(bundles, args);\n\tif (!info) return null;\n\tseedRequestUpdateBundles(context, [findSeedBundle(bundles, info.id), args.bundleId === NIL_UUID ? null : findSeedBundle(bundles, args.bundleId)]);\n\treturn info;\n};\n//#endregion\nexport { resolveUpdateInfoFromBundles };\n", "//#region src/createStoragePlugin.ts\nconst wrapNodeProfile = (node, hooks) => ({\n\t...node,\n\tasync upload(key, filePath) {\n\t\tconst result = await node.upload(key, filePath);\n\t\tawait hooks?.onStorageUploaded?.();\n\t\treturn result;\n\t}\n});\nconst createProfiledStoragePlugin = ({ createProfiles, name, profileShape, supportedProtocol }, hooks) => {\n\tlet cachedProfiles = null;\n\tlet cachedNodeProfile;\n\tlet cachedRuntimeProfile;\n\tconst getProfiles = () => {\n\t\tcachedProfiles ??= createProfiles();\n\t\treturn cachedProfiles;\n\t};\n\tconst getNodeProfile = () => {\n\t\tconst node = getProfiles().node;\n\t\tif (!node) return;\n\t\tcachedNodeProfile ??= wrapNodeProfile(node, hooks);\n\t\treturn cachedNodeProfile;\n\t};\n\tconst requireNodeProfile = () => {\n\t\tconst node = getNodeProfile();\n\t\tif (!node) throw new Error(`${name} does not implement the node storage profile for protocol \"${supportedProtocol}\".`);\n\t\treturn node;\n\t};\n\tconst getRuntimeProfile = () => {\n\t\tconst runtime = getProfiles().runtime;\n\t\tif (!runtime) return;\n\t\tcachedRuntimeProfile ??= runtime;\n\t\treturn cachedRuntimeProfile;\n\t};\n\tconst requireRuntimeProfile = () => {\n\t\tconst runtime = getRuntimeProfile();\n\t\tif (!runtime) throw new Error(`${name} does not implement the runtime storage profile for protocol \"${supportedProtocol}\".`);\n\t\treturn runtime;\n\t};\n\tconst profiles = {};\n\tif (profileShape?.node) {\n\t\tconst nodeProfile = {\n\t\t\tasync delete(storageUri) {\n\t\t\t\treturn requireNodeProfile().delete(storageUri);\n\t\t\t},\n\t\t\tasync downloadFile(storageUri, filePath) {\n\t\t\t\treturn requireNodeProfile().downloadFile(storageUri, filePath);\n\t\t\t},\n\t\t\tasync exists(storageUri) {\n\t\t\t\treturn requireNodeProfile().exists(storageUri);\n\t\t\t},\n\t\t\tasync upload(key, filePath) {\n\t\t\t\treturn requireNodeProfile().upload(key, filePath);\n\t\t\t}\n\t\t};\n\t\tObject.defineProperties(nodeProfile, {\n\t\t\tdeleteObjects: {\n\t\t\t\tenumerable: true,\n\t\t\t\tget: () => {\n\t\t\t\t\tconst deleteObjects = requireNodeProfile().deleteObjects;\n\t\t\t\t\treturn deleteObjects ? (keys) => deleteObjects(keys) : void 0;\n\t\t\t\t}\n\t\t\t},\n\t\t\tlistObjects: {\n\t\t\t\tenumerable: true,\n\t\t\t\tget: () => {\n\t\t\t\t\tconst listObjects = requireNodeProfile().listObjects;\n\t\t\t\t\treturn listObjects ? (prefix) => listObjects(prefix) : void 0;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tprofiles.node = nodeProfile;\n\t} else if (profileShape?.node !== false) Object.defineProperty(profiles, \"node\", {\n\t\tenumerable: true,\n\t\tget: getNodeProfile\n\t});\n\tif (profileShape?.runtime) profiles.runtime = {\n\t\tasync getDownloadUrl(storageUri, context) {\n\t\t\treturn requireRuntimeProfile().getDownloadUrl(storageUri, context);\n\t\t},\n\t\tasync readText(storageUri, context) {\n\t\t\treturn requireRuntimeProfile().readText(storageUri, context);\n\t\t}\n\t};\n\telse if (profileShape?.runtime !== false) Object.defineProperty(profiles, \"runtime\", {\n\t\tenumerable: true,\n\t\tget: getRuntimeProfile\n\t});\n\treturn {\n\t\tname,\n\t\tsupportedProtocol,\n\t\tprofiles\n\t};\n};\n/**\n* Creates a deploy/CLI/console storage plugin.\n*/\nconst createNodeStoragePlugin = (options) => {\n\treturn (config, hooks) => {\n\t\treturn () => createProfiledStoragePlugin({\n\t\t\tcreateProfiles: () => ({ node: options.factory(config) }),\n\t\t\tname: options.name,\n\t\t\tprofileShape: {\n\t\t\t\tnode: true,\n\t\t\t\truntime: false\n\t\t\t},\n\t\t\tsupportedProtocol: options.supportedProtocol\n\t\t}, hooks);\n\t};\n};\n/**\n* Creates an update-check runtime storage plugin.\n*/\nconst createRuntimeStoragePlugin = (options) => {\n\treturn (config, hooks) => {\n\t\treturn () => createProfiledStoragePlugin({\n\t\t\tcreateProfiles: () => ({ runtime: options.factory(config) }),\n\t\t\tname: options.name,\n\t\t\tprofileShape: {\n\t\t\t\tnode: false,\n\t\t\t\truntime: true\n\t\t\t},\n\t\t\tsupportedProtocol: options.supportedProtocol\n\t\t}, hooks);\n\t};\n};\n/**\n* Creates a storage plugin that can be used by both Node tooling and update\n* check runtimes.\n*/\nconst createUniversalStoragePlugin = (options) => {\n\treturn (config, hooks) => {\n\t\treturn () => createProfiledStoragePlugin({\n\t\t\tcreateProfiles: () => options.factory(config),\n\t\t\tname: options.name,\n\t\t\tprofileShape: {\n\t\t\t\tnode: true,\n\t\t\t\truntime: true\n\t\t\t},\n\t\t\tsupportedProtocol: options.supportedProtocol\n\t\t}, hooks);\n\t};\n};\n//#endregion\nexport { createNodeStoragePlugin, createRuntimeStoragePlugin, createUniversalStoragePlugin };\n", "//#region src/parseStorageUri.ts\nconst decodeStorageObjectKey = (key) => {\n\ttry {\n\t\treturn decodeURIComponent(key);\n\t} catch {\n\t\treturn key;\n\t}\n};\n/**\n* Parses a storage URI and validates the protocol.\n*\n* @param storageUri - The storage URI to parse (e.g., \"s3://bucket/path/to/file\")\n* @param expectedProtocol - The expected protocol without colon (e.g., \"s3\", \"r2\", \"gs\")\n* @returns Parsed storage URI components\n* @throws Error if the URI is invalid or protocol doesn't match\n*\n* @example\n* ```typescript\n* const { bucket, key } = parseStorageUri(\"s3://my-bucket/path/to/file.zip\", \"s3\");\n* // bucket: \"my-bucket\"\n* // key: \"path/to/file.zip\"\n* ```\n*/\nfunction parseStorageUri(storageUri, expectedProtocol) {\n\ttry {\n\t\tconst url = new URL(storageUri);\n\t\tconst protocol = url.protocol.replace(\":\", \"\");\n\t\tif (protocol !== expectedProtocol) throw new Error(`Invalid storage URI protocol. Expected ${expectedProtocol}, got ${protocol}`);\n\t\treturn {\n\t\t\tprotocol,\n\t\t\tbucket: url.hostname,\n\t\t\tkey: decodeStorageObjectKey(url.pathname.slice(1))\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof TypeError) throw new Error(`Invalid storage URI format: ${storageUri}`);\n\t\tthrow error;\n\t}\n}\n//#endregion\nexport { decodeStorageObjectKey, parseStorageUri };\n", "//#region src/storageProfile.ts\nconst createMissingProfileError = (plugin, profile) => /* @__PURE__ */ new Error(`${plugin.name} does not implement the ${profile} storage profile for protocol \"${plugin.supportedProtocol}\".`);\nconst isNodeStoragePlugin = (plugin) => Boolean(plugin.profiles.node);\nconst isRuntimeStoragePlugin = (plugin) => Boolean(plugin.profiles.runtime);\nfunction assertNodeStoragePlugin(plugin) {\n\tif (!isNodeStoragePlugin(plugin)) throw createMissingProfileError(plugin, \"node\");\n}\nfunction assertRuntimeStoragePlugin(plugin) {\n\tif (!isRuntimeStoragePlugin(plugin)) throw createMissingProfileError(plugin, \"runtime\");\n}\n//#endregion\nexport { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin };\n", "//#region package.json\nvar version = \"0.36.14\";\n//#endregion\nexport { version };\n", "import { version } from \"./package.mjs\";\n//#region src/version.ts\nconst HOT_UPDATER_SERVER_VERSION = version;\n//#endregion\nexport { HOT_UPDATER_SERVER_VERSION };\n", "//#region src/internalRouter.ts\nconst normalizePath = (path) => {\n\tif (!path) return \"/\";\n\tif (path === \"/\") return path;\n\tconst withLeadingSlash = path.startsWith(\"/\") ? path : `/${path}`;\n\treturn withLeadingSlash.endsWith(\"/\") ? withLeadingSlash.slice(0, -1) : withLeadingSlash;\n};\nconst toSegments = (path) => {\n\tconst normalized = normalizePath(path);\n\treturn normalized === \"/\" ? [] : normalized.slice(1).split(\"/\");\n};\nfunction createRouter() {\n\treturn { routes: [] };\n}\nfunction addRoute(router, method, path, data) {\n\tconst segments = toSegments(path);\n\tconst paramNames = segments.filter((segment) => segment.startsWith(\":\")).map((segment) => segment.slice(1));\n\trouter.routes.push({\n\t\tdata,\n\t\tmethod: method.toUpperCase(),\n\t\tparamNames,\n\t\tsegments\n\t});\n}\nfunction findRoute(router, method, path) {\n\tconst normalizedMethod = method.toUpperCase();\n\tconst pathSegments = toSegments(path);\n\tfor (const route of router.routes) {\n\t\tif (route.method !== normalizedMethod) continue;\n\t\tif (route.segments.length !== pathSegments.length) continue;\n\t\tconst params = {};\n\t\tlet matched = true;\n\t\tfor (let index = 0; index < route.segments.length; index += 1) {\n\t\t\tconst routeSegment = route.segments[index];\n\t\t\tconst pathSegment = pathSegments[index];\n\t\t\tif (routeSegment.startsWith(\":\")) {\n\t\t\t\tparams[routeSegment.slice(1)] = pathSegment;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (routeSegment !== pathSegment) {\n\t\t\t\tmatched = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (matched) return {\n\t\t\tdata: route.data,\n\t\t\tparams\n\t\t};\n\t}\n}\n//#endregion\nexport { addRoute, createRouter, findRoute };\n", "import { addRoute, createRouter, findRoute } from \"./internalRouter.mjs\";\nimport { HOT_UPDATER_SERVER_VERSION } from \"./version.mjs\";\nimport { isGreaterOrEqual, normalize } from \"verkit\";\n//#region src/handler.ts\nvar HandlerBadRequestError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"HandlerBadRequestError\";\n\t}\n};\nconst SDK_VERSION_HEADER = \"Hot-Updater-SDK-Version\";\nconst EXPLICIT_NO_UPDATE_MIN_SDK_VERSION = \"0.31.0\";\nconst DEFAULT_BUNDLE_LIST_LIMIT = 50;\nconst MAX_BUNDLE_LIST_LIMIT = 100;\nconst supportsExplicitNoUpdateResponse = (request) => {\n\tconst sdkVersion = request.headers.get(SDK_VERSION_HEADER)?.trim();\n\tif (!sdkVersion) return false;\n\tconst normalizedSdkVersion = normalize(sdkVersion);\n\treturn normalizedSdkVersion !== null && isGreaterOrEqual(normalizedSdkVersion, EXPLICIT_NO_UPDATE_MIN_SDK_VERSION);\n};\nconst serializeUpdateInfo = (updateInfo, request) => {\n\tif (updateInfo) return JSON.stringify(updateInfo);\n\tif (supportsExplicitNoUpdateResponse(request)) return JSON.stringify({ status: \"UP_TO_DATE\" });\n\treturn JSON.stringify(null);\n};\nconst handleVersion = async () => {\n\treturn new Response(JSON.stringify({ version: HOT_UPDATER_SERVER_VERSION }), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst decodeMaybe = (value) => {\n\tif (value === void 0) return void 0;\n\ttry {\n\t\treturn decodeURIComponent(value);\n\t} catch {\n\t\treturn value;\n\t}\n};\nconst isPlatform = (value) => {\n\treturn value === \"ios\" || value === \"android\";\n};\nconst requireRouteParam = (params, key) => {\n\tconst value = params[key];\n\tif (!value) throw new HandlerBadRequestError(`Missing route parameter: ${key}`);\n\treturn value;\n};\nconst parseBooleanSearchParam = (url, key) => {\n\tconst value = url.searchParams.get(key);\n\tif (value === null) return;\n\tif (value === \"true\") return true;\n\tif (value === \"false\") return false;\n\tthrow new HandlerBadRequestError(`The '${key}' query parameter must be 'true' or 'false'.`);\n};\nconst parseNullableStringSearchParam = (url, key) => {\n\tconst value = url.searchParams.get(key);\n\tif (value === null) return;\n\treturn value === \"null\" ? null : value;\n};\nconst parseStringArraySearchParam = (url, key) => {\n\tconst values = url.searchParams.getAll(key);\n\treturn values.length > 0 ? values : void 0;\n};\nconst parsePositiveIntegerSearchParam = (url, key, defaultValue, maxValue) => {\n\tconst value = url.searchParams.get(key);\n\tif (value === null) return defaultValue;\n\tconst parsed = Number(value);\n\tif (!Number.isInteger(parsed) || parsed < 1 || parsed > maxValue) throw new HandlerBadRequestError(`The '${key}' query parameter must be a positive integer between 1 and ${maxValue}.`);\n\treturn parsed;\n};\nconst requirePlatformParam = (params) => {\n\tconst platform = requireRouteParam(params, \"platform\");\n\tif (!isPlatform(platform)) throw new HandlerBadRequestError(`Invalid platform: ${platform}. Expected 'ios' or 'android'.`);\n\treturn platform;\n};\nconst requireBundlePatchPayload = (payload, bundleId) => {\n\tif (!payload || typeof payload !== \"object\" || Array.isArray(payload)) throw new HandlerBadRequestError(\"Invalid bundle payload\");\n\tconst bundlePatch = payload;\n\tif (bundlePatch.id !== void 0 && bundlePatch.id !== bundleId) throw new HandlerBadRequestError(\"Bundle id mismatch\");\n\tconst { id: _ignoredId, ...rest } = bundlePatch;\n\treturn rest;\n};\nconst handleFingerprintUpdateWithCohort = async (params, request, api, context) => {\n\tconst platform = requirePlatformParam(params);\n\tconst fingerprintHash = requireRouteParam(params, \"fingerprintHash\");\n\tconst channel = requireRouteParam(params, \"channel\");\n\tconst minBundleId = requireRouteParam(params, \"minBundleId\");\n\tconst bundleId = requireRouteParam(params, \"bundleId\");\n\tconst updateInfo = await api.getAppUpdateInfo({\n\t\t_updateStrategy: \"fingerprint\",\n\t\tplatform,\n\t\tfingerprintHash,\n\t\tchannel,\n\t\tminBundleId,\n\t\tbundleId,\n\t\tcohort: decodeMaybe(params.cohort)\n\t}, context);\n\treturn new Response(serializeUpdateInfo(updateInfo, request), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleAppVersionUpdateWithCohort = async (params, request, api, context) => {\n\tconst platform = requirePlatformParam(params);\n\tconst appVersion = requireRouteParam(params, \"appVersion\");\n\tconst channel = requireRouteParam(params, \"channel\");\n\tconst minBundleId = requireRouteParam(params, \"minBundleId\");\n\tconst bundleId = requireRouteParam(params, \"bundleId\");\n\tconst updateInfo = await api.getAppUpdateInfo({\n\t\t_updateStrategy: \"appVersion\",\n\t\tplatform,\n\t\tappVersion,\n\t\tchannel,\n\t\tminBundleId,\n\t\tbundleId,\n\t\tcohort: decodeMaybe(params.cohort)\n\t}, context);\n\treturn new Response(serializeUpdateInfo(updateInfo, request), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleGetBundle = async (params, _request, api, context) => {\n\tconst bundleId = requireRouteParam(params, \"id\");\n\tconst bundle = await api.getBundleById(bundleId, context);\n\tif (!bundle) return new Response(JSON.stringify({ error: \"Bundle not found\" }), {\n\t\tstatus: 404,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n\treturn new Response(JSON.stringify(bundle), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleGetBundles = async (_params, request, api, context) => {\n\tconst url = new URL(request.url);\n\tconst channel = url.searchParams.get(\"channel\") ?? void 0;\n\tconst platform = url.searchParams.get(\"platform\");\n\tconst limit = parsePositiveIntegerSearchParam(url, \"limit\", DEFAULT_BUNDLE_LIST_LIMIT, MAX_BUNDLE_LIST_LIMIT);\n\tconst pageParam = url.searchParams.get(\"page\");\n\tconst offset = url.searchParams.get(\"offset\");\n\tconst after = url.searchParams.get(\"after\") ?? void 0;\n\tconst before = url.searchParams.get(\"before\") ?? void 0;\n\tconst enabled = parseBooleanSearchParam(url, \"enabled\");\n\tconst targetAppVersion = parseNullableStringSearchParam(url, \"targetAppVersion\");\n\tconst targetAppVersionIn = parseStringArraySearchParam(url, \"targetAppVersionIn\");\n\tconst targetAppVersionNotNull = parseBooleanSearchParam(url, \"targetAppVersionNotNull\");\n\tconst fingerprintHash = parseNullableStringSearchParam(url, \"fingerprintHash\");\n\tconst idEq = url.searchParams.get(\"idEq\") ?? void 0;\n\tconst idGt = url.searchParams.get(\"idGt\") ?? void 0;\n\tconst idGte = url.searchParams.get(\"idGte\") ?? void 0;\n\tconst idLt = url.searchParams.get(\"idLt\") ?? void 0;\n\tconst idLte = url.searchParams.get(\"idLte\") ?? void 0;\n\tconst idIn = parseStringArraySearchParam(url, \"idIn\");\n\tconst page = pageParam === null ? void 0 : Number.isInteger(Number(pageParam)) && Number(pageParam) > 0 ? Number(pageParam) : null;\n\tif (offset !== null) throw new HandlerBadRequestError(\"The 'offset' query parameter has been removed. Use 'after' or 'before' cursor pagination instead.\");\n\tif (page === null) throw new HandlerBadRequestError(\"The 'page' query parameter must be a positive integer.\");\n\tif (platform !== null && !isPlatform(platform)) throw new HandlerBadRequestError(`Invalid platform: ${platform}. Expected 'ios' or 'android'.`);\n\tconst result = await api.getBundles({\n\t\twhere: {\n\t\t\t...channel && { channel },\n\t\t\t...platform && { platform },\n\t\t\t...enabled !== void 0 && { enabled },\n\t\t\t...idEq || idGt || idGte || idLt || idLte || idIn && idIn.length > 0 ? { id: {\n\t\t\t\t...idEq && { eq: idEq },\n\t\t\t\t...idGt && { gt: idGt },\n\t\t\t\t...idGte && { gte: idGte },\n\t\t\t\t...idLt && { lt: idLt },\n\t\t\t\t...idLte && { lte: idLte },\n\t\t\t\t...idIn && idIn.length > 0 && { in: idIn }\n\t\t\t} } : {},\n\t\t\t...targetAppVersion !== void 0 && { targetAppVersion },\n\t\t\t...targetAppVersionIn && { targetAppVersionIn },\n\t\t\t...targetAppVersionNotNull !== void 0 && { targetAppVersionNotNull },\n\t\t\t...fingerprintHash !== void 0 && { fingerprintHash }\n\t\t},\n\t\tlimit,\n\t\tpage,\n\t\tcursor: after || before ? {\n\t\t\tafter,\n\t\t\tbefore\n\t\t} : void 0\n\t}, context);\n\treturn new Response(JSON.stringify(result), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleCreateBundles = async (_params, request, api, context) => {\n\tconst body = await request.json();\n\tconst bundles = Array.isArray(body) ? body : [body];\n\tfor (const bundle of bundles) await api.insertBundle(bundle, context);\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\tstatus: 201,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleUpdateBundle = async (params, request, api, context) => {\n\tconst bundleId = requireRouteParam(params, \"id\");\n\tconst body = await request.json();\n\tconst bundlePatch = requireBundlePatchPayload(Array.isArray(body) ? body[0] : body, bundleId);\n\tawait api.updateBundleById(bundleId, bundlePatch, context);\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleDeleteBundle = async (params, _request, api, context) => {\n\tconst bundleId = requireRouteParam(params, \"id\");\n\tawait api.deleteBundleById(bundleId, context);\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst handleGetChannels = async (_params, _request, api, context) => {\n\tconst response = { data: { channels: await api.getChannels(context) } };\n\treturn new Response(JSON.stringify(response), {\n\t\tstatus: 200,\n\t\theaders: { \"Content-Type\": \"application/json\" }\n\t});\n};\nconst routes = {\n\tversion: handleVersion,\n\tfingerprintUpdateWithCohort: handleFingerprintUpdateWithCohort,\n\tappVersionUpdateWithCohort: handleAppVersionUpdateWithCohort,\n\tgetBundle: handleGetBundle,\n\tgetBundles: handleGetBundles,\n\tcreateBundles: handleCreateBundles,\n\tupdateBundle: handleUpdateBundle,\n\tdeleteBundle: handleDeleteBundle,\n\tgetChannels: handleGetChannels\n};\n/**\n* Creates a Web Standard Request handler for Hot Updater API\n* This handler is framework-agnostic and works with any runtime that\n* supports standard Request/Response objects.\n*/\nfunction createHandler(api, options = {}) {\n\tconst basePath = options.basePath ?? \"/api\";\n\tconst routeOptions = {\n\t\tupdateCheck: options.routes?.updateCheck ?? true,\n\t\tbundles: options.routes?.bundles ?? false\n\t};\n\tconst router = createRouter();\n\taddRoute(router, \"GET\", \"/version\", \"version\");\n\tif (routeOptions.updateCheck) {\n\t\taddRoute(router, \"GET\", \"/fingerprint/:platform/:fingerprintHash/:channel/:minBundleId/:bundleId\", \"fingerprintUpdateWithCohort\");\n\t\taddRoute(router, \"GET\", \"/fingerprint/:platform/:fingerprintHash/:channel/:minBundleId/:bundleId/:cohort\", \"fingerprintUpdateWithCohort\");\n\t\taddRoute(router, \"GET\", \"/app-version/:platform/:appVersion/:channel/:minBundleId/:bundleId\", \"appVersionUpdateWithCohort\");\n\t\taddRoute(router, \"GET\", \"/app-version/:platform/:appVersion/:channel/:minBundleId/:bundleId/:cohort\", \"appVersionUpdateWithCohort\");\n\t}\n\tif (routeOptions.bundles) {\n\t\taddRoute(router, \"GET\", \"/api/bundles/channels\", \"getChannels\");\n\t\taddRoute(router, \"GET\", \"/api/bundles/:id\", \"getBundle\");\n\t\taddRoute(router, \"GET\", \"/api/bundles\", \"getBundles\");\n\t\taddRoute(router, \"POST\", \"/api/bundles\", \"createBundles\");\n\t\taddRoute(router, \"PATCH\", \"/api/bundles/:id\", \"updateBundle\");\n\t\taddRoute(router, \"DELETE\", \"/api/bundles/:id\", \"deleteBundle\");\n\t}\n\treturn async (request, context) => {\n\t\ttry {\n\t\t\tconst path = new URL(request.url).pathname;\n\t\t\tconst method = request.method;\n\t\t\tconst match = findRoute(router, method, path.startsWith(basePath) ? path.slice(basePath.length) : path);\n\t\t\tif (!match) return new Response(JSON.stringify({ error: \"Not found\" }), {\n\t\t\t\tstatus: 404,\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" }\n\t\t\t});\n\t\t\tconst handler = routes[match.data];\n\t\t\tif (!handler) return new Response(JSON.stringify({ error: \"Handler not found\" }), {\n\t\t\t\tstatus: 500,\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" }\n\t\t\t});\n\t\t\treturn await handler(match.params || {}, request, api, context);\n\t\t} catch (error) {\n\t\t\tif (error instanceof HandlerBadRequestError) return new Response(JSON.stringify({ error: error.message }), {\n\t\t\t\tstatus: 400,\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" }\n\t\t\t});\n\t\t\tconsole.error(\"Hot Updater handler error:\", error);\n\t\t\treturn new Response(JSON.stringify({\n\t\t\t\terror: \"Internal server error\",\n\t\t\t\tmessage: error instanceof Error ? error.message : \"Unknown error\"\n\t\t\t}), {\n\t\t\t\tstatus: 500,\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" }\n\t\t\t});\n\t\t}\n\t};\n}\n//#endregion\nexport { createHandler };\n", "import { DEFAULT_ROLLOUT_COHORT_COUNT, INVALID_COHORT_ERROR_MESSAGE, isValidCohort } from \"@hot-updater/core\";\n//#region src/db/schemaEnhancements.ts\nconst normalizeNullableString = (value) => {\n\tif (value === null || value === void 0) return null;\n\tconst normalized = value.trim();\n\treturn normalized.length > 0 ? normalized : null;\n};\nconst assertBundlePersistenceConstraints = (bundle) => {\n\tconst targetAppVersion = normalizeNullableString(bundle.targetAppVersion);\n\tconst fingerprintHash = normalizeNullableString(bundle.fingerprintHash);\n\tif (!targetAppVersion && !fingerprintHash) throw new Error(\"Bundle must define either targetAppVersion or fingerprintHash.\");\n\tconst rolloutCohortCount = bundle.rolloutCohortCount;\n\tif (rolloutCohortCount !== null && rolloutCohortCount !== void 0) {\n\t\tif (!Number.isInteger(rolloutCohortCount) || rolloutCohortCount < 0 || rolloutCohortCount > DEFAULT_ROLLOUT_COHORT_COUNT) throw new Error(`rolloutCohortCount must be an integer between 0 and ${DEFAULT_ROLLOUT_COHORT_COUNT}.`);\n\t}\n\tfor (const cohort of bundle.targetCohorts ?? []) if (!isValidCohort(cohort)) throw new Error(`Invalid target cohort \"${cohort}\". ${INVALID_COHORT_ERROR_MESSAGE}`);\n};\n//#endregion\nexport { assertBundlePersistenceConstraints };\n", "import { getManifestAssetDownloadPath, resolveManifestAssetStorageUri } from \"@hot-updater/plugin-core\";\nimport { getAssetBaseStorageUri, getBundlePatch, getManifestFileHash, getManifestStorageUri, stripBundleArtifactMetadata } from \"@hot-updater/core\";\n//#region src/db/updateArtifacts.ts\nconst HBC_ASSET_PATH_RE = /\\.bundle$/;\nconst resolveUniqueHbcAssetPath = (manifest) => {\n\tconst candidates = Object.keys(manifest.assets).sort((left, right) => left.localeCompare(right)).filter((candidate) => HBC_ASSET_PATH_RE.test(candidate));\n\treturn candidates.length === 1 ? candidates[0] : null;\n};\nconst isBundleManifest = (value) => {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst manifest = value;\n\tif (typeof manifest.bundleId !== \"string\") return false;\n\tif (!manifest.assets || typeof manifest.assets !== \"object\") return false;\n\treturn Object.values(manifest.assets).every((asset) => {\n\t\tif (!asset || typeof asset !== \"object\" || Array.isArray(asset)) return false;\n\t\tconst manifestAsset = asset;\n\t\treturn typeof manifestAsset.fileHash === \"string\" && (manifestAsset.signature === void 0 || typeof manifestAsset.signature === \"string\");\n\t});\n};\nconst parseBundleMetadata = (value) => {\n\tif (!value) return;\n\tlet parsedValue = value;\n\tif (typeof parsedValue === \"string\") try {\n\t\tparsedValue = JSON.parse(parsedValue);\n\t} catch {\n\t\treturn;\n\t}\n\tif (!parsedValue || typeof parsedValue !== \"object\" || Array.isArray(parsedValue)) return;\n\treturn stripBundleArtifactMetadata(parsedValue);\n};\nasync function fetchBundleManifest(storageUri, readStorageText, resolveFileUrl, context) {\n\tconst [storageText, fileUrl] = await Promise.all([readStorageText(storageUri, context), resolveFileUrl(storageUri, context)]);\n\tif (storageText === null) return null;\n\tlet payload;\n\ttry {\n\t\tpayload = JSON.parse(storageText);\n\t} catch {\n\t\treturn null;\n\t}\n\tif (!isBundleManifest(payload)) return null;\n\tif (!fileUrl) return null;\n\treturn {\n\t\tfileUrl,\n\t\tmanifest: payload\n\t};\n}\nasync function resolveChangedAssets({ assetBaseStorageUri, currentManifest, currentBundle, resolveFileUrl, targetBundle, targetManifest, context }) {\n\tconst patchDescriptor = await resolveHbcPatchDescriptor({\n\t\tcurrentBundle,\n\t\tresolveFileUrl,\n\t\ttargetBundle,\n\t\ttargetManifest,\n\t\tcontext\n\t});\n\tconst changedEntries = await Promise.all(Object.entries(targetManifest.assets).map(async ([assetPath, asset]) => {\n\t\tif ((currentManifest?.assets[assetPath])?.fileHash === asset.fileHash) return null;\n\t\tconst downloadPath = getManifestAssetDownloadPath(assetPath);\n\t\tconst usesBrotliAsset = downloadPath !== assetPath;\n\t\tconst storageUri = resolveManifestAssetStorageUri({\n\t\t\tassetBaseStorageUri,\n\t\t\tassetPath: downloadPath,\n\t\t\tfileHash: asset.fileHash\n\t\t});\n\t\tconst patch = patchDescriptor?.assetPath === assetPath ? patchDescriptor.patch : null;\n\t\tlet fileUrl = null;\n\t\ttry {\n\t\t\tfileUrl = await resolveFileUrl(storageUri, context);\n\t\t} catch (error) {\n\t\t\tif (!patch) throw error;\n\t\t}\n\t\tif (!fileUrl && !patch) return false;\n\t\tconst changedAsset = { fileHash: asset.fileHash };\n\t\tif (fileUrl) {\n\t\t\tchangedAsset.file = { url: fileUrl };\n\t\t\tif (usesBrotliAsset) changedAsset.file.compression = \"br\";\n\t\t}\n\t\tif (patch) changedAsset.patch = patch;\n\t\treturn [assetPath, changedAsset];\n\t}));\n\tif (changedEntries.some((entry) => entry === false)) return null;\n\treturn Object.fromEntries(changedEntries.filter((entry) => entry !== null));\n}\nasync function resolveHbcPatchDescriptor({ currentBundle, resolveFileUrl, targetBundle, targetManifest, context }) {\n\tconst matchingPatch = targetBundle && currentBundle ? getBundlePatch(targetBundle, currentBundle.id) : null;\n\tconst patchAssetPath = resolveUniqueHbcAssetPath(targetManifest);\n\tif (!currentBundle || !matchingPatch || !patchAssetPath || !matchingPatch.patchStorageUri || !matchingPatch.patchFileHash || !matchingPatch.baseFileHash) return null;\n\tconst patchUrl = await resolveFileUrl(matchingPatch.patchStorageUri, context);\n\tif (!patchUrl) return null;\n\treturn {\n\t\tassetPath: patchAssetPath,\n\t\tpatch: {\n\t\t\talgorithm: \"bsdiff\",\n\t\t\tbaseBundleId: matchingPatch.baseBundleId,\n\t\t\tbaseFileHash: matchingPatch.baseFileHash,\n\t\t\tpatchFileHash: matchingPatch.patchFileHash,\n\t\t\tpatchUrl\n\t\t}\n\t};\n}\nasync function resolveManifestArtifacts({ currentBundle, resolveFileUrl, readStorageText, targetBundle, context }) {\n\tconst manifestStorageUri = targetBundle ? getManifestStorageUri(targetBundle) : null;\n\tconst manifestFileHash = targetBundle ? getManifestFileHash(targetBundle) : null;\n\tconst assetBaseStorageUri = targetBundle ? getAssetBaseStorageUri(targetBundle) : null;\n\tif (!manifestStorageUri || !manifestFileHash || !assetBaseStorageUri) return null;\n\tconst currentManifestStorageUri = currentBundle ? getManifestStorageUri(currentBundle) : null;\n\tconst [targetManifestResult, currentManifestResult] = await Promise.all([fetchBundleManifest(manifestStorageUri, readStorageText, resolveFileUrl, context), currentManifestStorageUri ? fetchBundleManifest(currentManifestStorageUri, readStorageText, resolveFileUrl, context) : null]);\n\tif (!targetManifestResult) return null;\n\tconst changedAssets = await resolveChangedAssets({\n\t\tassetBaseStorageUri,\n\t\tcurrentManifest: currentManifestResult?.manifest ?? null,\n\t\tcurrentBundle,\n\t\tresolveFileUrl,\n\t\ttargetBundle,\n\t\ttargetManifest: targetManifestResult.manifest,\n\t\tcontext\n\t});\n\tif (!changedAssets) return null;\n\treturn {\n\t\tchangedAssets,\n\t\tmanifestFileHash,\n\t\tmanifestUrl: targetManifestResult.fileUrl\n\t};\n}\n//#endregion\nexport { parseBundleMetadata, resolveManifestArtifacts };\n", "import { assertBundlePersistenceConstraints } from \"./schemaEnhancements.mjs\";\nimport { resolveManifestArtifacts } from \"./updateArtifacts.mjs\";\nimport { createRequestUpdateBundleResolver, semverSatisfies } from \"@hot-updater/plugin-core\";\nimport { NIL_UUID, isCohortEligibleForUpdate } from \"@hot-updater/core\";\n//#region src/db/pluginCore.ts\nconst PAGE_SIZE = 100;\nconst DESC_ORDER = {\n\tfield: \"id\",\n\tdirection: \"desc\"\n};\nconst bundleMatchesQueryWhere = (bundle, where) => {\n\tif (!where) return true;\n\tif (where.channel !== void 0 && bundle.channel !== where.channel) return false;\n\tif (where.platform !== void 0 && bundle.platform !== where.platform) return false;\n\tif (where.enabled !== void 0 && bundle.enabled !== where.enabled) return false;\n\tif (where.id?.eq !== void 0 && bundle.id !== where.id.eq) return false;\n\tif (where.id?.gt !== void 0 && bundle.id.localeCompare(where.id.gt) <= 0) return false;\n\tif (where.id?.gte !== void 0 && bundle.id.localeCompare(where.id.gte) < 0) return false;\n\tif (where.id?.lt !== void 0 && bundle.id.localeCompare(where.id.lt) >= 0) return false;\n\tif (where.id?.lte !== void 0 && bundle.id.localeCompare(where.id.lte) > 0) return false;\n\tif (where.id?.in && !where.id.in.includes(bundle.id)) return false;\n\tif (where.targetAppVersionNotNull && bundle.targetAppVersion === null) return false;\n\tif (where.targetAppVersion !== void 0 && bundle.targetAppVersion !== where.targetAppVersion) return false;\n\tif (where.targetAppVersionIn && !where.targetAppVersionIn.includes(bundle.targetAppVersion ?? \"\")) return false;\n\tif (where.fingerprintHash !== void 0 && bundle.fingerprintHash !== where.fingerprintHash) return false;\n\treturn true;\n};\nconst sortBundles = (bundles, orderBy) => {\n\tconst direction = orderBy?.direction ?? \"desc\";\n\treturn bundles.slice().sort((a, b) => {\n\t\tconst result = a.id.localeCompare(b.id);\n\t\treturn direction === \"asc\" ? result : -result;\n\t});\n};\nconst makeResponse = (bundle, status) => ({\n\tid: bundle.id,\n\tmessage: bundle.message,\n\tshouldForceUpdate: status === \"ROLLBACK\" ? true : bundle.shouldForceUpdate,\n\tstatus,\n\tstorageUri: bundle.storageUri,\n\tfileHash: bundle.fileHash\n});\nconst INIT_BUNDLE_ROLLBACK_UPDATE_INFO = {\n\tmessage: null,\n\tid: NIL_UUID,\n\tshouldForceUpdate: true,\n\tstatus: \"ROLLBACK\",\n\tstorageUri: null,\n\tfileHash: null\n};\nfunction createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {\n\tconst coreOptions = options;\n\tconst runWithMutationPlugin = async (operation) => {\n\t\tconst plugin = coreOptions?.createMutationPlugin?.() ?? getPlugin();\n\t\ttry {\n\t\t\treturn await operation(plugin);\n\t\t} finally {\n\t\t\tif (coreOptions?.createMutationPlugin) await coreOptions.cleanupMutationPlugin?.(plugin);\n\t\t}\n\t};\n\tconst getSortedBundlePage = async (options, context) => {\n\t\tconst result = await getPlugin().getBundles({\n\t\t\t...options,\n\t\t\torderBy: options.orderBy ?? DESC_ORDER\n\t\t}, context);\n\t\treturn {\n\t\t\t...result,\n\t\t\tdata: sortBundles(result.data, options.orderBy ?? DESC_ORDER)\n\t\t};\n\t};\n\tconst isEligibleForUpdate = (bundle, cohort) => {\n\t\treturn isCohortEligibleForUpdate(bundle.id, cohort, bundle.rolloutCohortCount, bundle.targetCohorts);\n\t};\n\tconst findUpdateInfoByScanning = async ({ args, queryWhere, isCandidate, context }) => {\n\t\tlet after;\n\t\twhile (true) {\n\t\t\tconst { data, pagination } = await getSortedBundlePage({\n\t\t\t\twhere: queryWhere,\n\t\t\t\tlimit: PAGE_SIZE,\n\t\t\t\torderBy: DESC_ORDER,\n\t\t\t\t...after ? { cursor: { after } } : {}\n\t\t\t}, context);\n\t\t\tfor (const bundle of data) {\n\t\t\t\tif (!bundleMatchesQueryWhere(bundle, queryWhere) || !isCandidate(bundle)) continue;\n\t\t\t\tif (args.bundleId === NIL_UUID) {\n\t\t\t\t\tif (isEligibleForUpdate(bundle, args.cohort)) return makeResponse(bundle, \"UPDATE\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst compareResult = bundle.id.localeCompare(args.bundleId);\n\t\t\t\tif (compareResult > 0) {\n\t\t\t\t\tif (isEligibleForUpdate(bundle, args.cohort)) return makeResponse(bundle, \"UPDATE\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (compareResult === 0) {\n\t\t\t\t\tif (isEligibleForUpdate(bundle, args.cohort)) return null;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\treturn makeResponse(bundle, \"ROLLBACK\");\n\t\t\t}\n\t\t\tif (!pagination.hasNextPage) break;\n\t\t\tafter = data.at(-1)?.id;\n\t\t\tif (!after) break;\n\t\t}\n\t\tif (args.bundleId === NIL_UUID) return null;\n\t\tif (args.minBundleId && args.bundleId.localeCompare(args.minBundleId) <= 0) return null;\n\t\treturn INIT_BUNDLE_ROLLBACK_UPDATE_INFO;\n\t};\n\tconst getBaseWhere = ({ platform, channel, minBundleId }) => ({\n\t\tplatform,\n\t\tchannel,\n\t\tenabled: true,\n\t\tid: { gte: minBundleId }\n\t});\n\treturn {\n\t\tapi: {\n\t\t\tasync getBundleById(id, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\treturn getPlugin().getBundleById(id, context);\n\t\t\t},\n\t\t\tasync getUpdateInfo(args, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\tconst directGetUpdateInfo = getPlugin().getUpdateInfo;\n\t\t\t\tif (directGetUpdateInfo) return context === void 0 ? await directGetUpdateInfo(args) : await directGetUpdateInfo(args, context);\n\t\t\t\tconst channel = args.channel ?? \"production\";\n\t\t\t\tconst minBundleId = args.minBundleId ?? NIL_UUID;\n\t\t\t\tconst baseWhere = getBaseWhere({\n\t\t\t\t\tplatform: args.platform,\n\t\t\t\t\tchannel,\n\t\t\t\t\tminBundleId\n\t\t\t\t});\n\t\t\t\tif (args._updateStrategy === \"fingerprint\") return findUpdateInfoByScanning({\n\t\t\t\t\targs,\n\t\t\t\t\tqueryWhere: {\n\t\t\t\t\t\t...baseWhere,\n\t\t\t\t\t\tfingerprintHash: args.fingerprintHash\n\t\t\t\t\t},\n\t\t\t\t\tcontext,\n\t\t\t\t\tisCandidate: (bundle) => {\n\t\t\t\t\t\treturn bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && bundle.fingerprintHash === args.fingerprintHash;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn findUpdateInfoByScanning({\n\t\t\t\t\targs,\n\t\t\t\t\tqueryWhere: { ...baseWhere },\n\t\t\t\t\tcontext,\n\t\t\t\t\tisCandidate: (bundle) => {\n\t\t\t\t\t\treturn bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && !!bundle.targetAppVersion && semverSatisfies(bundle.targetAppVersion, args.appVersion);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync getAppUpdateInfo(args, context) {\n\t\t\t\tconst info = await this.getUpdateInfo(args, context);\n\t\t\t\tif (!info) return null;\n\t\t\t\tconst { storageUri, ...rest } = info;\n\t\t\t\tconst readStorageText = coreOptions?.readStorageText;\n\t\t\t\tif (info.id === NIL_UUID || !readStorageText) {\n\t\t\t\t\tconst fileUrl = await resolveFileUrl(storageUri ?? null, context);\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...rest,\n\t\t\t\t\t\tfileUrl\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst requestBundles = createRequestUpdateBundleResolver(context);\n\t\t\t\tconst getCurrentBundle = () => {\n\t\t\t\t\tif (args.bundleId === NIL_UUID) return null;\n\t\t\t\t\tconst seededCurrentBundle = requestBundles.peek(args.bundleId);\n\t\t\t\t\tif (seededCurrentBundle || requestBundles.hasSeededBundles()) return seededCurrentBundle;\n\t\t\t\t\treturn requestBundles.getById(args.bundleId, () => getPlugin().getBundleById(args.bundleId, context));\n\t\t\t\t};\n\t\t\t\tconst [fileUrl, targetBundle, currentBundle] = await Promise.all([\n\t\t\t\t\tresolveFileUrl(storageUri ?? null, context),\n\t\t\t\t\trequestBundles.getById(info.id, () => getPlugin().getBundleById(info.id, context)),\n\t\t\t\t\tgetCurrentBundle()\n\t\t\t\t]);\n\t\t\t\tconst baseResponse = {\n\t\t\t\t\t...rest,\n\t\t\t\t\tfileUrl\n\t\t\t\t};\n\t\t\t\tconst manifestArtifacts = await resolveManifestArtifacts({\n\t\t\t\t\tcurrentBundle,\n\t\t\t\t\tresolveFileUrl,\n\t\t\t\t\treadStorageText,\n\t\t\t\t\ttargetBundle,\n\t\t\t\t\tcontext\n\t\t\t\t});\n\t\t\t\tif (!manifestArtifacts) return baseResponse;\n\t\t\t\treturn {\n\t\t\t\t\t...baseResponse,\n\t\t\t\t\t...manifestArtifacts\n\t\t\t\t};\n\t\t\t},\n\t\t\tasync getChannels(context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\treturn getPlugin().getChannels(context);\n\t\t\t},\n\t\t\tasync getBundles(options, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\treturn getPlugin().getBundles(options, context);\n\t\t\t},\n\t\t\tasync insertBundle(bundle, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\tassertBundlePersistenceConstraints(bundle);\n\t\t\t\tawait runWithMutationPlugin(async (plugin) => {\n\t\t\t\t\tawait plugin.appendBundle(bundle, context);\n\t\t\t\t\tawait plugin.commitBundle(context);\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync updateBundleById(bundleId, newBundle, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\tawait runWithMutationPlugin(async (plugin) => {\n\t\t\t\t\tconst current = await plugin.getBundleById(bundleId, context);\n\t\t\t\t\tif (!current) throw new Error(\"targetBundleId not found\");\n\t\t\t\t\tassertBundlePersistenceConstraints({\n\t\t\t\t\t\t...current,\n\t\t\t\t\t\t...newBundle\n\t\t\t\t\t});\n\t\t\t\t\tawait plugin.updateBundle(bundleId, newBundle, context);\n\t\t\t\t\tawait plugin.commitBundle(context);\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync deleteBundleById(bundleId, context) {\n\t\t\t\tawait coreOptions?.beforeOperation?.();\n\t\t\t\tawait runWithMutationPlugin(async (plugin) => {\n\t\t\t\t\tconst bundle = await plugin.getBundleById(bundleId, context);\n\t\t\t\t\tif (!bundle) return;\n\t\t\t\t\tawait plugin.deleteBundle(bundle, context);\n\t\t\t\t\tawait plugin.commitBundle(context);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tadapterName: getPlugin().name,\n\t\tcreateMigrator: () => {\n\t\t\tthrow new Error(\"createMigrator is only available for Kysely/MongoDB database adapters.\");\n\t\t},\n\t\tgenerateSchema: () => {\n\t\t\tthrow new Error(\"generateSchema is only available for Drizzle/Prisma database adapters.\");\n\t\t}\n\t};\n}\n//#endregion\nexport { createPluginDatabaseCore };\n", "//#region src/schema/types.ts\nconst HOT_UPDATER_SCHEMA_VERSION = \"0.31.0\";\nconst HOT_UPDATER_SETTINGS_TABLE = \"private_hot_updater_settings\";\n//#endregion\nexport { HOT_UPDATER_SCHEMA_VERSION, HOT_UPDATER_SETTINGS_TABLE };\n", "import { HOT_UPDATER_SCHEMA_VERSION } from \"../schema/types.mjs\";\n//#region src/db/schemaReadiness.ts\nvar HotUpdaterSchemaMigrationRequiredError = class extends Error {\n\tconstructor(adapterName, currentVersion) {\n\t\tsuper(currentVersion === void 0 ? `Hot Updater database schema is not initialized for ${adapterName}. Run \\`hot-updater db migrate\\` before using this adapter.` : `Hot Updater database schema version ${currentVersion} is not supported by ${adapterName}. Run \\`hot-updater db migrate\\` to upgrade to ${HOT_UPDATER_SCHEMA_VERSION}.`);\n\t\tthis.adapterName = adapterName;\n\t\tthis.currentVersion = currentVersion;\n\t\tthis.name = \"HotUpdaterSchemaMigrationRequiredError\";\n\t}\n};\nconst createSchemaReadinessChecker = (adapterName, createMigrator) => {\n\tif (!createMigrator) return async () => {};\n\tlet ready = false;\n\treturn async () => {\n\t\tif (ready) return;\n\t\tconst version = await createMigrator().getVersion();\n\t\tif (version !== \"0.31.0\") throw new HotUpdaterSchemaMigrationRequiredError(adapterName, version);\n\t\tready = true;\n\t};\n};\n//#endregion\nexport { HotUpdaterSchemaMigrationRequiredError, createSchemaReadinessChecker };\n", "//#region src/db/types.ts\nconst sqlProviders = [\n\t\"sqlite\",\n\t\"cockroachdb\",\n\t\"mysql\",\n\t\"postgresql\",\n\t\"mssql\"\n];\nconst noSqlProviders = [\"mongodb\"];\n[...sqlProviders, ...noSqlProviders];\nfunction isDatabasePluginFactory(adapter) {\n\treturn typeof adapter === \"function\";\n}\nfunction isDatabasePlugin(adapter) {\n\treturn typeof adapter === \"object\" && adapter !== null && \"getBundleById\" in adapter && \"getBundles\" in adapter && \"getChannels\" in adapter;\n}\nfunction getSQLProvider(provider) {\n\tif (!provider) return;\n\treturn sqlProviders.includes(provider) ? provider : void 0;\n}\n//#endregion\nexport { getSQLProvider, isDatabasePlugin, isDatabasePluginFactory };\n", "//#region src/route.ts\nconst normalizeBasePath = (basePath) => {\n\tif (!basePath || basePath === \"/\") return \"/\";\n\treturn basePath.endsWith(\"/\") ? basePath.slice(0, -1) : basePath;\n};\n//#endregion\nexport { normalizeBasePath };\n", "//#region src/storageAccess.ts\nconst assertRemoteDownloadUrl = (fileUrl) => {\n\ttry {\n\t\tconst protocol = new URL(fileUrl).protocol.replace(\":\", \"\");\n\t\tif (protocol === \"http\" || protocol === \"https\") return fileUrl;\n\t} catch {}\n\tthrow new Error(\"Storage plugin returned a local file path; runtime update checks require an HTTP(S) download URL.\");\n};\nconst getStorageProtocol = (storageUri) => new URL(storageUri).protocol.replace(\":\", \"\");\nconst isRemoteUrlProtocol = (protocol) => protocol === \"http\" || protocol === \"https\";\nconst createStorageAccess = (storagePlugins) => {\n\tconst findStoragePlugin = (protocol) => {\n\t\treturn storagePlugins.find((item) => item.supportedProtocol === protocol);\n\t};\n\tconst resolveFileUrl = async (storageUri, context) => {\n\t\tif (!storageUri) return null;\n\t\tconst protocol = getStorageProtocol(storageUri);\n\t\tconst plugin = findStoragePlugin(protocol);\n\t\tif (plugin) {\n\t\t\tconst { fileUrl } = await plugin.profiles.runtime.getDownloadUrl(storageUri, context);\n\t\t\tif (!fileUrl) throw new Error(\"Storage plugin returned empty fileUrl\");\n\t\t\treturn assertRemoteDownloadUrl(fileUrl);\n\t\t}\n\t\tif (isRemoteUrlProtocol(protocol)) return storageUri;\n\t\tthrow new Error(`No storage plugin for protocol: ${protocol}`);\n\t};\n\tconst readStorageText = async (storageUri, context) => {\n\t\tconst protocol = getStorageProtocol(storageUri);\n\t\tconst plugin = findStoragePlugin(protocol);\n\t\tif (plugin) return plugin.profiles.runtime.readText(storageUri, context);\n\t\tif (isRemoteUrlProtocol(protocol)) {\n\t\t\tconst response = await fetch(storageUri);\n\t\t\tif (!response.ok) return null;\n\t\t\treturn response.text();\n\t\t}\n\t\tthrow new Error(`No storage plugin for protocol: ${protocol}`);\n\t};\n\treturn {\n\t\treadStorageText,\n\t\tresolveFileUrl\n\t};\n};\n//#endregion\nexport { createStorageAccess };\n", "import { createHandler } from \"./handler.mjs\";\nimport { createPluginDatabaseCore } from \"./db/pluginCore.mjs\";\nimport { createSchemaReadinessChecker } from \"./db/schemaReadiness.mjs\";\nimport { isDatabasePlugin, isDatabasePluginFactory } from \"./db/types.mjs\";\nimport { normalizeBasePath } from \"./route.mjs\";\nimport { createStorageAccess } from \"./storageAccess.mjs\";\nimport { assertRuntimeStoragePlugin } from \"@hot-updater/plugin-core\";\n//#region src/createHotUpdaterCore.ts\nconst hotUpdaterCoreMetadata = Symbol.for(\"@hot-updater/server/core-metadata\");\nfunction getHotUpdaterCoreMetadata(hotUpdater) {\n\treturn hotUpdater[hotUpdaterCoreMetadata];\n}\nfunction createHotUpdaterCore(options) {\n\tconst database = options.database;\n\tconst basePath = normalizeBasePath(options.basePath ?? \"/api\");\n\tconst { readStorageText, resolveFileUrl } = createStorageAccess((options.storages ?? options.storagePlugins ?? []).map((plugin) => {\n\t\tconst storagePlugin = typeof plugin === \"function\" ? plugin() : plugin;\n\t\tassertRuntimeStoragePlugin(storagePlugin);\n\t\treturn storagePlugin;\n\t}));\n\tif (!isDatabasePluginFactory(database) && !isDatabasePlugin(database)) throw new Error(\"@hot-updater/server only supports database plugins.\");\n\tconst adapterCapabilities = database;\n\tconst plugin = isDatabasePluginFactory(database) ? database() : database;\n\tconst assertSchemaReady = createSchemaReadinessChecker(adapterCapabilities.adapterName ?? plugin.name, adapterCapabilities.createMigrator);\n\tconst core = createPluginDatabaseCore(() => plugin, resolveFileUrl, isDatabasePluginFactory(database) ? {\n\t\tcreateMutationPlugin: () => database(),\n\t\tbeforeOperation: assertSchemaReady,\n\t\treadStorageText\n\t} : {\n\t\tbeforeOperation: assertSchemaReady,\n\t\treadStorageText\n\t});\n\tconst internalHandler = createHandler(core.api, {\n\t\tbasePath,\n\t\troutes: options.routes\n\t});\n\tconst handler = (request, context, ...extraArgs) => {\n\t\tif (extraArgs.length > 0) return internalHandler(request);\n\t\treturn internalHandler(request, context);\n\t};\n\tconst api = {\n\t\tbasePath,\n\t\tadapterName: adapterCapabilities.adapterName ?? core.adapterName,\n\t\thandler\n\t};\n\tObject.defineProperties(api, Object.getOwnPropertyDescriptors(core.api));\n\tObject.defineProperty(api, hotUpdaterCoreMetadata, {\n\t\tenumerable: false,\n\t\tvalue: {\n\t\t\tadapterCapabilities,\n\t\t\tcore\n\t\t}\n\t});\n\treturn {\n\t\tapi,\n\t\tadapterCapabilities,\n\t\tcore\n\t};\n}\nfunction createHotUpdater(options) {\n\treturn createHotUpdaterCore(options).api;\n}\n//#endregion\nexport { createHotUpdater, getHotUpdaterCoreMetadata };\n", "// src/compose.ts\nvar compose = (middleware, onError, onNotFound) => {\n return (context, next) => {\n let index = -1;\n return dispatch(0);\n async function dispatch(i) {\n if (i <= index) {\n throw new Error(\"next() called multiple times\");\n }\n index = i;\n let res;\n let isError = false;\n let handler;\n if (middleware[i]) {\n handler = middleware[i][0][0];\n context.req.routeIndex = i;\n } else {\n handler = i === middleware.length && next || void 0;\n }\n if (handler) {\n try {\n res = await handler(context, () => dispatch(i + 1));\n } catch (err) {\n if (err instanceof Error && onError) {\n context.error = err;\n res = await onError(err, context);\n isError = true;\n } else {\n throw err;\n }\n }\n } else {\n if (context.finalized === false && onNotFound) {\n res = await onNotFound(context);\n }\n }\n if (res && (context.finalized === false || isError)) {\n context.res = res;\n }\n return context;\n }\n };\n};\nexport {\n compose\n};\n", "// src/request/constants.ts\nvar GET_MATCH_RESULT = /* @__PURE__ */ Symbol();\nexport {\n GET_MATCH_RESULT\n};\n", "// src/utils/buffer.ts\nimport { sha256 } from \"./crypto.js\";\nvar equal = (a, b) => {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n const va = new DataView(a);\n const vb = new DataView(b);\n let i = va.byteLength;\n while (i--) {\n if (va.getUint8(i) !== vb.getUint8(i)) {\n return false;\n }\n }\n return true;\n};\nvar constantTimeEqualString = (a, b) => {\n const aLen = a.length;\n const bLen = b.length;\n const maxLen = Math.max(aLen, bLen);\n let out = aLen ^ bLen;\n for (let i = 0; i < maxLen; i++) {\n const aChar = i < aLen ? a.charCodeAt(i) : 0;\n const bChar = i < bLen ? b.charCodeAt(i) : 0;\n out |= aChar ^ bChar;\n }\n return out === 0;\n};\nvar timingSafeEqualString = async (a, b, hashFunction) => {\n if (!hashFunction) {\n hashFunction = sha256;\n }\n const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)]);\n if (sa == null || sb == null || typeof sa !== \"string\" || typeof sb !== \"string\") {\n return false;\n }\n const hashEqual = constantTimeEqualString(sa, sb);\n const originalEqual = constantTimeEqualString(a, b);\n return hashEqual && originalEqual;\n};\nvar timingSafeEqual = async (a, b, hashFunction) => {\n if (typeof a === \"string\" && typeof b === \"string\") {\n return timingSafeEqualString(a, b, hashFunction);\n }\n if (!hashFunction) {\n hashFunction = sha256;\n }\n const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)]);\n if (!sa || !sb || typeof sa !== \"string\" || typeof sb !== \"string\") {\n return false;\n }\n return timingSafeEqualString(sa, sb);\n};\nvar bufferToString = (buffer) => {\n if (buffer instanceof ArrayBuffer) {\n const enc = new TextDecoder(\"utf-8\");\n return enc.decode(buffer);\n }\n return buffer;\n};\nvar bufferToFormData = (arrayBuffer, contentType) => {\n const response = new Response(arrayBuffer, {\n headers: {\n // Normalize the media type (case-insensitive) while keeping parameters like the boundary\n \"Content-Type\": contentType.replace(/^[^;]+/, (mediaType) => mediaType.toLowerCase())\n }\n });\n return response.formData();\n};\nexport {\n bufferToFormData,\n bufferToString,\n equal,\n timingSafeEqual\n};\n", "// src/utils/body.ts\nimport { bufferToFormData } from \"./buffer.js\";\nvar isRawRequest = (request) => \"headers\" in request;\nvar parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {\n const { all = false, dot = false } = options;\n const headers = isRawRequest(request) ? request.headers : request.raw.headers;\n const contentType = headers.get(\"Content-Type\");\n const mediaType = contentType?.split(\";\")[0].trim().toLowerCase();\n if (mediaType === \"multipart/form-data\" || mediaType === \"application/x-www-form-urlencoded\") {\n return parseFormData(request, { all, dot });\n }\n return {};\n};\nasync function parseFormData(request, options) {\n if (!isRawRequest(request) && request.bodyCache.formData) {\n return convertFormDataToBodyData(\n await request.bodyCache.formData,\n options\n );\n }\n const headers = isRawRequest(request) ? request.headers : request.raw.headers;\n const arrayBuffer = await request.arrayBuffer();\n const formDataPromise = bufferToFormData(arrayBuffer, headers.get(\"Content-Type\") || \"\");\n if (!isRawRequest(request)) {\n request.bodyCache.formData = formDataPromise;\n }\n const formData = await formDataPromise;\n if (formData) {\n return convertFormDataToBodyData(formData, options);\n }\n return {};\n}\nfunction convertFormDataToBodyData(formData, options) {\n const form = /* @__PURE__ */ Object.create(null);\n formData.forEach((value, key) => {\n const shouldParseAllValues = options.all || key.endsWith(\"[]\");\n if (!shouldParseAllValues) {\n form[key] = value;\n } else {\n handleParsingAllValues(form, key, value);\n }\n });\n if (options.dot) {\n Object.entries(form).forEach(([key, value]) => {\n const shouldParseDotValues = key.includes(\".\");\n if (shouldParseDotValues) {\n handleParsingNestedValues(form, key, value);\n delete form[key];\n }\n });\n }\n return form;\n}\nvar handleParsingAllValues = (form, key, value) => {\n if (form[key] !== void 0) {\n if (Array.isArray(form[key])) {\n ;\n form[key].push(value);\n } else {\n form[key] = [form[key], value];\n }\n } else {\n if (!key.endsWith(\"[]\")) {\n form[key] = value;\n } else {\n form[key] = [value];\n }\n }\n};\nvar handleParsingNestedValues = (form, key, value) => {\n if (/(?:^|\\.)__proto__\\./.test(key)) {\n return;\n }\n let nestedForm = form;\n const keys = key.split(\".\");\n keys.forEach((key2, index) => {\n if (index === keys.length - 1) {\n nestedForm[key2] = value;\n } else {\n if (!nestedForm[key2] || typeof nestedForm[key2] !== \"object\" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {\n nestedForm[key2] = /* @__PURE__ */ Object.create(null);\n }\n nestedForm = nestedForm[key2];\n }\n });\n};\nexport {\n parseBody\n};\n", "// src/utils/url.ts\nvar splitPath = (path) => {\n const paths = path.split(\"/\");\n if (paths[0] === \"\") {\n paths.shift();\n }\n return paths;\n};\nvar splitRoutingPath = (routePath) => {\n const { groups, path } = extractGroupsFromPath(routePath);\n const paths = splitPath(path);\n return replaceGroupMarks(paths, groups);\n};\nvar extractGroupsFromPath = (path) => {\n const groups = [];\n path = path.replace(/\\{[^}]+\\}/g, (match, index) => {\n const mark = `@${index}`;\n groups.push([mark, match]);\n return mark;\n });\n return { groups, path };\n};\nvar replaceGroupMarks = (paths, groups) => {\n for (let i = groups.length - 1; i >= 0; i--) {\n const [mark] = groups[i];\n for (let j = paths.length - 1; j >= 0; j--) {\n if (paths[j].includes(mark)) {\n paths[j] = paths[j].replace(mark, groups[i][1]);\n break;\n }\n }\n }\n return paths;\n};\nvar patternCache = {};\nvar getPattern = (label, next) => {\n if (label === \"*\") {\n return \"*\";\n }\n const match = label.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);\n if (match) {\n const cacheKey = `${label}#${next}`;\n if (!patternCache[cacheKey]) {\n if (match[2]) {\n patternCache[cacheKey] = next && next[0] !== \":\" && next[0] !== \"*\" ? [cacheKey, match[1], new RegExp(`^${match[2]}(?=/${next})`)] : [label, match[1], new RegExp(`^${match[2]}$`)];\n } else {\n patternCache[cacheKey] = [label, match[1], true];\n }\n }\n return patternCache[cacheKey];\n }\n return null;\n};\nvar tryDecode = (str, decoder) => {\n try {\n return decoder(str);\n } catch {\n return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {\n try {\n return decoder(match);\n } catch {\n return match;\n }\n });\n }\n};\nvar tryDecodeURI = (str) => tryDecode(str, decodeURI);\nvar getPath = (request) => {\n const url = request.url;\n const start = url.indexOf(\"/\", url.indexOf(\":\") + 4);\n let i = start;\n for (; i < url.length; i++) {\n const charCode = url.charCodeAt(i);\n if (charCode === 37) {\n const queryIndex = url.indexOf(\"?\", i);\n const hashIndex = url.indexOf(\"#\", i);\n const end = queryIndex === -1 ? hashIndex === -1 ? void 0 : hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);\n const path = url.slice(start, end);\n return tryDecodeURI(path.includes(\"%25\") ? path.replace(/%25/g, \"%2525\") : path);\n } else if (charCode === 63 || charCode === 35) {\n break;\n }\n }\n return url.slice(start, i);\n};\nvar getQueryStrings = (url) => {\n const queryIndex = url.indexOf(\"?\", 8);\n return queryIndex === -1 ? \"\" : \"?\" + url.slice(queryIndex + 1);\n};\nvar getPathNoStrict = (request) => {\n const result = getPath(request);\n return result.length > 1 && result.at(-1) === \"/\" ? result.slice(0, -1) : result;\n};\nvar mergePath = (base, sub, ...rest) => {\n if (rest.length) {\n sub = mergePath(sub, ...rest);\n }\n return `${base?.[0] === \"/\" ? \"\" : \"/\"}${base}${sub === \"/\" ? \"\" : `${base?.at(-1) === \"/\" ? \"\" : \"/\"}${sub?.[0] === \"/\" ? sub.slice(1) : sub}`}`;\n};\nvar checkOptionalParameter = (path) => {\n if (path.charCodeAt(path.length - 1) !== 63 || !path.includes(\":\")) {\n return null;\n }\n const segments = path.split(\"/\");\n const results = [];\n let basePath = \"\";\n segments.forEach((segment) => {\n if (segment !== \"\" && !/\\:/.test(segment)) {\n basePath += \"/\" + segment;\n } else if (/\\:/.test(segment)) {\n if (/\\?/.test(segment)) {\n if (results.length === 0 && basePath === \"\") {\n results.push(\"/\");\n } else {\n results.push(basePath);\n }\n const optionalSegment = segment.replace(\"?\", \"\");\n basePath += \"/\" + optionalSegment;\n results.push(basePath);\n } else {\n basePath += \"/\" + segment;\n }\n }\n });\n return results.filter((v, i, a) => a.indexOf(v) === i);\n};\nvar _decodeURI = (value) => {\n if (!/[%+]/.test(value)) {\n return value;\n }\n if (value.indexOf(\"+\") !== -1) {\n value = value.replace(/\\+/g, \" \");\n }\n return value.indexOf(\"%\") !== -1 ? tryDecode(value, decodeURIComponent_) : value;\n};\nvar _getQueryParam = (url, key, multiple) => {\n let encoded;\n if (!multiple && key && !/[%+]/.test(key)) {\n let keyIndex2 = url.indexOf(\"?\", 8);\n if (keyIndex2 === -1) {\n return void 0;\n }\n if (!url.startsWith(key, keyIndex2 + 1)) {\n keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);\n }\n while (keyIndex2 !== -1) {\n const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);\n if (trailingKeyCode === 61) {\n const valueIndex = keyIndex2 + key.length + 2;\n const endIndex = url.indexOf(\"&\", valueIndex);\n return _decodeURI(url.slice(valueIndex, endIndex === -1 ? void 0 : endIndex));\n } else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) {\n return \"\";\n }\n keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);\n }\n encoded = /[%+]/.test(url);\n if (!encoded) {\n return void 0;\n }\n }\n const results = /* @__PURE__ */ Object.create(null);\n encoded ??= /[%+]/.test(url);\n let keyIndex = url.indexOf(\"?\", 8);\n while (keyIndex !== -1) {\n const nextKeyIndex = url.indexOf(\"&\", keyIndex + 1);\n let valueIndex = url.indexOf(\"=\", keyIndex);\n if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) {\n valueIndex = -1;\n }\n let name = url.slice(\n keyIndex + 1,\n valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex\n );\n if (encoded) {\n name = _decodeURI(name);\n }\n keyIndex = nextKeyIndex;\n if (name === \"\") {\n continue;\n }\n let value;\n if (valueIndex === -1) {\n value = \"\";\n } else {\n value = url.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex);\n if (encoded) {\n value = _decodeURI(value);\n }\n }\n if (multiple) {\n if (!(results[name] && Array.isArray(results[name]))) {\n results[name] = [];\n }\n ;\n results[name].push(value);\n } else {\n results[name] ??= value;\n }\n }\n return key ? results[key] : results;\n};\nvar getQueryParam = _getQueryParam;\nvar getQueryParams = (url, key) => {\n return _getQueryParam(url, key, true);\n};\nvar decodeURIComponent_ = decodeURIComponent;\nexport {\n checkOptionalParameter,\n decodeURIComponent_,\n getPath,\n getPathNoStrict,\n getPattern,\n getQueryParam,\n getQueryParams,\n getQueryStrings,\n mergePath,\n splitPath,\n splitRoutingPath,\n tryDecode,\n tryDecodeURI\n};\n", "// src/request.ts\nimport { HTTPException } from \"./http-exception.js\";\nimport { GET_MATCH_RESULT } from \"./request/constants.js\";\nimport { parseBody } from \"./utils/body.js\";\nimport { decodeURIComponent_, getQueryParam, getQueryParams, tryDecode } from \"./utils/url.js\";\nvar tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);\nvar HonoRequest = class {\n /**\n * `.raw` can get the raw Request object.\n *\n * @see {@link https://hono.dev/docs/api/request#raw}\n *\n * @example\n * ```ts\n * // For Cloudflare Workers\n * app.post('/', async (c) => {\n * const metadata = c.req.raw.cf?.hostMetadata?\n * ...\n * })\n * ```\n */\n raw;\n #validatedData;\n // Short name of validatedData\n #matchResult;\n routeIndex = 0;\n /**\n * `.path` can get the pathname of the request.\n *\n * @see {@link https://hono.dev/docs/api/request#path}\n *\n * @example\n * ```ts\n * app.get('/about/me', (c) => {\n * const pathname = c.req.path // `/about/me`\n * })\n * ```\n */\n path;\n bodyCache = {};\n constructor(request, path = \"/\", matchResult = [[]]) {\n this.raw = request;\n this.path = path;\n this.#matchResult = matchResult;\n this.#validatedData = {};\n }\n param(key) {\n return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();\n }\n #getDecodedParam(key) {\n const paramKey = this.#matchResult[0][this.routeIndex][1][key];\n const param = this.#getParamValue(paramKey);\n return param && /\\%/.test(param) ? tryDecodeURIComponent(param) : param;\n }\n #getAllDecodedParams() {\n const decoded = {};\n const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);\n for (const key of keys) {\n const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);\n if (value !== void 0) {\n decoded[key] = /\\%/.test(value) ? tryDecodeURIComponent(value) : value;\n }\n }\n return decoded;\n }\n #getParamValue(paramKey) {\n return this.#matchResult[1] ? this.#matchResult[1][paramKey] : paramKey;\n }\n query(key) {\n return getQueryParam(this.url, key);\n }\n queries(key) {\n return getQueryParams(this.url, key);\n }\n header(name) {\n if (name) {\n return this.raw.headers.get(name) ?? void 0;\n }\n const headerData = /* @__PURE__ */ Object.create(null);\n this.raw.headers.forEach((value, key) => {\n headerData[key] = value;\n });\n return headerData;\n }\n async parseBody(options) {\n return parseBody(this, options);\n }\n #cachedBody = (key) => {\n const { bodyCache, raw } = this;\n const cachedBody = bodyCache[key];\n if (cachedBody) {\n return cachedBody;\n }\n const anyCachedKey = Object.keys(bodyCache)[0];\n if (anyCachedKey) {\n return bodyCache[anyCachedKey].then((body) => {\n if (anyCachedKey === \"json\") {\n body = JSON.stringify(body);\n }\n return new Response(body)[key]();\n });\n }\n return bodyCache[key] = raw[key]();\n };\n /**\n * `.json()` can parse Request body of type `application/json`\n *\n * @see {@link https://hono.dev/docs/api/request#json}\n *\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.json()\n * })\n * ```\n */\n json() {\n return this.#cachedBody(\"text\").then((text) => JSON.parse(text));\n }\n /**\n * `.text()` can parse Request body of type `text/plain`\n *\n * @see {@link https://hono.dev/docs/api/request#text}\n *\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.text()\n * })\n * ```\n */\n text() {\n return this.#cachedBody(\"text\");\n }\n /**\n * `.arrayBuffer()` parse Request body as an `ArrayBuffer`\n *\n * @see {@link https://hono.dev/docs/api/request#arraybuffer}\n *\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.arrayBuffer()\n * })\n * ```\n */\n arrayBuffer() {\n return this.#cachedBody(\"arrayBuffer\");\n }\n /**\n * `.bytes()` parses the request body as a `Uint8Array`.\n *\n * @see {@link https://hono.dev/docs/api/request#bytes}\n *\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.bytes()\n * })\n * ```\n */\n bytes() {\n return this.#cachedBody(\"arrayBuffer\").then((buffer) => new Uint8Array(buffer));\n }\n /**\n * Parses the request body as a `Blob`.\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.blob();\n * });\n * ```\n * @see https://hono.dev/docs/api/request#blob\n */\n blob() {\n return this.#cachedBody(\"blob\");\n }\n /**\n * Parses the request body as `FormData`.\n * @example\n * ```ts\n * app.post('/entry', async (c) => {\n * const body = await c.req.formData();\n * });\n * ```\n * @see https://hono.dev/docs/api/request#formdata\n */\n formData() {\n return this.#cachedBody(\"formData\");\n }\n /**\n * Adds validated data to the request.\n *\n * @param target - The target of the validation.\n * @param data - The validated data to add.\n */\n addValidatedData(target, data) {\n this.#validatedData[target] = data;\n }\n valid(target) {\n return this.#validatedData[target];\n }\n /**\n * `.url()` can get the request url strings.\n *\n * @see {@link https://hono.dev/docs/api/request#url}\n *\n * @example\n * ```ts\n * app.get('/about/me', (c) => {\n * const url = c.req.url // `http://localhost:8787/about/me`\n * ...\n * })\n * ```\n */\n get url() {\n return this.raw.url;\n }\n /**\n * `.method()` can get the method name of the request.\n *\n * @see {@link https://hono.dev/docs/api/request#method}\n *\n * @example\n * ```ts\n * app.get('/about/me', (c) => {\n * const method = c.req.method // `GET`\n * })\n * ```\n */\n get method() {\n return this.raw.method;\n }\n get [GET_MATCH_RESULT]() {\n return this.#matchResult;\n }\n /**\n * `.matchedRoutes()` can return a matched route in the handler\n *\n * @deprecated\n *\n * Use matchedRoutes helper defined in \"hono/route\" instead.\n *\n * @see {@link https://hono.dev/docs/api/request#matchedroutes}\n *\n * @example\n * ```ts\n * app.use('*', async function logger(c, next) {\n * await next()\n * c.req.matchedRoutes.forEach(({ handler, method, path }, i) => {\n * const name = handler.name || (handler.length < 2 ? '[handler]' : '[middleware]')\n * console.log(\n * method,\n * ' ',\n * path,\n * ' '.repeat(Math.max(10 - path.length, 0)),\n * name,\n * i === c.req.routeIndex ? '<- respond from here' : ''\n * )\n * })\n * })\n * ```\n */\n get matchedRoutes() {\n return this.#matchResult[0].map(([[, route]]) => route);\n }\n /**\n * `routePath()` can retrieve the path registered within the handler\n *\n * @deprecated\n *\n * Use routePath helper defined in \"hono/route\" instead.\n *\n * @see {@link https://hono.dev/docs/api/request#routepath}\n *\n * @example\n * ```ts\n * app.get('/posts/:id', (c) => {\n * return c.json({ path: c.req.routePath })\n * })\n * ```\n */\n get routePath() {\n return this.#matchResult[0].map(([[, route]]) => route)[this.routeIndex].path;\n }\n};\nvar cloneRawRequest = async (req) => {\n if (!req.raw.bodyUsed) {\n return req.raw.clone();\n }\n const cacheKey = Object.keys(req.bodyCache)[0];\n if (!cacheKey) {\n throw new HTTPException(500, {\n message: \"Cannot clone request: body was already consumed and not cached. Please use HonoRequest methods (e.g., req.json(), req.text()) instead of consuming req.raw directly.\"\n });\n }\n const body = await req[cacheKey]();\n const headers = req.header();\n if (body instanceof FormData) {\n delete headers[\"content-type\"];\n }\n const requestInit = {\n body,\n cache: req.raw.cache,\n credentials: req.raw.credentials,\n headers,\n integrity: req.raw.integrity,\n keepalive: req.raw.keepalive,\n method: req.method,\n mode: req.raw.mode,\n redirect: req.raw.redirect,\n referrer: req.raw.referrer,\n referrerPolicy: req.raw.referrerPolicy,\n signal: req.raw.signal\n };\n return new Request(req.url, requestInit);\n};\nexport {\n HonoRequest,\n cloneRawRequest\n};\n", "// src/utils/html.ts\nvar HtmlEscapedCallbackPhase = {\n Stringify: 1,\n BeforeStream: 2,\n Stream: 3\n};\nvar raw = (value, callbacks) => {\n const escapedString = new String(value);\n escapedString.isEscaped = true;\n escapedString.callbacks = callbacks;\n return escapedString;\n};\nvar escapeRe = /[&<>'\"]/;\nvar stringBufferToString = async (buffer, callbacks) => {\n let str = \"\";\n callbacks ||= [];\n const resolvedBuffer = await Promise.all(buffer);\n for (let i = resolvedBuffer.length - 1; ; i--) {\n str += resolvedBuffer[i];\n i--;\n if (i < 0) {\n break;\n }\n let r = resolvedBuffer[i];\n if (typeof r === \"object\") {\n callbacks.push(...r.callbacks || []);\n }\n const isEscaped = r.isEscaped;\n r = await (typeof r === \"object\" ? r.toString() : r);\n if (typeof r === \"object\") {\n callbacks.push(...r.callbacks || []);\n }\n if (r.isEscaped ?? isEscaped) {\n str += r;\n } else {\n const buf = [str];\n escapeToBuffer(r, buf);\n str = buf[0];\n }\n }\n return raw(str, callbacks);\n};\nvar escapeToBuffer = (str, buffer) => {\n const match = str.search(escapeRe);\n if (match === -1) {\n buffer[0] += str;\n return;\n }\n let escape;\n let index;\n let lastIndex = 0;\n for (index = match; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34:\n escape = \"&quot;\";\n break;\n case 39:\n escape = \"&#39;\";\n break;\n case 38:\n escape = \"&amp;\";\n break;\n case 60:\n escape = \"&lt;\";\n break;\n case 62:\n escape = \"&gt;\";\n break;\n default:\n continue;\n }\n buffer[0] += str.substring(lastIndex, index) + escape;\n lastIndex = index + 1;\n }\n buffer[0] += str.substring(lastIndex, index);\n};\nvar resolveCallbackSync = (str) => {\n const callbacks = str.callbacks;\n if (!callbacks?.length) {\n return str;\n }\n const buffer = [str];\n const context = {};\n callbacks.forEach((c) => c({ phase: HtmlEscapedCallbackPhase.Stringify, buffer, context }));\n return buffer[0];\n};\nvar resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {\n if (typeof str === \"object\" && !(str instanceof String)) {\n if (!(str instanceof Promise)) {\n str = str.toString();\n }\n if (str instanceof Promise) {\n str = await str;\n }\n }\n const callbacks = str.callbacks;\n if (!callbacks?.length) {\n return Promise.resolve(str);\n }\n if (buffer) {\n buffer[0] += str;\n } else {\n buffer = [str];\n }\n const resStr = Promise.all(callbacks.map((c) => c({ phase, buffer, context }))).then(\n (res) => Promise.all(\n res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context, buffer))\n ).then(() => buffer[0])\n );\n if (preserveCallbacks) {\n return raw(await resStr, callbacks);\n } else {\n return resStr;\n }\n};\nexport {\n HtmlEscapedCallbackPhase,\n escapeToBuffer,\n raw,\n resolveCallback,\n resolveCallbackSync,\n stringBufferToString\n};\n", "// src/context.ts\nimport { HonoRequest } from \"./request.js\";\nimport { HtmlEscapedCallbackPhase, resolveCallback } from \"./utils/html.js\";\nvar TEXT_PLAIN = \"text/plain; charset=UTF-8\";\nvar setDefaultContentType = (contentType, headers) => {\n return {\n \"Content-Type\": contentType,\n ...headers\n };\n};\nvar createResponseInstance = (body, init) => new Response(body, init);\nvar Context = class {\n #rawRequest;\n #req;\n /**\n * `.env` can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.\n *\n * @see {@link https://hono.dev/docs/api/context#env}\n *\n * @example\n * ```ts\n * // Environment object for Cloudflare Workers\n * app.get('*', async c => {\n * const counter = c.env.COUNTER\n * })\n * ```\n */\n env = {};\n #var;\n finalized = false;\n /**\n * `.error` can get the error object from the middleware if the Handler throws an error.\n *\n * @see {@link https://hono.dev/docs/api/context#error}\n *\n * @example\n * ```ts\n * app.use('*', async (c, next) => {\n * await next()\n * if (c.error) {\n * // do something...\n * }\n * })\n * ```\n */\n error;\n #status;\n #executionCtx;\n #res;\n #layout;\n #renderer;\n #notFoundHandler;\n #preparedHeaders;\n #matchResult;\n #path;\n /**\n * Creates an instance of the Context class.\n *\n * @param req - The Request object.\n * @param options - Optional configuration options for the context.\n */\n constructor(req, options) {\n this.#rawRequest = req;\n if (options) {\n this.#executionCtx = options.executionCtx;\n this.env = options.env;\n this.#notFoundHandler = options.notFoundHandler;\n this.#path = options.path;\n this.#matchResult = options.matchResult;\n }\n }\n /**\n * `.req` is the instance of {@link HonoRequest}.\n */\n get req() {\n this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult);\n return this.#req;\n }\n /**\n * @see {@link https://hono.dev/docs/api/context#event}\n * The FetchEvent associated with the current request.\n *\n * @throws Will throw an error if the context does not have a FetchEvent.\n */\n get event() {\n if (this.#executionCtx && \"respondWith\" in this.#executionCtx) {\n return this.#executionCtx;\n } else {\n throw Error(\"This context has no FetchEvent\");\n }\n }\n /**\n * @see {@link https://hono.dev/docs/api/context#executionctx}\n * The ExecutionContext associated with the current request.\n *\n * @throws Will throw an error if the context does not have an ExecutionContext.\n */\n get executionCtx() {\n if (this.#executionCtx) {\n return this.#executionCtx;\n } else {\n throw Error(\"This context has no ExecutionContext\");\n }\n }\n /**\n * @see {@link https://hono.dev/docs/api/context#res}\n * The Response object for the current request.\n */\n get res() {\n return this.#res ||= createResponseInstance(null, {\n headers: this.#preparedHeaders ??= new Headers()\n });\n }\n /**\n * Sets the Response object for the current request.\n *\n * @param _res - The Response object to set.\n */\n set res(_res) {\n if (this.#res && _res) {\n _res = createResponseInstance(_res.body, _res);\n for (const [k, v] of this.#res.headers.entries()) {\n if (k === \"content-type\") {\n continue;\n }\n if (k === \"set-cookie\") {\n const cookies = this.#res.headers.getSetCookie();\n _res.headers.delete(\"set-cookie\");\n for (const cookie of cookies) {\n _res.headers.append(\"set-cookie\", cookie);\n }\n } else {\n _res.headers.set(k, v);\n }\n }\n }\n this.#res = _res;\n this.finalized = true;\n }\n /**\n * `.render()` can create a response within a layout.\n *\n * @see {@link https://hono.dev/docs/api/context#render-setrenderer}\n *\n * @example\n * ```ts\n * app.get('/', (c) => {\n * return c.render('Hello!')\n * })\n * ```\n */\n render = (...args) => {\n this.#renderer ??= (content) => this.html(content);\n return this.#renderer(...args);\n };\n /**\n * Sets the layout for the response.\n *\n * @param layout - The layout to set.\n * @returns The layout function.\n */\n setLayout = (layout) => this.#layout = layout;\n /**\n * Gets the current layout for the response.\n *\n * @returns The current layout function.\n */\n getLayout = () => this.#layout;\n /**\n * `.setRenderer()` can set the layout in the custom middleware.\n *\n * @see {@link https://hono.dev/docs/api/context#render-setrenderer}\n *\n * @example\n * ```tsx\n * app.use('*', async (c, next) => {\n * c.setRenderer((content) => {\n * return c.html(\n * <html>\n * <body>\n * <p>{content}</p>\n * </body>\n * </html>\n * )\n * })\n * await next()\n * })\n * ```\n */\n setRenderer = (renderer) => {\n this.#renderer = renderer;\n };\n /**\n * `.header()` can set headers.\n *\n * @see {@link https://hono.dev/docs/api/context#header}\n *\n * @example\n * ```ts\n * app.get('/welcome', (c) => {\n * // Set headers\n * c.header('X-Message', 'Hello!')\n * c.header('Content-Type', 'text/plain')\n *\n * return c.body('Thank you for coming')\n * })\n * ```\n */\n header = (name, value, options) => {\n if (this.finalized) {\n this.#res = createResponseInstance(this.#res.body, this.#res);\n }\n const headers = this.#res ? this.#res.headers : this.#preparedHeaders ??= new Headers();\n if (value === void 0) {\n headers.delete(name);\n } else if (options?.append) {\n headers.append(name, value);\n } else {\n headers.set(name, value);\n }\n };\n status = (status) => {\n this.#status = status;\n };\n /**\n * `.set()` can set the value specified by the key.\n *\n * @see {@link https://hono.dev/docs/api/context#set-get}\n *\n * @example\n * ```ts\n * app.use('*', async (c, next) => {\n * c.set('message', 'Hono is hot!!')\n * await next()\n * })\n * ```\n */\n set = (key, value) => {\n this.#var ??= /* @__PURE__ */ new Map();\n this.#var.set(key, value);\n };\n /**\n * `.get()` can use the value specified by the key.\n *\n * @see {@link https://hono.dev/docs/api/context#set-get}\n *\n * @example\n * ```ts\n * app.get('/', (c) => {\n * const message = c.get('message')\n * return c.text(`The message is \"${message}\"`)\n * })\n * ```\n */\n get = (key) => {\n return this.#var ? this.#var.get(key) : void 0;\n };\n /**\n * `.var` can access the value of a variable.\n *\n * @see {@link https://hono.dev/docs/api/context#var}\n *\n * @example\n * ```ts\n * const result = c.var.client.oneMethod()\n * ```\n */\n // c.var.propName is a read-only\n get var() {\n if (!this.#var) {\n return {};\n }\n return Object.fromEntries(this.#var);\n }\n #newResponse(data, arg, headers) {\n const responseHeaders = this.#res ? new Headers(this.#res.headers) : this.#preparedHeaders ?? new Headers();\n if (typeof arg === \"object\" && \"headers\" in arg) {\n const argHeaders = arg.headers instanceof Headers ? arg.headers : new Headers(arg.headers);\n for (const [key, value] of argHeaders) {\n if (key.toLowerCase() === \"set-cookie\") {\n responseHeaders.append(key, value);\n } else {\n responseHeaders.set(key, value);\n }\n }\n }\n if (headers) {\n for (const [k, v] of Object.entries(headers)) {\n if (typeof v === \"string\") {\n responseHeaders.set(k, v);\n } else {\n responseHeaders.delete(k);\n for (const v2 of v) {\n responseHeaders.append(k, v2);\n }\n }\n }\n }\n const status = typeof arg === \"number\" ? arg : arg?.status ?? this.#status;\n return createResponseInstance(data, { status, headers: responseHeaders });\n }\n newResponse = (...args) => this.#newResponse(...args);\n /**\n * `.body()` can return the HTTP response.\n * You can set headers with `.header()` and set HTTP status code with `.status`.\n * This can also be set in `.text()`, `.json()` and so on.\n *\n * @see {@link https://hono.dev/docs/api/context#body}\n *\n * @example\n * ```ts\n * app.get('/welcome', (c) => {\n * // Set headers\n * c.header('X-Message', 'Hello!')\n * c.header('Content-Type', 'text/plain')\n * // Set HTTP status code\n * c.status(201)\n *\n * // Return the response body\n * return c.body('Thank you for coming')\n * })\n * ```\n */\n body = (data, arg, headers) => this.#newResponse(data, arg, headers);\n /**\n * `.text()` can render text as `Content-Type:text/plain`.\n *\n * @see {@link https://hono.dev/docs/api/context#text}\n *\n * @example\n * ```ts\n * app.get('/say', (c) => {\n * return c.text('Hello!')\n * })\n * ```\n */\n text = (text, arg, headers) => {\n return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized ? new Response(text) : this.#newResponse(\n text,\n arg,\n setDefaultContentType(TEXT_PLAIN, headers)\n );\n };\n /**\n * `.json()` can render JSON as `Content-Type:application/json`.\n *\n * @see {@link https://hono.dev/docs/api/context#json}\n *\n * @example\n * ```ts\n * app.get('/api', (c) => {\n * return c.json({ message: 'Hello!' })\n * })\n * ```\n */\n json = (object, arg, headers) => {\n return this.#newResponse(\n JSON.stringify(object),\n arg,\n setDefaultContentType(\"application/json\", headers)\n );\n };\n html = (html, arg, headers) => {\n const res = (html2) => this.#newResponse(html2, arg, setDefaultContentType(\"text/html; charset=UTF-8\", headers));\n return typeof html === \"object\" ? resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html);\n };\n /**\n * `.redirect()` can Redirect, default status code is 302.\n *\n * @see {@link https://hono.dev/docs/api/context#redirect}\n *\n * @example\n * ```ts\n * app.get('/redirect', (c) => {\n * return c.redirect('/')\n * })\n * app.get('/redirect-permanently', (c) => {\n * return c.redirect('/', 301)\n * })\n * ```\n */\n redirect = (location, status) => {\n const locationString = String(location);\n this.header(\n \"Location\",\n // Multibyes should be encoded\n // eslint-disable-next-line no-control-regex\n !/[^\\x00-\\xFF]/.test(locationString) ? locationString : encodeURI(locationString)\n );\n return this.newResponse(null, status ?? 302);\n };\n /**\n * `.notFound()` can return the Not Found Response.\n *\n * @see {@link https://hono.dev/docs/api/context#notfound}\n *\n * @example\n * ```ts\n * app.get('/notfound', (c) => {\n * return c.notFound()\n * })\n * ```\n */\n notFound = () => {\n this.#notFoundHandler ??= () => createResponseInstance();\n return this.#notFoundHandler(this);\n };\n};\nexport {\n Context,\n TEXT_PLAIN\n};\n", "// src/router.ts\nvar METHOD_NAME_ALL = \"ALL\";\nvar METHOD_NAME_ALL_LOWERCASE = \"all\";\nvar METHODS = [\"get\", \"post\", \"put\", \"delete\", \"options\", \"patch\"];\nvar MESSAGE_MATCHER_IS_ALREADY_BUILT = \"Can not add a route since the matcher is already built.\";\nvar UnsupportedPathError = class extends Error {\n};\nexport {\n MESSAGE_MATCHER_IS_ALREADY_BUILT,\n METHODS,\n METHOD_NAME_ALL,\n METHOD_NAME_ALL_LOWERCASE,\n UnsupportedPathError\n};\n", "// src/utils/constants.ts\nvar COMPOSED_HANDLER = \"__COMPOSED_HANDLER\";\nexport {\n COMPOSED_HANDLER\n};\n", "// src/hono-base.ts\nimport { compose } from \"./compose.js\";\nimport { Context } from \"./context.js\";\nimport { METHODS, METHOD_NAME_ALL, METHOD_NAME_ALL_LOWERCASE } from \"./router.js\";\nimport { COMPOSED_HANDLER } from \"./utils/constants.js\";\nimport { getPath, getPathNoStrict, mergePath } from \"./utils/url.js\";\nvar notFoundHandler = (c) => {\n return c.text(\"404 Not Found\", 404);\n};\nvar errorHandler = (err, c) => {\n if (\"getResponse\" in err) {\n const res = err.getResponse();\n return c.newResponse(res.body, res);\n }\n console.error(err);\n return c.text(\"Internal Server Error\", 500);\n};\nvar Hono = class _Hono {\n get;\n post;\n put;\n delete;\n options;\n patch;\n all;\n on;\n use;\n /*\n This class is like an abstract class and does not have a router.\n To use it, inherit the class and implement router in the constructor.\n */\n router;\n getPath;\n // Cannot use `#` because it requires visibility at JavaScript runtime.\n _basePath = \"/\";\n #path = \"/\";\n routes = [];\n constructor(options = {}) {\n const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];\n allMethods.forEach((method) => {\n this[method] = (args1, ...args) => {\n if (typeof args1 === \"string\") {\n this.#path = args1;\n } else {\n this.#addRoute(method, this.#path, args1);\n }\n args.forEach((handler) => {\n this.#addRoute(method, this.#path, handler);\n });\n return this;\n };\n });\n this.on = (method, path, ...handlers) => {\n for (const p of [path].flat()) {\n this.#path = p;\n for (const m of [method].flat()) {\n handlers.map((handler) => {\n this.#addRoute(m.toUpperCase(), this.#path, handler);\n });\n }\n }\n return this;\n };\n this.use = (arg1, ...handlers) => {\n if (typeof arg1 === \"string\") {\n this.#path = arg1;\n } else {\n this.#path = \"*\";\n handlers.unshift(arg1);\n }\n handlers.forEach((handler) => {\n this.#addRoute(METHOD_NAME_ALL, this.#path, handler);\n });\n return this;\n };\n const { strict, ...optionsWithoutStrict } = options;\n Object.assign(this, optionsWithoutStrict);\n this.getPath = strict ?? true ? options.getPath ?? getPath : getPathNoStrict;\n }\n #clone() {\n const clone = new _Hono({\n router: this.router,\n getPath: this.getPath\n });\n clone.errorHandler = this.errorHandler;\n clone.#notFoundHandler = this.#notFoundHandler;\n clone.routes = this.routes;\n return clone;\n }\n #notFoundHandler = notFoundHandler;\n // Cannot use `#` because it requires visibility at JavaScript runtime.\n errorHandler = errorHandler;\n /**\n * `.route()` allows grouping other Hono instance in routes.\n *\n * @see {@link https://hono.dev/docs/api/routing#grouping}\n *\n * @param {string} path - base Path\n * @param {Hono} app - other Hono instance\n * @returns {Hono} routed Hono instance\n *\n * @example\n * ```ts\n * const app = new Hono()\n * const app2 = new Hono()\n *\n * app2.get(\"/user\", (c) => c.text(\"user\"))\n * app.route(\"/api\", app2) // GET /api/user\n * ```\n */\n route(path, app) {\n const subApp = this.basePath(path);\n app.routes.map((r) => {\n let handler;\n if (app.errorHandler === errorHandler) {\n handler = r.handler;\n } else {\n handler = async (c, next) => (await compose([], app.errorHandler)(c, () => r.handler(c, next))).res;\n handler[COMPOSED_HANDLER] = r.handler;\n }\n subApp.#addRoute(r.method, r.path, handler, r.basePath);\n });\n return this;\n }\n /**\n * `.basePath()` allows base paths to be specified.\n *\n * @see {@link https://hono.dev/docs/api/routing#base-path}\n *\n * @param {string} path - base Path\n * @returns {Hono} changed Hono instance\n *\n * @example\n * ```ts\n * const api = new Hono().basePath('/api')\n * ```\n */\n basePath(path) {\n const subApp = this.#clone();\n subApp._basePath = mergePath(this._basePath, path);\n return subApp;\n }\n /**\n * `.onError()` handles an error and returns a customized Response.\n *\n * @see {@link https://hono.dev/docs/api/hono#error-handling}\n *\n * @param {ErrorHandler} handler - request Handler for error\n * @returns {Hono} changed Hono instance\n *\n * @example\n * ```ts\n * app.onError((err, c) => {\n * console.error(`${err}`)\n * return c.text('Custom Error Message', 500)\n * })\n * ```\n */\n onError = (handler) => {\n this.errorHandler = handler;\n return this;\n };\n /**\n * `.notFound()` allows you to customize a Not Found Response.\n *\n * @see {@link https://hono.dev/docs/api/hono#not-found}\n *\n * @param {NotFoundHandler} handler - request handler for not-found\n * @returns {Hono} changed Hono instance\n *\n * @example\n * ```ts\n * app.notFound((c) => {\n * return c.text('Custom 404 Message', 404)\n * })\n * ```\n */\n notFound = (handler) => {\n this.#notFoundHandler = handler;\n return this;\n };\n /**\n * `.mount()` allows you to mount applications built with other frameworks into your Hono application.\n *\n * @see {@link https://hono.dev/docs/api/hono#mount}\n *\n * @param {string} path - base Path\n * @param {Function} applicationHandler - other Request Handler\n * @param {MountOptions} [options] - options of `.mount()`\n * @returns {Hono} mounted Hono instance\n *\n * @example\n * ```ts\n * import { Router as IttyRouter } from 'itty-router'\n * import { Hono } from 'hono'\n * // Create itty-router application\n * const ittyRouter = IttyRouter()\n * // GET /itty-router/hello\n * ittyRouter.get('/hello', () => new Response('Hello from itty-router'))\n *\n * const app = new Hono()\n * app.mount('/itty-router', ittyRouter.handle)\n * ```\n *\n * @example\n * ```ts\n * const app = new Hono()\n * // Send the request to another application without modification.\n * app.mount('/app', anotherApp, {\n * replaceRequest: (req) => req,\n * })\n * ```\n */\n mount(path, applicationHandler, options) {\n let replaceRequest;\n let optionHandler;\n if (options) {\n if (typeof options === \"function\") {\n optionHandler = options;\n } else {\n optionHandler = options.optionHandler;\n if (options.replaceRequest === false) {\n replaceRequest = (request) => request;\n } else {\n replaceRequest = options.replaceRequest;\n }\n }\n }\n const getOptions = optionHandler ? (c) => {\n const options2 = optionHandler(c);\n return Array.isArray(options2) ? options2 : [options2];\n } : (c) => {\n let executionContext = void 0;\n try {\n executionContext = c.executionCtx;\n } catch {\n }\n return [c.env, executionContext];\n };\n replaceRequest ||= (() => {\n const mergedPath = mergePath(this._basePath, path);\n const pathPrefixLength = mergedPath === \"/\" ? 0 : mergedPath.length;\n return (request) => {\n const url = new URL(request.url);\n url.pathname = this.getPath(request).slice(pathPrefixLength) || \"/\";\n return new Request(url, request);\n };\n })();\n const handler = async (c, next) => {\n const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c));\n if (res) {\n return res;\n }\n await next();\n };\n this.#addRoute(METHOD_NAME_ALL, mergePath(path, \"*\"), handler);\n return this;\n }\n #addRoute(method, path, handler, baseRoutePath) {\n method = method.toUpperCase();\n path = mergePath(this._basePath, path);\n const r = {\n basePath: baseRoutePath !== void 0 ? mergePath(this._basePath, baseRoutePath) : this._basePath,\n path,\n method,\n handler\n };\n this.router.add(method, path, [handler, r]);\n this.routes.push(r);\n }\n #handleError(err, c) {\n if (err instanceof Error) {\n return this.errorHandler(err, c);\n }\n throw err;\n }\n #dispatch(request, executionCtx, env, method) {\n if (method === \"HEAD\") {\n return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, \"GET\")))();\n }\n const path = this.getPath(request, { env });\n const matchResult = this.router.match(method, path);\n const c = new Context(request, {\n path,\n matchResult,\n env,\n executionCtx,\n notFoundHandler: this.#notFoundHandler\n });\n if (matchResult[0].length === 1) {\n let res;\n try {\n res = matchResult[0][0][0][0](c, async () => {\n c.res = await this.#notFoundHandler(c);\n });\n } catch (err) {\n return this.#handleError(err, c);\n }\n return res instanceof Promise ? res.then(\n (resolved) => resolved || (c.finalized ? c.res : this.#notFoundHandler(c))\n ).catch((err) => this.#handleError(err, c)) : res ?? this.#notFoundHandler(c);\n }\n const composed = compose(matchResult[0], this.errorHandler, this.#notFoundHandler);\n return (async () => {\n try {\n const context = await composed(c);\n if (!context.finalized) {\n throw new Error(\n \"Context is not finalized. Did you forget to return a Response object or `await next()`?\"\n );\n }\n return context.res;\n } catch (err) {\n return this.#handleError(err, c);\n }\n })();\n }\n /**\n * `.fetch()` will be entry point of your app.\n *\n * @see {@link https://hono.dev/docs/api/hono#fetch}\n *\n * @param {Request} request - request Object of request\n * @param {Env} Env - env Object\n * @param {ExecutionContext} - context of execution\n * @returns {Response | Promise<Response>} response of request\n *\n */\n fetch = (request, ...rest) => {\n return this.#dispatch(request, rest[1], rest[0], request.method);\n };\n /**\n * `.request()` is a useful method for testing.\n * You can pass a URL or pathname to send a GET request.\n * app will return a Response object.\n * ```ts\n * test('GET /hello is ok', async () => {\n * const res = await app.request('/hello')\n * expect(res.status).toBe(200)\n * })\n * ```\n * @see https://hono.dev/docs/api/hono#request\n */\n request = (input, requestInit, Env, executionCtx) => {\n if (input instanceof Request) {\n return this.fetch(requestInit ? new Request(input, requestInit) : input, Env, executionCtx);\n }\n input = input.toString();\n return this.fetch(\n new Request(\n /^https?:\\/\\//.test(input) ? input : `http://localhost${mergePath(\"/\", input)}`,\n requestInit\n ),\n Env,\n executionCtx\n );\n };\n /**\n * `.fire()` automatically adds a global fetch event listener.\n * This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers.\n * @deprecated\n * Use `fire` from `hono/service-worker` instead.\n * ```ts\n * import { Hono } from 'hono'\n * import { fire } from 'hono/service-worker'\n *\n * const app = new Hono()\n * // ...\n * fire(app)\n * ```\n * @see https://hono.dev/docs/api/hono#fire\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\n * @see https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/\n */\n fire = () => {\n addEventListener(\"fetch\", (event) => {\n event.respondWith(this.#dispatch(event.request, event, void 0, event.request.method));\n });\n };\n};\nexport {\n Hono as HonoBase\n};\n", "// src/router/reg-exp-router/matcher.ts\nimport { METHOD_NAME_ALL } from \"../../router.js\";\nvar emptyParam = [];\nfunction match(method, path) {\n const matchers = this.buildAllMatchers();\n const match2 = ((method2, path2) => {\n const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];\n const staticMatch = matcher[2][path2];\n if (staticMatch) {\n return staticMatch;\n }\n const match3 = path2.match(matcher[0]);\n if (!match3) {\n return [[], emptyParam];\n }\n const index = match3.indexOf(\"\", 1);\n return [matcher[1][index], match3];\n });\n this.match = match2;\n return match2(method, path);\n}\nexport {\n emptyParam,\n match\n};\n", "// src/router/reg-exp-router/node.ts\nvar LABEL_REG_EXP_STR = \"[^/]+\";\nvar ONLY_WILDCARD_REG_EXP_STR = \".*\";\nvar TAIL_WILDCARD_REG_EXP_STR = \"(?:|/.*)\";\nvar PATH_ERROR = /* @__PURE__ */ Symbol();\nvar regExpMetaChars = new Set(\".\\\\+*[^]$()\");\nfunction compareKey(a, b) {\n if (a.length === 1) {\n return b.length === 1 ? a < b ? -1 : 1 : -1;\n }\n if (b.length === 1) {\n return 1;\n }\n if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) {\n return 1;\n } else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) {\n return -1;\n }\n if (a === LABEL_REG_EXP_STR) {\n return 1;\n } else if (b === LABEL_REG_EXP_STR) {\n return -1;\n }\n return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;\n}\nvar Node = class _Node {\n #index;\n #varIndex;\n #children = /* @__PURE__ */ Object.create(null);\n insert(tokens, index, paramMap, context, pathErrorCheckOnly) {\n if (tokens.length === 0) {\n if (this.#index !== void 0) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n this.#index = index;\n return;\n }\n const [token, ...restTokens] = tokens;\n const pattern = token === \"*\" ? restTokens.length === 0 ? [\"\", \"\", ONLY_WILDCARD_REG_EXP_STR] : [\"\", \"\", LABEL_REG_EXP_STR] : token === \"/*\" ? [\"\", \"\", TAIL_WILDCARD_REG_EXP_STR] : token.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);\n let node;\n if (pattern) {\n const name = pattern[1];\n let regexpStr = pattern[2] || LABEL_REG_EXP_STR;\n if (name && pattern[2]) {\n if (regexpStr === \".*\") {\n throw PATH_ERROR;\n }\n regexpStr = regexpStr.replace(/^\\((?!\\?:)(?=[^)]+\\)$)/, \"(?:\");\n if (/\\((?!\\?:)/.test(regexpStr)) {\n throw PATH_ERROR;\n }\n }\n node = this.#children[regexpStr];\n if (!node) {\n if (Object.keys(this.#children).some(\n (k) => k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR\n )) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n node = this.#children[regexpStr] = new _Node();\n if (name !== \"\") {\n node.#varIndex = context.varIndex++;\n }\n }\n if (!pathErrorCheckOnly && name !== \"\") {\n paramMap.push([name, node.#varIndex]);\n }\n } else {\n node = this.#children[token];\n if (!node) {\n if (Object.keys(this.#children).some(\n (k) => k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR\n )) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n node = this.#children[token] = new _Node();\n }\n }\n node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);\n }\n buildRegExpStr() {\n const childKeys = Object.keys(this.#children).sort(compareKey);\n const strList = childKeys.map((k) => {\n const c = this.#children[k];\n return (typeof c.#varIndex === \"number\" ? `(${k})@${c.#varIndex}` : regExpMetaChars.has(k) ? `\\\\${k}` : k) + c.buildRegExpStr();\n });\n if (typeof this.#index === \"number\") {\n strList.unshift(`#${this.#index}`);\n }\n if (strList.length === 0) {\n return \"\";\n }\n if (strList.length === 1) {\n return strList[0];\n }\n return \"(?:\" + strList.join(\"|\") + \")\";\n }\n};\nexport {\n Node,\n PATH_ERROR\n};\n", "// src/router/reg-exp-router/trie.ts\nimport { Node } from \"./node.js\";\nvar Trie = class {\n #context = { varIndex: 0 };\n #root = new Node();\n insert(path, index, pathErrorCheckOnly) {\n const paramAssoc = [];\n const groups = [];\n for (let i = 0; ; ) {\n let replaced = false;\n path = path.replace(/\\{[^}]+\\}/g, (m) => {\n const mark = `@\\\\${i}`;\n groups[i] = [mark, m];\n i++;\n replaced = true;\n return mark;\n });\n if (!replaced) {\n break;\n }\n }\n const tokens = path.match(/(?::[^\\/]+)|(?:\\/\\*$)|./g) || [];\n for (let i = groups.length - 1; i >= 0; i--) {\n const [mark] = groups[i];\n for (let j = tokens.length - 1; j >= 0; j--) {\n if (tokens[j].indexOf(mark) !== -1) {\n tokens[j] = tokens[j].replace(mark, groups[i][1]);\n break;\n }\n }\n }\n this.#root.insert(tokens, index, paramAssoc, this.#context, pathErrorCheckOnly);\n return paramAssoc;\n }\n buildRegExp() {\n let regexp = this.#root.buildRegExpStr();\n if (regexp === \"\") {\n return [/^$/, [], []];\n }\n let captureIndex = 0;\n const indexReplacementMap = [];\n const paramReplacementMap = [];\n regexp = regexp.replace(/#(\\d+)|@(\\d+)|\\.\\*\\$/g, (_, handlerIndex, paramIndex) => {\n if (handlerIndex !== void 0) {\n indexReplacementMap[++captureIndex] = Number(handlerIndex);\n return \"$()\";\n }\n if (paramIndex !== void 0) {\n paramReplacementMap[Number(paramIndex)] = ++captureIndex;\n return \"\";\n }\n return \"\";\n });\n return [new RegExp(`^${regexp}`), indexReplacementMap, paramReplacementMap];\n }\n};\nexport {\n Trie\n};\n", "// src/router/reg-exp-router/router.ts\nimport {\n MESSAGE_MATCHER_IS_ALREADY_BUILT,\n METHOD_NAME_ALL,\n UnsupportedPathError\n} from \"../../router.js\";\nimport { checkOptionalParameter } from \"../../utils/url.js\";\nimport { match, emptyParam } from \"./matcher.js\";\nimport { PATH_ERROR } from \"./node.js\";\nimport { Trie } from \"./trie.js\";\nvar nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];\nvar wildcardRegExpCache = /* @__PURE__ */ Object.create(null);\nfunction buildWildcardRegExp(path) {\n return wildcardRegExpCache[path] ??= new RegExp(\n path === \"*\" ? \"\" : `^${path.replace(\n /\\/\\*$|([.\\\\+*[^\\]$()])/g,\n (_, metaChar) => metaChar ? `\\\\${metaChar}` : \"(?:|/.*)\"\n )}$`\n );\n}\nfunction clearWildcardRegExpCache() {\n wildcardRegExpCache = /* @__PURE__ */ Object.create(null);\n}\nfunction buildMatcherFromPreprocessedRoutes(routes) {\n const trie = new Trie();\n const handlerData = [];\n if (routes.length === 0) {\n return nullMatcher;\n }\n const routesWithStaticPathFlag = routes.map(\n (route) => [!/\\*|\\/:/.test(route[0]), ...route]\n ).sort(\n ([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length\n );\n const staticMap = /* @__PURE__ */ Object.create(null);\n for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {\n const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];\n if (pathErrorCheckOnly) {\n staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];\n } else {\n j++;\n }\n let paramAssoc;\n try {\n paramAssoc = trie.insert(path, j, pathErrorCheckOnly);\n } catch (e) {\n throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;\n }\n if (pathErrorCheckOnly) {\n continue;\n }\n handlerData[j] = handlers.map(([h, paramCount]) => {\n const paramIndexMap = /* @__PURE__ */ Object.create(null);\n paramCount -= 1;\n for (; paramCount >= 0; paramCount--) {\n const [key, value] = paramAssoc[paramCount];\n paramIndexMap[key] = value;\n }\n return [h, paramIndexMap];\n });\n }\n const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();\n for (let i = 0, len = handlerData.length; i < len; i++) {\n for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {\n const map = handlerData[i][j]?.[1];\n if (!map) {\n continue;\n }\n const keys = Object.keys(map);\n for (let k = 0, len3 = keys.length; k < len3; k++) {\n map[keys[k]] = paramReplacementMap[map[keys[k]]];\n }\n }\n }\n const handlerMap = [];\n for (const i in indexReplacementMap) {\n handlerMap[i] = handlerData[indexReplacementMap[i]];\n }\n return [regexp, handlerMap, staticMap];\n}\nfunction findMiddleware(middleware, path) {\n if (!middleware) {\n return void 0;\n }\n for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {\n if (buildWildcardRegExp(k).test(path)) {\n return [...middleware[k]];\n }\n }\n return void 0;\n}\nvar RegExpRouter = class {\n name = \"RegExpRouter\";\n #middleware;\n #routes;\n constructor() {\n this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };\n this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };\n }\n add(method, path, handler) {\n const middleware = this.#middleware;\n const routes = this.#routes;\n if (!middleware || !routes) {\n throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);\n }\n if (!middleware[method]) {\n ;\n [middleware, routes].forEach((handlerMap) => {\n handlerMap[method] = /* @__PURE__ */ Object.create(null);\n Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => {\n handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];\n });\n });\n }\n if (path === \"/*\") {\n path = \"*\";\n }\n const paramCount = (path.match(/\\/:/g) || []).length;\n if (/\\*$/.test(path)) {\n const re = buildWildcardRegExp(path);\n if (method === METHOD_NAME_ALL) {\n Object.keys(middleware).forEach((m) => {\n middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];\n });\n } else {\n middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];\n }\n Object.keys(middleware).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n Object.keys(middleware[m]).forEach((p) => {\n re.test(p) && middleware[m][p].push([handler, paramCount]);\n });\n }\n });\n Object.keys(routes).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n Object.keys(routes[m]).forEach(\n (p) => re.test(p) && routes[m][p].push([handler, paramCount])\n );\n }\n });\n return;\n }\n const paths = checkOptionalParameter(path) || [path];\n for (let i = 0, len = paths.length; i < len; i++) {\n const path2 = paths[i];\n Object.keys(routes).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n routes[m][path2] ||= [\n ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []\n ];\n routes[m][path2].push([handler, paramCount - len + i + 1]);\n }\n });\n }\n }\n match = match;\n buildAllMatchers() {\n const matchers = /* @__PURE__ */ Object.create(null);\n Object.keys(this.#routes).concat(Object.keys(this.#middleware)).forEach((method) => {\n matchers[method] ||= this.#buildMatcher(method);\n });\n this.#middleware = this.#routes = void 0;\n clearWildcardRegExpCache();\n return matchers;\n }\n #buildMatcher(method) {\n const routes = [];\n let hasOwnRoute = method === METHOD_NAME_ALL;\n [this.#middleware, this.#routes].forEach((r) => {\n const ownRoute = r[method] ? Object.keys(r[method]).map((path) => [path, r[method][path]]) : [];\n if (ownRoute.length !== 0) {\n hasOwnRoute ||= true;\n routes.push(...ownRoute);\n } else if (method !== METHOD_NAME_ALL) {\n routes.push(\n ...Object.keys(r[METHOD_NAME_ALL]).map((path) => [path, r[METHOD_NAME_ALL][path]])\n );\n }\n });\n if (!hasOwnRoute) {\n return null;\n } else {\n return buildMatcherFromPreprocessedRoutes(routes);\n }\n }\n};\nexport {\n RegExpRouter\n};\n", "// src/router/smart-router/router.ts\nimport { MESSAGE_MATCHER_IS_ALREADY_BUILT, UnsupportedPathError } from \"../../router.js\";\nvar SmartRouter = class {\n name = \"SmartRouter\";\n #routers = [];\n #routes = [];\n constructor(init) {\n this.#routers = init.routers;\n }\n add(method, path, handler) {\n if (!this.#routes) {\n throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);\n }\n this.#routes.push([method, path, handler]);\n }\n match(method, path) {\n if (!this.#routes) {\n throw new Error(\"Fatal error\");\n }\n const routers = this.#routers;\n const routes = this.#routes;\n const len = routers.length;\n let i = 0;\n let res;\n for (; i < len; i++) {\n const router = routers[i];\n try {\n for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {\n router.add(...routes[i2]);\n }\n res = router.match(method, path);\n } catch (e) {\n if (e instanceof UnsupportedPathError) {\n continue;\n }\n throw e;\n }\n this.match = router.match.bind(router);\n this.#routers = [router];\n this.#routes = void 0;\n break;\n }\n if (i === len) {\n throw new Error(\"Fatal error\");\n }\n this.name = `SmartRouter + ${this.activeRouter.name}`;\n return res;\n }\n get activeRouter() {\n if (this.#routes || this.#routers.length !== 1) {\n throw new Error(\"No active router has been determined yet.\");\n }\n return this.#routers[0];\n }\n};\nexport {\n SmartRouter\n};\n", "// src/router/trie-router/node.ts\nimport { METHOD_NAME_ALL } from \"../../router.js\";\nimport { getPattern, splitPath, splitRoutingPath } from \"../../utils/url.js\";\nvar emptyParams = /* @__PURE__ */ Object.create(null);\nvar hasChildren = (children) => {\n for (const _ in children) {\n return true;\n }\n return false;\n};\nvar Node = class _Node {\n #methods;\n #children;\n #patterns;\n #order = 0;\n #params = emptyParams;\n constructor(method, handler, children) {\n this.#children = children || /* @__PURE__ */ Object.create(null);\n this.#methods = [];\n if (method && handler) {\n const m = /* @__PURE__ */ Object.create(null);\n m[method] = { handler, possibleKeys: [], score: 0 };\n this.#methods = [m];\n }\n this.#patterns = [];\n }\n insert(method, path, handler) {\n this.#order = ++this.#order;\n let curNode = this;\n const parts = splitRoutingPath(path);\n const possibleKeys = [];\n for (let i = 0, len = parts.length; i < len; i++) {\n const p = parts[i];\n const nextP = parts[i + 1];\n const pattern = getPattern(p, nextP);\n const key = Array.isArray(pattern) ? pattern[0] : p;\n if (key in curNode.#children) {\n curNode = curNode.#children[key];\n if (pattern) {\n possibleKeys.push(pattern[1]);\n }\n continue;\n }\n curNode.#children[key] = new _Node();\n if (pattern) {\n curNode.#patterns.push(pattern);\n possibleKeys.push(pattern[1]);\n }\n curNode = curNode.#children[key];\n }\n curNode.#methods.push({\n [method]: {\n handler,\n possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),\n score: this.#order\n }\n });\n return curNode;\n }\n #pushHandlerSets(handlerSets, node, method, nodeParams, params) {\n for (let i = 0, len = node.#methods.length; i < len; i++) {\n const m = node.#methods[i];\n const handlerSet = m[method] || m[METHOD_NAME_ALL];\n const processedSet = {};\n if (handlerSet !== void 0) {\n handlerSet.params = /* @__PURE__ */ Object.create(null);\n handlerSets.push(handlerSet);\n if (nodeParams !== emptyParams || params && params !== emptyParams) {\n for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {\n const key = handlerSet.possibleKeys[i2];\n const processed = processedSet[handlerSet.score];\n handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];\n processedSet[handlerSet.score] = true;\n }\n }\n }\n }\n }\n search(method, path) {\n const handlerSets = [];\n this.#params = emptyParams;\n const curNode = this;\n let curNodes = [curNode];\n const parts = splitPath(path);\n const curNodesQueue = [];\n const len = parts.length;\n let partOffsets = null;\n for (let i = 0; i < len; i++) {\n const part = parts[i];\n const isLast = i === len - 1;\n const tempNodes = [];\n for (let j = 0, len2 = curNodes.length; j < len2; j++) {\n const node = curNodes[j];\n const nextNode = node.#children[part];\n if (nextNode) {\n nextNode.#params = node.#params;\n if (isLast) {\n if (nextNode.#children[\"*\"]) {\n this.#pushHandlerSets(handlerSets, nextNode.#children[\"*\"], method, node.#params);\n }\n this.#pushHandlerSets(handlerSets, nextNode, method, node.#params);\n } else {\n tempNodes.push(nextNode);\n }\n }\n for (let k = 0, len3 = node.#patterns.length; k < len3; k++) {\n const pattern = node.#patterns[k];\n const params = node.#params === emptyParams ? {} : { ...node.#params };\n if (pattern === \"*\") {\n const astNode = node.#children[\"*\"];\n if (astNode) {\n this.#pushHandlerSets(handlerSets, astNode, method, node.#params);\n astNode.#params = params;\n tempNodes.push(astNode);\n }\n continue;\n }\n const [key, name, matcher] = pattern;\n if (!part && !(matcher instanceof RegExp)) {\n continue;\n }\n const child = node.#children[key];\n if (matcher instanceof RegExp) {\n if (partOffsets === null) {\n partOffsets = new Array(len);\n let offset = path[0] === \"/\" ? 1 : 0;\n for (let p = 0; p < len; p++) {\n partOffsets[p] = offset;\n offset += parts[p].length + 1;\n }\n }\n const restPathString = path.substring(partOffsets[i]);\n const m = matcher.exec(restPathString);\n if (m) {\n params[name] = m[0];\n this.#pushHandlerSets(handlerSets, child, method, node.#params, params);\n if (m[0].length === restPathString.length && child.#children[\"*\"]) {\n this.#pushHandlerSets(\n handlerSets,\n child.#children[\"*\"],\n method,\n node.#params,\n params\n );\n }\n if (hasChildren(child.#children)) {\n child.#params = params;\n const componentCount = m[0].match(/\\//)?.length ?? 0;\n const targetCurNodes = curNodesQueue[componentCount] ||= [];\n targetCurNodes.push(child);\n }\n continue;\n }\n }\n if (matcher === true || matcher.test(part)) {\n params[name] = part;\n if (isLast) {\n this.#pushHandlerSets(handlerSets, child, method, params, node.#params);\n if (child.#children[\"*\"]) {\n this.#pushHandlerSets(\n handlerSets,\n child.#children[\"*\"],\n method,\n params,\n node.#params\n );\n }\n } else {\n child.#params = params;\n tempNodes.push(child);\n }\n }\n }\n }\n const shifted = curNodesQueue.shift();\n curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;\n }\n if (handlerSets.length > 1) {\n handlerSets.sort((a, b) => {\n return a.score - b.score;\n });\n }\n return [handlerSets.map(({ handler, params }) => [handler, params])];\n }\n};\nexport {\n Node\n};\n", "// src/router/trie-router/router.ts\nimport { checkOptionalParameter } from \"../../utils/url.js\";\nimport { Node } from \"./node.js\";\nvar TrieRouter = class {\n name = \"TrieRouter\";\n #node;\n constructor() {\n this.#node = new Node();\n }\n add(method, path, handler) {\n const results = checkOptionalParameter(path);\n if (results) {\n for (let i = 0, len = results.length; i < len; i++) {\n this.#node.insert(method, results[i], handler);\n }\n return;\n }\n this.#node.insert(method, path, handler);\n }\n match(method, path) {\n return this.#node.search(method, path);\n }\n};\nexport {\n TrieRouter\n};\n", "// src/hono.ts\nimport { HonoBase } from \"./hono-base.js\";\nimport { RegExpRouter } from \"./router/reg-exp-router/index.js\";\nimport { SmartRouter } from \"./router/smart-router/index.js\";\nimport { TrieRouter } from \"./router/trie-router/index.js\";\nvar Hono = class extends HonoBase {\n /**\n * Creates an instance of the Hono class.\n *\n * @param options - Optional configuration options for the Hono instance.\n */\n constructor(options = {}) {\n super(options);\n this.router = options.router ?? new SmartRouter({\n routers: [new RegExpRouter(), new TrieRouter()]\n });\n }\n};\nexport {\n Hono\n};\n", "import {\n DEFAULT_ROLLOUT_COHORT_COUNT,\n getAssetBaseStorageUri,\n getBundlePatches,\n getManifestFileHash,\n getManifestStorageUri,\n NIL_UUID,\n stripBundleArtifactMetadata,\n} from \"@hot-updater/core\";\nimport type {\n Bundle,\n DatabaseBundleQueryWhere,\n HotUpdaterContext,\n PaginationOptions,\n RequestEnvContext,\n} from \"@hot-updater/plugin-core\";\nimport {\n calculatePagination,\n createDatabasePlugin,\n filterCompatibleAppVersions,\n resolveUpdateInfoFromBundles,\n} from \"@hot-updater/plugin-core\";\n\ntype D1Result<T> = {\n results?: T[];\n};\n\ntype D1PreparedStatement = {\n bind: (...values: unknown[]) => {\n all: <T>() => Promise<D1Result<T>>;\n first: <T>() => Promise<T | null>;\n run: () => Promise<unknown>;\n };\n};\n\ntype D1Like = {\n prepare: (sql: string) => D1PreparedStatement;\n};\n\nexport interface CloudflareWorkerDatabaseEnv {\n DB: D1Like;\n}\n\ninterface CloudflareWorkerDatabaseConfig<\n TContext extends RequestEnvContext<CloudflareWorkerDatabaseEnv>,\n> {\n getDb: (context?: HotUpdaterContext<TContext>) => D1Like;\n}\n\ntype QueryConditions = DatabaseBundleQueryWhere;\n\ninterface BuildQueryResult {\n sql: string;\n params: unknown[];\n}\n\nconst buildJsonEachInClause = (\n columnName: string,\n values: string[],\n params: unknown[],\n) => {\n if (values.length === 0) {\n return \"1 = 0\";\n }\n\n params.push(JSON.stringify(values));\n return `${columnName} IN (SELECT value FROM json_each(?))`;\n};\n\ninterface D1WorkerBundleRow {\n id: string;\n channel: string;\n enabled: number | boolean;\n should_force_update: number | boolean;\n file_hash: string;\n git_commit_hash: string | null;\n message: string | null;\n platform: \"ios\" | \"android\";\n target_app_version: string | null;\n storage_uri: string;\n fingerprint_hash: string | null;\n metadata: unknown;\n manifest_storage_uri?: string | null;\n manifest_file_hash?: string | null;\n asset_base_storage_uri?: string | null;\n rollout_cohort_count: number | null;\n target_cohorts: string | null;\n}\n\ninterface D1WorkerBundlePatchRow {\n id: string;\n bundle_id: string;\n base_bundle_id: string;\n base_file_hash: string;\n patch_file_hash: string;\n patch_storage_uri: string;\n order_index: number | null;\n}\n\nfunction buildWhereClause(\n conditions: QueryConditions | undefined,\n): BuildQueryResult {\n if (!conditions) {\n return { sql: \"\", params: [] };\n }\n\n const clauses: string[] = [];\n const params: unknown[] = [];\n\n if (conditions.channel) {\n clauses.push(\"channel = ?\");\n params.push(conditions.channel);\n }\n\n if (conditions.platform) {\n clauses.push(\"platform = ?\");\n params.push(conditions.platform);\n }\n\n if (conditions.enabled !== undefined) {\n clauses.push(\"enabled = ?\");\n params.push(conditions.enabled ? 1 : 0);\n }\n\n if (conditions.id?.in) {\n clauses.push(buildJsonEachInClause(\"id\", conditions.id.in, params));\n }\n\n if (conditions.id?.eq) {\n clauses.push(\"id = ?\");\n params.push(conditions.id.eq);\n }\n\n if (conditions.id?.gt) {\n clauses.push(\"id > ?\");\n params.push(conditions.id.gt);\n }\n\n if (conditions.id?.gte) {\n clauses.push(\"id >= ?\");\n params.push(conditions.id.gte);\n }\n\n if (conditions.id?.lt) {\n clauses.push(\"id < ?\");\n params.push(conditions.id.lt);\n }\n\n if (conditions.id?.lte) {\n clauses.push(\"id <= ?\");\n params.push(conditions.id.lte);\n }\n\n if (conditions.targetAppVersionNotNull) {\n clauses.push(\"target_app_version IS NOT NULL\");\n }\n\n if (conditions.targetAppVersion !== undefined) {\n if (conditions.targetAppVersion === null) {\n clauses.push(\"target_app_version IS NULL\");\n } else {\n clauses.push(\"target_app_version = ?\");\n params.push(conditions.targetAppVersion);\n }\n }\n\n if (conditions.targetAppVersionIn) {\n clauses.push(\n buildJsonEachInClause(\n \"target_app_version\",\n conditions.targetAppVersionIn,\n params,\n ),\n );\n }\n\n if (conditions.fingerprintHash !== undefined) {\n if (conditions.fingerprintHash === null) {\n clauses.push(\"fingerprint_hash IS NULL\");\n } else {\n clauses.push(\"fingerprint_hash = ?\");\n params.push(conditions.fingerprintHash);\n }\n }\n\n const whereClause =\n clauses.length > 0 ? ` WHERE ${clauses.join(\" AND \")}` : \"\";\n\n return { sql: whereClause, params };\n}\n\nfunction parseTargetCohorts(value: unknown): string[] | null {\n if (!value) return null;\n if (Array.isArray(value)) {\n return value.filter((item): item is string => typeof item === \"string\");\n }\n if (typeof value === \"string\") {\n try {\n const parsed = JSON.parse(value) as unknown;\n if (Array.isArray(parsed)) {\n return parsed.filter(\n (item): item is string => typeof item === \"string\",\n );\n }\n } catch {\n return null;\n }\n }\n return null;\n}\n\nconst parseMetadata = (value: unknown): Bundle[\"metadata\"] => {\n if (!value) return undefined;\n if (typeof value === \"string\") {\n try {\n return parseMetadata(JSON.parse(value) as unknown);\n } catch {\n return undefined;\n }\n }\n return typeof value === \"object\" && !Array.isArray(value)\n ? (value as Bundle[\"metadata\"])\n : undefined;\n};\n\nconst buildBundlePatchId = (bundleId: string, baseBundleId: string) =>\n `${bundleId}:${baseBundleId}`;\n\nconst bundleToPatchRows = (bundle: Bundle): D1WorkerBundlePatchRow[] =>\n getBundlePatches(bundle).map((patch, index) => ({\n id: buildBundlePatchId(bundle.id, patch.baseBundleId),\n bundle_id: bundle.id,\n base_bundle_id: patch.baseBundleId,\n base_file_hash: patch.baseFileHash,\n patch_file_hash: patch.patchFileHash,\n patch_storage_uri: patch.patchStorageUri,\n order_index: index,\n }));\n\nfunction transformRowToBundle(\n row: D1WorkerBundleRow,\n patchRows: D1WorkerBundlePatchRow[] = [],\n): Bundle {\n const rawMetadata = parseMetadata(row.metadata);\n const patches = patchRows\n .slice()\n .sort(\n (left, right) =>\n (left.order_index ?? 0) - (right.order_index ?? 0) ||\n left.base_bundle_id.localeCompare(right.base_bundle_id),\n )\n .map((patch) => ({\n baseBundleId: patch.base_bundle_id,\n baseFileHash: patch.base_file_hash,\n patchFileHash: patch.patch_file_hash,\n patchStorageUri: patch.patch_storage_uri,\n }));\n const primaryPatch = patches[0] ?? null;\n\n return {\n id: row.id,\n channel: row.channel,\n enabled: Boolean(row.enabled),\n shouldForceUpdate: Boolean(row.should_force_update),\n fileHash: row.file_hash,\n gitCommitHash: row.git_commit_hash,\n message: row.message,\n platform: row.platform,\n targetAppVersion: row.target_app_version,\n storageUri: row.storage_uri,\n fingerprintHash: row.fingerprint_hash,\n metadata: stripBundleArtifactMetadata(rawMetadata),\n manifestStorageUri: row.manifest_storage_uri ?? null,\n manifestFileHash: row.manifest_file_hash ?? null,\n assetBaseStorageUri: row.asset_base_storage_uri ?? null,\n patches,\n patchBaseBundleId: primaryPatch?.baseBundleId ?? null,\n patchBaseFileHash: primaryPatch?.baseFileHash ?? null,\n patchFileHash: primaryPatch?.patchFileHash ?? null,\n patchStorageUri: primaryPatch?.patchStorageUri ?? null,\n rolloutCohortCount:\n (row.rollout_cohort_count as number | null) ??\n DEFAULT_ROLLOUT_COHORT_COUNT,\n targetCohorts: parseTargetCohorts(row.target_cohorts as unknown),\n };\n}\n\nconst resolveDbFromContext = (\n context?: RequestEnvContext<CloudflareWorkerDatabaseEnv>,\n) => {\n const db = context?.env?.DB;\n\n if (!db) {\n throw new Error(\n \"d1WorkerDatabase requires env.DB in the hot updater context.\",\n );\n }\n\n return db;\n};\n\nexport const d1WorkerDatabase = <\n TContext extends RequestEnvContext<CloudflareWorkerDatabaseEnv> =\n RequestEnvContext<CloudflareWorkerDatabaseEnv>,\n>() =>\n createDatabasePlugin<CloudflareWorkerDatabaseConfig<TContext>, TContext>({\n name: \"d1WorkerDatabase\",\n factory: (config) => {\n const queryAll = async <TRow>(\n sql: string,\n params: unknown[] = [],\n context?: HotUpdaterContext<TContext>,\n ): Promise<TRow[]> => {\n const result = await config\n .getDb(context)\n .prepare(sql)\n .bind(...params)\n .all<TRow>();\n return result.results ?? [];\n };\n\n const queryFirst = async <TRow>(\n sql: string,\n params: unknown[] = [],\n context?: HotUpdaterContext<TContext>,\n ): Promise<TRow | null> => {\n const result = await config\n .getDb(context)\n .prepare(sql)\n .bind(...params)\n .first<TRow>();\n return result ?? null;\n };\n\n const getPatchMap = async (\n bundleIds: string[],\n context?: HotUpdaterContext<TContext>,\n ) => {\n const patchMap = new Map<string, D1WorkerBundlePatchRow[]>();\n\n if (bundleIds.length === 0) {\n return patchMap;\n }\n\n const rows = await queryAll<D1WorkerBundlePatchRow>(\n `\n SELECT *\n FROM bundle_patches\n WHERE bundle_id IN (SELECT value FROM json_each(?))\n ORDER BY order_index ASC, base_bundle_id ASC\n `,\n [JSON.stringify(bundleIds)],\n context,\n );\n\n for (const row of rows) {\n const current = patchMap.get(row.bundle_id) ?? [];\n current.push(row);\n patchMap.set(row.bundle_id, current);\n }\n\n return patchMap;\n };\n\n const queryBundlesForUpdateInfo = async (\n conditions: QueryConditions,\n context?: HotUpdaterContext<TContext>,\n ): Promise<Bundle[]> => {\n const { sql: whereClause, params } = buildWhereClause(conditions);\n const rows = await queryAll<D1WorkerBundleRow>(\n `\n SELECT * FROM bundles\n ${whereClause}\n `,\n params,\n context,\n );\n const patchMap = await getPatchMap(\n rows.map((row) => row.id),\n context,\n );\n\n return rows.map((row) =>\n transformRowToBundle(row, patchMap.get(row.id)),\n );\n };\n\n const getTargetAppVersionsForUpdateInfo = async (\n {\n platform,\n channel,\n minBundleId,\n }: {\n platform: Bundle[\"platform\"];\n channel: string;\n minBundleId: string;\n },\n context?: HotUpdaterContext<TContext>,\n ): Promise<string[]> => {\n const rows = await queryAll<{ target_app_version: string }>(\n `\n SELECT target_app_version\n FROM bundles\n WHERE channel = ?\n AND platform = ?\n AND enabled = 1\n AND id >= ?\n AND target_app_version IS NOT NULL\n GROUP BY target_app_version\n `,\n [channel, platform, minBundleId],\n context,\n );\n\n return rows.map((row) => row.target_app_version);\n };\n\n return {\n async getUpdateInfo(args, context) {\n const channel = args.channel ?? \"production\";\n const minBundleId = args.minBundleId ?? NIL_UUID;\n\n if (args._updateStrategy === \"appVersion\") {\n const targetAppVersions = await getTargetAppVersionsForUpdateInfo(\n {\n platform: args.platform,\n channel,\n minBundleId,\n },\n context,\n );\n const compatibleAppVersions = filterCompatibleAppVersions(\n targetAppVersions,\n args.appVersion,\n );\n const bundles =\n compatibleAppVersions.length > 0\n ? await queryBundlesForUpdateInfo(\n {\n enabled: true,\n platform: args.platform,\n channel,\n id: {\n gte: minBundleId,\n },\n targetAppVersionIn: compatibleAppVersions,\n },\n context,\n )\n : [];\n\n return resolveUpdateInfoFromBundles({\n args: { ...args, channel, minBundleId },\n bundles,\n context,\n });\n }\n\n const bundles = await queryBundlesForUpdateInfo(\n {\n enabled: true,\n platform: args.platform,\n channel,\n id: {\n gte: minBundleId,\n },\n fingerprintHash: args.fingerprintHash,\n },\n context,\n );\n\n return resolveUpdateInfoFromBundles({\n args: { ...args, channel, minBundleId },\n bundles,\n context,\n });\n },\n\n async getBundleById(bundleId, context) {\n const [row, patchMap] = await Promise.all([\n queryFirst<D1WorkerBundleRow>(\n \"SELECT * FROM bundles WHERE id = ? LIMIT 1\",\n [bundleId],\n context,\n ),\n getPatchMap([bundleId], context),\n ]);\n\n return row ? transformRowToBundle(row, patchMap.get(bundleId)) : null;\n },\n\n async getBundles(options, context) {\n const { where, limit, orderBy } = options;\n const offset =\n ((\"offset\" in options ? options.offset : undefined) as\n | number\n | undefined) ?? 0;\n const { sql: whereClause, params } = buildWhereClause(where);\n const orderSql =\n orderBy?.direction === \"asc\"\n ? \"ORDER BY id ASC\"\n : \"ORDER BY id DESC\";\n\n const countRows = await queryAll<{ total: number }>(\n `SELECT COUNT(*) as total FROM bundles${whereClause}`,\n params,\n context,\n );\n const total = countRows[0]?.total ?? 0;\n\n const rows = await queryAll<D1WorkerBundleRow>(\n `SELECT * FROM bundles${whereClause} ${orderSql} LIMIT ? OFFSET ?`,\n [...params, limit, offset],\n context,\n );\n\n const patchMap = await getPatchMap(\n rows.map((row) => row.id),\n context,\n );\n const bundles = rows.map((row) =>\n transformRowToBundle(row, patchMap.get(row.id)),\n );\n\n const paginationOptions: PaginationOptions = { limit, offset };\n return {\n data: bundles,\n pagination: calculatePagination(total, paginationOptions),\n };\n },\n\n async getChannels(context) {\n const rows = await queryAll<{ channel: string }>(\n \"SELECT channel FROM bundles GROUP BY channel\",\n [],\n context,\n );\n return rows.map((row) => row.channel);\n },\n\n async commitBundle({ changedSets }, context) {\n if (changedSets.length === 0) {\n return;\n }\n\n const db = config.getDb(context);\n\n for (const operation of changedSets) {\n if (operation.operation === \"delete\") {\n await db\n .prepare(\"DELETE FROM bundle_patches WHERE bundle_id = ?\")\n .bind(operation.data.id)\n .run();\n await db\n .prepare(\"DELETE FROM bundle_patches WHERE base_bundle_id = ?\")\n .bind(operation.data.id)\n .run();\n await db\n .prepare(\"DELETE FROM bundles WHERE id = ?\")\n .bind(operation.data.id)\n .run();\n continue;\n }\n\n const bundle = operation.data;\n await db\n .prepare(`\n INSERT OR REPLACE INTO bundles (\n id,\n channel,\n enabled,\n should_force_update,\n file_hash,\n git_commit_hash,\n message,\n platform,\n target_app_version,\n storage_uri,\n fingerprint_hash,\n metadata,\n manifest_storage_uri,\n manifest_file_hash,\n asset_base_storage_uri,\n rollout_cohort_count,\n target_cohorts\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n `)\n .bind(\n bundle.id,\n bundle.channel,\n bundle.enabled ? 1 : 0,\n bundle.shouldForceUpdate ? 1 : 0,\n bundle.fileHash,\n bundle.gitCommitHash || null,\n bundle.message || null,\n bundle.platform,\n bundle.targetAppVersion,\n bundle.storageUri,\n bundle.fingerprintHash,\n JSON.stringify(\n stripBundleArtifactMetadata(bundle.metadata) ?? {},\n ),\n getManifestStorageUri(bundle),\n getManifestFileHash(bundle),\n getAssetBaseStorageUri(bundle),\n bundle.rolloutCohortCount ?? DEFAULT_ROLLOUT_COHORT_COUNT,\n bundle.targetCohorts\n ? JSON.stringify(bundle.targetCohorts)\n : null,\n )\n .run();\n\n await db\n .prepare(\"DELETE FROM bundle_patches WHERE bundle_id = ?\")\n .bind(bundle.id)\n .run();\n\n const patchRows = bundleToPatchRows(bundle);\n for (const patchRow of patchRows) {\n await db\n .prepare(`\n INSERT OR REPLACE INTO bundle_patches (\n id,\n bundle_id,\n base_bundle_id,\n base_file_hash,\n patch_file_hash,\n patch_storage_uri,\n order_index\n )\n VALUES (?, ?, ?, ?, ?, ?, ?)\n `)\n .bind(\n patchRow.id,\n patchRow.bundle_id,\n patchRow.base_bundle_id,\n patchRow.base_file_hash,\n patchRow.patch_file_hash,\n patchRow.patch_storage_uri,\n patchRow.order_index ?? 0,\n )\n .run();\n }\n }\n },\n };\n },\n })({\n getDb: resolveDbFromContext,\n });\n", "import { signToken } from \"@hot-updater/js\";\nimport {\n createRuntimeStoragePlugin,\n decodeStorageObjectKey,\n type HotUpdaterContext,\n type RequestEnvContext,\n} from \"@hot-updater/plugin-core\";\n\nexport interface CloudflareWorkerStorageEnv {\n JWT_SECRET: string;\n BUCKET: {\n get: (key: string) => Promise<{ text: () => Promise<string> } | null>;\n };\n}\n\ntype ContextResolver<TContext, TValue> = (\n context?: HotUpdaterContext<TContext>,\n) => TValue | Promise<TValue>;\n\nexport interface CloudflareWorkerStorageConfig<\n TContext extends RequestEnvContext<CloudflareWorkerStorageEnv>,\n> {\n jwtSecret?: string | ContextResolver<TContext, string>;\n publicBaseUrl: string | ContextResolver<TContext, string>;\n}\n\nconst resolveContextValue = async <TContext, TValue>(\n value: TValue | ContextResolver<TContext, TValue>,\n context?: HotUpdaterContext<TContext>,\n) => {\n return typeof value === \"function\"\n ? await (value as ContextResolver<TContext, TValue>)(context)\n : value;\n};\n\nconst resolveJwtSecretFromContext = (\n context?: RequestEnvContext<CloudflareWorkerStorageEnv>,\n) => {\n const jwtSecret = context?.env?.JWT_SECRET;\n\n if (!jwtSecret) {\n throw new Error(\n \"r2WorkerStorage requires env.JWT_SECRET in the hot updater context.\",\n );\n }\n\n return jwtSecret;\n};\n\nconst resolveR2BucketFromContext = (\n context?: RequestEnvContext<CloudflareWorkerStorageEnv>,\n) => {\n const bucket = context?.env?.BUCKET;\n\n if (!bucket) {\n throw new Error(\n \"r2WorkerStorage requires env.BUCKET in the hot updater context.\",\n );\n }\n\n return bucket;\n};\n\nconst createPublicObjectPath = (storageUrl: URL) =>\n `${storageUrl.host}${storageUrl.pathname}`;\n\nconst createR2ObjectKey = (storageUrl: URL) =>\n decodeStorageObjectKey(storageUrl.pathname.replace(/^\\/+/, \"\"));\n\nexport const r2WorkerStorage = <\n TContext extends RequestEnvContext<CloudflareWorkerStorageEnv> =\n RequestEnvContext<CloudflareWorkerStorageEnv>,\n>(\n config: CloudflareWorkerStorageConfig<TContext>,\n) => {\n return createRuntimeStoragePlugin<\n CloudflareWorkerStorageConfig<TContext>,\n TContext\n >({\n name: \"r2WorkerStorage\",\n supportedProtocol: \"r2\",\n factory: (config) => ({\n async readText(storageUri, context) {\n const storageUrl = new URL(storageUri);\n\n if (storageUrl.protocol !== \"r2:\") {\n throw new Error(\"Invalid R2 storage URI protocol\");\n }\n\n const bucket = resolveR2BucketFromContext(context);\n const key = createR2ObjectKey(storageUrl);\n const object = await bucket.get(key);\n if (!object) {\n return null;\n }\n\n return object.text();\n },\n async getDownloadUrl(storageUri, context) {\n const storageUrl = new URL(storageUri);\n\n if (storageUrl.protocol !== \"r2:\") {\n throw new Error(\"Invalid R2 storage URI protocol\");\n }\n\n const key = createPublicObjectPath(storageUrl);\n const [jwtSecret, publicBaseUrl] = await Promise.all([\n resolveContextValue(\n config.jwtSecret ?? resolveJwtSecretFromContext,\n context,\n ),\n resolveContextValue(config.publicBaseUrl, context),\n ]);\n const token = await signToken(key, jwtSecret);\n const url = new URL(publicBaseUrl);\n\n url.pathname = key;\n url.search = \"\";\n url.searchParams.set(\"token\", token);\n\n return {\n fileUrl: url.toString(),\n };\n },\n }),\n })(config);\n};\n", "export { verifyJwtSignedUrl } from \"@hot-updater/js\";\n\nimport type { RequestEnvContext as BaseRequestEnvContext } from \"@hot-updater/plugin-core\";\n\nimport {\n type CloudflareWorkerDatabaseEnv,\n d1WorkerDatabase,\n} from \"../cloudflareWorkerDatabase\";\nimport {\n type CloudflareWorkerStorageConfig,\n type CloudflareWorkerStorageEnv,\n r2WorkerStorage,\n} from \"../r2WorkerStorage\";\n\nexport type { CloudflareWorkerDatabaseEnv, CloudflareWorkerStorageEnv };\n\nexport interface CloudflareWorkerRuntimeEnv\n extends CloudflareWorkerDatabaseEnv, CloudflareWorkerStorageEnv {}\n\nexport type RequestEnvContext<TEnv = CloudflareWorkerRuntimeEnv> =\n BaseRequestEnvContext<TEnv>;\n\nexport const d1Database = <\n TContext extends RequestEnvContext<CloudflareWorkerRuntimeEnv> =\n RequestEnvContext<CloudflareWorkerRuntimeEnv>,\n>() => d1WorkerDatabase<TContext>();\n\nexport const r2Storage = <\n TContext extends RequestEnvContext<CloudflareWorkerRuntimeEnv> =\n RequestEnvContext<CloudflareWorkerRuntimeEnv>,\n>(\n config: CloudflareWorkerStorageConfig<TContext>,\n) => r2WorkerStorage<TContext>(config);\n", "import { decodeStorageObjectKey } from \"@hot-updater/plugin-core\";\nimport { createHotUpdater } from \"@hot-updater/server\";\nimport { Hono } from \"hono\";\n\nimport {\n d1Database,\n type RequestEnvContext,\n r2Storage,\n verifyJwtSignedUrl,\n} from \"../../src/worker\";\n\nexport type CloudflareWorkerEnv = {\n DB: {\n prepare: D1Database[\"prepare\"];\n };\n BUCKET: R2Bucket;\n JWT_SECRET: string;\n};\n\nexport const HOT_UPDATER_BASE_PATH = \"/api/check-update\";\n\nconst resolveRequestOrigin = (context?: RequestEnvContext) => {\n const request = context?.request;\n\n if (!request) {\n throw new Error(\n \"r2WorkerStorage requires a request to resolve publicBaseUrl.\",\n );\n }\n\n return new URL(request.url).origin;\n};\n\nconst hotUpdater = createHotUpdater({\n database: d1Database(),\n storages: [\n r2Storage({\n publicBaseUrl: resolveRequestOrigin,\n }),\n ],\n basePath: HOT_UPDATER_BASE_PATH,\n routes: {\n updateCheck: true,\n bundles: false,\n },\n});\n\nconst app = new Hono<{ Bindings: CloudflareWorkerEnv }>();\n\napp.mount(\n HOT_UPDATER_BASE_PATH,\n (request: Request, env: CloudflareWorkerEnv) => {\n return hotUpdater.handler(request, {\n request,\n env,\n });\n },\n {\n optionHandler: (c) => [c.env],\n },\n);\n\napp.get(\"*\", async (c) => {\n const result = await verifyJwtSignedUrl({\n path: new URL(c.req.url).pathname,\n token: c.req.query(\"token\"),\n jwtSecret: c.env.JWT_SECRET,\n handler: async (storageUri) => {\n const [, ...key] = decodeStorageObjectKey(storageUri).split(\"/\");\n const object = await c.env.BUCKET.get(key.join(\"/\"));\n if (!object) {\n return null;\n }\n\n return {\n body: object.body,\n contentType: object.httpMetadata?.contentType,\n };\n },\n });\n\n if (result.status !== 200) {\n return c.json({ error: result.error }, result.status);\n }\n\n return c.body(result.responseBody, 200, result.responseHeaders);\n});\n\nexport default app;\n"],
6
6
  "mappings": ";;;;;AAuBO,SAAS,0BAA0B,MAAM;AAC/C,SAAO,IAAI,MAAM,WAAW,IAAI,0BAA0B;AAC3D;AAFgB;AAAA;AAIT,SAAS,eAAe,MAAM;AACpC,QAAM,KAAK,6BAAM;AAChB,UAAM,0CAA0B,IAAI;AAAA,EACrC,GAFW;AAGX,SAAO,OAAO,OAAO,IAAI,EAAE,WAAW,KAAK,CAAC;AAC7C;AALgB;;AAcT,SAAS,oBAAoB,MAAM;AACzC,SAAO,MAAM;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc;AACb,YAAM,IAAI,MAAM,WAAW,IAAI,0BAA0B;AAAA,IAC1D;AAAA,EACD;AACD;AAPgB;;;ACxChB,IAAM,cAAc,WAAW,aAAa,cAAc,KAAK,IAAI;AACnE,IAAM,kBAAkB,WAAW,aAAa,MAAM,WAAW,YAAY,IAAI,KAAK,WAAW,WAAW,IAAI,MAAM,KAAK,IAAI,IAAI;AACnI,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,UAAU;AAAA,EACV,UAAU;AAAA,EACV,eAAe;AAAA,IACd,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,eAAe;AAAA,EAChB;AAAA,EACA,QAAQ;AAAA,EACR,SAAS;AACR,WAAO;AAAA,EACR;AACD;AAEO,IAAM,mBAAN,MAAuB;AAAA,EA1B9B,OA0B8B;AAAA;AAAA;AAAA,EAC7B,YAAY;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,YAAY,MAAM,SAAS;AAC1B,SAAK,OAAO;AACZ,SAAK,YAAY,SAAS,aAAa,gBAAgB;AACvD,SAA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EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,IAAI;AACJ,IAAM,WAAW;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAA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AAC;AAED,IAAM,MAAM,IAAIC,MAAwC;AAExD,IAAI;AAAA,EACF;AAAA,EACA,CAAC,SAAkBC,SAA6B;AAC9C,WAAO,WAAW,QAAQ,SAAS;AAAA,MACjC;AAAA,MACA,KAAAA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA;AAAA,IACE,eAAe,wBAAC,MAAM,CAAC,EAAE,GAAG,GAAb;AAAA,EACjB;AACF;AAEA,IAAI,IAAI,KAAK,OAAO,MAAM;AACxB,QAAM,SAAS,MAAM,mBAAmB;AAAA,IACtC,MAAM,IAAI,IAAI,EAAE,IAAI,GAAG,EAAE;AAAA,IACzB,OAAO,EAAE,IAAI,MAAM,OAAO;AAAA,IAC1B,WAAW,EAAE,IAAI;AAAA,IACjB,SAAS,8BAAO,eAAe;AAC7B,YAAM,CAAC,EAAE,GAAG,GAAG,IAAI,uBAAuB,UAAU,EAAE,MAAM,GAAG;AAC/D,YAAM,SAAS,MAAM,EAAE,IAAI,OAAO,IAAI,IAAI,KAAK,GAAG,CAAC;AACnD,UAAI,CAAC,QAAQ;AACX,eAAO;AAAA,MACT;AAEA,aAAO;AAAA,QACL,MAAM,OAAO;AAAA,QACb,aAAa,OAAO,cAAc;AAAA,MACpC;AAAA,IACF,GAXS;AAAA,EAYX,CAAC;AAED,MAAI,OAAO,WAAW,KAAK;AACzB,WAAO,EAAE,KAAK,EAAE,OAAO,OAAO,MAAM,GAAG,OAAO,MAAM;AAAA,EACtD;AAEA,SAAO,EAAE,KAAK,OAAO,cAAc,KAAK,OAAO,eAAe;AAChE,CAAC;AAED,IAAO,gBAAQ;",
7
7
  "names": ["PerformanceMark", "clear", "count", "countReset", "createTask", "debug", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "profile", "profileEnd", "table", "time", "timeEnd", "timeLog", "timeStamp", "trace", "warn", "hrtime", "dir", "env", "count", "cwd", "assert", "hrtime", "error", "context", "config", "context", "options", "result", "version", "match", "match", "version", "version", "match", "raw", "version", "version", "version", "version", "context", "context", "LETTER_DASH_NUMBER", "NUMERIC_IDENTIFIER", "NUMERIC_IDENTIFIER_LOOSE", "NON_NUMERIC_IDENTIFIER", "MAIN_VERSION", "MAIN_VERSION_LOOSE", "PRERELEASE_IDENTIFIER", "PRERELEASE_IDENTIFIER_LOOSE", "PRERELEASE", "PRERELEASE_LOOSE", "BUILD_IDENTIFIER", "BUILD", "FULL_PLAIN", "LOOSE_PLAIN", "GREATER_LESS_THAN", "XRANGE_IDENTIFIER", "XRANGE_IDENTIFIER_LOOSE", "XRANGE_PLAIN", "XRANGE_PLAIN_LOOSE", "LONE_TILDE", "LONE_CARET", "COERCE_PLAIN", "COERCE", "COERCE_FULL", "makeSafeRegexSource", "safeRegex", "NUMERIC$1", "compareIdentifiers", "FULL", "LOOSE", "COERCE_EXACT", "COERCE_FULL_EXACT", "NUMERIC", "formatComparableVersion", "version", "formatFullVersion", "parse", "match", "tryParse", "compareMainParsed", "comparePrereleaseParsed", "compareParsed", "coerceParsedVersion", "STRICT_COMPARATOR", "LOOSE_COMPARATOR$1", "parseComparator", "testParsedComparator", "comparatorAllowsPrerelease", "testComparatorSet", "BUILD_STRIP", "BUILD_SAFE", "STRICT_HYPHEN", "LOOSE_HYPHEN", "COMPARATOR_TRIM", "TILDE_TRIM", "CARET_TRIM", "STRICT_TILDE", "LOOSE_TILDE", "STRICT_CARET", "LOOSE_CARET", "STRICT_XRANGE", "LOOSE_XRANGE", "STAR", "GTE_ZERO", "GTE_ZERO_PRERELEASE", "LOOSE_COMPARATOR", "isWildcard", "hasInvalidWildcardOrder", "replaceTilde", "replaceTildes", "replaceCaret", "replaceCarets", "replaceXRange", "replaceXRanges", "replaceHyphenRange", "expandComparator", "parseSimpleRange", "parseRange", "raw", "tryParseRange", "testParsedRange", "testRangeVersion", "satisfies", "coerce", "semverSatisfies", "channel", "platform", "semverSatisfies", "message", "context", "info", "context", "config", "profile", "version", "version", "message", "platform", "context", "channel", "match", "error", "context", "error", "bundleMatchesQueryWhere", "sortBundles", "makeResponse", "INIT_BUNDLE_ROLLBACK_UPDATE_INFO", "options", "context", "platform", "channel", "info", "fileUrl", "version", "context", "plugin", "context", "context", "match", "decoder", "raw", "context", "app", "env", "context", "context", "routes", "routes", "Node", "_Node", "Node", "Hono", "context", "config", "platform", "channel", "bundles", "context", "config", "config", "context", "Hono", "env"]
8
8
  }