screw-up 1.29.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/index.cjs +561 -100
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.mjs +502 -74
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/main.cjs +64 -31
  6. package/dist/main.cjs.map +1 -1
  7. package/dist/main.mjs +5 -5
  8. package/dist/main.mjs.map +1 -1
  9. package/dist/{metadata-file-CyQ2yue9.js → metadata-file-BWd04LhD.js} +63 -34
  10. package/dist/metadata-file-BWd04LhD.js.map +1 -0
  11. package/dist/{packageMetadata-CpakAG0S.cjs → packageMetadata-BDGBM3Fx.cjs} +3 -3
  12. package/dist/{packageMetadata-DnXbVLQ5.js → packageMetadata-BsMXJpMH.js} +6 -6
  13. package/dist/{packageMetadata-DnXbVLQ5.js.map → packageMetadata-BsMXJpMH.js.map} +1 -1
  14. package/dist/{packageMetadata-K_w0Knb7.cjs → packageMetadata-ip0rBTwa.cjs} +5 -5
  15. package/dist/{packageMetadata-K_w0Knb7.cjs.map → packageMetadata-ip0rBTwa.cjs.map} +1 -1
  16. package/dist/src/analyzer.d.ts +2 -2
  17. package/dist/src/analyzer.d.ts.map +1 -1
  18. package/dist/src/cli-internal.d.ts +3 -3
  19. package/dist/src/cli-internal.d.ts.map +1 -1
  20. package/dist/src/cli.d.ts +3 -3
  21. package/dist/src/cli.d.ts.map +1 -1
  22. package/dist/src/declaration-import-fix.d.ts +21 -0
  23. package/dist/src/declaration-import-fix.d.ts.map +1 -0
  24. package/dist/src/default-import-fix.d.ts +2 -2
  25. package/dist/src/default-import-fix.d.ts.map +1 -1
  26. package/dist/src/fast-tags.d.ts +2 -2
  27. package/dist/src/fast-tags.d.ts.map +1 -1
  28. package/dist/src/generated/packageMetadata.d.ts +4 -4
  29. package/dist/src/git-operations.d.ts +3 -3
  30. package/dist/src/git-operations.d.ts.map +1 -1
  31. package/dist/src/git-ref-utils.d.ts +25 -0
  32. package/dist/src/git-ref-utils.d.ts.map +1 -0
  33. package/dist/src/index.d.ts +4 -4
  34. package/dist/src/index.d.ts.map +1 -1
  35. package/dist/src/internal.d.ts +3 -3
  36. package/dist/src/main.d.ts +2 -2
  37. package/dist/src/metadata-file.d.ts +4 -4
  38. package/dist/src/metadata-file.d.ts.map +1 -1
  39. package/dist/src/text-edits.d.ts +24 -0
  40. package/dist/src/text-edits.d.ts.map +1 -0
  41. package/dist/src/types.d.ts +7 -2
  42. package/dist/src/types.d.ts.map +1 -1
  43. package/dist/src/vite-plugin.d.ts +3 -3
  44. package/dist/src/vite-plugin.d.ts.map +1 -1
  45. package/package.json +14 -10
  46. package/dist/metadata-file-CyQ2yue9.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../node_modules/async-primitives/dist/index.mjs","../src/default-import-fix.ts","../src/vite-plugin.ts","../src/index.ts"],"sourcesContent":["/*!\n * name: async-primitives\n * version: 1.5.0\n * description: A collection of primitive functions for asynchronous operations\n * author: Kouji Matsui (@kekyo@mi.kekyo.net)\n * license: MIT\n * repository.url: https://github.com/kekyo/async-primitives.git\n * git.commit.hash: cd35465b7e9b9945049186e7eaeecc0bfba65766\n */\nconst __NOOP_HANDLER = () => {\n};\nconst __NOOP_RELEASABLE = {\n release: __NOOP_HANDLER,\n [Symbol.dispose]: __NOOP_HANDLER\n};\nconst toAbortError = (reason) => {\n if (reason instanceof Error) {\n return reason;\n }\n if (typeof reason === \"string\") {\n return new Error(reason);\n }\n return new Error(\"Operation aborted\");\n};\nconst onAbort = (signal, callback) => {\n if (!signal) {\n return __NOOP_RELEASABLE;\n }\n if (signal.aborted) {\n try {\n callback(toAbortError(signal.reason));\n } catch (error) {\n console.warn(\"AbortHook callback error: \", error);\n }\n return __NOOP_RELEASABLE;\n }\n let abortHandler;\n abortHandler = () => {\n if (abortHandler) {\n const reason = signal.reason;\n signal.removeEventListener(\"abort\", abortHandler);\n abortHandler = void 0;\n try {\n callback(toAbortError(reason));\n } catch (error) {\n console.warn(\"AbortHook callback error: \", error);\n }\n }\n };\n const release = () => {\n if (abortHandler) {\n signal.removeEventListener(\"abort\", abortHandler);\n abortHandler = void 0;\n }\n };\n signal.addEventListener(\"abort\", abortHandler, { once: true });\n const handle = {\n release,\n [Symbol.dispose]: release\n };\n return handle;\n};\nconst delay = (msec, signal) => {\n if (signal) {\n if (signal.aborted) {\n throw new Error(\"Delay was aborted\");\n }\n return new Promise((resolve, reject) => {\n const abortHandle = onAbort(signal, () => {\n clearTimeout(timeoutId);\n reject(new Error(\"Delay was aborted\"));\n });\n const timeoutId = setTimeout(() => {\n abortHandle.release();\n resolve();\n }, msec);\n });\n } else {\n return new Promise((resolve) => {\n setTimeout(resolve, msec);\n });\n }\n};\nconst defer = (fn) => {\n if (typeof setImmediate === \"function\") {\n setImmediate(fn);\n } else {\n setTimeout(fn, 0);\n }\n};\nconst ABORTED_ERROR$2 = () => new Error(\"Lock acquisition was aborted\");\nconst createLockHandle = (releaseCallback) => {\n let isActive = true;\n const release = () => {\n if (!isActive) {\n return;\n }\n isActive = false;\n releaseCallback();\n };\n return {\n get isActive() {\n return isActive;\n },\n release,\n [Symbol.dispose]: release\n };\n};\nconst createMutex = (maxConsecutiveCalls = 20) => {\n let isLocked = false;\n const queue = [];\n let count = 0;\n const processQueue = () => {\n var _a;\n if (isLocked || queue.length === 0) {\n return;\n }\n const item = queue.shift();\n if ((_a = item.signal) == null ? void 0 : _a.aborted) {\n item.reject(ABORTED_ERROR$2());\n scheduleNextProcess();\n return;\n }\n isLocked = true;\n const lockHandle = createLockHandle(releaseLock);\n item.resolve(lockHandle);\n };\n const scheduleNextProcess = () => {\n count++;\n if (count >= maxConsecutiveCalls) {\n count = 0;\n defer(processQueue);\n } else {\n processQueue();\n }\n };\n const releaseLock = () => {\n if (!isLocked) {\n return;\n }\n isLocked = false;\n scheduleNextProcess();\n };\n const removeFromQueue = (item) => {\n const index = queue.indexOf(item);\n if (index !== -1) {\n queue.splice(index, 1);\n }\n };\n const lock = async (signal) => {\n if (signal) {\n if (signal.aborted) {\n throw ABORTED_ERROR$2();\n }\n return new Promise((resolve, reject) => {\n const queueItem = {\n resolve: void 0,\n reject: void 0,\n signal\n };\n const abortHandle = onAbort(signal, () => {\n removeFromQueue(queueItem);\n reject(ABORTED_ERROR$2());\n });\n queueItem.resolve = (handle) => {\n abortHandle.release();\n resolve(handle);\n };\n queueItem.reject = (error) => {\n abortHandle.release();\n reject(error);\n };\n queue.push(queueItem);\n processQueue();\n });\n } else {\n return new Promise((resolve, reject) => {\n queue.push({\n resolve,\n reject\n });\n processQueue();\n });\n }\n };\n const result = {\n lock,\n waiter: {\n wait: lock\n },\n get isLocked() {\n return isLocked;\n },\n get pendingCount() {\n return queue.length;\n }\n };\n return result;\n};\nconst createDeferred = (signal) => {\n let resolve;\n let reject;\n const promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n const disposer = onAbort(signal, () => {\n const _reject = reject;\n if (_reject) {\n resolve = void 0;\n reject = void 0;\n _reject(new Error(\"Deferred aborted\"));\n }\n });\n return {\n // The promise that resolves to the result\n promise,\n // Resolve the promise with a result\n resolve: (value) => {\n const _resolve = resolve;\n if (_resolve) {\n resolve = void 0;\n reject = void 0;\n disposer.release();\n _resolve(value);\n }\n },\n // Reject the promise with an error\n reject: (error) => {\n const _reject = reject;\n if (_reject) {\n resolve = void 0;\n reject = void 0;\n disposer.release();\n _reject(error);\n }\n }\n };\n};\nconst __NOOP_DUMMY_HANDLE = {\n get isActive() {\n return false;\n },\n release: __NOOP_HANDLER,\n [Symbol.dispose]: __NOOP_HANDLER\n};\nconst createConditional = () => {\n const waiters = [];\n const trigger = () => {\n if (waiters.length >= 1) {\n waiters.shift().resolve();\n }\n };\n const wait = async (signal) => {\n if (signal == null ? void 0 : signal.aborted) {\n throw new Error(\"Conditional aborted\");\n }\n const waiter = createDeferred();\n waiters.push(waiter);\n const disposer = onAbort(signal, () => {\n waiters.splice(waiters.indexOf(waiter), 1);\n waiter.reject(new Error(\"Conditional aborted\"));\n });\n try {\n await waiter.promise;\n } finally {\n disposer.release();\n }\n return __NOOP_DUMMY_HANDLE;\n };\n const result = {\n trigger,\n wait,\n waiter: {\n wait\n }\n };\n return result;\n};\nconst createManuallyConditional = (initialState) => {\n const waiters = [];\n let raised = initialState != null ? initialState : false;\n const trigger = () => {\n raised = false;\n const waiter = waiters.shift();\n if (waiter) {\n waiter.resolve();\n raised = false;\n }\n };\n const raise = () => {\n while (waiters.length >= 1) {\n raised = true;\n waiters.shift().resolve();\n }\n raised = true;\n };\n const drop = () => {\n raised = false;\n };\n const wait = async (signal) => {\n if (raised) {\n return __NOOP_DUMMY_HANDLE;\n }\n if (signal == null ? void 0 : signal.aborted) {\n throw new Error(\"Conditional aborted\");\n }\n const waiter = createDeferred();\n waiters.push(waiter);\n const disposer = onAbort(signal, () => {\n waiters.splice(waiters.indexOf(waiter), 1);\n waiter.reject(new Error(\"Conditional aborted\"));\n });\n try {\n await waiter.promise;\n } finally {\n disposer.release();\n }\n return __NOOP_DUMMY_HANDLE;\n };\n const result = {\n trigger,\n raise,\n drop,\n wait,\n waiter: {\n wait\n }\n };\n return result;\n};\nconst createDeferredGenerator = (options) => {\n const maxItemReserved = options == null ? void 0 : options.maxItemReserved;\n const signal = options == null ? void 0 : options.signal;\n const queue = [];\n const arrived = createManuallyConditional();\n const canReserve = maxItemReserved ? createManuallyConditional(true) : void 0;\n const generator = (async function* () {\n while (true) {\n while (true) {\n const item = queue.shift();\n if (maxItemReserved && queue.length === maxItemReserved - 1) {\n canReserve.raise();\n }\n if (!item) {\n break;\n }\n switch (item.kind) {\n // Yield return a value\n case \"value\":\n yield item.value;\n break;\n // Completed, exit the generator\n case \"completed\":\n return;\n // Error, throw an error\n case \"error\":\n throw item.error;\n }\n if (signal == null ? void 0 : signal.aborted) {\n throw new Error(\"Deferred generator aborted\");\n }\n }\n arrived.drop();\n try {\n await arrived.wait(signal);\n } catch (error) {\n if (error instanceof Error && error.message === \"Conditional aborted\") {\n error.message = \"Deferred generator aborted\";\n }\n throw error;\n }\n }\n })();\n const enqueue = async (item, signal2) => {\n while (true) {\n if (!maxItemReserved || queue.length < maxItemReserved) {\n const remains = queue.push(item);\n if (remains === 1) {\n arrived.raise();\n }\n if (remains === maxItemReserved) {\n canReserve.drop();\n }\n break;\n }\n try {\n await canReserve.wait(signal2);\n } catch (error) {\n if (error instanceof Error && error.message === \"Conditional aborted\") {\n error.message = \"Deferred generator aborted\";\n }\n throw error;\n }\n }\n };\n return {\n // The async generator that yields values\n generator,\n // Yield a value to the generator\n yield: (value, signal2) => enqueue({ kind: \"value\", value }, signal2),\n // Complete the generator (equivalent to return)\n return: (signal2) => enqueue({ kind: \"completed\" }, signal2),\n // Throw an error to the generator\n throw: (error, signal2) => enqueue({ kind: \"error\", error }, signal2)\n };\n};\nconst createLogicalContext = (id) => {\n return { id, data: /* @__PURE__ */ new Map() };\n};\nlet currentLogicalContext = createLogicalContext(Symbol(\"[root]\"));\nconst setCurrentLogicalContext = (context) => {\n currentLogicalContext = context;\n};\nconst trampoline = (adjustment, callback, thisArg, ...args) => {\n const previousLogicalContext = currentLogicalContext;\n currentLogicalContext = adjustment.contextToUse;\n try {\n return callback.call(thisArg, ...args);\n } finally {\n adjustment.contextAfter = currentLogicalContext;\n currentLogicalContext = previousLogicalContext;\n }\n};\nlet isPrepared = false;\nconst prepare = () => {\n if (isPrepared) {\n return;\n }\n isPrepared = true;\n if (typeof globalThis.setTimeout !== \"undefined\") {\n const __setTimeout = globalThis.setTimeout;\n globalThis.setTimeout = ((handler, timeout, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __setTimeout(\n (...args2) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n trampoline(adjustment, handler, void 0, ...args2);\n },\n timeout,\n ...args\n );\n });\n }\n if (typeof globalThis.setInterval !== \"undefined\") {\n const __setInterval = globalThis.setInterval;\n globalThis.setInterval = ((handler, timeout, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __setInterval(\n (...args2) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n trampoline(adjustment, handler, void 0, ...args2);\n },\n timeout,\n ...args\n );\n });\n }\n if (typeof globalThis.queueMicrotask !== \"undefined\") {\n const __queueMicrotask = globalThis.queueMicrotask;\n globalThis.queueMicrotask = (callback) => {\n const capturedLogicalContext = currentLogicalContext;\n return __queueMicrotask(() => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n trampoline(adjustment, callback, void 0);\n });\n };\n }\n if (typeof globalThis.setImmediate !== \"undefined\") {\n const __setImmediate = globalThis.setImmediate;\n globalThis.setImmediate = ((callback, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __setImmediate(\n (...callbackArgs) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n trampoline(adjustment, callback, void 0, ...callbackArgs);\n },\n ...args\n );\n });\n }\n if (typeof process !== \"undefined\" && process.nextTick) {\n const __nextTick = process.nextTick;\n process.nextTick = (callback, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __nextTick(() => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n trampoline(adjustment, callback, void 0, ...args);\n });\n };\n }\n if (typeof Promise !== \"undefined\") {\n const __then = Promise.prototype.then;\n const __catch = Promise.prototype.catch;\n const __finally = Promise.prototype.finally;\n Promise.prototype.then = function(onFulfilled, onRejected) {\n const capturedLogicalContext = currentLogicalContext;\n const resultPromise = __then.call(\n this,\n onFulfilled ? (value) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, onFulfilled, void 0, value);\n } : void 0,\n onRejected ? (reason) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, onRejected, void 0, reason);\n } : void 0\n );\n return resultPromise;\n };\n Promise.prototype.catch = function(onRejected) {\n const capturedLogicalContext = currentLogicalContext;\n const resultPromise = __catch.call(\n this,\n onRejected ? (reason) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, onRejected, void 0, reason);\n } : void 0\n );\n return resultPromise;\n };\n Promise.prototype.finally = function(onFinally) {\n const capturedLogicalContext = currentLogicalContext;\n const resultPromise = __finally.call(\n this,\n onFinally ? () => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, onFinally, void 0);\n } : void 0\n );\n return resultPromise;\n };\n }\n if (typeof EventTarget !== \"undefined\" && EventTarget.prototype && EventTarget.prototype.addEventListener) {\n const __eventTargetAddEventListener = EventTarget.prototype.addEventListener;\n EventTarget.prototype.addEventListener = function(type, listener, options) {\n if (listener === null || listener === void 0) {\n return __eventTargetAddEventListener.call(\n this,\n type,\n listener,\n options\n );\n }\n if (typeof listener === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return __eventTargetAddEventListener.call(\n this,\n type,\n wrappedListener,\n options\n );\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return __eventTargetAddEventListener.call(\n this,\n type,\n wrappedListener,\n options\n );\n }\n return __eventTargetAddEventListener.call(\n this,\n type,\n listener,\n options\n );\n };\n }\n if (typeof Element !== \"undefined\" && Element.prototype && Element.prototype.addEventListener) {\n const __elementAddEventListener = Element.prototype.addEventListener;\n Element.prototype.addEventListener = function(type, listener, options) {\n if (listener === null || listener === void 0) {\n return __elementAddEventListener.call(\n this,\n type,\n listener,\n options\n );\n }\n if (typeof listener === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return __elementAddEventListener.call(\n this,\n type,\n wrappedListener,\n options\n );\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return __elementAddEventListener.call(\n this,\n type,\n wrappedListener,\n options\n );\n }\n return __elementAddEventListener.call(\n this,\n type,\n listener,\n options\n );\n };\n }\n if (typeof globalThis.requestAnimationFrame !== \"undefined\") {\n const __requestAnimationFrame = globalThis.requestAnimationFrame;\n globalThis.requestAnimationFrame = (callback) => {\n const capturedLogicalContext = currentLogicalContext;\n return __requestAnimationFrame((time) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, callback, void 0, time);\n });\n };\n }\n if (typeof globalThis.XMLHttpRequest !== \"undefined\") {\n const __XMLHttpRequest = globalThis.XMLHttpRequest;\n globalThis.XMLHttpRequest = class extends __XMLHttpRequest {\n constructor() {\n super();\n this._userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\n \"onreadystatechange\",\n \"onloadstart\",\n \"onprogress\",\n \"onabort\",\n \"onerror\",\n \"onload\",\n \"ontimeout\",\n \"onloadend\"\n ];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(this, prop, {\n get: () => this._userHandlers.get(prop) || null,\n set: (newHandler) => {\n this._userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, newHandler, this, event);\n };\n const parentProto = Object.getPrototypeOf(\n Object.getPrototypeOf(this)\n );\n const descriptor = Object.getOwnPropertyDescriptor(\n parentProto,\n prop\n );\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, wrappedHandler);\n } else {\n this[`_${prop}`] = wrappedHandler;\n }\n } else {\n const parentProto = Object.getPrototypeOf(\n Object.getPrototypeOf(this)\n );\n const descriptor = Object.getOwnPropertyDescriptor(\n parentProto,\n prop\n );\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, null);\n } else {\n this[`_${prop}`] = null;\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n }\n addEventListener(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return super.addEventListener(type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return super.addEventListener(type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return super.addEventListener(type, wrappedListener, options);\n }\n return super.addEventListener(type, listener, options);\n }\n };\n }\n if (typeof globalThis.WebSocket !== \"undefined\") {\n const __WebSocket = globalThis.WebSocket;\n globalThis.WebSocket = class extends __WebSocket {\n constructor(url, protocols) {\n super(url, protocols);\n this._userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\n \"onopen\",\n \"onmessage\",\n \"onerror\",\n \"onclose\"\n ];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(this, prop, {\n get: () => this._userHandlers.get(prop) || null,\n set: (newHandler) => {\n this._userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, newHandler, this, event);\n };\n const parentProto = Object.getPrototypeOf(\n Object.getPrototypeOf(this)\n );\n const descriptor = Object.getOwnPropertyDescriptor(\n parentProto,\n prop\n );\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, wrappedHandler);\n } else {\n this[`_${prop}`] = wrappedHandler;\n }\n } else {\n const parentProto = Object.getPrototypeOf(\n Object.getPrototypeOf(this)\n );\n const descriptor = Object.getOwnPropertyDescriptor(\n parentProto,\n prop\n );\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, null);\n } else {\n this[`_${prop}`] = null;\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n }\n addEventListener(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return super.addEventListener(type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return super.addEventListener(type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return super.addEventListener(type, wrappedListener, options);\n }\n return super.addEventListener(type, listener, options);\n }\n };\n }\n if (typeof globalThis.MutationObserver !== \"undefined\") {\n const __MutationObserver = globalThis.MutationObserver;\n globalThis.MutationObserver = class extends __MutationObserver {\n constructor(callback) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedCallback = (mutations, observer) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(\n adjustment,\n callback,\n void 0,\n mutations,\n observer\n );\n };\n super(wrappedCallback);\n }\n };\n }\n if (typeof globalThis.ResizeObserver !== \"undefined\") {\n const __ResizeObserver = globalThis.ResizeObserver;\n globalThis.ResizeObserver = class extends __ResizeObserver {\n constructor(callback) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedCallback = (entries, observer) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, callback, void 0, entries, observer);\n };\n super(wrappedCallback);\n }\n };\n }\n if (typeof globalThis.IntersectionObserver !== \"undefined\") {\n const __IntersectionObserver = globalThis.IntersectionObserver;\n globalThis.IntersectionObserver = class extends __IntersectionObserver {\n constructor(callback, options) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedCallback = (entries, observer) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, callback, void 0, entries, observer);\n };\n super(wrappedCallback, options);\n }\n };\n }\n if (typeof globalThis.Worker !== \"undefined\") {\n const __Worker = globalThis.Worker;\n globalThis.Worker = class extends __Worker {\n constructor(scriptURL, options) {\n super(scriptURL, options);\n this._userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\n \"onmessage\",\n \"onmessageerror\",\n \"onerror\"\n ];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(this, prop, {\n get: () => this._userHandlers.get(prop) || null,\n set: (newHandler) => {\n this._userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, newHandler, this, event);\n };\n const parentProto = Object.getPrototypeOf(\n Object.getPrototypeOf(this)\n );\n const descriptor = Object.getOwnPropertyDescriptor(\n parentProto,\n prop\n );\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, wrappedHandler);\n } else {\n this[`_${prop}`] = wrappedHandler;\n }\n } else {\n const parentProto = Object.getPrototypeOf(\n Object.getPrototypeOf(this)\n );\n const descriptor = Object.getOwnPropertyDescriptor(\n parentProto,\n prop\n );\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, null);\n } else {\n this[`_${prop}`] = null;\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n }\n addEventListener(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return super.addEventListener(type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return super.addEventListener(type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return super.addEventListener(type, wrappedListener, options);\n }\n return super.addEventListener(type, listener, options);\n }\n };\n }\n if (typeof globalThis.MessagePort !== \"undefined\") {\n const __MessagePort = globalThis.MessagePort;\n const createMessagePortWrapper = (originalPort) => {\n const _userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\"onmessage\", \"onmessageerror\"];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(originalPort, prop, {\n get: () => _userHandlers.get(prop) || null,\n set: (newHandler) => {\n _userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, newHandler, this, event);\n };\n const descriptor = Object.getOwnPropertyDescriptor(\n __MessagePort.prototype,\n prop\n );\n if (descriptor && descriptor.set) {\n descriptor.set.call(originalPort, wrappedHandler);\n }\n } else {\n const descriptor = Object.getOwnPropertyDescriptor(\n __MessagePort.prototype,\n prop\n );\n if (descriptor && descriptor.set) {\n descriptor.set.call(originalPort, null);\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n const originalAddEventListener = originalPort.addEventListener;\n originalPort.addEventListener = function(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return originalAddEventListener.call(\n this,\n type,\n listener,\n options\n );\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return originalAddEventListener.call(\n this,\n type,\n wrappedListener,\n options\n );\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = {\n contextToUse: capturedLogicalContext\n };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return originalAddEventListener.call(\n this,\n type,\n wrappedListener,\n options\n );\n }\n return originalAddEventListener.call(this, type, listener, options);\n };\n return originalPort;\n };\n if (typeof globalThis.MessageChannel !== \"undefined\") {\n const __MessageChannel = globalThis.MessageChannel;\n globalThis.MessageChannel = class extends __MessageChannel {\n constructor() {\n super();\n createMessagePortWrapper(this.port1);\n createMessagePortWrapper(this.port2);\n }\n };\n }\n }\n};\nconst setLogicalContextValue = (key, value) => {\n prepare();\n if (value !== void 0) {\n currentLogicalContext.data.set(key, value);\n } else {\n currentLogicalContext.data.delete(key);\n }\n};\nconst getLogicalContextValue = (key) => {\n prepare();\n return currentLogicalContext.data.get(key);\n};\nconst runOnNewLogicalContext = (prefix, handler) => {\n const previousLogicalContext = currentLogicalContext;\n setCurrentLogicalContext(\n createLogicalContext(Symbol(`${prefix}-${crypto.randomUUID()}`))\n );\n try {\n return handler();\n } finally {\n setCurrentLogicalContext(previousLogicalContext);\n }\n};\nconst getCurrentLogicalContextId = () => {\n prepare();\n return currentLogicalContext.id;\n};\nconst createAsyncLocal = () => {\n const key = Symbol(`async-local-${crypto.randomUUID()}`);\n return {\n setValue: (value) => {\n setLogicalContextValue(key, value);\n },\n getValue: () => {\n return getLogicalContextValue(key);\n }\n };\n};\nconst ABORTED_ERROR$1 = () => new Error(\"Semaphore acquisition was aborted\");\nconst INVALID_COUNT_ERROR = () => new Error(\"Semaphore count must be greater than 0\");\nconst createSemaphoreHandle = (releaseCallback) => {\n let isActive = true;\n const release = () => {\n if (!isActive) {\n return;\n }\n isActive = false;\n releaseCallback();\n };\n return {\n get isActive() {\n return isActive;\n },\n release,\n [Symbol.dispose]: release\n };\n};\nconst createSemaphore = (count, maxConsecutiveCalls = 20) => {\n if (count < 1) {\n throw INVALID_COUNT_ERROR();\n }\n let availableCount = count;\n const queue = [];\n let consecutiveCallCount = 0;\n const processQueue = () => {\n var _a;\n while (availableCount > 0 && queue.length > 0) {\n const item = queue.shift();\n if ((_a = item.signal) == null ? void 0 : _a.aborted) {\n item.reject(ABORTED_ERROR$1());\n continue;\n }\n availableCount--;\n const semaphoreHandle = createSemaphoreHandle(releaseSemaphore);\n item.resolve(semaphoreHandle);\n }\n };\n const scheduleNextProcess = () => {\n consecutiveCallCount++;\n if (consecutiveCallCount >= maxConsecutiveCalls) {\n consecutiveCallCount = 0;\n defer(processQueue);\n } else {\n processQueue();\n }\n };\n const releaseSemaphore = () => {\n availableCount++;\n scheduleNextProcess();\n };\n const removeFromQueue = (item) => {\n const index = queue.indexOf(item);\n if (index !== -1) {\n queue.splice(index, 1);\n }\n };\n const acquire = async (signal) => {\n if (signal) {\n if (signal.aborted) {\n throw ABORTED_ERROR$1();\n }\n if (availableCount > 0) {\n availableCount--;\n return createSemaphoreHandle(releaseSemaphore);\n }\n return new Promise((resolve, reject) => {\n const queueItem = {\n resolve: void 0,\n reject: void 0,\n signal\n };\n const abortHandle = onAbort(signal, () => {\n removeFromQueue(queueItem);\n reject(ABORTED_ERROR$1());\n });\n queueItem.resolve = (handle) => {\n abortHandle.release();\n resolve(handle);\n };\n queueItem.reject = (error) => {\n abortHandle.release();\n reject(error);\n };\n queue.push(queueItem);\n processQueue();\n });\n } else {\n if (availableCount > 0) {\n availableCount--;\n return createSemaphoreHandle(releaseSemaphore);\n }\n return new Promise((resolve, reject) => {\n queue.push({\n resolve,\n reject\n });\n processQueue();\n });\n }\n };\n const result = {\n acquire,\n waiter: {\n wait: acquire\n },\n get availableCount() {\n return availableCount;\n },\n get pendingCount() {\n return queue.length;\n }\n };\n return result;\n};\nconst ABORTED_ERROR = () => new Error(\"Lock acquisition was aborted\");\nconst createReadLockHandle = (releaseCallback) => {\n let isActive = true;\n const release = () => {\n if (!isActive) {\n return;\n }\n isActive = false;\n releaseCallback();\n };\n return {\n get isActive() {\n return isActive;\n },\n release,\n [Symbol.dispose]: release\n };\n};\nconst createWriteLockHandle = (releaseCallback) => {\n let isActive = true;\n const release = () => {\n if (!isActive) {\n return;\n }\n isActive = false;\n releaseCallback();\n };\n return {\n get isActive() {\n return isActive;\n },\n release,\n [Symbol.dispose]: release\n };\n};\nfunction createReaderWriterLock(optionsOrMaxCalls) {\n var _a, _b;\n let policy = \"write-preferring\";\n let maxConsecutiveCalls = 20;\n if (typeof optionsOrMaxCalls === \"number\") {\n maxConsecutiveCalls = optionsOrMaxCalls;\n } else if (optionsOrMaxCalls) {\n policy = (_a = optionsOrMaxCalls.policy) != null ? _a : \"write-preferring\";\n maxConsecutiveCalls = (_b = optionsOrMaxCalls.maxConsecutiveCalls) != null ? _b : 20;\n }\n let currentReaders = 0;\n let hasWriter = false;\n const readQueue = [];\n const writeQueue = [];\n let consecutiveCallCount = 0;\n const processQueues = () => {\n var _a2, _b2, _c, _d;\n if (policy === \"write-preferring\") {\n if (!hasWriter && currentReaders === 0 && writeQueue.length > 0) {\n const item = writeQueue.shift();\n if ((_a2 = item.signal) == null ? void 0 : _a2.aborted) {\n item.reject(ABORTED_ERROR());\n scheduleNextProcess();\n return;\n }\n hasWriter = true;\n const writeLockHandle = createWriteLockHandle(releaseWriteLock);\n item.resolve(writeLockHandle);\n } else if (!hasWriter && writeQueue.length === 0 && readQueue.length > 0) {\n const readersToProcess = [];\n while (readQueue.length > 0) {\n const item = readQueue.shift();\n if ((_b2 = item.signal) == null ? void 0 : _b2.aborted) {\n item.reject(ABORTED_ERROR());\n } else {\n readersToProcess.push(item);\n }\n }\n for (const item of readersToProcess) {\n currentReaders++;\n const readLockHandle = createReadLockHandle(releaseReadLock);\n item.resolve(readLockHandle);\n }\n }\n } else {\n if (!hasWriter && readQueue.length > 0) {\n const readersToProcess = [];\n while (readQueue.length > 0) {\n const item = readQueue.shift();\n if ((_c = item.signal) == null ? void 0 : _c.aborted) {\n item.reject(ABORTED_ERROR());\n } else {\n readersToProcess.push(item);\n }\n }\n for (const item of readersToProcess) {\n currentReaders++;\n const readLockHandle = createReadLockHandle(releaseReadLock);\n item.resolve(readLockHandle);\n }\n } else if (!hasWriter && currentReaders === 0 && writeQueue.length > 0) {\n const item = writeQueue.shift();\n if ((_d = item.signal) == null ? void 0 : _d.aborted) {\n item.reject(ABORTED_ERROR());\n scheduleNextProcess();\n return;\n }\n hasWriter = true;\n const writeLockHandle = createWriteLockHandle(releaseWriteLock);\n item.resolve(writeLockHandle);\n }\n }\n };\n const scheduleNextProcess = () => {\n consecutiveCallCount++;\n if (consecutiveCallCount >= maxConsecutiveCalls) {\n consecutiveCallCount = 0;\n defer(processQueues);\n } else {\n processQueues();\n }\n };\n const releaseReadLock = () => {\n if (currentReaders > 0) {\n currentReaders--;\n if (currentReaders === 0) {\n scheduleNextProcess();\n }\n }\n };\n const releaseWriteLock = () => {\n if (hasWriter) {\n hasWriter = false;\n scheduleNextProcess();\n }\n };\n const removeFromReadQueue = (item) => {\n const index = readQueue.indexOf(item);\n if (index !== -1) {\n readQueue.splice(index, 1);\n }\n };\n const removeFromWriteQueue = (item) => {\n const index = writeQueue.indexOf(item);\n if (index !== -1) {\n writeQueue.splice(index, 1);\n }\n };\n const readLock = async (signal) => {\n if (signal) {\n if (signal.aborted) {\n throw ABORTED_ERROR();\n }\n const canAcquireImmediately = policy === \"read-preferring\" ? !hasWriter : !hasWriter && writeQueue.length === 0;\n if (canAcquireImmediately) {\n currentReaders++;\n return createReadLockHandle(releaseReadLock);\n }\n return new Promise((resolve, reject) => {\n const queueItem = {\n resolve: void 0,\n reject: void 0,\n signal\n };\n const abortHandle = onAbort(signal, () => {\n removeFromReadQueue(queueItem);\n reject(ABORTED_ERROR());\n });\n queueItem.resolve = (handle) => {\n abortHandle.release();\n resolve(handle);\n };\n queueItem.reject = (error) => {\n abortHandle.release();\n reject(error);\n };\n readQueue.push(queueItem);\n processQueues();\n });\n } else {\n const canAcquireImmediately = policy === \"read-preferring\" ? !hasWriter : !hasWriter && writeQueue.length === 0;\n if (canAcquireImmediately) {\n currentReaders++;\n return createReadLockHandle(releaseReadLock);\n }\n return new Promise((resolve, reject) => {\n readQueue.push({\n resolve,\n reject\n });\n processQueues();\n });\n }\n };\n const writeLock = async (signal) => {\n if (signal) {\n if (signal.aborted) {\n throw ABORTED_ERROR();\n }\n if (!hasWriter && currentReaders === 0) {\n hasWriter = true;\n return createWriteLockHandle(releaseWriteLock);\n }\n return new Promise((resolve, reject) => {\n const queueItem = {\n resolve: void 0,\n reject: void 0,\n signal\n };\n const abortHandle = onAbort(signal, () => {\n removeFromWriteQueue(queueItem);\n reject(ABORTED_ERROR());\n });\n queueItem.resolve = (handle) => {\n abortHandle.release();\n resolve(handle);\n };\n queueItem.reject = (error) => {\n abortHandle.release();\n reject(error);\n };\n writeQueue.push(queueItem);\n processQueues();\n });\n } else {\n if (!hasWriter && currentReaders === 0) {\n hasWriter = true;\n return createWriteLockHandle(releaseWriteLock);\n }\n return new Promise((resolve, reject) => {\n writeQueue.push({\n resolve,\n reject\n });\n processQueues();\n });\n }\n };\n const readWaiter = {\n wait: readLock\n };\n const writeWaiter = {\n wait: writeLock\n };\n return {\n readLock,\n writeLock,\n readWaiter,\n writeWaiter,\n get currentReaders() {\n return currentReaders;\n },\n get hasWriter() {\n return hasWriter;\n },\n get pendingReadersCount() {\n return readQueue.length;\n },\n get pendingWritersCount() {\n return writeQueue.length;\n }\n };\n}\nexport {\n createAsyncLocal,\n createMutex as createAsyncLock,\n createConditional,\n createDeferred,\n createDeferredGenerator,\n createManuallyConditional,\n createManuallyConditional as createManuallySignal,\n createMutex,\n createReaderWriterLock,\n createSemaphore,\n createConditional as createSignal,\n defer,\n delay,\n getCurrentLogicalContextId,\n getLogicalContextValue,\n onAbort,\n runOnNewLogicalContext,\n setLogicalContextValue\n};\n//# sourceMappingURL=index.mjs.map\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\nimport { createHash } from 'crypto';\nimport { existsSync } from 'fs';\nimport { readFile } from 'fs/promises';\nimport { dirname, extname, join } from 'path';\n\n// We use async I/O except 'existsSync', because 'exists' will throw an error if the file does not exist.\n\n//////////////////////////////////////////////////////////////////////////////////\n\nexport type ModuleInteropKind = 'cjs' | 'esm' | 'unresolvable' | 'unknown';\n\nconst importConditions = ['import', 'node', 'default'] as const;\n\nconst stripQuery = (id: string): string => {\n const queryIndex = id.indexOf('?');\n return queryIndex === -1 ? id : id.slice(0, queryIndex);\n};\n\nconst isBareSpecifier = (specifier: string): boolean => {\n if (!specifier) {\n return false;\n }\n if (specifier.startsWith('.')) {\n return false;\n }\n if (specifier.startsWith('/') || specifier.startsWith('\\\\')) {\n return false;\n }\n if (specifier.startsWith('node:')) {\n return false;\n }\n if (specifier.includes(':')) {\n return false;\n }\n return true;\n};\n\nconst parsePackageName = (\n specifier: string\n): { packageName: string; subpath: string } => {\n if (specifier.startsWith('@')) {\n const parts = specifier.split('/');\n if (parts.length >= 2) {\n return {\n packageName: `${parts[0]}/${parts[1]}`,\n subpath: parts.slice(2).join('/'),\n };\n }\n }\n const [packageName, ...rest] = specifier.split('/');\n return { packageName, subpath: rest.join('/') };\n};\n\nconst findPackageJsonPath = (\n packageName: string,\n importerDir: string\n): string | undefined => {\n let current = importerDir;\n while (true) {\n const candidate = join(\n current,\n 'node_modules',\n packageName,\n 'package.json'\n );\n if (existsSync(candidate)) {\n return candidate;\n }\n const parent = dirname(current);\n if (parent === current) {\n return undefined;\n }\n current = parent;\n }\n};\n\nconst readPackageJson = async (\n packageJsonPath: string\n): Promise<Record<string, unknown> | undefined> => {\n try {\n const raw = await readFile(packageJsonPath, 'utf8');\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === 'object') {\n return parsed as Record<string, unknown>;\n }\n } catch {\n return undefined;\n }\n return undefined;\n};\n\nconst resolveExportTarget = (\n target: unknown,\n subpath: string,\n conditions: readonly string[]\n): string | undefined => {\n if (typeof target === 'string') {\n if (subpath && subpath !== '.') {\n return undefined;\n }\n return target;\n }\n if (Array.isArray(target)) {\n for (const entry of target) {\n const resolved = resolveExportTarget(entry, subpath, conditions);\n if (resolved) {\n return resolved;\n }\n }\n return undefined;\n }\n if (!target || typeof target !== 'object') {\n return undefined;\n }\n\n const record = target as Record<string, unknown>;\n const keys = Object.keys(record);\n const hasSubpathMap = keys.some((key) => key.startsWith('.'));\n\n if (hasSubpathMap) {\n const subpathKey =\n subpath === '' || subpath === '.'\n ? '.'\n : subpath.startsWith('./')\n ? subpath\n : `./${subpath}`;\n if (!(subpathKey in record)) {\n return undefined;\n }\n return resolveExportTarget(record[subpathKey], '.', conditions);\n }\n\n for (const condition of conditions) {\n if (condition in record) {\n const resolved = resolveExportTarget(\n record[condition],\n subpath,\n conditions\n );\n if (resolved) {\n return resolved;\n }\n }\n }\n\n return undefined;\n};\n\nconst inferModuleKindFromPath = (\n targetPath: string,\n packageType: string | undefined\n): ModuleInteropKind => {\n const ext = extname(targetPath);\n if (ext === '.mjs') {\n return 'esm';\n }\n if (ext === '.cjs') {\n return 'cjs';\n }\n if (ext === '.js' || ext === '') {\n return packageType === 'module' ? 'esm' : 'cjs';\n }\n return packageType === 'module' ? 'esm' : 'cjs';\n};\n\nconst resolveModuleKindFromPackage = (\n packageJson: Record<string, unknown>,\n subpath: string\n): ModuleInteropKind => {\n const packageType =\n typeof packageJson.type === 'string' ? packageJson.type : undefined;\n if (packageJson.exports !== undefined) {\n const resolved = resolveExportTarget(\n packageJson.exports,\n subpath,\n importConditions\n );\n if (!resolved) {\n return 'unresolvable';\n }\n return inferModuleKindFromPath(resolved, packageType);\n }\n\n if (subpath) {\n return inferModuleKindFromPath(subpath, packageType);\n }\n\n const main =\n typeof packageJson.main === 'string' ? packageJson.main : 'index.js';\n return inferModuleKindFromPath(main, packageType);\n};\n\nexport const createNodeModuleKindResolver = () => {\n const packageJsonCache = new Map<string, Record<string, unknown> | null>();\n const resolveCache = new Map<string, ModuleInteropKind>();\n\n return async (\n specifier: string,\n importer: string\n ): Promise<ModuleInteropKind> => {\n if (!isBareSpecifier(specifier)) {\n return 'unknown';\n }\n\n const importerPath = stripQuery(importer);\n const importerDir = dirname(importerPath);\n const { packageName, subpath } = parsePackageName(specifier);\n const packageJsonPath = findPackageJsonPath(packageName, importerDir);\n if (!packageJsonPath) {\n return 'unknown';\n }\n\n const cacheKey = `${packageJsonPath}:${subpath}`;\n const cached = resolveCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n let packageJson = packageJsonCache.get(packageJsonPath);\n if (packageJson === undefined) {\n packageJson = (await readPackageJson(packageJsonPath)) ?? null;\n packageJsonCache.set(packageJsonPath, packageJson);\n }\n if (!packageJson) {\n resolveCache.set(cacheKey, 'unknown');\n return 'unknown';\n }\n\n const resolved = resolveModuleKindFromPackage(packageJson, subpath);\n resolveCache.set(cacheKey, resolved);\n return resolved;\n };\n};\n\nexport const scanHasDefaultImport = (\n ts: typeof import('typescript'),\n code: string\n): boolean => {\n const scanner = ts.createScanner(\n ts.ScriptTarget.ESNext,\n true,\n ts.LanguageVariant.Standard,\n code\n );\n let token = scanner.scan();\n while (token !== ts.SyntaxKind.EndOfFileToken) {\n if (token === ts.SyntaxKind.ImportKeyword) {\n const next = scanner.scan();\n if (next === ts.SyntaxKind.OpenParenToken) {\n token = scanner.scan();\n continue;\n }\n if (\n next === ts.SyntaxKind.Identifier ||\n next === ts.SyntaxKind.TypeKeyword\n ) {\n return true;\n }\n }\n token = scanner.scan();\n }\n return false;\n};\n\n// This feature is implemented in a somewhat tricky two-step process:\n//\n// Vite's `transform()` is responsible for formatting the code sent to the subsequent 'rollup.'\n// While it enables various code transformations, at this stage, it does not distinguish whether the target code is intended for CJS or ESM.\n// This is because 'rollup' handles that distinction later, and `transform()` performs a single optimization to format the common code base.\n// However, the default import fixup must distinguish between CJS and ESM.\n//\n// Therefore, in Step 1, we always insert `__resolveDefaultExport` as a commonly used function.\n// Within it, we reference a global flag name derived from the source file path and\n// insert `globalThis.__screwUpIsInCJS_<id> = false;` as a placeholder.\n// This allows `renderChunk()` (Step 2) to flip it to `true` only for CJS output chunks,\n// while keeping the code length stable.\n//\n// We avoid performing all processing in the `renderChunk()` because at that stage, we would be referencing post-transpiled code.\n// This prevents the use of a simple replacement process and carries the risk of code transformation failure.\n\nconst cjsInteropGlobalFlagPrefix = '__screwUpIsInCJS_';\nconst cjsInteropIdLength = 12;\nconst cjsInteropGlobalFlagAssignmentPattern = new RegExp(\n `\\\\bglobalThis\\\\.${cjsInteropGlobalFlagPrefix}[0-9a-f]+\\\\s*=\\\\s*false\\\\b`,\n 'g'\n);\n\nconst createCjsInteropHelperId = (seed: string): string => {\n const hash = createHash('sha256').update(seed).digest('hex');\n return hash.slice(0, cjsInteropIdLength);\n};\n\nconst buildHelperFunctionSource = (helperId: string): string => `\nglobalThis.${cjsInteropGlobalFlagPrefix}${helperId} = false;\nfunction __resolveDefaultExport<T>(module: T | { default?: T }, isESM: boolean): T {\n const __isInCJS =\n typeof globalThis !== 'undefined' &&\n (globalThis as any).${cjsInteropGlobalFlagPrefix}${helperId} === true;\n const maybe = module as { default?: T };\n const hasDefault = !!(maybe && typeof maybe === 'object' && 'default' in maybe);\n const unwrapNamespaceDefault = (value: unknown): unknown => {\n if (!value || typeof value !== 'object') {\n return value;\n }\n const inner = value as any;\n const isModule =\n inner.__esModule === true ||\n (typeof Symbol !== 'undefined' &&\n (inner as any)[Symbol.toStringTag] === 'Module');\n if (isModule && 'default' in inner) {\n return inner.default;\n }\n return value;\n };\n const resolvedDefault = hasDefault\n ? unwrapNamespaceDefault((maybe as any).default)\n : undefined;\n\n if (__isInCJS) {\n return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);\n }\n\n if (isESM) {\n if (hasDefault) {\n return resolvedDefault as T;\n }\n throw new Error('Default export not found.');\n }\n\n return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);\n}`;\n\nexport const injectCjsInteropFlag = (\n code: string\n): { code: string; changed: boolean } => {\n let changed = false;\n const nextCode = code.replace(\n cjsInteropGlobalFlagAssignmentPattern,\n (match) => {\n changed = true;\n // Preserve length to keep sourcemaps stable without remapping.\n return match.replace(/\\bfalse\\b/, 'true ');\n }\n );\n return { code: nextCode, changed };\n};\n\nconst hasResolveDefaultExport = (\n ts: typeof import('typescript'),\n sourceFile: import('typescript').SourceFile\n): boolean => {\n return sourceFile.statements.some((statement) => {\n if (ts.isFunctionDeclaration(statement)) {\n return statement.name?.text === '__resolveDefaultExport';\n }\n if (ts.isVariableStatement(statement)) {\n return statement.declarationList.declarations.some((declaration) => {\n return (\n ts.isIdentifier(declaration.name) &&\n declaration.name.text === '__resolveDefaultExport'\n );\n });\n }\n if (ts.isImportDeclaration(statement)) {\n const importClause = statement.importClause;\n if (!importClause) {\n return false;\n }\n if (importClause.name?.text === '__resolveDefaultExport') {\n return true;\n }\n if (importClause.namedBindings) {\n if (ts.isNamespaceImport(importClause.namedBindings)) {\n return (\n importClause.namedBindings.name.text === '__resolveDefaultExport'\n );\n }\n if (ts.isNamedImports(importClause.namedBindings)) {\n return importClause.namedBindings.elements.some(\n (element) =>\n element.name.text === '__resolveDefaultExport' ||\n element.propertyName?.text === '__resolveDefaultExport'\n );\n }\n }\n }\n return false;\n });\n};\n\nconst isTypeOnlyImportClause = (\n ts: typeof import('typescript'),\n importClause: import('typescript').ImportClause\n): boolean => {\n const phaseModifier = (importClause as { phaseModifier?: number })\n .phaseModifier;\n if (phaseModifier !== undefined) {\n return phaseModifier === ts.SyntaxKind.TypeKeyword;\n }\n return Boolean((importClause as { isTypeOnly?: boolean }).isTypeOnly);\n};\n\nconst getScriptKind = (\n ts: typeof import('typescript'),\n id: string\n): import('typescript').ScriptKind => {\n if (id.endsWith('.tsx')) {\n return ts.ScriptKind.TSX;\n }\n if (id.endsWith('.jsx')) {\n return ts.ScriptKind.JSX;\n }\n if (id.endsWith('.mts')) {\n const mts = (ts.ScriptKind as unknown as Record<string, number>)['MTS'];\n return mts ?? ts.ScriptKind.TS;\n }\n if (id.endsWith('.cts')) {\n const cts = (ts.ScriptKind as unknown as Record<string, number>)['CTS'];\n return cts ?? ts.ScriptKind.TS;\n }\n if (id.endsWith('.ts')) {\n return ts.ScriptKind.TS;\n }\n if (id.endsWith('.mjs')) {\n return ts.ScriptKind.JS;\n }\n if (id.endsWith('.cjs')) {\n return ts.ScriptKind.JS;\n }\n return ts.ScriptKind.JS;\n};\n\nconst formatModuleSpecifier = (specifier: string): string => {\n const escaped = specifier.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\");\n return `'${escaped}'`;\n};\n\nconst buildNamedImport = (\n moduleName: string,\n namedBindings: import('typescript').NamedImports\n): string => {\n const elements = namedBindings.elements\n .map((specifier) => {\n const alias = specifier.propertyName\n ? `${specifier.propertyName.text} as ${specifier.name.text}`\n : specifier.name.text;\n return specifier.isTypeOnly ? `type ${alias}` : alias;\n })\n .join(', ');\n return `import { ${elements} } from ${formatModuleSpecifier(moduleName)};`;\n};\n\nexport const transformDefaultImports = async (\n ts: typeof import('typescript'),\n code: string,\n id: string,\n resolveModuleKind: (\n specifier: string,\n importer: string\n ) => Promise<ModuleInteropKind>\n): Promise<{ code: string; changed: boolean }> => {\n const normalizedId = stripQuery(id);\n const sourceFile = ts.createSourceFile(\n normalizedId,\n code,\n ts.ScriptTarget.ESNext,\n false,\n getScriptKind(ts, normalizedId)\n );\n\n const edits: Array<{ start: number; end: number; text: string }> = [];\n let needsHelper = false;\n const helperPresent = hasResolveDefaultExport(ts, sourceFile);\n let namespaceIndex = 0;\n\n const usedNamespace = (base: string): string => {\n let candidate = `${base}${namespaceIndex}`;\n while (code.includes(candidate)) {\n namespaceIndex += 1;\n candidate = `${base}${namespaceIndex}`;\n }\n namespaceIndex += 1;\n return candidate;\n };\n\n for (const statement of sourceFile.statements) {\n if (!ts.isImportDeclaration(statement)) {\n continue;\n }\n const importClause = statement.importClause;\n if (!importClause || !importClause.name) {\n continue;\n }\n if (isTypeOnlyImportClause(ts, importClause)) {\n continue;\n }\n if (!ts.isStringLiteral(statement.moduleSpecifier)) {\n continue;\n }\n const moduleName = statement.moduleSpecifier.text;\n const moduleKind = await resolveModuleKind(moduleName, normalizedId);\n if (moduleKind === 'unknown' || moduleKind === 'unresolvable') {\n continue;\n }\n const isESM = moduleKind === 'esm';\n const isCJS = moduleKind === 'cjs';\n\n const defaultName = importClause.name.text;\n const replacementImports: string[] = [];\n let namespaceName: string | undefined;\n let defaultImportName: string | undefined;\n\n if (\n importClause.namedBindings &&\n ts.isNamespaceImport(importClause.namedBindings)\n ) {\n namespaceName = importClause.namedBindings.name.text;\n replacementImports.push(\n `import * as ${namespaceName} from ${formatModuleSpecifier(moduleName)};`\n );\n } else if (isCJS) {\n defaultImportName = usedNamespace('__screwUpDefaultImportModule');\n replacementImports.push(\n `import ${defaultImportName} from ${formatModuleSpecifier(moduleName)};`\n );\n if (\n importClause.namedBindings &&\n ts.isNamedImports(importClause.namedBindings)\n ) {\n replacementImports.push(\n buildNamedImport(moduleName, importClause.namedBindings)\n );\n }\n } else {\n namespaceName = usedNamespace('__screwUpDefaultImportModule');\n replacementImports.push(\n `import * as ${namespaceName} from ${formatModuleSpecifier(moduleName)};`\n );\n if (\n importClause.namedBindings &&\n ts.isNamedImports(importClause.namedBindings)\n ) {\n replacementImports.push(\n buildNamedImport(moduleName, importClause.namedBindings)\n );\n }\n }\n\n const interopSource = namespaceName ?? defaultImportName;\n const replacement =\n `${replacementImports.join('\\n')}\\n` +\n `const ${defaultName} = __resolveDefaultExport(${interopSource}, ${isESM});`;\n\n edits.push({\n start: statement.getStart(sourceFile),\n end: statement.getEnd(),\n text: replacement,\n });\n needsHelper = true;\n }\n\n if (edits.length === 0) {\n return { code, changed: false };\n }\n\n if (needsHelper && !helperPresent) {\n const importStatements = sourceFile.statements.filter(\n ts.isImportDeclaration\n );\n const lastImport = importStatements[importStatements.length - 1];\n if (lastImport) {\n const newline = code.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const helperId = createCjsInteropHelperId(normalizedId);\n edits.push({\n start: lastImport.getEnd(),\n end: lastImport.getEnd(),\n text: `${newline}${buildHelperFunctionSource(helperId)}${newline}`,\n });\n }\n }\n\n edits.sort((a, b) => b.start - a.start);\n let nextCode = code;\n for (const edit of edits) {\n nextCode =\n nextCode.slice(0, edit.start) + edit.text + nextCode.slice(edit.end);\n }\n\n return { code: nextCode, changed: true };\n};\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\nimport type { Plugin } from 'vite';\nimport type {\n NormalizedOutputOptions,\n OutputAsset,\n OutputChunk,\n OutputOptions,\n} from 'rolldown';\nimport { readFile, writeFile, readdir } from 'fs/promises';\nimport { existsSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { createMutex } from 'async-primitives';\n\nimport { git_commit_hash, name, version } from './generated/packageMetadata';\nimport { resolvePackageMetadata, createConsoleLogger } from './internal';\nimport { ScrewUpOptions, PackageMetadata } from './types';\nimport { getFetchGitMetadata } from './analyzer';\nimport {\n createNodeModuleKindResolver,\n injectCjsInteropFlag,\n scanHasDefaultImport,\n transformDefaultImports,\n} from './default-import-fix';\nimport {\n ensureMetadataGitignore,\n generateMetadataFileContent,\n writeFileIfChanged,\n} from './metadata-file';\n\n//////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Generate banner string from package.json metadata\n * @param metadata - Package metadata\n * @param outputKeys - Array of keys to output in specified order\n * @returns Banner string\n */\nexport const generateBanner = (\n metadata: PackageMetadata,\n outputKeys: readonly string[]\n): string => {\n const parts: string[] = [];\n\n for (const key of outputKeys) {\n const value = metadata[key];\n if (value) {\n parts.push(`${key}: ${value}`);\n }\n }\n\n return parts.length > 0 ? `/*!\\n * ${parts.join('\\n * ')}\\n */` : '';\n};\n\n/**\n * Insert banner header at appropriate position considering shebang\n * @param content - The content to insert banner into\n * @param banner - The banner header to insert\n * @returns Content with banner header inserted\n */\nconst insertBannerHeader = (content: string, banner: string): string => {\n const lines = content.split('\\n');\n\n // Check if first line is shebang\n if (lines.length > 0 && lines[0].startsWith('#!')) {\n // Insert banner after shebang line\n return lines[0] + '\\n' + banner + '\\n' + lines.slice(1).join('\\n');\n } else {\n // Insert banner at the beginning\n return banner + '\\n' + content;\n }\n};\n\n/**\n * Split a leading shebang from content, keeping the shebang line with newline.\n */\nconst splitShebang = (content: string): { shebang: string; rest: string } => {\n if (!content.startsWith('#!')) {\n return { shebang: '', rest: content };\n }\n const newlineIndex = content.indexOf('\\n');\n if (newlineIndex === -1) {\n return { shebang: `${content}\\n`, rest: '' };\n }\n return {\n shebang: content.slice(0, newlineIndex + 1),\n rest: content.slice(newlineIndex + 1),\n };\n};\n\n/**\n * Adds a trailing newline to the banner text when needed so subsequent\n * concatenations do not collapse onto the last line.\n */\nconst ensureTrailingNewline = (value: string, newline: string): string =>\n value.endsWith(newline) ? value : value + newline;\n\n/**\n * Merge screw-up's metadata banner with an existing Rollup banner, keeping any\n * shebang line at the very top and preventing duplicate metadata blocks.\n */\nconst mergeBanners = (\n currentBanner: string,\n existingBanner: string\n): string => {\n if (!currentBanner) {\n return existingBanner;\n }\n if (!existingBanner) {\n return currentBanner;\n }\n\n if (existingBanner.includes(currentBanner)) {\n return existingBanner;\n }\n\n // Preserve shebang at the very top while sliding the metadata banner underneath it.\n const shebangMatch = existingBanner.match(/^(#![^\\r\\n]*)(\\r?\\n)?([\\s\\S]*)$/);\n if (shebangMatch) {\n const [, shebangLine, newlineSeq = '\\n', rest = ''] = shebangMatch;\n if (rest.startsWith(currentBanner)) {\n return existingBanner;\n }\n const currentWithNewline = ensureTrailingNewline(currentBanner, newlineSeq);\n if (rest.length === 0) {\n return `${shebangLine}${newlineSeq}${currentWithNewline}`;\n }\n return `${shebangLine}${newlineSeq}${currentWithNewline}${rest}`;\n }\n\n // Default path: prepend metadata banner before the previous banner content.\n const newlineSeq = existingBanner.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const currentWithNewline = ensureTrailingNewline(currentBanner, newlineSeq);\n return `${currentWithNewline}${existingBanner}`;\n};\n\n/**\n * Count how many newline characters exist in the banner block.\n * The result equals the line delta that needs to be applied to sourcemaps.\n */\nconst countInsertedLines = (bannerWithTrailingNewline: string): number => {\n return bannerWithTrailingNewline.split('\\n').length - 1;\n};\n\n/**\n * Convert asset payloads to UTF-8 strings to simplify sourcemap adjustments.\n */\nconst stringifyAssetSource = (source: string | Uint8Array): string =>\n typeof source === 'string' ? source : Buffer.from(source).toString('utf-8');\n\n/**\n * Prepend the specified number of empty lines to a sourcemap by adding semicolons\n * at the beginning of the VLQ mappings string.\n * @returns Updated sourcemap JSON string, or undefined if no change is needed.\n */\nconst applyLineOffsetToSourceMap = (\n source: string | Uint8Array,\n lineOffset: number\n): string | undefined => {\n if (lineOffset <= 0) {\n return undefined;\n }\n\n const original = stringifyAssetSource(source);\n let map: any;\n try {\n map = JSON.parse(original);\n } catch {\n return undefined;\n }\n\n if (!map || typeof map.mappings !== 'string') {\n return undefined;\n }\n\n const prefix = ';'.repeat(lineOffset);\n if (map.mappings.startsWith(prefix)) {\n return undefined;\n }\n\n map.mappings = prefix + map.mappings;\n const serialized = JSON.stringify(map);\n return original.endsWith('\\n') ? `${serialized}\\n` : serialized;\n};\n\n/**\n * Prepend empty lines to sourcemap objects for chunk outputs.\n */\nconst applyLineOffsetToSourceMapObject = (\n map: any,\n lineOffset: number\n): void => {\n if (!map || lineOffset <= 0 || typeof map.mappings !== 'string') {\n return;\n }\n const prefix = ';'.repeat(lineOffset);\n if (map.mappings.startsWith(prefix)) {\n return;\n }\n map.mappings = prefix + map.mappings;\n};\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Vite plugin that adds banner to the bundled code\n * @param options - Plugin options\n * @returns Vite plugin\n */\nexport const screwUp = (options: ScrewUpOptions = {}): Plugin => {\n const {\n fixDefaultImport = true,\n outputKeys = [\n 'name',\n 'version',\n 'description',\n 'author',\n 'license',\n 'repository.url',\n 'git.commit.hash',\n ],\n assetFilters = ['\\\\.d\\\\.ts$'],\n outputMetadataFile = false,\n outputMetadataFilePath = 'src/generated/packageMetadata.ts',\n outputMetadataKeys = [\n 'name',\n 'version',\n 'description',\n 'author',\n 'license',\n 'repository.url',\n 'git.commit.hash',\n ],\n checkWorkingDirectoryStatus = true,\n alwaysOverrideVersionFromGit = true,\n insertMetadataBanner = true,\n } = options;\n\n const assetFiltersRegex = assetFilters.map((filter) => new RegExp(filter));\n const generateMetadataSourceLocker = createMutex();\n const resolveModuleKind = createNodeModuleKindResolver();\n let typescriptPromise:\n | Promise<typeof import('typescript') | undefined>\n | undefined;\n\n const loggerPrefix = `${name}-vite`;\n let logger = createConsoleLogger(loggerPrefix);\n let banner = '';\n let metadata: any;\n let projectRoot: string;\n let fetchGitMetadata = () => Promise.resolve<any>({});\n\n const loadTypeScript = async () => {\n if (!typescriptPromise) {\n typescriptPromise = import('typescript').catch(() => undefined);\n }\n return typescriptPromise;\n };\n\n const resolveOutputBanner = async (\n outputOptions: NormalizedOutputOptions,\n chunk: OutputChunk\n ): Promise<string> => {\n const outputBanner = outputOptions.banner;\n if (typeof outputBanner === 'function') {\n const resolved = await outputBanner(chunk);\n return resolved ?? banner ?? '';\n }\n return outputBanner ?? banner ?? '';\n };\n\n // Generate and write metadata TypeScript file\n const generateMetadataSourceFiles = async () => {\n // Resolve package metadata\n const result = await resolvePackageMetadata(\n projectRoot,\n fetchGitMetadata,\n alwaysOverrideVersionFromGit,\n logger\n );\n metadata = result.metadata;\n // Regenerate banner with updated metadata\n banner = generateBanner(metadata, outputKeys);\n if (outputMetadataFile) {\n const metadataSourceContent = generateMetadataFileContent(\n metadata,\n outputMetadataKeys\n );\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n const metadataWritten = await writeFileIfChanged(\n metadataSourcePath,\n metadataSourceContent,\n 'metadata source file',\n logger\n );\n if (existsSync(metadataSourcePath)) {\n const gitignoreWritten = await ensureMetadataGitignore(\n metadataSourcePath,\n logger\n );\n if (gitignoreWritten) {\n logger.info(\n `generateMetadataSourceFile: .gitignore is generated: ${join(\n dirname(outputMetadataFilePath),\n '.gitignore'\n )}`\n );\n }\n }\n return metadataWritten;\n }\n return false;\n };\n\n // Generate dummy metadata TypeScript file with empty string values\n const generateMetadataFileFromKeys = async (keys: readonly string[]) => {\n if (outputMetadataFile) {\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n // Only generate if file doesn't exist (don't overwrite existing files)\n if (!existsSync(metadataSourcePath)) {\n // Create dummy metadata with empty strings for all keys\n const dummyMetadata: any = {};\n keys.forEach((key) => {\n dummyMetadata[key] = '[Require first build]';\n });\n const dummyContent = generateMetadataFileContent(dummyMetadata, keys);\n return await writeFileIfChanged(\n metadataSourcePath,\n dummyContent,\n 'dummy metadata source file',\n logger\n );\n }\n }\n return false;\n };\n\n return {\n name: 'screw-up',\n // Ensure screw-up runs before other plugins\n // (especially vite-plugin-dts, avoid packageMetadata.ts is not found)\n enforce: 'pre',\n // Plugin starting\n applyToEnvironment: async (penv) => {\n // Prime metadata generation once so dependent files are ready immediately\n logger.info(`${version}-${git_commit_hash}: Started.`);\n\n // Partial (but maybe exact) project root\n projectRoot = penv.config.root;\n\n // Generate dummy metadata source file to prevent import errors on initial build\n if (\n projectRoot &&\n (await generateMetadataFileFromKeys(outputMetadataKeys))\n ) {\n logger.info(\n `applyToEnvironment: Dummy metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n\n return true;\n },\n // Build configuration phase\n config: (config) => {\n // When banner injection is disabled, leave rollup output untouched\n if (!insertMetadataBanner) {\n return;\n }\n\n config.build ??= {};\n const rolldownOptions = (config.build.rolldownOptions ??= {});\n // Normalize rollup outputs to an array so we can inject a banner even when empty\n const ensureOutputs = (): OutputOptions[] => {\n // Consumer already supplied an array of outputs (possibly empty)\n if (Array.isArray(rolldownOptions.output)) {\n const outputs = rolldownOptions.output as OutputOptions[];\n // Array exists but contains no entry yet; create one lazily\n if (outputs.length === 0) {\n const output: OutputOptions = {};\n outputs.push(output);\n return outputs;\n }\n outputs.forEach((output, index) => {\n // Array slot is nullish (user emptied it); replace with object to keep consistent\n if (!output) {\n outputs[index] = {};\n }\n });\n return outputs;\n }\n\n // Single output object was provided; wrap it to unify processing\n if (rolldownOptions.output) {\n return [rolldownOptions.output as OutputOptions];\n }\n\n // No output specified at all; create placeholder so banner hook can run\n const output: OutputOptions = {};\n rolldownOptions.output = output;\n return [output];\n };\n\n const outputs = ensureOutputs();\n\n outputs.forEach((output) => {\n const previousBanner = output.banner;\n // Preserve any existing banner configuration and append ours later in order\n const resolvePreviousBanner = async (chunk: any) => {\n // User provided banner as function; resolve it per chunk for compatibility\n if (typeof previousBanner === 'function') {\n const resolved = await previousBanner(chunk);\n return resolved ?? '';\n }\n return previousBanner ?? '';\n };\n\n output.banner = async (chunk: any) => {\n const existingBanner = await resolvePreviousBanner(chunk);\n const currentBanner = banner ?? '';\n return mergeBanners(currentBanner, existingBanner);\n };\n });\n },\n transform: async (code, id) => {\n if (!fixDefaultImport || !id || id.includes('\\0')) {\n return;\n }\n const cleanId = id.split('?')[0];\n if (cleanId.includes('node_modules')) {\n return;\n }\n if (\n cleanId.endsWith('.d.ts') ||\n cleanId.endsWith('.d.mts') ||\n cleanId.endsWith('.d.cts')\n ) {\n return;\n }\n if (!/\\.(?:[cm]?[jt]sx?|[cm]js)$/.test(cleanId)) {\n return;\n }\n\n const ts = await loadTypeScript();\n if (!ts) {\n return;\n }\n const hasDefaultImport = scanHasDefaultImport(ts, code);\n if (cleanId.includes('/src/') || cleanId.includes('\\\\src\\\\')) {\n logger.debug(\n `[fixDefaultImport] scan ${cleanId}: ${\n hasDefaultImport ? 'hit' : 'miss'\n }`\n );\n }\n if (!hasDefaultImport) {\n return;\n }\n\n const result = await transformDefaultImports(\n ts,\n code,\n cleanId,\n resolveModuleKind\n );\n if (result.changed) {\n return {\n code: result.code,\n map: null,\n };\n }\n },\n // Configuration resolved phase\n configResolved: async (config) => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n // Enable debug logging for performance analysis\n const tempEnableLogging = true;\n\n // Save project root\n projectRoot = config.root;\n if (tempEnableLogging || config?.logger) {\n logger = createConsoleLogger(loggerPrefix, config.logger);\n } else if (config?.customLogger) {\n logger = createConsoleLogger(loggerPrefix, config.customLogger);\n }\n\n logger.debug(`configResolved: Started.`);\n // Get Git metadata fetcher function\n fetchGitMetadata = getFetchGitMetadata(\n projectRoot,\n checkWorkingDirectoryStatus,\n logger\n );\n // Refresh banner string and generated files before TypeScript compilation kicks in\n // Generate metadata TypeScript file early to ensure it's available during TypeScript compilation\n if (await generateMetadataSourceFiles()) {\n logger.info(\n `configResolved: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`configResolved: Exited.`);\n l.release();\n }\n },\n // Server hook\n configureServer: async (server) => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n logger.debug(`configureServer: Started.`);\n\n // Exclude generated metadata file from watcher to prevent infinite loop\n // Metadata file output is enabled and watcher is present; unwatch to avoid churn\n if (outputMetadataFile && server.watcher) {\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n // Use unwatch to exclude the file from being watched\n server.watcher.unwatch(metadataSourcePath);\n logger.debug(\n `configureServer: Excluded from watcher: ${outputMetadataFilePath}`\n );\n }\n\n // Rebuild banner metadata on dev server startup to keep values fresh\n if (await generateMetadataSourceFiles()) {\n logger.info(\n `configureServer: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`configureServer: Exited.`);\n l.release();\n }\n },\n // Build start phase\n buildStart: async () => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n logger.debug(`buildStart: Started.`);\n // Re-resolve package metadata to capture any changes since configResolved\n // Update metadata TypeScript file with latest data\n if (await generateMetadataSourceFiles()) {\n logger.info(\n `buildStart: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`buildStart: Exited.`);\n l.release();\n }\n },\n renderChunk: (code, chunk, outputOptions) => {\n if (!fixDefaultImport || outputOptions.format !== 'cjs') {\n return null;\n }\n const result = injectCjsInteropFlag(code);\n if (!result.changed) {\n return null;\n }\n return { code: result.code, map: null };\n },\n // Generate bundle phase\n generateBundle: {\n order: 'post',\n handler: async (_outputOptions, bundle) => {\n // Rolldown applies JS chunk banners natively, so only patch assets that\n // are emitted outside that path (for example declaration files).\n if (insertMetadataBanner) {\n let assetCount = 0;\n for (const fileName in bundle) {\n const chunk = bundle[fileName];\n if (\n // Only treat assets that match filters; JS chunks already handled via rollup banner\n chunk.type === 'asset' &&\n assetFiltersRegex.some((filter) => filter.test(fileName))\n ) {\n if (typeof chunk.source === 'string') {\n // Assets are not covered by rollup banner injection, so prepend manually\n const bannerBlock = `${banner}\\n`;\n // Insert banner while preserving shebang semantics and capture line delta for maps\n chunk.source = insertBannerHeader(chunk.source, bannerBlock); // insert more blank line\n const lineOffset = countInsertedLines(bannerBlock);\n\n const mapFileName = `${fileName}.map`;\n const mapAsset = bundle[mapFileName] as OutputAsset | undefined;\n if (\n mapAsset &&\n mapAsset.type === 'asset' &&\n mapAsset.source !== undefined\n ) {\n // Rewrite the sourcemap mappings so declaration lines still map back correctly\n const adjusted = applyLineOffsetToSourceMap(\n mapAsset.source,\n lineOffset\n );\n if (adjusted !== undefined) {\n mapAsset.source = adjusted;\n }\n }\n assetCount++;\n }\n }\n }\n if (assetCount >= 1) {\n logger.debug(\n `generateBundle: Banner header inserted: ${assetCount} file(s)`\n );\n }\n }\n },\n },\n // Write bundle phase\n writeBundle: async (options) => {\n // Handle files written by other plugins (like vite-plugin-dts) if banner insertion is enabled\n if (!insertMetadataBanner || !options.dir) return;\n\n try {\n // Read all files in the output directory\n const files = await readdir(options.dir, { recursive: true });\n\n // Iterate over all files\n let count = 0;\n for (const file of files) {\n const filePath = join(options.dir, file);\n\n // Check if the file is target asset file\n // Apply banner only to filtered assets in post-write stage\n if (assetFiltersRegex.some((filter) => filter.test(file))) {\n try {\n // Read the asset file\n const content = await readFile(filePath, 'utf-8');\n // Append banner to the asset file if it doesn't already contain it\n if (!content.includes(banner)) {\n // Backfill banners onto assets emitted by other plugins as well\n const bannerBlock = `${banner}\\n`;\n await writeFile(\n filePath,\n insertBannerHeader(content, bannerBlock)\n );\n\n const lineOffset = countInsertedLines(bannerBlock);\n const mapPath = `${filePath}.map`;\n try {\n const mapContent = await readFile(mapPath, 'utf-8');\n // Align existing .d.ts.map files so consumer toolchains see accurate positions\n const adjusted = applyLineOffsetToSourceMap(\n mapContent,\n lineOffset\n );\n if (adjusted !== undefined) {\n await writeFile(mapPath, adjusted);\n }\n } catch {\n // Declarations without sourcemap can be safely ignored\n }\n count++;\n }\n } catch (error) {\n // Skip files that can't be read/written\n }\n }\n }\n if (count >= 1) {\n logger.debug(`writeBundle: Banner header inserted: ${count} file(s)`);\n }\n } catch (error) {\n // Skip files that can't be read/written\n }\n },\n };\n};\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\nimport { screwUp } from './vite-plugin';\n\n//////////////////////////////////////////////////////////////////////////////////\n\n// Expose screw-up Vite plugin\n\nexport * from './types';\nexport default screwUp;\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAM,uBAAuB;AAE7B,IAAM,oBAAoB;CACxB,SAAS;EACR,OAAO,UAAU;CACnB;AACD,IAAM,gBAAgB,WAAW;AAC/B,KAAI,kBAAkB,MACpB,QAAO;AAET,KAAI,OAAO,WAAW,SACpB,QAAO,IAAI,MAAM,OAAO;AAE1B,wBAAO,IAAI,MAAM,oBAAoB;;AAEvC,IAAM,WAAW,QAAQ,aAAa;AACpC,KAAI,CAAC,OACH,QAAO;AAET,KAAI,OAAO,SAAS;AAClB,MAAI;AACF,YAAS,aAAa,OAAO,OAAO,CAAC;WAC9B,OAAO;AACd,WAAQ,KAAK,8BAA8B,MAAM;;AAEn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ACL,2CAA2C,WAAW,UACvD;;;GAIR;EAED,aAAa,OAAO,YAAY;AAE9B,OAAI,CAAC,wBAAwB,CAAC,QAAQ,IAAK;AAE3C,OAAI;IAEF,MAAM,QAAQ,MAAM,QAAQ,QAAQ,KAAK,EAAE,WAAW,MAAM,CAAC;IAG7D,IAAI,QAAQ;AACZ,SAAK,MAAM,QAAQ,OAAO;KACxB,MAAM,WAAW,KAAK,QAAQ,KAAK,KAAK;AAIxC,SAAI,kBAAkB,MAAM,WAAW,OAAO,KAAK,KAAK,CAAC,CACvD,KAAI;MAEF,MAAM,UAAU,MAAM,SAAS,UAAU,QAAQ;AAEjD,UAAI,CAAC,QAAQ,SAAS,OAAO,EAAE;OAE7B,MAAM,cAAc,GAAG,OAAO;AAC9B,aAAM,UACJ,UACA,mBAAmB,SAAS,YAAY,CACzC;OAED,MAAM,aAAa,mBAAmB,YAAY;OAClD,MAAM,UAAU,GAAG,SAAS;AAC5B,WAAI;QAGF,MAAM,WAAW,2BAFE,MAAM,SAAS,SAAS,QAAQ,EAIjD,WACD;AACD,YAAI,aAAa,KAAA,EACf,OAAM,UAAU,SAAS,SAAS;0BAE9B;AAGR;;cAEK,OAAO;;AAKpB,QAAI,SAAS,EACX,QAAO,MAAM,wCAAwC,MAAM,UAAU;YAEhE,OAAO;;EAInB;;;;ACtpBH,IAAA,cAAe"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../node_modules/async-primitives/dist/index.mjs","../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs","../src/text-edits.ts","../src/declaration-import-fix.ts","../src/default-import-fix.ts","../src/vite-plugin.ts","../src/index.ts"],"sourcesContent":["/*!\n* name: async-primitives\n* version: 1.7.0\n* description: A collection of primitive functions for asynchronous operations\n* author: Kouji Matsui (@kekyo@mi.kekyo.net)\n* license: MIT\n* repository.url: https://github.com/kekyo/async-primitives.git\n* git.commit.hash: 9472fbd5310b92690d84aaafb897429a04c013c5\n*/\n//#region src/primitives/internal/utils.ts\n/**\n* A no-op Releasable object that does nothing when released or disposed\n*/\nvar __NOOP_HANDLER = () => {};\nvar __NOOP_RELEASABLE = {\n\trelease: __NOOP_HANDLER,\n\t[Symbol.dispose]: __NOOP_HANDLER\n};\n//#endregion\n//#region src/primitives/abort-hook.ts\nvar toAbortError = (reason) => {\n\tif (reason instanceof Error) return reason;\n\tif (typeof reason === \"string\") return new Error(reason);\n\treturn /* @__PURE__ */ new Error(\"Operation aborted\");\n};\n/**\n* Hooks up an abort handler to an AbortSignal and returns a handle for early cleanup\n* @param signal - The AbortSignal to hook up to\n* @param callback - The callback to call when the signal is aborted\n* @returns A Releasable handle that can be used to remove the abort listener early\n*/\nvar onAbort = (signal, callback) => {\n\tif (!signal) return __NOOP_RELEASABLE;\n\tif (signal.aborted) {\n\t\ttry {\n\t\t\tcallback(toAbortError(signal.reason));\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"AbortHook callback error: \", error);\n\t\t}\n\t\treturn __NOOP_RELEASABLE;\n\t}\n\tlet abortHandler = () => {\n\t\tif (abortHandler) {\n\t\t\tconst reason = signal.reason;\n\t\t\tsignal.removeEventListener(\"abort\", abortHandler);\n\t\t\tabortHandler = void 0;\n\t\t\ttry {\n\t\t\t\tcallback(toAbortError(reason));\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn(\"AbortHook callback error: \", error);\n\t\t\t}\n\t\t}\n\t};\n\tconst release = () => {\n\t\tif (abortHandler) {\n\t\t\tsignal.removeEventListener(\"abort\", abortHandler);\n\t\t\tabortHandler = void 0;\n\t\t}\n\t};\n\tsignal.addEventListener(\"abort\", abortHandler, { once: true });\n\treturn {\n\t\trelease,\n\t\t[Symbol.dispose]: release\n\t};\n};\n//#endregion\n//#region src/primitives/delay.ts\n/**\n* Helper function to create a delay\n* @param msec - The number of milliseconds to delay\n* @param signal - Optional AbortSignal to cancel the delay\n* @returns A promise that resolves after the delay or rejects if aborted\n*/\nvar delay = (msec, signal) => {\n\tif (signal) {\n\t\tif (signal.aborted) throw new Error(\"Delay was aborted\");\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst abortHandle = onAbort(signal, () => {\n\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\treject(/* @__PURE__ */ new Error(\"Delay was aborted\"));\n\t\t\t});\n\t\t\tconst timeoutId = setTimeout(() => {\n\t\t\t\tabortHandle.release();\n\t\t\t\tresolve();\n\t\t\t}, msec);\n\t\t});\n\t} else return new Promise((resolve) => {\n\t\tsetTimeout(resolve, msec);\n\t});\n};\n//#endregion\n//#region src/primitives/defer.ts\nvar runtimeGlobal$1 = globalThis;\nvar defer = (fn) => {\n\tconst setImmediateHandler = runtimeGlobal$1.setImmediate;\n\tif (typeof setImmediateHandler === \"function\") {\n\t\tsetImmediateHandler(fn);\n\t\treturn;\n\t}\n\tglobalThis.setTimeout(fn, 0);\n};\n//#endregion\n//#region src/primitives/mutex.ts\nvar ABORTED_ERROR$2 = () => /* @__PURE__ */ new Error(\"Lock acquisition was aborted\");\n/**\n* Creates a new LockHandle instance\n* @param releaseCallback Callback function to release the lock\n* @returns A LockHandle object with release and dispose functionality\n*/\nvar createLockHandle = (releaseCallback) => {\n\tlet isActive = true;\n\tconst release = () => {\n\t\tif (!isActive) return;\n\t\tisActive = false;\n\t\treleaseCallback();\n\t};\n\treturn {\n\t\tget isActive() {\n\t\t\treturn isActive;\n\t\t},\n\t\trelease,\n\t\t[Symbol.dispose]: release\n\t};\n};\n/**\n* Creates a new Mutex instance\n* @param maxConsecutiveCalls - The maximum number of consecutive calls to the lockAsync method before yielding control to the next item in the queue\n* @returns A new Mutex for promise-based mutex operations\n*/\nvar createMutex = (maxConsecutiveCalls = 20) => {\n\tlet isLocked = false;\n\tconst queue = [];\n\tlet count = 0;\n\tconst processQueue = () => {\n\t\tvar _item$signal;\n\t\tif (isLocked || queue.length === 0) return;\n\t\tconst item = queue.shift();\n\t\tif ((_item$signal = item.signal) === null || _item$signal === void 0 ? void 0 : _item$signal.aborted) {\n\t\t\titem.reject(ABORTED_ERROR$2());\n\t\t\tscheduleNextProcess();\n\t\t\treturn;\n\t\t}\n\t\tisLocked = true;\n\t\tconst lockHandle = createLockHandle(releaseLock);\n\t\titem.resolve(lockHandle);\n\t};\n\tconst scheduleNextProcess = () => {\n\t\tcount++;\n\t\tif (count >= maxConsecutiveCalls) {\n\t\t\tcount = 0;\n\t\t\tdefer(processQueue);\n\t\t} else processQueue();\n\t};\n\tconst releaseLock = () => {\n\t\tif (!isLocked) return;\n\t\tisLocked = false;\n\t\tscheduleNextProcess();\n\t};\n\tconst removeFromQueue = (item) => {\n\t\tconst index = queue.indexOf(item);\n\t\tif (index !== -1) queue.splice(index, 1);\n\t};\n\tconst lock = async (signal) => {\n\t\tif (signal) {\n\t\t\tif (signal.aborted) throw ABORTED_ERROR$2();\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tconst queueItem = {\n\t\t\t\t\tresolve: void 0,\n\t\t\t\t\treject: void 0,\n\t\t\t\t\tsignal\n\t\t\t\t};\n\t\t\t\tconst abortHandle = onAbort(signal, () => {\n\t\t\t\t\tremoveFromQueue(queueItem);\n\t\t\t\t\treject(ABORTED_ERROR$2());\n\t\t\t\t});\n\t\t\t\tqueueItem.resolve = (handle) => {\n\t\t\t\t\tabortHandle.release();\n\t\t\t\t\tresolve(handle);\n\t\t\t\t};\n\t\t\t\tqueueItem.reject = (error) => {\n\t\t\t\t\tabortHandle.release();\n\t\t\t\t\treject(error);\n\t\t\t\t};\n\t\t\t\tqueue.push(queueItem);\n\t\t\t\tprocessQueue();\n\t\t\t});\n\t\t} else return new Promise((resolve, reject) => {\n\t\t\tqueue.push({\n\t\t\t\tresolve,\n\t\t\t\treject\n\t\t\t});\n\t\t\tprocessQueue();\n\t\t});\n\t};\n\treturn {\n\t\tlock,\n\t\twaiter: { wait: lock },\n\t\tget isLocked() {\n\t\t\treturn isLocked;\n\t\t},\n\t\tget pendingCount() {\n\t\t\treturn queue.length;\n\t\t}\n\t};\n};\n//#endregion\n//#region src/primitives/deferred.ts\n/**\n* Creates a new deferred object\n* @param T - The type of the result\n* @param signal - Optional AbortSignal for cancelling the wait\n* @returns A deferred object with a promise, resolve, and reject methods\n*/\nvar createDeferred = (signal) => {\n\tlet resolve;\n\tlet reject;\n\tconst promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\tconst disposer = onAbort(signal, () => {\n\t\tconst _reject = reject;\n\t\tif (_reject) {\n\t\t\tresolve = void 0;\n\t\t\treject = void 0;\n\t\t\t_reject(/* @__PURE__ */ new Error(\"Deferred aborted\"));\n\t\t}\n\t});\n\treturn {\n\t\tpromise,\n\t\tresolve: (value) => {\n\t\t\tconst _resolve = resolve;\n\t\t\tif (_resolve) {\n\t\t\t\tresolve = void 0;\n\t\t\t\treject = void 0;\n\t\t\t\tdisposer.release();\n\t\t\t\t_resolve(value);\n\t\t\t}\n\t\t},\n\t\treject: (error) => {\n\t\t\tconst _reject = reject;\n\t\t\tif (_reject) {\n\t\t\t\tresolve = void 0;\n\t\t\t\treject = void 0;\n\t\t\t\tdisposer.release();\n\t\t\t\t_reject(error);\n\t\t\t}\n\t\t}\n\t};\n};\n//#endregion\n//#region src/primitives/conditional.ts\nvar __NOOP_DUMMY_HANDLE = {\n\tget isActive() {\n\t\treturn false;\n\t},\n\trelease: __NOOP_HANDLER,\n\t[Symbol.dispose]: __NOOP_HANDLER\n};\n/**\n* Creates a conditional that can be automatically triggered\n* @returns A conditional that can be automatically triggered\n*/\nvar createConditional = () => {\n\tconst waiters = [];\n\tconst trigger = () => {\n\t\tif (waiters.length >= 1) waiters.shift().resolve();\n\t};\n\tconst wait = async (signal) => {\n\t\tif (signal === null || signal === void 0 ? void 0 : signal.aborted) throw new Error(\"Conditional aborted\");\n\t\tconst waiter = createDeferred();\n\t\twaiters.push(waiter);\n\t\tconst disposer = onAbort(signal, () => {\n\t\t\twaiters.splice(waiters.indexOf(waiter), 1);\n\t\t\twaiter.reject(/* @__PURE__ */ new Error(\"Conditional aborted\"));\n\t\t});\n\t\ttry {\n\t\t\tawait waiter.promise;\n\t\t} finally {\n\t\t\tdisposer.release();\n\t\t}\n\t\treturn __NOOP_DUMMY_HANDLE;\n\t};\n\treturn {\n\t\ttrigger,\n\t\twait,\n\t\twaiter: { wait }\n\t};\n};\n/**\n* Creates a conditional that can be manually set and reset\n* @param initialState - Optional initial state of the conditional (Default: false, dropped)\n* @returns A conditional that can be manually set and reset\n*/\nvar createManuallyConditional = (initialState) => {\n\tconst waiters = [];\n\tlet raised = initialState !== null && initialState !== void 0 ? initialState : false;\n\tconst trigger = () => {\n\t\traised = false;\n\t\tconst waiter = waiters.shift();\n\t\tif (waiter) {\n\t\t\twaiter.resolve();\n\t\t\traised = false;\n\t\t}\n\t};\n\tconst raise = () => {\n\t\twhile (waiters.length >= 1) {\n\t\t\traised = true;\n\t\t\twaiters.shift().resolve();\n\t\t}\n\t\traised = true;\n\t};\n\tconst drop = () => {\n\t\traised = false;\n\t};\n\tconst wait = async (signal) => {\n\t\tif (raised) return __NOOP_DUMMY_HANDLE;\n\t\tif (signal === null || signal === void 0 ? void 0 : signal.aborted) throw new Error(\"Conditional aborted\");\n\t\tconst waiter = createDeferred();\n\t\twaiters.push(waiter);\n\t\tconst disposer = onAbort(signal, () => {\n\t\t\twaiters.splice(waiters.indexOf(waiter), 1);\n\t\t\twaiter.reject(/* @__PURE__ */ new Error(\"Conditional aborted\"));\n\t\t});\n\t\ttry {\n\t\t\tawait waiter.promise;\n\t\t} finally {\n\t\t\tdisposer.release();\n\t\t}\n\t\treturn __NOOP_DUMMY_HANDLE;\n\t};\n\treturn {\n\t\ttrigger,\n\t\traise,\n\t\tdrop,\n\t\twait,\n\t\twaiter: { wait }\n\t};\n};\n//#endregion\n//#region src/primitives/deferred-generator.ts\n/**\n* Creates a new deferred generator object\n* @param T - The type of the yielded values\n* @param options - Optional options for the deferred generator\n* @returns A deferred generator object with an async generator and control functions\n*/\nvar createDeferredGenerator = (options) => {\n\tconst maxItemReserved = options === null || options === void 0 ? void 0 : options.maxItemReserved;\n\tconst signal = options === null || options === void 0 ? void 0 : options.signal;\n\tconst queue = [];\n\tconst arrived = createManuallyConditional();\n\tconst canReserve = maxItemReserved ? createManuallyConditional(true) : void 0;\n\tconst generator = (async function* () {\n\t\twhile (true) {\n\t\t\twhile (true) {\n\t\t\t\tconst item = queue.shift();\n\t\t\t\tif (maxItemReserved && queue.length === maxItemReserved - 1) canReserve.raise();\n\t\t\t\tif (!item) break;\n\t\t\t\tswitch (item.kind) {\n\t\t\t\t\tcase \"value\":\n\t\t\t\t\t\tyield item.value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"completed\": return;\n\t\t\t\t\tcase \"error\": throw item.error;\n\t\t\t\t}\n\t\t\t\tif (signal === null || signal === void 0 ? void 0 : signal.aborted) throw new Error(\"Deferred generator aborted\");\n\t\t\t}\n\t\t\tarrived.drop();\n\t\t\ttry {\n\t\t\t\tawait arrived.wait(signal);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof Error && error.message === \"Conditional aborted\") error.message = \"Deferred generator aborted\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t})();\n\tconst enqueue = async (item, signal) => {\n\t\twhile (true) {\n\t\t\tif (!maxItemReserved || queue.length < maxItemReserved) {\n\t\t\t\tconst remains = queue.push(item);\n\t\t\t\tif (remains === 1) arrived.raise();\n\t\t\t\tif (remains === maxItemReserved) canReserve.drop();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait canReserve.wait(signal);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof Error && error.message === \"Conditional aborted\") error.message = \"Deferred generator aborted\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t};\n\treturn {\n\t\tgenerator,\n\t\tyield: (value, signal) => enqueue({\n\t\t\tkind: \"value\",\n\t\t\tvalue\n\t\t}, signal),\n\t\treturn: (signal) => enqueue({ kind: \"completed\" }, signal),\n\t\tthrow: (error, signal) => enqueue({\n\t\t\tkind: \"error\",\n\t\t\terror\n\t\t}, signal)\n\t};\n};\n//#endregion\n//#region src/primitives/internal/logical-context.ts\nvar runtimeGlobal = globalThis;\nvar LOGICAL_CONTEXT_HOOK = Symbol(\"logical-context-hook\");\nvar isHooked = (callback) => {\n\treturn callback[LOGICAL_CONTEXT_HOOK] === true;\n};\nvar markAsHooked = (callback) => {\n\tcallback[LOGICAL_CONTEXT_HOOK] = true;\n\treturn callback;\n};\nvar createLogicalContext = (id) => {\n\treturn {\n\t\tid,\n\t\tdata: /* @__PURE__ */ new Map()\n\t};\n};\nvar currentLogicalContext = createLogicalContext(Symbol(\"[root]\"));\nvar setCurrentLogicalContext = (context) => {\n\tcurrentLogicalContext = context;\n};\nvar trampoline = (adjustment, callback, thisArg, ...args) => {\n\tconst previousLogicalContext = currentLogicalContext;\n\tcurrentLogicalContext = adjustment.contextToUse;\n\ttry {\n\t\treturn callback.call(thisArg, ...args);\n\t} finally {\n\t\tadjustment.contextAfter = currentLogicalContext;\n\t\tcurrentLogicalContext = previousLogicalContext;\n\t}\n};\nvar isPrepared = false;\nvar prepareRuntimeHooks = () => {\n\tif (typeof globalThis.setTimeout !== \"undefined\" && !isHooked(globalThis.setTimeout)) {\n\t\tconst __setTimeout = globalThis.setTimeout;\n\t\tglobalThis.setTimeout = markAsHooked(((handler, timeout, ...args) => {\n\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\treturn __setTimeout((...callbackArgs) => {\n\t\t\t\ttrampoline({ contextToUse: capturedLogicalContext }, handler, void 0, ...callbackArgs);\n\t\t\t}, timeout, ...args);\n\t\t}));\n\t}\n\tif (typeof globalThis.setInterval !== \"undefined\" && !isHooked(globalThis.setInterval)) {\n\t\tconst __setInterval = globalThis.setInterval;\n\t\tglobalThis.setInterval = markAsHooked(((handler, timeout, ...args) => {\n\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\treturn __setInterval((...callbackArgs) => {\n\t\t\t\ttrampoline({ contextToUse: capturedLogicalContext }, handler, void 0, ...callbackArgs);\n\t\t\t}, timeout, ...args);\n\t\t}));\n\t}\n\tif (typeof globalThis.queueMicrotask !== \"undefined\" && !isHooked(globalThis.queueMicrotask)) {\n\t\tconst __queueMicrotask = globalThis.queueMicrotask;\n\t\tglobalThis.queueMicrotask = markAsHooked((callback) => {\n\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\treturn __queueMicrotask(() => {\n\t\t\t\ttrampoline({ contextToUse: capturedLogicalContext }, callback, void 0);\n\t\t\t});\n\t\t});\n\t}\n\tconst __setImmediate = runtimeGlobal.setImmediate;\n\tif (typeof __setImmediate === \"function\" && !isHooked(__setImmediate)) runtimeGlobal.setImmediate = markAsHooked(((callback, ...args) => {\n\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\treturn __setImmediate((...callbackArgs) => {\n\t\t\ttrampoline({ contextToUse: capturedLogicalContext }, callback, void 0, ...callbackArgs);\n\t\t}, ...args);\n\t}));\n\tconst runtimeProcess = runtimeGlobal.process;\n\tif (runtimeProcess && typeof runtimeProcess.nextTick === \"function\" && !isHooked(runtimeProcess.nextTick)) {\n\t\tconst __nextTick = runtimeProcess.nextTick;\n\t\truntimeProcess.nextTick = markAsHooked((callback, ...args) => {\n\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\treturn __nextTick(() => {\n\t\t\t\ttrampoline({ contextToUse: capturedLogicalContext }, callback, void 0, ...args);\n\t\t\t});\n\t\t});\n\t}\n\tif (typeof globalThis.requestAnimationFrame !== \"undefined\" && !isHooked(globalThis.requestAnimationFrame)) {\n\t\tconst __requestAnimationFrame = globalThis.requestAnimationFrame;\n\t\tglobalThis.requestAnimationFrame = markAsHooked((callback) => {\n\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\treturn __requestAnimationFrame((time) => {\n\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, callback, void 0, time);\n\t\t\t});\n\t\t});\n\t}\n};\nvar prepare = () => {\n\tprepareRuntimeHooks();\n\tif (isPrepared) return;\n\tisPrepared = true;\n\tif (typeof Promise !== \"undefined\") {\n\t\tconst __then = Promise.prototype.then;\n\t\tconst __catch = Promise.prototype.catch;\n\t\tconst __finally = Promise.prototype.finally;\n\t\tPromise.prototype.then = function(onFulfilled, onRejected) {\n\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\treturn __then.call(this, onFulfilled ? (value) => {\n\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, onFulfilled, void 0, value);\n\t\t\t} : void 0, onRejected ? (reason) => {\n\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, onRejected, void 0, reason);\n\t\t\t} : void 0);\n\t\t};\n\t\tPromise.prototype.catch = function(onRejected) {\n\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\treturn __catch.call(this, onRejected ? (reason) => {\n\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, onRejected, void 0, reason);\n\t\t\t} : void 0);\n\t\t};\n\t\tPromise.prototype.finally = function(onFinally) {\n\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\treturn __finally.call(this, onFinally ? () => {\n\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, onFinally, void 0);\n\t\t\t} : void 0);\n\t\t};\n\t}\n\tif (typeof EventTarget !== \"undefined\" && EventTarget.prototype && EventTarget.prototype.addEventListener) {\n\t\tconst __eventTargetAddEventListener = EventTarget.prototype.addEventListener;\n\t\tEventTarget.prototype.addEventListener = function(type, listener, options) {\n\t\t\tif (listener === null || listener === void 0) return __eventTargetAddEventListener.call(this, type, listener, options);\n\t\t\tif (typeof listener === \"function\") {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\tconst wrappedListener = (event) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, listener, event.currentTarget, event);\n\t\t\t\t};\n\t\t\t\treturn __eventTargetAddEventListener.call(this, type, wrappedListener, options);\n\t\t\t} else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\treturn __eventTargetAddEventListener.call(this, type, { handleEvent: (event) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, () => listener.handleEvent(event));\n\t\t\t\t} }, options);\n\t\t\t}\n\t\t\treturn __eventTargetAddEventListener.call(this, type, listener, options);\n\t\t};\n\t}\n\tif (typeof Element !== \"undefined\" && Element.prototype && Element.prototype.addEventListener) {\n\t\tconst __elementAddEventListener = Element.prototype.addEventListener;\n\t\tElement.prototype.addEventListener = function(type, listener, options) {\n\t\t\tif (listener === null || listener === void 0) return __elementAddEventListener.call(this, type, listener, options);\n\t\t\tif (typeof listener === \"function\") {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\tconst wrappedListener = (event) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, listener, event.currentTarget, event);\n\t\t\t\t};\n\t\t\t\treturn __elementAddEventListener.call(this, type, wrappedListener, options);\n\t\t\t} else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\treturn __elementAddEventListener.call(this, type, { handleEvent: (event) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, () => listener.handleEvent(event));\n\t\t\t\t} }, options);\n\t\t\t}\n\t\t\treturn __elementAddEventListener.call(this, type, listener, options);\n\t\t};\n\t}\n\tif (typeof globalThis.XMLHttpRequest !== \"undefined\") {\n\t\tconst __XMLHttpRequest = globalThis.XMLHttpRequest;\n\t\tglobalThis.XMLHttpRequest = class extends __XMLHttpRequest {\n\t\t\tconstructor() {\n\t\t\t\tsuper();\n\t\t\t\tthis._userHandlers = /* @__PURE__ */ new Map();\n\t\t\t\t[\n\t\t\t\t\t\"onreadystatechange\",\n\t\t\t\t\t\"onloadstart\",\n\t\t\t\t\t\"onprogress\",\n\t\t\t\t\t\"onabort\",\n\t\t\t\t\t\"onerror\",\n\t\t\t\t\t\"onload\",\n\t\t\t\t\t\"ontimeout\",\n\t\t\t\t\t\"onloadend\"\n\t\t\t\t].forEach((prop) => {\n\t\t\t\t\tObject.defineProperty(this, prop, {\n\t\t\t\t\t\tget: () => this._userHandlers.get(prop) || null,\n\t\t\t\t\t\tset: (newHandler) => {\n\t\t\t\t\t\t\tthis._userHandlers.set(prop, newHandler);\n\t\t\t\t\t\t\tif (newHandler && typeof newHandler === \"function\") {\n\t\t\t\t\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\t\t\t\t\tconst wrappedHandler = function(event) {\n\t\t\t\t\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, newHandler, this, event);\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(this)), prop);\n\t\t\t\t\t\t\t\tif (descriptor && descriptor.set) descriptor.set.call(this, wrappedHandler);\n\t\t\t\t\t\t\t\telse this[`_${prop}`] = wrappedHandler;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(this)), prop);\n\t\t\t\t\t\t\t\tif (descriptor && descriptor.set) descriptor.set.call(this, null);\n\t\t\t\t\t\t\t\telse this[`_${prop}`] = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tenumerable: true\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t\taddEventListener(type, listener, options) {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\tif (!listener) return super.addEventListener(type, listener, options);\n\t\t\t\tif (typeof listener === \"function\") {\n\t\t\t\t\tconst wrappedListener = (event) => {\n\t\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, listener, event.currentTarget, event);\n\t\t\t\t\t};\n\t\t\t\t\treturn super.addEventListener(type, wrappedListener, options);\n\t\t\t\t} else if (typeof listener === \"object\" && \"handleEvent\" in listener) return super.addEventListener(type, { handleEvent: (event) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, () => listener.handleEvent(event));\n\t\t\t\t} }, options);\n\t\t\t\treturn super.addEventListener(type, listener, options);\n\t\t\t}\n\t\t};\n\t}\n\tif (typeof globalThis.WebSocket !== \"undefined\") {\n\t\tconst __WebSocket = globalThis.WebSocket;\n\t\tglobalThis.WebSocket = class extends __WebSocket {\n\t\t\tconstructor(url, protocols) {\n\t\t\t\tsuper(url, protocols);\n\t\t\t\tthis._userHandlers = /* @__PURE__ */ new Map();\n\t\t\t\t[\n\t\t\t\t\t\"onopen\",\n\t\t\t\t\t\"onmessage\",\n\t\t\t\t\t\"onerror\",\n\t\t\t\t\t\"onclose\"\n\t\t\t\t].forEach((prop) => {\n\t\t\t\t\tObject.defineProperty(this, prop, {\n\t\t\t\t\t\tget: () => this._userHandlers.get(prop) || null,\n\t\t\t\t\t\tset: (newHandler) => {\n\t\t\t\t\t\t\tthis._userHandlers.set(prop, newHandler);\n\t\t\t\t\t\t\tif (newHandler && typeof newHandler === \"function\") {\n\t\t\t\t\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\t\t\t\t\tconst wrappedHandler = function(event) {\n\t\t\t\t\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, newHandler, this, event);\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(this)), prop);\n\t\t\t\t\t\t\t\tif (descriptor && descriptor.set) descriptor.set.call(this, wrappedHandler);\n\t\t\t\t\t\t\t\telse this[`_${prop}`] = wrappedHandler;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(this)), prop);\n\t\t\t\t\t\t\t\tif (descriptor && descriptor.set) descriptor.set.call(this, null);\n\t\t\t\t\t\t\t\telse this[`_${prop}`] = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tenumerable: true\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t\taddEventListener(type, listener, options) {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\tif (!listener) return super.addEventListener(type, listener, options);\n\t\t\t\tif (typeof listener === \"function\") {\n\t\t\t\t\tconst wrappedListener = (event) => {\n\t\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, listener, event.currentTarget, event);\n\t\t\t\t\t};\n\t\t\t\t\treturn super.addEventListener(type, wrappedListener, options);\n\t\t\t\t} else if (typeof listener === \"object\" && \"handleEvent\" in listener) return super.addEventListener(type, { handleEvent: (event) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, () => listener.handleEvent(event));\n\t\t\t\t} }, options);\n\t\t\t\treturn super.addEventListener(type, listener, options);\n\t\t\t}\n\t\t};\n\t}\n\tif (typeof globalThis.MutationObserver !== \"undefined\") {\n\t\tconst __MutationObserver = globalThis.MutationObserver;\n\t\tglobalThis.MutationObserver = class extends __MutationObserver {\n\t\t\tconstructor(callback) {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\tconst wrappedCallback = (mutations, observer) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, callback, void 0, mutations, observer);\n\t\t\t\t};\n\t\t\t\tsuper(wrappedCallback);\n\t\t\t}\n\t\t};\n\t}\n\tif (typeof globalThis.ResizeObserver !== \"undefined\") {\n\t\tconst __ResizeObserver = globalThis.ResizeObserver;\n\t\tglobalThis.ResizeObserver = class extends __ResizeObserver {\n\t\t\tconstructor(callback) {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\tconst wrappedCallback = (entries, observer) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, callback, void 0, entries, observer);\n\t\t\t\t};\n\t\t\t\tsuper(wrappedCallback);\n\t\t\t}\n\t\t};\n\t}\n\tif (typeof globalThis.IntersectionObserver !== \"undefined\") {\n\t\tconst __IntersectionObserver = globalThis.IntersectionObserver;\n\t\tglobalThis.IntersectionObserver = class extends __IntersectionObserver {\n\t\t\tconstructor(callback, options) {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\tconst wrappedCallback = (entries, observer) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, callback, void 0, entries, observer);\n\t\t\t\t};\n\t\t\t\tsuper(wrappedCallback, options);\n\t\t\t}\n\t\t};\n\t}\n\tif (typeof globalThis.Worker !== \"undefined\") {\n\t\tconst __Worker = globalThis.Worker;\n\t\tglobalThis.Worker = class extends __Worker {\n\t\t\tconstructor(scriptURL, options) {\n\t\t\t\tsuper(scriptURL, options);\n\t\t\t\tthis._userHandlers = /* @__PURE__ */ new Map();\n\t\t\t\t[\n\t\t\t\t\t\"onmessage\",\n\t\t\t\t\t\"onmessageerror\",\n\t\t\t\t\t\"onerror\"\n\t\t\t\t].forEach((prop) => {\n\t\t\t\t\tObject.defineProperty(this, prop, {\n\t\t\t\t\t\tget: () => this._userHandlers.get(prop) || null,\n\t\t\t\t\t\tset: (newHandler) => {\n\t\t\t\t\t\t\tthis._userHandlers.set(prop, newHandler);\n\t\t\t\t\t\t\tif (newHandler && typeof newHandler === \"function\") {\n\t\t\t\t\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\t\t\t\t\tconst wrappedHandler = function(event) {\n\t\t\t\t\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, newHandler, this, event);\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(this)), prop);\n\t\t\t\t\t\t\t\tif (descriptor && descriptor.set) descriptor.set.call(this, wrappedHandler);\n\t\t\t\t\t\t\t\telse this[`_${prop}`] = wrappedHandler;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(this)), prop);\n\t\t\t\t\t\t\t\tif (descriptor && descriptor.set) descriptor.set.call(this, null);\n\t\t\t\t\t\t\t\telse this[`_${prop}`] = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tenumerable: true\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t\taddEventListener(type, listener, options) {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\tif (!listener) return super.addEventListener(type, listener, options);\n\t\t\t\tif (typeof listener === \"function\") {\n\t\t\t\t\tconst wrappedListener = (event) => {\n\t\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, listener, event.currentTarget, event);\n\t\t\t\t\t};\n\t\t\t\t\treturn super.addEventListener(type, wrappedListener, options);\n\t\t\t\t} else if (typeof listener === \"object\" && \"handleEvent\" in listener) return super.addEventListener(type, { handleEvent: (event) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, () => listener.handleEvent(event));\n\t\t\t\t} }, options);\n\t\t\t\treturn super.addEventListener(type, listener, options);\n\t\t\t}\n\t\t};\n\t}\n\tif (typeof globalThis.MessagePort !== \"undefined\") {\n\t\tconst __MessagePort = globalThis.MessagePort;\n\t\tconst createMessagePortWrapper = (originalPort) => {\n\t\t\tconst _userHandlers = /* @__PURE__ */ new Map();\n\t\t\t[\"onmessage\", \"onmessageerror\"].forEach((prop) => {\n\t\t\t\tObject.defineProperty(originalPort, prop, {\n\t\t\t\t\tget: () => _userHandlers.get(prop) || null,\n\t\t\t\t\tset: (newHandler) => {\n\t\t\t\t\t\t_userHandlers.set(prop, newHandler);\n\t\t\t\t\t\tif (newHandler && typeof newHandler === \"function\") {\n\t\t\t\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\t\t\t\tconst wrappedHandler = function(event) {\n\t\t\t\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, newHandler, this, event);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(__MessagePort.prototype, prop);\n\t\t\t\t\t\t\tif (descriptor && descriptor.set) descriptor.set.call(originalPort, wrappedHandler);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(__MessagePort.prototype, prop);\n\t\t\t\t\t\t\tif (descriptor && descriptor.set) descriptor.set.call(originalPort, null);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\tenumerable: true\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst originalAddEventListener = originalPort.addEventListener;\n\t\t\toriginalPort.addEventListener = function(type, listener, options) {\n\t\t\t\tconst capturedLogicalContext = currentLogicalContext;\n\t\t\t\tif (!listener) return originalAddEventListener.call(this, type, listener, options);\n\t\t\t\tif (typeof listener === \"function\") {\n\t\t\t\t\tconst wrappedListener = (event) => {\n\t\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, listener, event.currentTarget, event);\n\t\t\t\t\t};\n\t\t\t\t\treturn originalAddEventListener.call(this, type, wrappedListener, options);\n\t\t\t\t} else if (typeof listener === \"object\" && \"handleEvent\" in listener) return originalAddEventListener.call(this, type, { handleEvent: (event) => {\n\t\t\t\t\treturn trampoline({ contextToUse: capturedLogicalContext }, () => listener.handleEvent(event));\n\t\t\t\t} }, options);\n\t\t\t\treturn originalAddEventListener.call(this, type, listener, options);\n\t\t\t};\n\t\t\treturn originalPort;\n\t\t};\n\t\tif (typeof globalThis.MessageChannel !== \"undefined\") {\n\t\t\tconst __MessageChannel = globalThis.MessageChannel;\n\t\t\tglobalThis.MessageChannel = class extends __MessageChannel {\n\t\t\t\tconstructor() {\n\t\t\t\t\tsuper();\n\t\t\t\t\tcreateMessagePortWrapper(this.port1);\n\t\t\t\t\tcreateMessagePortWrapper(this.port2);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n};\n//#endregion\n//#region src/primitives/logical-context.ts\n/**\n* Set a value in the current logical context\n* @param key The symbol key for the value\n* @param value The value to store\n*/\nvar setLogicalContextValue = (key, value) => {\n\tprepare();\n\tif (value !== void 0) currentLogicalContext.data.set(key, value);\n\telse currentLogicalContext.data.delete(key);\n};\n/**\n* Get a value from the current logical context\n* @param key The symbol key for the value\n* @returns The stored value or undefined if not found\n*/\nvar getLogicalContextValue = (key) => {\n\tprepare();\n\treturn currentLogicalContext.data.get(key);\n};\n/**\n* Run a handler on a new logical context\n* @param prefix The prefix for the new logical context\n* @param handler The handler to run\n* @returns The result of the handler\n*/\nvar runOnNewLogicalContext = (prefix, handler) => {\n\tconst previousLogicalContext = currentLogicalContext;\n\tsetCurrentLogicalContext(createLogicalContext(Symbol(`${prefix}-${crypto.randomUUID()}`)));\n\ttry {\n\t\treturn handler();\n\t} finally {\n\t\tsetCurrentLogicalContext(previousLogicalContext);\n\t}\n};\n/**\n* Get the current logical context id\n* @returns The current logical context id\n*/\nvar getCurrentLogicalContextId = () => {\n\tprepare();\n\treturn currentLogicalContext.id;\n};\n//#endregion\n//#region src/primitives/async-local.ts\n/**\n* Creates a new AsyncLocal instance\n* @template T The type of the value to store in the async context\n* @returns A new AsyncLocal instance\n*/\nvar createAsyncLocal = () => {\n\tconst key = Symbol(`async-local-${crypto.randomUUID()}`);\n\treturn {\n\t\tsetValue: (value) => {\n\t\t\tsetLogicalContextValue(key, value);\n\t\t},\n\t\tgetValue: () => {\n\t\t\treturn getLogicalContextValue(key);\n\t\t}\n\t};\n};\n//#endregion\n//#region src/primitives/semaphore.ts\nvar ABORTED_ERROR$1 = () => /* @__PURE__ */ new Error(\"Semaphore acquisition was aborted\");\nvar INVALID_COUNT_ERROR = () => /* @__PURE__ */ new Error(\"Semaphore count must be greater than 0\");\n/**\n* Creates a new SemaphoreHandle instance\n* @param releaseCallback Callback function to release the semaphore resource\n* @returns A SemaphoreHandle object with release and dispose functionality\n*/\nvar createSemaphoreHandle = (releaseCallback) => {\n\tlet isActive = true;\n\tconst release = () => {\n\t\tif (!isActive) return;\n\t\tisActive = false;\n\t\treleaseCallback();\n\t};\n\treturn {\n\t\tget isActive() {\n\t\t\treturn isActive;\n\t\t},\n\t\trelease,\n\t\t[Symbol.dispose]: release\n\t};\n};\n/**\n* Creates a new Semaphore instance for managing limited concurrent access\n* @param count The maximum number of concurrent acquisitions allowed (must be greater than 0)\n* @param maxConsecutiveCalls The maximum number of consecutive calls before yielding control\n* @returns A new Semaphore for managing concurrent resource access\n*/\nvar createSemaphore = (count, maxConsecutiveCalls = 20) => {\n\tif (count < 1) throw INVALID_COUNT_ERROR();\n\tlet availableCount = count;\n\tconst queue = [];\n\tlet consecutiveCallCount = 0;\n\tconst processQueue = () => {\n\t\twhile (availableCount > 0 && queue.length > 0) {\n\t\t\tvar _item$signal;\n\t\t\tconst item = queue.shift();\n\t\t\tif ((_item$signal = item.signal) === null || _item$signal === void 0 ? void 0 : _item$signal.aborted) {\n\t\t\t\titem.reject(ABORTED_ERROR$1());\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tavailableCount--;\n\t\t\tconst semaphoreHandle = createSemaphoreHandle(releaseSemaphore);\n\t\t\titem.resolve(semaphoreHandle);\n\t\t}\n\t};\n\tconst scheduleNextProcess = () => {\n\t\tconsecutiveCallCount++;\n\t\tif (consecutiveCallCount >= maxConsecutiveCalls) {\n\t\t\tconsecutiveCallCount = 0;\n\t\t\tdefer(processQueue);\n\t\t} else processQueue();\n\t};\n\tconst releaseSemaphore = () => {\n\t\tavailableCount++;\n\t\tscheduleNextProcess();\n\t};\n\tconst removeFromQueue = (item) => {\n\t\tconst index = queue.indexOf(item);\n\t\tif (index !== -1) queue.splice(index, 1);\n\t};\n\tconst acquire = async (signal) => {\n\t\tif (signal) {\n\t\t\tif (signal.aborted) throw ABORTED_ERROR$1();\n\t\t\tif (availableCount > 0) {\n\t\t\t\tavailableCount--;\n\t\t\t\treturn createSemaphoreHandle(releaseSemaphore);\n\t\t\t}\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tconst queueItem = {\n\t\t\t\t\tresolve: void 0,\n\t\t\t\t\treject: void 0,\n\t\t\t\t\tsignal\n\t\t\t\t};\n\t\t\t\tconst abortHandle = onAbort(signal, () => {\n\t\t\t\t\tremoveFromQueue(queueItem);\n\t\t\t\t\treject(ABORTED_ERROR$1());\n\t\t\t\t});\n\t\t\t\tqueueItem.resolve = (handle) => {\n\t\t\t\t\tabortHandle.release();\n\t\t\t\t\tresolve(handle);\n\t\t\t\t};\n\t\t\t\tqueueItem.reject = (error) => {\n\t\t\t\t\tabortHandle.release();\n\t\t\t\t\treject(error);\n\t\t\t\t};\n\t\t\t\tqueue.push(queueItem);\n\t\t\t\tprocessQueue();\n\t\t\t});\n\t\t} else {\n\t\t\tif (availableCount > 0) {\n\t\t\t\tavailableCount--;\n\t\t\t\treturn createSemaphoreHandle(releaseSemaphore);\n\t\t\t}\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tqueue.push({\n\t\t\t\t\tresolve,\n\t\t\t\t\treject\n\t\t\t\t});\n\t\t\t\tprocessQueue();\n\t\t\t});\n\t\t}\n\t};\n\treturn {\n\t\tacquire,\n\t\twaiter: { wait: acquire },\n\t\tget availableCount() {\n\t\t\treturn availableCount;\n\t\t},\n\t\tget pendingCount() {\n\t\t\treturn queue.length;\n\t\t}\n\t};\n};\n//#endregion\n//#region src/primitives/reader-writer-lock.ts\nvar ABORTED_ERROR = () => /* @__PURE__ */ new Error(\"Lock acquisition was aborted\");\n/**\n* Creates a new ReadLockHandle instance\n* @param releaseCallback Callback function to release the read lock\n* @returns A ReadLockHandle object with release and dispose functionality\n*/\nvar createReadLockHandle = (releaseCallback) => {\n\tlet isActive = true;\n\tconst release = () => {\n\t\tif (!isActive) return;\n\t\tisActive = false;\n\t\treleaseCallback();\n\t};\n\treturn {\n\t\tget isActive() {\n\t\t\treturn isActive;\n\t\t},\n\t\trelease,\n\t\t[Symbol.dispose]: release\n\t};\n};\n/**\n* Creates a new WriteLockHandle instance\n* @param releaseCallback Callback function to release the write lock\n* @returns A WriteLockHandle object with release and dispose functionality\n*/\nvar createWriteLockHandle = (releaseCallback) => {\n\tlet isActive = true;\n\tconst release = () => {\n\t\tif (!isActive) return;\n\t\tisActive = false;\n\t\treleaseCallback();\n\t};\n\treturn {\n\t\tget isActive() {\n\t\t\treturn isActive;\n\t\t},\n\t\trelease,\n\t\t[Symbol.dispose]: release\n\t};\n};\nfunction createReaderWriterLock(optionsOrMaxCalls) {\n\tlet policy = \"write-preferring\";\n\tlet maxConsecutiveCalls = 20;\n\tif (typeof optionsOrMaxCalls === \"number\") maxConsecutiveCalls = optionsOrMaxCalls;\n\telse if (optionsOrMaxCalls) {\n\t\tvar _optionsOrMaxCalls$po, _optionsOrMaxCalls$ma;\n\t\tpolicy = (_optionsOrMaxCalls$po = optionsOrMaxCalls.policy) !== null && _optionsOrMaxCalls$po !== void 0 ? _optionsOrMaxCalls$po : \"write-preferring\";\n\t\tmaxConsecutiveCalls = (_optionsOrMaxCalls$ma = optionsOrMaxCalls.maxConsecutiveCalls) !== null && _optionsOrMaxCalls$ma !== void 0 ? _optionsOrMaxCalls$ma : 20;\n\t}\n\tlet currentReaders = 0;\n\tlet hasWriter = false;\n\tconst readQueue = [];\n\tconst writeQueue = [];\n\tlet consecutiveCallCount = 0;\n\tconst processQueues = () => {\n\t\tif (policy === \"write-preferring\") {\n\t\t\tif (!hasWriter && currentReaders === 0 && writeQueue.length > 0) {\n\t\t\t\tvar _item$signal;\n\t\t\t\tconst item = writeQueue.shift();\n\t\t\t\tif ((_item$signal = item.signal) === null || _item$signal === void 0 ? void 0 : _item$signal.aborted) {\n\t\t\t\t\titem.reject(ABORTED_ERROR());\n\t\t\t\t\tscheduleNextProcess();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\thasWriter = true;\n\t\t\t\tconst writeLockHandle = createWriteLockHandle(releaseWriteLock);\n\t\t\t\titem.resolve(writeLockHandle);\n\t\t\t} else if (!hasWriter && writeQueue.length === 0 && readQueue.length > 0) {\n\t\t\t\tconst readersToProcess = [];\n\t\t\t\twhile (readQueue.length > 0) {\n\t\t\t\t\tvar _item$signal2;\n\t\t\t\t\tconst item = readQueue.shift();\n\t\t\t\t\tif ((_item$signal2 = item.signal) === null || _item$signal2 === void 0 ? void 0 : _item$signal2.aborted) item.reject(ABORTED_ERROR());\n\t\t\t\t\telse readersToProcess.push(item);\n\t\t\t\t}\n\t\t\t\tfor (const item of readersToProcess) {\n\t\t\t\t\tcurrentReaders++;\n\t\t\t\t\tconst readLockHandle = createReadLockHandle(releaseReadLock);\n\t\t\t\t\titem.resolve(readLockHandle);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!hasWriter && readQueue.length > 0) {\n\t\t\tconst readersToProcess = [];\n\t\t\twhile (readQueue.length > 0) {\n\t\t\t\tvar _item$signal3;\n\t\t\t\tconst item = readQueue.shift();\n\t\t\t\tif ((_item$signal3 = item.signal) === null || _item$signal3 === void 0 ? void 0 : _item$signal3.aborted) item.reject(ABORTED_ERROR());\n\t\t\t\telse readersToProcess.push(item);\n\t\t\t}\n\t\t\tfor (const item of readersToProcess) {\n\t\t\t\tcurrentReaders++;\n\t\t\t\tconst readLockHandle = createReadLockHandle(releaseReadLock);\n\t\t\t\titem.resolve(readLockHandle);\n\t\t\t}\n\t\t} else if (!hasWriter && currentReaders === 0 && writeQueue.length > 0) {\n\t\t\tvar _item$signal4;\n\t\t\tconst item = writeQueue.shift();\n\t\t\tif ((_item$signal4 = item.signal) === null || _item$signal4 === void 0 ? void 0 : _item$signal4.aborted) {\n\t\t\t\titem.reject(ABORTED_ERROR());\n\t\t\t\tscheduleNextProcess();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\thasWriter = true;\n\t\t\tconst writeLockHandle = createWriteLockHandle(releaseWriteLock);\n\t\t\titem.resolve(writeLockHandle);\n\t\t}\n\t};\n\tconst scheduleNextProcess = () => {\n\t\tconsecutiveCallCount++;\n\t\tif (consecutiveCallCount >= maxConsecutiveCalls) {\n\t\t\tconsecutiveCallCount = 0;\n\t\t\tdefer(processQueues);\n\t\t} else processQueues();\n\t};\n\tconst releaseReadLock = () => {\n\t\tif (currentReaders > 0) {\n\t\t\tcurrentReaders--;\n\t\t\tif (currentReaders === 0) scheduleNextProcess();\n\t\t}\n\t};\n\tconst releaseWriteLock = () => {\n\t\tif (hasWriter) {\n\t\t\thasWriter = false;\n\t\t\tscheduleNextProcess();\n\t\t}\n\t};\n\tconst removeFromReadQueue = (item) => {\n\t\tconst index = readQueue.indexOf(item);\n\t\tif (index !== -1) readQueue.splice(index, 1);\n\t};\n\tconst removeFromWriteQueue = (item) => {\n\t\tconst index = writeQueue.indexOf(item);\n\t\tif (index !== -1) writeQueue.splice(index, 1);\n\t};\n\tconst readLock = async (signal) => {\n\t\tif (signal) {\n\t\t\tif (signal.aborted) throw ABORTED_ERROR();\n\t\t\tif (policy === \"read-preferring\" ? !hasWriter : !hasWriter && writeQueue.length === 0) {\n\t\t\t\tcurrentReaders++;\n\t\t\t\treturn createReadLockHandle(releaseReadLock);\n\t\t\t}\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tconst queueItem = {\n\t\t\t\t\tresolve: void 0,\n\t\t\t\t\treject: void 0,\n\t\t\t\t\tsignal\n\t\t\t\t};\n\t\t\t\tconst abortHandle = onAbort(signal, () => {\n\t\t\t\t\tremoveFromReadQueue(queueItem);\n\t\t\t\t\treject(ABORTED_ERROR());\n\t\t\t\t});\n\t\t\t\tqueueItem.resolve = (handle) => {\n\t\t\t\t\tabortHandle.release();\n\t\t\t\t\tresolve(handle);\n\t\t\t\t};\n\t\t\t\tqueueItem.reject = (error) => {\n\t\t\t\t\tabortHandle.release();\n\t\t\t\t\treject(error);\n\t\t\t\t};\n\t\t\t\treadQueue.push(queueItem);\n\t\t\t\tprocessQueues();\n\t\t\t});\n\t\t} else {\n\t\t\tif (policy === \"read-preferring\" ? !hasWriter : !hasWriter && writeQueue.length === 0) {\n\t\t\t\tcurrentReaders++;\n\t\t\t\treturn createReadLockHandle(releaseReadLock);\n\t\t\t}\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\treadQueue.push({\n\t\t\t\t\tresolve,\n\t\t\t\t\treject\n\t\t\t\t});\n\t\t\t\tprocessQueues();\n\t\t\t});\n\t\t}\n\t};\n\tconst writeLock = async (signal) => {\n\t\tif (signal) {\n\t\t\tif (signal.aborted) throw ABORTED_ERROR();\n\t\t\tif (!hasWriter && currentReaders === 0) {\n\t\t\t\thasWriter = true;\n\t\t\t\treturn createWriteLockHandle(releaseWriteLock);\n\t\t\t}\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tconst queueItem = {\n\t\t\t\t\tresolve: void 0,\n\t\t\t\t\treject: void 0,\n\t\t\t\t\tsignal\n\t\t\t\t};\n\t\t\t\tconst abortHandle = onAbort(signal, () => {\n\t\t\t\t\tremoveFromWriteQueue(queueItem);\n\t\t\t\t\treject(ABORTED_ERROR());\n\t\t\t\t});\n\t\t\t\tqueueItem.resolve = (handle) => {\n\t\t\t\t\tabortHandle.release();\n\t\t\t\t\tresolve(handle);\n\t\t\t\t};\n\t\t\t\tqueueItem.reject = (error) => {\n\t\t\t\t\tabortHandle.release();\n\t\t\t\t\treject(error);\n\t\t\t\t};\n\t\t\t\twriteQueue.push(queueItem);\n\t\t\t\tprocessQueues();\n\t\t\t});\n\t\t} else {\n\t\t\tif (!hasWriter && currentReaders === 0) {\n\t\t\t\thasWriter = true;\n\t\t\t\treturn createWriteLockHandle(releaseWriteLock);\n\t\t\t}\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\twriteQueue.push({\n\t\t\t\t\tresolve,\n\t\t\t\t\treject\n\t\t\t\t});\n\t\t\t\tprocessQueues();\n\t\t\t});\n\t\t}\n\t};\n\treturn {\n\t\treadLock,\n\t\twriteLock,\n\t\treadWaiter: { wait: readLock },\n\t\twriteWaiter: { wait: writeLock },\n\t\tget currentReaders() {\n\t\t\treturn currentReaders;\n\t\t},\n\t\tget hasWriter() {\n\t\t\treturn hasWriter;\n\t\t},\n\t\tget pendingReadersCount() {\n\t\t\treturn readQueue.length;\n\t\t},\n\t\tget pendingWritersCount() {\n\t\t\treturn writeQueue.length;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/primitives/async-operator.ts\nvar __NO_INITIAL_VALUE = Symbol(\"no-initial-value\");\nvar __LINEAR_SKIP = Symbol(\"linear-skip\");\nvar __LINEAR_STOP = Symbol(\"linear-stop\");\nvar createAsyncIterable = (iteratorFactory) => ({ [Symbol.asyncIterator]: iteratorFactory });\nvar createSyncIterable = (iteratorFactory) => ({ [Symbol.iterator]: iteratorFactory });\nvar createIteratorFactories = (source) => isAsyncIterable(source) ? {\n\tsyncFactory: void 0,\n\tasyncFactory: () => toAsyncIterable(source)\n} : {\n\tsyncFactory: () => source,\n\tasyncFactory: () => toAsyncIterable(source)\n};\nvar createAsyncOnlyFactories = (asyncFactory) => ({\n\tsyncFactory: void 0,\n\tasyncFactory\n});\nvar normalizeIteratorFactories = (iteratorFactoriesOrAsyncFactory) => typeof iteratorFactoriesOrAsyncFactory === \"function\" ? createAsyncOnlyFactories(iteratorFactoriesOrAsyncFactory) : iteratorFactoriesOrAsyncFactory;\nvar identity = (value) => value;\nvar sameValueZero = (left, right) => left === right || left !== left && right !== right;\nvar isArraySource = (source) => Array.isArray(source);\nvar isPromiseLike = (value) => (typeof value === \"object\" && value !== null || typeof value === \"function\") && typeof value.then === \"function\";\nvar isAsyncIterable = (source) => typeof source[Symbol.asyncIterator] === \"function\";\nvar toAsyncIterable = (source) => createAsyncIterable(async function* () {\n\tif (isAsyncIterable(source)) for await (const value of source) yield value;\n\telse for (const value of source) yield isPromiseLike(value) ? await value : value;\n});\nvar toIntegerOrInfinity = (value) => {\n\tif (Number.isNaN(value) || value === 0) return 0;\n\tif (!Number.isFinite(value)) return value;\n\treturn Math.trunc(value);\n};\nvar normalizeCount = (count) => {\n\tif (Number.isNaN(count) || count <= 0) return 0;\n\treturn Math.trunc(count);\n};\nvar normalizeRequiredCount = (count, name) => {\n\tif (!Number.isFinite(count) || count <= 0) throw new RangeError(`${name} must be greater than 0`);\n\treturn Math.trunc(count);\n};\nvar isNonNullish = (value) => value !== null && value !== void 0;\nvar compareValues = (left, right) => {\n\tif (left < right) return -1;\n\tif (left > right) return 1;\n\treturn 0;\n};\nvar createLinearRuntimeState = (operation) => {\n\tswitch (operation.kind) {\n\t\tcase \"map\":\n\t\tcase \"filter\":\n\t\tcase \"choose\":\n\t\tcase \"takeWhile\": return {\n\t\t\tkind: operation.kind,\n\t\t\tindex: 0\n\t\t};\n\t\tcase \"skipWhile\": return {\n\t\t\tkind: operation.kind,\n\t\t\tindex: 0,\n\t\t\tskipping: true\n\t\t};\n\t}\n};\nvar createLinearPipelineFactories = (pipeline) => createAsyncOnlyFactories(() => createAsyncIterable(async function* () {\n\tconst runtimeStates = pipeline.operations.map(createLinearRuntimeState);\n\tconst applyOperations = async (input) => {\n\t\tlet current = input;\n\t\tfor (let operationIndex = 0; operationIndex < pipeline.operations.length; operationIndex++) {\n\t\t\tconst operation = pipeline.operations[operationIndex];\n\t\t\tconst runtimeState = runtimeStates[operationIndex];\n\t\t\tswitch (operation.kind) {\n\t\t\t\tcase \"map\": {\n\t\t\t\t\tconst selected = operation.selector(current, runtimeState.index);\n\t\t\t\t\tcurrent = isPromiseLike(selected) ? await selected : selected;\n\t\t\t\t\truntimeState.index++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"filter\": {\n\t\t\t\t\tconst result = operation.predicate(current, runtimeState.index);\n\t\t\t\t\tconst included = isPromiseLike(result) ? await result : result;\n\t\t\t\t\truntimeState.index++;\n\t\t\t\t\tif (!included) return __LINEAR_SKIP;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"choose\": {\n\t\t\t\t\tconst result = operation.selector(current, runtimeState.index);\n\t\t\t\t\tconst selected = isPromiseLike(result) ? await result : result;\n\t\t\t\t\truntimeState.index++;\n\t\t\t\t\tif (!isNonNullish(selected)) return __LINEAR_SKIP;\n\t\t\t\t\tcurrent = selected;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"skipWhile\": {\n\t\t\t\t\tconst skipState = runtimeState;\n\t\t\t\t\tconst result = operation.predicate(current, runtimeState.index);\n\t\t\t\t\tconst shouldSkip = isPromiseLike(result) ? await result : result;\n\t\t\t\t\truntimeState.index++;\n\t\t\t\t\tif (skipState.skipping && shouldSkip) return __LINEAR_SKIP;\n\t\t\t\t\tskipState.skipping = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"takeWhile\": {\n\t\t\t\t\tconst result = operation.predicate(current, runtimeState.index);\n\t\t\t\t\tif (!(isPromiseLike(result) ? await result : result)) return __LINEAR_STOP;\n\t\t\t\t\truntimeState.index++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn current;\n\t};\n\tconst { syncFactory, asyncFactory } = pipeline.sourceFactories;\n\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\tconst processedValue = await applyOperations(isPromiseLike(value) ? await value : value);\n\t\tif (processedValue === __LINEAR_STOP) return;\n\t\tif (processedValue !== __LINEAR_SKIP) yield processedValue;\n\t}\n\telse for await (const value of asyncFactory()) {\n\t\tconst processedValue = await applyOperations(value);\n\t\tif (processedValue === __LINEAR_STOP) return;\n\t\tif (processedValue !== __LINEAR_SKIP) yield processedValue;\n\t}\n}));\nvar collectKeysFromSource = async (source, selector) => {\n\tconst { syncFactory, asyncFactory } = createIteratorFactories(source);\n\tlet index = 0;\n\tconst keys = /* @__PURE__ */ new Set();\n\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\tconst key = selector(isPromiseLike(value) ? await value : value, index);\n\t\tkeys.add(isPromiseLike(key) ? await key : key);\n\t\tindex++;\n\t}\n\telse for await (const value of asyncFactory()) {\n\t\tconst key = selector(value, index);\n\t\tkeys.add(isPromiseLike(key) ? await key : key);\n\t\tindex++;\n\t}\n\treturn keys;\n};\nvar collectValuesFromSource = async (source) => {\n\tconst { syncFactory, asyncFactory } = createIteratorFactories(source);\n\tconst values = /* @__PURE__ */ new Set();\n\tif (syncFactory !== void 0) for (const value of syncFactory()) values.add(isPromiseLike(value) ? await value : value);\n\telse for await (const value of asyncFactory()) values.add(value);\n\treturn values;\n};\nvar materializeValues = async (iteratorFactories) => {\n\tconst { syncFactory, asyncFactory } = iteratorFactories;\n\tconst values = [];\n\tif (syncFactory !== void 0) for (const value of syncFactory()) values.push(isPromiseLike(value) ? await value : value);\n\telse for await (const value of asyncFactory()) values.push(value);\n\treturn values;\n};\nvar findExtremeBy = async (iteratorFactories, selector, direction) => {\n\tconst { syncFactory, asyncFactory } = iteratorFactories;\n\tlet index = 0;\n\tlet hasBestValue = false;\n\tlet bestValue;\n\tlet bestKey;\n\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\tconst selectedKey = selector(resolvedValue, index);\n\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\tif (!hasBestValue || (direction === \"min\" ? compareValues(key, bestKey) < 0 : compareValues(key, bestKey) > 0)) {\n\t\t\thasBestValue = true;\n\t\t\tbestValue = resolvedValue;\n\t\t\tbestKey = key;\n\t\t}\n\t\tindex++;\n\t}\n\telse for await (const value of asyncFactory()) {\n\t\tconst selectedKey = selector(value, index);\n\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\tif (!hasBestValue || (direction === \"min\" ? compareValues(key, bestKey) < 0 : compareValues(key, bestKey) > 0)) {\n\t\t\thasBestValue = true;\n\t\t\tbestValue = value;\n\t\t\tbestKey = key;\n\t\t}\n\t\tindex++;\n\t}\n\treturn bestValue;\n};\nvar createAsyncOperator = (iteratorFactoriesOrAsyncFactory, linearPipeline) => {\n\tconst iteratorFactories = normalizeIteratorFactories(iteratorFactoriesOrAsyncFactory);\n\tconst { syncFactory, asyncFactory } = iteratorFactories;\n\tconst iterableFactory = asyncFactory;\n\tconst appendLinearOperation = (operation, createFallbackIteratorFactories) => {\n\t\tconst nextLinearPipeline = linearPipeline === void 0 ? {\n\t\t\tsourceFactories: iteratorFactories,\n\t\t\toperations: [operation]\n\t\t} : {\n\t\t\tsourceFactories: linearPipeline.sourceFactories,\n\t\t\toperations: [...linearPipeline.operations, operation]\n\t\t};\n\t\treturn createAsyncOperator(linearPipeline === void 0 ? createFallbackIteratorFactories() : createLinearPipelineFactories(nextLinearPipeline), nextLinearPipeline);\n\t};\n\tconst reduce = (async (...args) => {\n\t\tconst [reducer] = args;\n\t\tlet accumulator = args.length === 2 ? args[1] : __NO_INITIAL_VALUE;\n\t\tlet index = 0;\n\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\tif (accumulator === __NO_INITIAL_VALUE) accumulator = resolvedValue;\n\t\t\telse {\n\t\t\t\tconst reduced = reducer(accumulator, resolvedValue, index);\n\t\t\t\taccumulator = isPromiseLike(reduced) ? await reduced : reduced;\n\t\t\t}\n\t\t\tindex++;\n\t\t}\n\t\telse for await (const value of asyncFactory()) {\n\t\t\tif (accumulator === __NO_INITIAL_VALUE) accumulator = value;\n\t\t\telse {\n\t\t\t\tconst reduced = reducer(accumulator, value, index);\n\t\t\t\taccumulator = isPromiseLike(reduced) ? await reduced : reduced;\n\t\t\t}\n\t\t\tindex++;\n\t\t}\n\t\tif (accumulator === __NO_INITIAL_VALUE) throw new TypeError(\"Reduce of empty AsyncOperator with no initial value\");\n\t\treturn accumulator;\n\t});\n\tconst reduceRight = (async (...args) => {\n\t\tconst [reducer] = args;\n\t\tconst hasInitialValue = args.length === 2;\n\t\tconst values = await materializeValues(iteratorFactories);\n\t\tlet accumulator = hasInitialValue ? args[1] : __NO_INITIAL_VALUE;\n\t\tfor (let index = values.length - 1; index >= 0; index--) {\n\t\t\tconst value = values[index];\n\t\t\tif (accumulator === __NO_INITIAL_VALUE) accumulator = value;\n\t\t\telse {\n\t\t\t\tconst reduced = reducer(accumulator, value, index);\n\t\t\t\taccumulator = isPromiseLike(reduced) ? await reduced : reduced;\n\t\t\t}\n\t\t}\n\t\tif (accumulator === __NO_INITIAL_VALUE) throw new TypeError(\"ReduceRight of empty AsyncOperator with no initial value\");\n\t\treturn accumulator;\n\t});\n\tconst flat = ((depth) => createAsyncOperator(createAsyncOnlyFactories(() => createAsyncIterable(async function* () {\n\t\tconst values = await materializeValues(iteratorFactories);\n\t\tfor (const value of values.flat(depth)) yield value;\n\t}))));\n\treturn {\n\t\t[Symbol.asyncIterator]: () => asyncFactory()[Symbol.asyncIterator](),\n\t\tmap: (selector) => appendLinearOperation({\n\t\t\tkind: \"map\",\n\t\t\tselector\n\t\t}, () => {\n\t\t\tconst mappedSyncFactory = syncFactory === void 0 ? void 0 : () => createSyncIterable(function* () {\n\t\t\t\tlet index = 0;\n\t\t\t\tfor (const value of syncFactory()) {\n\t\t\t\t\tconst currentIndex = index;\n\t\t\t\t\tif (isPromiseLike(value)) yield value.then((resolvedValue) => selector(resolvedValue, currentIndex));\n\t\t\t\t\telse yield selector(value, currentIndex);\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (mappedSyncFactory !== void 0) return {\n\t\t\t\tsyncFactory: mappedSyncFactory,\n\t\t\t\tasyncFactory: () => toAsyncIterable(mappedSyncFactory())\n\t\t\t};\n\t\t\treturn createAsyncOnlyFactories(() => createAsyncIterable(async function* () {\n\t\t\t\tlet index = 0;\n\t\t\t\tfor await (const value of iterableFactory()) {\n\t\t\t\t\tconst selected = selector(value, index);\n\t\t\t\t\tyield isPromiseLike(selected) ? await selected : selected;\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t}));\n\t\t}),\n\t\tflatMap: (selector) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) {\n\t\t\t\tconst source = syncFactory();\n\t\t\t\tif (Array.isArray(source)) for (let outerIndex = 0; outerIndex < source.length; outerIndex++) {\n\t\t\t\t\tconst value = source[outerIndex];\n\t\t\t\t\tconst selected = selector(isPromiseLike(value) ? await value : value, index);\n\t\t\t\t\tconst innerSource = isPromiseLike(selected) ? await selected : selected;\n\t\t\t\t\tif (isArraySource(innerSource)) for (let innerIndex = 0; innerIndex < innerSource.length; innerIndex++) {\n\t\t\t\t\t\tconst innerValue = innerSource[innerIndex];\n\t\t\t\t\t\tyield isPromiseLike(innerValue) ? await innerValue : innerValue;\n\t\t\t\t\t}\n\t\t\t\t\telse if (isAsyncIterable(innerSource)) for await (const innerValue of innerSource) yield innerValue;\n\t\t\t\t\telse for (const innerValue of innerSource) yield isPromiseLike(innerValue) ? await innerValue : innerValue;\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t\telse for (const value of source) {\n\t\t\t\t\tconst selected = selector(isPromiseLike(value) ? await value : value, index);\n\t\t\t\t\tconst innerSource = isPromiseLike(selected) ? await selected : selected;\n\t\t\t\t\tif (isArraySource(innerSource)) for (let innerIndex = 0; innerIndex < innerSource.length; innerIndex++) {\n\t\t\t\t\t\tconst innerValue = innerSource[innerIndex];\n\t\t\t\t\t\tyield isPromiseLike(innerValue) ? await innerValue : innerValue;\n\t\t\t\t\t}\n\t\t\t\t\telse if (isAsyncIterable(innerSource)) for await (const innerValue of innerSource) yield innerValue;\n\t\t\t\t\telse for (const innerValue of innerSource) yield isPromiseLike(innerValue) ? await innerValue : innerValue;\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t} else for await (const value of iterableFactory()) {\n\t\t\t\tconst selected = selector(value, index);\n\t\t\t\tconst innerSource = isPromiseLike(selected) ? await selected : selected;\n\t\t\t\tif (isArraySource(innerSource)) for (let innerIndex = 0; innerIndex < innerSource.length; innerIndex++) {\n\t\t\t\t\tconst innerValue = innerSource[innerIndex];\n\t\t\t\t\tyield isPromiseLike(innerValue) ? await innerValue : innerValue;\n\t\t\t\t}\n\t\t\t\telse if (isAsyncIterable(innerSource)) for await (const innerValue of innerSource) yield innerValue;\n\t\t\t\telse for (const innerValue of innerSource) yield isPromiseLike(innerValue) ? await innerValue : innerValue;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t})),\n\t\tfilter: (predicate) => appendLinearOperation({\n\t\t\tkind: \"filter\",\n\t\t\tpredicate\n\t\t}, () => createAsyncOnlyFactories(() => createAsyncIterable(async function* () {\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst result = predicate(resolvedValue, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) yield resolvedValue;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = predicate(value, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) yield value;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}))),\n\t\tconcat: (...sources) => {\n\t\t\tconst concatenatedSyncFactory = syncFactory !== void 0 && sources.every((source) => !isAsyncIterable(source)) ? () => createSyncIterable(function* () {\n\t\t\t\tfor (const value of syncFactory()) yield value;\n\t\t\t\tfor (const source of sources) for (const value of source) yield value;\n\t\t\t}) : void 0;\n\t\t\tif (concatenatedSyncFactory !== void 0) return createAsyncOperator({\n\t\t\t\tsyncFactory: concatenatedSyncFactory,\n\t\t\t\tasyncFactory: () => toAsyncIterable(concatenatedSyncFactory())\n\t\t\t});\n\t\t\treturn createAsyncOperator(createAsyncOnlyFactories(() => createAsyncIterable(async function* () {\n\t\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) yield isPromiseLike(value) ? await value : value;\n\t\t\t\telse for await (const value of iterableFactory()) yield value;\n\t\t\t\tfor (const source of sources) if (isAsyncIterable(source)) for await (const value of source) yield value;\n\t\t\t\telse for (const value of source) yield isPromiseLike(value) ? await value : value;\n\t\t\t})));\n\t\t},\n\t\tchoose: (selector) => appendLinearOperation({\n\t\t\tkind: \"choose\",\n\t\t\tselector\n\t\t}, () => createAsyncOnlyFactories(() => createAsyncIterable(async function* () {\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst result = selector(isPromiseLike(value) ? await value : value, index);\n\t\t\t\tconst selected = isPromiseLike(result) ? await result : result;\n\t\t\t\tif (isNonNullish(selected)) yield selected;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = selector(value, index);\n\t\t\t\tconst selected = isPromiseLike(result) ? await result : result;\n\t\t\t\tif (isNonNullish(selected)) yield selected;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}))),\n\t\tslice: (start, end) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst normalizedStart = toIntegerOrInfinity(start);\n\t\t\tconst normalizedEnd = end === void 0 ? void 0 : toIntegerOrInfinity(end);\n\t\t\tif (normalizedStart < 0 || normalizedEnd !== void 0 && normalizedEnd < 0) {\n\t\t\t\tconst values = await materializeValues(iteratorFactories);\n\t\t\t\tfor (const value of values.slice(start, end)) yield value;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst startIndex = Math.max(normalizedStart, 0);\n\t\t\tif (startIndex === Infinity) return;\n\t\t\tconst endIndex = normalizedEnd === void 0 ? void 0 : Math.max(normalizedEnd, 0);\n\t\t\tif (endIndex !== void 0 && endIndex !== Infinity && endIndex <= startIndex) return;\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) {\n\t\t\t\tconst iterator = syncFactory()[Symbol.iterator]();\n\t\t\t\twhile (true) {\n\t\t\t\t\tif (endIndex !== void 0 && endIndex !== Infinity && index >= endIndex) return;\n\t\t\t\t\tconst result = iterator.next();\n\t\t\t\t\tif (result.done) return;\n\t\t\t\t\tconst value = result.value;\n\t\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\t\tif (index >= startIndex) yield resolvedValue;\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst iterator = iterableFactory()[Symbol.asyncIterator]();\n\t\t\t\twhile (true) {\n\t\t\t\t\tif (endIndex !== void 0 && endIndex !== Infinity && index >= endIndex) return;\n\t\t\t\t\tconst result = await iterator.next();\n\t\t\t\t\tif (result.done) return;\n\t\t\t\t\tconst value = result.value;\n\t\t\t\t\tif (index >= startIndex) yield value;\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t}\n\t\t})),\n\t\tdistinct: () => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst seenValues = /* @__PURE__ */ new Set();\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tif (!seenValues.has(resolvedValue)) {\n\t\t\t\t\tseenValues.add(resolvedValue);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) if (!seenValues.has(value)) {\n\t\t\t\tseenValues.add(value);\n\t\t\t\tyield value;\n\t\t\t}\n\t\t})),\n\t\tdistinctBy: (selector) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tlet index = 0;\n\t\t\tconst seenKeys = /* @__PURE__ */ new Set();\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst selectedKey = selector(resolvedValue, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (!seenKeys.has(key)) {\n\t\t\t\t\tseenKeys.add(key);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst selectedKey = selector(value, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (!seenKeys.has(key)) {\n\t\t\t\t\tseenKeys.add(key);\n\t\t\t\t\tyield value;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t})),\n\t\tskip: (count) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst normalizedCount = normalizeCount(count);\n\t\t\tlet skippedCount = 0;\n\t\t\tfor await (const value of iterableFactory()) {\n\t\t\t\tif (skippedCount < normalizedCount) {\n\t\t\t\t\tskippedCount++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tyield value;\n\t\t\t}\n\t\t})),\n\t\tskipWhile: (predicate) => appendLinearOperation({\n\t\t\tkind: \"skipWhile\",\n\t\t\tpredicate\n\t\t}, () => createAsyncOnlyFactories(() => createAsyncIterable(async function* () {\n\t\t\tlet index = 0;\n\t\t\tlet skipping = true;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst result = predicate(resolvedValue, index);\n\t\t\t\tif (skipping && (isPromiseLike(result) ? await result : result)) {\n\t\t\t\t\tindex++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tskipping = false;\n\t\t\t\tyield resolvedValue;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = predicate(value, index);\n\t\t\t\tif (skipping && (isPromiseLike(result) ? await result : result)) {\n\t\t\t\t\tindex++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tskipping = false;\n\t\t\t\tyield value;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}))),\n\t\ttake: (count) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst normalizedCount = normalizeCount(count);\n\t\t\tif (normalizedCount === 0) return;\n\t\t\tlet takenCount = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tyield isPromiseLike(value) ? await value : value;\n\t\t\t\ttakenCount++;\n\t\t\t\tif (takenCount >= normalizedCount) return;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tyield value;\n\t\t\t\ttakenCount++;\n\t\t\t\tif (takenCount >= normalizedCount) return;\n\t\t\t}\n\t\t})),\n\t\ttakeWhile: (predicate) => appendLinearOperation({\n\t\t\tkind: \"takeWhile\",\n\t\t\tpredicate\n\t\t}, () => createAsyncOnlyFactories(() => createAsyncIterable(async function* () {\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst result = predicate(resolvedValue, index);\n\t\t\t\tif (!(isPromiseLike(result) ? await result : result)) return;\n\t\t\t\tyield resolvedValue;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = predicate(value, index);\n\t\t\t\tif (!(isPromiseLike(result) ? await result : result)) return;\n\t\t\t\tyield value;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}))),\n\t\tpairwise: () => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tlet hasPreviousValue = false;\n\t\t\tlet previousValue;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tif (hasPreviousValue) yield [previousValue, resolvedValue];\n\t\t\t\tpreviousValue = resolvedValue;\n\t\t\t\thasPreviousValue = true;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tif (hasPreviousValue) yield [previousValue, value];\n\t\t\t\tpreviousValue = value;\n\t\t\t\thasPreviousValue = true;\n\t\t\t}\n\t\t})),\n\t\tzip: (source) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tif (isAsyncIterable(source)) {\n\t\t\t\tconst otherIterator = source[Symbol.asyncIterator]();\n\t\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\t\tconst otherResult = await otherIterator.next();\n\t\t\t\t\tif (otherResult.done) return;\n\t\t\t\t\tyield [isPromiseLike(value) ? await value : value, otherResult.value];\n\t\t\t\t}\n\t\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\t\tconst otherResult = await otherIterator.next();\n\t\t\t\t\tif (otherResult.done) return;\n\t\t\t\t\tyield [value, otherResult.value];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst otherIterator = source[Symbol.iterator]();\n\t\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\t\tconst otherResult = otherIterator.next();\n\t\t\t\t\tif (otherResult.done) return;\n\t\t\t\t\tyield [isPromiseLike(value) ? await value : value, isPromiseLike(otherResult.value) ? await otherResult.value : otherResult.value];\n\t\t\t\t}\n\t\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\t\tconst otherResult = otherIterator.next();\n\t\t\t\t\tif (otherResult.done) return;\n\t\t\t\t\tyield [value, isPromiseLike(otherResult.value) ? await otherResult.value : otherResult.value];\n\t\t\t\t}\n\t\t\t}\n\t\t})),\n\t\tscan: (reducer, initialValue) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tlet accumulator = initialValue;\n\t\t\tlet index = 0;\n\t\t\tyield accumulator;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst reduced = reducer(accumulator, resolvedValue, index);\n\t\t\t\taccumulator = isPromiseLike(reduced) ? await reduced : reduced;\n\t\t\t\tyield accumulator;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst reduced = reducer(accumulator, value, index);\n\t\t\t\taccumulator = isPromiseLike(reduced) ? await reduced : reduced;\n\t\t\t\tyield accumulator;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t})),\n\t\tunion: (source) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst seenValues = /* @__PURE__ */ new Set();\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tif (!seenValues.has(resolvedValue)) {\n\t\t\t\t\tseenValues.add(resolvedValue);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) if (!seenValues.has(value)) {\n\t\t\t\tseenValues.add(value);\n\t\t\t\tyield value;\n\t\t\t}\n\t\t\tif (isAsyncIterable(source)) {\n\t\t\t\tfor await (const value of source) if (!seenValues.has(value)) {\n\t\t\t\t\tseenValues.add(value);\n\t\t\t\t\tyield value;\n\t\t\t\t}\n\t\t\t} else for (const value of source) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tif (!seenValues.has(resolvedValue)) {\n\t\t\t\t\tseenValues.add(resolvedValue);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t})),\n\t\tunionBy: (source, selector) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst seenKeys = /* @__PURE__ */ new Set();\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst selectedKey = selector(resolvedValue, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (!seenKeys.has(key)) {\n\t\t\t\t\tseenKeys.add(key);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst selectedKey = selector(value, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (!seenKeys.has(key)) {\n\t\t\t\t\tseenKeys.add(key);\n\t\t\t\t\tyield value;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tindex = 0;\n\t\t\tif (isAsyncIterable(source)) for await (const value of source) {\n\t\t\t\tconst selectedKey = selector(value, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (!seenKeys.has(key)) {\n\t\t\t\t\tseenKeys.add(key);\n\t\t\t\t\tyield value;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for (const value of source) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst selectedKey = selector(resolvedValue, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (!seenKeys.has(key)) {\n\t\t\t\t\tseenKeys.add(key);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t})),\n\t\tintersect: (source) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst rightValues = await collectValuesFromSource(source);\n\t\t\tconst yieldedValues = /* @__PURE__ */ new Set();\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tif (rightValues.has(resolvedValue) && !yieldedValues.has(resolvedValue)) {\n\t\t\t\t\tyieldedValues.add(resolvedValue);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) if (rightValues.has(value) && !yieldedValues.has(value)) {\n\t\t\t\tyieldedValues.add(value);\n\t\t\t\tyield value;\n\t\t\t}\n\t\t})),\n\t\tintersectBy: (source, selector) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst rightKeys = await collectKeysFromSource(source, selector);\n\t\t\tconst yieldedKeys = /* @__PURE__ */ new Set();\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst selectedKey = selector(resolvedValue, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (rightKeys.has(key) && !yieldedKeys.has(key)) {\n\t\t\t\t\tyieldedKeys.add(key);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst selectedKey = selector(value, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (rightKeys.has(key) && !yieldedKeys.has(key)) {\n\t\t\t\t\tyieldedKeys.add(key);\n\t\t\t\t\tyield value;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t})),\n\t\texcept: (source) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst excludedValues = await collectValuesFromSource(source);\n\t\t\tconst yieldedValues = /* @__PURE__ */ new Set();\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tif (!excludedValues.has(resolvedValue) && !yieldedValues.has(resolvedValue)) {\n\t\t\t\t\tyieldedValues.add(resolvedValue);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) if (!excludedValues.has(value) && !yieldedValues.has(value)) {\n\t\t\t\tyieldedValues.add(value);\n\t\t\t\tyield value;\n\t\t\t}\n\t\t})),\n\t\texceptBy: (source, selector) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst excludedKeys = await collectKeysFromSource(source, selector);\n\t\t\tconst yieldedKeys = /* @__PURE__ */ new Set();\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst selectedKey = selector(resolvedValue, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (!excludedKeys.has(key) && !yieldedKeys.has(key)) {\n\t\t\t\t\tyieldedKeys.add(key);\n\t\t\t\t\tyield resolvedValue;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst selectedKey = selector(value, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tif (!excludedKeys.has(key) && !yieldedKeys.has(key)) {\n\t\t\t\t\tyieldedKeys.add(key);\n\t\t\t\t\tyield value;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t})),\n\t\tchunkBySize: (size) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst normalizedSize = normalizeRequiredCount(size, \"Chunk size\");\n\t\t\tlet chunk = [];\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tchunk.push(isPromiseLike(value) ? await value : value);\n\t\t\t\tif (chunk.length >= normalizedSize) {\n\t\t\t\t\tyield chunk;\n\t\t\t\t\tchunk = [];\n\t\t\t\t}\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tchunk.push(value);\n\t\t\t\tif (chunk.length >= normalizedSize) {\n\t\t\t\t\tyield chunk;\n\t\t\t\t\tchunk = [];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (chunk.length > 0) yield chunk;\n\t\t})),\n\t\twindowed: (size) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst normalizedSize = normalizeRequiredCount(size, \"Window size\");\n\t\t\tconst buffer = new Array(normalizedSize);\n\t\t\tlet count = 0;\n\t\t\tlet nextIndex = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tbuffer[nextIndex] = isPromiseLike(value) ? await value : value;\n\t\t\t\tnextIndex = (nextIndex + 1) % normalizedSize;\n\t\t\t\tcount = Math.min(count + 1, normalizedSize);\n\t\t\t\tif (count < normalizedSize) continue;\n\t\t\t\tconst window = new Array(normalizedSize);\n\t\t\t\tfor (let index = 0; index < normalizedSize; index++) window[index] = buffer[(nextIndex + index) % normalizedSize];\n\t\t\t\tyield window;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tbuffer[nextIndex] = value;\n\t\t\t\tnextIndex = (nextIndex + 1) % normalizedSize;\n\t\t\t\tcount = Math.min(count + 1, normalizedSize);\n\t\t\t\tif (count < normalizedSize) continue;\n\t\t\t\tconst window = new Array(normalizedSize);\n\t\t\t\tfor (let index = 0; index < normalizedSize; index++) window[index] = buffer[(nextIndex + index) % normalizedSize];\n\t\t\t\tyield window;\n\t\t\t}\n\t\t})),\n\t\tflat,\n\t\treverse: () => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst values = await materializeValues(iteratorFactories);\n\t\t\tvalues.reverse();\n\t\t\tfor (const value of values) yield value;\n\t\t})),\n\t\ttoReversed: () => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst values = await materializeValues(iteratorFactories);\n\t\t\tfor (const value of [...values].reverse()) yield value;\n\t\t})),\n\t\tsort: (compareFn) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst values = await materializeValues(iteratorFactories);\n\t\t\tcompareFn === void 0 ? values.sort() : values.sort(compareFn);\n\t\t\tfor (const value of values) yield value;\n\t\t})),\n\t\ttoSorted: (compareFn) => createAsyncOperator(() => createAsyncIterable(async function* () {\n\t\t\tconst sortedValues = [...await materializeValues(iteratorFactories)];\n\t\t\tcompareFn === void 0 ? sortedValues.sort() : sortedValues.sort(compareFn);\n\t\t\tfor (const value of sortedValues) yield value;\n\t\t})),\n\t\tforEach: async (action) => {\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst result = action(isPromiseLike(value) ? await value : value, index);\n\t\t\t\tif (isPromiseLike(result)) await result;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = action(value, index);\n\t\t\t\tif (isPromiseLike(result)) await result;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t},\n\t\treduce,\n\t\treduceRight,\n\t\tsome: async (predicate) => {\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst result = predicate(isPromiseLike(value) ? await value : value, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) return true;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = predicate(value, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) return true;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tevery: async (predicate) => {\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst result = predicate(isPromiseLike(value) ? await value : value, index);\n\t\t\t\tif (!(isPromiseLike(result) ? await result : result)) return false;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = predicate(value, index);\n\t\t\t\tif (!(isPromiseLike(result) ? await result : result)) return false;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t\tfind: async (predicate) => {\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst result = predicate(resolvedValue, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) return resolvedValue;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = predicate(value, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) return value;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t},\n\t\tfindIndex: async (predicate) => {\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst result = predicate(isPromiseLike(value) ? await value : value, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) return index;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = predicate(value, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) return index;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\treturn -1;\n\t\t},\n\t\tat: async (index) => {\n\t\t\tconst normalizedIndex = toIntegerOrInfinity(index);\n\t\t\tif (normalizedIndex >= 0) {\n\t\t\t\tif (normalizedIndex === Infinity) return;\n\t\t\t\tlet currentIndex = 0;\n\t\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\t\tif (currentIndex === normalizedIndex) return resolvedValue;\n\t\t\t\t\tcurrentIndex++;\n\t\t\t\t}\n\t\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\t\tif (currentIndex === normalizedIndex) return value;\n\t\t\t\t\tcurrentIndex++;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (normalizedIndex === -Infinity) return;\n\t\t\tconst lookback = Math.abs(normalizedIndex);\n\t\t\tconst buffer = new Array(lookback);\n\t\t\tlet count = 0;\n\t\t\tlet nextIndex = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tbuffer[nextIndex] = isPromiseLike(value) ? await value : value;\n\t\t\t\tnextIndex = (nextIndex + 1) % lookback;\n\t\t\t\tcount = Math.min(count + 1, lookback);\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tbuffer[nextIndex] = value;\n\t\t\t\tnextIndex = (nextIndex + 1) % lookback;\n\t\t\t\tcount = Math.min(count + 1, lookback);\n\t\t\t}\n\t\t\treturn count === lookback ? buffer[nextIndex] : void 0;\n\t\t},\n\t\tincludes: async (searchElement, fromIndex) => {\n\t\t\tconst normalizedFromIndex = toIntegerOrInfinity(fromIndex !== null && fromIndex !== void 0 ? fromIndex : 0);\n\t\t\tif (normalizedFromIndex < 0) return (await materializeValues(iteratorFactories)).includes(searchElement, normalizedFromIndex);\n\t\t\tif (normalizedFromIndex === Infinity) return false;\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tif (index >= normalizedFromIndex && sameValueZero(resolvedValue, searchElement)) return true;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tif (index >= normalizedFromIndex && sameValueZero(value, searchElement)) return true;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tindexOf: async (searchElement, fromIndex) => {\n\t\t\tconst normalizedFromIndex = toIntegerOrInfinity(fromIndex !== null && fromIndex !== void 0 ? fromIndex : 0);\n\t\t\tif (normalizedFromIndex < 0) return (await materializeValues(iteratorFactories)).indexOf(searchElement, normalizedFromIndex);\n\t\t\tif (normalizedFromIndex === Infinity) return -1;\n\t\t\tlet index = 0;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tif (index >= normalizedFromIndex && resolvedValue === searchElement) return index;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tif (index >= normalizedFromIndex && value === searchElement) return index;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\treturn -1;\n\t\t},\n\t\tlastIndexOf: async (searchElement, fromIndex) => {\n\t\t\tconst values = await materializeValues(iteratorFactories);\n\t\t\treturn fromIndex === void 0 ? values.lastIndexOf(searchElement) : values.lastIndexOf(searchElement, fromIndex);\n\t\t},\n\t\tfindLast: async (predicate) => {\n\t\t\tlet index = 0;\n\t\t\tlet foundValue;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst result = predicate(resolvedValue, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) foundValue = resolvedValue;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = predicate(value, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) foundValue = value;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\treturn foundValue;\n\t\t},\n\t\tfindLastIndex: async (predicate) => {\n\t\t\tlet index = 0;\n\t\t\tlet foundIndex = -1;\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst result = predicate(isPromiseLike(value) ? await value : value, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) foundIndex = index;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst result = predicate(value, index);\n\t\t\t\tif (isPromiseLike(result) ? await result : result) foundIndex = index;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\treturn foundIndex;\n\t\t},\n\t\tmin: async () => findExtremeBy(iteratorFactories, identity, \"min\"),\n\t\tminBy: async (selector) => findExtremeBy(iteratorFactories, selector, \"min\"),\n\t\tmax: async () => findExtremeBy(iteratorFactories, (value) => value, \"max\"),\n\t\tmaxBy: async (selector) => findExtremeBy(iteratorFactories, selector, \"max\"),\n\t\tgroupBy: async (selector) => {\n\t\t\tlet index = 0;\n\t\t\tconst groupedValues = /* @__PURE__ */ new Map();\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tconst selectedKey = selector(resolvedValue, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tconst existingGroup = groupedValues.get(key);\n\t\t\t\tif (existingGroup) existingGroup.push(resolvedValue);\n\t\t\t\telse groupedValues.set(key, [resolvedValue]);\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tconst selectedKey = selector(value, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tconst existingGroup = groupedValues.get(key);\n\t\t\t\tif (existingGroup) existingGroup.push(value);\n\t\t\t\telse groupedValues.set(key, [value]);\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\treturn groupedValues;\n\t\t},\n\t\tcountBy: async (selector) => {\n\t\t\tlet index = 0;\n\t\t\tconst counts = /* @__PURE__ */ new Map();\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tvar _counts$get;\n\t\t\t\tconst selectedKey = selector(isPromiseLike(value) ? await value : value, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tcounts.set(key, ((_counts$get = counts.get(key)) !== null && _counts$get !== void 0 ? _counts$get : 0) + 1);\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tvar _counts$get2;\n\t\t\t\tconst selectedKey = selector(value, index);\n\t\t\t\tconst key = isPromiseLike(selectedKey) ? await selectedKey : selectedKey;\n\t\t\t\tcounts.set(key, ((_counts$get2 = counts.get(key)) !== null && _counts$get2 !== void 0 ? _counts$get2 : 0) + 1);\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\treturn counts;\n\t\t},\n\t\tjoin: async (separator) => {\n\t\t\tconst normalizedSeparator = separator !== null && separator !== void 0 ? separator : \",\";\n\t\t\tlet isFirst = true;\n\t\t\tlet result = \"\";\n\t\t\tif (syncFactory !== void 0) for (const value of syncFactory()) {\n\t\t\t\tconst resolvedValue = isPromiseLike(value) ? await value : value;\n\t\t\t\tif (!isFirst) result += normalizedSeparator;\n\t\t\t\tresult += resolvedValue == null ? \"\" : String(resolvedValue);\n\t\t\t\tisFirst = false;\n\t\t\t}\n\t\t\telse for await (const value of iterableFactory()) {\n\t\t\t\tif (!isFirst) result += normalizedSeparator;\n\t\t\t\tresult += value == null ? \"\" : String(value);\n\t\t\t\tisFirst = false;\n\t\t\t}\n\t\t\treturn result;\n\t\t},\n\t\ttoArray: async () => materializeValues(iteratorFactories)\n\t};\n};\n/**\n* Creates a chainable async operator pipeline from an iterable of values or promise-like values\n* @param source - Source iterable to resolve\n* @returns A lazy async operator pipeline\n*/\nvar from = (source) => createAsyncOperator(createIteratorFactories(source));\n//#endregion\nexport { createAsyncLocal, createMutex as createAsyncLock, createMutex, createConditional, createConditional as createSignal, createDeferred, createDeferredGenerator, createManuallyConditional, createManuallyConditional as createManuallySignal, createReaderWriterLock, createSemaphore, defer, delay, from, getCurrentLogicalContextId, getLogicalContextValue, onAbort, runOnNewLogicalContext, setLogicalContextValue };\n\n//# sourceMappingURL=index.mjs.map","// src/vlq.ts\nvar comma = \",\".charCodeAt(0);\nvar semicolon = \";\".charCodeAt(0);\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar intToChar = new Uint8Array(64);\nvar charToInt = new Uint8Array(128);\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\nfunction decodeInteger(reader, relative) {\n let value = 0;\n let shift = 0;\n let integer = 0;\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n const shouldNegate = value & 1;\n value >>>= 1;\n if (shouldNegate) {\n value = -2147483648 | -value;\n }\n return relative + value;\n}\nfunction encodeInteger(builder, num, relative) {\n let delta = num - relative;\n delta = delta < 0 ? -delta << 1 | 1 : delta << 1;\n do {\n let clamped = delta & 31;\n delta >>>= 5;\n if (delta > 0) clamped |= 32;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n return num;\n}\nfunction hasMoreVlq(reader, max) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n\n// src/strings.ts\nvar bufLength = 1024 * 16;\nvar td = typeof TextDecoder !== \"undefined\" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== \"undefined\" ? {\n decode(buf) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n }\n} : {\n decode(buf) {\n let out = \"\";\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n }\n};\nvar StringWriter = class {\n constructor() {\n this.pos = 0;\n this.out = \"\";\n this.buffer = new Uint8Array(bufLength);\n }\n write(v) {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n flush() {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n};\nvar StringReader = class {\n constructor(buffer) {\n this.pos = 0;\n this.buffer = buffer;\n }\n next() {\n return this.buffer.charCodeAt(this.pos++);\n }\n peek() {\n return this.buffer.charCodeAt(this.pos);\n }\n indexOf(char) {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n};\n\n// src/scopes.ts\nvar EMPTY = [];\nfunction decodeOriginalScopes(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes = [];\n const stack = [];\n let line = 0;\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop();\n last[2] = line;\n last[3] = column;\n continue;\n }\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 1;\n const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];\n let vars = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n scopes.push(scope);\n stack.push(scope);\n }\n return scopes;\n}\nfunction encodeOriginalScopes(scopes) {\n const writer = new StringWriter();\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n return writer.flush();\n}\nfunction _encodeOriginalScopes(scopes, index, writer, state) {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n if (index > 0) writer.write(comma);\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n const fields = scope.length === 6 ? 1 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n return index;\n}\nfunction decodeGeneratedRanges(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges = [];\n const stack = [];\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n do {\n const semi = reader.indexOf(\";\");\n let genColumn = 0;\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop();\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 1;\n const hasCallsite = fields & 2;\n const hasScope = fields & 4;\n let callsite = null;\n let bindings = EMPTY;\n let range;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0\n );\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];\n } else {\n range = [genLine, genColumn, 0, 0];\n }\n range.isScope = !!hasScope;\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0\n );\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges;\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n ranges.push(range);\n stack.push(range);\n }\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n return ranges;\n}\nfunction encodeGeneratedRanges(ranges) {\n if (ranges.length === 0) return \"\";\n const writer = new StringWriter();\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n return writer.flush();\n}\nfunction _encodeGeneratedRanges(ranges, index, writer, state) {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings\n } = range;\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, range[1], state[1]);\n const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);\n encodeInteger(writer, fields, 0);\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);\n encodeInteger(writer, expRange[0], 0);\n }\n }\n }\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n return index;\n}\nfunction catchupLine(writer, lastLine, line) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n\n// src/sourcemap-codec.ts\nfunction decode(mappings) {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n do {\n const semi = reader.indexOf(\";\");\n const line = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n while (reader.pos < semi) {\n let seg;\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n line.push(seg);\n reader.pos++;\n }\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n return decoded;\n}\nfunction sort(line) {\n line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[0] - b[0];\n}\nfunction encode(decoded) {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n let genColumn = 0;\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n genColumn = encodeInteger(writer, segment[0], genColumn);\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n return writer.flush();\n}\nexport {\n decode,\n decodeGeneratedRanges,\n decodeOriginalScopes,\n encode,\n encodeGeneratedRanges,\n encodeOriginalScopes\n};\n//# sourceMappingURL=sourcemap-codec.mjs.map\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\n//////////////////////////////////////////////////////////////////////////////////\n\nexport interface TextEdit {\n readonly start: number;\n readonly end: number;\n readonly text: string;\n}\n\nexport interface LineColumnOffset {\n readonly line: number;\n readonly column: number;\n}\n\nconst readNewlineAt = (value: string, index: number): string | undefined => {\n if (index < 0 || index >= value.length) {\n return undefined;\n }\n if (value.startsWith('\\r\\n', index)) {\n return '\\r\\n';\n }\n const char = value[index];\n if (char === '\\n' || char === '\\r') {\n return char;\n }\n return undefined;\n};\n\nconst findFirstNewline = (value: string): string | undefined => {\n for (let index = 0; index < value.length; index++) {\n const newline = readNewlineAt(value, index);\n if (newline) {\n return newline;\n }\n }\n return undefined;\n};\n\nconst findPreviousNewline = (\n value: string,\n index: number\n): string | undefined => {\n for (let current = index - 1; current >= 0; current--) {\n if (value[current] === '\\n') {\n return current > 0 && value[current - 1] === '\\r' ? '\\r\\n' : '\\n';\n }\n if (value[current] === '\\r') {\n return '\\r';\n }\n }\n return undefined;\n};\n\nexport const applyTextEdits = (\n value: string,\n edits: readonly TextEdit[]\n): string => {\n if (edits.length === 0) {\n return value;\n }\n\n const sorted = [...edits].sort((lhs, rhs) => rhs.start - lhs.start);\n let result = value;\n let previousStart = value.length;\n\n for (const edit of sorted) {\n if (edit.start > edit.end) {\n throw new Error(`Invalid text edit range: ${edit.start} > ${edit.end}`);\n }\n if (edit.end > previousStart) {\n throw new Error('Overlapping text edits are not supported');\n }\n result = result.slice(0, edit.start) + edit.text + result.slice(edit.end);\n previousStart = edit.start;\n }\n\n return result;\n};\n\nexport const detectPreferredNewline = (\n value: string,\n start: number,\n end: number\n): string => {\n const within = findFirstNewline(value.slice(start, end));\n if (within) {\n return within;\n }\n\n const adjacent = readNewlineAt(value, end);\n if (adjacent) {\n return adjacent;\n }\n\n const after = findFirstNewline(value.slice(end));\n if (after) {\n return after;\n }\n\n const before = findPreviousNewline(value, start);\n if (before) {\n return before;\n }\n\n return findFirstNewline(value) ?? '\\n';\n};\n\nexport const collectLineStarts = (value: string): readonly number[] => {\n const starts = [0];\n\n for (let index = 0; index < value.length; index++) {\n const char = value[index];\n if (char === '\\r') {\n if (value[index + 1] === '\\n') {\n index += 1;\n }\n starts.push(index + 1);\n continue;\n }\n if (char === '\\n') {\n starts.push(index + 1);\n }\n }\n\n return starts;\n};\n\nexport const getLineColumnOffset = (\n lineStarts: readonly number[],\n offset: number\n): LineColumnOffset => {\n let low = 0;\n let high = lineStarts.length - 1;\n\n while (low <= high) {\n const middle = (low + high) >> 1;\n const lineStart = lineStarts[middle];\n const nextStart =\n middle + 1 < lineStarts.length\n ? lineStarts[middle + 1]\n : Number.MAX_SAFE_INTEGER;\n\n if (offset < lineStart) {\n high = middle - 1;\n continue;\n }\n if (offset >= nextStart) {\n low = middle + 1;\n continue;\n }\n\n return {\n line: middle,\n column: offset - lineStart,\n };\n }\n\n const lastLine = Math.max(0, lineStarts.length - 1);\n return {\n line: lastLine,\n column: offset - lineStarts[lastLine],\n };\n};\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\nimport { decode, encode } from '@jridgewell/sourcemap-codec';\nimport { dirname, join, posix, resolve } from 'path';\n\nimport type { Logger } from './internal';\nimport {\n applyTextEdits,\n collectLineStarts,\n getLineColumnOffset,\n TextEdit,\n} from './text-edits';\n\n//////////////////////////////////////////////////////////////////////////////////\n\nconst declarationFilePattern = /\\.d\\.(?:cts|mts|ts)$/;\n\ntype DeclarationRuntimeSuffix = '.js' | '.mjs' | '.cjs';\n\nexport interface DeclarationImportFixResult {\n readonly changed: boolean;\n readonly code: string;\n readonly edits: readonly TextEdit[];\n}\n\ninterface SourceMapLike {\n file?: string;\n mappings: string;\n names?: readonly string[];\n sourceRoot?: string;\n sources?: readonly string[];\n sourcesContent?: readonly (string | null)[];\n version: number;\n}\n\nconst isRelativeSpecifier = (specifier: string): boolean =>\n specifier.startsWith('./') || specifier.startsWith('../');\n\nconst hasExplicitExtension = (specifier: string): boolean =>\n posix.extname(specifier) !== '';\n\nconst getDeclarationRuntimeSuffix = (\n declarationPath: string\n): DeclarationRuntimeSuffix => {\n if (declarationPath.endsWith('.d.mts')) {\n return '.mjs';\n }\n if (declarationPath.endsWith('.d.cts')) {\n return '.cjs';\n }\n return '.js';\n};\n\nconst createCandidateDeclarationPaths = (\n resolvedPath: string\n): readonly string[] => [\n `${resolvedPath}.d.ts`,\n `${resolvedPath}.d.mts`,\n `${resolvedPath}.d.cts`,\n join(resolvedPath, 'index.d.ts'),\n join(resolvedPath, 'index.d.mts'),\n join(resolvedPath, 'index.d.cts'),\n];\n\nconst resolveSpecifierSuffix = (\n specifier: string,\n importerPath: string,\n declarationFiles: ReadonlySet<string>,\n logger?: Logger\n): string | undefined => {\n if (!isRelativeSpecifier(specifier) || hasExplicitExtension(specifier)) {\n return undefined;\n }\n\n const resolvedPath = resolve(dirname(importerPath), specifier);\n const matches = createCandidateDeclarationPaths(resolvedPath).filter((path) =>\n declarationFiles.has(path)\n );\n\n if (matches.length === 0) {\n return undefined;\n }\n\n if (matches.length >= 2) {\n logger?.warn(\n `[fixDeclarationImports] Skipped ambiguous declaration import: ${specifier} (${matches\n .map((path) => path.split(/[/\\\\]/).pop() ?? path)\n .join(', ')})`\n );\n return undefined;\n }\n\n const match = matches[0];\n const runtimeSuffix = getDeclarationRuntimeSuffix(match);\n const indexPrefix = join(resolvedPath, 'index.');\n\n return match.startsWith(indexPrefix)\n ? `/index${runtimeSuffix}`\n : runtimeSuffix;\n};\n\nconst collectModuleSpecifierEdits = (\n ts: typeof import('typescript'),\n sourceFile: import('typescript').SourceFile,\n importerPath: string,\n declarationFiles: ReadonlySet<string>,\n logger?: Logger\n): TextEdit[] => {\n const edits: TextEdit[] = [];\n const seen = new Set<number>();\n\n const pushSpecifierEdit = (\n literal: import('typescript').StringLiteralLike\n ) => {\n const suffix = resolveSpecifierSuffix(\n literal.text,\n importerPath,\n declarationFiles,\n logger\n );\n if (!suffix) {\n return;\n }\n\n const insertionPoint = literal.getEnd() - 1;\n if (seen.has(insertionPoint)) {\n return;\n }\n seen.add(insertionPoint);\n\n edits.push({\n start: insertionPoint,\n end: insertionPoint,\n text: suffix,\n });\n };\n\n const visit = (node: import('typescript').Node) => {\n if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {\n if (\n node.moduleSpecifier &&\n ts.isStringLiteralLike(node.moduleSpecifier)\n ) {\n pushSpecifierEdit(node.moduleSpecifier);\n }\n } else if (ts.isImportTypeNode(node)) {\n const argument = node.argument;\n if (\n ts.isLiteralTypeNode(argument) &&\n ts.isStringLiteralLike(argument.literal)\n ) {\n pushSpecifierEdit(argument.literal);\n }\n }\n\n node.forEachChild(visit);\n };\n\n sourceFile.forEachChild(visit);\n\n return edits;\n};\n\nexport const isDeclarationFilePath = (filePath: string): boolean =>\n declarationFilePattern.test(filePath);\n\nexport const fixDeclarationImportSpecifiers = (\n ts: typeof import('typescript'),\n code: string,\n filePath: string,\n declarationFiles: ReadonlySet<string>,\n logger?: Logger\n): DeclarationImportFixResult => {\n const sourceFile = ts.createSourceFile(\n filePath,\n code,\n ts.ScriptTarget.ESNext,\n false,\n ts.ScriptKind.TS\n );\n\n const edits = collectModuleSpecifierEdits(\n ts,\n sourceFile,\n filePath,\n declarationFiles,\n logger\n );\n\n if (edits.length === 0) {\n return {\n changed: false,\n code,\n edits,\n };\n }\n\n return {\n changed: true,\n code: applyTextEdits(code, edits),\n edits,\n };\n};\n\nexport const adjustSourceMapForDeclarationEdits = (\n source: string | Uint8Array,\n originalCode: string,\n edits: readonly TextEdit[]\n): string | undefined => {\n if (edits.length === 0) {\n return undefined;\n }\n\n const original =\n typeof source === 'string' ? source : Buffer.from(source).toString('utf-8');\n\n let map: SourceMapLike;\n try {\n map = JSON.parse(original) as SourceMapLike;\n } catch {\n return undefined;\n }\n\n if (!map || typeof map.mappings !== 'string') {\n return undefined;\n }\n\n const lineStarts = collectLineStarts(originalCode);\n const lineDeltas = new Map<\n number,\n Array<{ column: number; delta: number }>\n >();\n\n for (const edit of edits) {\n if (edit.start !== edit.end) {\n return undefined;\n }\n if (edit.text.includes('\\n') || edit.text.includes('\\r')) {\n return undefined;\n }\n\n const position = getLineColumnOffset(lineStarts, edit.start);\n const entries = lineDeltas.get(position.line) ?? [];\n entries.push({\n column: position.column,\n delta: edit.text.length,\n });\n lineDeltas.set(position.line, entries);\n }\n\n if (lineDeltas.size === 0) {\n return undefined;\n }\n\n const decodedMappings = decode(map.mappings);\n\n for (const [line, entries] of lineDeltas.entries()) {\n const segments = decodedMappings[line];\n if (!segments || segments.length === 0) {\n continue;\n }\n\n const sortedEntries = [...entries].sort(\n (lhs, rhs) => lhs.column - rhs.column\n );\n let entryIndex = 0;\n let cumulativeDelta = 0;\n\n for (const segment of segments) {\n while (\n entryIndex < sortedEntries.length &&\n sortedEntries[entryIndex].column <= segment[0]\n ) {\n cumulativeDelta += sortedEntries[entryIndex].delta;\n entryIndex += 1;\n }\n\n segment[0] += cumulativeDelta;\n }\n }\n\n map.mappings = encode(decodedMappings);\n const serialized = JSON.stringify(map);\n return original.endsWith('\\n') ? `${serialized}\\n` : serialized;\n};\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\nimport { createHash } from 'crypto';\nimport { existsSync } from 'fs';\nimport { readFile } from 'fs/promises';\nimport { dirname, extname, join } from 'path';\n\nimport { applyTextEdits, detectPreferredNewline, TextEdit } from './text-edits';\n\n// We use async I/O except 'existsSync', because 'exists' will throw an error if the file does not exist.\n\n//////////////////////////////////////////////////////////////////////////////////\n\nexport type ModuleInteropKind = 'cjs' | 'esm' | 'unresolvable' | 'unknown';\n\nconst importConditions = ['import', 'node', 'default'] as const;\n\nconst stripQuery = (id: string): string => {\n const queryIndex = id.indexOf('?');\n return queryIndex === -1 ? id : id.slice(0, queryIndex);\n};\n\nconst isBareSpecifier = (specifier: string): boolean => {\n if (!specifier) {\n return false;\n }\n if (specifier.startsWith('.')) {\n return false;\n }\n if (specifier.startsWith('/') || specifier.startsWith('\\\\')) {\n return false;\n }\n if (specifier.startsWith('node:')) {\n return false;\n }\n if (specifier.includes(':')) {\n return false;\n }\n return true;\n};\n\nconst parsePackageName = (\n specifier: string\n): { packageName: string; subpath: string } => {\n if (specifier.startsWith('@')) {\n const parts = specifier.split('/');\n if (parts.length >= 2) {\n return {\n packageName: `${parts[0]}/${parts[1]}`,\n subpath: parts.slice(2).join('/'),\n };\n }\n }\n const [packageName, ...rest] = specifier.split('/');\n return { packageName, subpath: rest.join('/') };\n};\n\nconst findPackageJsonPath = (\n packageName: string,\n importerDir: string\n): string | undefined => {\n let current = importerDir;\n while (true) {\n const candidate = join(\n current,\n 'node_modules',\n packageName,\n 'package.json'\n );\n if (existsSync(candidate)) {\n return candidate;\n }\n const parent = dirname(current);\n if (parent === current) {\n return undefined;\n }\n current = parent;\n }\n};\n\nconst readPackageJson = async (\n packageJsonPath: string\n): Promise<Record<string, unknown> | undefined> => {\n try {\n const raw = await readFile(packageJsonPath, 'utf8');\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === 'object') {\n return parsed as Record<string, unknown>;\n }\n } catch {\n return undefined;\n }\n return undefined;\n};\n\nconst resolveExportTarget = (\n target: unknown,\n subpath: string,\n conditions: readonly string[]\n): string | undefined => {\n if (typeof target === 'string') {\n if (subpath && subpath !== '.') {\n return undefined;\n }\n return target;\n }\n if (Array.isArray(target)) {\n for (const entry of target) {\n const resolved = resolveExportTarget(entry, subpath, conditions);\n if (resolved) {\n return resolved;\n }\n }\n return undefined;\n }\n if (!target || typeof target !== 'object') {\n return undefined;\n }\n\n const record = target as Record<string, unknown>;\n const keys = Object.keys(record);\n const hasSubpathMap = keys.some((key) => key.startsWith('.'));\n\n if (hasSubpathMap) {\n const subpathKey =\n subpath === '' || subpath === '.'\n ? '.'\n : subpath.startsWith('./')\n ? subpath\n : `./${subpath}`;\n if (!(subpathKey in record)) {\n return undefined;\n }\n return resolveExportTarget(record[subpathKey], '.', conditions);\n }\n\n for (const condition of conditions) {\n if (condition in record) {\n const resolved = resolveExportTarget(\n record[condition],\n subpath,\n conditions\n );\n if (resolved) {\n return resolved;\n }\n }\n }\n\n return undefined;\n};\n\nconst inferModuleKindFromPath = (\n targetPath: string,\n packageType: string | undefined\n): ModuleInteropKind => {\n const ext = extname(targetPath);\n if (ext === '.mjs') {\n return 'esm';\n }\n if (ext === '.cjs') {\n return 'cjs';\n }\n if (ext === '.js' || ext === '') {\n return packageType === 'module' ? 'esm' : 'cjs';\n }\n return packageType === 'module' ? 'esm' : 'cjs';\n};\n\nconst resolveModuleKindFromPackage = (\n packageJson: Record<string, unknown>,\n subpath: string\n): ModuleInteropKind => {\n const packageType =\n typeof packageJson.type === 'string' ? packageJson.type : undefined;\n if (packageJson.exports !== undefined) {\n const resolved = resolveExportTarget(\n packageJson.exports,\n subpath,\n importConditions\n );\n if (!resolved) {\n return 'unresolvable';\n }\n return inferModuleKindFromPath(resolved, packageType);\n }\n\n if (subpath) {\n return inferModuleKindFromPath(subpath, packageType);\n }\n\n const main =\n typeof packageJson.main === 'string' ? packageJson.main : 'index.js';\n return inferModuleKindFromPath(main, packageType);\n};\n\nexport const createNodeModuleKindResolver = () => {\n const packageJsonCache = new Map<string, Record<string, unknown> | null>();\n const resolveCache = new Map<string, ModuleInteropKind>();\n\n return async (\n specifier: string,\n importer: string\n ): Promise<ModuleInteropKind> => {\n if (!isBareSpecifier(specifier)) {\n return 'unknown';\n }\n\n const importerPath = stripQuery(importer);\n const importerDir = dirname(importerPath);\n const { packageName, subpath } = parsePackageName(specifier);\n const packageJsonPath = findPackageJsonPath(packageName, importerDir);\n if (!packageJsonPath) {\n return 'unknown';\n }\n\n const cacheKey = `${packageJsonPath}:${subpath}`;\n const cached = resolveCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n\n let packageJson = packageJsonCache.get(packageJsonPath);\n if (packageJson === undefined) {\n packageJson = (await readPackageJson(packageJsonPath)) ?? null;\n packageJsonCache.set(packageJsonPath, packageJson);\n }\n if (!packageJson) {\n resolveCache.set(cacheKey, 'unknown');\n return 'unknown';\n }\n\n const resolved = resolveModuleKindFromPackage(packageJson, subpath);\n resolveCache.set(cacheKey, resolved);\n return resolved;\n };\n};\n\nexport const scanHasDefaultImport = (\n ts: typeof import('typescript'),\n code: string\n): boolean => {\n const scanner = ts.createScanner(\n ts.ScriptTarget.ESNext,\n true,\n ts.LanguageVariant.Standard,\n code\n );\n let token = scanner.scan();\n while (token !== ts.SyntaxKind.EndOfFileToken) {\n if (token === ts.SyntaxKind.ImportKeyword) {\n const next = scanner.scan();\n if (next === ts.SyntaxKind.OpenParenToken) {\n token = scanner.scan();\n continue;\n }\n if (\n next === ts.SyntaxKind.Identifier ||\n next === ts.SyntaxKind.TypeKeyword\n ) {\n return true;\n }\n }\n token = scanner.scan();\n }\n return false;\n};\n\n// This feature is implemented in a somewhat tricky two-step process:\n//\n// Vite's `transform()` is responsible for formatting the code sent to the subsequent 'rollup.'\n// While it enables various code transformations, at this stage, it does not distinguish whether the target code is intended for CJS or ESM.\n// This is because 'rollup' handles that distinction later, and `transform()` performs a single optimization to format the common code base.\n// However, the default import fixup must distinguish between CJS and ESM.\n//\n// Therefore, in Step 1, we always insert `__resolveDefaultExport` as a commonly used function.\n// Within it, we reference a global flag name derived from the source file path and\n// insert `globalThis.__screwUpIsInCJS_<id> = false;` as a placeholder.\n// This allows `renderChunk()` (Step 2) to flip it to `true` only for CJS output chunks,\n// while keeping the code length stable.\n//\n// We avoid performing all processing in the `renderChunk()` because at that stage, we would be referencing post-transpiled code.\n// This prevents the use of a simple replacement process and carries the risk of code transformation failure.\n\nconst cjsInteropGlobalFlagPrefix = '__screwUpIsInCJS_';\nconst cjsInteropIdLength = 12;\nconst cjsInteropGlobalFlagAssignmentPattern = new RegExp(\n `\\\\bglobalThis\\\\.${cjsInteropGlobalFlagPrefix}[0-9a-f]+\\\\s*=\\\\s*false\\\\b`,\n 'g'\n);\n\nconst createCjsInteropHelperId = (seed: string): string => {\n const hash = createHash('sha256').update(seed).digest('hex');\n return hash.slice(0, cjsInteropIdLength);\n};\n\nconst buildHelperFunctionSource = (helperId: string, newline: string): string =>\n [\n `globalThis.${cjsInteropGlobalFlagPrefix}${helperId} = false;`,\n 'function __resolveDefaultExport<T>(module: T | { default?: T }, isESM: boolean): T {',\n ' const __isInCJS =',\n \" typeof globalThis !== 'undefined' &&\",\n ` (globalThis as any).${cjsInteropGlobalFlagPrefix}${helperId} === true;`,\n ' const maybe = module as { default?: T };',\n \" const hasDefault = !!(maybe && typeof maybe === 'object' && 'default' in maybe);\",\n ' const unwrapNamespaceDefault = (value: unknown): unknown => {',\n \" if (!value || typeof value !== 'object') {\",\n ' return value;',\n ' }',\n ' const inner = value as any;',\n ' const isModule =',\n ' inner.__esModule === true ||',\n \" (typeof Symbol !== 'undefined' &&\",\n \" (inner as any)[Symbol.toStringTag] === 'Module');\",\n \" if (isModule && 'default' in inner) {\",\n ' return inner.default;',\n ' }',\n ' return value;',\n ' };',\n ' const resolvedDefault = hasDefault',\n ' ? unwrapNamespaceDefault((maybe as any).default)',\n ' : undefined;',\n '',\n ' if (__isInCJS) {',\n ' return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);',\n ' }',\n '',\n ' if (isESM) {',\n ' if (hasDefault) {',\n ' return resolvedDefault as T;',\n ' }',\n \" throw new Error('Default export not found.');\",\n ' }',\n '',\n ' return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);',\n '}',\n ].join(newline);\n\nexport const injectCjsInteropFlag = (\n code: string\n): { code: string; changed: boolean } => {\n let changed = false;\n const nextCode = code.replace(\n cjsInteropGlobalFlagAssignmentPattern,\n (match) => {\n changed = true;\n // Preserve length to keep sourcemaps stable without remapping.\n return match.replace(/\\bfalse\\b/, 'true ');\n }\n );\n return { code: nextCode, changed };\n};\n\nconst hasResolveDefaultExport = (\n ts: typeof import('typescript'),\n sourceFile: import('typescript').SourceFile\n): boolean => {\n return sourceFile.statements.some((statement) => {\n if (ts.isFunctionDeclaration(statement)) {\n return statement.name?.text === '__resolveDefaultExport';\n }\n if (ts.isVariableStatement(statement)) {\n return statement.declarationList.declarations.some((declaration) => {\n return (\n ts.isIdentifier(declaration.name) &&\n declaration.name.text === '__resolveDefaultExport'\n );\n });\n }\n if (ts.isImportDeclaration(statement)) {\n const importClause = statement.importClause;\n if (!importClause) {\n return false;\n }\n if (importClause.name?.text === '__resolveDefaultExport') {\n return true;\n }\n if (importClause.namedBindings) {\n if (ts.isNamespaceImport(importClause.namedBindings)) {\n return (\n importClause.namedBindings.name.text === '__resolveDefaultExport'\n );\n }\n if (ts.isNamedImports(importClause.namedBindings)) {\n return importClause.namedBindings.elements.some(\n (element) =>\n element.name.text === '__resolveDefaultExport' ||\n element.propertyName?.text === '__resolveDefaultExport'\n );\n }\n }\n }\n return false;\n });\n};\n\nconst isTypeOnlyImportClause = (\n ts: typeof import('typescript'),\n importClause: import('typescript').ImportClause\n): boolean => {\n const phaseModifier = (importClause as { phaseModifier?: number })\n .phaseModifier;\n if (phaseModifier !== undefined) {\n return phaseModifier === ts.SyntaxKind.TypeKeyword;\n }\n return Boolean((importClause as { isTypeOnly?: boolean }).isTypeOnly);\n};\n\nconst getScriptKind = (\n ts: typeof import('typescript'),\n id: string\n): import('typescript').ScriptKind => {\n if (id.endsWith('.tsx')) {\n return ts.ScriptKind.TSX;\n }\n if (id.endsWith('.jsx')) {\n return ts.ScriptKind.JSX;\n }\n if (id.endsWith('.mts')) {\n const mts = (ts.ScriptKind as unknown as Record<string, number>)['MTS'];\n return mts ?? ts.ScriptKind.TS;\n }\n if (id.endsWith('.cts')) {\n const cts = (ts.ScriptKind as unknown as Record<string, number>)['CTS'];\n return cts ?? ts.ScriptKind.TS;\n }\n if (id.endsWith('.ts')) {\n return ts.ScriptKind.TS;\n }\n if (id.endsWith('.mjs')) {\n return ts.ScriptKind.JS;\n }\n if (id.endsWith('.cjs')) {\n return ts.ScriptKind.JS;\n }\n return ts.ScriptKind.JS;\n};\n\nconst formatModuleSpecifier = (specifier: string): string => {\n const escaped = specifier.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\");\n return `'${escaped}'`;\n};\n\nconst buildNamedImport = (\n moduleName: string,\n namedBindings: import('typescript').NamedImports\n): string => {\n const elements = namedBindings.elements\n .map((specifier) => {\n const alias = specifier.propertyName\n ? `${specifier.propertyName.text} as ${specifier.name.text}`\n : specifier.name.text;\n return specifier.isTypeOnly ? `type ${alias}` : alias;\n })\n .join(', ');\n return `import { ${elements} } from ${formatModuleSpecifier(moduleName)};`;\n};\n\nexport const transformDefaultImports = async (\n ts: typeof import('typescript'),\n code: string,\n id: string,\n resolveModuleKind: (\n specifier: string,\n importer: string\n ) => Promise<ModuleInteropKind>\n): Promise<{ code: string; changed: boolean }> => {\n const normalizedId = stripQuery(id);\n const sourceFile = ts.createSourceFile(\n normalizedId,\n code,\n ts.ScriptTarget.ESNext,\n false,\n getScriptKind(ts, normalizedId)\n );\n\n const edits: TextEdit[] = [];\n let needsHelper = false;\n const helperPresent = hasResolveDefaultExport(ts, sourceFile);\n let namespaceIndex = 0;\n\n const usedNamespace = (base: string): string => {\n let candidate = `${base}${namespaceIndex}`;\n while (code.includes(candidate)) {\n namespaceIndex += 1;\n candidate = `${base}${namespaceIndex}`;\n }\n namespaceIndex += 1;\n return candidate;\n };\n\n for (const statement of sourceFile.statements) {\n if (!ts.isImportDeclaration(statement)) {\n continue;\n }\n const importClause = statement.importClause;\n if (!importClause || !importClause.name) {\n continue;\n }\n if (isTypeOnlyImportClause(ts, importClause)) {\n continue;\n }\n if (!ts.isStringLiteral(statement.moduleSpecifier)) {\n continue;\n }\n const moduleName = statement.moduleSpecifier.text;\n const moduleKind = await resolveModuleKind(moduleName, normalizedId);\n if (moduleKind === 'unknown' || moduleKind === 'unresolvable') {\n continue;\n }\n const isESM = moduleKind === 'esm';\n const isCJS = moduleKind === 'cjs';\n\n const defaultName = importClause.name.text;\n const replacementImports: string[] = [];\n let namespaceName: string | undefined;\n let defaultImportName: string | undefined;\n\n if (\n importClause.namedBindings &&\n ts.isNamespaceImport(importClause.namedBindings)\n ) {\n namespaceName = importClause.namedBindings.name.text;\n replacementImports.push(\n `import * as ${namespaceName} from ${formatModuleSpecifier(moduleName)};`\n );\n } else if (isCJS) {\n defaultImportName = usedNamespace('__screwUpDefaultImportModule');\n replacementImports.push(\n `import ${defaultImportName} from ${formatModuleSpecifier(moduleName)};`\n );\n if (\n importClause.namedBindings &&\n ts.isNamedImports(importClause.namedBindings)\n ) {\n replacementImports.push(\n buildNamedImport(moduleName, importClause.namedBindings)\n );\n }\n } else {\n namespaceName = usedNamespace('__screwUpDefaultImportModule');\n replacementImports.push(\n `import * as ${namespaceName} from ${formatModuleSpecifier(moduleName)};`\n );\n if (\n importClause.namedBindings &&\n ts.isNamedImports(importClause.namedBindings)\n ) {\n replacementImports.push(\n buildNamedImport(moduleName, importClause.namedBindings)\n );\n }\n }\n\n const interopSource = namespaceName ?? defaultImportName;\n const newline = detectPreferredNewline(\n code,\n statement.getStart(sourceFile),\n statement.getEnd()\n );\n const replacement =\n `${replacementImports.join(newline)}${newline}` +\n `const ${defaultName} = __resolveDefaultExport(${interopSource}, ${isESM});`;\n\n edits.push({\n start: statement.getStart(sourceFile),\n end: statement.getEnd(),\n text: replacement,\n });\n needsHelper = true;\n }\n\n if (edits.length === 0) {\n return { code, changed: false };\n }\n\n if (needsHelper && !helperPresent) {\n const importStatements = sourceFile.statements.filter(\n ts.isImportDeclaration\n );\n const lastImport = importStatements[importStatements.length - 1];\n if (lastImport) {\n const newline = detectPreferredNewline(\n code,\n lastImport.getStart(sourceFile),\n lastImport.getEnd()\n );\n const helperId = createCjsInteropHelperId(normalizedId);\n edits.push({\n start: lastImport.getEnd(),\n end: lastImport.getEnd(),\n text: `${newline}${buildHelperFunctionSource(helperId, newline)}${newline}`,\n });\n }\n }\n\n return { code: applyTextEdits(code, edits), changed: true };\n};\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\nimport type { Plugin } from 'vite';\nimport type {\n NormalizedOutputOptions,\n OutputAsset,\n OutputChunk,\n OutputOptions,\n} from 'rolldown';\nimport { readFile, writeFile, readdir } from 'fs/promises';\nimport { existsSync } from 'fs';\nimport { join, dirname, resolve } from 'path';\nimport { createMutex } from 'async-primitives';\n\nimport { git_commit_hash, name, version } from './generated/packageMetadata';\nimport { resolvePackageMetadata, createConsoleLogger } from './internal';\nimport { ScrewUpOptions, PackageMetadata } from './types';\nimport { getFetchGitMetadata } from './analyzer';\nimport {\n adjustSourceMapForDeclarationEdits,\n fixDeclarationImportSpecifiers,\n isDeclarationFilePath,\n} from './declaration-import-fix';\nimport {\n createNodeModuleKindResolver,\n injectCjsInteropFlag,\n scanHasDefaultImport,\n transformDefaultImports,\n} from './default-import-fix';\nimport {\n ensureMetadataGitignore,\n generateMetadataFileContent,\n writeFileIfChanged,\n} from './metadata-file';\n\n//////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Generate banner string from package.json metadata\n * @param metadata - Package metadata\n * @param outputKeys - Array of keys to output in specified order\n * @returns Banner string\n */\nexport const generateBanner = (\n metadata: PackageMetadata,\n outputKeys: readonly string[]\n): string => {\n const parts: string[] = [];\n\n for (const key of outputKeys) {\n const value = metadata[key];\n if (value) {\n parts.push(`${key}: ${value}`);\n }\n }\n\n return parts.length > 0 ? `/*!\\n * ${parts.join('\\n * ')}\\n */` : '';\n};\n\n/**\n * Insert banner header at appropriate position considering shebang\n * @param content - The content to insert banner into\n * @param banner - The banner header to insert\n * @returns Content with banner header inserted\n */\nconst insertBannerHeader = (content: string, banner: string): string => {\n const lines = content.split('\\n');\n\n // Check if first line is shebang\n if (lines.length > 0 && lines[0].startsWith('#!')) {\n // Insert banner after shebang line\n return lines[0] + '\\n' + banner + '\\n' + lines.slice(1).join('\\n');\n } else {\n // Insert banner at the beginning\n return banner + '\\n' + content;\n }\n};\n\n/**\n * Split a leading shebang from content, keeping the shebang line with newline.\n */\nconst splitShebang = (content: string): { shebang: string; rest: string } => {\n if (!content.startsWith('#!')) {\n return { shebang: '', rest: content };\n }\n const newlineIndex = content.indexOf('\\n');\n if (newlineIndex === -1) {\n return { shebang: `${content}\\n`, rest: '' };\n }\n return {\n shebang: content.slice(0, newlineIndex + 1),\n rest: content.slice(newlineIndex + 1),\n };\n};\n\n/**\n * Adds a trailing newline to the banner text when needed so subsequent\n * concatenations do not collapse onto the last line.\n */\nconst ensureTrailingNewline = (value: string, newline: string): string =>\n value.endsWith(newline) ? value : value + newline;\n\n/**\n * Merge screw-up's metadata banner with an existing Rollup banner, keeping any\n * shebang line at the very top and preventing duplicate metadata blocks.\n */\nconst mergeBanners = (\n currentBanner: string,\n existingBanner: string\n): string => {\n if (!currentBanner) {\n return existingBanner;\n }\n if (!existingBanner) {\n return currentBanner;\n }\n\n if (existingBanner.includes(currentBanner)) {\n return existingBanner;\n }\n\n // Preserve shebang at the very top while sliding the metadata banner underneath it.\n const shebangMatch = existingBanner.match(/^(#![^\\r\\n]*)(\\r?\\n)?([\\s\\S]*)$/);\n if (shebangMatch) {\n const [, shebangLine, newlineSeq = '\\n', rest = ''] = shebangMatch;\n if (rest.startsWith(currentBanner)) {\n return existingBanner;\n }\n const currentWithNewline = ensureTrailingNewline(currentBanner, newlineSeq);\n if (rest.length === 0) {\n return `${shebangLine}${newlineSeq}${currentWithNewline}`;\n }\n return `${shebangLine}${newlineSeq}${currentWithNewline}${rest}`;\n }\n\n // Default path: prepend metadata banner before the previous banner content.\n const newlineSeq = existingBanner.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const currentWithNewline = ensureTrailingNewline(currentBanner, newlineSeq);\n return `${currentWithNewline}${existingBanner}`;\n};\n\n/**\n * Count how many newline characters exist in the banner block.\n * The result equals the line delta that needs to be applied to sourcemaps.\n */\nconst countInsertedLines = (bannerWithTrailingNewline: string): number => {\n return bannerWithTrailingNewline.split('\\n').length - 1;\n};\n\n/**\n * Convert asset payloads to UTF-8 strings to simplify sourcemap adjustments.\n */\nconst stringifyAssetSource = (source: string | Uint8Array): string =>\n typeof source === 'string' ? source : Buffer.from(source).toString('utf-8');\n\n/**\n * Prepend the specified number of empty lines to a sourcemap by adding semicolons\n * at the beginning of the VLQ mappings string.\n * @returns Updated sourcemap JSON string, or undefined if no change is needed.\n */\nconst applyLineOffsetToSourceMap = (\n source: string | Uint8Array,\n lineOffset: number\n): string | undefined => {\n if (lineOffset <= 0) {\n return undefined;\n }\n\n const original = stringifyAssetSource(source);\n let map: any;\n try {\n map = JSON.parse(original);\n } catch {\n return undefined;\n }\n\n if (!map || typeof map.mappings !== 'string') {\n return undefined;\n }\n\n const prefix = ';'.repeat(lineOffset);\n if (map.mappings.startsWith(prefix)) {\n return undefined;\n }\n\n map.mappings = prefix + map.mappings;\n const serialized = JSON.stringify(map);\n return original.endsWith('\\n') ? `${serialized}\\n` : serialized;\n};\n\n/**\n * Prepend empty lines to sourcemap objects for chunk outputs.\n */\nconst applyLineOffsetToSourceMapObject = (\n map: any,\n lineOffset: number\n): void => {\n if (!map || lineOffset <= 0 || typeof map.mappings !== 'string') {\n return;\n }\n const prefix = ';'.repeat(lineOffset);\n if (map.mappings.startsWith(prefix)) {\n return;\n }\n map.mappings = prefix + map.mappings;\n};\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Vite plugin that adds banner to the bundled code\n * @param options - Plugin options\n * @returns Vite plugin\n */\nexport const screwUp = (options: ScrewUpOptions = {}): Plugin => {\n const {\n fixDefaultImport = true,\n outputKeys = [\n 'name',\n 'version',\n 'description',\n 'author',\n 'license',\n 'repository.url',\n 'git.commit.hash',\n ],\n assetFilters = ['\\\\.d\\\\.ts$'],\n outputMetadataFile = false,\n outputMetadataFilePath = 'src/generated/packageMetadata.ts',\n outputMetadataKeys = [\n 'name',\n 'version',\n 'description',\n 'author',\n 'license',\n 'repository.url',\n 'git.commit.hash',\n ],\n checkWorkingDirectoryStatus = true,\n alwaysOverrideVersionFromGit = true,\n insertMetadataBanner = true,\n fixDeclarationImportExtensions = true,\n } = options;\n\n const assetFiltersRegex = assetFilters.map((filter) => new RegExp(filter));\n const generateMetadataSourceLocker = createMutex();\n const resolveModuleKind = createNodeModuleKindResolver();\n let typescriptPromise:\n | Promise<typeof import('typescript') | undefined>\n | undefined;\n\n const loggerPrefix = `${name}-vite`;\n let logger = createConsoleLogger(loggerPrefix);\n let banner = '';\n let metadata: any;\n let projectRoot: string;\n let fetchGitMetadata = () => Promise.resolve<any>({});\n\n const loadTypeScript = async () => {\n if (!typescriptPromise) {\n typescriptPromise = import('typescript').catch(() => undefined);\n }\n return typescriptPromise;\n };\n\n const resolveOutputBanner = async (\n outputOptions: NormalizedOutputOptions,\n chunk: OutputChunk\n ): Promise<string> => {\n const outputBanner = outputOptions.banner;\n if (typeof outputBanner === 'function') {\n const resolved = await outputBanner(chunk);\n return resolved ?? banner ?? '';\n }\n return outputBanner ?? banner ?? '';\n };\n\n // Generate and write metadata TypeScript file\n const generateMetadataSourceFiles = async () => {\n // Resolve package metadata\n const result = await resolvePackageMetadata(\n projectRoot,\n fetchGitMetadata,\n alwaysOverrideVersionFromGit,\n logger\n );\n metadata = result.metadata;\n // Regenerate banner with updated metadata\n banner = generateBanner(metadata, outputKeys);\n if (outputMetadataFile) {\n const metadataSourceContent = generateMetadataFileContent(\n metadata,\n outputMetadataKeys\n );\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n const metadataWritten = await writeFileIfChanged(\n metadataSourcePath,\n metadataSourceContent,\n 'metadata source file',\n logger\n );\n if (existsSync(metadataSourcePath)) {\n const gitignoreWritten = await ensureMetadataGitignore(\n metadataSourcePath,\n logger\n );\n if (gitignoreWritten) {\n logger.info(\n `generateMetadataSourceFile: .gitignore is generated: ${join(\n dirname(outputMetadataFilePath),\n '.gitignore'\n )}`\n );\n }\n }\n return metadataWritten;\n }\n return false;\n };\n\n // Generate dummy metadata TypeScript file with empty string values\n const generateMetadataFileFromKeys = async (keys: readonly string[]) => {\n if (outputMetadataFile) {\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n // Only generate if file doesn't exist (don't overwrite existing files)\n if (!existsSync(metadataSourcePath)) {\n // Create dummy metadata with empty strings for all keys\n const dummyMetadata: any = {};\n keys.forEach((key) => {\n dummyMetadata[key] = '[Require first build]';\n });\n const dummyContent = generateMetadataFileContent(dummyMetadata, keys);\n return await writeFileIfChanged(\n metadataSourcePath,\n dummyContent,\n 'dummy metadata source file',\n logger\n );\n }\n }\n return false;\n };\n\n return {\n name: 'screw-up',\n // Ensure screw-up runs before other plugins\n // (especially vite-plugin-dts, avoid packageMetadata.ts is not found)\n enforce: 'pre',\n // Plugin starting\n applyToEnvironment: async (penv) => {\n // Prime metadata generation once so dependent files are ready immediately\n logger.info(`${version}-${git_commit_hash}: Started.`);\n\n // Partial (but maybe exact) project root\n projectRoot = penv.config.root;\n\n // Generate dummy metadata source file to prevent import errors on initial build\n if (\n projectRoot &&\n (await generateMetadataFileFromKeys(outputMetadataKeys))\n ) {\n logger.info(\n `applyToEnvironment: Dummy metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n\n return true;\n },\n // Build configuration phase\n config: (config) => {\n // When banner injection is disabled, leave rollup output untouched\n if (!insertMetadataBanner) {\n return;\n }\n\n config.build ??= {};\n const rolldownOptions = (config.build.rolldownOptions ??= {});\n // Normalize rollup outputs to an array so we can inject a banner even when empty\n const ensureOutputs = (): OutputOptions[] => {\n // Consumer already supplied an array of outputs (possibly empty)\n if (Array.isArray(rolldownOptions.output)) {\n const outputs = rolldownOptions.output as OutputOptions[];\n // Array exists but contains no entry yet; create one lazily\n if (outputs.length === 0) {\n const output: OutputOptions = {};\n outputs.push(output);\n return outputs;\n }\n outputs.forEach((output, index) => {\n // Array slot is nullish (user emptied it); replace with object to keep consistent\n if (!output) {\n outputs[index] = {};\n }\n });\n return outputs;\n }\n\n // Single output object was provided; wrap it to unify processing\n if (rolldownOptions.output) {\n return [rolldownOptions.output as OutputOptions];\n }\n\n // No output specified at all; create placeholder so banner hook can run\n const output: OutputOptions = {};\n rolldownOptions.output = output;\n return [output];\n };\n\n const outputs = ensureOutputs();\n\n outputs.forEach((output) => {\n const previousBanner = output.banner;\n // Preserve any existing banner configuration and append ours later in order\n const resolvePreviousBanner = async (chunk: any) => {\n // User provided banner as function; resolve it per chunk for compatibility\n if (typeof previousBanner === 'function') {\n const resolved = await previousBanner(chunk);\n return resolved ?? '';\n }\n return previousBanner ?? '';\n };\n\n output.banner = async (chunk: any) => {\n const existingBanner = await resolvePreviousBanner(chunk);\n const currentBanner = banner ?? '';\n return mergeBanners(currentBanner, existingBanner);\n };\n });\n },\n transform: async (code, id) => {\n if (!fixDefaultImport || !id || id.includes('\\0')) {\n return;\n }\n const cleanId = id.split('?')[0];\n if (cleanId.includes('node_modules')) {\n return;\n }\n if (\n cleanId.endsWith('.d.ts') ||\n cleanId.endsWith('.d.mts') ||\n cleanId.endsWith('.d.cts')\n ) {\n return;\n }\n if (!/\\.(?:[cm]?[jt]sx?|[cm]js)$/.test(cleanId)) {\n return;\n }\n\n const ts = await loadTypeScript();\n if (!ts) {\n return;\n }\n const hasDefaultImport = scanHasDefaultImport(ts, code);\n if (cleanId.includes('/src/') || cleanId.includes('\\\\src\\\\')) {\n logger.debug(\n `[fixDefaultImport] scan ${cleanId}: ${\n hasDefaultImport ? 'hit' : 'miss'\n }`\n );\n }\n if (!hasDefaultImport) {\n return;\n }\n\n const result = await transformDefaultImports(\n ts,\n code,\n cleanId,\n resolveModuleKind\n );\n if (result.changed) {\n return {\n code: result.code,\n map: null,\n };\n }\n },\n // Configuration resolved phase\n configResolved: async (config) => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n // Enable debug logging for performance analysis\n const tempEnableLogging = true;\n\n // Save project root\n projectRoot = config.root;\n if (tempEnableLogging || config?.logger) {\n logger = createConsoleLogger(loggerPrefix, config.logger);\n } else if (config?.customLogger) {\n logger = createConsoleLogger(loggerPrefix, config.customLogger);\n }\n\n logger.debug(`configResolved: Started.`);\n // Get Git metadata fetcher function\n fetchGitMetadata = getFetchGitMetadata(\n projectRoot,\n checkWorkingDirectoryStatus,\n logger\n );\n // Refresh banner string and generated files before TypeScript compilation kicks in\n // Generate metadata TypeScript file early to ensure it's available during TypeScript compilation\n if (await generateMetadataSourceFiles()) {\n logger.info(\n `configResolved: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`configResolved: Exited.`);\n l.release();\n }\n },\n // Server hook\n configureServer: async (server) => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n logger.debug(`configureServer: Started.`);\n\n // Exclude generated metadata file from watcher to prevent infinite loop\n // Metadata file output is enabled and watcher is present; unwatch to avoid churn\n if (outputMetadataFile && server.watcher) {\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n // Use unwatch to exclude the file from being watched\n server.watcher.unwatch(metadataSourcePath);\n logger.debug(\n `configureServer: Excluded from watcher: ${outputMetadataFilePath}`\n );\n }\n\n // Rebuild banner metadata on dev server startup to keep values fresh\n if (await generateMetadataSourceFiles()) {\n logger.info(\n `configureServer: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`configureServer: Exited.`);\n l.release();\n }\n },\n // Build start phase\n buildStart: async () => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n logger.debug(`buildStart: Started.`);\n // Re-resolve package metadata to capture any changes since configResolved\n // Update metadata TypeScript file with latest data\n if (await generateMetadataSourceFiles()) {\n logger.info(\n `buildStart: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`buildStart: Exited.`);\n l.release();\n }\n },\n renderChunk: (code, chunk, outputOptions) => {\n if (!fixDefaultImport || outputOptions.format !== 'cjs') {\n return null;\n }\n const result = injectCjsInteropFlag(code);\n if (!result.changed) {\n return null;\n }\n return { code: result.code, map: null };\n },\n // Generate bundle phase\n generateBundle: {\n order: 'post',\n handler: async (_outputOptions, bundle) => {\n // Rolldown applies JS chunk banners natively, so only patch assets that\n // are emitted outside that path (for example declaration files).\n if (insertMetadataBanner) {\n let assetCount = 0;\n for (const fileName in bundle) {\n const chunk = bundle[fileName];\n if (\n // Only treat assets that match filters; JS chunks already handled via rollup banner\n chunk.type === 'asset' &&\n assetFiltersRegex.some((filter) => filter.test(fileName))\n ) {\n if (typeof chunk.source === 'string') {\n // Assets are not covered by rollup banner injection, so prepend manually\n const bannerBlock = `${banner}\\n`;\n // Insert banner while preserving shebang semantics and capture line delta for maps\n chunk.source = insertBannerHeader(chunk.source, bannerBlock); // insert more blank line\n const lineOffset = countInsertedLines(bannerBlock);\n\n const mapFileName = `${fileName}.map`;\n const mapAsset = bundle[mapFileName] as OutputAsset | undefined;\n if (\n mapAsset &&\n mapAsset.type === 'asset' &&\n mapAsset.source !== undefined\n ) {\n // Rewrite the sourcemap mappings so declaration lines still map back correctly\n const adjusted = applyLineOffsetToSourceMap(\n mapAsset.source,\n lineOffset\n );\n if (adjusted !== undefined) {\n mapAsset.source = adjusted;\n }\n }\n assetCount++;\n }\n }\n }\n if (assetCount >= 1) {\n logger.debug(\n `generateBundle: Banner header inserted: ${assetCount} file(s)`\n );\n }\n }\n },\n },\n // Write bundle phase\n writeBundle: async (options) => {\n if (!options.dir) return;\n\n try {\n const files = await readdir(options.dir, { recursive: true });\n const declarationFiles = new Set(\n files\n .filter((file) => isDeclarationFilePath(file))\n .map((file) => resolve(options.dir!, file))\n );\n const ts = fixDeclarationImportExtensions\n ? await loadTypeScript()\n : undefined;\n\n let bannerCount = 0;\n let declarationCount = 0;\n for (const file of files) {\n const filePath = join(options.dir, file);\n const isAssetTarget = assetFiltersRegex.some((filter) =>\n filter.test(file)\n );\n const isDeclarationTarget =\n fixDeclarationImportExtensions &&\n !!ts &&\n isDeclarationFilePath(filePath);\n\n if (!isAssetTarget && !isDeclarationTarget) {\n continue;\n }\n\n try {\n let content = await readFile(filePath, 'utf-8');\n let contentChanged = false;\n let mapLoaded = false;\n let mapContent: string | undefined;\n const mapPath = `${filePath}.map`;\n\n const loadMapContent = async (): Promise<string | undefined> => {\n if (mapLoaded) {\n return mapContent;\n }\n mapLoaded = true;\n try {\n mapContent = await readFile(mapPath, 'utf-8');\n } catch {\n mapContent = undefined;\n }\n return mapContent;\n };\n\n if (\n insertMetadataBanner &&\n isAssetTarget &&\n !content.includes(banner)\n ) {\n const bannerBlock = `${banner}\\n`;\n content = insertBannerHeader(content, bannerBlock);\n contentChanged = true;\n\n const currentMapContent = await loadMapContent();\n if (currentMapContent !== undefined) {\n const lineOffset = countInsertedLines(bannerBlock);\n const adjusted = applyLineOffsetToSourceMap(\n currentMapContent,\n lineOffset\n );\n if (adjusted !== undefined) {\n mapContent = adjusted;\n }\n }\n bannerCount++;\n }\n\n if (isDeclarationTarget) {\n const declarationResult = fixDeclarationImportSpecifiers(\n ts!,\n content,\n filePath,\n declarationFiles,\n logger\n );\n if (declarationResult.changed) {\n const currentMapContent = await loadMapContent();\n if (currentMapContent !== undefined) {\n const adjusted = adjustSourceMapForDeclarationEdits(\n currentMapContent,\n content,\n declarationResult.edits\n );\n if (adjusted !== undefined) {\n mapContent = adjusted;\n }\n }\n\n content = declarationResult.code;\n contentChanged = true;\n declarationCount++;\n }\n }\n\n if (contentChanged) {\n await writeFile(filePath, content);\n }\n if (mapLoaded && mapContent !== undefined) {\n await writeFile(mapPath, mapContent);\n }\n } catch {\n // Skip files that can't be read/written\n }\n }\n if (bannerCount >= 1) {\n logger.debug(\n `writeBundle: Banner header inserted: ${bannerCount} file(s)`\n );\n }\n if (declarationCount >= 1) {\n logger.debug(\n `writeBundle: Declaration imports fixed: ${declarationCount} file(s)`\n );\n }\n } catch {\n // Skip files that can't be read/written\n }\n },\n };\n};\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\nimport { screwUp } from './vite-plugin';\n\n//////////////////////////////////////////////////////////////////////////////////\n\n// Expose screw-up Vite plugin\n\nexport * from './types';\nexport default screwUp;\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAI,uBAAuB;AAC3B,IAAI,oBAAoB;CACvB,SAAS;EACR,OAAO,UAAU;CAClB;AAGD,IAAI,gBAAgB,WAAW;AAC9B,KAAI,kBAAkB,MAAO,QAAO;AACpC,KAAI,OAAO,WAAW,SAAU,QAAO,IAAI,MAAM,OAAO;AACxD,wBAAuB,IAAI,MAAM,oBAAoB;;;;;;;;AAQtD,IAAI,WAAW,QAAQ,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