@fluid-app/widget-runtime 0.1.282 → 0.1.283

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 (74) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.d.cts +3 -3
  3. package/dist/index.d.mts +3 -3
  4. package/dist/index.mjs +2 -2
  5. package/dist/{remote-dom-renderer-BGIZ0FRi.d.mts → remote-dom-renderer-BnqVsw6k.d.mts} +4 -8
  6. package/dist/remote-dom-renderer-BnqVsw6k.d.mts.map +1 -0
  7. package/dist/remote-dom-renderer-CMpuJrkw.cjs +471 -0
  8. package/dist/remote-dom-renderer-CMpuJrkw.cjs.map +1 -0
  9. package/dist/remote-dom-renderer-D2FspToS.mjs +466 -0
  10. package/dist/remote-dom-renderer-D2FspToS.mjs.map +1 -0
  11. package/dist/{remote-dom-renderer-BoB9jd3B.d.cts → remote-dom-renderer-D3Jz1sOH.d.cts} +4 -8
  12. package/dist/remote-dom-renderer-D3Jz1sOH.d.cts.map +1 -0
  13. package/dist/{remote-dom-renderer-m5bn0hcE.mjs → remote-dom-styles-CmHfrrKz.mjs} +261 -702
  14. package/dist/remote-dom-styles-CmHfrrKz.mjs.map +1 -0
  15. package/dist/{remote-dom-renderer-VA5axIKk.cjs → remote-dom-styles-RV40tYyt.cjs} +328 -698
  16. package/dist/remote-dom-styles-RV40tYyt.cjs.map +1 -0
  17. package/dist/{remote-dom-ui-contract-B140dMly.d.mts → remote-dom-ui-contract-Dr0q3O4E.d.cts} +75 -77
  18. package/dist/remote-dom-ui-contract-Dr0q3O4E.d.cts.map +1 -0
  19. package/dist/{remote-dom-ui-contract-BLOyWbT2.d.cts → remote-dom-ui-contract-Dr0q3O4E.d.mts} +75 -77
  20. package/dist/remote-dom-ui-contract-Dr0q3O4E.d.mts.map +1 -0
  21. package/dist/remote-dom-values-BBN5u_Mj.mjs +1358 -0
  22. package/dist/remote-dom-values-BBN5u_Mj.mjs.map +1 -0
  23. package/dist/{remote-dom-values-D4AgBNWr.d.cts → remote-dom-values-BR8Qnhg9.d.cts} +1 -3
  24. package/dist/remote-dom-values-BR8Qnhg9.d.cts.map +1 -0
  25. package/dist/remote-dom-values-D1Fi2ibn.cjs +1441 -0
  26. package/dist/remote-dom-values-D1Fi2ibn.cjs.map +1 -0
  27. package/dist/{remote-dom-values-EwoLXnSn.d.mts → remote-dom-values-D8qikv8I.d.mts} +2 -3
  28. package/dist/remote-dom-values-D8qikv8I.d.mts.map +1 -0
  29. package/dist/remote-dom.cjs +2 -2
  30. package/dist/remote-dom.d.cts +2 -2
  31. package/dist/remote-dom.d.mts +2 -2
  32. package/dist/remote-dom.mjs +2 -2
  33. package/dist/site-host.cjs +372 -0
  34. package/dist/site-host.cjs.map +1 -0
  35. package/dist/site-host.d.cts +61 -0
  36. package/dist/site-host.d.cts.map +1 -0
  37. package/dist/site-host.d.mts +61 -0
  38. package/dist/site-host.d.mts.map +1 -0
  39. package/dist/site-host.mjs +369 -0
  40. package/dist/site-host.mjs.map +1 -0
  41. package/dist/{worker-react-bootstrap-C7tCMYGA.mjs → worker-react-bootstrap-CwlNMpMT.mjs} +2 -3
  42. package/dist/{worker-react-bootstrap-C7tCMYGA.mjs.map → worker-react-bootstrap-CwlNMpMT.mjs.map} +1 -1
  43. package/dist/{worker-react-bootstrap-N8jcWZ3L.cjs → worker-react-bootstrap-Dbq9hU1k.cjs} +2 -3
  44. package/dist/{worker-react-bootstrap-N8jcWZ3L.cjs.map → worker-react-bootstrap-Dbq9hU1k.cjs.map} +1 -1
  45. package/dist/{worker-react-renderer-ByjjgyrY.cjs → worker-react-renderer-CsI-dsP5.cjs} +5 -6
  46. package/dist/worker-react-renderer-CsI-dsP5.cjs.map +1 -0
  47. package/dist/{worker-react-renderer-ggcPIDLl.mjs → worker-react-renderer-LC2Dr-gj.mjs} +5 -5
  48. package/dist/{worker-react-renderer-ggcPIDLl.mjs.map → worker-react-renderer-LC2Dr-gj.mjs.map} +1 -1
  49. package/dist/worker.cjs +12 -17
  50. package/dist/worker.cjs.map +1 -1
  51. package/dist/worker.d.cts +15 -13
  52. package/dist/worker.d.cts.map +1 -1
  53. package/dist/worker.d.mts +16 -14
  54. package/dist/worker.d.mts.map +1 -1
  55. package/dist/worker.mjs +9 -13
  56. package/dist/worker.mjs.map +1 -1
  57. package/package.json +11 -6
  58. package/dist/Thread-0eUyc0Hw.cjs +0 -591
  59. package/dist/Thread-0eUyc0Hw.cjs.map +0 -1
  60. package/dist/Thread-BiW7rXts.mjs +0 -574
  61. package/dist/Thread-BiW7rXts.mjs.map +0 -1
  62. package/dist/remote-dom-renderer-BGIZ0FRi.d.mts.map +0 -1
  63. package/dist/remote-dom-renderer-BoB9jd3B.d.cts.map +0 -1
  64. package/dist/remote-dom-renderer-VA5axIKk.cjs.map +0 -1
  65. package/dist/remote-dom-renderer-m5bn0hcE.mjs.map +0 -1
  66. package/dist/remote-dom-ui-contract-B140dMly.d.mts.map +0 -1
  67. package/dist/remote-dom-ui-contract-BLOyWbT2.d.cts.map +0 -1
  68. package/dist/remote-dom-values-B5UZPDRy.cjs +0 -849
  69. package/dist/remote-dom-values-B5UZPDRy.cjs.map +0 -1
  70. package/dist/remote-dom-values-D4AgBNWr.d.cts.map +0 -1
  71. package/dist/remote-dom-values-EwoLXnSn.d.mts.map +0 -1
  72. package/dist/remote-dom-values-wEbrw5iW.mjs +0 -790
  73. package/dist/remote-dom-values-wEbrw5iW.mjs.map +0 -1
  74. package/dist/worker-react-renderer-ByjjgyrY.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-dom-values-D1Fi2ibn.cjs","names":["isBasicObject"],"sources":["../../../../node_modules/.pnpm/@quilted+threads@4.1.0_@preact+signals-core@1.14.3/node_modules/@quilted/threads/build/esm/constants.mjs","../../../../node_modules/.pnpm/@quilted+threads@4.1.0_@preact+signals-core@1.14.3/node_modules/@quilted/threads/build/esm/memory.mjs","../../../../node_modules/.pnpm/@quilted+events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs","../../../../node_modules/.pnpm/@quilted+threads@4.1.0_@preact+signals-core@1.14.3/node_modules/@quilted/threads/build/esm/errors.mjs","../../../../node_modules/.pnpm/@quilted+threads@4.1.0_@preact+signals-core@1.14.3/node_modules/@quilted/threads/build/esm/nanoid.mjs","../../../../node_modules/.pnpm/@quilted+threads@4.1.0_@preact+signals-core@1.14.3/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs","../../../../node_modules/.pnpm/@quilted+threads@4.1.0_@preact+signals-core@1.14.3/node_modules/@quilted/threads/build/esm/serialization/shared.mjs","../../../../node_modules/.pnpm/@quilted+threads@4.1.0_@preact+signals-core@1.14.3/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs","../../../../node_modules/.pnpm/@quilted+threads@4.1.0_@preact+signals-core@1.14.3/node_modules/@quilted/threads/build/esm/Thread.mjs","../src/remote-dom-ui-contract.ts","../src/remote-dom-values.ts"],"sourcesContent":["const MESSAGE_CALL = 1;\nconst MESSAGE_CALL_RESULT = 2;\nconst MESSAGE_FUNCTION_CALL = 3;\nconst MESSAGE_FUNCTION_RESULT = 4;\nconst MESSAGE_FUNCTION_RELEASE = 5;\nconst SERIALIZE_METHOD = Symbol.for('quilt.threads.serialize');\nconst TRANSFERABLE = Symbol.for('quilt.threads.transferable');\n\nexport { MESSAGE_CALL, MESSAGE_CALL_RESULT, MESSAGE_FUNCTION_CALL, MESSAGE_FUNCTION_RELEASE, MESSAGE_FUNCTION_RESULT, SERIALIZE_METHOD, TRANSFERABLE };\n","const RETAIN_METHOD = Symbol.for('quilt.threads.retain');\nconst RELEASE_METHOD = Symbol.for('quilt.threads.release');\nconst RETAINED_BY = Symbol.for('quilt.threads.retained-by');\n\n/**\n * A mapped object type that takes an object with methods, and converts it into the\n * an object with the same methods that can be called over a thread.\n */\n\n/**\n * An object that can retain a reference to a `MemoryManageable` object.\n */\n\n/**\n * An object transferred between threads that must have its memory manually managed,\n * in order to release the reference to a corresponding object on the original thread.\n */\n\n/**\n * A simple representation of a called function. This object allows this library to\n * release references to functions immediately when the function call that transferred\n * them into this thread is completed.\n */\nclass StackFrame {\n memoryManaged = (() => new Set())();\n add(memoryManageable) {\n this.memoryManaged.add(memoryManageable);\n memoryManageable[RETAINED_BY].add(this);\n memoryManageable[RETAIN_METHOD]();\n }\n release() {\n for (const memoryManaged of this.memoryManaged) {\n memoryManaged[RETAINED_BY].delete(this);\n memoryManaged[RELEASE_METHOD]();\n }\n this.memoryManaged.clear();\n }\n}\n\n/**\n * Indicates that a value is being manually memory-managed across threads by this library.\n */\nfunction isMemoryManageable(value) {\n return Boolean(value && value[RETAIN_METHOD] && value[RELEASE_METHOD]);\n}\n\n/**\n * Marks a value as being used so it will not be automatically released. Calling `retain` will,\n * by default, deeply retain the value — that is, it will traverse into nested array elements\n * and object properties, and retain every `retain`-able thing it finds.\n *\n * You will typically use this alongside also storing that value in a variable that lives outside\n * the context of the function where that value was received.\n *\n * @example\n * import {retain} from '@quilted/threads';\n *\n * const allUsers = new Set<User>();\n *\n * async function sayHello(user: User) {\n * allUsers.add(user);\n * retain(user);\n * return `Hey, ${await user.fullName()}!`;\n * }\n */\nfunction retain(value, {\n deep = true\n} = {}) {\n return retainInternal(value, deep, new Map());\n}\nfunction retainInternal(value, deep, seen) {\n const seenValue = seen.get(value);\n if (seenValue) return seenValue;\n const canRetain = isMemoryManageable(value);\n if (canRetain) {\n value[RETAIN_METHOD]();\n }\n seen.set(value, canRetain);\n if (deep) {\n if (Array.isArray(value)) {\n const nestedCanRetain = value.reduce((canRetain, item) => retainInternal(item, deep, seen) || canRetain, canRetain);\n seen.set(value, nestedCanRetain);\n return nestedCanRetain;\n }\n if (isBasicObject(value)) {\n const nestedCanRetain = Object.keys(value).reduce((canRetain, key) => retainInternal(value[key], deep, seen) || canRetain, canRetain);\n seen.set(value, nestedCanRetain);\n return nestedCanRetain;\n }\n }\n return canRetain;\n}\n\n/**\n * Once you are no longer using the a `retain`-ed value, you can use this function to mark it as\n * being unused. Like `retain()`, this function will apply to all nested array elements and object\n * properties.\n *\n * @example\n * import {retain} from '@quilted/threads';\n *\n * const allUsers = new Set<User>();\n *\n * function removeUser(user: User) {\n * allUsers.delete(user);\n * release(user);\n * }\n */\nfunction release(value, {\n deep = true\n} = {}) {\n return releaseInternal(value, deep, new Map());\n}\nfunction releaseInternal(value, deep, seen) {\n const seenValue = seen.get(value);\n if (seenValue) return seenValue;\n const canRelease = isMemoryManageable(value);\n if (canRelease) {\n value[RELEASE_METHOD]();\n }\n seen.set(value, canRelease);\n if (deep) {\n if (Array.isArray(value)) {\n const nestedCanRelease = value.reduce((canRelease, item) => releaseInternal(item, deep, seen) || canRelease, canRelease);\n seen.set(value, nestedCanRelease);\n return nestedCanRelease;\n }\n if (isBasicObject(value)) {\n const nestedCanRelease = Object.keys(value).reduce((canRelease, key) => releaseInternal(value[key], deep, seen) || canRelease, canRelease);\n seen.set(value, nestedCanRelease);\n return nestedCanRelease;\n }\n }\n return canRelease;\n}\nfunction isBasicObject(value) {\n if (value == null || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value);\n return prototype == null || prototype === Object.prototype;\n}\n\nexport { RELEASE_METHOD, RETAINED_BY, RETAIN_METHOD, StackFrame, isBasicObject, isMemoryManageable, release, retain };\n","/**\n * An `AbortController` that will automatically abort when any of\n * its \"parent\" `AbortController`s abort. This is useful for when\n * you have nested asynchronous operations that may abort independently.\n * The `AbortController` can also be independently aborted.\n *\n * To associate the parent `AbortController`s, pass their signals\n * as arguments to the constructor.\n *\n * @example\n * import {NestedAbortController} from '@shopify/events';\n *\n * const parent = new AbortController();\n * const nested = new NestedAbortController(parent.signal);\n *\n * parent.abort();\n * nested.signal.aborted; // true\n */\nclass NestedAbortController extends AbortController {\n constructor(...parents) {\n super();\n const abortedSignal = parents.find(signal => signal.aborted);\n if (abortedSignal) {\n this.abort(abortedSignal.reason);\n } else {\n const abort = event => this.abort(event.target.reason);\n const options = {\n signal: this.signal\n };\n for (const signal of parents) {\n signal.addEventListener('abort', abort, options);\n }\n }\n }\n}\n\nexport { NestedAbortController };\n","class ThreadClosedError extends Error {\n constructor() {\n super('You attempted to call a function on a closed thread.');\n }\n}\n\nexport { ThreadClosedError };\n","// Copied from https://github.com/ai/nanoid/blob/main/nanoid.js\nlet a = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';\nfunction nanoid(e = 21) {\n let t = '',\n r = crypto.getRandomValues(new Uint8Array(e));\n for (let n = 0; n < e; n++) t += a[63 & r[n]];\n return t;\n}\n\nexport { nanoid };\n","import { MESSAGE_FUNCTION_CALL, MESSAGE_FUNCTION_RELEASE } from '../constants.mjs';\nimport { nanoid } from '../nanoid.mjs';\n\n/**\n * A strategy for managing functions across threads that automatically releases\n * functions when they are no longer needed. This is done by deserializing functions\n * into a proxy that can be called, and wrapping that proxy in a `FinalizationRegistry`,\n * which allows us to send a message to the parent thread when the function is no\n * longer used.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\nclass ThreadFunctionsAutomatic {\n #functionsToId = (() => new Map())();\n #idsToFunction = (() => new Map())();\n #idsToProxy = (() => new Map())();\n #finalization = (() => new WeakMap())();\n get(id) {\n return this.#idsToFunction.get(id);\n }\n release(id) {\n const func = this.#idsToFunction.get(id);\n if (func) {\n this.#idsToFunction.delete(id);\n this.#functionsToId.delete(func);\n }\n return Boolean(func);\n }\n serialize(func) {\n let id = this.#functionsToId.get(func);\n if (id == null) {\n id = nanoid();\n this.#functionsToId.set(func, id);\n this.#idsToFunction.set(id, func);\n }\n return id;\n }\n deserialize(id, thread) {\n let proxy = this.#idsToProxy.get(id)?.deref();\n if (proxy) return proxy;\n proxy = (...args) => {\n if (!this.#idsToProxy.has(id)) {\n throw new Error('You attempted to call a function that was already revoked.');\n }\n return thread.call((callID, args, transferable) => {\n thread.messages.send([MESSAGE_FUNCTION_CALL, callID, id, args], transferable);\n }, args);\n };\n this.#finalizationRegistry(thread)?.register(proxy, id);\n this.#idsToProxy.set(id, new WeakRef(proxy));\n return proxy;\n }\n #finalizationRegistry(thread) {\n let finalization = this.#finalization.get(thread);\n if (typeof FinalizationRegistry === 'undefined') {\n return undefined;\n }\n if (!finalization) {\n finalization = new FinalizationRegistry(id => {\n thread.messages.send([MESSAGE_FUNCTION_RELEASE, id]);\n });\n this.#finalization.set(thread, finalization);\n }\n return finalization;\n }\n}\n\nexport { ThreadFunctionsAutomatic };\n","function isIterator(value) {\n return value != null && (Symbol.asyncIterator in value || Symbol.iterator in value) && typeof value.next === 'function';\n}\nfunction isBasicObject(value) {\n if (value == null || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value);\n return prototype == null || prototype === Object.prototype;\n}\n\nexport { isBasicObject, isIterator };\n","import { TRANSFERABLE, SERIALIZE_METHOD } from '../constants.mjs';\nimport { isIterator, isBasicObject } from './shared.mjs';\n\nconst FUNCTION = '_@f';\nconst ASYNC_ITERATOR = '_@i';\n\n/**\n * A thread encoder that can transfer supports a wide variety of JavaScript types by\n * converting them to a format that the [`structuredClone`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm)\n * algorithm can process. This\n *\n * Additionally, this encoder will convert functions into a JSON-friendly representation.\n * These functions will use a manual memory management technique to ensure they can be\n * garbage collected by default, but can be configured to use a `WeakRef`-based automatic\n * memory management system by setting the `garbageCollection: 'weak-ref'` option.\n */\nclass ThreadSerializationStructuredClone {\n #customSerializer;\n #customDeserializer;\n constructor(options) {\n this.#customSerializer = options?.serialize;\n this.#customDeserializer = options?.deserialize;\n }\n\n /**\n * Serializes a value into a structured cloning-compatible format that can be transferred between threads.\n */\n serialize(value, thread, transferable) {\n return this.#serializeInternal(value, thread, transferable);\n }\n #serializeInternal(value, thread, transferable, seen = new Map(), isApplyingDefault = false) {\n if (value == null) return value;\n if (seen.has(value)) return seen.get(value);\n\n // Prevent circular references\n seen.set(value, undefined);\n if (typeof value === 'object') {\n if (this.#customSerializer && !isApplyingDefault) {\n const customValue = this.#customSerializer(value, value => this.#serializeInternal(value, thread, transferable, seen, true), thread, transferable);\n if (customValue !== undefined) {\n seen.set(value, customValue);\n return customValue;\n }\n }\n if (value[TRANSFERABLE]) {\n transferable?.push(value);\n seen.set(value, value);\n return value;\n }\n const serializeValue = value => {\n return this.#serializeInternal(value, thread, transferable, seen);\n };\n if (typeof value[SERIALIZE_METHOD] === 'function') {\n const result = value[SERIALIZE_METHOD]({\n serialize: serializeValue\n });\n seen.set(value, result);\n return result;\n }\n if (Array.isArray(value)) {\n const result = value.map(item => serializeValue(item));\n seen.set(value, result);\n return result;\n }\n if (value instanceof Map) {\n const entries = [...value.entries()].map(([key, value]) => {\n return [serializeValue(key), serializeValue(value)];\n });\n const result = new Map(entries);\n seen.set(value, result);\n return result;\n }\n if (value instanceof Set) {\n const entries = [...value].map(entry => serializeValue(entry));\n const result = new Set(entries);\n seen.set(value, result);\n return result;\n }\n const valueIsIterator = isIterator(value);\n if (isBasicObject(value) || valueIsIterator) {\n const result = {};\n for (const key of Object.keys(value)) {\n result[key] = serializeValue(value[key]);\n }\n if (valueIsIterator) {\n result.next ??= serializeValue(value.next.bind(value));\n result.return ??= serializeValue(value.return.bind(value));\n result.throw ??= serializeValue(value.throw.bind(value));\n result[ASYNC_ITERATOR] = true;\n }\n seen.set(value, result);\n return result;\n }\n }\n if (typeof value === 'function') {\n const serialized = thread.functions.serialize(value, thread, transferable);\n const result = {\n [FUNCTION]: serialized\n };\n seen.set(value, result);\n return result;\n }\n seen.set(value, value);\n return value;\n }\n\n /**\n * Deserializes a structured cloning-compatible value from another thread.\n */\n deserialize(value, thread) {\n return this.#deserializeInternal(value, thread);\n }\n #deserializeInternal(value, thread, isApplyingDefault = false) {\n if (value == null) return value;\n if (typeof value === 'object') {\n if (this.#customDeserializer && !isApplyingDefault) {\n const customValue = this.#customDeserializer(value, value => this.#deserializeInternal(value, thread, true), thread);\n if (customValue !== undefined) {\n return customValue;\n }\n }\n if (value == null) {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map(value => this.#deserializeInternal(value, thread));\n }\n if (value instanceof Map) {\n return new Map([...value].map(([key, value]) => [this.#deserializeInternal(key, thread), this.#deserializeInternal(value, thread)]));\n }\n if (value instanceof Set) {\n return new Set([...value].map(entry => this.#deserializeInternal(entry, thread)));\n }\n if (FUNCTION in value) {\n const func = thread.functions.deserialize(value[FUNCTION], thread);\n return func;\n }\n if (!isBasicObject(value)) {\n return value;\n }\n const result = {};\n for (const key of Object.keys(value)) {\n if (key === ASYNC_ITERATOR) {\n result[Symbol.asyncIterator] = () => result;\n } else {\n result[key] = this.#deserializeInternal(value[key], thread);\n }\n }\n return result;\n }\n return value;\n }\n}\n\nexport { ThreadSerializationStructuredClone };\n","import { NestedAbortController } from '@quilted/events';\nimport { ThreadClosedError } from './errors.mjs';\nimport { nanoid } from './nanoid.mjs';\nimport { MESSAGE_FUNCTION_RELEASE, MESSAGE_FUNCTION_RESULT, MESSAGE_CALL_RESULT, MESSAGE_FUNCTION_CALL, MESSAGE_CALL } from './constants.mjs';\nimport { ThreadFunctionsAutomatic } from './functions/ThreadFunctionsAutomatic.mjs';\nimport { ThreadSerializationStructuredClone } from './serialization/ThreadSerializationStructuredClone.mjs';\n\n/**\n * An object that can serialize and deserialize values communicated between two threads.\n */\n\n/**\n * An object that can serialize and deserialize values communicated between two threads.\n */\n\n/**\n * Options to customize the creation of a `ThreadSerialization` instance.\n */\n\n/**\n * Options to customize the creation of a `Thread` instance.\n */\n\n/**\n * An object backing a `Thread` that provides the message-passing interface\n * that allows communication to flow between environments. This message-passing\n * interface is based on the [`postMessage` interface](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage),\n * which is easily adaptable to many JavaScript objects and environments.\n */\n\n/**\n * A map of messages that can be sent between threads.\n */\n\n/**\n * The possible data payloads that can be transferred between threads.\n */\n\n/**\n * A helper type that extracts all callable methods that can be safely proxied\n * between threads; that is, ones which return a promise or async iterator.\n */\n\n/**\n * A thread represents a target JavaScript environment that exposes a set\n * of callable, asynchronous methods. The thread takes care of automatically\n * encoding and decoding its arguments and return values, so you can interact\n * with it as if its methods were implemented in the same environment as your\n * own code.\n */\nclass Thread {\n /**\n * An object that exposes the methods that can be called on the paired thread.\n * This object will automatically encode and decode arguments and return values\n * as necessary.\n */\n\n /**\n * An object that exposes the methods that can be called on this thread by the\n * paired thread. To set these methods, pass the `exports` option when creating\n * a new `Thread`.\n */\n\n /**\n * An object that provides the message-passing interface that allows communication\n * to flow between environments.\n */\n\n /**\n * An object that manages how functions are proxied between threads.\n */\n\n /**\n * An object that manages how values are serialized and deserialized between threads.\n */\n\n /**\n * An `AbortSignal` that indicates whether the communication channel is still open.\n */\n get signal() {\n return this.#abort.signal;\n }\n\n /**\n * A boolean indicating whether the communication channel is still open.\n */\n get closed() {\n return this.#abort.signal.aborted;\n }\n #abort;\n #idsToResolver = (() => new Map())();\n constructor(messages, {\n imports,\n exports,\n functions = new ThreadFunctionsAutomatic(),\n serialization = new ThreadSerializationStructuredClone(),\n signal\n } = {}) {\n this.messages = messages;\n this.#abort = signal ? new NestedAbortController(signal) : new AbortController();\n this.exports = exports ?? {};\n this.imports = createThreadImports(this.#handlerForCall.bind(this), imports);\n this.functions = functions;\n this.serialization = serialization;\n this.functions.start?.(this);\n this.serialization.start?.(this);\n this.signal.addEventListener('abort', () => {\n for (const id of this.#idsToResolver.keys()) {\n this.#resolveCall(id, undefined, new ThreadClosedError());\n }\n this.#idsToResolver.clear();\n }, {\n once: true\n });\n messages.listen(async rawData => {\n const isThreadMessageData = Array.isArray(rawData) && typeof rawData[0] === 'number';\n if (!isThreadMessageData) {\n return;\n }\n const data = rawData;\n switch (data[0]) {\n case MESSAGE_CALL:\n {\n const [, id, property, args] = data;\n const func = this.exports[property] ?? (() => {\n throw new Error(`No '${property}' method is exported from this thread`);\n });\n await this.#callLocal(func, args, (value, error, transferable) => {\n this.messages.send([MESSAGE_CALL_RESULT, id, value, error], transferable);\n });\n break;\n }\n case MESSAGE_FUNCTION_CALL:\n {\n const [, callID, funcID, args] = data;\n const func = this.functions.get(funcID, this) ?? missingThreadFunction;\n await this.#callLocal(func, args, (value, error, transferable) => {\n this.messages.send([MESSAGE_FUNCTION_RESULT, callID, value, error], transferable);\n });\n break;\n }\n case MESSAGE_CALL_RESULT:\n case MESSAGE_FUNCTION_RESULT:\n {\n this.#resolveCall(...data.slice(1));\n break;\n }\n case MESSAGE_FUNCTION_RELEASE:\n {\n const id = data[1];\n this.functions.release(id, this);\n break;\n }\n }\n }, {\n signal: this.signal\n });\n }\n\n /**\n * Closes the communication channel between the two threads. This will prevent\n * any further communication between the threads, and will clean up any memory\n * associated with in-progress communication. It will also reject any inflight\n * function calls between threads with a `ThreadClosedError`.\n */\n close() {\n this.#abort.abort();\n }\n\n /**\n * Requests that the thread provide the context needed to make a function\n * call between threads. You provide this method a function to call and the\n * unserialized arguments you wish to call it with, and the thread will call\n * the function you provided with a serialized call ID, the serialized arguments,\n * and any transferable objects that need to be passed between threads.\n */\n call(func, args) {\n if (this.closed) {\n return Promise.reject(new ThreadClosedError());\n }\n const transferable = [];\n const serialized = this.serialization.serialize(args, this, transferable);\n const id = nanoid();\n const done = this.#waitForResult(id);\n func(id, serialized, transferable);\n return done;\n }\n async #callLocal(func, args, withResult) {\n try {\n const result = this.functions.call ? await this.functions.call(func, args, this) : await func(...this.serialization.deserialize(args, this));\n const transferable = [];\n const serialized = this.serialization.serialize(result, this, transferable);\n withResult(serialized, undefined, transferable);\n } catch (error) {\n withResult(undefined, this.serialization.serialize(error, this));\n }\n }\n #handlerForCall(property) {\n return (...args) => {\n try {\n if (typeof property !== 'string' && typeof property !== 'number') {\n throw new Error(`Can’t call a symbol method on a thread: ${property.toString()}`);\n }\n return this.call((id, serializedArgs, transferable) => {\n this.messages.send([MESSAGE_CALL, id, property, serializedArgs], transferable);\n }, args);\n } catch (error) {\n return Promise.reject(error);\n }\n };\n }\n #resolveCall(...args) {\n const callID = args[0];\n const resolver = this.#idsToResolver.get(callID);\n if (resolver) {\n resolver(...args);\n this.#idsToResolver.delete(callID);\n }\n }\n #waitForResult(id) {\n const promise = new Promise((resolve, reject) => {\n this.#idsToResolver.set(id, (_, value, error) => {\n if (error == null) {\n resolve(this.serialization.deserialize(value, this));\n } else {\n reject(this.serialization.deserialize(error, this));\n }\n });\n });\n Object.defineProperty(promise, Symbol.asyncIterator, {\n async *value() {\n const result = await promise;\n Object.defineProperty(result, Symbol.asyncIterator, {\n value: () => result\n });\n yield* result;\n }\n });\n return promise;\n }\n}\nfunction createThreadImports(handlerForImport, imported) {\n let call;\n if (imported == null) {\n if (typeof Proxy !== 'function') {\n throw new Error(`You must pass an array of callable methods in environments without Proxies.`);\n }\n const cache = new Map();\n call = new Proxy({}, {\n get(_target, property) {\n if (cache.has(property)) {\n return cache.get(property);\n }\n const handler = handlerForImport(property);\n cache.set(property, handler);\n return handler;\n }\n });\n } else {\n call = {};\n for (const method of imported) {\n Object.defineProperty(call, method, {\n value: handlerForImport(method),\n writable: false,\n configurable: true,\n enumerable: true\n });\n }\n }\n return call;\n}\nfunction missingThreadFunction() {\n throw new Error(`You attempted to call a function that is not stored. It may have already been released.`);\n}\n\nexport { Thread };\n","import type { ReactNode } from \"react\";\n\nexport const REMOTE_DOM_UI_CONTRACT_VERSION = \"2\";\nexport const REMOTE_DOM_LEGACY_UI_CONTRACT_VERSION = \"1\";\n/**\n * The contract of the member-site host (`site-host.ts`). It draws native\n * elements with no React; Fluid's components join it as they are rebuilt\n * without React (O-W.14). Portal's host doesn't offer it, and a worker runs on\n * a site only when its build names it (O-W.24), so a package built for Portal,\n * which carries React, never mounts on a site (INV-17.27).\n */\nexport const REMOTE_DOM_SITE_UI_CONTRACT_VERSION = \"site-1\";\nexport const REMOTE_DOM_SUPPORTED_UI_CONTRACT_VERSIONS = [\n REMOTE_DOM_LEGACY_UI_CONTRACT_VERSION,\n REMOTE_DOM_UI_CONTRACT_VERSION,\n] as const;\n\nexport type RemoteDomUiValueCodec =\n | \"boolean\"\n | \"finite-number-array\"\n | \"finite-number\"\n | \"navigation-url\"\n | \"option-array\"\n | \"string\"\n | \"string-array\"\n | \"string-or-string-array\"\n | \"url\";\n\nexport interface RemoteDomUiEventDefinition {\n readonly propName: string;\n readonly eventName: string;\n readonly payload: RemoteDomUiValueCodec | \"void\";\n}\n\nexport interface RemoteDomUiComponentDefinition {\n readonly exportName: string;\n readonly tagName: `fluid-ui-${string}` | \"fluid-spacer-widget\";\n readonly properties: Readonly<Record<string, RemoteDomUiValueCodec>>;\n readonly events: readonly RemoteDomUiEventDefinition[];\n readonly contractVersion: \"1\" | \"2\";\n}\n\ntype RemoteDomUiCodecValue<Codec extends RemoteDomUiValueCodec | \"void\"> =\n Codec extends \"boolean\"\n ? boolean\n : Codec extends \"finite-number-array\"\n ? readonly number[]\n : Codec extends \"finite-number\"\n ? number\n : Codec extends \"option-array\"\n ? readonly RemoteDomUiOption[]\n : Codec extends \"string\"\n ? string\n : Codec extends \"navigation-url\" | \"url\"\n ? string\n : Codec extends \"string-array\"\n ? readonly string[]\n : Codec extends \"string-or-string-array\"\n ? string | readonly string[]\n : Codec extends \"void\"\n ? void\n : never;\n\n/** Serializable label and value pair used by remote choice components. */\nexport interface RemoteDomUiOption {\n readonly label: string;\n readonly value: string;\n}\n\nconst noProperties = {} as const;\nconst noEvents = [] as const;\n\nconst commonProperties = {\n \"aria-label\": \"string\",\n disabled: \"boolean\",\n id: \"string\",\n} as const satisfies Readonly<Record<string, RemoteDomUiValueCodec>>;\n\nconst disclosureProperties = {\n defaultOpen: \"boolean\",\n open: \"boolean\",\n} as const satisfies Readonly<Record<string, RemoteDomUiValueCodec>>;\n\nconst disclosureEvents = [\n {\n propName: \"onOpenChange\",\n eventName: \"open-change\",\n payload: \"boolean\",\n },\n] as const satisfies readonly RemoteDomUiEventDefinition[];\n\nconst valueProperties = {\n defaultValue: \"string\",\n value: \"string\",\n} as const satisfies Readonly<Record<string, RemoteDomUiValueCodec>>;\n\nconst valueEvents = [\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string\",\n },\n] as const satisfies readonly RemoteDomUiEventDefinition[];\n\nconst singleOrMultipleValueEvents = [\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string-or-string-array\",\n },\n] as const satisfies readonly RemoteDomUiEventDefinition[];\n\ntype RemoteDomUiLiteralComponentDefinition<\n Name extends string,\n Properties extends Readonly<Record<string, RemoteDomUiValueCodec>>,\n Events extends readonly RemoteDomUiEventDefinition[],\n> = {\n readonly exportName: Name;\n readonly tagName: `fluid-ui-${string}`;\n readonly properties: Properties;\n readonly events: Events;\n readonly contractVersion: \"2\";\n};\n\nfunction component<const Name extends string>(\n exportName: Name,\n): RemoteDomUiLiteralComponentDefinition<\n Name,\n typeof noProperties,\n typeof noEvents\n>;\nfunction component<\n const Name extends string,\n const Properties extends Readonly<Record<string, RemoteDomUiValueCodec>>,\n>(\n exportName: Name,\n properties: Properties,\n): RemoteDomUiLiteralComponentDefinition<Name, Properties, typeof noEvents>;\nfunction component<\n const Name extends string,\n const Properties extends Readonly<Record<string, RemoteDomUiValueCodec>>,\n const Events extends readonly RemoteDomUiEventDefinition[],\n>(\n exportName: Name,\n properties: Properties,\n events: Events,\n): RemoteDomUiLiteralComponentDefinition<Name, Properties, Events>;\nfunction component(\n exportName: string,\n properties: Readonly<Record<string, RemoteDomUiValueCodec>> = noProperties,\n events: readonly RemoteDomUiEventDefinition[] = noEvents,\n): RemoteDomUiComponentDefinition {\n return {\n exportName,\n tagName: `fluid-ui-${exportName\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .toLowerCase()}`,\n properties,\n events,\n contractVersion: \"2\",\n };\n}\n\n/**\n * Reviewed positive allowlist for host-rendered Fluid UI in Remote DOM widgets.\n * This is runtime security policy; it must never be inferred from React props.\n */\nexport const REMOTE_DOM_UI_COMPONENTS = [\n component(\n \"Accordion\",\n {\n ...commonProperties,\n collapsible: \"boolean\",\n defaultValue: \"string-or-string-array\",\n dir: \"string\",\n orientation: \"string\",\n type: \"string\",\n value: \"string-or-string-array\",\n },\n singleOrMultipleValueEvents,\n ),\n component(\"AccordionItem\", { ...commonProperties, value: \"string\" }),\n component(\"AccordionTrigger\", commonProperties),\n component(\"AccordionContent\", noProperties),\n component(\"Alert\", { ...commonProperties, variant: \"string\" }),\n component(\"AlertTitle\"),\n component(\"AlertDescription\"),\n component(\"AlertDialog\", disclosureProperties, disclosureEvents),\n component(\"AlertDialogTrigger\", commonProperties),\n component(\"AlertDialogContent\"),\n component(\"AlertDialogHeader\"),\n component(\"AlertDialogFooter\"),\n component(\"AlertDialogTitle\"),\n component(\"AlertDialogDescription\"),\n component(\"AlertDialogMedia\"),\n component(\"AlertDialogAction\", commonProperties),\n component(\"AlertDialogCancel\", commonProperties),\n component(\"Avatar\", { size: \"string\" }),\n component(\"AvatarImage\", { alt: \"string\", src: \"url\" }),\n component(\"AvatarFallback\", { delayMs: \"finite-number\" }),\n component(\"AvatarBadge\"),\n component(\"AvatarGroup\"),\n component(\"AvatarGroupCount\"),\n component(\"Badge\", { variant: \"string\" }),\n component(\"Breadcrumb\"),\n component(\"BreadcrumbList\"),\n component(\"BreadcrumbItem\"),\n component(\"BreadcrumbLink\", { href: \"navigation-url\" }),\n component(\"BreadcrumbPage\"),\n component(\"BreadcrumbSeparator\"),\n component(\"BreadcrumbEllipsis\"),\n component(\n \"Button\",\n {\n ...commonProperties,\n name: \"string\",\n size: \"string\",\n type: \"string\",\n value: \"string\",\n variant: \"string\",\n },\n [{ propName: \"onPress\", eventName: \"press\", payload: \"void\" }],\n ),\n component(\n \"Calendar\",\n {\n defaultMonth: \"string\",\n disabledDates: \"string-array\",\n fromDate: \"string\",\n month: \"string\",\n selected: \"string\",\n showOutsideDays: \"boolean\",\n toDate: \"string\",\n },\n [\n {\n propName: \"onMonthChange\",\n eventName: \"month-change\",\n payload: \"string\",\n },\n {\n propName: \"onSelectedChange\",\n eventName: \"selected-change\",\n payload: \"string\",\n },\n ],\n ),\n component(\n \"Checkbox\",\n {\n ...commonProperties,\n checked: \"boolean\",\n defaultChecked: \"boolean\",\n name: \"string\",\n required: \"boolean\",\n value: \"string\",\n },\n [\n {\n propName: \"onCheckedChange\",\n eventName: \"checked-change\",\n payload: \"boolean\",\n },\n ],\n ),\n component(\"Card\"),\n component(\"CardHeader\"),\n component(\"CardFooter\"),\n component(\"CardTitle\"),\n component(\"CardAction\"),\n component(\"CardDescription\"),\n component(\"CardContent\"),\n component(\"Collapsible\", disclosureProperties, disclosureEvents),\n component(\"CollapsibleTrigger\", commonProperties),\n component(\"CollapsibleContent\"),\n component(\n \"Command\",\n { loop: \"boolean\", shouldFilter: \"boolean\", value: \"string\" },\n valueEvents,\n ),\n component(\n \"CommandInput\",\n {\n ...commonProperties,\n placeholder: \"string\",\n value: \"string\",\n },\n valueEvents,\n ),\n component(\"CommandList\"),\n component(\"CommandEmpty\"),\n component(\"CommandGroup\", { heading: \"string\", value: \"string\" }),\n component(\n \"CommandItem\",\n { ...commonProperties, keywords: \"string-array\", value: \"string\" },\n [{ propName: \"onSelect\", eventName: \"select\", payload: \"string\" }],\n ),\n component(\"CommandShortcut\"),\n component(\"CommandSeparator\", { alwaysRender: \"boolean\" }),\n component(\n \"DatePicker\",\n {\n ...commonProperties,\n placeholder: \"string\",\n value: \"string\",\n },\n [{ propName: \"onChange\", eventName: \"change\", payload: \"string\" }],\n ),\n component(\"Dialog\", disclosureProperties, disclosureEvents),\n component(\"DialogTrigger\", commonProperties),\n component(\"DialogContent\", {\n ...commonProperties,\n showCloseButton: \"boolean\",\n }),\n component(\"DialogHeader\"),\n component(\"DialogFooter\"),\n component(\"DialogTitle\"),\n component(\"DialogDescription\"),\n component(\"DialogClose\", commonProperties),\n component(\"DropdownMenu\", disclosureProperties, disclosureEvents),\n component(\"DropdownMenuTrigger\", commonProperties),\n component(\"DropdownMenuContent\", {\n align: \"string\",\n alignOffset: \"finite-number\",\n side: \"string\",\n sideOffset: \"finite-number\",\n }),\n component(\"DropdownMenuGroup\"),\n component(\"DropdownMenuLabel\", { inset: \"boolean\" }),\n component(\"DropdownMenuItem\", { ...commonProperties, inset: \"boolean\" }, [\n { propName: \"onSelect\", eventName: \"select\", payload: \"void\" },\n ]),\n component(\n \"DropdownMenuCheckboxItem\",\n { ...commonProperties, checked: \"boolean\" },\n [\n {\n propName: \"onCheckedChange\",\n eventName: \"checked-change\",\n payload: \"boolean\",\n },\n ],\n ),\n component(\"DropdownMenuRadioGroup\", valueProperties, valueEvents),\n component(\"DropdownMenuRadioItem\", { ...commonProperties, value: \"string\" }),\n component(\"DropdownMenuSeparator\"),\n component(\"DropdownMenuShortcut\"),\n component(\"DropdownMenuSub\", disclosureProperties, disclosureEvents),\n component(\"DropdownMenuSubTrigger\", {\n ...commonProperties,\n inset: \"boolean\",\n }),\n component(\"DropdownMenuSubContent\", {\n alignOffset: \"finite-number\",\n sideOffset: \"finite-number\",\n }),\n component(\n \"Input\",\n {\n ...commonProperties,\n autoComplete: \"string\",\n checked: \"boolean\",\n max: \"string\",\n maxLength: \"finite-number\",\n min: \"string\",\n minLength: \"finite-number\",\n name: \"string\",\n pattern: \"string\",\n placeholder: \"string\",\n readOnly: \"boolean\",\n required: \"boolean\",\n step: \"string\",\n type: \"string\",\n value: \"string\",\n },\n [\n { propName: \"onBlur\", eventName: \"blur\", payload: \"void\" },\n { propName: \"onFocus\", eventName: \"focus\", payload: \"void\" },\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string\",\n },\n ],\n ),\n component(\"Label\", { htmlFor: \"string\" }),\n component(\"Pagination\"),\n component(\"PaginationContent\"),\n component(\"PaginationItem\"),\n component(\"PaginationLink\", {\n ...commonProperties,\n href: \"navigation-url\",\n isActive: \"boolean\",\n size: \"string\",\n }),\n component(\"PaginationPrevious\", { href: \"navigation-url\" }),\n component(\"PaginationNext\", { href: \"navigation-url\" }),\n component(\"PaginationEllipsis\"),\n component(\n \"Popover\",\n { ...disclosureProperties, modal: \"boolean\" },\n disclosureEvents,\n ),\n component(\"PopoverTrigger\", commonProperties),\n component(\"PopoverAnchor\"),\n component(\"PopoverContent\", {\n align: \"string\",\n alignOffset: \"finite-number\",\n side: \"string\",\n sideOffset: \"finite-number\",\n }),\n component(\"PopoverHeader\"),\n component(\"PopoverTitle\"),\n component(\"PopoverDescription\"),\n component(\"Progress\", { max: \"finite-number\", value: \"finite-number\" }),\n component(\n \"RadioGroup\",\n {\n ...commonProperties,\n ...valueProperties,\n orientation: \"string\",\n required: \"boolean\",\n },\n valueEvents,\n ),\n component(\"RadioGroupItem\", { ...commonProperties, value: \"string\" }),\n component(\"ScrollArea\", { dir: \"string\", type: \"string\" }),\n component(\"ScrollBar\", { orientation: \"string\" }),\n component(\n \"Select\",\n {\n ...commonProperties,\n ...valueProperties,\n name: \"string\",\n open: \"boolean\",\n required: \"boolean\",\n },\n [...valueEvents, ...disclosureEvents],\n ),\n component(\"SelectGroup\"),\n component(\"SelectValue\", { placeholder: \"string\" }),\n component(\"SelectTrigger\", { ...commonProperties, size: \"string\" }),\n component(\"SelectContent\", {\n align: \"string\",\n position: \"string\",\n side: \"string\",\n sideOffset: \"finite-number\",\n }),\n component(\"SelectLabel\"),\n component(\"SelectItem\", {\n ...commonProperties,\n textValue: \"string\",\n value: \"string\",\n }),\n component(\"SelectSeparator\"),\n component(\"SelectScrollUpButton\"),\n component(\"SelectScrollDownButton\"),\n component(\"Separator\", { decorative: \"boolean\", orientation: \"string\" }),\n component(\"Sheet\", disclosureProperties, disclosureEvents),\n component(\"SheetTrigger\", commonProperties),\n component(\"SheetContent\", { ...commonProperties, side: \"string\" }),\n component(\"SheetHeader\"),\n component(\"SheetFooter\"),\n component(\"SheetTitle\"),\n component(\"SheetDescription\"),\n component(\"SheetClose\", commonProperties),\n component(\"Skeleton\", { \"aria-label\": \"string\" }),\n component(\n \"Slider\",\n {\n ...commonProperties,\n defaultValue: \"finite-number-array\",\n inverted: \"boolean\",\n max: \"finite-number\",\n min: \"finite-number\",\n name: \"string\",\n orientation: \"string\",\n step: \"finite-number\",\n value: \"finite-number-array\",\n },\n [\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"finite-number-array\",\n },\n {\n propName: \"onValueCommit\",\n eventName: \"value-commit\",\n payload: \"finite-number-array\",\n },\n ],\n ),\n component(\"Spinner\", { \"aria-label\": \"string\" }),\n component(\"SpinnerWithText\", { text: \"string\", variant: \"string\" }),\n component(\n \"Switch\",\n {\n ...commonProperties,\n checked: \"boolean\",\n defaultChecked: \"boolean\",\n name: \"string\",\n required: \"boolean\",\n value: \"string\",\n },\n [\n {\n propName: \"onCheckedChange\",\n eventName: \"checked-change\",\n payload: \"boolean\",\n },\n ],\n ),\n component(\"Table\"),\n component(\"TableHeader\"),\n component(\"TableBody\"),\n component(\"TableFooter\"),\n component(\"TableRow\"),\n component(\"TableHead\"),\n component(\"TableCell\"),\n component(\"TableCaption\"),\n component(\n \"Tabs\",\n {\n ...commonProperties,\n ...valueProperties,\n activationMode: \"string\",\n orientation: \"string\",\n },\n valueEvents,\n ),\n component(\"TabsList\", { loop: \"boolean\" }),\n component(\"TabsTrigger\", { ...commonProperties, value: \"string\" }),\n component(\"TabsContent\", { value: \"string\" }),\n component(\n \"Textarea\",\n {\n ...commonProperties,\n autoComplete: \"string\",\n maxLength: \"finite-number\",\n minLength: \"finite-number\",\n name: \"string\",\n placeholder: \"string\",\n readOnly: \"boolean\",\n required: \"boolean\",\n rows: \"finite-number\",\n value: \"string\",\n },\n [\n { propName: \"onBlur\", eventName: \"blur\", payload: \"void\" },\n { propName: \"onFocus\", eventName: \"focus\", payload: \"void\" },\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string\",\n },\n ],\n ),\n component(\n \"Toggle\",\n {\n ...commonProperties,\n defaultPressed: \"boolean\",\n pressed: \"boolean\",\n size: \"string\",\n variant: \"string\",\n },\n [\n {\n propName: \"onPressedChange\",\n eventName: \"pressed-change\",\n payload: \"boolean\",\n },\n ],\n ),\n component(\n \"ToggleGroup\",\n {\n ...commonProperties,\n defaultValue: \"string-or-string-array\",\n orientation: \"string\",\n rovingFocus: \"boolean\",\n spacing: \"finite-number\",\n type: \"string\",\n value: \"string-or-string-array\",\n },\n singleOrMultipleValueEvents,\n ),\n component(\"ToggleGroupItem\", { ...commonProperties, value: \"string\" }),\n component(\n \"Tooltip\",\n { defaultOpen: \"boolean\", delayDuration: \"finite-number\", open: \"boolean\" },\n disclosureEvents,\n ),\n component(\"TooltipTrigger\", commonProperties),\n component(\"TooltipContent\", {\n align: \"string\",\n side: \"string\",\n sideOffset: \"finite-number\",\n }),\n component(\n \"Combobox\",\n {\n ...commonProperties,\n emptyText: \"string\",\n options: \"option-array\",\n placeholder: \"string\",\n value: \"string\",\n zIndex: \"finite-number\",\n },\n valueEvents,\n ),\n component(\n \"InfiniteScrollSentinel\",\n {\n hasMore: \"boolean\",\n isLoading: \"boolean\",\n rootMargin: \"string\",\n },\n [{ propName: \"onLoadMore\", eventName: \"load-more\", payload: \"void\" }],\n ),\n component(\n \"PhoneInput\",\n {\n ...commonProperties,\n defaultCountry: \"string\",\n emptyText: \"string\",\n error: \"boolean\",\n searchPlaceholder: \"string\",\n value: \"string\",\n },\n [\n { propName: \"onBlur\", eventName: \"blur\", payload: \"void\" },\n { propName: \"onFocus\", eventName: \"focus\", payload: \"void\" },\n {\n propName: \"onValueChange\",\n eventName: \"value-change\",\n payload: \"string\",\n },\n ],\n ),\n {\n exportName: \"SearchSort\",\n tagName: \"fluid-ui-search-sort\",\n properties: {\n clearLabel: \"string\",\n placeholder: \"string\",\n searchValue: \"string\",\n sortLabel: \"string\",\n sortOptions: \"option-array\",\n sortValue: \"string\",\n },\n events: [\n {\n propName: \"onSearchChange\",\n eventName: \"search-change\",\n payload: \"string\",\n },\n { propName: \"onSortChange\", eventName: \"sort-change\", payload: \"string\" },\n ],\n contractVersion: \"1\",\n },\n {\n exportName: \"FluidSpacerWidget\",\n tagName: \"fluid-spacer-widget\",\n properties: {\n customHeight: \"string\",\n previewMode: \"boolean\",\n },\n events: noEvents,\n contractVersion: \"1\",\n },\n] as const satisfies readonly RemoteDomUiComponentDefinition[];\n\n/** Names of the Fluid UI components available to a Remote DOM widget. */\nexport type RemoteDomUiComponentName =\n (typeof REMOTE_DOM_UI_COMPONENTS)[number][\"exportName\"];\n\ntype RemoteDomUiDefinition<Name extends RemoteDomUiComponentName> = Extract<\n (typeof REMOTE_DOM_UI_COMPONENTS)[number],\n { readonly exportName: Name }\n>;\n\ntype RemoteDomUiPropertyProps<Name extends RemoteDomUiComponentName> = {\n readonly [Property in keyof RemoteDomUiDefinition<Name>[\"properties\"]]?: RemoteDomUiDefinition<Name>[\"properties\"][Property] extends RemoteDomUiValueCodec\n ? RemoteDomUiCodecValue<RemoteDomUiDefinition<Name>[\"properties\"][Property]>\n : never;\n};\n\ntype RemoteDomUiEventProps<Name extends RemoteDomUiComponentName> = {\n readonly [Event in RemoteDomUiDefinition<Name>[\"events\"][number] as Event[\"propName\"]]?: Event[\"payload\"] extends \"void\"\n ? () => void\n : (value: RemoteDomUiCodecValue<Event[\"payload\"]>) => void;\n};\n\ntype RemoteDomUiBaseComponentProps<Name extends RemoteDomUiComponentName> =\n RemoteDomUiPropertyProps<Name> &\n RemoteDomUiEventProps<Name> & {\n /** Content rendered inside the host-owned Fluid component. */\n readonly children?: ReactNode;\n };\n\ntype RemoteDomUiSearchSortProps = Omit<\n RemoteDomUiBaseComponentProps<\"SearchSort\">,\n | \"onSearchChange\"\n | \"onSortChange\"\n | \"searchValue\"\n | \"sortOptions\"\n | \"sortValue\"\n> &\n Required<\n Pick<\n RemoteDomUiBaseComponentProps<\"SearchSort\">,\n \"onSearchChange\" | \"searchValue\"\n >\n > &\n (\n | {\n readonly onSortChange?: never;\n readonly sortOptions?: never;\n readonly sortValue?: never;\n }\n | Required<\n Pick<\n RemoteDomUiBaseComponentProps<\"SearchSort\">,\n \"onSortChange\" | \"sortOptions\" | \"sortValue\"\n >\n >\n );\n\n/** JSON-safe props accepted by one reviewed worker Fluid UI component. */\nexport type RemoteDomUiComponentProps<Name extends RemoteDomUiComponentName> =\n Name extends \"Combobox\"\n ? RemoteDomUiBaseComponentProps<\"Combobox\"> &\n Required<\n Pick<\n RemoteDomUiBaseComponentProps<\"Combobox\">,\n \"onValueChange\" | \"options\" | \"value\"\n >\n >\n : Name extends \"SearchSort\"\n ? RemoteDomUiSearchSortProps\n : RemoteDomUiBaseComponentProps<Name>;\n\nexport const REMOTE_DOM_UI_EXCLUSIONS = {\n Chart: \"Recharts and render-function contracts are not serializable.\",\n Form: \"React Hook Form state, context, and render props stay worker-local.\",\n IconButton: \"Its required Lucide component prop is not serializable.\",\n IconToggle: \"Its required Lucide component prop is not serializable.\",\n MobileActionSheet:\n \"Viewport-level mobile presentation cannot be contained with behavioral parity.\",\n MobileBottomSheet:\n \"Viewport-level mobile presentation cannot be contained with behavioral parity.\",\n PortalContainerProvider:\n \"The widget host owns its contained portal destination.\",\n ResponsiveDialog:\n \"Its mobile presentation depends on an excluded viewport-level sheet.\",\n Toaster:\n \"Toast presentation is a global side effect outside widget ownership.\",\n fluidToast:\n \"Toast presentation is a global side effect outside widget ownership.\",\n useZodForm: \"React Hook Form state and schema integration stay worker-local.\",\n} as const;\n\nexport const REMOTE_DOM_UI_COMPONENT_BY_TAG: ReadonlyMap<\n string,\n RemoteDomUiComponentDefinition\n> = new Map(\n REMOTE_DOM_UI_COMPONENTS.map((definition) => [\n definition.tagName,\n definition,\n ]),\n);\n\nexport function getRemoteDomUiComponent(\n tagName: string,\n): RemoteDomUiComponentDefinition | undefined {\n return REMOTE_DOM_UI_COMPONENT_BY_TAG.get(tagName);\n}\n","import type {\n RemoteMutationRecord,\n RemoteNodeSerialization,\n} from \"@remote-dom/core\";\nimport {\n REMOTE_DOM_UI_COMPONENTS,\n type RemoteDomUiEventDefinition,\n} from \"./remote-dom-ui-contract\";\n\nexport const REMOTE_DOM_FULLSCREEN_CAPABILITY = \"fullscreen\";\nexport const FLUID_SEARCH_SORT_TAG_NAME = \"fluid-ui-search-sort\";\nexport const FLUID_SPACER_WIDGET_TAG_NAME = \"fluid-spacer-widget\";\n\n/** Canonical element allowlist shared by the worker registration and host sanitizer. */\nexport const REMOTE_DOM_ALLOWED_TAG_NAMES = [\n \"a\",\n \"abbr\",\n \"address\",\n \"article\",\n \"aside\",\n \"audio\",\n \"b\",\n \"bdi\",\n \"bdo\",\n \"blockquote\",\n \"br\",\n \"button\",\n \"caption\",\n \"cite\",\n \"code\",\n \"col\",\n \"colgroup\",\n \"data\",\n \"dd\",\n \"del\",\n \"details\",\n \"dfn\",\n \"dialog\",\n \"div\",\n \"dl\",\n \"dt\",\n \"em\",\n \"fieldset\",\n \"figcaption\",\n \"figure\",\n \"footer\",\n \"form\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"header\",\n \"hr\",\n \"i\",\n \"img\",\n \"input\",\n \"ins\",\n \"kbd\",\n \"label\",\n \"legend\",\n \"li\",\n \"main\",\n \"mark\",\n \"meter\",\n \"nav\",\n \"ol\",\n \"optgroup\",\n \"option\",\n \"output\",\n \"p\",\n \"picture\",\n \"pre\",\n \"progress\",\n \"q\",\n \"rp\",\n \"rt\",\n \"ruby\",\n \"s\",\n \"samp\",\n \"section\",\n \"select\",\n \"small\",\n \"source\",\n \"span\",\n \"strong\",\n \"sub\",\n \"summary\",\n \"sup\",\n \"table\",\n \"tbody\",\n \"td\",\n \"textarea\",\n \"tfoot\",\n \"th\",\n \"thead\",\n \"time\",\n \"tr\",\n \"track\",\n \"u\",\n \"ul\",\n \"var\",\n \"video\",\n \"wbr\",\n ...REMOTE_DOM_UI_COMPONENTS.map(({ tagName }) => tagName),\n] as const;\n\n/** Canonical event allowlist shared by worker elements and host forwarding. */\nexport const SUPPORTED_REMOTE_DOM_EVENTS = [\n \"blur\",\n \"change\",\n \"click\",\n \"contextmenu\",\n \"dblclick\",\n \"focus\",\n \"input\",\n \"keydown\",\n \"keypress\",\n \"keyup\",\n \"mousedown\",\n \"mouseenter\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseout\",\n \"mouseover\",\n \"mouseup\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerenter\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerout\",\n \"pointerover\",\n \"pointerup\",\n \"submit\",\n] as const;\nexport const REMOTE_DOM_SEARCH_SORT_EVENTS = [\n \"search-change\",\n \"sort-change\",\n] as const;\nexport const REMOTE_DOM_UI_EVENTS = [\n ...new Set(\n REMOTE_DOM_UI_COMPONENTS.flatMap(({ events }) =>\n (events as readonly RemoteDomUiEventDefinition[]).map(\n ({ eventName }) => eventName,\n ),\n ),\n ),\n] as const;\n\nexport type RemoteDomRemoteNode = RemoteNodeSerialization;\nexport type RemoteDomRemoteMutationRecord = RemoteMutationRecord;\n\nexport type RemoteDomSerializableValue =\n | null\n | boolean\n | number\n | string\n | readonly RemoteDomSerializableValue[]\n | { readonly [key: string]: RemoteDomSerializableValue };\n\nconst REMOTE_DOM_UNSAFE_PROPERTY_KEYS = new Set([\n \"__proto__\",\n \"constructor\",\n \"prototype\",\n]);\nconst MAX_REMOTE_DOM_SERIALIZATION_DEPTH = 50;\n\nexport function isSafeRemoteDomPropertyKey(key: string): boolean {\n return !REMOTE_DOM_UNSAFE_PROPERTY_KEYS.has(key);\n}\n\n/** Converts an arbitrary value into a structured-clone-safe Remote DOM value. */\nexport function toRemoteDomSerializableValue(\n value: unknown,\n): RemoteDomSerializableValue | undefined {\n return serializeRemoteDomValue(value, new WeakSet<object>(), 0);\n}\n\nfunction serializeRemoteDomValue(\n value: unknown,\n ancestors: WeakSet<object>,\n depth: number,\n): RemoteDomSerializableValue | undefined {\n if (\n value === undefined ||\n typeof value === \"function\" ||\n typeof value === \"symbol\"\n ) {\n return undefined;\n }\n if (typeof value === \"bigint\") return value.toString();\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\"\n ) {\n return value;\n }\n if (typeof value === \"number\") {\n return Number.isFinite(value) ? value : null;\n }\n if (typeof value !== \"object\") return null;\n if (depth > MAX_REMOTE_DOM_SERIALIZATION_DEPTH || ancestors.has(value)) {\n return null;\n }\n if (value instanceof Date) {\n return Number.isFinite(value.getTime()) ? value.toISOString() : null;\n }\n if (value instanceof Error) {\n return { name: value.name, message: value.message };\n }\n\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n return value.map(\n (item) => serializeRemoteDomValue(item, ancestors, depth + 1) ?? null,\n );\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) return null;\n\n const serialized: Record<string, RemoteDomSerializableValue> = {};\n for (const [key, item] of Object.entries(value)) {\n if (!isSafeRemoteDomPropertyKey(key)) continue;\n\n const serializedItem = serializeRemoteDomValue(\n item,\n ancestors,\n depth + 1,\n );\n if (serializedItem !== undefined) serialized[key] = serializedItem;\n }\n return serialized;\n } finally {\n ancestors.delete(value);\n }\n}\n\nexport function isRemoteDomSerializableValue(\n value: unknown,\n): value is RemoteDomSerializableValue {\n return isRemoteDomSerializableValueInternal(value, new WeakSet<object>(), 0);\n}\n\nfunction isRemoteDomSerializableValueInternal(\n value: unknown,\n seen: WeakSet<object>,\n depth: number,\n): value is RemoteDomSerializableValue {\n if (value === null) return true;\n\n switch (typeof value) {\n case \"boolean\":\n case \"string\":\n return true;\n case \"number\":\n return Number.isFinite(value);\n case \"object\":\n return isRemoteDomSerializableObject(value, seen, depth);\n default:\n return false;\n }\n}\n\nfunction isRemoteDomSerializableObject(\n value: object,\n ancestors: WeakSet<object>,\n depth: number,\n): value is\n | readonly RemoteDomSerializableValue[]\n | { readonly [key: string]: RemoteDomSerializableValue } {\n if (depth > 50 || ancestors.has(value)) return false;\n\n const prototype = Object.getPrototypeOf(value);\n if (\n !Array.isArray(value) &&\n prototype !== Object.prototype &&\n prototype !== null\n ) {\n return false;\n }\n\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n return value.every((item) =>\n isRemoteDomSerializableValueInternal(item, ancestors, depth + 1),\n );\n }\n\n return Object.entries(value).every(\n ([key, item]) =>\n isSafeRemoteDomPropertyKey(key) &&\n isRemoteDomSerializableValueInternal(item, ancestors, depth + 1),\n );\n } finally {\n ancestors.delete(value);\n }\n}\n\nexport type RemoteDomNodeProperties = Readonly<\n Record<string, RemoteDomSerializableValue | undefined>\n>;\n\nexport interface RemoteDomNavigationIntent {\n readonly href: string;\n readonly url: string;\n readonly targetId?: string;\n readonly source: \"anchor\";\n readonly altKey: boolean;\n readonly ctrlKey: boolean;\n readonly metaKey: boolean;\n readonly shiftKey: boolean;\n readonly button: number;\n}\n\nexport const DEFAULT_REMOTE_DOM_MEDIA_ORIGINS = [\n \"https://assets.fluid.app\",\n \"https://cdn.fluid.app\",\n \"https://ik.imagekit.io\",\n \"https://media.fluid.app\",\n] as const;\n\nexport interface RemoteDomUrlOriginPolicy {\n readonly artifactOrigins: readonly string[];\n readonly artifactBaseUrl?: string;\n readonly mediaOrigins: readonly string[];\n readonly navigationOrigin?: string;\n}\n\nexport interface RemoteDomUrlOriginPolicyInput {\n readonly artifactUrls: readonly string[];\n readonly mediaOrigins?: readonly string[];\n readonly navigationOrigin?: string;\n}\n\nexport function createRemoteDomUrlOriginPolicy({\n artifactUrls,\n mediaOrigins = DEFAULT_REMOTE_DOM_MEDIA_ORIGINS,\n navigationOrigin,\n}: RemoteDomUrlOriginPolicyInput): RemoteDomUrlOriginPolicy {\n const artifactOriginSet = new Set<string>();\n let artifactBaseUrl: string | undefined;\n for (const artifactUrl of artifactUrls) {\n const normalizedUrl = normalizeRemoteDomHttpUrl(artifactUrl);\n if (!normalizedUrl) continue;\n artifactOriginSet.add(normalizedUrl.origin);\n artifactBaseUrl ??= normalizedUrl.href;\n }\n\n const mediaOriginSet = new Set<string>();\n for (const mediaOrigin of mediaOrigins) {\n const origin = normalizeRemoteDomHttpOrigin(mediaOrigin);\n if (origin) mediaOriginSet.add(origin);\n }\n\n const navigationHttpOrigin = navigationOrigin\n ? normalizeRemoteDomHttpOrigin(navigationOrigin)\n : undefined;\n\n return {\n artifactOrigins: Array.from(artifactOriginSet),\n ...(artifactBaseUrl ? { artifactBaseUrl } : {}),\n mediaOrigins: Array.from(mediaOriginSet),\n ...(navigationHttpOrigin === undefined\n ? {}\n : { navigationOrigin: navigationHttpOrigin }),\n };\n}\n\nfunction normalizeRemoteDomHttpOrigin(value: string): string | undefined {\n return normalizeRemoteDomHttpUrl(value)?.origin;\n}\n\nfunction normalizeRemoteDomHttpUrl(value: string): URL | undefined {\n try {\n const parsedUrl = new URL(value);\n return parsedUrl.protocol === \"http:\" || parsedUrl.protocol === \"https:\"\n ? parsedUrl\n : undefined;\n } catch {\n return undefined;\n }\n}\n\nexport interface RemoteDomProtocolError {\n readonly code: string;\n readonly message: string;\n readonly details?: RemoteDomSerializableValue;\n}\n"],"ignoreList":[0,1,2,3,4,5,6,7,8],"mappings":";AAKA,MAAM,mBAAmB,OAAO,IAAI,yBAAyB;AAC7D,MAAM,eAAe,OAAO,IAAI,4BAA4B;;ACN5D,MAAM,gBAAgB,OAAO,IAAI,sBAAsB;AACvD,MAAM,iBAAiB,OAAO,IAAI,uBAAuB;;;;AAyCzD,SAAS,mBAAmB,OAAO;CACjC,OAAO,QAAQ,SAAS,MAAM,kBAAkB,MAAM,eAAe;AACvE;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,OAAO,OAAO,EACrB,OAAO,SACL,CAAC,GAAG;CACN,OAAO,eAAe,OAAO,sBAAM,IAAI,IAAI,CAAC;AAC9C;AACA,SAAS,eAAe,OAAO,MAAM,MAAM;CACzC,MAAM,YAAY,KAAK,IAAI,KAAK;CAChC,IAAI,WAAW,OAAO;CACtB,MAAM,YAAY,mBAAmB,KAAK;CAC1C,IAAI,WACF,MAAM,cAAc,CAAC;CAEvB,KAAK,IAAI,OAAO,SAAS;CACzB,IAAI,MAAM;EACR,IAAI,MAAM,QAAQ,KAAK,GAAG;GACxB,MAAM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,WAAW;EACX,OAAO;EACP,mBAAmB;EACnB,OAAO;CACT,GACA;EACE;GAAE,UAAU;GAAU,WAAW;GAAQ,SAAS;EAAO;EACzD;GAAE,UAAU;GAAW,WAAW;GAAS,SAAS;EAAO;EAC3D;GACE,UAAU;GACV,WAAW;GACX,SAAS;EACX;CACF,CACF;CACA;EACE,YAAY;EACZ,SAAS;EACT,YAAY;GACV,YAAY;GACZ,aAAa;GACb,aAAa;GACb,WAAW;GACX,aAAa;GACb,WAAW;EACb;EACA,QAAQ,CACN;GACE,UAAU;GACV,WAAW;GACX,SAAS;EACX,GACA;GAAE,UAAU;GAAgB,WAAW;GAAe,SAAS;EAAS,CAC1E;EACA,iBAAiB;CACnB;CACA;EACE,YAAY;EACZ,SAAS;EACT,YAAY;GACV,cAAc;GACd,aAAa;EACf;EACA,QAAQ;EACR,iBAAiB;CACnB;AACF;AA4FA,MAAa,iCAGT,IAAI,IACN,yBAAyB,KAAK,eAAe,CAC3C,WAAW,SACX,UACF,CAAC,CACH;AAEA,SAAgB,wBACd,SAC4C;CAC5C,OAAO,+BAA+B,IAAI,OAAO;AACnD;;ACjwBA,MAAa,mCAAmC;;AAKhD,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAG,yBAAyB,KAAK,EAAE,cAAc,OAAO;AAC1D;;AAG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AAe,kCACf,oBAC0D;CAC1D,MAAM,oCAAoB,IAAI,IAAY;CAC1C,IAAI;CACJ,KAAK,MAAM,eAAe,cAAc;EACtC,MAAM,gBAAgB,0BAA0B,WAAW;EAC3D,IAAI,CAAC,eAAe;EACpB,kBAAkB,IAAI,cAAc,MAAM;EAC1C,oBAAoB,cAAc;CACpC;CAEA,MAAM,iCAAiB,IAAI,IAAY;CACvC,KAAK,MAAM,eAAe,cAAc;EACtC,MAAM,SAAS,6BAA6B,WAAW;EACvD,IAAI,QAAQ,eAAe,IAAI,MAAM;CACvC;CAEA,MAAM,uBAAuB,mBACzB,6BAA6B,gBAAgB,IAC7C,KAAA;CAEJ,OAAO;EACL,iBAAiB,MAAM,KAAK,iBAAiB;EAC7C,GAAI,kBAAkB,EAAE,gBAAgB,IAAI,CAAC;EAC7C,cAAc,MAAM,KAAK,cAAc;EACvC,GAAI,yBAAyB,KAAA,IACzB,CAAC,IACD,EAAE,kBAAkB,qBAAqB;CAC/C;AACF;AAEA,SAAS,6BAA6B,OAAmC;CACvE,OAAO,0BAA0B,KAAK,CAAC,EAAE;AAC3C;AAEA,SAAS,0BAA0B,OAAgC;CACjE,IAAI;EACF,MAAM,YAAY,IAAI,IAAI,KAAK;EAC/B,OAAO,UAAU,aAAa,WAAW,UAAU,aAAa,WAC5D,YACA,KAAA;CACN,QAAQ;EACN;CACF;AACF"}
@@ -1,4 +1,4 @@
1
- //#region src/remote-dom-values.d.ts
1
+ import "@remote-dom/core";
2
2
  type RemoteDomSerializableValue = null | boolean | number | string | readonly RemoteDomSerializableValue[] | {
3
3
  readonly [key: string]: RemoteDomSerializableValue;
4
4
  };
@@ -27,6 +27,5 @@ interface RemoteDomUrlOriginPolicyInput {
27
27
  readonly mediaOrigins?: readonly string[];
28
28
  readonly navigationOrigin?: string;
29
29
  }
30
- //#endregion
31
30
  export { isRemoteDomSerializableValue as a, RemoteDomUrlOriginPolicyInput as i, RemoteDomSerializableValue as n, toRemoteDomSerializableValue as o, RemoteDomUrlOriginPolicy as r, RemoteDomNavigationIntent as t };
32
- //# sourceMappingURL=remote-dom-values-EwoLXnSn.d.mts.map
31
+ //# sourceMappingURL=remote-dom-values-D8qikv8I.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-dom-values-D8qikv8I.d.mts","names":[],"sources":["../src/remote-dom-values.ts"],"mappings":";KA0JY,yEAKC;YACG,cAAc;;;iBAcd,6BACd,iBACC;iBAkEa,6BACd,iBACC,SAAS;UAgEK;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;UAUM;WACN;WACA;WACA;WACA;;UAGM;WACN;WACA;WACA"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_remote_dom_renderer = require("./remote-dom-renderer-VA5axIKk.cjs");
3
- const require_remote_dom_values = require("./remote-dom-values-B5UZPDRy.cjs");
2
+ const require_remote_dom_renderer = require("./remote-dom-renderer-CMpuJrkw.cjs");
3
+ const require_remote_dom_values = require("./remote-dom-values-D1Fi2ibn.cjs");
4
4
  exports.isRemoteDomSerializableValue = require_remote_dom_values.isRemoteDomSerializableValue;
5
5
  exports.mountRemoteDomWidget = require_remote_dom_renderer.mountRemoteDomWidget;
6
6
  exports.toRemoteDomSerializableValue = require_remote_dom_values.toRemoteDomSerializableValue;
@@ -1,3 +1,3 @@
1
- import { a as isRemoteDomSerializableValue, i as RemoteDomUrlOriginPolicyInput, n as RemoteDomSerializableValue, o as toRemoteDomSerializableValue, r as RemoteDomUrlOriginPolicy, t as RemoteDomNavigationIntent } from "./remote-dom-values-D4AgBNWr.cjs";
2
- import { a as RemoteDomWidgetHandle, c as mountRemoteDomWidget, d as RemoteDomStyleAttachment, f as RemoteDomThemeBridgeOptions, i as RemoteDomWidgetArtifact, l as RemoteDomCssFetcher, n as RemoteDomCapabilityDeclaration, o as RemoteDomWorkerFactory, r as RemoteDomFullscreenRequest, s as RemoteDomWorkerLike, t as MountRemoteDomWidgetOptions, u as RemoteDomCssUrlInput } from "./remote-dom-renderer-BoB9jd3B.cjs";
1
+ import { a as RemoteDomWidgetHandle, c as mountRemoteDomWidget, d as RemoteDomCssUrlInput, f as RemoteDomStyleAttachment, i as RemoteDomWidgetArtifact, n as RemoteDomCapabilityDeclaration, o as RemoteDomWorkerFactory, p as RemoteDomThemeBridgeOptions, r as RemoteDomFullscreenRequest, s as RemoteDomWorkerLike, t as MountRemoteDomWidgetOptions, u as RemoteDomCssFetcher } from "./remote-dom-renderer-D3Jz1sOH.cjs";
2
+ import { a as isRemoteDomSerializableValue, i as RemoteDomUrlOriginPolicyInput, n as RemoteDomSerializableValue, o as toRemoteDomSerializableValue, r as RemoteDomUrlOriginPolicy, t as RemoteDomNavigationIntent } from "./remote-dom-values-BR8Qnhg9.cjs";
3
3
  export { type MountRemoteDomWidgetOptions, type RemoteDomCapabilityDeclaration, type RemoteDomCssFetcher, type RemoteDomCssUrlInput, type RemoteDomFullscreenRequest, type RemoteDomNavigationIntent, type RemoteDomSerializableValue, type RemoteDomStyleAttachment, type RemoteDomThemeBridgeOptions, type RemoteDomUrlOriginPolicy, type RemoteDomUrlOriginPolicyInput, type RemoteDomWidgetArtifact, type RemoteDomWidgetHandle, type RemoteDomWorkerFactory, type RemoteDomWorkerLike, isRemoteDomSerializableValue, mountRemoteDomWidget, toRemoteDomSerializableValue };
@@ -1,3 +1,3 @@
1
- import { a as isRemoteDomSerializableValue, i as RemoteDomUrlOriginPolicyInput, n as RemoteDomSerializableValue, o as toRemoteDomSerializableValue, r as RemoteDomUrlOriginPolicy, t as RemoteDomNavigationIntent } from "./remote-dom-values-EwoLXnSn.mjs";
2
- import { a as RemoteDomWidgetHandle, c as mountRemoteDomWidget, d as RemoteDomStyleAttachment, f as RemoteDomThemeBridgeOptions, i as RemoteDomWidgetArtifact, l as RemoteDomCssFetcher, n as RemoteDomCapabilityDeclaration, o as RemoteDomWorkerFactory, r as RemoteDomFullscreenRequest, s as RemoteDomWorkerLike, t as MountRemoteDomWidgetOptions, u as RemoteDomCssUrlInput } from "./remote-dom-renderer-BGIZ0FRi.mjs";
1
+ import { a as RemoteDomWidgetHandle, c as mountRemoteDomWidget, d as RemoteDomCssUrlInput, f as RemoteDomStyleAttachment, i as RemoteDomWidgetArtifact, n as RemoteDomCapabilityDeclaration, o as RemoteDomWorkerFactory, p as RemoteDomThemeBridgeOptions, r as RemoteDomFullscreenRequest, s as RemoteDomWorkerLike, t as MountRemoteDomWidgetOptions, u as RemoteDomCssFetcher } from "./remote-dom-renderer-BnqVsw6k.mjs";
2
+ import { a as isRemoteDomSerializableValue, i as RemoteDomUrlOriginPolicyInput, n as RemoteDomSerializableValue, o as toRemoteDomSerializableValue, r as RemoteDomUrlOriginPolicy, t as RemoteDomNavigationIntent } from "./remote-dom-values-D8qikv8I.mjs";
3
3
  export { type MountRemoteDomWidgetOptions, type RemoteDomCapabilityDeclaration, type RemoteDomCssFetcher, type RemoteDomCssUrlInput, type RemoteDomFullscreenRequest, type RemoteDomNavigationIntent, type RemoteDomSerializableValue, type RemoteDomStyleAttachment, type RemoteDomThemeBridgeOptions, type RemoteDomUrlOriginPolicy, type RemoteDomUrlOriginPolicyInput, type RemoteDomWidgetArtifact, type RemoteDomWidgetHandle, type RemoteDomWorkerFactory, type RemoteDomWorkerLike, isRemoteDomSerializableValue, mountRemoteDomWidget, toRemoteDomSerializableValue };
@@ -1,3 +1,3 @@
1
- import { a as isRemoteDomSerializableValue, s as toRemoteDomSerializableValue } from "./remote-dom-values-wEbrw5iW.mjs";
2
- import { t as mountRemoteDomWidget } from "./remote-dom-renderer-m5bn0hcE.mjs";
1
+ import { t as mountRemoteDomWidget } from "./remote-dom-renderer-D2FspToS.mjs";
2
+ import { a as isRemoteDomSerializableValue, s as toRemoteDomSerializableValue } from "./remote-dom-values-BBN5u_Mj.mjs";
3
3
  export { isRemoteDomSerializableValue, mountRemoteDomWidget, toRemoteDomSerializableValue };
@@ -0,0 +1,372 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_remote_dom_values = require("./remote-dom-values-D1Fi2ibn.cjs");
3
+ const require_remote_dom_styles = require("./remote-dom-styles-RV40tYyt.cjs");
4
+ let _remote_dom_core = require("@remote-dom/core");
5
+ // src/site-host.ts
6
+ /**
7
+ * The site host offers only the site contract. Workers built today require
8
+ * contract 2 and carry React, so they refuse this host; a build for sites
9
+ * names the site contract (`uiContractVersions`) and mounts.
10
+ */
11
+ const SITE_HOST_UI_CONTRACT_VERSIONS = [require_remote_dom_values.REMOTE_DOM_SITE_UI_CONTRACT_VERSION];
12
+ const DEFAULT_MAX_MUTATION_BATCH_SIZE = 1e3;
13
+ const DEFAULT_MAX_DOM_NODE_COUNT = 1e3;
14
+ /**
15
+ * Mounts one widget on a member site.
16
+ *
17
+ * Refuses a worker served from another origin, and a widget granted network
18
+ * access: on a site the sandbox's limit comes from the policy on the worker's
19
+ * own response, which a cross-origin or blob worker would not carry.
20
+ *
21
+ * Raises TypeError when the props aren't serializable, the artifact asks for
22
+ * network access, or the worker isn't on the site's origin.
23
+ */
24
+ function mountSiteWidget(options) {
25
+ const initialProps = options.props ?? null;
26
+ if (!require_remote_dom_values.isRemoteDomSerializableValue(initialProps)) throw new TypeError("Initial widget props must be serializable");
27
+ if (options.artifact.networkAccessGranted === true) throw new TypeError("Widgets on member sites can't be granted network access");
28
+ const siteOrigin = require_remote_dom_styles.normalizeNavigationOrigin(options.siteOrigin ?? (typeof location === "undefined" ? void 0 : location.origin));
29
+ if (!siteOrigin) throw new TypeError("A site widget needs the site's http(s) origin");
30
+ if (!isOnOrigin(options.artifact.workerEntryUrl, siteOrigin)) throw new TypeError("A site widget's worker must be served from the site");
31
+ const shadowRoot = options.host.shadowRoot ?? options.host.attachShadow({ mode: "open" });
32
+ shadowRoot.replaceChildren();
33
+ const urlOriginPolicy = require_remote_dom_values.createRemoteDomUrlOriginPolicy({
34
+ artifactUrls: [
35
+ options.artifact.workerEntryUrl,
36
+ ...options.artifact.cssUrls,
37
+ ...options.artifact.assetUrls
38
+ ],
39
+ mediaOrigins: options.mediaOrigins ?? [],
40
+ navigationOrigin: siteOrigin
41
+ });
42
+ const styles = require_remote_dom_styles.attachRemoteDomStyles({
43
+ artifact: options.artifact,
44
+ root: shadowRoot,
45
+ urlOriginPolicy,
46
+ onFailure: (count) => {
47
+ require_remote_dom_styles.reportHostError(options, `${count} site widget styles failed to load`);
48
+ },
49
+ ...options.cssText === void 0 ? {} : { cssText: options.cssText },
50
+ ...options.widgetCssText === void 0 ? {} : { widgetCssText: options.widgetCssText },
51
+ ...options.themeBridgeCssText === void 0 ? {} : { themeBridgeCssText: options.themeBridgeCssText },
52
+ ...options.themeBridge === void 0 ? {} : { themeBridge: options.themeBridge },
53
+ ...options.fetchCss === void 0 ? {} : { fetchCss: options.fetchCss }
54
+ });
55
+ let worker;
56
+ try {
57
+ worker = (options.workerFactory ?? createSiteWorker)(options.artifact.workerEntryUrl, { type: "module" });
58
+ } catch (error) {
59
+ require_remote_dom_styles.reportCleanupErrors(options, "Site widget setup cleanup failed", require_remote_dom_styles.collectCleanupErrors([() => styles.dispose(), () => clearDrawnNodes(shadowRoot)]));
60
+ throw error;
61
+ }
62
+ const thread = new require_remote_dom_values.Thread({
63
+ send(message, transferables) {
64
+ worker.postMessage(message, transferables ?? []);
65
+ },
66
+ listen(listener, { signal }) {
67
+ const onMessage = (event) => {
68
+ listener(event.data);
69
+ };
70
+ if (worker.addEventListener) {
71
+ worker.addEventListener("message", onMessage, { signal });
72
+ return;
73
+ }
74
+ worker.onmessage = onMessage;
75
+ signal?.addEventListener("abort", () => {
76
+ worker.onmessage = null;
77
+ }, { once: true });
78
+ }
79
+ });
80
+ const renderContainer = document.createElement("div");
81
+ renderContainer.setAttribute("data-fluid-remote-dom-render-root", "");
82
+ shadowRoot.append(renderContainer);
83
+ let state;
84
+ const isDisposed = () => state.disposed;
85
+ const drawn = new DomTree(renderContainer, options, isDisposed);
86
+ state = {
87
+ options,
88
+ shadowRoot,
89
+ renderContainer,
90
+ worker,
91
+ thread,
92
+ styles,
93
+ drawn,
94
+ submitListener: require_remote_dom_styles.createSubmitPreventionListener(),
95
+ navigationListener: (event) => {
96
+ require_remote_dom_styles.handleRemoteDomNavigationIntent({
97
+ shadowRoot,
98
+ urlOriginPolicy,
99
+ navigationOrigin: siteOrigin,
100
+ allowedAnchorUrls: options.allowedAnchorUrls,
101
+ onNavigate: options.onNavigate,
102
+ onError: options.onError,
103
+ isDisposed
104
+ }, event);
105
+ },
106
+ disposed: false
107
+ };
108
+ const connection = require_remote_dom_styles.createSanitizingRemoteConnection({
109
+ connection: drawn.connection,
110
+ ...options.allowedAnchorUrls ? { allowedAnchorUrls: options.allowedAnchorUrls } : {},
111
+ urlOriginPolicy,
112
+ maxMutationBatchSize: options.maxMutationBatchSize ?? DEFAULT_MAX_MUTATION_BATCH_SIZE,
113
+ maxDomNodeCount: options.maxDomNodeCount ?? DEFAULT_MAX_DOM_NODE_COUNT,
114
+ onNodeLimitExceeded: () => {
115
+ require_remote_dom_styles.reportHostError(options, "Site widget exceeded its DOM node limit");
116
+ },
117
+ onInvalidRecord: (message) => require_remote_dom_styles.reportHostError(options, message),
118
+ onMutateError: (error) => require_remote_dom_styles.reportHostError(options, "Site widget mutation could not be applied", error)
119
+ });
120
+ shadowRoot.addEventListener("submit", state.submitListener, { capture: true });
121
+ shadowRoot.addEventListener("click", state.navigationListener, { capture: true });
122
+ worker.onerror = (event) => {
123
+ event.preventDefault?.();
124
+ if (state.disposed) return;
125
+ require_remote_dom_styles.reportHostError(options, event.message || "Site widget worker failed", event.error);
126
+ disposeQuietly(state, false);
127
+ };
128
+ const ready = Promise.all([styles.ready, thread.imports.mount({
129
+ widgetType: options.artifact.widgetType,
130
+ props: initialProps,
131
+ supportedUiContractVersions: SITE_HOST_UI_CONTRACT_VERSIONS
132
+ }, {
133
+ mutate(records) {
134
+ if (state.disposed) return;
135
+ connection.mutate(records);
136
+ require_remote_dom_styles.enforceAllowedAnchorSafety(shadowRoot, options.allowedAnchorUrls);
137
+ },
138
+ callCapability(capability, method, payload) {
139
+ return require_remote_dom_styles.callRemoteDomCapability({
140
+ declared: options.artifact.capabilities,
141
+ host: options.host,
142
+ shadowRoot,
143
+ callCapability: options.callCapability,
144
+ onError: options.onError,
145
+ isDisposed
146
+ }, capability, method, payload);
147
+ },
148
+ reportError(error) {
149
+ require_remote_dom_styles.reportHostError(options, error.message);
150
+ }
151
+ })]).then(() => void 0);
152
+ ready.catch((error) => {
153
+ if (state.disposed) return;
154
+ require_remote_dom_styles.reportHostError(options, "Site widget failed to mount", error);
155
+ disposeQuietly(state);
156
+ });
157
+ return {
158
+ shadowRoot,
159
+ styles,
160
+ ready,
161
+ updateProps(props) {
162
+ if (state.disposed) return;
163
+ if (!require_remote_dom_values.isRemoteDomSerializableValue(props)) throw new TypeError("Widget props must be serializable");
164
+ state.thread.imports.updateProps(props).catch((error) => {
165
+ if (!state.disposed) require_remote_dom_styles.reportHostError(options, "Site widget props update failed", error);
166
+ });
167
+ },
168
+ dispose() {
169
+ disposeSiteWidget(state);
170
+ }
171
+ };
172
+ }
173
+ /**
174
+ * Starts the worker straight from its URL. No blob wrapper: a blob worker
175
+ * takes the page's policy instead of the one on the worker's response.
176
+ */
177
+ function createSiteWorker(workerEntryUrl, options) {
178
+ if (typeof Worker === "undefined") throw new Error("Workers are not available in this environment");
179
+ return new Worker(workerEntryUrl, options);
180
+ }
181
+ function isOnOrigin(url, origin) {
182
+ try {
183
+ const parsed = new URL(url, origin);
184
+ return (parsed.protocol === "https:" || parsed.protocol === "http:") && parsed.origin === origin;
185
+ } catch {
186
+ return false;
187
+ }
188
+ }
189
+ /** Applies sanitized Remote DOM records to real DOM nodes. */
190
+ var DomTree = class {
191
+ container;
192
+ reporter;
193
+ isDisposed;
194
+ connection;
195
+ nodes = /* @__PURE__ */ new Map();
196
+ ids = /* @__PURE__ */ new WeakMap();
197
+ elements = /* @__PURE__ */ new Map();
198
+ constructor(container, reporter, isDisposed) {
199
+ this.container = container;
200
+ this.reporter = reporter;
201
+ this.isDisposed = isDisposed;
202
+ this.elements.set(_remote_dom_core.ROOT_ID, {
203
+ element: container,
204
+ tagName: "",
205
+ listeners: /* @__PURE__ */ new Map(),
206
+ handlers: /* @__PURE__ */ new Map()
207
+ });
208
+ this.connection = (0, _remote_dom_core.createRemoteConnection)({
209
+ call: (_id, method) => {
210
+ throw new Error(`Site widget method "${method}" is not allowed`);
211
+ },
212
+ insertChild: (parentId, child, index) => {
213
+ const parent = this.parentNode(parentId);
214
+ const node = this.build(child);
215
+ parent.insertBefore(node, parent.childNodes[index] ?? null);
216
+ },
217
+ removeChild: (parentId, index) => {
218
+ const node = this.parentNode(parentId).childNodes[index];
219
+ if (!node) throw new Error(`No child at ${index} of "${parentId}"`);
220
+ this.forget(node);
221
+ node.remove();
222
+ },
223
+ updateText: (id, text) => {
224
+ const node = this.nodes.get(id);
225
+ if (node instanceof CharacterData) node.data = text;
226
+ },
227
+ updateProperty: (id, name, value, type) => {
228
+ const drawn = this.elements.get(id);
229
+ if (drawn) this.apply(drawn, name, value, type ?? _remote_dom_core.UPDATE_PROPERTY_TYPE_PROPERTY);
230
+ }
231
+ });
232
+ }
233
+ clear() {
234
+ for (const child of Array.from(this.container.childNodes)) {
235
+ this.forget(child);
236
+ child.remove();
237
+ }
238
+ const root = this.elements.get(_remote_dom_core.ROOT_ID);
239
+ if (root) for (const eventName of Array.from(root.listeners.keys())) this.listen(root, eventName, null);
240
+ }
241
+ parentNode(id) {
242
+ const parent = id === _remote_dom_core.ROOT_ID ? this.container : this.nodes.get(id);
243
+ if (!parent) throw new Error(`Parent "${id}" is missing`);
244
+ return parent;
245
+ }
246
+ build(child) {
247
+ let node;
248
+ if (child.type === _remote_dom_core.NODE_TYPE_TEXT) node = document.createTextNode(child.data);
249
+ else if (child.type === _remote_dom_core.NODE_TYPE_COMMENT) node = document.createComment(child.data);
250
+ else if (child.type === _remote_dom_core.NODE_TYPE_ELEMENT) {
251
+ const element = document.createElement(child.element);
252
+ element.setAttribute(require_remote_dom_styles.REMOTE_DOM_NODE_ID_ATTRIBUTE, child.id);
253
+ const drawn = {
254
+ element,
255
+ tagName: child.element,
256
+ listeners: /* @__PURE__ */ new Map(),
257
+ handlers: /* @__PURE__ */ new Map()
258
+ };
259
+ this.elements.set(child.id, drawn);
260
+ for (const grandchild of child.children ?? []) element.append(this.build(grandchild));
261
+ for (const [name, value] of Object.entries(child.attributes ?? {})) this.apply(drawn, name, value, _remote_dom_core.UPDATE_PROPERTY_TYPE_ATTRIBUTE);
262
+ for (const [name, value] of Object.entries(child.properties ?? {})) this.apply(drawn, name, value, _remote_dom_core.UPDATE_PROPERTY_TYPE_PROPERTY);
263
+ for (const [name, value] of Object.entries(child.eventListeners ?? {})) this.apply(drawn, name, value, _remote_dom_core.UPDATE_PROPERTY_TYPE_EVENT_LISTENER);
264
+ node = element;
265
+ } else throw new Error("Unknown Remote DOM node type");
266
+ this.nodes.set(child.id, node);
267
+ this.ids.set(node, child.id);
268
+ return node;
269
+ }
270
+ apply(drawn, name, value, type) {
271
+ if (type === _remote_dom_core.UPDATE_PROPERTY_TYPE_EVENT_LISTENER) {
272
+ this.listen(drawn, name, typeof value === "function" ? value : null);
273
+ return;
274
+ }
275
+ const { element } = drawn;
276
+ if (element instanceof HTMLInputElement && (name === "value" || name === "checked")) {
277
+ if (type !== _remote_dom_core.UPDATE_PROPERTY_TYPE_PROPERTY) return;
278
+ if (name === "value" && typeof value === "string") element.value = value;
279
+ if (name === "checked" && typeof value === "boolean") element.checked = value;
280
+ return;
281
+ }
282
+ if (element instanceof HTMLTextAreaElement && name === "value") {
283
+ element.value = typeof value === "string" ? value : "";
284
+ return;
285
+ }
286
+ if (value === void 0 || value === null || value === false) element.removeAttribute(name);
287
+ else if (value === true) element.setAttribute(name, "");
288
+ else if (typeof value === "string" || typeof value === "number") element.setAttribute(name, String(value));
289
+ else element[name] = value;
290
+ }
291
+ listen(drawn, eventName, listener) {
292
+ const previous = drawn.listeners.get(eventName);
293
+ if (previous === listener) return;
294
+ if (listener) require_remote_dom_values.retain(listener);
295
+ if (previous) require_remote_dom_values.release(previous);
296
+ if (!listener) {
297
+ drawn.listeners.delete(eventName);
298
+ const handler = drawn.handlers.get(eventName);
299
+ if (handler) {
300
+ drawn.element.removeEventListener(eventName, handler, { capture: drawn.element === this.container });
301
+ drawn.handlers.delete(eventName);
302
+ }
303
+ return;
304
+ }
305
+ drawn.listeners.set(eventName, listener);
306
+ if (drawn.handlers.has(eventName)) return;
307
+ const currentTargetId = drawn.element === this.container ? _remote_dom_core.ROOT_ID : drawn.element.getAttribute("data-fluid-remote-dom-node-id") ?? _remote_dom_core.ROOT_ID;
308
+ const handler = (event) => {
309
+ const current = drawn.listeners.get(eventName);
310
+ if (!current) return;
311
+ if (require_remote_dom_styles.hasCloserRemoteEventListener(event, currentTargetId, (id) => Boolean(this.elements.get(id)?.listeners.has(eventName)))) return;
312
+ require_remote_dom_styles.deliverRemoteDomEvent({
313
+ event,
314
+ eventName,
315
+ currentTargetId,
316
+ ...drawn.tagName ? { currentTargetTagName: drawn.tagName } : {},
317
+ listener: current,
318
+ reporter: this.reporter,
319
+ isDisposed: this.isDisposed
320
+ });
321
+ };
322
+ drawn.handlers.set(eventName, handler);
323
+ drawn.element.addEventListener(eventName, handler, { capture: drawn.element === this.container });
324
+ }
325
+ forget(node) {
326
+ const id = this.ids.get(node);
327
+ if (id !== void 0) {
328
+ const drawn = this.elements.get(id);
329
+ if (drawn) {
330
+ for (const listener of drawn.listeners.values()) require_remote_dom_values.release(listener);
331
+ drawn.listeners.clear();
332
+ }
333
+ this.nodes.delete(id);
334
+ this.elements.delete(id);
335
+ }
336
+ for (const child of Array.from(node.childNodes)) this.forget(child);
337
+ }
338
+ };
339
+ function disposeSiteWidget(state, notifyWorker = true) {
340
+ if (state.disposed) return;
341
+ state.disposed = true;
342
+ const errors = require_remote_dom_styles.collectCleanupErrors([
343
+ () => {
344
+ state.worker.onerror = null;
345
+ },
346
+ () => state.shadowRoot.removeEventListener("submit", state.submitListener, { capture: true }),
347
+ () => state.shadowRoot.removeEventListener("click", state.navigationListener, { capture: true }),
348
+ () => state.drawn.clear(),
349
+ () => state.styles.dispose(),
350
+ () => clearDrawnNodes(state.shadowRoot)
351
+ ]);
352
+ if (notifyWorker) Promise.resolve(state.thread.imports.dispose()).catch(() => void 0);
353
+ queueMicrotask(() => {
354
+ require_remote_dom_styles.reportCleanupErrors(state.options, "Site widget asynchronous cleanup failed", require_remote_dom_styles.collectCleanupErrors([() => state.thread.close(), () => state.worker.terminate()]));
355
+ });
356
+ if (errors.length > 0) throw new AggregateError(errors, "Site widget cleanup failed");
357
+ }
358
+ function disposeQuietly(state, notifyWorker = true) {
359
+ try {
360
+ disposeSiteWidget(state, notifyWorker);
361
+ } catch (error) {
362
+ require_remote_dom_styles.reportHostError(state.options, "Site widget cleanup failed after an earlier error", error);
363
+ }
364
+ }
365
+ function clearDrawnNodes(shadowRoot) {
366
+ for (const child of Array.from(shadowRoot.childNodes)) if (!(child instanceof HTMLStyleElement && child.hasAttribute("data-fluid-widget-style"))) child.remove();
367
+ }
368
+ exports.SITE_HOST_UI_CONTRACT_VERSIONS = SITE_HOST_UI_CONTRACT_VERSIONS;
369
+ exports.createSiteWorker = createSiteWorker;
370
+ exports.mountSiteWidget = mountSiteWidget;
371
+
372
+ //# sourceMappingURL=site-host.cjs.map