gestament 0.1.0 → 0.3.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 (86) hide show
  1. package/README.md +4 -6
  2. package/dist/displaySession.d.ts +18 -0
  3. package/dist/displaySession.d.ts.map +1 -0
  4. package/dist/element.d.ts +2 -2
  5. package/dist/errors-6gj5YuLw.cjs +36 -0
  6. package/dist/errors-6gj5YuLw.cjs.map +1 -0
  7. package/dist/errors-CCW4ATME.js +37 -0
  8. package/dist/errors-CCW4ATME.js.map +1 -0
  9. package/dist/errors.d.ts +2 -2
  10. package/dist/errors.d.ts.map +1 -1
  11. package/dist/generated/packageMetadata.d.ts +4 -4
  12. package/dist/gestament-config.d.ts +2 -2
  13. package/dist/gestament-launcher-driver.cjs +656 -0
  14. package/dist/gestament-launcher-driver.cjs.map +1 -0
  15. package/dist/gestament-launcher-driver.d.ts +13 -0
  16. package/dist/gestament-launcher-driver.d.ts.map +1 -0
  17. package/dist/gestament-launcher-driver.mjs +655 -0
  18. package/dist/gestament-launcher-driver.mjs.map +1 -0
  19. package/dist/gestament-tray-host.cjs +1 -1
  20. package/dist/gestament-tray-host.d.ts +2 -2
  21. package/dist/gestament-tray-host.mjs +1 -1
  22. package/dist/gestament-xvfb-pool-probe.cjs +29 -0
  23. package/dist/gestament-xvfb-pool-probe.cjs.map +1 -0
  24. package/dist/gestament-xvfb-pool-probe.d.ts +13 -0
  25. package/dist/gestament-xvfb-pool-probe.d.ts.map +1 -0
  26. package/dist/gestament-xvfb-pool-probe.mjs +28 -0
  27. package/dist/gestament-xvfb-pool-probe.mjs.map +1 -0
  28. package/dist/gestament-xvfb-worker.d.ts +2 -2
  29. package/dist/gestament-xvfb.cjs +8 -2
  30. package/dist/gestament-xvfb.cjs.map +1 -1
  31. package/dist/gestament-xvfb.d.ts +2 -2
  32. package/dist/gestament-xvfb.mjs +8 -2
  33. package/dist/gestament-xvfb.mjs.map +1 -1
  34. package/dist/index.cjs +4 -1074
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.mjs +4 -1074
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/launchGtkApp-BIO_5Xjn.cjs +2479 -0
  40. package/dist/launchGtkApp-BIO_5Xjn.cjs.map +1 -0
  41. package/dist/launchGtkApp-qi1qm5G4.js +2479 -0
  42. package/dist/launchGtkApp-qi1qm5G4.js.map +1 -0
  43. package/dist/launchGtkApp.d.ts +2 -2
  44. package/dist/launchGtkApp.d.ts.map +1 -1
  45. package/dist/launcherDriverProtocol.d.ts +107 -0
  46. package/dist/launcherDriverProtocol.d.ts.map +1 -0
  47. package/dist/{native-BRnrsqMn.cjs → native-CBXaFWP-.cjs} +14 -40
  48. package/dist/native-CBXaFWP-.cjs.map +1 -0
  49. package/dist/{native-DAhTiLnf.js → native-CWdUmdty.js} +48 -74
  50. package/dist/native-CWdUmdty.js.map +1 -0
  51. package/dist/native.d.ts +4 -2
  52. package/dist/native.d.ts.map +1 -1
  53. package/dist/prerequisites-BuZST2Dy.cjs +15 -0
  54. package/dist/prerequisites-BuZST2Dy.cjs.map +1 -0
  55. package/dist/prerequisites-JB0SKPVd.js +16 -0
  56. package/dist/prerequisites-JB0SKPVd.js.map +1 -0
  57. package/dist/prerequisites.d.ts +23 -0
  58. package/dist/prerequisites.d.ts.map +1 -0
  59. package/dist/testing.cjs +3 -0
  60. package/dist/testing.cjs.map +1 -1
  61. package/dist/testing.d.ts +4 -2
  62. package/dist/testing.d.ts.map +1 -1
  63. package/dist/testing.mjs +4 -1
  64. package/dist/testing.mjs.map +1 -1
  65. package/dist/tray.d.ts +2 -2
  66. package/dist/types.d.ts +84 -2
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/wait-DV5gkXs8.js +113 -0
  69. package/dist/wait-DV5gkXs8.js.map +1 -0
  70. package/dist/wait-eOIz4nZm.cjs +112 -0
  71. package/dist/wait-eOIz4nZm.cjs.map +1 -0
  72. package/dist/wait.d.ts +67 -0
  73. package/dist/wait.d.ts.map +1 -0
  74. package/package.json +8 -8
  75. package/prebuilds/linux-arm/gtk3/node.napi.armv7.glibc.node +0 -0
  76. package/prebuilds/linux-arm/gtk4/node.napi.armv7.glibc.node +0 -0
  77. package/prebuilds/linux-arm64/gtk3/node.napi.glibc.node +0 -0
  78. package/prebuilds/linux-arm64/gtk4/node.napi.glibc.node +0 -0
  79. package/prebuilds/linux-ia32/gtk3/node.napi.glibc.node +0 -0
  80. package/prebuilds/linux-ia32/gtk4/node.napi.glibc.node +0 -0
  81. package/prebuilds/linux-riscv64/gtk3/node.napi.glibc.node +0 -0
  82. package/prebuilds/linux-riscv64/gtk4/node.napi.glibc.node +0 -0
  83. package/prebuilds/linux-x64/gtk3/node.napi.glibc.node +0 -0
  84. package/prebuilds/linux-x64/gtk4/node.napi.glibc.node +0 -0
  85. package/dist/native-BRnrsqMn.cjs.map +0 -1
  86. package/dist/native-DAhTiLnf.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-eOIz4nZm.cjs","sources":["../node_modules/async-primitives/dist/index.mjs","../src/wait.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","// gestament - TypeScript based test driver for GTK.\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/gestament\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { delay } from 'async-primitives';\n\nimport {\n createGtkInvalidArgumentError,\n createGtkOperationTimeoutError,\n} from './errors';\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\n/** Options shared by GTK wait helpers. */\nexport interface GtkWaitOptions {\n /**\n * Maximum time to retry in milliseconds.\n *\n * @remarks Default is 10000.\n */\n readonly timeoutMs?: number | undefined;\n\n /**\n * Delay between retry attempts in milliseconds.\n *\n * @remarks Default is 50.\n */\n readonly intervalMs?: number | undefined;\n\n /**\n * Message included in the timeout error.\n */\n readonly message?: string | undefined;\n}\n\ninterface GtkWaitContext {\n readonly deadlineMs: number;\n}\n\nconst defaultTimeoutMs = 10_000;\nconst defaultIntervalMs = 50;\n\nconst waitContext = new AsyncLocalStorage<GtkWaitContext>();\n\nconst immediateFailureCodes = new Set([\n 'APP_EXITED',\n 'INVALID_ARGUMENT',\n 'NATIVE_LOAD_FAILED',\n 'UNSUPPORTED_INTERFACE',\n]);\n\nconst validateNonNegativeFiniteNumber = (name: string, value: number): void => {\n if (!Number.isFinite(value) || value < 0) {\n throw createGtkInvalidArgumentError(\n `${name} must be a non-negative finite number.`\n );\n }\n};\n\nconst validatePositiveFiniteNumber = (name: string, value: number): void => {\n if (!Number.isFinite(value) || value <= 0) {\n throw createGtkInvalidArgumentError(\n `${name} must be a positive finite number.`\n );\n }\n};\n\nconst errorCode = (error: unknown): string | undefined => {\n const code = (error as { code?: unknown }).code;\n return typeof code === 'string' ? code : undefined;\n};\n\nconst errorLabel = (error: unknown): string => {\n if (error instanceof Error) {\n const code = errorCode(error);\n return code === undefined\n ? `${error.name}: ${error.message}`\n : `${error.name} [${code}]: ${error.message}`;\n }\n return String(error);\n};\n\nconst waitTimeoutMessage = (\n timeoutMs: number,\n message: string | undefined,\n lastError: unknown\n): string => {\n const base = message ?? 'Timed out waiting for GTK condition.';\n const last =\n lastError === undefined ? '' : ` Last error: ${errorLabel(lastError)}`;\n return `${base} Timeout: ${timeoutMs}ms.${last}`;\n};\n\nconst retryableError = (error: unknown): boolean =>\n !immediateFailureCodes.has(errorCode(error) ?? '');\n\nconst resolveWaitDeadlineMs = (\n startedAtMs: number,\n timeoutMs: number\n): number => {\n const requestedDeadlineMs = startedAtMs + timeoutMs;\n const parentDeadlineMs = waitContext.getStore()?.deadlineMs;\n return parentDeadlineMs === undefined\n ? requestedDeadlineMs\n : Math.min(requestedDeadlineMs, parentDeadlineMs);\n};\n\n/**\n * Returns the current absolute wait deadline.\n *\n * @returns The current deadline in Date.now() milliseconds, or undefined outside wait helpers.\n */\nexport const currentWaitDeadlineMs = (): number | undefined =>\n waitContext.getStore()?.deadlineMs;\n\n/**\n * Limits a wait timeout to the current shared wait deadline.\n *\n * @param fallbackTimeoutMs Timeout to use outside a shared wait context.\n * @returns Effective timeout in milliseconds.\n */\nexport const effectiveWaitTimeoutMs = (fallbackTimeoutMs: number): number => {\n const deadlineMs = currentWaitDeadlineMs();\n if (deadlineMs === undefined) {\n return fallbackTimeoutMs;\n }\n return Math.min(fallbackTimeoutMs, Math.max(0, deadlineMs - Date.now()));\n};\n\n/**\n * Runs a callback inside an existing absolute GTK wait deadline.\n *\n * @param deadlineMs Absolute deadline in Date.now() milliseconds.\n * @param operation Operation to execute.\n * @returns The operation result.\n */\nexport const runWithWaitDeadline = async <Result>(\n deadlineMs: number,\n operation: () => Result | Promise<Result>\n): Promise<Result> => waitContext.run({ deadlineMs }, async () => operation());\n\n/**\n * Repeats a probe until it returns a result or the timeout expires.\n *\n * @param probe Operation to retry.\n * @param options Wait options.\n * @returns The first successful probe result.\n */\nexport const waitForResult = async <Result>(\n probe: () => Result | Promise<Result>,\n options?: GtkWaitOptions\n): Promise<Result> => {\n const timeoutMs = options?.timeoutMs ?? defaultTimeoutMs;\n const intervalMs = options?.intervalMs ?? defaultIntervalMs;\n validateNonNegativeFiniteNumber('timeoutMs', timeoutMs);\n validatePositiveFiniteNumber('intervalMs', intervalMs);\n\n const startedAtMs = Date.now();\n const deadlineMs = resolveWaitDeadlineMs(startedAtMs, timeoutMs);\n const effectiveTimeoutMs = Math.max(0, deadlineMs - startedAtMs);\n return waitContext.run({ deadlineMs }, async (): Promise<Result> => {\n let lastError: unknown;\n\n while (true) {\n try {\n return await probe();\n } catch (error) {\n if (!retryableError(error)) {\n throw error;\n }\n\n lastError = error;\n }\n\n const remainingMs = deadlineMs - Date.now();\n if (remainingMs <= 0) {\n throw createGtkOperationTimeoutError(\n waitTimeoutMessage(effectiveTimeoutMs, options?.message, lastError)\n );\n }\n\n await delay(Math.min(intervalMs, remainingMs));\n }\n });\n};\n\n/**\n * Repeats an assertion block until it succeeds or the timeout expires.\n *\n * @param probe Assertion block to retry.\n * @param options Wait options.\n * @returns Promise resolved when the assertion block passes.\n */\nexport const toPass = async (\n probe: () => void | Promise<void>,\n options?: GtkWaitOptions\n): Promise<void> => {\n await waitForResult(async () => {\n await probe();\n }, options);\n};\n"],"names":["AsyncLocalStorage","createGtkInvalidArgumentError","createGtkOperationTimeoutError"],"mappings":";;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyEG,IAAC,QAAQ,CAAC,MAAM,WAAW;AAatB,SAAO,IAAI,QAAQ,CAAC,YAAY;AACtC,eAAW,SAAS,IAAI;AAAA,EACzB,CAAC;AACF;AChDA,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAE1B,MAAM,cAAc,IAAIA,iBAAAA,kBAAA;AAExB,MAAM,4CAA4B,IAAI;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,MAAM,kCAAkC,CAAC,MAAc,UAAwB;AAC7E,MAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,GAAG;AACxC,UAAMC,OAAAA;AAAAA,MACJ,GAAG,IAAI;AAAA,IAAA;AAAA,EAEX;AACF;AAEA,MAAM,+BAA+B,CAAC,MAAc,UAAwB;AAC1E,MAAI,CAAC,OAAO,SAAS,KAAK,KAAK,SAAS,GAAG;AACzC,UAAMA,OAAAA;AAAAA,MACJ,GAAG,IAAI;AAAA,IAAA;AAAA,EAEX;AACF;AAEA,MAAM,YAAY,CAAC,UAAuC;AACxD,QAAM,OAAQ,MAA6B;AAC3C,SAAO,OAAO,SAAS,WAAW,OAAO;AAC3C;AAEA,MAAM,aAAa,CAAC,UAA2B;AAC7C,MAAI,iBAAiB,OAAO;AAC1B,UAAM,OAAO,UAAU,KAAK;AAC5B,WAAO,SAAS,SACZ,GAAG,MAAM,IAAI,KAAK,MAAM,OAAO,KAC/B,GAAG,MAAM,IAAI,KAAK,IAAI,MAAM,MAAM,OAAO;AAAA,EAC/C;AACA,SAAO,OAAO,KAAK;AACrB;AAEA,MAAM,qBAAqB,CACzB,WACA,SACA,cACW;AACX,QAAM,OAAO,WAAW;AACxB,QAAM,OACJ,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AA;AAAAA,UACJ,mBAAmB,oBAAoB,SAAS,SAAS,SAAS;AAAA,QAAA;AAAA,MAEtE;AAEA,YAAM,MAAM,KAAK,IAAI,YAAY,WAAW,CAAC;AAAA,IAC/C;AAAA,EACF,CAAC;AACH;AASO,MAAM,SAAS,OACpB,OACA,YACkB;AAClB,QAAM,cAAc,YAAY;AAC9B,UAAM,MAAA;AAAA,EACR,GAAG,OAAO;AACZ;;;;;;;","x_google_ignoreList":[0]}
package/dist/wait.d.ts ADDED
@@ -0,0 +1,67 @@
1
+ /*!
2
+ * name: gestament
3
+ * version: 0.3.0
4
+ * description: TypeScript based test driver for GTK
5
+ * author: Kouji Matsui (@kekyo@mi.kekyo.net)
6
+ * license: MIT
7
+ * repository.url: https://github.com/kekyo/gestament.git
8
+ * git.commit.hash: c15fe3b28fb1c2fb73504c57773b1ee751cbf8c4
9
+ */
10
+
11
+ /** Options shared by GTK wait helpers. */
12
+ export interface GtkWaitOptions {
13
+ /**
14
+ * Maximum time to retry in milliseconds.
15
+ *
16
+ * @remarks Default is 10000.
17
+ */
18
+ readonly timeoutMs?: number | undefined;
19
+ /**
20
+ * Delay between retry attempts in milliseconds.
21
+ *
22
+ * @remarks Default is 50.
23
+ */
24
+ readonly intervalMs?: number | undefined;
25
+ /**
26
+ * Message included in the timeout error.
27
+ */
28
+ readonly message?: string | undefined;
29
+ }
30
+ /**
31
+ * Returns the current absolute wait deadline.
32
+ *
33
+ * @returns The current deadline in Date.now() milliseconds, or undefined outside wait helpers.
34
+ */
35
+ export declare const currentWaitDeadlineMs: () => number | undefined;
36
+ /**
37
+ * Limits a wait timeout to the current shared wait deadline.
38
+ *
39
+ * @param fallbackTimeoutMs Timeout to use outside a shared wait context.
40
+ * @returns Effective timeout in milliseconds.
41
+ */
42
+ export declare const effectiveWaitTimeoutMs: (fallbackTimeoutMs: number) => number;
43
+ /**
44
+ * Runs a callback inside an existing absolute GTK wait deadline.
45
+ *
46
+ * @param deadlineMs Absolute deadline in Date.now() milliseconds.
47
+ * @param operation Operation to execute.
48
+ * @returns The operation result.
49
+ */
50
+ export declare const runWithWaitDeadline: <Result>(deadlineMs: number, operation: () => Result | Promise<Result>) => Promise<Result>;
51
+ /**
52
+ * Repeats a probe until it returns a result or the timeout expires.
53
+ *
54
+ * @param probe Operation to retry.
55
+ * @param options Wait options.
56
+ * @returns The first successful probe result.
57
+ */
58
+ export declare const waitForResult: <Result>(probe: () => Result | Promise<Result>, options?: GtkWaitOptions) => Promise<Result>;
59
+ /**
60
+ * Repeats an assertion block until it succeeds or the timeout expires.
61
+ *
62
+ * @param probe Assertion block to retry.
63
+ * @param options Wait options.
64
+ * @returns Promise resolved when the assertion block passes.
65
+ */
66
+ export declare const toPass: (probe: () => void | Promise<void>, options?: GtkWaitOptions) => Promise<void>;
67
+ //# sourceMappingURL=wait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../src/wait.ts"],"names":[],"mappings":";;;;;;;;;AAeA,0CAA0C;AAC1C,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AA0ED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAO,MAAM,GAAG,SACd,CAAC;AAErC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,mBAAmB,MAAM,KAAG,MAMlE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAU,MAAM,EAC9C,YAAY,MAAM,EAClB,WAAW,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,KACxC,OAAO,CAAC,MAAM,CAA6D,CAAC;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAU,MAAM,EACxC,OAAO,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EACrC,UAAU,cAAc,KACvB,OAAO,CAAC,MAAM,CAiChB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GACjB,OAAO,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EACjC,UAAU,cAAc,KACvB,OAAO,CAAC,IAAI,CAId,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gestament",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "TypeScript based test driver for GTK",
5
5
  "keywords": [
6
6
  "test",
@@ -75,18 +75,18 @@
75
75
  },
76
76
  "git": {
77
77
  "tags": [
78
- "0.1.0"
78
+ "0.3.0"
79
79
  ],
80
80
  "branches": [
81
81
  "main"
82
82
  ],
83
83
  "commit": {
84
- "hash": "2e2298272ff7a9fff6945b8d87de6223ac4d7847",
85
- "shortHash": "2e22982",
86
- "date": "2026-05-03T22:02:18+09:00",
87
- "message": "Initial commit"
84
+ "hash": "c15fe3b28fb1c2fb73504c57773b1ee751cbf8c4",
85
+ "shortHash": "c15fe3b",
86
+ "date": "2026-05-20T08:17:14+09:00",
87
+ "message": "Merge branch 'develop'"
88
88
  },
89
- "version": "0.1.0"
89
+ "version": "0.3.0"
90
90
  },
91
- "buildDate": "2026-05-11T13:13:48+09:00"
91
+ "buildDate": "2026-05-20T14:12:46+09:00"
92
92
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"native-BRnrsqMn.cjs","sources":["../src/errors.ts","../src/generated/packageMetadata.ts","../src/native.ts"],"sourcesContent":["// gestament - TypeScript based test driver for GTK.\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/gestament\n\nimport type { GtkAutomationError, GtkAutomationErrorCode } from './types';\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\nconst createGtkAutomationError = (\n code: GtkAutomationErrorCode,\n message: string\n): GtkAutomationError => {\n const error = new Error(message) as GtkAutomationError;\n Object.defineProperty(error, 'code', {\n enumerable: true,\n value: code,\n });\n error.name = 'GtkAutomationError';\n return error;\n};\n\n/** Creates an error for a GTK application that exited before an operation completed. */\nexport const createGtkAppExitedError = (message: string): GtkAutomationError =>\n createGtkAutomationError('APP_EXITED', message);\n\n/** Creates an error for an invalid public API argument. */\nexport const createGtkInvalidArgumentError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('INVALID_ARGUMENT', message);\n\n/** Creates an error for an accessible element that was not found. */\nexport const createGtkElementNotFoundError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('ELEMENT_NOT_FOUND', message);\n\n/** Creates an error for an element whose host object no longer exists. */\nexport const createGtkStaleElementError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('STALE_ELEMENT', message);\n\n/** Creates an error for an operation that exceeded its timeout. */\nexport const createGtkOperationTimeoutError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('TIMEOUT', message);\n\n/** Creates an error for an operation that failed. */\nexport const createGtkOperationFailedError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('OPERATION_FAILED', message);\n\n/** Creates an error for an operation that is not supported by the element. */\nexport const createGtkUnsupportedInterfaceError = (\n message: string\n): GtkAutomationError =>\n createGtkAutomationError('UNSUPPORTED_INTERFACE', message);\n\n/** Converts native addon errors into the public error shape. */\nexport const normalizeNativeError = (error: unknown): GtkAutomationError => {\n if (error instanceof Error) {\n const maybeCode = (error as { code?: unknown }).code;\n if (\n maybeCode === 'ELEMENT_NOT_FOUND' ||\n maybeCode === 'INVALID_ARGUMENT' ||\n maybeCode === 'NATIVE_LOAD_FAILED' ||\n maybeCode === 'OPERATION_FAILED' ||\n maybeCode === 'STALE_ELEMENT' ||\n maybeCode === 'UNSUPPORTED_INTERFACE'\n ) {\n return createGtkAutomationError(maybeCode, error.message);\n }\n\n return createGtkAutomationError('OPERATION_FAILED', error.message);\n }\n\n return createGtkAutomationError('OPERATION_FAILED', String(error));\n};\n","// @ts-nocheck\n// This file is auto-generated by screw-up plugin\n// Do not edit manually\n\nexport const name = \"gestament\";\nexport const version = \"0.1.0\";\nexport const description = \"TypeScript based test driver for GTK\";\nexport const author = \"Kouji Matsui (@kekyo@mi.kekyo.net)\";\nexport const license = \"MIT\";\nexport const repository_url = \"https://github.com/kekyo/gestament.git\";\nexport const git_commit_hash = \"2e2298272ff7a9fff6945b8d87de6223ac4d7847\";\n","// gestament - TypeScript based test driver for GTK.\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/gestament\n\nimport { createRequire } from 'node:module';\nimport { existsSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { normalizeNativeError } from './errors';\nimport { version as packageVersion } from './generated/packageMetadata';\nimport type { GtkAutomationError } from './types';\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\ninterface NativeInfo {\n readonly version: string;\n readonly arch: string;\n readonly gtkBackend: GtkBackend;\n readonly napiVersion: number;\n}\n\nexport interface NativeCaptureBounds {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\nexport interface NativeCapture {\n readonly image: Buffer;\n readonly bounds: NativeCaptureBounds;\n readonly visibleBounds: NativeCaptureBounds;\n readonly clipped: boolean;\n}\n\nexport interface NativeElementInfo {\n readonly roleName: string;\n readonly localizedRoleName: string;\n readonly accessibleId: string;\n readonly name: string;\n readonly description: string;\n readonly interfaces: string[];\n readonly states: string[];\n}\n\n/** AT-SPI Value metadata returned by the native layer. */\nexport interface NativeValueInfo {\n /** Current numeric value. */\n readonly value: number;\n\n /** Minimum accepted numeric value. */\n readonly minimum: number;\n\n /** Maximum accepted numeric value. */\n readonly maximum: number;\n\n /** Minimum increment used by step-based controls. */\n readonly minimumIncrement: number;\n\n /** Text representation reported by AT-SPI, when available. */\n readonly text: string;\n}\n\n/** Point returned by the native layer. */\nexport interface NativeImagePoint {\n /** Horizontal pixel coordinate. */\n readonly x: number;\n\n /** Vertical pixel coordinate. */\n readonly y: number;\n}\n\n/** Image size returned by the native layer. */\nexport interface NativeImageSize {\n /** Image width in physical pixels. */\n readonly width: number;\n\n /** Image height in physical pixels. */\n readonly height: number;\n}\n\n/** AT-SPI Image metadata returned by the native layer. */\nexport interface NativeImageInfo {\n /** Text description reported by AT-SPI. */\n readonly description: string;\n\n /** Image locale reported by AT-SPI. */\n readonly locale: string;\n\n /** Image position reported by AT-SPI. */\n readonly position: NativeImagePoint;\n\n /** Image size reported by AT-SPI. */\n readonly size: NativeImageSize;\n\n /** Screen-relative image bounds reported by AT-SPI. */\n readonly bounds: NativeCaptureBounds;\n}\n\n/** Opaque native element handle backed by an AT-SPI accessible proxy. */\nexport type NativeElementHandle = object;\n\n/** AT-SPI readiness state reported by the native layer. */\nexport type NativeAtspiReadiness =\n | 'ready'\n | 'missing-bus-name'\n | 'missing-root'\n | 'missing-cache';\n\n/** StatusNotifier tray item metadata reported by the native layer. */\nexport interface NativeTrayItem {\n readonly busName: string;\n readonly objectPath: string;\n readonly id: string;\n readonly title: string;\n readonly status: string;\n readonly iconName: string;\n readonly accessibleId: string;\n}\n\ninterface NativeAddon {\n readonly findById: (\n processId: number,\n id: string\n ) => NativeElementHandle | undefined;\n readonly processAtspiReadiness: (processId: number) => NativeAtspiReadiness;\n readonly findAnyById: (id: string) => NativeElementHandle | undefined;\n readonly setTextById: (processId: number, id: string, text: string) => void;\n readonly clickById: (processId: number, id: string) => void;\n readonly textById: (processId: number, id: string) => string;\n readonly captureById: (processId: number, id: string) => NativeCapture;\n readonly windowCount: (processId: number) => number;\n readonly windowAt: (\n processId: number,\n index: number\n ) => NativeElementHandle | undefined;\n readonly childCount: (element: NativeElementHandle) => number;\n readonly childAt: (\n element: NativeElementHandle,\n index: number\n ) => NativeElementHandle | undefined;\n readonly selectedChildCount: (element: NativeElementHandle) => number;\n readonly selectedChildAt: (\n element: NativeElementHandle,\n index: number\n ) => NativeElementHandle | undefined;\n readonly isChildSelected: (\n element: NativeElementHandle,\n index: number\n ) => boolean;\n readonly selectChildAt: (element: NativeElementHandle, index: number) => void;\n readonly deselectChildAt: (\n element: NativeElementHandle,\n index: number\n ) => void;\n readonly selectAllChildren: (element: NativeElementHandle) => void;\n readonly clearSelection: (element: NativeElementHandle) => void;\n readonly tableRowCount: (element: NativeElementHandle) => number;\n readonly tableColumnCount: (element: NativeElementHandle) => number;\n readonly tableCellAt: (\n element: NativeElementHandle,\n row: number,\n column: number\n ) => NativeElementHandle | undefined;\n readonly tableSelectedRows: (element: NativeElementHandle) => number[];\n readonly tableSelectedColumns: (element: NativeElementHandle) => number[];\n readonly tableIsRowSelected: (\n element: NativeElementHandle,\n row: number\n ) => boolean;\n readonly tableIsColumnSelected: (\n element: NativeElementHandle,\n column: number\n ) => boolean;\n readonly tableIsCellSelected: (\n element: NativeElementHandle,\n row: number,\n column: number\n ) => boolean;\n readonly tableSelectRow: (element: NativeElementHandle, row: number) => void;\n readonly tableDeselectRow: (\n element: NativeElementHandle,\n row: number\n ) => void;\n readonly tableSelectColumn: (\n element: NativeElementHandle,\n column: number\n ) => void;\n readonly tableDeselectColumn: (\n element: NativeElementHandle,\n column: number\n ) => void;\n readonly setText: (element: NativeElementHandle, text: string) => void;\n readonly click: (element: NativeElementHandle) => void;\n readonly text: (element: NativeElementHandle) => string;\n readonly valueInfo: (element: NativeElementHandle) => NativeValueInfo;\n readonly imageInfo: (element: NativeElementHandle) => NativeImageInfo;\n readonly setValue: (element: NativeElementHandle, value: number) => void;\n readonly capture: (element: NativeElementHandle) => NativeCapture;\n readonly captureScreen: () => NativeCapture;\n readonly captureBounds: (\n x: number,\n y: number,\n width: number,\n height: number\n ) => NativeCapture;\n readonly elementInfo: (element: NativeElementHandle) => NativeElementInfo;\n readonly trayItems: (processId: number) => NativeTrayItem[];\n readonly runTrayHost: () => void;\n readonly nativeInfo: () => NativeInfo;\n}\n\ntype GtkBackend = 'gtk3' | 'gtk4';\ntype GtkBackendSelection = GtkBackend | 'auto';\n\nconst require = createRequire(import.meta.url);\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\n\nlet loadedAddon: NativeAddon | undefined;\n\nconst createNativeLoadError = (message: string): GtkAutomationError => {\n const loadError = new Error(message) as GtkAutomationError;\n Object.defineProperty(loadError, 'code', {\n enumerable: true,\n value: 'NATIVE_LOAD_FAILED',\n });\n return loadError;\n};\n\nconst selectedGtkBackend = (): GtkBackendSelection => {\n const value = process.env.GESTAMENT_GTK_BACKEND;\n if (value === undefined || value.length === 0) {\n return 'gtk3';\n }\n if (value === 'gtk3' || value === 'gtk4' || value === 'auto') {\n return value;\n }\n throw createNativeLoadError(\n `Unsupported GESTAMENT_GTK_BACKEND: ${value}. Expected gtk3, gtk4, or auto.`\n );\n};\n\nconst candidateGtkBackends = (): readonly GtkBackend[] => {\n const selected = selectedGtkBackend();\n return selected === 'auto' ? ['gtk3', 'gtk4'] : [selected];\n};\n\nconst prebuildDirectory = (): string => {\n if (process.platform !== 'linux') {\n throw createNativeLoadError(\n `Unsupported platform for gestament native prebuilds: ${process.platform}.`\n );\n }\n\n switch (process.arch) {\n case 'x64':\n return 'linux-x64';\n case 'ia32':\n return 'linux-ia32';\n case 'arm64':\n return 'linux-arm64';\n case 'arm':\n return 'linux-arm';\n case 'riscv64':\n return 'linux-riscv64';\n default:\n throw createNativeLoadError(\n `Unsupported architecture for gestament native prebuilds: ${process.arch}.`\n );\n }\n};\n\nconst prebuildFile = (): string =>\n process.arch === 'arm'\n ? 'node.napi.armv7.glibc.node'\n : 'node.napi.glibc.node';\n\nconst prebuildPath = (backend: GtkBackend): string =>\n resolve(\n packageRoot,\n 'prebuilds',\n prebuildDirectory(),\n backend,\n prebuildFile()\n );\n\nconst loadNativePrebuild = (backend: GtkBackend): NativeAddon => {\n const path = prebuildPath(backend);\n if (!existsSync(path)) {\n throw new Error(`Missing ${backend} native prebuild: ${path}`);\n }\n return require(path) as NativeAddon;\n};\n\nconst loadNativeAddon = (): NativeAddon => {\n if (loadedAddon !== undefined) {\n return loadedAddon;\n }\n\n const errors: string[] = [];\n for (const backend of candidateGtkBackends()) {\n try {\n const addon = loadNativePrebuild(backend);\n const nativeInfo = addon.nativeInfo();\n if (nativeInfo.version !== packageVersion) {\n throw new Error(\n `gestament native prebuild version mismatch: native=${nativeInfo.version}, package=${packageVersion}`\n );\n }\n if (nativeInfo.gtkBackend !== backend) {\n throw new Error(\n `gestament native prebuild backend mismatch: native=${nativeInfo.gtkBackend}, requested=${backend}`\n );\n }\n loadedAddon = addon;\n return loadedAddon;\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : `Unknown error: ${String(error)}`;\n errors.push(`${backend}: ${message}`);\n }\n }\n\n throw createNativeLoadError(\n `Failed to load a compatible gestament native prebuild from ${packageRoot} ` +\n `(GESTAMENT_GTK_BACKEND=${selectedGtkBackend()}). Ensure this package ` +\n 'includes prebuilds for the current Linux/glibc architecture and selected ' +\n 'GTK backend, and that runtime libraries such as libatspi, glib, gio, ' +\n `GTK, X11, and dbus are installed. Original errors: ${errors.join(' | ')}`\n );\n};\n\nconst callNative = <Result>(operation: () => Result): Result => {\n try {\n return operation();\n } catch (error) {\n throw normalizeNativeError(error);\n }\n};\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\n/** Resolves an accessible id to a native element when it exists. */\nexport const nativeFindById = (\n processId: number,\n id: string\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().findById(processId, id));\n\n/** Checks whether a GTK process has completed AT-SPI root/cache registration. */\nexport const nativeProcessAtspiReadiness = (\n processId: number\n): NativeAtspiReadiness =>\n callNative(() => loadNativeAddon().processAtspiReadiness(processId));\n\n/** Resolves an accessible id to a native element across all exposed processes. */\nexport const nativeFindAnyById = (\n id: string\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().findAnyById(id));\n\n/** Sets text contents on the accessible with the given id. */\nexport const nativeSetTextById = (\n processId: number,\n id: string,\n text: string\n): void => {\n callNative(() => loadNativeAddon().setTextById(processId, id, text));\n};\n\n/** Executes the first action on the accessible with the given id. */\nexport const nativeClickById = (processId: number, id: string): void => {\n callNative(() => loadNativeAddon().clickById(processId, id));\n};\n\n/** Reads text from the accessible with the given id. */\nexport const nativeTextById = (processId: number, id: string): string =>\n callNative(() => loadNativeAddon().textById(processId, id));\n\n/** Captures real screen pixels for the accessible with the given id. */\nexport const nativeCaptureById = (\n processId: number,\n id: string\n): NativeCapture =>\n callNative(() => loadNativeAddon().captureById(processId, id));\n\n/** Counts top-level windows hosted by the process. */\nexport const nativeWindowCount = (processId: number): number =>\n callNative(() => loadNativeAddon().windowCount(processId));\n\n/** Resolves a top-level window index to an element handle when it exists. */\nexport const nativeWindowAt = (\n processId: number,\n index: number\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().windowAt(processId, index));\n\n/** Counts direct children for an element handle. */\nexport const nativeChildCount = (element: NativeElementHandle): number =>\n callNative(() => loadNativeAddon().childCount(element));\n\n/** Resolves a direct child index to an element handle when it exists. */\nexport const nativeChildAt = (\n element: NativeElementHandle,\n index: number\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().childAt(element, index));\n\n/** Counts selected children for a selectable element handle. */\nexport const nativeSelectedChildCount = (\n element: NativeElementHandle\n): number => callNative(() => loadNativeAddon().selectedChildCount(element));\n\n/** Resolves a selected child index to an element handle when it exists. */\nexport const nativeSelectedChildAt = (\n element: NativeElementHandle,\n index: number\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().selectedChildAt(element, index));\n\n/** Reads whether a direct child is selected. */\nexport const nativeIsChildSelected = (\n element: NativeElementHandle,\n index: number\n): boolean =>\n callNative(() => loadNativeAddon().isChildSelected(element, index));\n\n/** Selects a direct child for a selectable element handle. */\nexport const nativeSelectChildAt = (\n element: NativeElementHandle,\n index: number\n): void => {\n callNative(() => loadNativeAddon().selectChildAt(element, index));\n};\n\n/** Deselects a direct child for a selectable element handle. */\nexport const nativeDeselectChildAt = (\n element: NativeElementHandle,\n index: number\n): void => {\n callNative(() => loadNativeAddon().deselectChildAt(element, index));\n};\n\n/** Selects all children for a selectable element handle. */\nexport const nativeSelectAllChildren = (element: NativeElementHandle): void => {\n callNative(() => loadNativeAddon().selectAllChildren(element));\n};\n\n/** Clears child selection for a selectable element handle. */\nexport const nativeClearSelection = (element: NativeElementHandle): void => {\n callNative(() => loadNativeAddon().clearSelection(element));\n};\n\n/** Counts table rows for a table element handle. */\nexport const nativeTableRowCount = (element: NativeElementHandle): number =>\n callNative(() => loadNativeAddon().tableRowCount(element));\n\n/** Counts table columns for a table element handle. */\nexport const nativeTableColumnCount = (element: NativeElementHandle): number =>\n callNative(() => loadNativeAddon().tableColumnCount(element));\n\n/** Resolves a table cell element handle by row and column when it exists. */\nexport const nativeTableCellAt = (\n element: NativeElementHandle,\n row: number,\n column: number\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().tableCellAt(element, row, column));\n\n/** Reads selected table row indexes. */\nexport const nativeTableSelectedRows = (\n element: NativeElementHandle\n): number[] => callNative(() => loadNativeAddon().tableSelectedRows(element));\n\n/** Reads selected table column indexes. */\nexport const nativeTableSelectedColumns = (\n element: NativeElementHandle\n): number[] =>\n callNative(() => loadNativeAddon().tableSelectedColumns(element));\n\n/** Reads whether a table row is selected. */\nexport const nativeTableIsRowSelected = (\n element: NativeElementHandle,\n row: number\n): boolean =>\n callNative(() => loadNativeAddon().tableIsRowSelected(element, row));\n\n/** Reads whether a table column is selected. */\nexport const nativeTableIsColumnSelected = (\n element: NativeElementHandle,\n column: number\n): boolean =>\n callNative(() => loadNativeAddon().tableIsColumnSelected(element, column));\n\n/** Reads whether a table cell is selected. */\nexport const nativeTableIsCellSelected = (\n element: NativeElementHandle,\n row: number,\n column: number\n): boolean =>\n callNative(() => loadNativeAddon().tableIsCellSelected(element, row, column));\n\n/** Selects a table row. */\nexport const nativeTableSelectRow = (\n element: NativeElementHandle,\n row: number\n): void => {\n callNative(() => loadNativeAddon().tableSelectRow(element, row));\n};\n\n/** Deselects a table row. */\nexport const nativeTableDeselectRow = (\n element: NativeElementHandle,\n row: number\n): void => {\n callNative(() => loadNativeAddon().tableDeselectRow(element, row));\n};\n\n/** Selects a table column. */\nexport const nativeTableSelectColumn = (\n element: NativeElementHandle,\n column: number\n): void => {\n callNative(() => loadNativeAddon().tableSelectColumn(element, column));\n};\n\n/** Deselects a table column. */\nexport const nativeTableDeselectColumn = (\n element: NativeElementHandle,\n column: number\n): void => {\n callNative(() => loadNativeAddon().tableDeselectColumn(element, column));\n};\n\n/** Sets text contents on the accessible resolved by an element handle. */\nexport const nativeSetText = (\n element: NativeElementHandle,\n text: string\n): void => {\n callNative(() => loadNativeAddon().setText(element, text));\n};\n\n/** Executes the first action on the accessible resolved by an element handle. */\nexport const nativeClick = (element: NativeElementHandle): void => {\n callNative(() => loadNativeAddon().click(element));\n};\n\n/** Reads text from the accessible resolved by an element handle. */\nexport const nativeText = (element: NativeElementHandle): string =>\n callNative(() => loadNativeAddon().text(element));\n\n/** Reads value metadata from the accessible resolved by an element handle. */\nexport const nativeValueInfo = (\n element: NativeElementHandle\n): NativeValueInfo => callNative(() => loadNativeAddon().valueInfo(element));\n\n/** Reads image metadata from the accessible resolved by an element handle. */\nexport const nativeImageInfo = (\n element: NativeElementHandle\n): NativeImageInfo => callNative(() => loadNativeAddon().imageInfo(element));\n\n/** Sets a numeric value on the accessible resolved by an element handle. */\nexport const nativeSetValue = (\n element: NativeElementHandle,\n value: number\n): void => {\n callNative(() => loadNativeAddon().setValue(element, value));\n};\n\n/** Captures real screen pixels for the accessible resolved by an element handle. */\nexport const nativeCapture = (element: NativeElementHandle): NativeCapture =>\n callNative(() => loadNativeAddon().capture(element));\n\n/** Captures the full X11 root window currently addressed by DISPLAY. */\nexport const nativeCaptureScreen = (): NativeCapture =>\n callNative(() => loadNativeAddon().captureScreen());\n\n/** Captures real screen pixels for explicit screen-relative bounds. */\nexport const nativeCaptureBounds = (\n bounds: NativeCaptureBounds\n): NativeCapture =>\n callNative(() =>\n loadNativeAddon().captureBounds(\n bounds.x,\n bounds.y,\n bounds.width,\n bounds.height\n )\n );\n\n/** Reads AT-SPI metadata for the accessible resolved by an element handle. */\nexport const nativeElementInfo = (\n element: NativeElementHandle\n): NativeElementInfo =>\n callNative(() => loadNativeAddon().elementInfo(element));\n\n/** Lists StatusNotifier tray items owned by the process. */\nexport const nativeTrayItems = (processId: number): NativeTrayItem[] =>\n callNative(() => loadNativeAddon().trayItems(processId));\n\n/** Runs the test tray host until the process is terminated. */\nexport const nativeRunTrayHost = (): void => {\n callNative(() => loadNativeAddon().runTrayHost());\n};\n"],"names":["require","createRequire","resolve","dirname","fileURLToPath","existsSync","packageVersion"],"mappings":";;;;;;AASA,MAAM,2BAA2B,CAC/B,MACA,YACuB;AACvB,QAAM,QAAQ,IAAI,MAAM,OAAO;AAC/B,SAAO,eAAe,OAAO,QAAQ;AAAA,IACnC,YAAY;AAAA,IACZ,OAAO;AAAA,EAAA,CACR;AACD,QAAM,OAAO;AACb,SAAO;AACT;AAGO,MAAM,0BAA0B,CAAC,YACtC,yBAAyB,cAAc,OAAO;AAGzC,MAAM,gCAAgC,CAC3C,YACuB,yBAAyB,oBAAoB,OAAO;AAGtE,MAAM,gCAAgC,CAC3C,YACuB,yBAAyB,qBAAqB,OAAO;AAGvE,MAAM,6BAA6B,CACxC,YACuB,yBAAyB,iBAAiB,OAAO;AAQnE,MAAM,gCAAgC,CAC3C,YACuB,yBAAyB,oBAAoB,OAAO;AAGtE,MAAM,qCAAqC,CAChD,YAEA,yBAAyB,yBAAyB,OAAO;AAGpD,MAAM,uBAAuB,CAAC,UAAuC;AAC1E,MAAI,iBAAiB,OAAO;AAC1B,UAAM,YAAa,MAA6B;AAChD,QACE,cAAc,uBACd,cAAc,sBACd,cAAc,wBACd,cAAc,sBACd,cAAc,mBACd,cAAc,yBACd;AACA,aAAO,yBAAyB,WAAW,MAAM,OAAO;AAAA,IAC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AAM,gBAAA,EAAkB,QAAQ,SAAS,IAAI,CAAC;AAC3D;AAGO,MAAM,cAAc,CAAC,YAAuC;AACjE,aAAW,MAAM,gBAAA,EAAkB,MAAM,OAAO,CAAC;AACnD;AAGO,MAAM,aAAa,CAAC,YACzB,WAAW,MAAM,gBAAA,EAAkB,KAAK,OAAO,CAAC;AAG3C,MAAM,kBAAkB,CAC7B,YACoB,WAAW,MAAM,gBAAA,EAAkB,UAAU,OAAO,CAAC;AAGpE,MAAM,kBAAkB,CAC7B,YACoB,WAAW,MAAM,gBAAA,EAAkB,UAAU,OAAO,CAAC;AAGpE,MAAM,iBAAiB,CAC5B,SACA,UACS;AACT,aAAW,MAAM,gBAAA,EAAkB,SAAS,SAAS,KAAK,CAAC;AAC7D;AAGO,MAAM,gBAAgB,CAAC,YAC5B,WAAW,MAAM,gBAAA,EAAkB,QAAQ,OAAO,CAAC;AAG9C,MAAM,sBAAsB,MACjC,WAAW,MAAM,gBAAA,EAAkB,eAAe;AAG7C,MAAM,sBAAsB,CACjC,WAEA;AAAA,EAAW,MACT,kBAAkB;AAAA,IAChB,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAEX;AAGK,MAAM,oBAAoB,CAC/B,YAEA,WAAW,MAAM,gBAAA,EAAkB,YAAY,OAAO,CAAC;AAGlD,MAAM,kBAAkB,CAAC,cAC9B,WAAW,MAAM,gBAAA,EAAkB,UAAU,SAAS,CAAC;AAGlD,MAAM,oBAAoB,MAAY;AAC3C,aAAW,MAAM,kBAAkB,aAAa;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"native-DAhTiLnf.js","sources":["../src/errors.ts","../src/generated/packageMetadata.ts","../src/native.ts"],"sourcesContent":["// gestament - TypeScript based test driver for GTK.\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/gestament\n\nimport type { GtkAutomationError, GtkAutomationErrorCode } from './types';\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\nconst createGtkAutomationError = (\n code: GtkAutomationErrorCode,\n message: string\n): GtkAutomationError => {\n const error = new Error(message) as GtkAutomationError;\n Object.defineProperty(error, 'code', {\n enumerable: true,\n value: code,\n });\n error.name = 'GtkAutomationError';\n return error;\n};\n\n/** Creates an error for a GTK application that exited before an operation completed. */\nexport const createGtkAppExitedError = (message: string): GtkAutomationError =>\n createGtkAutomationError('APP_EXITED', message);\n\n/** Creates an error for an invalid public API argument. */\nexport const createGtkInvalidArgumentError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('INVALID_ARGUMENT', message);\n\n/** Creates an error for an accessible element that was not found. */\nexport const createGtkElementNotFoundError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('ELEMENT_NOT_FOUND', message);\n\n/** Creates an error for an element whose host object no longer exists. */\nexport const createGtkStaleElementError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('STALE_ELEMENT', message);\n\n/** Creates an error for an operation that exceeded its timeout. */\nexport const createGtkOperationTimeoutError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('TIMEOUT', message);\n\n/** Creates an error for an operation that failed. */\nexport const createGtkOperationFailedError = (\n message: string\n): GtkAutomationError => createGtkAutomationError('OPERATION_FAILED', message);\n\n/** Creates an error for an operation that is not supported by the element. */\nexport const createGtkUnsupportedInterfaceError = (\n message: string\n): GtkAutomationError =>\n createGtkAutomationError('UNSUPPORTED_INTERFACE', message);\n\n/** Converts native addon errors into the public error shape. */\nexport const normalizeNativeError = (error: unknown): GtkAutomationError => {\n if (error instanceof Error) {\n const maybeCode = (error as { code?: unknown }).code;\n if (\n maybeCode === 'ELEMENT_NOT_FOUND' ||\n maybeCode === 'INVALID_ARGUMENT' ||\n maybeCode === 'NATIVE_LOAD_FAILED' ||\n maybeCode === 'OPERATION_FAILED' ||\n maybeCode === 'STALE_ELEMENT' ||\n maybeCode === 'UNSUPPORTED_INTERFACE'\n ) {\n return createGtkAutomationError(maybeCode, error.message);\n }\n\n return createGtkAutomationError('OPERATION_FAILED', error.message);\n }\n\n return createGtkAutomationError('OPERATION_FAILED', String(error));\n};\n","// @ts-nocheck\n// This file is auto-generated by screw-up plugin\n// Do not edit manually\n\nexport const name = \"gestament\";\nexport const version = \"0.1.0\";\nexport const description = \"TypeScript based test driver for GTK\";\nexport const author = \"Kouji Matsui (@kekyo@mi.kekyo.net)\";\nexport const license = \"MIT\";\nexport const repository_url = \"https://github.com/kekyo/gestament.git\";\nexport const git_commit_hash = \"2e2298272ff7a9fff6945b8d87de6223ac4d7847\";\n","// gestament - TypeScript based test driver for GTK.\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/gestament\n\nimport { createRequire } from 'node:module';\nimport { existsSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { normalizeNativeError } from './errors';\nimport { version as packageVersion } from './generated/packageMetadata';\nimport type { GtkAutomationError } from './types';\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\ninterface NativeInfo {\n readonly version: string;\n readonly arch: string;\n readonly gtkBackend: GtkBackend;\n readonly napiVersion: number;\n}\n\nexport interface NativeCaptureBounds {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\nexport interface NativeCapture {\n readonly image: Buffer;\n readonly bounds: NativeCaptureBounds;\n readonly visibleBounds: NativeCaptureBounds;\n readonly clipped: boolean;\n}\n\nexport interface NativeElementInfo {\n readonly roleName: string;\n readonly localizedRoleName: string;\n readonly accessibleId: string;\n readonly name: string;\n readonly description: string;\n readonly interfaces: string[];\n readonly states: string[];\n}\n\n/** AT-SPI Value metadata returned by the native layer. */\nexport interface NativeValueInfo {\n /** Current numeric value. */\n readonly value: number;\n\n /** Minimum accepted numeric value. */\n readonly minimum: number;\n\n /** Maximum accepted numeric value. */\n readonly maximum: number;\n\n /** Minimum increment used by step-based controls. */\n readonly minimumIncrement: number;\n\n /** Text representation reported by AT-SPI, when available. */\n readonly text: string;\n}\n\n/** Point returned by the native layer. */\nexport interface NativeImagePoint {\n /** Horizontal pixel coordinate. */\n readonly x: number;\n\n /** Vertical pixel coordinate. */\n readonly y: number;\n}\n\n/** Image size returned by the native layer. */\nexport interface NativeImageSize {\n /** Image width in physical pixels. */\n readonly width: number;\n\n /** Image height in physical pixels. */\n readonly height: number;\n}\n\n/** AT-SPI Image metadata returned by the native layer. */\nexport interface NativeImageInfo {\n /** Text description reported by AT-SPI. */\n readonly description: string;\n\n /** Image locale reported by AT-SPI. */\n readonly locale: string;\n\n /** Image position reported by AT-SPI. */\n readonly position: NativeImagePoint;\n\n /** Image size reported by AT-SPI. */\n readonly size: NativeImageSize;\n\n /** Screen-relative image bounds reported by AT-SPI. */\n readonly bounds: NativeCaptureBounds;\n}\n\n/** Opaque native element handle backed by an AT-SPI accessible proxy. */\nexport type NativeElementHandle = object;\n\n/** AT-SPI readiness state reported by the native layer. */\nexport type NativeAtspiReadiness =\n | 'ready'\n | 'missing-bus-name'\n | 'missing-root'\n | 'missing-cache';\n\n/** StatusNotifier tray item metadata reported by the native layer. */\nexport interface NativeTrayItem {\n readonly busName: string;\n readonly objectPath: string;\n readonly id: string;\n readonly title: string;\n readonly status: string;\n readonly iconName: string;\n readonly accessibleId: string;\n}\n\ninterface NativeAddon {\n readonly findById: (\n processId: number,\n id: string\n ) => NativeElementHandle | undefined;\n readonly processAtspiReadiness: (processId: number) => NativeAtspiReadiness;\n readonly findAnyById: (id: string) => NativeElementHandle | undefined;\n readonly setTextById: (processId: number, id: string, text: string) => void;\n readonly clickById: (processId: number, id: string) => void;\n readonly textById: (processId: number, id: string) => string;\n readonly captureById: (processId: number, id: string) => NativeCapture;\n readonly windowCount: (processId: number) => number;\n readonly windowAt: (\n processId: number,\n index: number\n ) => NativeElementHandle | undefined;\n readonly childCount: (element: NativeElementHandle) => number;\n readonly childAt: (\n element: NativeElementHandle,\n index: number\n ) => NativeElementHandle | undefined;\n readonly selectedChildCount: (element: NativeElementHandle) => number;\n readonly selectedChildAt: (\n element: NativeElementHandle,\n index: number\n ) => NativeElementHandle | undefined;\n readonly isChildSelected: (\n element: NativeElementHandle,\n index: number\n ) => boolean;\n readonly selectChildAt: (element: NativeElementHandle, index: number) => void;\n readonly deselectChildAt: (\n element: NativeElementHandle,\n index: number\n ) => void;\n readonly selectAllChildren: (element: NativeElementHandle) => void;\n readonly clearSelection: (element: NativeElementHandle) => void;\n readonly tableRowCount: (element: NativeElementHandle) => number;\n readonly tableColumnCount: (element: NativeElementHandle) => number;\n readonly tableCellAt: (\n element: NativeElementHandle,\n row: number,\n column: number\n ) => NativeElementHandle | undefined;\n readonly tableSelectedRows: (element: NativeElementHandle) => number[];\n readonly tableSelectedColumns: (element: NativeElementHandle) => number[];\n readonly tableIsRowSelected: (\n element: NativeElementHandle,\n row: number\n ) => boolean;\n readonly tableIsColumnSelected: (\n element: NativeElementHandle,\n column: number\n ) => boolean;\n readonly tableIsCellSelected: (\n element: NativeElementHandle,\n row: number,\n column: number\n ) => boolean;\n readonly tableSelectRow: (element: NativeElementHandle, row: number) => void;\n readonly tableDeselectRow: (\n element: NativeElementHandle,\n row: number\n ) => void;\n readonly tableSelectColumn: (\n element: NativeElementHandle,\n column: number\n ) => void;\n readonly tableDeselectColumn: (\n element: NativeElementHandle,\n column: number\n ) => void;\n readonly setText: (element: NativeElementHandle, text: string) => void;\n readonly click: (element: NativeElementHandle) => void;\n readonly text: (element: NativeElementHandle) => string;\n readonly valueInfo: (element: NativeElementHandle) => NativeValueInfo;\n readonly imageInfo: (element: NativeElementHandle) => NativeImageInfo;\n readonly setValue: (element: NativeElementHandle, value: number) => void;\n readonly capture: (element: NativeElementHandle) => NativeCapture;\n readonly captureScreen: () => NativeCapture;\n readonly captureBounds: (\n x: number,\n y: number,\n width: number,\n height: number\n ) => NativeCapture;\n readonly elementInfo: (element: NativeElementHandle) => NativeElementInfo;\n readonly trayItems: (processId: number) => NativeTrayItem[];\n readonly runTrayHost: () => void;\n readonly nativeInfo: () => NativeInfo;\n}\n\ntype GtkBackend = 'gtk3' | 'gtk4';\ntype GtkBackendSelection = GtkBackend | 'auto';\n\nconst require = createRequire(import.meta.url);\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\n\nlet loadedAddon: NativeAddon | undefined;\n\nconst createNativeLoadError = (message: string): GtkAutomationError => {\n const loadError = new Error(message) as GtkAutomationError;\n Object.defineProperty(loadError, 'code', {\n enumerable: true,\n value: 'NATIVE_LOAD_FAILED',\n });\n return loadError;\n};\n\nconst selectedGtkBackend = (): GtkBackendSelection => {\n const value = process.env.GESTAMENT_GTK_BACKEND;\n if (value === undefined || value.length === 0) {\n return 'gtk3';\n }\n if (value === 'gtk3' || value === 'gtk4' || value === 'auto') {\n return value;\n }\n throw createNativeLoadError(\n `Unsupported GESTAMENT_GTK_BACKEND: ${value}. Expected gtk3, gtk4, or auto.`\n );\n};\n\nconst candidateGtkBackends = (): readonly GtkBackend[] => {\n const selected = selectedGtkBackend();\n return selected === 'auto' ? ['gtk3', 'gtk4'] : [selected];\n};\n\nconst prebuildDirectory = (): string => {\n if (process.platform !== 'linux') {\n throw createNativeLoadError(\n `Unsupported platform for gestament native prebuilds: ${process.platform}.`\n );\n }\n\n switch (process.arch) {\n case 'x64':\n return 'linux-x64';\n case 'ia32':\n return 'linux-ia32';\n case 'arm64':\n return 'linux-arm64';\n case 'arm':\n return 'linux-arm';\n case 'riscv64':\n return 'linux-riscv64';\n default:\n throw createNativeLoadError(\n `Unsupported architecture for gestament native prebuilds: ${process.arch}.`\n );\n }\n};\n\nconst prebuildFile = (): string =>\n process.arch === 'arm'\n ? 'node.napi.armv7.glibc.node'\n : 'node.napi.glibc.node';\n\nconst prebuildPath = (backend: GtkBackend): string =>\n resolve(\n packageRoot,\n 'prebuilds',\n prebuildDirectory(),\n backend,\n prebuildFile()\n );\n\nconst loadNativePrebuild = (backend: GtkBackend): NativeAddon => {\n const path = prebuildPath(backend);\n if (!existsSync(path)) {\n throw new Error(`Missing ${backend} native prebuild: ${path}`);\n }\n return require(path) as NativeAddon;\n};\n\nconst loadNativeAddon = (): NativeAddon => {\n if (loadedAddon !== undefined) {\n return loadedAddon;\n }\n\n const errors: string[] = [];\n for (const backend of candidateGtkBackends()) {\n try {\n const addon = loadNativePrebuild(backend);\n const nativeInfo = addon.nativeInfo();\n if (nativeInfo.version !== packageVersion) {\n throw new Error(\n `gestament native prebuild version mismatch: native=${nativeInfo.version}, package=${packageVersion}`\n );\n }\n if (nativeInfo.gtkBackend !== backend) {\n throw new Error(\n `gestament native prebuild backend mismatch: native=${nativeInfo.gtkBackend}, requested=${backend}`\n );\n }\n loadedAddon = addon;\n return loadedAddon;\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : `Unknown error: ${String(error)}`;\n errors.push(`${backend}: ${message}`);\n }\n }\n\n throw createNativeLoadError(\n `Failed to load a compatible gestament native prebuild from ${packageRoot} ` +\n `(GESTAMENT_GTK_BACKEND=${selectedGtkBackend()}). Ensure this package ` +\n 'includes prebuilds for the current Linux/glibc architecture and selected ' +\n 'GTK backend, and that runtime libraries such as libatspi, glib, gio, ' +\n `GTK, X11, and dbus are installed. Original errors: ${errors.join(' | ')}`\n );\n};\n\nconst callNative = <Result>(operation: () => Result): Result => {\n try {\n return operation();\n } catch (error) {\n throw normalizeNativeError(error);\n }\n};\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\n/** Resolves an accessible id to a native element when it exists. */\nexport const nativeFindById = (\n processId: number,\n id: string\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().findById(processId, id));\n\n/** Checks whether a GTK process has completed AT-SPI root/cache registration. */\nexport const nativeProcessAtspiReadiness = (\n processId: number\n): NativeAtspiReadiness =>\n callNative(() => loadNativeAddon().processAtspiReadiness(processId));\n\n/** Resolves an accessible id to a native element across all exposed processes. */\nexport const nativeFindAnyById = (\n id: string\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().findAnyById(id));\n\n/** Sets text contents on the accessible with the given id. */\nexport const nativeSetTextById = (\n processId: number,\n id: string,\n text: string\n): void => {\n callNative(() => loadNativeAddon().setTextById(processId, id, text));\n};\n\n/** Executes the first action on the accessible with the given id. */\nexport const nativeClickById = (processId: number, id: string): void => {\n callNative(() => loadNativeAddon().clickById(processId, id));\n};\n\n/** Reads text from the accessible with the given id. */\nexport const nativeTextById = (processId: number, id: string): string =>\n callNative(() => loadNativeAddon().textById(processId, id));\n\n/** Captures real screen pixels for the accessible with the given id. */\nexport const nativeCaptureById = (\n processId: number,\n id: string\n): NativeCapture =>\n callNative(() => loadNativeAddon().captureById(processId, id));\n\n/** Counts top-level windows hosted by the process. */\nexport const nativeWindowCount = (processId: number): number =>\n callNative(() => loadNativeAddon().windowCount(processId));\n\n/** Resolves a top-level window index to an element handle when it exists. */\nexport const nativeWindowAt = (\n processId: number,\n index: number\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().windowAt(processId, index));\n\n/** Counts direct children for an element handle. */\nexport const nativeChildCount = (element: NativeElementHandle): number =>\n callNative(() => loadNativeAddon().childCount(element));\n\n/** Resolves a direct child index to an element handle when it exists. */\nexport const nativeChildAt = (\n element: NativeElementHandle,\n index: number\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().childAt(element, index));\n\n/** Counts selected children for a selectable element handle. */\nexport const nativeSelectedChildCount = (\n element: NativeElementHandle\n): number => callNative(() => loadNativeAddon().selectedChildCount(element));\n\n/** Resolves a selected child index to an element handle when it exists. */\nexport const nativeSelectedChildAt = (\n element: NativeElementHandle,\n index: number\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().selectedChildAt(element, index));\n\n/** Reads whether a direct child is selected. */\nexport const nativeIsChildSelected = (\n element: NativeElementHandle,\n index: number\n): boolean =>\n callNative(() => loadNativeAddon().isChildSelected(element, index));\n\n/** Selects a direct child for a selectable element handle. */\nexport const nativeSelectChildAt = (\n element: NativeElementHandle,\n index: number\n): void => {\n callNative(() => loadNativeAddon().selectChildAt(element, index));\n};\n\n/** Deselects a direct child for a selectable element handle. */\nexport const nativeDeselectChildAt = (\n element: NativeElementHandle,\n index: number\n): void => {\n callNative(() => loadNativeAddon().deselectChildAt(element, index));\n};\n\n/** Selects all children for a selectable element handle. */\nexport const nativeSelectAllChildren = (element: NativeElementHandle): void => {\n callNative(() => loadNativeAddon().selectAllChildren(element));\n};\n\n/** Clears child selection for a selectable element handle. */\nexport const nativeClearSelection = (element: NativeElementHandle): void => {\n callNative(() => loadNativeAddon().clearSelection(element));\n};\n\n/** Counts table rows for a table element handle. */\nexport const nativeTableRowCount = (element: NativeElementHandle): number =>\n callNative(() => loadNativeAddon().tableRowCount(element));\n\n/** Counts table columns for a table element handle. */\nexport const nativeTableColumnCount = (element: NativeElementHandle): number =>\n callNative(() => loadNativeAddon().tableColumnCount(element));\n\n/** Resolves a table cell element handle by row and column when it exists. */\nexport const nativeTableCellAt = (\n element: NativeElementHandle,\n row: number,\n column: number\n): NativeElementHandle | undefined =>\n callNative(() => loadNativeAddon().tableCellAt(element, row, column));\n\n/** Reads selected table row indexes. */\nexport const nativeTableSelectedRows = (\n element: NativeElementHandle\n): number[] => callNative(() => loadNativeAddon().tableSelectedRows(element));\n\n/** Reads selected table column indexes. */\nexport const nativeTableSelectedColumns = (\n element: NativeElementHandle\n): number[] =>\n callNative(() => loadNativeAddon().tableSelectedColumns(element));\n\n/** Reads whether a table row is selected. */\nexport const nativeTableIsRowSelected = (\n element: NativeElementHandle,\n row: number\n): boolean =>\n callNative(() => loadNativeAddon().tableIsRowSelected(element, row));\n\n/** Reads whether a table column is selected. */\nexport const nativeTableIsColumnSelected = (\n element: NativeElementHandle,\n column: number\n): boolean =>\n callNative(() => loadNativeAddon().tableIsColumnSelected(element, column));\n\n/** Reads whether a table cell is selected. */\nexport const nativeTableIsCellSelected = (\n element: NativeElementHandle,\n row: number,\n column: number\n): boolean =>\n callNative(() => loadNativeAddon().tableIsCellSelected(element, row, column));\n\n/** Selects a table row. */\nexport const nativeTableSelectRow = (\n element: NativeElementHandle,\n row: number\n): void => {\n callNative(() => loadNativeAddon().tableSelectRow(element, row));\n};\n\n/** Deselects a table row. */\nexport const nativeTableDeselectRow = (\n element: NativeElementHandle,\n row: number\n): void => {\n callNative(() => loadNativeAddon().tableDeselectRow(element, row));\n};\n\n/** Selects a table column. */\nexport const nativeTableSelectColumn = (\n element: NativeElementHandle,\n column: number\n): void => {\n callNative(() => loadNativeAddon().tableSelectColumn(element, column));\n};\n\n/** Deselects a table column. */\nexport const nativeTableDeselectColumn = (\n element: NativeElementHandle,\n column: number\n): void => {\n callNative(() => loadNativeAddon().tableDeselectColumn(element, column));\n};\n\n/** Sets text contents on the accessible resolved by an element handle. */\nexport const nativeSetText = (\n element: NativeElementHandle,\n text: string\n): void => {\n callNative(() => loadNativeAddon().setText(element, text));\n};\n\n/** Executes the first action on the accessible resolved by an element handle. */\nexport const nativeClick = (element: NativeElementHandle): void => {\n callNative(() => loadNativeAddon().click(element));\n};\n\n/** Reads text from the accessible resolved by an element handle. */\nexport const nativeText = (element: NativeElementHandle): string =>\n callNative(() => loadNativeAddon().text(element));\n\n/** Reads value metadata from the accessible resolved by an element handle. */\nexport const nativeValueInfo = (\n element: NativeElementHandle\n): NativeValueInfo => callNative(() => loadNativeAddon().valueInfo(element));\n\n/** Reads image metadata from the accessible resolved by an element handle. */\nexport const nativeImageInfo = (\n element: NativeElementHandle\n): NativeImageInfo => callNative(() => loadNativeAddon().imageInfo(element));\n\n/** Sets a numeric value on the accessible resolved by an element handle. */\nexport const nativeSetValue = (\n element: NativeElementHandle,\n value: number\n): void => {\n callNative(() => loadNativeAddon().setValue(element, value));\n};\n\n/** Captures real screen pixels for the accessible resolved by an element handle. */\nexport const nativeCapture = (element: NativeElementHandle): NativeCapture =>\n callNative(() => loadNativeAddon().capture(element));\n\n/** Captures the full X11 root window currently addressed by DISPLAY. */\nexport const nativeCaptureScreen = (): NativeCapture =>\n callNative(() => loadNativeAddon().captureScreen());\n\n/** Captures real screen pixels for explicit screen-relative bounds. */\nexport const nativeCaptureBounds = (\n bounds: NativeCaptureBounds\n): NativeCapture =>\n callNative(() =>\n loadNativeAddon().captureBounds(\n bounds.x,\n bounds.y,\n bounds.width,\n bounds.height\n )\n );\n\n/** Reads AT-SPI metadata for the accessible resolved by an element handle. */\nexport const nativeElementInfo = (\n element: NativeElementHandle\n): NativeElementInfo =>\n callNative(() => loadNativeAddon().elementInfo(element));\n\n/** Lists StatusNotifier tray items owned by the process. */\nexport const nativeTrayItems = (processId: number): NativeTrayItem[] =>\n callNative(() => loadNativeAddon().trayItems(processId));\n\n/** Runs the test tray host until the process is terminated. */\nexport const nativeRunTrayHost = (): void => {\n callNative(() => loadNativeAddon().runTrayHost());\n};\n"],"names":["require","packageVersion"],"mappings":";;;;AASA,MAAM,2BAA2B,CAC/B,MACA,YACuB;AACvB,QAAM,QAAQ,IAAI,MAAM,OAAO;AAC/B,SAAO,eAAe,OAAO,QAAQ;AAAA,IACnC,YAAY;AAAA,IACZ,OAAO;AAAA,EAAA,CACR;AACD,QAAM,OAAO;AACb,SAAO;AACT;AAGO,MAAM,0BAA0B,CAAC,YACtC,yBAAyB,cAAc,OAAO;AAGzC,MAAM,gCAAgC,CAC3C,YACuB,yBAAyB,oBAAoB,OAAO;AAGtE,MAAM,gCAAgC,CAC3C,YACuB,yBAAyB,qBAAqB,OAAO;AAGvE,MAAM,6BAA6B,CACxC,YACuB,yBAAyB,iBAAiB,OAAO;AAQnE,MAAM,gCAAgC,CAC3C,YACuB,yBAAyB,oBAAoB,OAAO;AAGtE,MAAM,qCAAqC,CAChD,YAEA,yBAAyB,yBAAyB,OAAO;AAGpD,MAAM,uBAAuB,CAAC,UAAuC;AAC1E,MAAI,iBAAiB,OAAO;AAC1B,UAAM,YAAa,MAA6B;AAChD,QACE,cAAc,uBACd,cAAc,sBACd,cAAc,wBACd,cAAc,sBACd,cAA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