@b9g/crank 0.5.5 → 0.5.6
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.
- package/dom.cjs +2 -4
- package/dom.cjs.map +1 -1
- package/dom.js +2 -4
- package/dom.js.map +1 -1
- package/package.json +1 -1
- package/umd.js +2 -4
- package/umd.js.map +1 -1
package/umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"umd.js","sources":["../src/crank.ts","../src/dom.ts","../src/html.ts"],"sourcesContent":["const NOOP = () => {};\nconst IDENTITY = <T>(value: T): T => value;\n\nfunction wrap<T>(value: Array<T> | T | undefined): Array<T> {\n\treturn value === undefined ? [] : Array.isArray(value) ? value : [value];\n}\n\nfunction unwrap<T>(arr: Array<T>): Array<T> | T | undefined {\n\treturn arr.length === 0 ? undefined : arr.length === 1 ? arr[0] : arr;\n}\n\ntype NonStringIterable<T> = Iterable<T> & object;\n\n/**\n * Ensures a value is an array.\n *\n * This function does the same thing as wrap() above except it handles nulls\n * and iterables, so it is appropriate for wrapping user-provided element\n * children.\n */\nfunction arrayify<T>(\n\tvalue: NonStringIterable<T> | T | null | undefined,\n): Array<T> {\n\treturn value == null\n\t\t? []\n\t\t: Array.isArray(value)\n\t\t? value\n\t\t: typeof value === \"string\" ||\n\t\t typeof (value as any)[Symbol.iterator] !== \"function\"\n\t\t? [value]\n\t\t: // TODO: inference broke in TypeScript 3.9.\n\t\t [...(value as any)];\n}\n\nfunction isIteratorLike(\n\tvalue: any,\n): value is Iterator<unknown> | AsyncIterator<unknown> {\n\treturn value != null && typeof value.next === \"function\";\n}\n\nfunction isPromiseLike(value: any): value is PromiseLike<unknown> {\n\treturn value != null && typeof value.then === \"function\";\n}\n\n/**\n * A type which represents all valid values for an element tag.\n */\nexport type Tag = string | symbol | Component;\n\n/**\n * A helper type to map the tag of an element to its expected props.\n *\n * @template TTag - The tag associated with the props. Can be a string, symbol\n * or a component function.\n */\nexport type TagProps<TTag extends Tag> = TTag extends string\n\t? JSX.IntrinsicElements[TTag]\n\t: TTag extends Component<infer TProps>\n\t? TProps\n\t: Record<string, unknown>;\n\n/***\n * SPECIAL TAGS\n *\n * Crank provides a couple tags which have special meaning for the renderer.\n ***/\n\n/**\n * A special tag for grouping multiple children within the same parent.\n *\n * All non-string iterables which appear in the element tree are implicitly\n * wrapped in a fragment element.\n *\n * This tag is just the empty string, and you can use the empty string in\n * createElement calls or transpiler options directly to avoid having to\n * reference this export.\n */\nexport const Fragment = \"\";\nexport type Fragment = typeof Fragment;\n\n// TODO: We assert the following symbol tags as any because TypeScript support\n// for symbol tags in JSX doesn’t exist yet.\n// https://github.com/microsoft/TypeScript/issues/38367\n\n/**\n * A special tag for rendering into a new root node via a root prop.\n *\n * This tag is useful for creating element trees with multiple roots, for\n * things like modals or tooltips.\n *\n * Renderer.prototype.render() will implicitly wrap top-level element trees in\n * a Portal element.\n */\nexport const Portal = Symbol.for(\"crank.Portal\") as any;\nexport type Portal = typeof Portal;\n\n/**\n * A special tag which preserves whatever was previously rendered in the\n * element’s position.\n *\n * Copy elements are useful for when you want to prevent a subtree from\n * rerendering as a performance optimization. Copy elements can also be keyed,\n * in which case the previously rendered keyed element will be copied.\n */\nexport const Copy = Symbol.for(\"crank.Copy\") as any;\nexport type Copy = typeof Copy;\n\n/**\n * A special tag for injecting raw nodes or strings via a value prop.\n *\n * Renderer.prototype.raw() is called with the value prop.\n */\nexport const Raw = Symbol.for(\"crank.Raw\") as any;\nexport type Raw = typeof Raw;\n\n/**\n * Describes all valid values of an element tree, excluding iterables.\n *\n * Arbitrary objects can also be safely rendered, but will be converted to a\n * string using the toString() method. We exclude them from this type to catch\n * potential mistakes.\n */\nexport type Child = Element | string | number | boolean | null | undefined;\n\n/**\n * An arbitrarily nested iterable of Child values.\n *\n * We use a recursive interface here rather than making the Children type\n * directly recursive because recursive type aliases were added in TypeScript\n * 3.7.\n *\n * You should avoid referencing this type directly, as it is mainly exported to\n * prevent TypeScript errors.\n */\nexport interface ChildIterable extends Iterable<Child | ChildIterable> {}\n\n/**\n * Describes all valid values of an element tree, including arbitrarily nested\n * iterables of such values.\n */\nexport type Children = Child | ChildIterable;\n\n/**\n * Represents all functions which can be used as a component.\n *\n * @template [TProps=*] - The expected props for the component.\n */\nexport type Component<TProps extends Record<string, unknown> = any> = (\n\tthis: Context<TProps>,\n\tprops: TProps,\n) =>\n\t| Children\n\t| PromiseLike<Children>\n\t// The return type of iterators must include void because TypeScript will\n\t// infer generators which return implicitly as having a void return type.\n\t| Iterator<Children, Children | void, any>\n\t| AsyncIterator<Children, Children | void, any>;\n\ntype ChildrenIteratorResult = IteratorResult<Children, Children | void>;\n\n/**\n * A type to keep track of keys. Any value can be a key, though null and\n * undefined are ignored.\n */\ntype Key = unknown;\n\nconst ElementSymbol = Symbol.for(\"crank.Element\");\n\n// To maximize compatibility between Crank versions, starting with 0.2.0, any\n// changes to the Element properties will be considered a breaking change.\nexport interface Element<TTag extends Tag = Tag> {\n\t/**\n\t * @internal\n\t * A unique symbol to identify elements as elements across versions and\n\t * realms, and to protect against basic injection attacks.\n\t * https://overreacted.io/why-do-react-elements-have-typeof-property/\n\t *\n\t * This property is defined on the element prototype rather than per\n\t * instance, because it is the same for every Element.\n\t */\n\t$$typeof: typeof ElementSymbol;\n\n\t/**\n\t * The tag of the element. Can be a string, symbol or function.\n\t */\n\ttag: TTag;\n\n\t/**\n\t * An object containing the “properties” of an element. These correspond to\n\t * the attribute syntax from JSX.\n\t */\n\tprops: TagProps<TTag>;\n\n\t/**\n\t * A value which uniquely identifies an element from its siblings so that it\n\t * can be added/updated/moved/removed by key rather than position.\n\t *\n\t * Passed in createElement() as the prop \"c-key\".\n\t */\n\tkey: Key;\n\n\t/**\n\t * A callback which is called with the element’s result when it is committed.\n\t *\n\t * Passed in createElement() as the prop \"c-ref\".\n\t */\n\tref: ((value: unknown) => unknown) | undefined;\n\n\t/**\n\t * A possible boolean which indicates that element should NOT be rerendered.\n\t * If the element has never been rendered, this property has no effect.\n\t *\n\t * Passed in createElement() as the prop \"c-static\".\n\t */\n\tstatic_: boolean | undefined;\n}\n\n/**\n * Elements are the basic building blocks of Crank applications. They are\n * JavaScript objects which are interpreted by special classes called renderers\n * to produce and manage stateful nodes.\n *\n * @template {Tag} [TTag=Tag] - The type of the tag of the element.\n *\n * @example\n * // specific element types\n * let div: Element<\"div\">;\n * let portal: Element<Portal>;\n * let myEl: Element<MyComponent>;\n *\n * // general element types\n * let host: Element<string | symbol>;\n * let component: Element<Component>;\n *\n * Typically, you use a helper function like createElement to create elements\n * rather than instatiating this class directly.\n */\nexport class Element<TTag extends Tag = Tag> {\n\tconstructor(\n\t\ttag: TTag,\n\t\tprops: TagProps<TTag>,\n\t\tkey: Key,\n\t\tref?: ((value: unknown) => unknown) | undefined,\n\t\tstatic_?: boolean | undefined,\n\t) {\n\t\tthis.tag = tag;\n\t\tthis.props = props;\n\t\tthis.key = key;\n\t\tthis.ref = ref;\n\t\tthis.static_ = static_;\n\t}\n}\n\n// See Element interface\nElement.prototype.$$typeof = ElementSymbol;\n\nexport function isElement(value: any): value is Element {\n\treturn value != null && value.$$typeof === ElementSymbol;\n}\n\n/**\n * Creates an element with the specified tag, props and children.\n *\n * This function is usually used as a transpilation target for JSX transpilers,\n * but it can also be called directly. It additionally extracts special props so\n * they aren’t accessible to renderer methods or components, and assigns the\n * children prop according to any additional arguments passed to the function.\n */\nexport function createElement<TTag extends Tag>(\n\ttag: TTag,\n\tprops?: TagProps<TTag> | null | undefined,\n\t...children: Array<unknown>\n): Element<TTag> {\n\tlet key: Key;\n\tlet ref: ((value: unknown) => unknown) | undefined;\n\tlet static_ = false;\n\tconst props1 = {} as TagProps<TTag>;\n\tif (props != null) {\n\t\tfor (const name in props) {\n\t\t\tswitch (name) {\n\t\t\t\tcase \"crank-key\":\n\t\t\t\tcase \"c-key\":\n\t\t\t\tcase \"$key\":\n\t\t\t\t\t// We have to make sure we don’t assign null to the key because we\n\t\t\t\t\t// don’t check for null keys in the diffing functions.\n\t\t\t\t\tif (props[name] != null) {\n\t\t\t\t\t\tkey = props[name];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"crank-ref\":\n\t\t\t\tcase \"c-ref\":\n\t\t\t\tcase \"$ref\":\n\t\t\t\t\tif (typeof props[name] === \"function\") {\n\t\t\t\t\t\tref = props[name];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"crank-static\":\n\t\t\t\tcase \"c-static\":\n\t\t\t\tcase \"$static\":\n\t\t\t\t\tstatic_ = !!props[name];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tprops1[name] = props[name];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (children.length > 1) {\n\t\tprops1.children = children;\n\t} else if (children.length === 1) {\n\t\tprops1.children = children[0];\n\t}\n\n\treturn new Element(tag, props1, key, ref, static_);\n}\n\n/** Clones a given element, shallowly copying the props object. */\nexport function cloneElement<TTag extends Tag>(\n\tel: Element<TTag>,\n): Element<TTag> {\n\tif (!isElement(el)) {\n\t\tthrow new TypeError(\"Cannot clone non-element\");\n\t}\n\n\treturn new Element(el.tag, {...el.props}, el.key, el.ref);\n}\n\n/*** ELEMENT UTILITIES ***/\n\n// WHAT ARE WE DOING TO THE CHILDREN???\n/**\n * All values in the element tree are narrowed from the union in Child to\n * NarrowedChild during rendering, to simplify element diffing.\n */\ntype NarrowedChild = Element | string | undefined;\n\nfunction narrow(value: Children): NarrowedChild {\n\tif (typeof value === \"boolean\" || value == null) {\n\t\treturn undefined;\n\t} else if (typeof value === \"string\" || isElement(value)) {\n\t\treturn value;\n\t} else if (typeof (value as any)[Symbol.iterator] === \"function\") {\n\t\treturn createElement(Fragment, null, value);\n\t}\n\n\treturn value.toString();\n}\n\n/**\n * A helper type which repesents all possible rendered values of an element.\n *\n * @template TNode - The node type for the element provided by the renderer.\n *\n * When asking the question, what is the “value” of a specific element, the\n * answer varies depending on the tag:\n *\n * For host elements, the value is the nodes created for the element.\n *\n * For fragments, the value is usually an array of nodes.\n *\n * For portals, the value is undefined, because a Portal element’s root and\n * children are opaque to its parent.\n *\n * For components, the value can be any of the above, because the value of a\n * component is determined by its immediate children.\n *\n * Rendered values can also be strings or arrays of nodes and strings, in the\n * case of component or fragment elements with strings or multiple children.\n *\n * All of these possible values are reflected in this utility type.\n */\nexport type ElementValue<TNode> =\n\t| Array<TNode | string>\n\t| TNode\n\t| string\n\t| undefined;\n\n/**\n * Takes an array of element values and normalizes the output as an array of\n * nodes and strings.\n *\n * @returns Normalized array of nodes and/or strings.\n *\n * Normalize will flatten only one level of nested arrays, because it is\n * designed to be called once at each level of the tree. It will also\n * concatenate adjacent strings and remove all undefined values.\n */\nfunction normalize<TNode>(\n\tvalues: Array<ElementValue<TNode>>,\n): Array<TNode | string> {\n\tconst result: Array<TNode | string> = [];\n\tlet buffer: string | undefined;\n\tfor (let i = 0; i < values.length; i++) {\n\t\tconst value = values[i];\n\t\tif (!value) {\n\t\t\t// pass\n\t\t} else if (typeof value === \"string\") {\n\t\t\tbuffer = (buffer || \"\") + value;\n\t\t} else if (!Array.isArray(value)) {\n\t\t\tif (buffer) {\n\t\t\t\tresult.push(buffer);\n\t\t\t\tbuffer = undefined;\n\t\t\t}\n\n\t\t\tresult.push(value);\n\t\t} else {\n\t\t\t// We could use recursion here but it’s just easier to do it inline.\n\t\t\tfor (let j = 0; j < value.length; j++) {\n\t\t\t\tconst value1 = value[j];\n\t\t\t\tif (!value1) {\n\t\t\t\t\t// pass\n\t\t\t\t} else if (typeof value1 === \"string\") {\n\t\t\t\t\tbuffer = (buffer || \"\") + value1;\n\t\t\t\t} else {\n\t\t\t\t\tif (buffer) {\n\t\t\t\t\t\tresult.push(buffer);\n\t\t\t\t\t\tbuffer = undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tresult.push(value1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (buffer) {\n\t\tresult.push(buffer);\n\t}\n\n\treturn result;\n}\n\n/**\n * @internal\n * The internal nodes which are cached and diffed against new elements when\n * rendering element trees.\n */\nclass Retainer<TNode> {\n\t/**\n\t * The element associated with this retainer.\n\t */\n\tdeclare el: Element;\n\t/**\n\t * The context associated with this element. Will only be defined for\n\t * component elements.\n\t */\n\tdeclare ctx: ContextImpl<TNode> | undefined;\n\t/**\n\t * The retainer children of this element. Retainers form a tree which mirrors\n\t * elements. Can be a single child or undefined as a memory optimization.\n\t */\n\tdeclare children: Array<RetainerChild<TNode>> | RetainerChild<TNode>;\n\t/**\n\t * The value associated with this element.\n\t */\n\tdeclare value: ElementValue<TNode>;\n\t/**\n\t * The cached child values of this element. Only host and component elements\n\t * will use this property.\n\t */\n\tdeclare cachedChildValues: ElementValue<TNode>;\n\t/**\n\t * The child which this retainer replaces. This property is used when an\n\t * async retainer tree replaces previously rendered elements, so that the\n\t * previously rendered elements can remain visible until the async tree\n\t * fulfills. Will be set to undefined once this subtree fully renders.\n\t */\n\tdeclare fallbackValue: RetainerChild<TNode>;\n\n\tdeclare inflightValue: Promise<ElementValue<TNode>> | undefined;\n\tdeclare onNextValues: Function | undefined;\n\tconstructor(el: Element) {\n\t\tthis.el = el;\n\t\tthis.ctx = undefined;\n\t\tthis.children = undefined;\n\t\tthis.value = undefined;\n\t\tthis.cachedChildValues = undefined;\n\t\tthis.fallbackValue = undefined;\n\t\tthis.inflightValue = undefined;\n\t\tthis.onNextValues = undefined;\n\t}\n}\n\n/**\n * The retainer equivalent of ElementValue\n */\ntype RetainerChild<TNode> = Retainer<TNode> | string | undefined;\n\n/**\n * Finds the value of the element according to its type.\n *\n * @returns The value of the element.\n */\nfunction getValue<TNode>(ret: Retainer<TNode>): ElementValue<TNode> {\n\tif (typeof ret.fallbackValue !== \"undefined\") {\n\t\treturn typeof ret.fallbackValue === \"object\"\n\t\t\t? getValue(ret.fallbackValue)\n\t\t\t: ret.fallbackValue;\n\t} else if (ret.el.tag === Portal) {\n\t\treturn;\n\t} else if (typeof ret.el.tag !== \"function\" && ret.el.tag !== Fragment) {\n\t\treturn ret.value;\n\t}\n\n\treturn unwrap(getChildValues(ret));\n}\n\n/**\n * Walks an element’s children to find its child values.\n *\n * @returns A normalized array of nodes and strings.\n */\nfunction getChildValues<TNode>(ret: Retainer<TNode>): Array<TNode | string> {\n\tif (ret.cachedChildValues) {\n\t\treturn wrap(ret.cachedChildValues);\n\t}\n\n\tconst values: Array<ElementValue<TNode>> = [];\n\tconst children = wrap(ret.children);\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (child) {\n\t\t\tvalues.push(typeof child === \"string\" ? child : getValue(child));\n\t\t}\n\t}\n\n\tconst values1 = normalize(values);\n\tconst tag = ret.el.tag;\n\tif (typeof tag === \"function\" || (tag !== Fragment && tag !== Raw)) {\n\t\tret.cachedChildValues = unwrap(values1);\n\t}\n\treturn values1;\n}\n\nexport interface HydrationData<TNode> {\n\tprops: Record<string, unknown>;\n\tchildren: Array<TNode | string>;\n}\n\n// TODO: Document the interface and methods\nexport interface RendererImpl<\n\tTNode,\n\tTScope,\n\tTRoot extends TNode = TNode,\n\tTResult = ElementValue<TNode>,\n> {\n\tscope<TTag extends string | symbol>(\n\t\tscope: TScope | undefined,\n\t\ttag: TTag,\n\t\tprops: TagProps<TTag>,\n\t): TScope | undefined;\n\n\tcreate<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tprops: TagProps<TTag>,\n\t\tscope: TScope | undefined,\n\t): TNode;\n\n\thydrate<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tnode: TNode | TRoot,\n\t\tprops: TagProps<TTag>,\n\t): HydrationData<TNode> | undefined;\n\n\t/**\n\t * Called when an element’s rendered value is exposed via render, schedule,\n\t * refresh, refs, or generator yield expressions.\n\t *\n\t * @param value - The value of the element being read. Can be a node, a\n\t * string, undefined, or an array of nodes and strings, depending on the\n\t * element.\n\t *\n\t * @returns Varies according to the specific renderer subclass. By default,\n\t * it exposes the element’s value.\n\t *\n\t * This is useful for renderers which don’t want to expose their internal\n\t * nodes. For instance, the HTML renderer will convert all internal nodes to\n\t * strings.\n\t */\n\tread(value: ElementValue<TNode>): TResult;\n\n\t/**\n\t * Called for each string in an element tree.\n\t *\n\t * @param text - The string child.\n\t * @param scope - The current scope.\n\t *\n\t * @returns A string to be passed to arrange.\n\t *\n\t * Rather than returning Text nodes as we would in the DOM case, for example,\n\t * we delay that step for Renderer.prototype.arrange. We do this so that\n\t * adjacent strings can be concatenated, and the actual element tree can be\n\t * rendered in normalized form.\n\t */\n\ttext(\n\t\ttext: string,\n\t\tscope: TScope | undefined,\n\t\thydration: HydrationData<TNode> | undefined,\n\t): string;\n\n\t/**\n\t * Called for each Raw element whose value prop is a string.\n\t *\n\t * @param text - The string child.\n\t * @param scope - The current scope.\n\t *\n\t * @returns The parsed node or string.\n\t */\n\traw(\n\t\tvalue: string | TNode,\n\t\tscope: TScope | undefined,\n\t\thydration: HydrationData<TNode> | undefined,\n\t): ElementValue<TNode>;\n\n\tpatch<TTag extends string | symbol, TName extends string>(\n\t\ttag: TTag,\n\t\tnode: TNode,\n\t\tname: TName,\n\t\tvalue: TagProps<TTag>[TName],\n\t\toldValue: TagProps<TTag>[TName] | undefined,\n\t\tscope: TScope,\n\t): unknown;\n\n\tarrange<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tnode: TNode,\n\t\tprops: TagProps<TTag>,\n\t\tchildren: Array<TNode | string>,\n\t\toldProps: TagProps<TTag> | undefined,\n\t\toldChildren: Array<TNode | string> | undefined,\n\t): unknown;\n\n\tdispose<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tnode: TNode,\n\t\tprops: TagProps<TTag>,\n\t): unknown;\n\n\tflush(root: TRoot): unknown;\n}\n\nconst defaultRendererImpl: RendererImpl<unknown, unknown, unknown, unknown> = {\n\tcreate() {\n\t\tthrow new Error(\"Not implemented\");\n\t},\n\thydrate() {\n\t\tthrow new Error(\"Not implemented\");\n\t},\n\tscope: IDENTITY,\n\tread: IDENTITY,\n\ttext: IDENTITY,\n\traw: IDENTITY,\n\tpatch: NOOP,\n\tarrange: NOOP,\n\tdispose: NOOP,\n\tflush: NOOP,\n};\n\nconst _RendererImpl = Symbol.for(\"crank.RendererImpl\");\n/**\n * An abstract class which is subclassed to render to different target\n * environments. This class is responsible for kicking off the rendering\n * process and caching previous trees by root.\n *\n * @template TNode - The type of the node for a rendering environment.\n * @template TScope - Data which is passed down the tree.\n * @template TRoot - The type of the root for a rendering environment.\n * @template TResult - The type of exposed values.\n */\nexport class Renderer<\n\tTNode extends object = object,\n\tTScope = unknown,\n\tTRoot extends TNode = TNode,\n\tTResult = ElementValue<TNode>,\n> {\n\t/**\n\t * @internal\n\t * A weakmap which stores element trees by root.\n\t */\n\tdeclare cache: WeakMap<object, Retainer<TNode>>;\n\n\tdeclare [_RendererImpl]: RendererImpl<TNode, TScope, TRoot, TResult>;\n\tconstructor(impl: Partial<RendererImpl<TNode, TScope, TRoot, TResult>>) {\n\t\tthis.cache = new WeakMap();\n\t\tthis[_RendererImpl] = {\n\t\t\t...(defaultRendererImpl as RendererImpl<TNode, TScope, TRoot, TResult>),\n\t\t\t...impl,\n\t\t};\n\t}\n\n\t/**\n\t * Renders an element tree into a specific root.\n\t *\n\t * @param children - An element tree. You can render null with a previously\n\t * used root to delete the previously rendered element tree from the cache.\n\t * @param root - The node to be rendered into. The renderer will cache\n\t * element trees per root.\n\t * @param bridge - An optional context that will be the ancestor context of all\n\t * elements in the tree. Useful for connecting different renderers so that\n\t * events/provisions properly propagate. The context for a given root must be\n\t * the same or an error will be thrown.\n\t *\n\t * @returns The result of rendering the children, or a possible promise of\n\t * the result if the element tree renders asynchronously.\n\t */\n\trender(\n\t\tchildren: Children,\n\t\troot?: TRoot | undefined,\n\t\tbridge?: Context | undefined,\n\t): Promise<TResult> | TResult {\n\t\tlet ret: Retainer<TNode> | undefined;\n\t\tconst ctx = bridge && (bridge[_ContextImpl] as ContextImpl<TNode>);\n\t\tif (typeof root === \"object\" && root !== null) {\n\t\t\tret = this.cache.get(root);\n\t\t}\n\n\t\tlet oldProps: Record<string, any> | undefined;\n\t\tif (ret === undefined) {\n\t\t\tret = new Retainer(createElement(Portal, {children, root}));\n\t\t\tret.value = root;\n\t\t\tret.ctx = ctx;\n\t\t\tif (typeof root === \"object\" && root !== null && children != null) {\n\t\t\t\tthis.cache.set(root, ret);\n\t\t\t}\n\t\t} else if (ret.ctx !== ctx) {\n\t\t\tthrow new Error(\"Context mismatch\");\n\t\t} else {\n\t\t\toldProps = ret.el.props;\n\t\t\tret.el = createElement(Portal, {children, root});\n\t\t\tif (typeof root === \"object\" && root !== null && children == null) {\n\t\t\t\tthis.cache.delete(root);\n\t\t\t}\n\t\t}\n\n\t\tconst impl = this[_RendererImpl];\n\t\tconst childValues = diffChildren(\n\t\t\timpl,\n\t\t\troot,\n\t\t\tret,\n\t\t\tctx,\n\t\t\timpl.scope(undefined, Portal, ret.el.props),\n\t\t\tret,\n\t\t\tchildren,\n\t\t\tundefined, // hydration data\n\t\t);\n\n\t\t// We return the child values of the portal because portal elements\n\t\t// themselves have no readable value.\n\t\tif (isPromiseLike(childValues)) {\n\t\t\treturn childValues.then((childValues) =>\n\t\t\t\tcommitRootRender(impl, root, ctx, ret!, childValues, oldProps),\n\t\t\t);\n\t\t}\n\n\t\treturn commitRootRender(impl, root, ctx, ret, childValues, oldProps);\n\t}\n\n\thydrate(\n\t\tchildren: Children,\n\t\troot: TRoot,\n\t\tbridge?: Context | undefined,\n\t): Promise<TResult> | TResult {\n\t\tconst impl = this[_RendererImpl];\n\t\tconst ctx = bridge && (bridge[_ContextImpl] as ContextImpl<TNode>);\n\t\tlet ret: Retainer<TNode> | undefined;\n\t\tret = this.cache.get(root);\n\t\tif (ret !== undefined) {\n\t\t\t// If there is a retainer for the root, hydration is not necessary.\n\t\t\treturn this.render(children, root, bridge);\n\t\t}\n\n\t\tlet oldProps: Record<string, any> | undefined;\n\t\tret = new Retainer(createElement(Portal, {children, root}));\n\t\tret.value = root;\n\t\tif (typeof root === \"object\" && root !== null && children != null) {\n\t\t\tthis.cache.set(root, ret);\n\t\t}\n\n\t\tconst hydrationData = impl.hydrate(Portal, root, {});\n\t\tconst childValues = diffChildren(\n\t\t\timpl,\n\t\t\troot,\n\t\t\tret,\n\t\t\tctx,\n\t\t\timpl.scope(undefined, Portal, ret.el.props),\n\t\t\tret,\n\t\t\tchildren,\n\t\t\thydrationData,\n\t\t);\n\n\t\t// We return the child values of the portal because portal elements\n\t\t// themselves have no readable value.\n\t\tif (isPromiseLike(childValues)) {\n\t\t\treturn childValues.then((childValues) =>\n\t\t\t\tcommitRootRender(impl, root, ctx, ret!, childValues, oldProps),\n\t\t\t);\n\t\t}\n\n\t\treturn commitRootRender(impl, root, ctx, ret, childValues, oldProps);\n\t}\n}\n\n/*** PRIVATE RENDERER FUNCTIONS ***/\nfunction commitRootRender<TNode, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, unknown, TRoot, TResult>,\n\troot: TRoot | undefined,\n\tctx: ContextImpl<TNode> | undefined,\n\tret: Retainer<TNode>,\n\tchildValues: Array<TNode | string>,\n\toldProps: Record<string, any> | undefined,\n): TResult {\n\t// element is a host or portal element\n\tif (root != null) {\n\t\trenderer.arrange(\n\t\t\tPortal,\n\t\t\troot,\n\t\t\tret.el.props,\n\t\t\tchildValues,\n\t\t\toldProps,\n\t\t\twrap(ret.cachedChildValues),\n\t\t);\n\t\tflush(renderer, root);\n\t}\n\n\tret.cachedChildValues = unwrap(childValues);\n\tif (root == null) {\n\t\tunmount(renderer, ret, ctx, ret);\n\t}\n\n\treturn renderer.read(ret.cachedChildValues);\n}\n\nfunction diffChildren<TNode, TScope, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\troot: TRoot | undefined,\n\thost: Retainer<TNode>,\n\tctx: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\tscope: TScope | undefined,\n\tparent: Retainer<TNode>,\n\tchildren: Children,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<Array<TNode | string>> | Array<TNode | string> {\n\tconst oldRetained = wrap(parent.children);\n\tconst newRetained: typeof oldRetained = [];\n\tconst newChildren = arrayify(children);\n\tconst values: Array<Promise<ElementValue<TNode>> | ElementValue<TNode>> = [];\n\tlet graveyard: Array<Retainer<TNode>> | undefined;\n\tlet childrenByKey: Map<Key, Retainer<TNode>> | undefined;\n\tlet seenKeys: Set<Key> | undefined;\n\tlet isAsync = false;\n\tlet hydrationBlock: Promise<unknown> | undefined;\n\tlet oi = 0;\n\tlet oldLength = oldRetained.length;\n\tfor (let ni = 0, newLength = newChildren.length; ni < newLength; ni++) {\n\t\t// length checks to prevent index out of bounds deoptimizations.\n\t\tlet ret = oi >= oldLength ? undefined : oldRetained[oi];\n\t\tlet child = narrow(newChildren[ni]);\n\t\t{\n\t\t\t// aligning new children with old retainers\n\t\t\tlet oldKey = typeof ret === \"object\" ? ret.el.key : undefined;\n\t\t\tlet newKey = typeof child === \"object\" ? child.key : undefined;\n\t\t\tif (newKey !== undefined && seenKeys && seenKeys.has(newKey)) {\n\t\t\t\tconsole.error(\"Duplicate key\", newKey);\n\t\t\t\tnewKey = undefined;\n\t\t\t}\n\n\t\t\tif (oldKey === newKey) {\n\t\t\t\tif (childrenByKey !== undefined && newKey !== undefined) {\n\t\t\t\t\tchildrenByKey.delete(newKey);\n\t\t\t\t}\n\n\t\t\t\toi++;\n\t\t\t} else {\n\t\t\t\tchildrenByKey = childrenByKey || createChildrenByKey(oldRetained, oi);\n\t\t\t\tif (newKey === undefined) {\n\t\t\t\t\twhile (ret !== undefined && oldKey !== undefined) {\n\t\t\t\t\t\toi++;\n\t\t\t\t\t\tret = oldRetained[oi];\n\t\t\t\t\t\toldKey = typeof ret === \"object\" ? ret.el.key : undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\toi++;\n\t\t\t\t} else {\n\t\t\t\t\tret = childrenByKey.get(newKey);\n\t\t\t\t\tif (ret !== undefined) {\n\t\t\t\t\t\tchildrenByKey.delete(newKey);\n\t\t\t\t\t}\n\n\t\t\t\t\t(seenKeys = seenKeys || new Set()).add(newKey);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Updating\n\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\tif (typeof child === \"object\") {\n\t\t\tif (child.tag === Copy) {\n\t\t\t\tvalue = getInflightValue(ret);\n\t\t\t} else {\n\t\t\t\tlet oldProps: Record<string, any> | undefined;\n\t\t\t\tlet static_ = false;\n\t\t\t\tif (typeof ret === \"object\" && ret.el.tag === child.tag) {\n\t\t\t\t\toldProps = ret.el.props;\n\t\t\t\t\tret.el = child;\n\t\t\t\t\tif (child.static_) {\n\t\t\t\t\t\tvalue = getInflightValue(ret);\n\t\t\t\t\t\tstatic_ = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof ret === \"object\") {\n\t\t\t\t\t\t(graveyard = graveyard || []).push(ret);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst fallback = ret;\n\t\t\t\t\tret = new Retainer<TNode>(child);\n\t\t\t\t\tret.fallbackValue = fallback;\n\t\t\t\t}\n\n\t\t\t\tif (static_) {\n\t\t\t\t\t// pass\n\t\t\t\t} else if (child.tag === Raw) {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateRaw(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: updateRaw(renderer, ret, scope, oldProps, hydrationData);\n\t\t\t\t} else if (child.tag === Fragment) {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateFragment(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: updateFragment(\n\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t );\n\t\t\t\t} else if (typeof child.tag === \"function\") {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateComponent(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: updateComponent(\n\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateHost(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: updateHost(\n\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst ref = child.ref;\n\t\t\tif (isPromiseLike(value)) {\n\t\t\t\tisAsync = true;\n\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\tvalue = value.then((value) => {\n\t\t\t\t\t\tref(renderer.read(value));\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (hydrationData !== undefined) {\n\t\t\t\t\thydrationBlock = value;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\tref(renderer.read(value));\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// child is a string or undefined\n\t\t\tif (typeof ret === \"object\") {\n\t\t\t\t(graveyard = graveyard || []).push(ret);\n\t\t\t}\n\n\t\t\tif (typeof child === \"string\") {\n\t\t\t\tvalue = ret = renderer.text(child, scope, hydrationData);\n\t\t\t} else {\n\t\t\t\tret = undefined;\n\t\t\t}\n\t\t}\n\n\t\tvalues[ni] = value;\n\t\tnewRetained[ni] = ret;\n\t}\n\n\t// cleanup remaining retainers\n\tfor (; oi < oldLength; oi++) {\n\t\tconst ret = oldRetained[oi];\n\t\tif (typeof ret === \"object\") {\n\t\t\t(graveyard = graveyard || []).push(ret);\n\t\t}\n\t}\n\n\tif (childrenByKey !== undefined && childrenByKey.size > 0) {\n\t\t(graveyard = graveyard || []).push(...childrenByKey.values());\n\t}\n\n\tparent.children = unwrap(newRetained);\n\tif (isAsync) {\n\t\tlet childValues1 = Promise.all(values).finally(() => {\n\t\t\tif (graveyard) {\n\t\t\t\tfor (let i = 0; i < graveyard.length; i++) {\n\t\t\t\t\tunmount(renderer, host, ctx, graveyard[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tlet onChildValues!: Function;\n\t\tchildValues1 = Promise.race([\n\t\t\tchildValues1,\n\t\t\tnew Promise<any>((resolve) => (onChildValues = resolve)),\n\t\t]);\n\n\t\tif (parent.onNextValues) {\n\t\t\tparent.onNextValues(childValues1);\n\t\t}\n\n\t\tparent.onNextValues = onChildValues;\n\t\treturn childValues1.then((childValues) => {\n\t\t\tparent.inflightValue = parent.fallbackValue = undefined;\n\t\t\treturn normalize(childValues);\n\t\t});\n\t} else {\n\t\tif (graveyard) {\n\t\t\tfor (let i = 0; i < graveyard.length; i++) {\n\t\t\t\tunmount(renderer, host, ctx, graveyard[i]);\n\t\t\t}\n\t\t}\n\n\t\tif (parent.onNextValues) {\n\t\t\tparent.onNextValues(values);\n\t\t\tparent.onNextValues = undefined;\n\t\t}\n\n\t\tparent.inflightValue = parent.fallbackValue = undefined;\n\t\t// We can assert there are no promises in the array because isAsync is false\n\t\treturn normalize(values as Array<ElementValue<TNode>>);\n\t}\n}\n\nfunction createChildrenByKey<TNode>(\n\tchildren: Array<RetainerChild<TNode>>,\n\toffset: number,\n): Map<Key, Retainer<TNode>> {\n\tconst childrenByKey = new Map<Key, Retainer<TNode>>();\n\tfor (let i = offset; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (typeof child === \"object\" && typeof child.el.key !== \"undefined\") {\n\t\t\tchildrenByKey.set(child.el.key, child);\n\t\t}\n\t}\n\n\treturn childrenByKey;\n}\n\nfunction getInflightValue<TNode>(\n\tchild: RetainerChild<TNode>,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (typeof child !== \"object\") {\n\t\treturn child;\n\t}\n\n\tconst ctx: ContextImpl<TNode> | undefined =\n\t\ttypeof child.el.tag === \"function\" ? child.ctx : undefined;\n\tif (ctx && ctx.f & IsUpdating && ctx.inflightValue) {\n\t\treturn ctx.inflightValue;\n\t} else if (child.inflightValue) {\n\t\treturn child.inflightValue;\n\t}\n\n\treturn getValue(child);\n}\n\nfunction updateRaw<TNode, TScope>(\n\trenderer: RendererImpl<TNode, TScope, TNode, unknown>,\n\tret: Retainer<TNode>,\n\tscope: TScope | undefined,\n\toldProps: Record<string, any> | undefined,\n\thydrationData: HydrationData<TNode> | undefined,\n): ElementValue<TNode> {\n\tconst props = ret.el.props;\n\tif (!oldProps || oldProps.value !== props.value) {\n\t\tret.value = renderer.raw(props.value, scope, hydrationData);\n\t}\n\n\treturn ret.value;\n}\n\nfunction updateFragment<TNode, TScope, TRoot extends TNode>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, unknown>,\n\troot: TRoot | undefined,\n\thost: Retainer<TNode>,\n\tctx: ContextImpl<TNode, TScope, TRoot> | undefined,\n\tscope: TScope | undefined,\n\tret: Retainer<TNode>,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tconst childValues = diffChildren(\n\t\trenderer,\n\t\troot,\n\t\thost,\n\t\tctx,\n\t\tscope,\n\t\tret,\n\t\tret.el.props.children,\n\t\thydrationData,\n\t);\n\n\tif (isPromiseLike(childValues)) {\n\t\tret.inflightValue = childValues.then((childValues) => unwrap(childValues));\n\t\treturn ret.inflightValue;\n\t}\n\n\treturn unwrap(childValues);\n}\n\nfunction updateHost<TNode, TScope, TRoot extends TNode>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, unknown>,\n\troot: TRoot | undefined,\n\tctx: ContextImpl<TNode, TScope, TRoot> | undefined,\n\tscope: TScope | undefined,\n\tret: Retainer<TNode>,\n\toldProps: Record<string, any> | undefined,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tconst el = ret.el;\n\tconst tag = el.tag as string | symbol;\n\tlet hydrationValue: TNode | string | undefined;\n\tif (el.tag === Portal) {\n\t\troot = ret.value = el.props.root;\n\t} else {\n\t\tif (hydrationData !== undefined) {\n\t\t\tconst value = hydrationData.children.shift();\n\t\t\thydrationValue = value;\n\t\t}\n\t}\n\n\tscope = renderer.scope(scope, tag, el.props);\n\tlet childHydrationData: HydrationData<TNode> | undefined;\n\tif (hydrationValue != null && typeof hydrationValue !== \"string\") {\n\t\tchildHydrationData = renderer.hydrate(tag, hydrationValue, el.props);\n\n\t\tif (childHydrationData === undefined) {\n\t\t\thydrationValue = undefined;\n\t\t}\n\t}\n\tconst childValues = diffChildren(\n\t\trenderer,\n\t\troot,\n\t\tret,\n\t\tctx,\n\t\tscope,\n\t\tret,\n\t\tret.el.props.children,\n\t\tchildHydrationData,\n\t);\n\n\tif (isPromiseLike(childValues)) {\n\t\tret.inflightValue = childValues.then((childValues) =>\n\t\t\tcommitHost(renderer, scope, ret, childValues, oldProps, hydrationValue),\n\t\t);\n\n\t\treturn ret.inflightValue;\n\t}\n\n\treturn commitHost(\n\t\trenderer,\n\t\tscope,\n\t\tret,\n\t\tchildValues,\n\t\toldProps,\n\t\thydrationValue,\n\t);\n}\n\nfunction commitHost<TNode, TScope>(\n\trenderer: RendererImpl<TNode, TScope, TNode, unknown>,\n\tscope: TScope,\n\tret: Retainer<TNode>,\n\tchildValues: Array<TNode | string>,\n\toldProps: Record<string, any> | undefined,\n\thydrationValue: TNode | undefined,\n): ElementValue<TNode> {\n\tconst tag = ret.el.tag as string | symbol;\n\tlet value = ret.value as TNode;\n\tif (hydrationValue != null) {\n\t\tvalue = ret.value = hydrationValue;\n\t}\n\n\tlet props = ret.el.props;\n\tlet copied: Set<string> | undefined;\n\tif (tag !== Portal) {\n\t\tif (value == null) {\n\t\t\t// This assumes that renderer.create does not return nullish values.\n\t\t\tvalue = ret.value = renderer.create(tag, props, scope);\n\t\t}\n\n\t\tfor (const propName in {...oldProps, ...props}) {\n\t\t\tconst propValue = props[propName];\n\t\t\tif (propValue === Copy) {\n\t\t\t\t// TODO: The Copy tag doubles as a way to skip the patching of a prop.\n\t\t\t\t// Not sure about this feature. Should probably be removed.\n\t\t\t\t(copied = copied || new Set()).add(propName);\n\t\t\t} else if (propName !== \"children\") {\n\t\t\t\trenderer.patch(\n\t\t\t\t\ttag,\n\t\t\t\t\tvalue,\n\t\t\t\t\tpropName,\n\t\t\t\t\tpropValue,\n\t\t\t\t\toldProps && oldProps[propName],\n\t\t\t\t\tscope,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (copied) {\n\t\tprops = {...ret.el.props};\n\t\tfor (const name of copied) {\n\t\t\tprops[name] = oldProps && oldProps[name];\n\t\t}\n\n\t\tret.el = new Element(tag, props, ret.el.key, ret.el.ref);\n\t}\n\n\trenderer.arrange(\n\t\ttag,\n\t\tvalue,\n\t\tprops,\n\t\tchildValues,\n\t\toldProps,\n\t\twrap(ret.cachedChildValues),\n\t);\n\tret.cachedChildValues = unwrap(childValues);\n\tif (tag === Portal) {\n\t\tflush(renderer, ret.value);\n\t\treturn;\n\t}\n\n\treturn value;\n}\n\nfunction flush<TRoot>(\n\trenderer: RendererImpl<unknown, unknown, TRoot>,\n\troot: TRoot,\n\tinitiator?: ContextImpl,\n) {\n\trenderer.flush(root);\n\tif (typeof root !== \"object\" || root === null) {\n\t\treturn;\n\t}\n\n\tconst flushMap = flushMaps.get(root as any);\n\tif (flushMap) {\n\t\tif (initiator) {\n\t\t\tconst flushMap1 = new Map<ContextImpl, Set<Function>>();\n\t\t\tfor (let [ctx, callbacks] of flushMap) {\n\t\t\t\tif (!ctxContains(initiator, ctx)) {\n\t\t\t\t\tflushMap.delete(ctx);\n\t\t\t\t\tflushMap1.set(ctx, callbacks);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (flushMap1.size) {\n\t\t\t\tflushMaps.set(root as any, flushMap1);\n\t\t\t} else {\n\t\t\t\tflushMaps.delete(root as any);\n\t\t\t}\n\t\t} else {\n\t\t\tflushMaps.delete(root as any);\n\t\t}\n\n\t\tfor (const [ctx, callbacks] of flushMap) {\n\t\t\tconst value = renderer.read(getValue(ctx.ret));\n\t\t\tfor (const callback of callbacks) {\n\t\t\t\tcallback(value);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction unmount<TNode, TScope, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\thost: Retainer<TNode>,\n\tctx: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\tret: Retainer<TNode>,\n): void {\n\tif (typeof ret.el.tag === \"function\") {\n\t\tctx = ret.ctx as ContextImpl<TNode, TScope, TRoot, TResult>;\n\t\tunmountComponent(ctx);\n\t} else if (ret.el.tag === Portal) {\n\t\thost = ret;\n\t\trenderer.arrange(\n\t\t\tPortal,\n\t\t\thost.value as TNode,\n\t\t\thost.el.props,\n\t\t\t[],\n\t\t\thost.el.props,\n\t\t\twrap(host.cachedChildValues),\n\t\t);\n\t\tflush(renderer, host.value);\n\t} else if (ret.el.tag !== Fragment) {\n\t\tif (isEventTarget(ret.value)) {\n\t\t\tconst records = getListenerRecords(ctx, host);\n\t\t\tfor (let i = 0; i < records.length; i++) {\n\t\t\t\tconst record = records[i];\n\t\t\t\tret.value.removeEventListener(\n\t\t\t\t\trecord.type,\n\t\t\t\t\trecord.callback,\n\t\t\t\t\trecord.options,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\trenderer.dispose(ret.el.tag, ret.value as TNode, ret.el.props);\n\t\thost = ret;\n\t}\n\n\tconst children = wrap(ret.children);\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (typeof child === \"object\") {\n\t\t\tunmount(renderer, host, ctx, child);\n\t\t}\n\t}\n}\n\n/*** CONTEXT FLAGS ***/\n/**\n * A flag which is true when the component is initialized or updated by an\n * ancestor component or the root render call.\n *\n * Used to determine things like whether the nearest host ancestor needs to be\n * rearranged.\n */\nconst IsUpdating = 1 << 0;\n\n/**\n * A flag which is true when the component is synchronously executing.\n *\n * Used to guard against components triggering stack overflow or generator error.\n */\nconst IsSyncExecuting = 1 << 1;\n\n/**\n * A flag which is true when the component is in a for...of loop.\n */\nconst IsInForOfLoop = 1 << 2;\n\n/**\n * A flag which is true when the component is in a for await...of loop.\n */\nconst IsInForAwaitOfLoop = 1 << 3;\n\n/**\n * A flag which is true when the component starts the render loop but has not\n * yielded yet.\n *\n * Used to make sure that components yield at least once per loop.\n */\nconst NeedsToYield = 1 << 4;\n\n/**\n * A flag used by async generator components in conjunction with the\n * onAvailable callback to mark whether new props can be pulled via the context\n * async iterator. See the Symbol.asyncIterator method and the\n * resumeCtxIterator function.\n */\nconst PropsAvailable = 1 << 5;\n\n/**\n * A flag which is set when a component errors.\n *\n * NOTE: This is mainly used to prevent some false positives in component\n * yields or returns undefined warnings. The reason we’re using this versus\n * IsUnmounted is a very troubling test (cascades sync generator parent and\n * sync generator child) where synchronous code causes a stack overflow error\n * in a non-deterministic way. Deeply disturbing stuff.\n */\nconst IsErrored = 1 << 6;\n\n/**\n * A flag which is set when the component is unmounted. Unmounted components\n * are no longer in the element tree and cannot refresh or rerender.\n */\nconst IsUnmounted = 1 << 7;\n\n/**\n * A flag which indicates that the component is a sync generator component.\n */\nconst IsSyncGen = 1 << 8;\n\n/**\n * A flag which indicates that the component is an async generator component.\n */\nconst IsAsyncGen = 1 << 9;\n\n/**\n * A flag which is set while schedule callbacks are called.\n */\nconst IsScheduling = 1 << 10;\n\n/**\n * A flag which is set when a schedule callback calls refresh.\n */\nconst IsSchedulingRefresh = 1 << 11;\n\nexport interface Context extends Crank.Context {}\n\n/**\n * An interface which can be extended to provide strongly typed provisions.\n * See Context.prototype.consume and Context.prototype.provide.\n */\nexport interface ProvisionMap extends Crank.ProvisionMap {}\n\nconst provisionMaps = new WeakMap<ContextImpl, Map<unknown, unknown>>();\n\nconst scheduleMap = new WeakMap<ContextImpl, Set<Function>>();\n\nconst cleanupMap = new WeakMap<ContextImpl, Set<Function>>();\n\n// keys are roots\nconst flushMaps = new WeakMap<object, Map<ContextImpl, Set<Function>>>();\n\n/**\n * @internal\n * The internal class which holds context data.\n */\nclass ContextImpl<\n\tTNode = unknown,\n\tTScope = unknown,\n\tTRoot extends TNode = TNode,\n\tTResult = unknown,\n> {\n\t/** A bitmask. See CONTEXT FLAGS above. */\n\tdeclare f: number;\n\n\t/** The actual context associated with this impl. */\n\tdeclare owner: Context<unknown, TResult>;\n\n\t/**\n\t * The renderer which created this context.\n\t */\n\tdeclare renderer: RendererImpl<TNode, TScope, TRoot, TResult>;\n\n\t/** The root node as set by the nearest ancestor portal. */\n\tdeclare root: TRoot | undefined;\n\n\t/**\n\t * The nearest ancestor host or portal retainer.\n\t *\n\t * When refresh is called, the host element will be arranged as the last step\n\t * of the commit, to make sure the parent’s children properly reflects the\n\t * components’s children.\n\t */\n\tdeclare host: Retainer<TNode>;\n\n\t/** The parent context impl. */\n\tdeclare parent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined;\n\n\t/** The value of the scope at the point of element’s creation. */\n\tdeclare scope: TScope | undefined;\n\n\t/** The internal node associated with this context. */\n\tdeclare ret: Retainer<TNode>;\n\n\t/**\n\t * The iterator returned by the component function.\n\t *\n\t * Existence of this property implies that the component is a generator\n\t * component. It is deleted when a component is returned.\n\t */\n\tdeclare iterator:\n\t\t| Iterator<Children, Children | void, unknown>\n\t\t| AsyncIterator<Children, Children | void, unknown>\n\t\t| undefined;\n\n\t// The following properties are used to implement the\n\tdeclare inflightBlock: Promise<unknown> | undefined;\n\tdeclare inflightValue: Promise<ElementValue<TNode>> | undefined;\n\tdeclare enqueuedBlock: Promise<unknown> | undefined;\n\tdeclare enqueuedValue: Promise<ElementValue<TNode>> | undefined;\n\n\t// The following callbacks are used to implement the async generator render\n\t// loop behavior.\n\tdeclare onProps: ((props: Record<string, any>) => unknown) | undefined;\n\tdeclare onPropsRequested: Function | undefined;\n\tconstructor(\n\t\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\t\troot: TRoot | undefined,\n\t\thost: Retainer<TNode>,\n\t\tparent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\t\tscope: TScope | undefined,\n\t\tret: Retainer<TNode>,\n\t) {\n\t\tthis.f = 0;\n\t\tthis.owner = new Context(this);\n\t\tthis.renderer = renderer;\n\t\tthis.root = root;\n\t\tthis.host = host;\n\t\tthis.parent = parent;\n\t\tthis.scope = scope;\n\t\tthis.ret = ret;\n\n\t\tthis.iterator = undefined;\n\t\tthis.inflightBlock = undefined;\n\t\tthis.inflightValue = undefined;\n\t\tthis.enqueuedBlock = undefined;\n\t\tthis.enqueuedValue = undefined;\n\t\tthis.onProps = undefined;\n\t\tthis.onPropsRequested = undefined;\n\t}\n}\n\nconst _ContextImpl = Symbol.for(\"crank.ContextImpl\");\n\ntype ComponentProps<T> = T extends () => any\n\t? {}\n\t: T extends (props: infer U) => any\n\t? U\n\t: T;\n/**\n * A class which is instantiated and passed to every component as its this\n * value. Contexts form a tree just like elements and all components in the\n * element tree are connected via contexts. Components can use this tree to\n * communicate data upwards via events and downwards via provisions.\n *\n * @template [T=*] - The expected shape of the props passed to the component,\n * or a component function. Used to strongly type the Context iterator methods.\n * @template [TResult=*] - The readable element value type. It is used in\n * places such as the return value of refresh and the argument passed to\n * schedule and cleanup callbacks.\n */\nexport class Context<T = any, TResult = any> implements EventTarget {\n\t/**\n\t * @internal\n\t */\n\tdeclare [_ContextImpl]: ContextImpl<unknown, unknown, unknown, TResult>;\n\n\t// TODO: If we could make the constructor function take a nicer value, it\n\t// would be useful for testing purposes.\n\tconstructor(impl: ContextImpl<unknown, unknown, unknown, TResult>) {\n\t\tthis[_ContextImpl] = impl;\n\t}\n\n\t/**\n\t * The current props of the associated element.\n\t *\n\t * Typically, you should read props either via the first parameter of the\n\t * component or via the context iterator methods. This property is mainly for\n\t * plugins or utilities which wrap contexts.\n\t */\n\tget props(): ComponentProps<T> {\n\t\treturn this[_ContextImpl].ret.el.props;\n\t}\n\n\t// TODO: Should we rename this???\n\t/**\n\t * The current value of the associated element.\n\t *\n\t * Typically, you should read values via refs, generator yield expressions,\n\t * or the refresh, schedule, cleanup, or flush methods. This property is\n\t * mainly for plugins or utilities which wrap contexts.\n\t */\n\tget value(): TResult {\n\t\treturn this[_ContextImpl].renderer.read(getValue(this[_ContextImpl].ret));\n\t}\n\n\t*[Symbol.iterator](): Generator<ComponentProps<T>> {\n\t\tconst ctx = this[_ContextImpl];\n\t\ttry {\n\t\t\tctx.f |= IsInForOfLoop;\n\t\t\twhile (!(ctx.f & IsUnmounted)) {\n\t\t\t\tif (ctx.f & NeedsToYield) {\n\t\t\t\t\tthrow new Error(\"Context iterated twice without a yield\");\n\t\t\t\t} else {\n\t\t\t\t\tctx.f |= NeedsToYield;\n\t\t\t\t}\n\n\t\t\t\tyield ctx.ret.el.props!;\n\t\t\t}\n\t\t} finally {\n\t\t\tctx.f &= ~IsInForOfLoop;\n\t\t}\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncGenerator<ComponentProps<T>> {\n\t\tconst ctx = this[_ContextImpl];\n\t\tif (ctx.f & IsSyncGen) {\n\t\t\tthrow new Error(\"Use for...of in sync generator components\");\n\t\t}\n\n\t\ttry {\n\t\t\tctx.f |= IsInForAwaitOfLoop;\n\t\t\twhile (!(ctx.f & IsUnmounted)) {\n\t\t\t\tif (ctx.f & NeedsToYield) {\n\t\t\t\t\tthrow new Error(\"Context iterated twice without a yield\");\n\t\t\t\t} else {\n\t\t\t\t\tctx.f |= NeedsToYield;\n\t\t\t\t}\n\n\t\t\t\tif (ctx.f & PropsAvailable) {\n\t\t\t\t\tctx.f &= ~PropsAvailable;\n\t\t\t\t\tyield ctx.ret.el.props;\n\t\t\t\t} else {\n\t\t\t\t\tconst props = await new Promise((resolve) => (ctx.onProps = resolve));\n\t\t\t\t\tif (ctx.f & IsUnmounted) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tyield props as ComponentProps<T>;\n\t\t\t\t}\n\n\t\t\t\tif (ctx.onPropsRequested) {\n\t\t\t\t\tctx.onPropsRequested();\n\t\t\t\t\tctx.onPropsRequested = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tctx.f &= ~IsInForAwaitOfLoop;\n\t\t\tif (ctx.onPropsRequested) {\n\t\t\t\tctx.onPropsRequested();\n\t\t\t\tctx.onPropsRequested = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Re-executes a component.\n\t *\n\t * @returns The rendered value of the component or a promise thereof if the\n\t * component or its children execute asynchronously.\n\t *\n\t * The refresh method works a little differently for async generator\n\t * components, in that it will resume the Context’s props async iterator\n\t * rather than resuming execution. This is because async generator components\n\t * are perpetually resumed independent of updates, and rely on the props\n\t * async iterator to suspend.\n\t */\n\trefresh(): Promise<TResult> | TResult {\n\t\tconst ctx = this[_ContextImpl];\n\t\tif (ctx.f & IsUnmounted) {\n\t\t\tconsole.error(\"Component is unmounted\");\n\t\t\treturn ctx.renderer.read(undefined);\n\t\t} else if (ctx.f & IsSyncExecuting) {\n\t\t\tconsole.error(\"Component is already executing\");\n\t\t\treturn this.value;\n\t\t}\n\n\t\tconst value = enqueueComponentRun(ctx);\n\t\tif (isPromiseLike(value)) {\n\t\t\treturn (value as Promise<any>).then((value) => ctx.renderer.read(value));\n\t\t}\n\n\t\treturn ctx.renderer.read(value);\n\t}\n\n\t/**\n\t * Registers a callback which fires when the component commits. Will only\n\t * fire once per callback and update.\n\t */\n\tschedule(callback: (value: TResult) => unknown): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tlet callbacks = scheduleMap.get(ctx);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = new Set<Function>();\n\t\t\tscheduleMap.set(ctx, callbacks);\n\t\t}\n\n\t\tcallbacks.add(callback);\n\t}\n\n\t/**\n\t * Registers a callback which fires when the component’s children are\n\t * rendered into the root. Will only fire once per callback and render.\n\t */\n\tflush(callback: (value: TResult) => unknown): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tif (typeof ctx.root !== \"object\" || ctx.root === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet flushMap = flushMaps.get(ctx.root);\n\t\tif (!flushMap) {\n\t\t\tflushMap = new Map<ContextImpl, Set<Function>>();\n\t\t\tflushMaps.set(ctx.root, flushMap);\n\t\t}\n\n\t\tlet callbacks = flushMap.get(ctx);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = new Set<Function>();\n\t\t\tflushMap.set(ctx, callbacks);\n\t\t}\n\n\t\tcallbacks.add(callback);\n\t}\n\n\t/**\n\t * Registers a callback which fires when the component unmounts. Will only\n\t * fire once per callback.\n\t */\n\tcleanup(callback: (value: TResult) => unknown): void {\n\t\tconst ctx = this[_ContextImpl];\n\n\t\tif (ctx.f & IsUnmounted) {\n\t\t\tconst value = ctx.renderer.read(getValue(ctx.ret));\n\t\t\tcallback(value);\n\t\t\treturn;\n\t\t}\n\n\t\tlet callbacks = cleanupMap.get(ctx);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = new Set<Function>();\n\t\t\tcleanupMap.set(ctx, callbacks);\n\t\t}\n\n\t\tcallbacks.add(callback);\n\t}\n\n\tconsume<TKey extends keyof ProvisionMap>(key: TKey): ProvisionMap[TKey];\n\tconsume(key: unknown): any;\n\tconsume(key: unknown): any {\n\t\tfor (\n\t\t\tlet ctx = this[_ContextImpl].parent;\n\t\t\tctx !== undefined;\n\t\t\tctx = ctx.parent\n\t\t) {\n\t\t\tconst provisions = provisionMaps.get(ctx);\n\t\t\tif (provisions && provisions.has(key)) {\n\t\t\t\treturn provisions.get(key)!;\n\t\t\t}\n\t\t}\n\t}\n\n\tprovide<TKey extends keyof ProvisionMap>(\n\t\tkey: TKey,\n\t\tvalue: ProvisionMap[TKey],\n\t): void;\n\tprovide(key: unknown, value: any): void;\n\tprovide(key: unknown, value: any): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tlet provisions = provisionMaps.get(ctx);\n\t\tif (!provisions) {\n\t\t\tprovisions = new Map();\n\t\t\tprovisionMaps.set(ctx, provisions);\n\t\t}\n\n\t\tprovisions.set(key, value);\n\t}\n\n\taddEventListener<T extends string>(\n\t\ttype: T,\n\t\tlistener: MappedEventListenerOrEventListenerObject<T> | null,\n\t\toptions?: boolean | AddEventListenerOptions,\n\t): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tlet listeners: Array<EventListenerRecord>;\n\t\tif (!isListenerOrListenerObject(listener)) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tconst listeners1 = listenersMap.get(ctx);\n\t\t\tif (listeners1) {\n\t\t\t\tlisteners = listeners1;\n\t\t\t} else {\n\t\t\t\tlisteners = [];\n\t\t\t\tlistenersMap.set(ctx, listeners);\n\t\t\t}\n\t\t}\n\n\t\toptions = normalizeListenerOptions(options);\n\t\tlet callback: MappedEventListener<T>;\n\t\tif (typeof listener === \"object\") {\n\t\t\tcallback = () => listener.handleEvent.apply(listener, arguments as any);\n\t\t} else {\n\t\t\tcallback = listener;\n\t\t}\n\n\t\tconst record: EventListenerRecord = {type, listener, callback, options};\n\t\tif (options.once) {\n\t\t\trecord.callback = function (this: any) {\n\t\t\t\tconst i = listeners.indexOf(record);\n\t\t\t\tif (i !== -1) {\n\t\t\t\t\tlisteners.splice(i, 1);\n\t\t\t\t}\n\n\t\t\t\treturn callback.apply(this, arguments as any);\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tlisteners.some(\n\t\t\t\t(record1) =>\n\t\t\t\t\trecord.type === record1.type &&\n\t\t\t\t\trecord.listener === record1.listener &&\n\t\t\t\t\t!record.options.capture === !record1.options.capture,\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tlisteners.push(record);\n\n\t\t// TODO: is it possible to separate out the EventTarget delegation logic\n\t\tfor (const value of getChildValues(ctx.ret)) {\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tvalue.addEventListener(record.type, record.callback, record.options);\n\t\t\t}\n\t\t}\n\t}\n\n\tremoveEventListener<T extends string>(\n\t\ttype: T,\n\t\tlistener: MappedEventListenerOrEventListenerObject<T> | null,\n\t\toptions?: EventListenerOptions | boolean,\n\t): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tconst listeners = listenersMap.get(ctx);\n\t\tif (listeners == null || !isListenerOrListenerObject(listener)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst options1 = normalizeListenerOptions(options);\n\t\tconst i = listeners.findIndex(\n\t\t\t(record) =>\n\t\t\t\trecord.type === type &&\n\t\t\t\trecord.listener === listener &&\n\t\t\t\t!record.options.capture === !options1.capture,\n\t\t);\n\n\t\tif (i === -1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = listeners[i];\n\t\tlisteners.splice(i, 1);\n\n\t\t// TODO: is it possible to separate out the EventTarget delegation logic\n\t\tfor (const value of getChildValues(ctx.ret)) {\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tvalue.removeEventListener(record.type, record.callback, record.options);\n\t\t\t}\n\t\t}\n\t}\n\n\tdispatchEvent(ev: Event): boolean {\n\t\tconst ctx = this[_ContextImpl];\n\t\tconst path: Array<ContextImpl> = [];\n\t\tfor (\n\t\t\tlet parent = ctx.parent;\n\t\t\tparent !== undefined;\n\t\t\tparent = parent.parent\n\t\t) {\n\t\t\tpath.push(parent);\n\t\t}\n\n\t\t// We patch the stopImmediatePropagation method because ev.cancelBubble\n\t\t// only informs us if stopPropagation was called and there are no\n\t\t// properties which inform us if stopImmediatePropagation was called.\n\t\tlet immediateCancelBubble = false;\n\t\tconst stopImmediatePropagation = ev.stopImmediatePropagation;\n\t\tsetEventProperty(ev, \"stopImmediatePropagation\", () => {\n\t\t\timmediateCancelBubble = true;\n\t\t\treturn stopImmediatePropagation.call(ev);\n\t\t});\n\t\tsetEventProperty(ev, \"target\", ctx.owner);\n\n\t\t// The only possible errors in this block are errors thrown by callbacks,\n\t\t// and dispatchEvent will only log these errors rather than throwing\n\t\t// them. Therefore, we place all code in a try block, log errors in the\n\t\t// catch block, and use an unsafe return statement in the finally block.\n\t\t//\n\t\t// Each early return within the try block returns true because while the\n\t\t// return value is overridden in the finally block, TypeScript\n\t\t// (justifiably) does not recognize the unsafe return statement.\n\t\ttry {\n\t\t\tsetEventProperty(ev, \"eventPhase\", CAPTURING_PHASE);\n\t\t\tfor (let i = path.length - 1; i >= 0; i--) {\n\t\t\t\tconst target = path[i];\n\t\t\t\tconst listeners = listenersMap.get(target);\n\t\t\t\tif (listeners) {\n\t\t\t\t\tsetEventProperty(ev, \"currentTarget\", target.owner);\n\t\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\t\tif (record.type === ev.type && record.options.capture) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\trecord.callback.call(target.owner, ev);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (immediateCancelBubble) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (ev.cancelBubble) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t{\n\t\t\t\tsetEventProperty(ev, \"eventPhase\", AT_TARGET);\n\t\t\t\tsetEventProperty(ev, \"currentTarget\", ctx.owner);\n\t\t\t\tconst propCallback = ctx.ret.el.props[\"on\" + ev.type];\n\t\t\t\tif (propCallback != null) {\n\t\t\t\t\tpropCallback(ev);\n\t\t\t\t\tif (immediateCancelBubble || ev.cancelBubble) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst listeners = listenersMap.get(ctx);\n\t\t\t\tif (listeners) {\n\t\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\t\tif (record.type === ev.type) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\trecord.callback.call(ctx.owner, ev);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (immediateCancelBubble) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (ev.cancelBubble) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ev.bubbles) {\n\t\t\t\tsetEventProperty(ev, \"eventPhase\", BUBBLING_PHASE);\n\t\t\t\tfor (let i = 0; i < path.length; i++) {\n\t\t\t\t\tconst target = path[i];\n\t\t\t\t\tconst listeners = listenersMap.get(target);\n\t\t\t\t\tif (listeners) {\n\t\t\t\t\t\tsetEventProperty(ev, \"currentTarget\", target.owner);\n\t\t\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\t\t\tif (record.type === ev.type && !record.options.capture) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\trecord.callback.call(target.owner, ev);\n\t\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (immediateCancelBubble) {\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (ev.cancelBubble) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tsetEventProperty(ev, \"eventPhase\", NONE);\n\t\t\tsetEventProperty(ev, \"currentTarget\", null);\n\t\t\t// eslint-disable-next-line no-unsafe-finally\n\t\t\treturn !ev.defaultPrevented;\n\t\t}\n\t}\n}\n\n/*** PRIVATE CONTEXT FUNCTIONS ***/\nfunction ctxContains(parent: ContextImpl, child: ContextImpl): boolean {\n\tfor (\n\t\tlet current: ContextImpl | undefined = child;\n\t\tcurrent !== undefined;\n\t\tcurrent = current.parent\n\t) {\n\t\tif (current === parent) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction updateComponent<TNode, TScope, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\troot: TRoot | undefined,\n\thost: Retainer<TNode>,\n\tparent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\tscope: TScope | undefined,\n\tret: Retainer<TNode>,\n\toldProps: Record<string, any> | undefined,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tlet ctx: ContextImpl<TNode, TScope, TRoot, TResult>;\n\tif (oldProps) {\n\t\tctx = ret.ctx as ContextImpl<TNode, TScope, TRoot, TResult>;\n\t\tif (ctx.f & IsSyncExecuting) {\n\t\t\tconsole.error(\"Component is already executing\");\n\t\t\treturn ret.cachedChildValues;\n\t\t}\n\t} else {\n\t\tctx = ret.ctx = new ContextImpl(renderer, root, host, parent, scope, ret);\n\t}\n\n\tctx.f |= IsUpdating;\n\treturn enqueueComponentRun(ctx, hydrationData);\n}\n\nfunction updateComponentChildren<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\tchildren: Children,\n\thydrationData?: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (ctx.f & IsUnmounted) {\n\t\treturn;\n\t} else if (ctx.f & IsErrored) {\n\t\t// This branch is necessary for some race conditions where this function is\n\t\t// called after iterator.throw() in async generator components.\n\t\treturn;\n\t} else if (children === undefined) {\n\t\tconsole.error(\n\t\t\t\"A component has returned or yielded undefined. If this was intentional, return or yield null instead.\",\n\t\t);\n\t}\n\n\tlet childValues: Promise<Array<string | TNode>> | Array<string | TNode>;\n\ttry {\n\t\t// TODO: WAT\n\t\t// We set the isExecuting flag in case a child component dispatches an event\n\t\t// which bubbles to this component and causes a synchronous refresh().\n\t\tctx.f |= IsSyncExecuting;\n\t\tchildValues = diffChildren(\n\t\t\tctx.renderer,\n\t\t\tctx.root,\n\t\t\tctx.host,\n\t\t\tctx,\n\t\t\tctx.scope,\n\t\t\tctx.ret,\n\t\t\tnarrow(children),\n\t\t\thydrationData,\n\t\t);\n\t} finally {\n\t\tctx.f &= ~IsSyncExecuting;\n\t}\n\n\tif (isPromiseLike(childValues)) {\n\t\tctx.ret.inflightValue = childValues.then((childValues) =>\n\t\t\tcommitComponent(ctx, childValues),\n\t\t);\n\n\t\treturn ctx.ret.inflightValue;\n\t}\n\n\treturn commitComponent(ctx, childValues);\n}\n\nfunction commitComponent<TNode>(\n\tctx: ContextImpl<TNode, unknown, TNode>,\n\tvalues: Array<TNode | string>,\n): ElementValue<TNode> {\n\tif (ctx.f & IsUnmounted) {\n\t\treturn;\n\t}\n\n\tconst listeners = listenersMap.get(ctx);\n\tif (listeners && listeners.length) {\n\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\tconst value = values[i];\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tfor (let j = 0; j < listeners.length; j++) {\n\t\t\t\t\tconst record = listeners[j];\n\t\t\t\t\tvalue.addEventListener(record.type, record.callback, record.options);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst oldValues = wrap(ctx.ret.cachedChildValues);\n\tlet value = (ctx.ret.cachedChildValues = unwrap(values));\n\tif (ctx.f & IsScheduling) {\n\t\tctx.f |= IsSchedulingRefresh;\n\t} else if (!(ctx.f & IsUpdating)) {\n\t\t// If we’re not updating the component, which happens when components are\n\t\t// refreshed, or when async generator components iterate, we have to do a\n\t\t// little bit housekeeping when a component’s child values have changed.\n\t\tif (!arrayEqual(oldValues, values)) {\n\t\t\tconst records = getListenerRecords(ctx.parent, ctx.host);\n\t\t\tif (records.length) {\n\t\t\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\t\t\tconst value = values[i];\n\t\t\t\t\tif (isEventTarget(value)) {\n\t\t\t\t\t\tfor (let j = 0; j < records.length; j++) {\n\t\t\t\t\t\t\tconst record = records[j];\n\t\t\t\t\t\t\tvalue.addEventListener(\n\t\t\t\t\t\t\t\trecord.type,\n\t\t\t\t\t\t\t\trecord.callback,\n\t\t\t\t\t\t\t\trecord.options,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// rearranging the nearest ancestor host element\n\t\t\tconst host = ctx.host;\n\t\t\tconst oldHostValues = wrap(host.cachedChildValues);\n\t\t\tinvalidate(ctx, host);\n\t\t\tconst hostValues = getChildValues(host);\n\t\t\tctx.renderer.arrange(\n\t\t\t\thost.el.tag as string | symbol,\n\t\t\t\thost.value as TNode,\n\t\t\t\thost.el.props,\n\t\t\t\thostValues,\n\t\t\t\t// props and oldProps are the same because the host isn’t updated.\n\t\t\t\thost.el.props,\n\t\t\t\toldHostValues,\n\t\t\t);\n\t\t}\n\n\t\tflush(ctx.renderer, ctx.root, ctx);\n\t}\n\n\tconst callbacks = scheduleMap.get(ctx);\n\tif (callbacks) {\n\t\tscheduleMap.delete(ctx);\n\t\tctx.f |= IsScheduling;\n\t\tconst value1 = ctx.renderer.read(value);\n\t\tfor (const callback of callbacks) {\n\t\t\tcallback(value1);\n\t\t}\n\n\t\tctx.f &= ~IsScheduling;\n\t\t// Handles an edge case where refresh() is called during a schedule().\n\t\tif (ctx.f & IsSchedulingRefresh) {\n\t\t\tctx.f &= ~IsSchedulingRefresh;\n\t\t\tvalue = getValue(ctx.ret);\n\t\t}\n\t}\n\n\tctx.f &= ~IsUpdating;\n\treturn value;\n}\n\nfunction invalidate(ctx: ContextImpl, host: Retainer<unknown>): void {\n\tfor (\n\t\tlet parent = ctx.parent;\n\t\tparent !== undefined && parent.host === host;\n\t\tparent = parent.parent\n\t) {\n\t\tparent.ret.cachedChildValues = undefined;\n\t}\n\n\thost.cachedChildValues = undefined;\n}\n\nfunction arrayEqual<TValue>(arr1: Array<TValue>, arr2: Array<TValue>): boolean {\n\tif (arr1.length !== arr2.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < arr1.length; i++) {\n\t\tconst value1 = arr1[i];\n\t\tconst value2 = arr2[i];\n\t\tif (value1 !== value2) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/** Enqueues and executes the component associated with the context. */\nfunction enqueueComponentRun<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\thydrationData?: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (ctx.f & IsAsyncGen && !(ctx.f & IsInForOfLoop)) {\n\t\tif (hydrationData !== undefined) {\n\t\t\tthrow new Error(\"Hydration error\");\n\t\t}\n\n\t\t// This branch will run for non-initial renders of async generator\n\t\t// components when they are not in for...of loops. When in a for...of loop,\n\t\t// async generator components will behave normally.\n\t\t//\n\t\t// Async gen componennts can be in one of three states:\n\t\t//\n\t\t// 1. propsAvailable flag is true: \"available\"\n\t\t//\n\t\t// The component is suspended somewhere in the loop. When the component\n\t\t// reaches the bottom of the loop, it will run again with the next props.\n\t\t//\n\t\t// 2. onAvailable callback is defined: \"suspended\"\n\t\t//\n\t\t// The component has suspended at the bottom of the loop and is waiting\n\t\t// for new props.\n\t\t//\n\t\t// 3. neither 1 or 2: \"Running\"\n\t\t//\n\t\t// The component is suspended somewhere in the loop. When the component\n\t\t// reaches the bottom of the loop, it will suspend.\n\t\t//\n\t\t// Components will never be both available and suspended at\n\t\t// the same time.\n\t\t//\n\t\t// If the component is at the loop bottom, this means that the next value\n\t\t// produced by the component will have the most up to date props, so we can\n\t\t// simply return the current inflight value. Otherwise, we have to wait for\n\t\t// the bottom of the loop to be reached before returning the inflight\n\t\t// value.\n\t\tconst isAtLoopbottom = ctx.f & IsInForAwaitOfLoop && !ctx.onProps;\n\t\tresumePropsIterator(ctx);\n\t\tif (isAtLoopbottom) {\n\t\t\tif (ctx.inflightBlock == null) {\n\t\t\t\tctx.inflightBlock = new Promise(\n\t\t\t\t\t(resolve) => (ctx.onPropsRequested = resolve),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn ctx.inflightBlock.then(() => {\n\t\t\t\tctx.inflightBlock = undefined;\n\t\t\t\treturn ctx.inflightValue;\n\t\t\t});\n\t\t}\n\n\t\treturn ctx.inflightValue;\n\t} else if (!ctx.inflightBlock) {\n\t\ttry {\n\t\t\tconst [block, value] = runComponent<TNode, TResult>(ctx, hydrationData);\n\t\t\tif (block) {\n\t\t\t\tctx.inflightBlock = block\n\t\t\t\t\t// TODO: there is some fuckery going on here related to async\n\t\t\t\t\t// generator components resuming when they’re meant to be returned.\n\t\t\t\t\t.then((v) => v)\n\t\t\t\t\t.finally(() => advanceComponent(ctx));\n\t\t\t\t// stepComponent will only return a block if the value is asynchronous\n\t\t\t\tctx.inflightValue = value as Promise<ElementValue<TNode>>;\n\t\t\t}\n\n\t\t\treturn value;\n\t\t} catch (err) {\n\t\t\tif (!(ctx.f & IsUpdating)) {\n\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\treturn propagateError<TNode>(ctx.parent, err);\n\t\t\t}\n\n\t\t\tthrow err;\n\t\t}\n\t} else if (!ctx.enqueuedBlock) {\n\t\tif (hydrationData !== undefined) {\n\t\t\tthrow new Error(\"Hydration error\");\n\t\t}\n\t\t// We need to assign enqueuedBlock and enqueuedValue synchronously, hence\n\t\t// the Promise constructor call here.\n\t\tlet resolveEnqueuedBlock: Function;\n\t\tctx.enqueuedBlock = new Promise(\n\t\t\t(resolve) => (resolveEnqueuedBlock = resolve),\n\t\t);\n\n\t\tctx.enqueuedValue = ctx.inflightBlock.then(() => {\n\t\t\ttry {\n\t\t\t\tconst [block, value] = runComponent<TNode, TResult>(ctx);\n\t\t\t\tif (block) {\n\t\t\t\t\tresolveEnqueuedBlock(block.finally(() => advanceComponent(ctx)));\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t} catch (err) {\n\t\t\t\tif (!(ctx.f & IsUpdating)) {\n\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn propagateError<TNode>(ctx.parent, err);\n\t\t\t\t}\n\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t});\n\t}\n\n\treturn ctx.enqueuedValue;\n}\n\n/** Called when the inflight block promise settles. */\nfunction advanceComponent(ctx: ContextImpl): void {\n\tif (ctx.f & IsAsyncGen && !(ctx.f & IsInForOfLoop)) {\n\t\treturn;\n\t}\n\n\tctx.inflightBlock = ctx.enqueuedBlock;\n\tctx.inflightValue = ctx.enqueuedValue;\n\tctx.enqueuedBlock = undefined;\n\tctx.enqueuedValue = undefined;\n}\n\n/**\n * This function is responsible for executing the component and handling all\n * the different component types. We cannot identify whether a component is a\n * generator or async without calling it and inspecting the return value.\n *\n * @returns {[block, value]} A tuple where\n * block - A possible promise which represents the duration during which the\n * component is blocked from updating.\n * value - A possible promise resolving to the rendered value of children.\n *\n * Each component type will block according to the type of the component.\n * - Sync function components never block and will transparently pass updates\n * to children.\n * - Async function components and async generator components block while\n * executing itself, but will not block for async children.\n * - Sync generator components block while any children are executing, because\n * they are expected to only resume when they’ve actually rendered.\n */\nfunction runComponent<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\thydrationData?: HydrationData<TNode> | undefined,\n): [\n\tPromise<unknown> | undefined,\n\tPromise<ElementValue<TNode>> | ElementValue<TNode>,\n] {\n\tconst ret = ctx.ret;\n\tconst initial = !ctx.iterator;\n\tif (initial) {\n\t\tresumePropsIterator(ctx);\n\t\tctx.f |= IsSyncExecuting;\n\t\tclearEventListeners(ctx);\n\t\tlet result: ReturnType<Component>;\n\t\ttry {\n\t\t\tresult = (ret.el.tag as Component).call(ctx.owner, ret.el.props);\n\t\t} catch (err) {\n\t\t\tctx.f |= IsErrored;\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t}\n\n\t\tif (isIteratorLike(result)) {\n\t\t\tctx.iterator = result;\n\t\t} else if (isPromiseLike(result)) {\n\t\t\t// async function component\n\t\t\tconst result1 =\n\t\t\t\tresult instanceof Promise ? result : Promise.resolve(result);\n\t\t\tconst value = result1.then(\n\t\t\t\t(result) =>\n\t\t\t\t\tupdateComponentChildren<TNode, TResult>(ctx, result, hydrationData),\n\t\t\t\t(err) => {\n\t\t\t\t\tctx.f |= IsErrored;\n\t\t\t\t\tthrow err;\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn [result1.catch(NOOP), value];\n\t\t} else {\n\t\t\t// sync function component\n\t\t\treturn [\n\t\t\t\tundefined,\n\t\t\t\tupdateComponentChildren<TNode, TResult>(ctx, result, hydrationData),\n\t\t\t];\n\t\t}\n\t} else if (hydrationData !== undefined) {\n\t\tthrow new Error(\"Hydration error\");\n\t}\n\n\tlet iteration!: Promise<ChildrenIteratorResult> | ChildrenIteratorResult;\n\tif (initial) {\n\t\ttry {\n\t\t\tctx.f |= IsSyncExecuting;\n\t\t\titeration = ctx.iterator!.next();\n\t\t} catch (err) {\n\t\t\tctx.f |= IsErrored;\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t}\n\n\t\tif (isPromiseLike(iteration)) {\n\t\t\tctx.f |= IsAsyncGen;\n\t\t} else {\n\t\t\tctx.f |= IsSyncGen;\n\t\t}\n\t}\n\n\tif (ctx.f & IsSyncGen) {\n\t\tctx.f &= ~NeedsToYield;\n\t\t// sync generator component\n\t\tif (!initial) {\n\t\t\ttry {\n\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\titeration = ctx.iterator!.next(ctx.renderer.read(getValue(ret)));\n\t\t\t} catch (err) {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t} finally {\n\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t}\n\t\t}\n\n\t\tif (isPromiseLike(iteration)) {\n\t\t\tthrow new Error(\"Mixed generator component\");\n\t\t}\n\n\t\tif (iteration.done) {\n\t\t\tctx.f &= ~IsSyncGen;\n\t\t\tctx.iterator = undefined;\n\t\t}\n\n\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\ttry {\n\t\t\tvalue = updateComponentChildren<TNode, TResult>(\n\t\t\t\tctx,\n\t\t\t\t// Children can be void so we eliminate that here\n\t\t\t\titeration.value as Children,\n\t\t\t\thydrationData,\n\t\t\t);\n\n\t\t\tif (isPromiseLike(value)) {\n\t\t\t\tvalue = value.catch((err) => handleChildError(ctx, err));\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tvalue = handleChildError(ctx, err);\n\t\t}\n\n\t\tconst block = isPromiseLike(value) ? value.catch(NOOP) : undefined;\n\t\treturn [block, value];\n\t} else if (ctx.f & IsInForOfLoop) {\n\t\t// TODO: does this need to be done async?\n\t\tctx.f &= ~NeedsToYield;\n\t\t// we are in a for...of loop for async generator\n\t\tif (!initial) {\n\t\t\ttry {\n\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\titeration = ctx.iterator!.next(ctx.renderer.read(getValue(ret)));\n\t\t\t} catch (err) {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t} finally {\n\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t}\n\t\t}\n\n\t\tif (!isPromiseLike(iteration)) {\n\t\t\tthrow new Error(\"Mixed generator component\");\n\t\t}\n\n\t\tconst block = iteration.catch(NOOP);\n\t\tconst value = iteration.then(\n\t\t\t(iteration) => {\n\t\t\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\t\t\tif (!(ctx.f & IsInForOfLoop)) {\n\t\t\t\t\trunAsyncGenComponent(ctx, Promise.resolve(iteration), hydrationData);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tvalue = updateComponentChildren<TNode, TResult>(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\t// Children can be void so we eliminate that here\n\t\t\t\t\t\titeration.value as Children,\n\t\t\t\t\t\thydrationData,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (isPromiseLike(value)) {\n\t\t\t\t\t\tvalue = value.catch((err) => handleChildError(ctx, err));\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\tvalue = handleChildError(ctx, err);\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\t(err) => {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t},\n\t\t);\n\n\t\treturn [block, value];\n\t} else {\n\t\trunAsyncGenComponent(\n\t\t\tctx,\n\t\t\titeration as Promise<ChildrenIteratorResult>,\n\t\t\thydrationData,\n\t\t);\n\t\t// async generator component\n\t\treturn [ctx.inflightBlock, ctx.inflightValue];\n\t}\n}\n\nasync function runAsyncGenComponent<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\titerationP: Promise<ChildrenIteratorResult>,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<void> {\n\tlet done = false;\n\ttry {\n\t\twhile (!done) {\n\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// inflightValue must be set synchronously.\n\t\t\tlet onValue!: Function;\n\t\t\tctx.inflightValue = new Promise((resolve) => (onValue = resolve));\n\t\t\tif (ctx.f & IsUpdating) {\n\t\t\t\t// We should not swallow unhandled promise rejections if the component is\n\t\t\t\t// updating independently.\n\t\t\t\t// TODO: Does this handle this.refresh() calls?\n\t\t\t\tctx.inflightValue.catch(NOOP);\n\t\t\t}\n\n\t\t\tlet iteration: ChildrenIteratorResult;\n\t\t\ttry {\n\t\t\t\titeration = await iterationP;\n\t\t\t} catch (err) {\n\t\t\t\tdone = true;\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tonValue(Promise.reject(err));\n\t\t\t\tbreak;\n\t\t\t} finally {\n\t\t\t\tctx.f &= ~NeedsToYield;\n\t\t\t\tif (!(ctx.f & IsInForAwaitOfLoop)) {\n\t\t\t\t\tctx.f &= ~PropsAvailable;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdone = !!iteration.done;\n\t\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\t\ttry {\n\t\t\t\tvalue = updateComponentChildren<TNode, TResult>(\n\t\t\t\t\tctx,\n\t\t\t\t\titeration.value!,\n\t\t\t\t\thydrationData,\n\t\t\t\t);\n\t\t\t\thydrationData = undefined;\n\t\t\t\tif (isPromiseLike(value)) {\n\t\t\t\t\tvalue = value.catch((err: any) => handleChildError(ctx, err));\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// Do we need to catch potential errors here in the case of unhandled\n\t\t\t\t// promise rejections?\n\t\t\t\tvalue = handleChildError(ctx, err);\n\t\t\t} finally {\n\t\t\t\tonValue(value);\n\t\t\t}\n\n\t\t\t// TODO: this can be done more elegantly\n\t\t\tlet oldValue: Promise<TResult> | TResult;\n\t\t\tif (ctx.ret.inflightValue) {\n\t\t\t\t// The value passed back into the generator as the argument to the next\n\t\t\t\t// method is a promise if an async generator component has async\n\t\t\t\t// children. Sync generator components only resume when their children\n\t\t\t\t// have fulfilled so the element’s inflight child values will never be\n\t\t\t\t// defined.\n\t\t\t\toldValue = ctx.ret.inflightValue.then((value) =>\n\t\t\t\t\tctx.renderer.read(value),\n\t\t\t\t);\n\n\t\t\t\toldValue.catch((err) => {\n\t\t\t\t\tif (ctx.f & IsUpdating) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn propagateError(ctx.parent, err);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\toldValue = ctx.renderer.read(getValue(ctx.ret));\n\t\t\t}\n\n\t\t\tif (ctx.f & IsUnmounted) {\n\t\t\t\tif (ctx.f & IsInForAwaitOfLoop) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\t\t\titerationP = ctx.iterator!.next(\n\t\t\t\t\t\t\toldValue,\n\t\t\t\t\t\t) as Promise<ChildrenIteratorResult>;\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (!done && !(ctx.f & IsInForOfLoop)) {\n\t\t\t\ttry {\n\t\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\t\titerationP = ctx.iterator!.next(\n\t\t\t\t\t\toldValue,\n\t\t\t\t\t) as Promise<ChildrenIteratorResult>;\n\t\t\t\t} finally {\n\t\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tif (done) {\n\t\t\tctx.f &= ~IsAsyncGen;\n\t\t\tctx.iterator = undefined;\n\t\t}\n\t}\n}\n\n/**\n * Called to resume the props async iterator for async generator components.\n */\nfunction resumePropsIterator(ctx: ContextImpl): void {\n\tif (ctx.onProps) {\n\t\tctx.onProps(ctx.ret.el.props);\n\t\tctx.onProps = undefined;\n\t\tctx.f &= ~PropsAvailable;\n\t} else {\n\t\tctx.f |= PropsAvailable;\n\t}\n}\n\n// TODO: async unmounting\nfunction unmountComponent(ctx: ContextImpl): void {\n\tif (ctx.f & IsUnmounted) {\n\t\treturn;\n\t}\n\n\tclearEventListeners(ctx);\n\n\tconst callbacks = cleanupMap.get(ctx);\n\tif (callbacks) {\n\t\tcleanupMap.delete(ctx);\n\t\tconst value = ctx.renderer.read(getValue(ctx.ret));\n\t\tfor (const callback of callbacks) {\n\t\t\tcallback(value);\n\t\t}\n\t}\n\n\tctx.f |= IsUnmounted;\n\tif (ctx.iterator) {\n\t\tif (ctx.f & IsSyncGen) {\n\t\t\tlet value: unknown;\n\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\tvalue = enqueueComponentRun(ctx);\n\t\t\t}\n\n\t\t\tif (isPromiseLike(value)) {\n\t\t\t\tvalue.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\t\t\t\tunmountComponent(ctx);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn propagateError<unknown>(ctx.parent, err);\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\t\tunmountComponent(ctx);\n\t\t\t\t} else {\n\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (ctx.f & IsAsyncGen) {\n\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\tconst value = enqueueComponentRun(ctx) as Promise<unknown>;\n\t\t\t\tvalue.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\t\t\t\tunmountComponent(ctx);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn propagateError<unknown>(ctx.parent, err);\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// The logic for unmounting async generator components is in the\n\t\t\t\t// runAsyncGenComponent function.\n\t\t\t\tresumePropsIterator(ctx);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction returnComponent(ctx: ContextImpl): void {\n\tresumePropsIterator(ctx);\n\tif (ctx.iterator && typeof ctx.iterator!.return === \"function\") {\n\t\ttry {\n\t\t\tctx.f |= IsSyncExecuting;\n\t\t\tconst iteration = ctx.iterator!.return();\n\t\t\tif (isPromiseLike(iteration)) {\n\t\t\t\titeration.catch((err) => {\n\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn propagateError<unknown>(ctx.parent, err);\n\t\t\t\t});\n\t\t\t}\n\t\t} finally {\n\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t}\n\t}\n}\n\n/*** EVENT TARGET UTILITIES ***/\n// EVENT PHASE CONSTANTS\n// https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase\nconst NONE = 0;\nconst CAPTURING_PHASE = 1;\nconst AT_TARGET = 2;\nconst BUBBLING_PHASE = 3;\n\nconst listenersMap = new WeakMap<ContextImpl, Array<EventListenerRecord>>();\n/**\n * A map of event type strings to Event subclasses. Can be extended via\n * TypeScript module augmentation to have strongly typed event listeners.\n */\nexport interface EventMap extends Crank.EventMap {\n\t[type: string]: Event;\n}\n\ntype MappedEventListener<T extends string> = (ev: EventMap[T]) => unknown;\n\ntype MappedEventListenerOrEventListenerObject<T extends string> =\n\t| MappedEventListener<T>\n\t| {handleEvent: MappedEventListener<T>};\n\nfunction isListenerOrListenerObject(\n\tvalue: unknown,\n): value is MappedEventListenerOrEventListenerObject<string> {\n\treturn (\n\t\ttypeof value === \"function\" ||\n\t\t(value !== null &&\n\t\t\ttypeof value === \"object\" &&\n\t\t\ttypeof (value as any).handleEvent === \"function\")\n\t);\n}\n\ninterface EventListenerRecord {\n\ttype: string;\n\t// listener is the original value passed to addEventListener, callback is the\n\t// transformed function\n\tlistener: MappedEventListenerOrEventListenerObject<any>;\n\tcallback: MappedEventListener<any>;\n\toptions: AddEventListenerOptions;\n}\n\nfunction normalizeListenerOptions(\n\toptions: AddEventListenerOptions | boolean | null | undefined,\n): AddEventListenerOptions {\n\tif (typeof options === \"boolean\") {\n\t\treturn {capture: options};\n\t} else if (options == null) {\n\t\treturn {};\n\t}\n\n\treturn options;\n}\n\nfunction isEventTarget(value: any): value is EventTarget {\n\treturn (\n\t\tvalue != null &&\n\t\ttypeof value.addEventListener === \"function\" &&\n\t\ttypeof value.removeEventListener === \"function\" &&\n\t\ttypeof value.dispatchEvent === \"function\"\n\t);\n}\n\nfunction setEventProperty<T extends keyof Event>(\n\tev: Event,\n\tkey: T,\n\tvalue: Event[T],\n): void {\n\tObject.defineProperty(ev, key, {value, writable: false, configurable: true});\n}\n\n// TODO: Maybe we can pass in the current context directly, rather than\n// starting from the parent?\n/**\n * A function to reconstruct an array of every listener given a context and a\n * host element.\n *\n * This function exploits the fact that contexts retain their nearest ancestor\n * host element. We can determine all the contexts which are directly listening\n * to an element by traversing up the context tree and checking that the host\n * element passed in matches the parent context’s host element.\n */\nfunction getListenerRecords(\n\tctx: ContextImpl | undefined,\n\tret: Retainer<unknown>,\n): Array<EventListenerRecord> {\n\tlet listeners: Array<EventListenerRecord> = [];\n\twhile (ctx !== undefined && ctx.host === ret) {\n\t\tconst listeners1 = listenersMap.get(ctx);\n\t\tif (listeners1) {\n\t\t\tlisteners = listeners.concat(listeners1);\n\t\t}\n\n\t\tctx = ctx.parent;\n\t}\n\n\treturn listeners;\n}\n\nfunction clearEventListeners(ctx: ContextImpl): void {\n\tconst listeners = listenersMap.get(ctx);\n\tif (listeners && listeners.length) {\n\t\tfor (const value of getChildValues(ctx.ret)) {\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\tvalue.removeEventListener(\n\t\t\t\t\t\trecord.type,\n\t\t\t\t\t\trecord.callback,\n\t\t\t\t\t\trecord.options,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlisteners.length = 0;\n\t}\n}\n\n/*** ERROR HANDLING UTILITIES ***/\nfunction handleChildError<TNode>(\n\tctx: ContextImpl<TNode, unknown, TNode>,\n\terr: unknown,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (!ctx.iterator || typeof ctx.iterator.throw !== \"function\") {\n\t\tthrow err;\n\t}\n\n\tresumePropsIterator(ctx);\n\tlet iteration: ChildrenIteratorResult | Promise<ChildrenIteratorResult>;\n\ttry {\n\t\tctx.f |= IsSyncExecuting;\n\t\titeration = ctx.iterator.throw(err);\n\t} catch (err) {\n\t\tctx.f |= IsErrored;\n\t\tthrow err;\n\t} finally {\n\t\tctx.f &= ~IsSyncExecuting;\n\t}\n\n\tif (isPromiseLike(iteration)) {\n\t\treturn iteration.then(\n\t\t\t(iteration) => {\n\t\t\t\tif (iteration.done) {\n\t\t\t\t\tctx.f &= ~IsAsyncGen;\n\t\t\t\t\tctx.iterator = undefined;\n\t\t\t\t}\n\n\t\t\t\treturn updateComponentChildren(ctx, iteration.value as Children);\n\t\t\t},\n\t\t\t(err) => {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t},\n\t\t);\n\t}\n\n\tif (iteration.done) {\n\t\tctx.f &= ~IsSyncGen;\n\t\tctx.f &= ~IsAsyncGen;\n\t\tctx.iterator = undefined;\n\t}\n\n\treturn updateComponentChildren(ctx, iteration.value as Children);\n}\n\nfunction propagateError<TNode>(\n\tctx: ContextImpl<TNode, unknown, TNode>,\n\terr: unknown,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tlet result: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\ttry {\n\t\tresult = handleChildError(ctx, err);\n\t} catch (err) {\n\t\tif (!ctx.parent) {\n\t\t\tthrow err;\n\t\t}\n\n\t\treturn propagateError<TNode>(ctx.parent, err);\n\t}\n\n\tif (isPromiseLike(result)) {\n\t\treturn result.catch((err) => {\n\t\t\tif (!ctx.parent) {\n\t\t\t\tthrow err;\n\t\t\t}\n\n\t\t\treturn propagateError<TNode>(ctx.parent, err);\n\t\t});\n\t}\n\n\treturn result;\n}\n\n// TODO: uncomment and use in the Element interface below\n// type CrankElement = Element;\ndeclare global {\n\tnamespace Crank {\n\t\texport interface EventMap {}\n\n\t\texport interface ProvisionMap {}\n\n\t\texport interface Context {}\n\t}\n\n\tnamespace JSX {\n\t\t// TODO: JSX Element type (the result of JSX expressions) don’t work\n\t\t// because TypeScript demands that all Components return JSX elements for\n\t\t// some reason.\n\t\t// interface Element extends CrankElement {}\n\n\t\texport interface IntrinsicElements {\n\t\t\t[tag: string]: any;\n\t\t}\n\n\t\texport interface ElementChildrenAttribute {\n\t\t\tchildren: {};\n\t\t}\n\t}\n}\n\n// Some JSX transpilation tools expect these functions to be defined on the\n// default export. Prefer named exports when importing directly.\nexport default {createElement, Fragment};\n","import {\n\tChildren,\n\tContext,\n\tElementValue,\n\tHydrationData,\n\tPortal,\n\tRenderer,\n\tRendererImpl,\n} from \"./crank.js\";\n\nconst SVG_NAMESPACE = \"http://www.w3.org/2000/svg\";\n\nexport const impl: Partial<RendererImpl<Node, string>> = {\n\tscope(xmlns: string | undefined, tag: string | symbol): string | undefined {\n\t\t// TODO: Should we handle xmlns???\n\t\tswitch (tag) {\n\t\t\tcase Portal:\n\t\t\tcase \"foreignObject\":\n\t\t\t\txmlns = undefined;\n\t\t\t\tbreak;\n\t\t\tcase \"svg\":\n\t\t\t\txmlns = SVG_NAMESPACE;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn xmlns;\n\t},\n\n\tcreate(\n\t\ttag: string | symbol,\n\t\t_props: unknown,\n\t\txmlns: string | undefined,\n\t): Node {\n\t\tif (typeof tag !== \"string\") {\n\t\t\tthrow new Error(`Unknown tag: ${tag.toString()}`);\n\t\t} else if (tag.toLowerCase() === \"svg\") {\n\t\t\txmlns = SVG_NAMESPACE;\n\t\t}\n\n\t\treturn xmlns\n\t\t\t? document.createElementNS(xmlns, tag)\n\t\t\t: document.createElement(tag);\n\t},\n\n\thydrate(\n\t\ttag: string | symbol,\n\t\tnode: Element,\n\t\tprops: Record<string, unknown>,\n\t): HydrationData<Element> | undefined {\n\t\tif (typeof tag !== \"string\" && tag !== Portal) {\n\t\t\tthrow new Error(`Unknown tag: ${tag.toString()}`);\n\t\t}\n\n\t\tif (\n\t\t\ttypeof tag === \"string\" &&\n\t\t\ttag.toUpperCase() !== (node as Element).tagName\n\t\t) {\n\t\t\t// TODO: consider pros and cons of hydration warnings\n\t\t\t//console.error(`Expected <${tag}> while hydrating but found:`, node);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst children: Array<string | Element> = [];\n\t\tfor (let i = 0; i < node.childNodes.length; i++) {\n\t\t\tconst child = node.childNodes[i];\n\t\t\tif (child.nodeType === Node.TEXT_NODE) {\n\t\t\t\tchildren.push((child as Text).data);\n\t\t\t} else if (child.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\tchildren.push(child as Element);\n\t\t\t}\n\t\t}\n\n\t\t// TODO: extract props from nodes\n\t\treturn {props, children};\n\t},\n\n\tpatch(\n\t\t_tag: string | symbol,\n\t\t// TODO: Why does this assignment work?\n\t\tnode: HTMLElement | SVGElement,\n\t\tname: string,\n\t\t// TODO: Stricter typings?\n\t\tvalue: unknown,\n\t\toldValue: unknown,\n\t\txmlns: string | undefined,\n\t): void {\n\t\tconst isSVG = xmlns === SVG_NAMESPACE;\n\t\tswitch (name) {\n\t\t\tcase \"style\": {\n\t\t\t\tconst style: CSSStyleDeclaration = node.style;\n\t\t\t\tif (style == null) {\n\t\t\t\t\tnode.setAttribute(\"style\", value as string);\n\t\t\t\t} else if (value == null || value === false) {\n\t\t\t\t\tnode.removeAttribute(\"style\");\n\t\t\t\t} else if (value === true) {\n\t\t\t\t\tnode.setAttribute(\"style\", \"\");\n\t\t\t\t} else if (typeof value === \"string\") {\n\t\t\t\t\tif (style.cssText !== value) {\n\t\t\t\t\t\tstyle.cssText = value;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof oldValue === \"string\") {\n\t\t\t\t\t\tstyle.cssText = \"\";\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const styleName in {...(oldValue as {}), ...(value as {})}) {\n\t\t\t\t\t\tconst styleValue = value && (value as any)[styleName];\n\t\t\t\t\t\tif (styleValue == null) {\n\t\t\t\t\t\t\tstyle.removeProperty(styleName);\n\t\t\t\t\t\t} else if (style.getPropertyValue(styleName) !== styleValue) {\n\t\t\t\t\t\t\tstyle.setProperty(styleName, styleValue);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"class\":\n\t\t\tcase \"className\":\n\t\t\t\tif (value === true) {\n\t\t\t\t\tnode.setAttribute(\"class\", \"\");\n\t\t\t\t} else if (value == null) {\n\t\t\t\t\tnode.removeAttribute(\"class\");\n\t\t\t\t} else if (!isSVG) {\n\t\t\t\t\tif (node.className !== value) {\n\t\t\t\t\t\t(node as any)[\"className\"] = value;\n\t\t\t\t\t}\n\t\t\t\t} else if (node.getAttribute(\"class\") !== value) {\n\t\t\t\t\tnode.setAttribute(\"class\", value as string);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"innerHTML\":\n\t\t\t\tif (value !== oldValue) {\n\t\t\t\t\tnode.innerHTML = value as any;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tdefault: {\n\t\t\t\tif (\n\t\t\t\t\tname in node &&\n\t\t\t\t\t// boolean properties will coerce strings, but sometimes they map to\n\t\t\t\t\t// enumerated attributes, where truthy strings (\"false\", \"no\") map to\n\t\t\t\t\t// falsy properties, so we use attributes in this case.\n\t\t\t\t\t!(\n\t\t\t\t\t\ttypeof value === \"string\" &&\n\t\t\t\t\t\ttypeof (node as any)[name] === \"boolean\"\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// walk up the object's prototype chain to find the owner of the\n\t\t\t\t\t// named property\n\t\t\t\t\tlet obj = node;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(obj, name)) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} while ((obj = Object.getPrototypeOf(obj)));\n\n\t\t\t\t\t// get the descriptor for the named property and check whether it\n\t\t\t\t\t// implies that the property is writable\n\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(obj, name);\n\t\t\t\t\tif (\n\t\t\t\t\t\tdescriptor != null &&\n\t\t\t\t\t\t(descriptor.writable === true || descriptor.set !== undefined)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ((node as any)[name] !== value || oldValue === undefined) {\n\t\t\t\t\t\t\t(node as any)[name] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// if the property wasn't writable, fall through to the code below\n\t\t\t\t\t// which uses setAttribute() instead of assigning directly.\n\t\t\t\t}\n\n\t\t\t\tif (value === true) {\n\t\t\t\t\tvalue = \"\";\n\t\t\t\t} else if (value == null || value === false) {\n\t\t\t\t\tnode.removeAttribute(name);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.getAttribute(name) !== value) {\n\t\t\t\t\tnode.setAttribute(name, value as any);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tarrange(\n\t\ttag: string | symbol,\n\t\tnode: Node,\n\t\tprops: Record<string, any>,\n\t\tchildren: Array<Element | string>,\n\t\t_oldProps: Record<string, any> | undefined,\n\t\toldChildren: Array<Element | string> | undefined,\n\t): void {\n\t\tif (tag === Portal && (node == null || typeof node.nodeType !== \"number\")) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Portal root is not a node. Received: ${JSON.stringify(\n\t\t\t\t\tnode && node.toString(),\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\t!(\"innerHTML\" in props) &&\n\t\t\t// We don’t want to update elements without explicit children (<div/>),\n\t\t\t// because these elements sometimes have child nodes added via raw\n\t\t\t// DOM manipulations.\n\t\t\t// However, if an element has previously rendered children, we clear the\n\t\t\t// them because it would be surprising not to clear Crank managed\n\t\t\t// children, even if the new element does not have explicit children.\n\t\t\t(\"children\" in props || (oldChildren && oldChildren.length))\n\t\t) {\n\t\t\tif (children.length === 0) {\n\t\t\t\tnode.textContent = \"\";\n\t\t\t} else {\n\t\t\t\tlet oldChild = node.firstChild;\n\t\t\t\tlet i = 0;\n\t\t\t\twhile (oldChild !== null && i < children.length) {\n\t\t\t\t\tconst newChild = children[i];\n\t\t\t\t\tif (oldChild === newChild) {\n\t\t\t\t\t\toldChild = oldChild.nextSibling;\n\t\t\t\t\t\ti++;\n\t\t\t\t\t} else if (typeof newChild === \"string\") {\n\t\t\t\t\t\tif (oldChild.nodeType === Node.TEXT_NODE) {\n\t\t\t\t\t\t\tif ((oldChild as Text).data !== newChild) {\n\t\t\t\t\t\t\t\t(oldChild as Text).data = newChild;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\toldChild = oldChild.nextSibling;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.insertBefore(document.createTextNode(newChild), oldChild);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ti++;\n\t\t\t\t\t} else if (oldChild.nodeType === Node.TEXT_NODE) {\n\t\t\t\t\t\tconst nextSibling = oldChild.nextSibling;\n\t\t\t\t\t\tnode.removeChild(oldChild);\n\t\t\t\t\t\toldChild = nextSibling;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.insertBefore(newChild, oldChild);\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\t// TODO: This is an optimization but we need to think a little more about other cases like prepending.\n\t\t\t\t\t\tif (oldChild !== children[i]) {\n\t\t\t\t\t\t\tconst nextSibling = oldChild.nextSibling;\n\t\t\t\t\t\t\tnode.removeChild(oldChild);\n\t\t\t\t\t\t\toldChild = nextSibling;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// remove excess DOM nodes\n\t\t\t\twhile (oldChild !== null) {\n\t\t\t\t\tconst nextSibling = oldChild.nextSibling;\n\t\t\t\t\tnode.removeChild(oldChild);\n\t\t\t\t\toldChild = nextSibling;\n\t\t\t\t}\n\n\t\t\t\t// append excess children\n\t\t\t\tfor (; i < children.length; i++) {\n\t\t\t\t\tconst newChild = children[i];\n\t\t\t\t\tnode.appendChild(\n\t\t\t\t\t\ttypeof newChild === \"string\"\n\t\t\t\t\t\t\t? document.createTextNode(newChild)\n\t\t\t\t\t\t\t: newChild,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\ttext(\n\t\ttext: string,\n\t\t_scope: string | undefined,\n\t\thydrationData: HydrationData<Element> | undefined,\n\t): string {\n\t\tif (hydrationData != null) {\n\t\t\tlet value = hydrationData.children.shift();\n\t\t\tif (typeof value !== \"string\" || !value.startsWith(text)) {\n\t\t\t\t// TODO: consider pros and cons of hydration warnings\n\t\t\t\t//console.error(`Expected \"${text}\" while hydrating but found:`, value);\n\t\t\t} else if (text.length < value.length) {\n\t\t\t\tvalue = value.slice(text.length);\n\t\t\t\thydrationData.children.unshift(value);\n\t\t\t}\n\t\t}\n\n\t\treturn text;\n\t},\n\n\traw(\n\t\tvalue: string | Node,\n\t\txmlns: string | undefined,\n\t\thydrationData: HydrationData<Element> | undefined,\n\t): ElementValue<Node> {\n\t\tlet result: ElementValue<Node>;\n\t\tif (typeof value === \"string\") {\n\t\t\tconst el =\n\t\t\t\txmlns == null\n\t\t\t\t\t? document.createElement(\"div\")\n\t\t\t\t\t: document.createElementNS(xmlns, \"svg\");\n\t\t\tel.innerHTML = value;\n\t\t\tif (el.childNodes.length === 0) {\n\t\t\t\tresult = undefined;\n\t\t\t} else if (el.childNodes.length === 1) {\n\t\t\t\tresult = el.childNodes[0];\n\t\t\t} else {\n\t\t\t\tresult = Array.from(el.childNodes);\n\t\t\t}\n\t\t} else {\n\t\t\tresult = value;\n\t\t}\n\n\t\tif (hydrationData != null) {\n\t\t\t// TODO: maybe we should warn on incorrect values\n\t\t\tif (Array.isArray(result)) {\n\t\t\t\tfor (let i = 0; i < result.length; i++) {\n\t\t\t\t\tconst node = result[i];\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof node !== \"string\" &&\n\t\t\t\t\t\t(node.nodeType === Node.ELEMENT_NODE ||\n\t\t\t\t\t\t\tnode.nodeType === Node.TEXT_NODE)\n\t\t\t\t\t) {\n\t\t\t\t\t\thydrationData.children.shift();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (result != null && typeof result !== \"string\") {\n\t\t\t\tif (\n\t\t\t\t\tresult.nodeType === Node.ELEMENT_NODE ||\n\t\t\t\t\tresult.nodeType === Node.TEXT_NODE\n\t\t\t\t) {\n\t\t\t\t\thydrationData.children.shift();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t},\n};\n\nexport class DOMRenderer extends Renderer<Node, string> {\n\tconstructor() {\n\t\tsuper(impl);\n\t}\n\n\trender(\n\t\tchildren: Children,\n\t\troot: Node,\n\t\tctx?: Context,\n\t): Promise<ElementValue<Node>> | ElementValue<Node> {\n\t\tvalidateRoot(root);\n\t\treturn super.render(children, root, ctx);\n\t}\n\n\thydrate(\n\t\tchildren: Children,\n\t\troot: Node,\n\t\tctx?: Context,\n\t): Promise<ElementValue<Node>> | ElementValue<Node> {\n\t\tvalidateRoot(root);\n\t\treturn super.hydrate(children, root, ctx);\n\t}\n}\n\nfunction validateRoot(root: unknown): asserts root is Node {\n\tif (\n\t\troot === null ||\n\t\t(typeof root === \"object\" && typeof (root as any).nodeType !== \"number\")\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`Render root is not a node. Received: ${JSON.stringify(\n\t\t\t\troot && root.toString(),\n\t\t\t)}`,\n\t\t);\n\t}\n}\n\nexport const renderer = new DOMRenderer();\n\ndeclare global {\n\tmodule Crank {\n\t\tinterface EventMap extends GlobalEventHandlersEventMap {}\n\t}\n}\n","import {Portal, Renderer} from \"./crank.js\";\nimport type {ElementValue, RendererImpl} from \"./crank.js\";\n\nconst voidTags = new Set([\n\t\"area\",\n\t\"base\",\n\t\"br\",\n\t\"col\",\n\t\"command\",\n\t\"embed\",\n\t\"hr\",\n\t\"img\",\n\t\"input\",\n\t\"keygen\",\n\t\"link\",\n\t\"meta\",\n\t\"param\",\n\t\"source\",\n\t\"track\",\n\t\"wbr\",\n]);\n\nfunction escape(text: string): string {\n\treturn text.replace(/[&<>\"']/g, (match) => {\n\t\tswitch (match) {\n\t\t\tcase \"&\":\n\t\t\t\treturn \"&\";\n\t\t\tcase \"<\":\n\t\t\t\treturn \"<\";\n\t\t\tcase \">\":\n\t\t\t\treturn \">\";\n\t\t\tcase '\"':\n\t\t\t\treturn \""\";\n\t\t\tcase \"'\":\n\t\t\t\treturn \"'\";\n\t\t\tdefault:\n\t\t\t\treturn \"\";\n\t\t}\n\t});\n}\n\nfunction printStyleObject(style: Record<string, any>): string {\n\tconst cssStrings = [];\n\tfor (const [name, value] of Object.entries(style)) {\n\t\tif (value != null) {\n\t\t\tcssStrings.push(`${name}:${value};`);\n\t\t}\n\t}\n\n\treturn cssStrings.join(\"\");\n}\n\nfunction printAttrs(props: Record<string, any>): string {\n\tconst attrs: string[] = [];\n\tfor (const [name, value] of Object.entries(props)) {\n\t\tswitch (true) {\n\t\t\tcase name === \"children\":\n\t\t\tcase name === \"innerHTML\":\n\t\t\t\tbreak;\n\t\t\tcase name === \"style\": {\n\t\t\t\tif (typeof value === \"string\") {\n\t\t\t\t\tattrs.push(`style=\"${escape(value)}\"`);\n\t\t\t\t} else if (typeof value === \"object\") {\n\t\t\t\t\tattrs.push(`style=\"${escape(printStyleObject(value))}\"`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase name === \"className\": {\n\t\t\t\tif (\"class\" in props || typeof value !== \"string\") {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tattrs.push(`class=\"${escape(value)}\"`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase typeof value === \"string\":\n\t\t\t\tattrs.push(`${escape(name)}=\"${escape(value)}\"`);\n\t\t\t\tbreak;\n\t\t\tcase typeof value === \"number\":\n\t\t\t\tattrs.push(`${escape(name)}=\"${value}\"`);\n\t\t\t\tbreak;\n\t\t\tcase value === true:\n\t\t\t\tattrs.push(`${escape(name)}`);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn attrs.join(\" \");\n}\n\ninterface Node {\n\tvalue: string;\n}\n\nfunction join(children: Array<Node | string>): string {\n\tlet result = \"\";\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tresult += typeof child === \"string\" ? child : child.value;\n\t}\n\n\treturn result;\n}\n\nexport const impl: Partial<RendererImpl<Node, undefined, any, string>> = {\n\tcreate(): Node {\n\t\treturn {value: \"\"};\n\t},\n\n\ttext(text: string): string {\n\t\treturn escape(text);\n\t},\n\n\tread(value: ElementValue<Node>): string {\n\t\tif (Array.isArray(value)) {\n\t\t\treturn join(value);\n\t\t} else if (typeof value === \"undefined\") {\n\t\t\treturn \"\";\n\t\t} else if (typeof value === \"string\") {\n\t\t\treturn value;\n\t\t} else {\n\t\t\treturn value.value;\n\t\t}\n\t},\n\n\tarrange(\n\t\ttag: string | symbol,\n\t\tnode: Node,\n\t\tprops: Record<string, any>,\n\t\tchildren: Array<Node | string>,\n\t): void {\n\t\tif (tag === Portal) {\n\t\t\treturn;\n\t\t} else if (typeof tag !== \"string\") {\n\t\t\tthrow new Error(`Unknown tag: ${tag.toString()}`);\n\t\t}\n\n\t\tconst attrs = printAttrs(props);\n\t\tconst open = `<${tag}${attrs.length ? \" \" : \"\"}${attrs}>`;\n\t\tlet result: string;\n\t\tif (voidTags.has(tag)) {\n\t\t\tresult = open;\n\t\t} else {\n\t\t\tconst close = `</${tag}>`;\n\t\t\tconst contents =\n\t\t\t\t\"innerHTML\" in props ? props[\"innerHTML\"] : join(children);\n\t\t\tresult = `${open}${contents}${close}`;\n\t\t}\n\n\t\tnode.value = result;\n\t},\n};\n\nexport class HTMLRenderer extends Renderer<Node, undefined, any, string> {\n\tconstructor() {\n\t\tsuper(impl);\n\t}\n}\n\nexport const renderer = new HTMLRenderer();\n\ndeclare global {\n\tmodule Crank {\n\t\tinterface EventMap extends GlobalEventHandlersEventMap {}\n\t}\n}\n"],"names":["impl","renderer"],"mappings":";;;;;;CAAA,MAAM,IAAI,GAAG,MAAK,GAAG,CAAC;CACtB,MAAM,QAAQ,GAAG,CAAI,KAAQ,KAAQ,KAAK,CAAC;CAE3C,SAAS,IAAI,CAAI,KAA+B,EAAA;KAC/C,OAAO,KAAK,KAAK,SAAS,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;CAC1E,CAAC;CAED,SAAS,MAAM,CAAI,GAAa,EAAA;CAC/B,IAAA,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;CACvE,CAAC;CAID;;;;;;CAMG;CACH,SAAS,QAAQ,CAChB,KAAkD,EAAA;KAElD,OAAO,KAAK,IAAI,IAAI;CACnB,UAAE,EAAE;CACJ,UAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;CACtB,cAAE,KAAK;CACP,cAAE,OAAO,KAAK,KAAK,QAAQ;CACzB,gBAAA,OAAQ,KAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU;mBACrD,CAAC,KA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M,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"umd.js","sources":["../src/crank.ts","../src/dom.ts","../src/html.ts"],"sourcesContent":["const NOOP = () => {};\nconst IDENTITY = <T>(value: T): T => value;\n\nfunction wrap<T>(value: Array<T> | T | undefined): Array<T> {\n\treturn value === undefined ? [] : Array.isArray(value) ? value : [value];\n}\n\nfunction unwrap<T>(arr: Array<T>): Array<T> | T | undefined {\n\treturn arr.length === 0 ? undefined : arr.length === 1 ? arr[0] : arr;\n}\n\ntype NonStringIterable<T> = Iterable<T> & object;\n\n/**\n * Ensures a value is an array.\n *\n * This function does the same thing as wrap() above except it handles nulls\n * and iterables, so it is appropriate for wrapping user-provided element\n * children.\n */\nfunction arrayify<T>(\n\tvalue: NonStringIterable<T> | T | null | undefined,\n): Array<T> {\n\treturn value == null\n\t\t? []\n\t\t: Array.isArray(value)\n\t\t? value\n\t\t: typeof value === \"string\" ||\n\t\t typeof (value as any)[Symbol.iterator] !== \"function\"\n\t\t? [value]\n\t\t: // TODO: inference broke in TypeScript 3.9.\n\t\t [...(value as any)];\n}\n\nfunction isIteratorLike(\n\tvalue: any,\n): value is Iterator<unknown> | AsyncIterator<unknown> {\n\treturn value != null && typeof value.next === \"function\";\n}\n\nfunction isPromiseLike(value: any): value is PromiseLike<unknown> {\n\treturn value != null && typeof value.then === \"function\";\n}\n\n/**\n * A type which represents all valid values for an element tag.\n */\nexport type Tag = string | symbol | Component;\n\n/**\n * A helper type to map the tag of an element to its expected props.\n *\n * @template TTag - The tag associated with the props. Can be a string, symbol\n * or a component function.\n */\nexport type TagProps<TTag extends Tag> = TTag extends string\n\t? JSX.IntrinsicElements[TTag]\n\t: TTag extends Component<infer TProps>\n\t? TProps\n\t: Record<string, unknown>;\n\n/***\n * SPECIAL TAGS\n *\n * Crank provides a couple tags which have special meaning for the renderer.\n ***/\n\n/**\n * A special tag for grouping multiple children within the same parent.\n *\n * All non-string iterables which appear in the element tree are implicitly\n * wrapped in a fragment element.\n *\n * This tag is just the empty string, and you can use the empty string in\n * createElement calls or transpiler options directly to avoid having to\n * reference this export.\n */\nexport const Fragment = \"\";\nexport type Fragment = typeof Fragment;\n\n// TODO: We assert the following symbol tags as any because TypeScript support\n// for symbol tags in JSX doesn’t exist yet.\n// https://github.com/microsoft/TypeScript/issues/38367\n\n/**\n * A special tag for rendering into a new root node via a root prop.\n *\n * This tag is useful for creating element trees with multiple roots, for\n * things like modals or tooltips.\n *\n * Renderer.prototype.render() will implicitly wrap top-level element trees in\n * a Portal element.\n */\nexport const Portal = Symbol.for(\"crank.Portal\") as any;\nexport type Portal = typeof Portal;\n\n/**\n * A special tag which preserves whatever was previously rendered in the\n * element’s position.\n *\n * Copy elements are useful for when you want to prevent a subtree from\n * rerendering as a performance optimization. Copy elements can also be keyed,\n * in which case the previously rendered keyed element will be copied.\n */\nexport const Copy = Symbol.for(\"crank.Copy\") as any;\nexport type Copy = typeof Copy;\n\n/**\n * A special tag for injecting raw nodes or strings via a value prop.\n *\n * Renderer.prototype.raw() is called with the value prop.\n */\nexport const Raw = Symbol.for(\"crank.Raw\") as any;\nexport type Raw = typeof Raw;\n\n/**\n * Describes all valid values of an element tree, excluding iterables.\n *\n * Arbitrary objects can also be safely rendered, but will be converted to a\n * string using the toString() method. We exclude them from this type to catch\n * potential mistakes.\n */\nexport type Child = Element | string | number | boolean | null | undefined;\n\n/**\n * An arbitrarily nested iterable of Child values.\n *\n * We use a recursive interface here rather than making the Children type\n * directly recursive because recursive type aliases were added in TypeScript\n * 3.7.\n *\n * You should avoid referencing this type directly, as it is mainly exported to\n * prevent TypeScript errors.\n */\nexport interface ChildIterable extends Iterable<Child | ChildIterable> {}\n\n/**\n * Describes all valid values of an element tree, including arbitrarily nested\n * iterables of such values.\n */\nexport type Children = Child | ChildIterable;\n\n/**\n * Represents all functions which can be used as a component.\n *\n * @template [TProps=*] - The expected props for the component.\n */\nexport type Component<TProps extends Record<string, unknown> = any> = (\n\tthis: Context<TProps>,\n\tprops: TProps,\n) =>\n\t| Children\n\t| PromiseLike<Children>\n\t// The return type of iterators must include void because TypeScript will\n\t// infer generators which return implicitly as having a void return type.\n\t| Iterator<Children, Children | void, any>\n\t| AsyncIterator<Children, Children | void, any>;\n\ntype ChildrenIteratorResult = IteratorResult<Children, Children | void>;\n\n/**\n * A type to keep track of keys. Any value can be a key, though null and\n * undefined are ignored.\n */\ntype Key = unknown;\n\nconst ElementSymbol = Symbol.for(\"crank.Element\");\n\n// To maximize compatibility between Crank versions, starting with 0.2.0, any\n// changes to the Element properties will be considered a breaking change.\nexport interface Element<TTag extends Tag = Tag> {\n\t/**\n\t * @internal\n\t * A unique symbol to identify elements as elements across versions and\n\t * realms, and to protect against basic injection attacks.\n\t * https://overreacted.io/why-do-react-elements-have-typeof-property/\n\t *\n\t * This property is defined on the element prototype rather than per\n\t * instance, because it is the same for every Element.\n\t */\n\t$$typeof: typeof ElementSymbol;\n\n\t/**\n\t * The tag of the element. Can be a string, symbol or function.\n\t */\n\ttag: TTag;\n\n\t/**\n\t * An object containing the “properties” of an element. These correspond to\n\t * the attribute syntax from JSX.\n\t */\n\tprops: TagProps<TTag>;\n\n\t/**\n\t * A value which uniquely identifies an element from its siblings so that it\n\t * can be added/updated/moved/removed by key rather than position.\n\t *\n\t * Passed in createElement() as the prop \"c-key\".\n\t */\n\tkey: Key;\n\n\t/**\n\t * A callback which is called with the element’s result when it is committed.\n\t *\n\t * Passed in createElement() as the prop \"c-ref\".\n\t */\n\tref: ((value: unknown) => unknown) | undefined;\n\n\t/**\n\t * A possible boolean which indicates that element should NOT be rerendered.\n\t * If the element has never been rendered, this property has no effect.\n\t *\n\t * Passed in createElement() as the prop \"c-static\".\n\t */\n\tstatic_: boolean | undefined;\n}\n\n/**\n * Elements are the basic building blocks of Crank applications. They are\n * JavaScript objects which are interpreted by special classes called renderers\n * to produce and manage stateful nodes.\n *\n * @template {Tag} [TTag=Tag] - The type of the tag of the element.\n *\n * @example\n * // specific element types\n * let div: Element<\"div\">;\n * let portal: Element<Portal>;\n * let myEl: Element<MyComponent>;\n *\n * // general element types\n * let host: Element<string | symbol>;\n * let component: Element<Component>;\n *\n * Typically, you use a helper function like createElement to create elements\n * rather than instatiating this class directly.\n */\nexport class Element<TTag extends Tag = Tag> {\n\tconstructor(\n\t\ttag: TTag,\n\t\tprops: TagProps<TTag>,\n\t\tkey: Key,\n\t\tref?: ((value: unknown) => unknown) | undefined,\n\t\tstatic_?: boolean | undefined,\n\t) {\n\t\tthis.tag = tag;\n\t\tthis.props = props;\n\t\tthis.key = key;\n\t\tthis.ref = ref;\n\t\tthis.static_ = static_;\n\t}\n}\n\n// See Element interface\nElement.prototype.$$typeof = ElementSymbol;\n\nexport function isElement(value: any): value is Element {\n\treturn value != null && value.$$typeof === ElementSymbol;\n}\n\n/**\n * Creates an element with the specified tag, props and children.\n *\n * This function is usually used as a transpilation target for JSX transpilers,\n * but it can also be called directly. It additionally extracts special props so\n * they aren’t accessible to renderer methods or components, and assigns the\n * children prop according to any additional arguments passed to the function.\n */\nexport function createElement<TTag extends Tag>(\n\ttag: TTag,\n\tprops?: TagProps<TTag> | null | undefined,\n\t...children: Array<unknown>\n): Element<TTag> {\n\tlet key: Key;\n\tlet ref: ((value: unknown) => unknown) | undefined;\n\tlet static_ = false;\n\tconst props1 = {} as TagProps<TTag>;\n\tif (props != null) {\n\t\tfor (const name in props) {\n\t\t\tswitch (name) {\n\t\t\t\tcase \"crank-key\":\n\t\t\t\tcase \"c-key\":\n\t\t\t\tcase \"$key\":\n\t\t\t\t\t// We have to make sure we don’t assign null to the key because we\n\t\t\t\t\t// don’t check for null keys in the diffing functions.\n\t\t\t\t\tif (props[name] != null) {\n\t\t\t\t\t\tkey = props[name];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"crank-ref\":\n\t\t\t\tcase \"c-ref\":\n\t\t\t\tcase \"$ref\":\n\t\t\t\t\tif (typeof props[name] === \"function\") {\n\t\t\t\t\t\tref = props[name];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"crank-static\":\n\t\t\t\tcase \"c-static\":\n\t\t\t\tcase \"$static\":\n\t\t\t\t\tstatic_ = !!props[name];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tprops1[name] = props[name];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (children.length > 1) {\n\t\tprops1.children = children;\n\t} else if (children.length === 1) {\n\t\tprops1.children = children[0];\n\t}\n\n\treturn new Element(tag, props1, key, ref, static_);\n}\n\n/** Clones a given element, shallowly copying the props object. */\nexport function cloneElement<TTag extends Tag>(\n\tel: Element<TTag>,\n): Element<TTag> {\n\tif (!isElement(el)) {\n\t\tthrow new TypeError(\"Cannot clone non-element\");\n\t}\n\n\treturn new Element(el.tag, {...el.props}, el.key, el.ref);\n}\n\n/*** ELEMENT UTILITIES ***/\n\n// WHAT ARE WE DOING TO THE CHILDREN???\n/**\n * All values in the element tree are narrowed from the union in Child to\n * NarrowedChild during rendering, to simplify element diffing.\n */\ntype NarrowedChild = Element | string | undefined;\n\nfunction narrow(value: Children): NarrowedChild {\n\tif (typeof value === \"boolean\" || value == null) {\n\t\treturn undefined;\n\t} else if (typeof value === \"string\" || isElement(value)) {\n\t\treturn value;\n\t} else if (typeof (value as any)[Symbol.iterator] === \"function\") {\n\t\treturn createElement(Fragment, null, value);\n\t}\n\n\treturn value.toString();\n}\n\n/**\n * A helper type which repesents all possible rendered values of an element.\n *\n * @template TNode - The node type for the element provided by the renderer.\n *\n * When asking the question, what is the “value” of a specific element, the\n * answer varies depending on the tag:\n *\n * For host elements, the value is the nodes created for the element.\n *\n * For fragments, the value is usually an array of nodes.\n *\n * For portals, the value is undefined, because a Portal element’s root and\n * children are opaque to its parent.\n *\n * For components, the value can be any of the above, because the value of a\n * component is determined by its immediate children.\n *\n * Rendered values can also be strings or arrays of nodes and strings, in the\n * case of component or fragment elements with strings or multiple children.\n *\n * All of these possible values are reflected in this utility type.\n */\nexport type ElementValue<TNode> =\n\t| Array<TNode | string>\n\t| TNode\n\t| string\n\t| undefined;\n\n/**\n * Takes an array of element values and normalizes the output as an array of\n * nodes and strings.\n *\n * @returns Normalized array of nodes and/or strings.\n *\n * Normalize will flatten only one level of nested arrays, because it is\n * designed to be called once at each level of the tree. It will also\n * concatenate adjacent strings and remove all undefined values.\n */\nfunction normalize<TNode>(\n\tvalues: Array<ElementValue<TNode>>,\n): Array<TNode | string> {\n\tconst result: Array<TNode | string> = [];\n\tlet buffer: string | undefined;\n\tfor (let i = 0; i < values.length; i++) {\n\t\tconst value = values[i];\n\t\tif (!value) {\n\t\t\t// pass\n\t\t} else if (typeof value === \"string\") {\n\t\t\tbuffer = (buffer || \"\") + value;\n\t\t} else if (!Array.isArray(value)) {\n\t\t\tif (buffer) {\n\t\t\t\tresult.push(buffer);\n\t\t\t\tbuffer = undefined;\n\t\t\t}\n\n\t\t\tresult.push(value);\n\t\t} else {\n\t\t\t// We could use recursion here but it’s just easier to do it inline.\n\t\t\tfor (let j = 0; j < value.length; j++) {\n\t\t\t\tconst value1 = value[j];\n\t\t\t\tif (!value1) {\n\t\t\t\t\t// pass\n\t\t\t\t} else if (typeof value1 === \"string\") {\n\t\t\t\t\tbuffer = (buffer || \"\") + value1;\n\t\t\t\t} else {\n\t\t\t\t\tif (buffer) {\n\t\t\t\t\t\tresult.push(buffer);\n\t\t\t\t\t\tbuffer = undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tresult.push(value1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (buffer) {\n\t\tresult.push(buffer);\n\t}\n\n\treturn result;\n}\n\n/**\n * @internal\n * The internal nodes which are cached and diffed against new elements when\n * rendering element trees.\n */\nclass Retainer<TNode> {\n\t/**\n\t * The element associated with this retainer.\n\t */\n\tdeclare el: Element;\n\t/**\n\t * The context associated with this element. Will only be defined for\n\t * component elements.\n\t */\n\tdeclare ctx: ContextImpl<TNode> | undefined;\n\t/**\n\t * The retainer children of this element. Retainers form a tree which mirrors\n\t * elements. Can be a single child or undefined as a memory optimization.\n\t */\n\tdeclare children: Array<RetainerChild<TNode>> | RetainerChild<TNode>;\n\t/**\n\t * The value associated with this element.\n\t */\n\tdeclare value: ElementValue<TNode>;\n\t/**\n\t * The cached child values of this element. Only host and component elements\n\t * will use this property.\n\t */\n\tdeclare cachedChildValues: ElementValue<TNode>;\n\t/**\n\t * The child which this retainer replaces. This property is used when an\n\t * async retainer tree replaces previously rendered elements, so that the\n\t * previously rendered elements can remain visible until the async tree\n\t * fulfills. Will be set to undefined once this subtree fully renders.\n\t */\n\tdeclare fallbackValue: RetainerChild<TNode>;\n\n\tdeclare inflightValue: Promise<ElementValue<TNode>> | undefined;\n\tdeclare onNextValues: Function | undefined;\n\tconstructor(el: Element) {\n\t\tthis.el = el;\n\t\tthis.ctx = undefined;\n\t\tthis.children = undefined;\n\t\tthis.value = undefined;\n\t\tthis.cachedChildValues = undefined;\n\t\tthis.fallbackValue = undefined;\n\t\tthis.inflightValue = undefined;\n\t\tthis.onNextValues = undefined;\n\t}\n}\n\n/**\n * The retainer equivalent of ElementValue\n */\ntype RetainerChild<TNode> = Retainer<TNode> | string | undefined;\n\n/**\n * Finds the value of the element according to its type.\n *\n * @returns The value of the element.\n */\nfunction getValue<TNode>(ret: Retainer<TNode>): ElementValue<TNode> {\n\tif (typeof ret.fallbackValue !== \"undefined\") {\n\t\treturn typeof ret.fallbackValue === \"object\"\n\t\t\t? getValue(ret.fallbackValue)\n\t\t\t: ret.fallbackValue;\n\t} else if (ret.el.tag === Portal) {\n\t\treturn;\n\t} else if (typeof ret.el.tag !== \"function\" && ret.el.tag !== Fragment) {\n\t\treturn ret.value;\n\t}\n\n\treturn unwrap(getChildValues(ret));\n}\n\n/**\n * Walks an element’s children to find its child values.\n *\n * @returns A normalized array of nodes and strings.\n */\nfunction getChildValues<TNode>(ret: Retainer<TNode>): Array<TNode | string> {\n\tif (ret.cachedChildValues) {\n\t\treturn wrap(ret.cachedChildValues);\n\t}\n\n\tconst values: Array<ElementValue<TNode>> = [];\n\tconst children = wrap(ret.children);\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (child) {\n\t\t\tvalues.push(typeof child === \"string\" ? child : getValue(child));\n\t\t}\n\t}\n\n\tconst values1 = normalize(values);\n\tconst tag = ret.el.tag;\n\tif (typeof tag === \"function\" || (tag !== Fragment && tag !== Raw)) {\n\t\tret.cachedChildValues = unwrap(values1);\n\t}\n\treturn values1;\n}\n\nexport interface HydrationData<TNode> {\n\tprops: Record<string, unknown>;\n\tchildren: Array<TNode | string>;\n}\n\n// TODO: Document the interface and methods\nexport interface RendererImpl<\n\tTNode,\n\tTScope,\n\tTRoot extends TNode = TNode,\n\tTResult = ElementValue<TNode>,\n> {\n\tscope<TTag extends string | symbol>(\n\t\tscope: TScope | undefined,\n\t\ttag: TTag,\n\t\tprops: TagProps<TTag>,\n\t): TScope | undefined;\n\n\tcreate<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tprops: TagProps<TTag>,\n\t\tscope: TScope | undefined,\n\t): TNode;\n\n\thydrate<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tnode: TNode | TRoot,\n\t\tprops: TagProps<TTag>,\n\t): HydrationData<TNode> | undefined;\n\n\t/**\n\t * Called when an element’s rendered value is exposed via render, schedule,\n\t * refresh, refs, or generator yield expressions.\n\t *\n\t * @param value - The value of the element being read. Can be a node, a\n\t * string, undefined, or an array of nodes and strings, depending on the\n\t * element.\n\t *\n\t * @returns Varies according to the specific renderer subclass. By default,\n\t * it exposes the element’s value.\n\t *\n\t * This is useful for renderers which don’t want to expose their internal\n\t * nodes. For instance, the HTML renderer will convert all internal nodes to\n\t * strings.\n\t */\n\tread(value: ElementValue<TNode>): TResult;\n\n\t/**\n\t * Called for each string in an element tree.\n\t *\n\t * @param text - The string child.\n\t * @param scope - The current scope.\n\t *\n\t * @returns A string to be passed to arrange.\n\t *\n\t * Rather than returning Text nodes as we would in the DOM case, for example,\n\t * we delay that step for Renderer.prototype.arrange. We do this so that\n\t * adjacent strings can be concatenated, and the actual element tree can be\n\t * rendered in normalized form.\n\t */\n\ttext(\n\t\ttext: string,\n\t\tscope: TScope | undefined,\n\t\thydration: HydrationData<TNode> | undefined,\n\t): string;\n\n\t/**\n\t * Called for each Raw element whose value prop is a string.\n\t *\n\t * @param text - The string child.\n\t * @param scope - The current scope.\n\t *\n\t * @returns The parsed node or string.\n\t */\n\traw(\n\t\tvalue: string | TNode,\n\t\tscope: TScope | undefined,\n\t\thydration: HydrationData<TNode> | undefined,\n\t): ElementValue<TNode>;\n\n\tpatch<TTag extends string | symbol, TName extends string>(\n\t\ttag: TTag,\n\t\tnode: TNode,\n\t\tname: TName,\n\t\tvalue: TagProps<TTag>[TName],\n\t\toldValue: TagProps<TTag>[TName] | undefined,\n\t\tscope: TScope,\n\t): unknown;\n\n\tarrange<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tnode: TNode,\n\t\tprops: TagProps<TTag>,\n\t\tchildren: Array<TNode | string>,\n\t\toldProps: TagProps<TTag> | undefined,\n\t\toldChildren: Array<TNode | string> | undefined,\n\t): unknown;\n\n\tdispose<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tnode: TNode,\n\t\tprops: TagProps<TTag>,\n\t): unknown;\n\n\tflush(root: TRoot): unknown;\n}\n\nconst defaultRendererImpl: RendererImpl<unknown, unknown, unknown, unknown> = {\n\tcreate() {\n\t\tthrow new Error(\"Not implemented\");\n\t},\n\thydrate() {\n\t\tthrow new Error(\"Not implemented\");\n\t},\n\tscope: IDENTITY,\n\tread: IDENTITY,\n\ttext: IDENTITY,\n\traw: IDENTITY,\n\tpatch: NOOP,\n\tarrange: NOOP,\n\tdispose: NOOP,\n\tflush: NOOP,\n};\n\nconst _RendererImpl = Symbol.for(\"crank.RendererImpl\");\n/**\n * An abstract class which is subclassed to render to different target\n * environments. This class is responsible for kicking off the rendering\n * process and caching previous trees by root.\n *\n * @template TNode - The type of the node for a rendering environment.\n * @template TScope - Data which is passed down the tree.\n * @template TRoot - The type of the root for a rendering environment.\n * @template TResult - The type of exposed values.\n */\nexport class Renderer<\n\tTNode extends object = object,\n\tTScope = unknown,\n\tTRoot extends TNode = TNode,\n\tTResult = ElementValue<TNode>,\n> {\n\t/**\n\t * @internal\n\t * A weakmap which stores element trees by root.\n\t */\n\tdeclare cache: WeakMap<object, Retainer<TNode>>;\n\n\tdeclare [_RendererImpl]: RendererImpl<TNode, TScope, TRoot, TResult>;\n\tconstructor(impl: Partial<RendererImpl<TNode, TScope, TRoot, TResult>>) {\n\t\tthis.cache = new WeakMap();\n\t\tthis[_RendererImpl] = {\n\t\t\t...(defaultRendererImpl as RendererImpl<TNode, TScope, TRoot, TResult>),\n\t\t\t...impl,\n\t\t};\n\t}\n\n\t/**\n\t * Renders an element tree into a specific root.\n\t *\n\t * @param children - An element tree. You can render null with a previously\n\t * used root to delete the previously rendered element tree from the cache.\n\t * @param root - The node to be rendered into. The renderer will cache\n\t * element trees per root.\n\t * @param bridge - An optional context that will be the ancestor context of all\n\t * elements in the tree. Useful for connecting different renderers so that\n\t * events/provisions properly propagate. The context for a given root must be\n\t * the same or an error will be thrown.\n\t *\n\t * @returns The result of rendering the children, or a possible promise of\n\t * the result if the element tree renders asynchronously.\n\t */\n\trender(\n\t\tchildren: Children,\n\t\troot?: TRoot | undefined,\n\t\tbridge?: Context | undefined,\n\t): Promise<TResult> | TResult {\n\t\tlet ret: Retainer<TNode> | undefined;\n\t\tconst ctx = bridge && (bridge[_ContextImpl] as ContextImpl<TNode>);\n\t\tif (typeof root === \"object\" && root !== null) {\n\t\t\tret = this.cache.get(root);\n\t\t}\n\n\t\tlet oldProps: Record<string, any> | undefined;\n\t\tif (ret === undefined) {\n\t\t\tret = new Retainer(createElement(Portal, {children, root}));\n\t\t\tret.value = root;\n\t\t\tret.ctx = ctx;\n\t\t\tif (typeof root === \"object\" && root !== null && children != null) {\n\t\t\t\tthis.cache.set(root, ret);\n\t\t\t}\n\t\t} else if (ret.ctx !== ctx) {\n\t\t\tthrow new Error(\"Context mismatch\");\n\t\t} else {\n\t\t\toldProps = ret.el.props;\n\t\t\tret.el = createElement(Portal, {children, root});\n\t\t\tif (typeof root === \"object\" && root !== null && children == null) {\n\t\t\t\tthis.cache.delete(root);\n\t\t\t}\n\t\t}\n\n\t\tconst impl = this[_RendererImpl];\n\t\tconst childValues = diffChildren(\n\t\t\timpl,\n\t\t\troot,\n\t\t\tret,\n\t\t\tctx,\n\t\t\timpl.scope(undefined, Portal, ret.el.props),\n\t\t\tret,\n\t\t\tchildren,\n\t\t\tundefined, // hydration data\n\t\t);\n\n\t\t// We return the child values of the portal because portal elements\n\t\t// themselves have no readable value.\n\t\tif (isPromiseLike(childValues)) {\n\t\t\treturn childValues.then((childValues) =>\n\t\t\t\tcommitRootRender(impl, root, ctx, ret!, childValues, oldProps),\n\t\t\t);\n\t\t}\n\n\t\treturn commitRootRender(impl, root, ctx, ret, childValues, oldProps);\n\t}\n\n\thydrate(\n\t\tchildren: Children,\n\t\troot: TRoot,\n\t\tbridge?: Context | undefined,\n\t): Promise<TResult> | TResult {\n\t\tconst impl = this[_RendererImpl];\n\t\tconst ctx = bridge && (bridge[_ContextImpl] as ContextImpl<TNode>);\n\t\tlet ret: Retainer<TNode> | undefined;\n\t\tret = this.cache.get(root);\n\t\tif (ret !== undefined) {\n\t\t\t// If there is a retainer for the root, hydration is not necessary.\n\t\t\treturn this.render(children, root, bridge);\n\t\t}\n\n\t\tlet oldProps: Record<string, any> | undefined;\n\t\tret = new Retainer(createElement(Portal, {children, root}));\n\t\tret.value = root;\n\t\tif (typeof root === \"object\" && root !== null && children != null) {\n\t\t\tthis.cache.set(root, ret);\n\t\t}\n\n\t\tconst hydrationData = impl.hydrate(Portal, root, {});\n\t\tconst childValues = diffChildren(\n\t\t\timpl,\n\t\t\troot,\n\t\t\tret,\n\t\t\tctx,\n\t\t\timpl.scope(undefined, Portal, ret.el.props),\n\t\t\tret,\n\t\t\tchildren,\n\t\t\thydrationData,\n\t\t);\n\n\t\t// We return the child values of the portal because portal elements\n\t\t// themselves have no readable value.\n\t\tif (isPromiseLike(childValues)) {\n\t\t\treturn childValues.then((childValues) =>\n\t\t\t\tcommitRootRender(impl, root, ctx, ret!, childValues, oldProps),\n\t\t\t);\n\t\t}\n\n\t\treturn commitRootRender(impl, root, ctx, ret, childValues, oldProps);\n\t}\n}\n\n/*** PRIVATE RENDERER FUNCTIONS ***/\nfunction commitRootRender<TNode, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, unknown, TRoot, TResult>,\n\troot: TRoot | undefined,\n\tctx: ContextImpl<TNode> | undefined,\n\tret: Retainer<TNode>,\n\tchildValues: Array<TNode | string>,\n\toldProps: Record<string, any> | undefined,\n): TResult {\n\t// element is a host or portal element\n\tif (root != null) {\n\t\trenderer.arrange(\n\t\t\tPortal,\n\t\t\troot,\n\t\t\tret.el.props,\n\t\t\tchildValues,\n\t\t\toldProps,\n\t\t\twrap(ret.cachedChildValues),\n\t\t);\n\t\tflush(renderer, root);\n\t}\n\n\tret.cachedChildValues = unwrap(childValues);\n\tif (root == null) {\n\t\tunmount(renderer, ret, ctx, ret);\n\t}\n\n\treturn renderer.read(ret.cachedChildValues);\n}\n\nfunction diffChildren<TNode, TScope, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\troot: TRoot | undefined,\n\thost: Retainer<TNode>,\n\tctx: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\tscope: TScope | undefined,\n\tparent: Retainer<TNode>,\n\tchildren: Children,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<Array<TNode | string>> | Array<TNode | string> {\n\tconst oldRetained = wrap(parent.children);\n\tconst newRetained: typeof oldRetained = [];\n\tconst newChildren = arrayify(children);\n\tconst values: Array<Promise<ElementValue<TNode>> | ElementValue<TNode>> = [];\n\tlet graveyard: Array<Retainer<TNode>> | undefined;\n\tlet childrenByKey: Map<Key, Retainer<TNode>> | undefined;\n\tlet seenKeys: Set<Key> | undefined;\n\tlet isAsync = false;\n\tlet hydrationBlock: Promise<unknown> | undefined;\n\tlet oi = 0;\n\tlet oldLength = oldRetained.length;\n\tfor (let ni = 0, newLength = newChildren.length; ni < newLength; ni++) {\n\t\t// length checks to prevent index out of bounds deoptimizations.\n\t\tlet ret = oi >= oldLength ? undefined : oldRetained[oi];\n\t\tlet child = narrow(newChildren[ni]);\n\t\t{\n\t\t\t// aligning new children with old retainers\n\t\t\tlet oldKey = typeof ret === \"object\" ? ret.el.key : undefined;\n\t\t\tlet newKey = typeof child === \"object\" ? child.key : undefined;\n\t\t\tif (newKey !== undefined && seenKeys && seenKeys.has(newKey)) {\n\t\t\t\tconsole.error(\"Duplicate key\", newKey);\n\t\t\t\tnewKey = undefined;\n\t\t\t}\n\n\t\t\tif (oldKey === newKey) {\n\t\t\t\tif (childrenByKey !== undefined && newKey !== undefined) {\n\t\t\t\t\tchildrenByKey.delete(newKey);\n\t\t\t\t}\n\n\t\t\t\toi++;\n\t\t\t} else {\n\t\t\t\tchildrenByKey = childrenByKey || createChildrenByKey(oldRetained, oi);\n\t\t\t\tif (newKey === undefined) {\n\t\t\t\t\twhile (ret !== undefined && oldKey !== undefined) {\n\t\t\t\t\t\toi++;\n\t\t\t\t\t\tret = oldRetained[oi];\n\t\t\t\t\t\toldKey = typeof ret === \"object\" ? ret.el.key : undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\toi++;\n\t\t\t\t} else {\n\t\t\t\t\tret = childrenByKey.get(newKey);\n\t\t\t\t\tif (ret !== undefined) {\n\t\t\t\t\t\tchildrenByKey.delete(newKey);\n\t\t\t\t\t}\n\n\t\t\t\t\t(seenKeys = seenKeys || new Set()).add(newKey);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Updating\n\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\tif (typeof child === \"object\") {\n\t\t\tif (child.tag === Copy) {\n\t\t\t\tvalue = getInflightValue(ret);\n\t\t\t} else {\n\t\t\t\tlet oldProps: Record<string, any> | undefined;\n\t\t\t\tlet static_ = false;\n\t\t\t\tif (typeof ret === \"object\" && ret.el.tag === child.tag) {\n\t\t\t\t\toldProps = ret.el.props;\n\t\t\t\t\tret.el = child;\n\t\t\t\t\tif (child.static_) {\n\t\t\t\t\t\tvalue = getInflightValue(ret);\n\t\t\t\t\t\tstatic_ = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof ret === \"object\") {\n\t\t\t\t\t\t(graveyard = graveyard || []).push(ret);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst fallback = ret;\n\t\t\t\t\tret = new Retainer<TNode>(child);\n\t\t\t\t\tret.fallbackValue = fallback;\n\t\t\t\t}\n\n\t\t\t\tif (static_) {\n\t\t\t\t\t// pass\n\t\t\t\t} else if (child.tag === Raw) {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateRaw(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: updateRaw(renderer, ret, scope, oldProps, hydrationData);\n\t\t\t\t} else if (child.tag === Fragment) {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateFragment(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: updateFragment(\n\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t );\n\t\t\t\t} else if (typeof child.tag === \"function\") {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateComponent(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: updateComponent(\n\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateHost(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: updateHost(\n\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst ref = child.ref;\n\t\t\tif (isPromiseLike(value)) {\n\t\t\t\tisAsync = true;\n\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\tvalue = value.then((value) => {\n\t\t\t\t\t\tref(renderer.read(value));\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (hydrationData !== undefined) {\n\t\t\t\t\thydrationBlock = value;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\tref(renderer.read(value));\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// child is a string or undefined\n\t\t\tif (typeof ret === \"object\") {\n\t\t\t\t(graveyard = graveyard || []).push(ret);\n\t\t\t}\n\n\t\t\tif (typeof child === \"string\") {\n\t\t\t\tvalue = ret = renderer.text(child, scope, hydrationData);\n\t\t\t} else {\n\t\t\t\tret = undefined;\n\t\t\t}\n\t\t}\n\n\t\tvalues[ni] = value;\n\t\tnewRetained[ni] = ret;\n\t}\n\n\t// cleanup remaining retainers\n\tfor (; oi < oldLength; oi++) {\n\t\tconst ret = oldRetained[oi];\n\t\tif (typeof ret === \"object\") {\n\t\t\t(graveyard = graveyard || []).push(ret);\n\t\t}\n\t}\n\n\tif (childrenByKey !== undefined && childrenByKey.size > 0) {\n\t\t(graveyard = graveyard || []).push(...childrenByKey.values());\n\t}\n\n\tparent.children = unwrap(newRetained);\n\tif (isAsync) {\n\t\tlet childValues1 = Promise.all(values).finally(() => {\n\t\t\tif (graveyard) {\n\t\t\t\tfor (let i = 0; i < graveyard.length; i++) {\n\t\t\t\t\tunmount(renderer, host, ctx, graveyard[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tlet onChildValues!: Function;\n\t\tchildValues1 = Promise.race([\n\t\t\tchildValues1,\n\t\t\tnew Promise<any>((resolve) => (onChildValues = resolve)),\n\t\t]);\n\n\t\tif (parent.onNextValues) {\n\t\t\tparent.onNextValues(childValues1);\n\t\t}\n\n\t\tparent.onNextValues = onChildValues;\n\t\treturn childValues1.then((childValues) => {\n\t\t\tparent.inflightValue = parent.fallbackValue = undefined;\n\t\t\treturn normalize(childValues);\n\t\t});\n\t} else {\n\t\tif (graveyard) {\n\t\t\tfor (let i = 0; i < graveyard.length; i++) {\n\t\t\t\tunmount(renderer, host, ctx, graveyard[i]);\n\t\t\t}\n\t\t}\n\n\t\tif (parent.onNextValues) {\n\t\t\tparent.onNextValues(values);\n\t\t\tparent.onNextValues = undefined;\n\t\t}\n\n\t\tparent.inflightValue = parent.fallbackValue = undefined;\n\t\t// We can assert there are no promises in the array because isAsync is false\n\t\treturn normalize(values as Array<ElementValue<TNode>>);\n\t}\n}\n\nfunction createChildrenByKey<TNode>(\n\tchildren: Array<RetainerChild<TNode>>,\n\toffset: number,\n): Map<Key, Retainer<TNode>> {\n\tconst childrenByKey = new Map<Key, Retainer<TNode>>();\n\tfor (let i = offset; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (typeof child === \"object\" && typeof child.el.key !== \"undefined\") {\n\t\t\tchildrenByKey.set(child.el.key, child);\n\t\t}\n\t}\n\n\treturn childrenByKey;\n}\n\nfunction getInflightValue<TNode>(\n\tchild: RetainerChild<TNode>,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (typeof child !== \"object\") {\n\t\treturn child;\n\t}\n\n\tconst ctx: ContextImpl<TNode> | undefined =\n\t\ttypeof child.el.tag === \"function\" ? child.ctx : undefined;\n\tif (ctx && ctx.f & IsUpdating && ctx.inflightValue) {\n\t\treturn ctx.inflightValue;\n\t} else if (child.inflightValue) {\n\t\treturn child.inflightValue;\n\t}\n\n\treturn getValue(child);\n}\n\nfunction updateRaw<TNode, TScope>(\n\trenderer: RendererImpl<TNode, TScope, TNode, unknown>,\n\tret: Retainer<TNode>,\n\tscope: TScope | undefined,\n\toldProps: Record<string, any> | undefined,\n\thydrationData: HydrationData<TNode> | undefined,\n): ElementValue<TNode> {\n\tconst props = ret.el.props;\n\tif (!oldProps || oldProps.value !== props.value) {\n\t\tret.value = renderer.raw(props.value, scope, hydrationData);\n\t}\n\n\treturn ret.value;\n}\n\nfunction updateFragment<TNode, TScope, TRoot extends TNode>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, unknown>,\n\troot: TRoot | undefined,\n\thost: Retainer<TNode>,\n\tctx: ContextImpl<TNode, TScope, TRoot> | undefined,\n\tscope: TScope | undefined,\n\tret: Retainer<TNode>,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tconst childValues = diffChildren(\n\t\trenderer,\n\t\troot,\n\t\thost,\n\t\tctx,\n\t\tscope,\n\t\tret,\n\t\tret.el.props.children,\n\t\thydrationData,\n\t);\n\n\tif (isPromiseLike(childValues)) {\n\t\tret.inflightValue = childValues.then((childValues) => unwrap(childValues));\n\t\treturn ret.inflightValue;\n\t}\n\n\treturn unwrap(childValues);\n}\n\nfunction updateHost<TNode, TScope, TRoot extends TNode>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, unknown>,\n\troot: TRoot | undefined,\n\tctx: ContextImpl<TNode, TScope, TRoot> | undefined,\n\tscope: TScope | undefined,\n\tret: Retainer<TNode>,\n\toldProps: Record<string, any> | undefined,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tconst el = ret.el;\n\tconst tag = el.tag as string | symbol;\n\tlet hydrationValue: TNode | string | undefined;\n\tif (el.tag === Portal) {\n\t\troot = ret.value = el.props.root;\n\t} else {\n\t\tif (hydrationData !== undefined) {\n\t\t\tconst value = hydrationData.children.shift();\n\t\t\thydrationValue = value;\n\t\t}\n\t}\n\n\tscope = renderer.scope(scope, tag, el.props);\n\tlet childHydrationData: HydrationData<TNode> | undefined;\n\tif (hydrationValue != null && typeof hydrationValue !== \"string\") {\n\t\tchildHydrationData = renderer.hydrate(tag, hydrationValue, el.props);\n\n\t\tif (childHydrationData === undefined) {\n\t\t\thydrationValue = undefined;\n\t\t}\n\t}\n\tconst childValues = diffChildren(\n\t\trenderer,\n\t\troot,\n\t\tret,\n\t\tctx,\n\t\tscope,\n\t\tret,\n\t\tret.el.props.children,\n\t\tchildHydrationData,\n\t);\n\n\tif (isPromiseLike(childValues)) {\n\t\tret.inflightValue = childValues.then((childValues) =>\n\t\t\tcommitHost(renderer, scope, ret, childValues, oldProps, hydrationValue),\n\t\t);\n\n\t\treturn ret.inflightValue;\n\t}\n\n\treturn commitHost(\n\t\trenderer,\n\t\tscope,\n\t\tret,\n\t\tchildValues,\n\t\toldProps,\n\t\thydrationValue,\n\t);\n}\n\nfunction commitHost<TNode, TScope>(\n\trenderer: RendererImpl<TNode, TScope, TNode, unknown>,\n\tscope: TScope,\n\tret: Retainer<TNode>,\n\tchildValues: Array<TNode | string>,\n\toldProps: Record<string, any> | undefined,\n\thydrationValue: TNode | undefined,\n): ElementValue<TNode> {\n\tconst tag = ret.el.tag as string | symbol;\n\tlet value = ret.value as TNode;\n\tif (hydrationValue != null) {\n\t\tvalue = ret.value = hydrationValue;\n\t}\n\n\tlet props = ret.el.props;\n\tlet copied: Set<string> | undefined;\n\tif (tag !== Portal) {\n\t\tif (value == null) {\n\t\t\t// This assumes that renderer.create does not return nullish values.\n\t\t\tvalue = ret.value = renderer.create(tag, props, scope);\n\t\t}\n\n\t\tfor (const propName in {...oldProps, ...props}) {\n\t\t\tconst propValue = props[propName];\n\t\t\tif (propValue === Copy) {\n\t\t\t\t// TODO: The Copy tag doubles as a way to skip the patching of a prop.\n\t\t\t\t// Not sure about this feature. Should probably be removed.\n\t\t\t\t(copied = copied || new Set()).add(propName);\n\t\t\t} else if (propName !== \"children\") {\n\t\t\t\trenderer.patch(\n\t\t\t\t\ttag,\n\t\t\t\t\tvalue,\n\t\t\t\t\tpropName,\n\t\t\t\t\tpropValue,\n\t\t\t\t\toldProps && oldProps[propName],\n\t\t\t\t\tscope,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (copied) {\n\t\tprops = {...ret.el.props};\n\t\tfor (const name of copied) {\n\t\t\tprops[name] = oldProps && oldProps[name];\n\t\t}\n\n\t\tret.el = new Element(tag, props, ret.el.key, ret.el.ref);\n\t}\n\n\trenderer.arrange(\n\t\ttag,\n\t\tvalue,\n\t\tprops,\n\t\tchildValues,\n\t\toldProps,\n\t\twrap(ret.cachedChildValues),\n\t);\n\tret.cachedChildValues = unwrap(childValues);\n\tif (tag === Portal) {\n\t\tflush(renderer, ret.value);\n\t\treturn;\n\t}\n\n\treturn value;\n}\n\nfunction flush<TRoot>(\n\trenderer: RendererImpl<unknown, unknown, TRoot>,\n\troot: TRoot,\n\tinitiator?: ContextImpl,\n) {\n\trenderer.flush(root);\n\tif (typeof root !== \"object\" || root === null) {\n\t\treturn;\n\t}\n\n\tconst flushMap = flushMaps.get(root as any);\n\tif (flushMap) {\n\t\tif (initiator) {\n\t\t\tconst flushMap1 = new Map<ContextImpl, Set<Function>>();\n\t\t\tfor (let [ctx, callbacks] of flushMap) {\n\t\t\t\tif (!ctxContains(initiator, ctx)) {\n\t\t\t\t\tflushMap.delete(ctx);\n\t\t\t\t\tflushMap1.set(ctx, callbacks);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (flushMap1.size) {\n\t\t\t\tflushMaps.set(root as any, flushMap1);\n\t\t\t} else {\n\t\t\t\tflushMaps.delete(root as any);\n\t\t\t}\n\t\t} else {\n\t\t\tflushMaps.delete(root as any);\n\t\t}\n\n\t\tfor (const [ctx, callbacks] of flushMap) {\n\t\t\tconst value = renderer.read(getValue(ctx.ret));\n\t\t\tfor (const callback of callbacks) {\n\t\t\t\tcallback(value);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction unmount<TNode, TScope, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\thost: Retainer<TNode>,\n\tctx: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\tret: Retainer<TNode>,\n): void {\n\tif (typeof ret.el.tag === \"function\") {\n\t\tctx = ret.ctx as ContextImpl<TNode, TScope, TRoot, TResult>;\n\t\tunmountComponent(ctx);\n\t} else if (ret.el.tag === Portal) {\n\t\thost = ret;\n\t\trenderer.arrange(\n\t\t\tPortal,\n\t\t\thost.value as TNode,\n\t\t\thost.el.props,\n\t\t\t[],\n\t\t\thost.el.props,\n\t\t\twrap(host.cachedChildValues),\n\t\t);\n\t\tflush(renderer, host.value);\n\t} else if (ret.el.tag !== Fragment) {\n\t\tif (isEventTarget(ret.value)) {\n\t\t\tconst records = getListenerRecords(ctx, host);\n\t\t\tfor (let i = 0; i < records.length; i++) {\n\t\t\t\tconst record = records[i];\n\t\t\t\tret.value.removeEventListener(\n\t\t\t\t\trecord.type,\n\t\t\t\t\trecord.callback,\n\t\t\t\t\trecord.options,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\trenderer.dispose(ret.el.tag, ret.value as TNode, ret.el.props);\n\t\thost = ret;\n\t}\n\n\tconst children = wrap(ret.children);\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (typeof child === \"object\") {\n\t\t\tunmount(renderer, host, ctx, child);\n\t\t}\n\t}\n}\n\n/*** CONTEXT FLAGS ***/\n/**\n * A flag which is true when the component is initialized or updated by an\n * ancestor component or the root render call.\n *\n * Used to determine things like whether the nearest host ancestor needs to be\n * rearranged.\n */\nconst IsUpdating = 1 << 0;\n\n/**\n * A flag which is true when the component is synchronously executing.\n *\n * Used to guard against components triggering stack overflow or generator error.\n */\nconst IsSyncExecuting = 1 << 1;\n\n/**\n * A flag which is true when the component is in a for...of loop.\n */\nconst IsInForOfLoop = 1 << 2;\n\n/**\n * A flag which is true when the component is in a for await...of loop.\n */\nconst IsInForAwaitOfLoop = 1 << 3;\n\n/**\n * A flag which is true when the component starts the render loop but has not\n * yielded yet.\n *\n * Used to make sure that components yield at least once per loop.\n */\nconst NeedsToYield = 1 << 4;\n\n/**\n * A flag used by async generator components in conjunction with the\n * onAvailable callback to mark whether new props can be pulled via the context\n * async iterator. See the Symbol.asyncIterator method and the\n * resumeCtxIterator function.\n */\nconst PropsAvailable = 1 << 5;\n\n/**\n * A flag which is set when a component errors.\n *\n * NOTE: This is mainly used to prevent some false positives in component\n * yields or returns undefined warnings. The reason we’re using this versus\n * IsUnmounted is a very troubling test (cascades sync generator parent and\n * sync generator child) where synchronous code causes a stack overflow error\n * in a non-deterministic way. Deeply disturbing stuff.\n */\nconst IsErrored = 1 << 6;\n\n/**\n * A flag which is set when the component is unmounted. Unmounted components\n * are no longer in the element tree and cannot refresh or rerender.\n */\nconst IsUnmounted = 1 << 7;\n\n/**\n * A flag which indicates that the component is a sync generator component.\n */\nconst IsSyncGen = 1 << 8;\n\n/**\n * A flag which indicates that the component is an async generator component.\n */\nconst IsAsyncGen = 1 << 9;\n\n/**\n * A flag which is set while schedule callbacks are called.\n */\nconst IsScheduling = 1 << 10;\n\n/**\n * A flag which is set when a schedule callback calls refresh.\n */\nconst IsSchedulingRefresh = 1 << 11;\n\nexport interface Context extends Crank.Context {}\n\n/**\n * An interface which can be extended to provide strongly typed provisions.\n * See Context.prototype.consume and Context.prototype.provide.\n */\nexport interface ProvisionMap extends Crank.ProvisionMap {}\n\nconst provisionMaps = new WeakMap<ContextImpl, Map<unknown, unknown>>();\n\nconst scheduleMap = new WeakMap<ContextImpl, Set<Function>>();\n\nconst cleanupMap = new WeakMap<ContextImpl, Set<Function>>();\n\n// keys are roots\nconst flushMaps = new WeakMap<object, Map<ContextImpl, Set<Function>>>();\n\n/**\n * @internal\n * The internal class which holds context data.\n */\nclass ContextImpl<\n\tTNode = unknown,\n\tTScope = unknown,\n\tTRoot extends TNode = TNode,\n\tTResult = unknown,\n> {\n\t/** A bitmask. See CONTEXT FLAGS above. */\n\tdeclare f: number;\n\n\t/** The actual context associated with this impl. */\n\tdeclare owner: Context<unknown, TResult>;\n\n\t/**\n\t * The renderer which created this context.\n\t */\n\tdeclare renderer: RendererImpl<TNode, TScope, TRoot, TResult>;\n\n\t/** The root node as set by the nearest ancestor portal. */\n\tdeclare root: TRoot | undefined;\n\n\t/**\n\t * The nearest ancestor host or portal retainer.\n\t *\n\t * When refresh is called, the host element will be arranged as the last step\n\t * of the commit, to make sure the parent’s children properly reflects the\n\t * components’s children.\n\t */\n\tdeclare host: Retainer<TNode>;\n\n\t/** The parent context impl. */\n\tdeclare parent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined;\n\n\t/** The value of the scope at the point of element’s creation. */\n\tdeclare scope: TScope | undefined;\n\n\t/** The internal node associated with this context. */\n\tdeclare ret: Retainer<TNode>;\n\n\t/**\n\t * The iterator returned by the component function.\n\t *\n\t * Existence of this property implies that the component is a generator\n\t * component. It is deleted when a component is returned.\n\t */\n\tdeclare iterator:\n\t\t| Iterator<Children, Children | void, unknown>\n\t\t| AsyncIterator<Children, Children | void, unknown>\n\t\t| undefined;\n\n\t// The following properties are used to implement the\n\tdeclare inflightBlock: Promise<unknown> | undefined;\n\tdeclare inflightValue: Promise<ElementValue<TNode>> | undefined;\n\tdeclare enqueuedBlock: Promise<unknown> | undefined;\n\tdeclare enqueuedValue: Promise<ElementValue<TNode>> | undefined;\n\n\t// The following callbacks are used to implement the async generator render\n\t// loop behavior.\n\tdeclare onProps: ((props: Record<string, any>) => unknown) | undefined;\n\tdeclare onPropsRequested: Function | undefined;\n\tconstructor(\n\t\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\t\troot: TRoot | undefined,\n\t\thost: Retainer<TNode>,\n\t\tparent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\t\tscope: TScope | undefined,\n\t\tret: Retainer<TNode>,\n\t) {\n\t\tthis.f = 0;\n\t\tthis.owner = new Context(this);\n\t\tthis.renderer = renderer;\n\t\tthis.root = root;\n\t\tthis.host = host;\n\t\tthis.parent = parent;\n\t\tthis.scope = scope;\n\t\tthis.ret = ret;\n\n\t\tthis.iterator = undefined;\n\t\tthis.inflightBlock = undefined;\n\t\tthis.inflightValue = undefined;\n\t\tthis.enqueuedBlock = undefined;\n\t\tthis.enqueuedValue = undefined;\n\t\tthis.onProps = undefined;\n\t\tthis.onPropsRequested = undefined;\n\t}\n}\n\nconst _ContextImpl = Symbol.for(\"crank.ContextImpl\");\n\ntype ComponentProps<T> = T extends () => any\n\t? {}\n\t: T extends (props: infer U) => any\n\t? U\n\t: T;\n/**\n * A class which is instantiated and passed to every component as its this\n * value. Contexts form a tree just like elements and all components in the\n * element tree are connected via contexts. Components can use this tree to\n * communicate data upwards via events and downwards via provisions.\n *\n * @template [T=*] - The expected shape of the props passed to the component,\n * or a component function. Used to strongly type the Context iterator methods.\n * @template [TResult=*] - The readable element value type. It is used in\n * places such as the return value of refresh and the argument passed to\n * schedule and cleanup callbacks.\n */\nexport class Context<T = any, TResult = any> implements EventTarget {\n\t/**\n\t * @internal\n\t */\n\tdeclare [_ContextImpl]: ContextImpl<unknown, unknown, unknown, TResult>;\n\n\t// TODO: If we could make the constructor function take a nicer value, it\n\t// would be useful for testing purposes.\n\tconstructor(impl: ContextImpl<unknown, unknown, unknown, TResult>) {\n\t\tthis[_ContextImpl] = impl;\n\t}\n\n\t/**\n\t * The current props of the associated element.\n\t *\n\t * Typically, you should read props either via the first parameter of the\n\t * component or via the context iterator methods. This property is mainly for\n\t * plugins or utilities which wrap contexts.\n\t */\n\tget props(): ComponentProps<T> {\n\t\treturn this[_ContextImpl].ret.el.props;\n\t}\n\n\t// TODO: Should we rename this???\n\t/**\n\t * The current value of the associated element.\n\t *\n\t * Typically, you should read values via refs, generator yield expressions,\n\t * or the refresh, schedule, cleanup, or flush methods. This property is\n\t * mainly for plugins or utilities which wrap contexts.\n\t */\n\tget value(): TResult {\n\t\treturn this[_ContextImpl].renderer.read(getValue(this[_ContextImpl].ret));\n\t}\n\n\t*[Symbol.iterator](): Generator<ComponentProps<T>> {\n\t\tconst ctx = this[_ContextImpl];\n\t\ttry {\n\t\t\tctx.f |= IsInForOfLoop;\n\t\t\twhile (!(ctx.f & IsUnmounted)) {\n\t\t\t\tif (ctx.f & NeedsToYield) {\n\t\t\t\t\tthrow new Error(\"Context iterated twice without a yield\");\n\t\t\t\t} else {\n\t\t\t\t\tctx.f |= NeedsToYield;\n\t\t\t\t}\n\n\t\t\t\tyield ctx.ret.el.props!;\n\t\t\t}\n\t\t} finally {\n\t\t\tctx.f &= ~IsInForOfLoop;\n\t\t}\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncGenerator<ComponentProps<T>> {\n\t\tconst ctx = this[_ContextImpl];\n\t\tif (ctx.f & IsSyncGen) {\n\t\t\tthrow new Error(\"Use for...of in sync generator components\");\n\t\t}\n\n\t\ttry {\n\t\t\tctx.f |= IsInForAwaitOfLoop;\n\t\t\twhile (!(ctx.f & IsUnmounted)) {\n\t\t\t\tif (ctx.f & NeedsToYield) {\n\t\t\t\t\tthrow new Error(\"Context iterated twice without a yield\");\n\t\t\t\t} else {\n\t\t\t\t\tctx.f |= NeedsToYield;\n\t\t\t\t}\n\n\t\t\t\tif (ctx.f & PropsAvailable) {\n\t\t\t\t\tctx.f &= ~PropsAvailable;\n\t\t\t\t\tyield ctx.ret.el.props;\n\t\t\t\t} else {\n\t\t\t\t\tconst props = await new Promise((resolve) => (ctx.onProps = resolve));\n\t\t\t\t\tif (ctx.f & IsUnmounted) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tyield props as ComponentProps<T>;\n\t\t\t\t}\n\n\t\t\t\tif (ctx.onPropsRequested) {\n\t\t\t\t\tctx.onPropsRequested();\n\t\t\t\t\tctx.onPropsRequested = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tctx.f &= ~IsInForAwaitOfLoop;\n\t\t\tif (ctx.onPropsRequested) {\n\t\t\t\tctx.onPropsRequested();\n\t\t\t\tctx.onPropsRequested = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Re-executes a component.\n\t *\n\t * @returns The rendered value of the component or a promise thereof if the\n\t * component or its children execute asynchronously.\n\t *\n\t * The refresh method works a little differently for async generator\n\t * components, in that it will resume the Context’s props async iterator\n\t * rather than resuming execution. This is because async generator components\n\t * are perpetually resumed independent of updates, and rely on the props\n\t * async iterator to suspend.\n\t */\n\trefresh(): Promise<TResult> | TResult {\n\t\tconst ctx = this[_ContextImpl];\n\t\tif (ctx.f & IsUnmounted) {\n\t\t\tconsole.error(\"Component is unmounted\");\n\t\t\treturn ctx.renderer.read(undefined);\n\t\t} else if (ctx.f & IsSyncExecuting) {\n\t\t\tconsole.error(\"Component is already executing\");\n\t\t\treturn this.value;\n\t\t}\n\n\t\tconst value = enqueueComponentRun(ctx);\n\t\tif (isPromiseLike(value)) {\n\t\t\treturn (value as Promise<any>).then((value) => ctx.renderer.read(value));\n\t\t}\n\n\t\treturn ctx.renderer.read(value);\n\t}\n\n\t/**\n\t * Registers a callback which fires when the component commits. Will only\n\t * fire once per callback and update.\n\t */\n\tschedule(callback: (value: TResult) => unknown): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tlet callbacks = scheduleMap.get(ctx);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = new Set<Function>();\n\t\t\tscheduleMap.set(ctx, callbacks);\n\t\t}\n\n\t\tcallbacks.add(callback);\n\t}\n\n\t/**\n\t * Registers a callback which fires when the component’s children are\n\t * rendered into the root. Will only fire once per callback and render.\n\t */\n\tflush(callback: (value: TResult) => unknown): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tif (typeof ctx.root !== \"object\" || ctx.root === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet flushMap = flushMaps.get(ctx.root);\n\t\tif (!flushMap) {\n\t\t\tflushMap = new Map<ContextImpl, Set<Function>>();\n\t\t\tflushMaps.set(ctx.root, flushMap);\n\t\t}\n\n\t\tlet callbacks = flushMap.get(ctx);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = new Set<Function>();\n\t\t\tflushMap.set(ctx, callbacks);\n\t\t}\n\n\t\tcallbacks.add(callback);\n\t}\n\n\t/**\n\t * Registers a callback which fires when the component unmounts. Will only\n\t * fire once per callback.\n\t */\n\tcleanup(callback: (value: TResult) => unknown): void {\n\t\tconst ctx = this[_ContextImpl];\n\n\t\tif (ctx.f & IsUnmounted) {\n\t\t\tconst value = ctx.renderer.read(getValue(ctx.ret));\n\t\t\tcallback(value);\n\t\t\treturn;\n\t\t}\n\n\t\tlet callbacks = cleanupMap.get(ctx);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = new Set<Function>();\n\t\t\tcleanupMap.set(ctx, callbacks);\n\t\t}\n\n\t\tcallbacks.add(callback);\n\t}\n\n\tconsume<TKey extends keyof ProvisionMap>(key: TKey): ProvisionMap[TKey];\n\tconsume(key: unknown): any;\n\tconsume(key: unknown): any {\n\t\tfor (\n\t\t\tlet ctx = this[_ContextImpl].parent;\n\t\t\tctx !== undefined;\n\t\t\tctx = ctx.parent\n\t\t) {\n\t\t\tconst provisions = provisionMaps.get(ctx);\n\t\t\tif (provisions && provisions.has(key)) {\n\t\t\t\treturn provisions.get(key)!;\n\t\t\t}\n\t\t}\n\t}\n\n\tprovide<TKey extends keyof ProvisionMap>(\n\t\tkey: TKey,\n\t\tvalue: ProvisionMap[TKey],\n\t): void;\n\tprovide(key: unknown, value: any): void;\n\tprovide(key: unknown, value: any): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tlet provisions = provisionMaps.get(ctx);\n\t\tif (!provisions) {\n\t\t\tprovisions = new Map();\n\t\t\tprovisionMaps.set(ctx, provisions);\n\t\t}\n\n\t\tprovisions.set(key, value);\n\t}\n\n\taddEventListener<T extends string>(\n\t\ttype: T,\n\t\tlistener: MappedEventListenerOrEventListenerObject<T> | null,\n\t\toptions?: boolean | AddEventListenerOptions,\n\t): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tlet listeners: Array<EventListenerRecord>;\n\t\tif (!isListenerOrListenerObject(listener)) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tconst listeners1 = listenersMap.get(ctx);\n\t\t\tif (listeners1) {\n\t\t\t\tlisteners = listeners1;\n\t\t\t} else {\n\t\t\t\tlisteners = [];\n\t\t\t\tlistenersMap.set(ctx, listeners);\n\t\t\t}\n\t\t}\n\n\t\toptions = normalizeListenerOptions(options);\n\t\tlet callback: MappedEventListener<T>;\n\t\tif (typeof listener === \"object\") {\n\t\t\tcallback = () => listener.handleEvent.apply(listener, arguments as any);\n\t\t} else {\n\t\t\tcallback = listener;\n\t\t}\n\n\t\tconst record: EventListenerRecord = {type, listener, callback, options};\n\t\tif (options.once) {\n\t\t\trecord.callback = function (this: any) {\n\t\t\t\tconst i = listeners.indexOf(record);\n\t\t\t\tif (i !== -1) {\n\t\t\t\t\tlisteners.splice(i, 1);\n\t\t\t\t}\n\n\t\t\t\treturn callback.apply(this, arguments as any);\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tlisteners.some(\n\t\t\t\t(record1) =>\n\t\t\t\t\trecord.type === record1.type &&\n\t\t\t\t\trecord.listener === record1.listener &&\n\t\t\t\t\t!record.options.capture === !record1.options.capture,\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tlisteners.push(record);\n\n\t\t// TODO: is it possible to separate out the EventTarget delegation logic\n\t\tfor (const value of getChildValues(ctx.ret)) {\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tvalue.addEventListener(record.type, record.callback, record.options);\n\t\t\t}\n\t\t}\n\t}\n\n\tremoveEventListener<T extends string>(\n\t\ttype: T,\n\t\tlistener: MappedEventListenerOrEventListenerObject<T> | null,\n\t\toptions?: EventListenerOptions | boolean,\n\t): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tconst listeners = listenersMap.get(ctx);\n\t\tif (listeners == null || !isListenerOrListenerObject(listener)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst options1 = normalizeListenerOptions(options);\n\t\tconst i = listeners.findIndex(\n\t\t\t(record) =>\n\t\t\t\trecord.type === type &&\n\t\t\t\trecord.listener === listener &&\n\t\t\t\t!record.options.capture === !options1.capture,\n\t\t);\n\n\t\tif (i === -1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = listeners[i];\n\t\tlisteners.splice(i, 1);\n\n\t\t// TODO: is it possible to separate out the EventTarget delegation logic\n\t\tfor (const value of getChildValues(ctx.ret)) {\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tvalue.removeEventListener(record.type, record.callback, record.options);\n\t\t\t}\n\t\t}\n\t}\n\n\tdispatchEvent(ev: Event): boolean {\n\t\tconst ctx = this[_ContextImpl];\n\t\tconst path: Array<ContextImpl> = [];\n\t\tfor (\n\t\t\tlet parent = ctx.parent;\n\t\t\tparent !== undefined;\n\t\t\tparent = parent.parent\n\t\t) {\n\t\t\tpath.push(parent);\n\t\t}\n\n\t\t// We patch the stopImmediatePropagation method because ev.cancelBubble\n\t\t// only informs us if stopPropagation was called and there are no\n\t\t// properties which inform us if stopImmediatePropagation was called.\n\t\tlet immediateCancelBubble = false;\n\t\tconst stopImmediatePropagation = ev.stopImmediatePropagation;\n\t\tsetEventProperty(ev, \"stopImmediatePropagation\", () => {\n\t\t\timmediateCancelBubble = true;\n\t\t\treturn stopImmediatePropagation.call(ev);\n\t\t});\n\t\tsetEventProperty(ev, \"target\", ctx.owner);\n\n\t\t// The only possible errors in this block are errors thrown by callbacks,\n\t\t// and dispatchEvent will only log these errors rather than throwing\n\t\t// them. Therefore, we place all code in a try block, log errors in the\n\t\t// catch block, and use an unsafe return statement in the finally block.\n\t\t//\n\t\t// Each early return within the try block returns true because while the\n\t\t// return value is overridden in the finally block, TypeScript\n\t\t// (justifiably) does not recognize the unsafe return statement.\n\t\ttry {\n\t\t\tsetEventProperty(ev, \"eventPhase\", CAPTURING_PHASE);\n\t\t\tfor (let i = path.length - 1; i >= 0; i--) {\n\t\t\t\tconst target = path[i];\n\t\t\t\tconst listeners = listenersMap.get(target);\n\t\t\t\tif (listeners) {\n\t\t\t\t\tsetEventProperty(ev, \"currentTarget\", target.owner);\n\t\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\t\tif (record.type === ev.type && record.options.capture) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\trecord.callback.call(target.owner, ev);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (immediateCancelBubble) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (ev.cancelBubble) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t{\n\t\t\t\tsetEventProperty(ev, \"eventPhase\", AT_TARGET);\n\t\t\t\tsetEventProperty(ev, \"currentTarget\", ctx.owner);\n\t\t\t\tconst propCallback = ctx.ret.el.props[\"on\" + ev.type];\n\t\t\t\tif (propCallback != null) {\n\t\t\t\t\tpropCallback(ev);\n\t\t\t\t\tif (immediateCancelBubble || ev.cancelBubble) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst listeners = listenersMap.get(ctx);\n\t\t\t\tif (listeners) {\n\t\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\t\tif (record.type === ev.type) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\trecord.callback.call(ctx.owner, ev);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (immediateCancelBubble) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (ev.cancelBubble) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ev.bubbles) {\n\t\t\t\tsetEventProperty(ev, \"eventPhase\", BUBBLING_PHASE);\n\t\t\t\tfor (let i = 0; i < path.length; i++) {\n\t\t\t\t\tconst target = path[i];\n\t\t\t\t\tconst listeners = listenersMap.get(target);\n\t\t\t\t\tif (listeners) {\n\t\t\t\t\t\tsetEventProperty(ev, \"currentTarget\", target.owner);\n\t\t\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\t\t\tif (record.type === ev.type && !record.options.capture) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\trecord.callback.call(target.owner, ev);\n\t\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (immediateCancelBubble) {\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (ev.cancelBubble) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tsetEventProperty(ev, \"eventPhase\", NONE);\n\t\t\tsetEventProperty(ev, \"currentTarget\", null);\n\t\t\t// eslint-disable-next-line no-unsafe-finally\n\t\t\treturn !ev.defaultPrevented;\n\t\t}\n\t}\n}\n\n/*** PRIVATE CONTEXT FUNCTIONS ***/\nfunction ctxContains(parent: ContextImpl, child: ContextImpl): boolean {\n\tfor (\n\t\tlet current: ContextImpl | undefined = child;\n\t\tcurrent !== undefined;\n\t\tcurrent = current.parent\n\t) {\n\t\tif (current === parent) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction updateComponent<TNode, TScope, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\troot: TRoot | undefined,\n\thost: Retainer<TNode>,\n\tparent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\tscope: TScope | undefined,\n\tret: Retainer<TNode>,\n\toldProps: Record<string, any> | undefined,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tlet ctx: ContextImpl<TNode, TScope, TRoot, TResult>;\n\tif (oldProps) {\n\t\tctx = ret.ctx as ContextImpl<TNode, TScope, TRoot, TResult>;\n\t\tif (ctx.f & IsSyncExecuting) {\n\t\t\tconsole.error(\"Component is already executing\");\n\t\t\treturn ret.cachedChildValues;\n\t\t}\n\t} else {\n\t\tctx = ret.ctx = new ContextImpl(renderer, root, host, parent, scope, ret);\n\t}\n\n\tctx.f |= IsUpdating;\n\treturn enqueueComponentRun(ctx, hydrationData);\n}\n\nfunction updateComponentChildren<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\tchildren: Children,\n\thydrationData?: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (ctx.f & IsUnmounted) {\n\t\treturn;\n\t} else if (ctx.f & IsErrored) {\n\t\t// This branch is necessary for some race conditions where this function is\n\t\t// called after iterator.throw() in async generator components.\n\t\treturn;\n\t} else if (children === undefined) {\n\t\tconsole.error(\n\t\t\t\"A component has returned or yielded undefined. If this was intentional, return or yield null instead.\",\n\t\t);\n\t}\n\n\tlet childValues: Promise<Array<string | TNode>> | Array<string | TNode>;\n\ttry {\n\t\t// TODO: WAT\n\t\t// We set the isExecuting flag in case a child component dispatches an event\n\t\t// which bubbles to this component and causes a synchronous refresh().\n\t\tctx.f |= IsSyncExecuting;\n\t\tchildValues = diffChildren(\n\t\t\tctx.renderer,\n\t\t\tctx.root,\n\t\t\tctx.host,\n\t\t\tctx,\n\t\t\tctx.scope,\n\t\t\tctx.ret,\n\t\t\tnarrow(children),\n\t\t\thydrationData,\n\t\t);\n\t} finally {\n\t\tctx.f &= ~IsSyncExecuting;\n\t}\n\n\tif (isPromiseLike(childValues)) {\n\t\tctx.ret.inflightValue = childValues.then((childValues) =>\n\t\t\tcommitComponent(ctx, childValues),\n\t\t);\n\n\t\treturn ctx.ret.inflightValue;\n\t}\n\n\treturn commitComponent(ctx, childValues);\n}\n\nfunction commitComponent<TNode>(\n\tctx: ContextImpl<TNode, unknown, TNode>,\n\tvalues: Array<TNode | string>,\n): ElementValue<TNode> {\n\tif (ctx.f & IsUnmounted) {\n\t\treturn;\n\t}\n\n\tconst listeners = listenersMap.get(ctx);\n\tif (listeners && listeners.length) {\n\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\tconst value = values[i];\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tfor (let j = 0; j < listeners.length; j++) {\n\t\t\t\t\tconst record = listeners[j];\n\t\t\t\t\tvalue.addEventListener(record.type, record.callback, record.options);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst oldValues = wrap(ctx.ret.cachedChildValues);\n\tlet value = (ctx.ret.cachedChildValues = unwrap(values));\n\tif (ctx.f & IsScheduling) {\n\t\tctx.f |= IsSchedulingRefresh;\n\t} else if (!(ctx.f & IsUpdating)) {\n\t\t// If we’re not updating the component, which happens when components are\n\t\t// refreshed, or when async generator components iterate, we have to do a\n\t\t// little bit housekeeping when a component’s child values have changed.\n\t\tif (!arrayEqual(oldValues, values)) {\n\t\t\tconst records = getListenerRecords(ctx.parent, ctx.host);\n\t\t\tif (records.length) {\n\t\t\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\t\t\tconst value = values[i];\n\t\t\t\t\tif (isEventTarget(value)) {\n\t\t\t\t\t\tfor (let j = 0; j < records.length; j++) {\n\t\t\t\t\t\t\tconst record = records[j];\n\t\t\t\t\t\t\tvalue.addEventListener(\n\t\t\t\t\t\t\t\trecord.type,\n\t\t\t\t\t\t\t\trecord.callback,\n\t\t\t\t\t\t\t\trecord.options,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// rearranging the nearest ancestor host element\n\t\t\tconst host = ctx.host;\n\t\t\tconst oldHostValues = wrap(host.cachedChildValues);\n\t\t\tinvalidate(ctx, host);\n\t\t\tconst hostValues = getChildValues(host);\n\t\t\tctx.renderer.arrange(\n\t\t\t\thost.el.tag as string | symbol,\n\t\t\t\thost.value as TNode,\n\t\t\t\thost.el.props,\n\t\t\t\thostValues,\n\t\t\t\t// props and oldProps are the same because the host isn’t updated.\n\t\t\t\thost.el.props,\n\t\t\t\toldHostValues,\n\t\t\t);\n\t\t}\n\n\t\tflush(ctx.renderer, ctx.root, ctx);\n\t}\n\n\tconst callbacks = scheduleMap.get(ctx);\n\tif (callbacks) {\n\t\tscheduleMap.delete(ctx);\n\t\tctx.f |= IsScheduling;\n\t\tconst value1 = ctx.renderer.read(value);\n\t\tfor (const callback of callbacks) {\n\t\t\tcallback(value1);\n\t\t}\n\n\t\tctx.f &= ~IsScheduling;\n\t\t// Handles an edge case where refresh() is called during a schedule().\n\t\tif (ctx.f & IsSchedulingRefresh) {\n\t\t\tctx.f &= ~IsSchedulingRefresh;\n\t\t\tvalue = getValue(ctx.ret);\n\t\t}\n\t}\n\n\tctx.f &= ~IsUpdating;\n\treturn value;\n}\n\nfunction invalidate(ctx: ContextImpl, host: Retainer<unknown>): void {\n\tfor (\n\t\tlet parent = ctx.parent;\n\t\tparent !== undefined && parent.host === host;\n\t\tparent = parent.parent\n\t) {\n\t\tparent.ret.cachedChildValues = undefined;\n\t}\n\n\thost.cachedChildValues = undefined;\n}\n\nfunction arrayEqual<TValue>(arr1: Array<TValue>, arr2: Array<TValue>): boolean {\n\tif (arr1.length !== arr2.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < arr1.length; i++) {\n\t\tconst value1 = arr1[i];\n\t\tconst value2 = arr2[i];\n\t\tif (value1 !== value2) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/** Enqueues and executes the component associated with the context. */\nfunction enqueueComponentRun<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\thydrationData?: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (ctx.f & IsAsyncGen && !(ctx.f & IsInForOfLoop)) {\n\t\tif (hydrationData !== undefined) {\n\t\t\tthrow new Error(\"Hydration error\");\n\t\t}\n\n\t\t// This branch will run for non-initial renders of async generator\n\t\t// components when they are not in for...of loops. When in a for...of loop,\n\t\t// async generator components will behave normally.\n\t\t//\n\t\t// Async gen componennts can be in one of three states:\n\t\t//\n\t\t// 1. propsAvailable flag is true: \"available\"\n\t\t//\n\t\t// The component is suspended somewhere in the loop. When the component\n\t\t// reaches the bottom of the loop, it will run again with the next props.\n\t\t//\n\t\t// 2. onAvailable callback is defined: \"suspended\"\n\t\t//\n\t\t// The component has suspended at the bottom of the loop and is waiting\n\t\t// for new props.\n\t\t//\n\t\t// 3. neither 1 or 2: \"Running\"\n\t\t//\n\t\t// The component is suspended somewhere in the loop. When the component\n\t\t// reaches the bottom of the loop, it will suspend.\n\t\t//\n\t\t// Components will never be both available and suspended at\n\t\t// the same time.\n\t\t//\n\t\t// If the component is at the loop bottom, this means that the next value\n\t\t// produced by the component will have the most up to date props, so we can\n\t\t// simply return the current inflight value. Otherwise, we have to wait for\n\t\t// the bottom of the loop to be reached before returning the inflight\n\t\t// value.\n\t\tconst isAtLoopbottom = ctx.f & IsInForAwaitOfLoop && !ctx.onProps;\n\t\tresumePropsIterator(ctx);\n\t\tif (isAtLoopbottom) {\n\t\t\tif (ctx.inflightBlock == null) {\n\t\t\t\tctx.inflightBlock = new Promise(\n\t\t\t\t\t(resolve) => (ctx.onPropsRequested = resolve),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn ctx.inflightBlock.then(() => {\n\t\t\t\tctx.inflightBlock = undefined;\n\t\t\t\treturn ctx.inflightValue;\n\t\t\t});\n\t\t}\n\n\t\treturn ctx.inflightValue;\n\t} else if (!ctx.inflightBlock) {\n\t\ttry {\n\t\t\tconst [block, value] = runComponent<TNode, TResult>(ctx, hydrationData);\n\t\t\tif (block) {\n\t\t\t\tctx.inflightBlock = block\n\t\t\t\t\t// TODO: there is some fuckery going on here related to async\n\t\t\t\t\t// generator components resuming when they’re meant to be returned.\n\t\t\t\t\t.then((v) => v)\n\t\t\t\t\t.finally(() => advanceComponent(ctx));\n\t\t\t\t// stepComponent will only return a block if the value is asynchronous\n\t\t\t\tctx.inflightValue = value as Promise<ElementValue<TNode>>;\n\t\t\t}\n\n\t\t\treturn value;\n\t\t} catch (err) {\n\t\t\tif (!(ctx.f & IsUpdating)) {\n\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\treturn propagateError<TNode>(ctx.parent, err);\n\t\t\t}\n\n\t\t\tthrow err;\n\t\t}\n\t} else if (!ctx.enqueuedBlock) {\n\t\tif (hydrationData !== undefined) {\n\t\t\tthrow new Error(\"Hydration error\");\n\t\t}\n\t\t// We need to assign enqueuedBlock and enqueuedValue synchronously, hence\n\t\t// the Promise constructor call here.\n\t\tlet resolveEnqueuedBlock: Function;\n\t\tctx.enqueuedBlock = new Promise(\n\t\t\t(resolve) => (resolveEnqueuedBlock = resolve),\n\t\t);\n\n\t\tctx.enqueuedValue = ctx.inflightBlock.then(() => {\n\t\t\ttry {\n\t\t\t\tconst [block, value] = runComponent<TNode, TResult>(ctx);\n\t\t\t\tif (block) {\n\t\t\t\t\tresolveEnqueuedBlock(block.finally(() => advanceComponent(ctx)));\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t} catch (err) {\n\t\t\t\tif (!(ctx.f & IsUpdating)) {\n\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn propagateError<TNode>(ctx.parent, err);\n\t\t\t\t}\n\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t});\n\t}\n\n\treturn ctx.enqueuedValue;\n}\n\n/** Called when the inflight block promise settles. */\nfunction advanceComponent(ctx: ContextImpl): void {\n\tif (ctx.f & IsAsyncGen && !(ctx.f & IsInForOfLoop)) {\n\t\treturn;\n\t}\n\n\tctx.inflightBlock = ctx.enqueuedBlock;\n\tctx.inflightValue = ctx.enqueuedValue;\n\tctx.enqueuedBlock = undefined;\n\tctx.enqueuedValue = undefined;\n}\n\n/**\n * This function is responsible for executing the component and handling all\n * the different component types. We cannot identify whether a component is a\n * generator or async without calling it and inspecting the return value.\n *\n * @returns {[block, value]} A tuple where\n * block - A possible promise which represents the duration during which the\n * component is blocked from updating.\n * value - A possible promise resolving to the rendered value of children.\n *\n * Each component type will block according to the type of the component.\n * - Sync function components never block and will transparently pass updates\n * to children.\n * - Async function components and async generator components block while\n * executing itself, but will not block for async children.\n * - Sync generator components block while any children are executing, because\n * they are expected to only resume when they’ve actually rendered.\n */\nfunction runComponent<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\thydrationData?: HydrationData<TNode> | undefined,\n): [\n\tPromise<unknown> | undefined,\n\tPromise<ElementValue<TNode>> | ElementValue<TNode>,\n] {\n\tconst ret = ctx.ret;\n\tconst initial = !ctx.iterator;\n\tif (initial) {\n\t\tresumePropsIterator(ctx);\n\t\tctx.f |= IsSyncExecuting;\n\t\tclearEventListeners(ctx);\n\t\tlet result: ReturnType<Component>;\n\t\ttry {\n\t\t\tresult = (ret.el.tag as Component).call(ctx.owner, ret.el.props);\n\t\t} catch (err) {\n\t\t\tctx.f |= IsErrored;\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t}\n\n\t\tif (isIteratorLike(result)) {\n\t\t\tctx.iterator = result;\n\t\t} else if (isPromiseLike(result)) {\n\t\t\t// async function component\n\t\t\tconst result1 =\n\t\t\t\tresult instanceof Promise ? result : Promise.resolve(result);\n\t\t\tconst value = result1.then(\n\t\t\t\t(result) =>\n\t\t\t\t\tupdateComponentChildren<TNode, TResult>(ctx, result, hydrationData),\n\t\t\t\t(err) => {\n\t\t\t\t\tctx.f |= IsErrored;\n\t\t\t\t\tthrow err;\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn [result1.catch(NOOP), value];\n\t\t} else {\n\t\t\t// sync function component\n\t\t\treturn [\n\t\t\t\tundefined,\n\t\t\t\tupdateComponentChildren<TNode, TResult>(ctx, result, hydrationData),\n\t\t\t];\n\t\t}\n\t} else if (hydrationData !== undefined) {\n\t\tthrow new Error(\"Hydration error\");\n\t}\n\n\tlet iteration!: Promise<ChildrenIteratorResult> | ChildrenIteratorResult;\n\tif (initial) {\n\t\ttry {\n\t\t\tctx.f |= IsSyncExecuting;\n\t\t\titeration = ctx.iterator!.next();\n\t\t} catch (err) {\n\t\t\tctx.f |= IsErrored;\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t}\n\n\t\tif (isPromiseLike(iteration)) {\n\t\t\tctx.f |= IsAsyncGen;\n\t\t} else {\n\t\t\tctx.f |= IsSyncGen;\n\t\t}\n\t}\n\n\tif (ctx.f & IsSyncGen) {\n\t\tctx.f &= ~NeedsToYield;\n\t\t// sync generator component\n\t\tif (!initial) {\n\t\t\ttry {\n\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\titeration = ctx.iterator!.next(ctx.renderer.read(getValue(ret)));\n\t\t\t} catch (err) {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t} finally {\n\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t}\n\t\t}\n\n\t\tif (isPromiseLike(iteration)) {\n\t\t\tthrow new Error(\"Mixed generator component\");\n\t\t}\n\n\t\tif (iteration.done) {\n\t\t\tctx.f &= ~IsSyncGen;\n\t\t\tctx.iterator = undefined;\n\t\t}\n\n\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\ttry {\n\t\t\tvalue = updateComponentChildren<TNode, TResult>(\n\t\t\t\tctx,\n\t\t\t\t// Children can be void so we eliminate that here\n\t\t\t\titeration.value as Children,\n\t\t\t\thydrationData,\n\t\t\t);\n\n\t\t\tif (isPromiseLike(value)) {\n\t\t\t\tvalue = value.catch((err) => handleChildError(ctx, err));\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tvalue = handleChildError(ctx, err);\n\t\t}\n\n\t\tconst block = isPromiseLike(value) ? value.catch(NOOP) : undefined;\n\t\treturn [block, value];\n\t} else if (ctx.f & IsInForOfLoop) {\n\t\t// TODO: does this need to be done async?\n\t\tctx.f &= ~NeedsToYield;\n\t\t// we are in a for...of loop for async generator\n\t\tif (!initial) {\n\t\t\ttry {\n\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\titeration = ctx.iterator!.next(ctx.renderer.read(getValue(ret)));\n\t\t\t} catch (err) {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t} finally {\n\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t}\n\t\t}\n\n\t\tif (!isPromiseLike(iteration)) {\n\t\t\tthrow new Error(\"Mixed generator component\");\n\t\t}\n\n\t\tconst block = iteration.catch(NOOP);\n\t\tconst value = iteration.then(\n\t\t\t(iteration) => {\n\t\t\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\t\t\tif (!(ctx.f & IsInForOfLoop)) {\n\t\t\t\t\trunAsyncGenComponent(ctx, Promise.resolve(iteration), hydrationData);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tvalue = updateComponentChildren<TNode, TResult>(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\t// Children can be void so we eliminate that here\n\t\t\t\t\t\titeration.value as Children,\n\t\t\t\t\t\thydrationData,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (isPromiseLike(value)) {\n\t\t\t\t\t\tvalue = value.catch((err) => handleChildError(ctx, err));\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\tvalue = handleChildError(ctx, err);\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\t(err) => {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t},\n\t\t);\n\n\t\treturn [block, value];\n\t} else {\n\t\trunAsyncGenComponent(\n\t\t\tctx,\n\t\t\titeration as Promise<ChildrenIteratorResult>,\n\t\t\thydrationData,\n\t\t);\n\t\t// async generator component\n\t\treturn [ctx.inflightBlock, ctx.inflightValue];\n\t}\n}\n\nasync function runAsyncGenComponent<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\titerationP: Promise<ChildrenIteratorResult>,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<void> {\n\tlet done = false;\n\ttry {\n\t\twhile (!done) {\n\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// inflightValue must be set synchronously.\n\t\t\tlet onValue!: Function;\n\t\t\tctx.inflightValue = new Promise((resolve) => (onValue = resolve));\n\t\t\tif (ctx.f & IsUpdating) {\n\t\t\t\t// We should not swallow unhandled promise rejections if the component is\n\t\t\t\t// updating independently.\n\t\t\t\t// TODO: Does this handle this.refresh() calls?\n\t\t\t\tctx.inflightValue.catch(NOOP);\n\t\t\t}\n\n\t\t\tlet iteration: ChildrenIteratorResult;\n\t\t\ttry {\n\t\t\t\titeration = await iterationP;\n\t\t\t} catch (err) {\n\t\t\t\tdone = true;\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tonValue(Promise.reject(err));\n\t\t\t\tbreak;\n\t\t\t} finally {\n\t\t\t\tctx.f &= ~NeedsToYield;\n\t\t\t\tif (!(ctx.f & IsInForAwaitOfLoop)) {\n\t\t\t\t\tctx.f &= ~PropsAvailable;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdone = !!iteration.done;\n\t\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\t\ttry {\n\t\t\t\tvalue = updateComponentChildren<TNode, TResult>(\n\t\t\t\t\tctx,\n\t\t\t\t\titeration.value!,\n\t\t\t\t\thydrationData,\n\t\t\t\t);\n\t\t\t\thydrationData = undefined;\n\t\t\t\tif (isPromiseLike(value)) {\n\t\t\t\t\tvalue = value.catch((err: any) => handleChildError(ctx, err));\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// Do we need to catch potential errors here in the case of unhandled\n\t\t\t\t// promise rejections?\n\t\t\t\tvalue = handleChildError(ctx, err);\n\t\t\t} finally {\n\t\t\t\tonValue(value);\n\t\t\t}\n\n\t\t\t// TODO: this can be done more elegantly\n\t\t\tlet oldValue: Promise<TResult> | TResult;\n\t\t\tif (ctx.ret.inflightValue) {\n\t\t\t\t// The value passed back into the generator as the argument to the next\n\t\t\t\t// method is a promise if an async generator component has async\n\t\t\t\t// children. Sync generator components only resume when their children\n\t\t\t\t// have fulfilled so the element’s inflight child values will never be\n\t\t\t\t// defined.\n\t\t\t\toldValue = ctx.ret.inflightValue.then((value) =>\n\t\t\t\t\tctx.renderer.read(value),\n\t\t\t\t);\n\n\t\t\t\toldValue.catch((err) => {\n\t\t\t\t\tif (ctx.f & IsUpdating) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn propagateError(ctx.parent, err);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\toldValue = ctx.renderer.read(getValue(ctx.ret));\n\t\t\t}\n\n\t\t\tif (ctx.f & IsUnmounted) {\n\t\t\t\tif (ctx.f & IsInForAwaitOfLoop) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\t\t\titerationP = ctx.iterator!.next(\n\t\t\t\t\t\t\toldValue,\n\t\t\t\t\t\t) as Promise<ChildrenIteratorResult>;\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (!done && !(ctx.f & IsInForOfLoop)) {\n\t\t\t\ttry {\n\t\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\t\titerationP = ctx.iterator!.next(\n\t\t\t\t\t\toldValue,\n\t\t\t\t\t) as Promise<ChildrenIteratorResult>;\n\t\t\t\t} finally {\n\t\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tif (done) {\n\t\t\tctx.f &= ~IsAsyncGen;\n\t\t\tctx.iterator = undefined;\n\t\t}\n\t}\n}\n\n/**\n * Called to resume the props async iterator for async generator components.\n */\nfunction resumePropsIterator(ctx: ContextImpl): void {\n\tif (ctx.onProps) {\n\t\tctx.onProps(ctx.ret.el.props);\n\t\tctx.onProps = undefined;\n\t\tctx.f &= ~PropsAvailable;\n\t} else {\n\t\tctx.f |= PropsAvailable;\n\t}\n}\n\n// TODO: async unmounting\nfunction unmountComponent(ctx: ContextImpl): void {\n\tif (ctx.f & IsUnmounted) {\n\t\treturn;\n\t}\n\n\tclearEventListeners(ctx);\n\n\tconst callbacks = cleanupMap.get(ctx);\n\tif (callbacks) {\n\t\tcleanupMap.delete(ctx);\n\t\tconst value = ctx.renderer.read(getValue(ctx.ret));\n\t\tfor (const callback of callbacks) {\n\t\t\tcallback(value);\n\t\t}\n\t}\n\n\tctx.f |= IsUnmounted;\n\tif (ctx.iterator) {\n\t\tif (ctx.f & IsSyncGen) {\n\t\t\tlet value: unknown;\n\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\tvalue = enqueueComponentRun(ctx);\n\t\t\t}\n\n\t\t\tif (isPromiseLike(value)) {\n\t\t\t\tvalue.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\t\t\t\tunmountComponent(ctx);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn propagateError<unknown>(ctx.parent, err);\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\t\tunmountComponent(ctx);\n\t\t\t\t} else {\n\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (ctx.f & IsAsyncGen) {\n\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\tconst value = enqueueComponentRun(ctx) as Promise<unknown>;\n\t\t\t\tvalue.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\t\t\t\tunmountComponent(ctx);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn propagateError<unknown>(ctx.parent, err);\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// The logic for unmounting async generator components is in the\n\t\t\t\t// runAsyncGenComponent function.\n\t\t\t\tresumePropsIterator(ctx);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction returnComponent(ctx: ContextImpl): void {\n\tresumePropsIterator(ctx);\n\tif (ctx.iterator && typeof ctx.iterator!.return === \"function\") {\n\t\ttry {\n\t\t\tctx.f |= IsSyncExecuting;\n\t\t\tconst iteration = ctx.iterator!.return();\n\t\t\tif (isPromiseLike(iteration)) {\n\t\t\t\titeration.catch((err) => {\n\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn propagateError<unknown>(ctx.parent, err);\n\t\t\t\t});\n\t\t\t}\n\t\t} finally {\n\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t}\n\t}\n}\n\n/*** EVENT TARGET UTILITIES ***/\n// EVENT PHASE CONSTANTS\n// https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase\nconst NONE = 0;\nconst CAPTURING_PHASE = 1;\nconst AT_TARGET = 2;\nconst BUBBLING_PHASE = 3;\n\nconst listenersMap = new WeakMap<ContextImpl, Array<EventListenerRecord>>();\n/**\n * A map of event type strings to Event subclasses. Can be extended via\n * TypeScript module augmentation to have strongly typed event listeners.\n */\nexport interface EventMap extends Crank.EventMap {\n\t[type: string]: Event;\n}\n\ntype MappedEventListener<T extends string> = (ev: EventMap[T]) => unknown;\n\ntype MappedEventListenerOrEventListenerObject<T extends string> =\n\t| MappedEventListener<T>\n\t| {handleEvent: MappedEventListener<T>};\n\nfunction isListenerOrListenerObject(\n\tvalue: unknown,\n): value is MappedEventListenerOrEventListenerObject<string> {\n\treturn (\n\t\ttypeof value === \"function\" ||\n\t\t(value !== null &&\n\t\t\ttypeof value === \"object\" &&\n\t\t\ttypeof (value as any).handleEvent === \"function\")\n\t);\n}\n\ninterface EventListenerRecord {\n\ttype: string;\n\t// listener is the original value passed to addEventListener, callback is the\n\t// transformed function\n\tlistener: MappedEventListenerOrEventListenerObject<any>;\n\tcallback: MappedEventListener<any>;\n\toptions: AddEventListenerOptions;\n}\n\nfunction normalizeListenerOptions(\n\toptions: AddEventListenerOptions | boolean | null | undefined,\n): AddEventListenerOptions {\n\tif (typeof options === \"boolean\") {\n\t\treturn {capture: options};\n\t} else if (options == null) {\n\t\treturn {};\n\t}\n\n\treturn options;\n}\n\nfunction isEventTarget(value: any): value is EventTarget {\n\treturn (\n\t\tvalue != null &&\n\t\ttypeof value.addEventListener === \"function\" &&\n\t\ttypeof value.removeEventListener === \"function\" &&\n\t\ttypeof value.dispatchEvent === \"function\"\n\t);\n}\n\nfunction setEventProperty<T extends keyof Event>(\n\tev: Event,\n\tkey: T,\n\tvalue: Event[T],\n): void {\n\tObject.defineProperty(ev, key, {value, writable: false, configurable: true});\n}\n\n// TODO: Maybe we can pass in the current context directly, rather than\n// starting from the parent?\n/**\n * A function to reconstruct an array of every listener given a context and a\n * host element.\n *\n * This function exploits the fact that contexts retain their nearest ancestor\n * host element. We can determine all the contexts which are directly listening\n * to an element by traversing up the context tree and checking that the host\n * element passed in matches the parent context’s host element.\n */\nfunction getListenerRecords(\n\tctx: ContextImpl | undefined,\n\tret: Retainer<unknown>,\n): Array<EventListenerRecord> {\n\tlet listeners: Array<EventListenerRecord> = [];\n\twhile (ctx !== undefined && ctx.host === ret) {\n\t\tconst listeners1 = listenersMap.get(ctx);\n\t\tif (listeners1) {\n\t\t\tlisteners = listeners.concat(listeners1);\n\t\t}\n\n\t\tctx = ctx.parent;\n\t}\n\n\treturn listeners;\n}\n\nfunction clearEventListeners(ctx: ContextImpl): void {\n\tconst listeners = listenersMap.get(ctx);\n\tif (listeners && listeners.length) {\n\t\tfor (const value of getChildValues(ctx.ret)) {\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\tvalue.removeEventListener(\n\t\t\t\t\t\trecord.type,\n\t\t\t\t\t\trecord.callback,\n\t\t\t\t\t\trecord.options,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlisteners.length = 0;\n\t}\n}\n\n/*** ERROR HANDLING UTILITIES ***/\nfunction handleChildError<TNode>(\n\tctx: ContextImpl<TNode, unknown, TNode>,\n\terr: unknown,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (!ctx.iterator || typeof ctx.iterator.throw !== \"function\") {\n\t\tthrow err;\n\t}\n\n\tresumePropsIterator(ctx);\n\tlet iteration: ChildrenIteratorResult | Promise<ChildrenIteratorResult>;\n\ttry {\n\t\tctx.f |= IsSyncExecuting;\n\t\titeration = ctx.iterator.throw(err);\n\t} catch (err) {\n\t\tctx.f |= IsErrored;\n\t\tthrow err;\n\t} finally {\n\t\tctx.f &= ~IsSyncExecuting;\n\t}\n\n\tif (isPromiseLike(iteration)) {\n\t\treturn iteration.then(\n\t\t\t(iteration) => {\n\t\t\t\tif (iteration.done) {\n\t\t\t\t\tctx.f &= ~IsAsyncGen;\n\t\t\t\t\tctx.iterator = undefined;\n\t\t\t\t}\n\n\t\t\t\treturn updateComponentChildren(ctx, iteration.value as Children);\n\t\t\t},\n\t\t\t(err) => {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t},\n\t\t);\n\t}\n\n\tif (iteration.done) {\n\t\tctx.f &= ~IsSyncGen;\n\t\tctx.f &= ~IsAsyncGen;\n\t\tctx.iterator = undefined;\n\t}\n\n\treturn updateComponentChildren(ctx, iteration.value as Children);\n}\n\nfunction propagateError<TNode>(\n\tctx: ContextImpl<TNode, unknown, TNode>,\n\terr: unknown,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tlet result: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\ttry {\n\t\tresult = handleChildError(ctx, err);\n\t} catch (err) {\n\t\tif (!ctx.parent) {\n\t\t\tthrow err;\n\t\t}\n\n\t\treturn propagateError<TNode>(ctx.parent, err);\n\t}\n\n\tif (isPromiseLike(result)) {\n\t\treturn result.catch((err) => {\n\t\t\tif (!ctx.parent) {\n\t\t\t\tthrow err;\n\t\t\t}\n\n\t\t\treturn propagateError<TNode>(ctx.parent, err);\n\t\t});\n\t}\n\n\treturn result;\n}\n\n// TODO: uncomment and use in the Element interface below\n// type CrankElement = Element;\ndeclare global {\n\tnamespace Crank {\n\t\texport interface EventMap {}\n\n\t\texport interface ProvisionMap {}\n\n\t\texport interface Context {}\n\t}\n\n\tnamespace JSX {\n\t\t// TODO: JSX Element type (the result of JSX expressions) don’t work\n\t\t// because TypeScript demands that all Components return JSX elements for\n\t\t// some reason.\n\t\t// interface Element extends CrankElement {}\n\n\t\texport interface IntrinsicElements {\n\t\t\t[tag: string]: any;\n\t\t}\n\n\t\texport interface ElementChildrenAttribute {\n\t\t\tchildren: {};\n\t\t}\n\t}\n}\n\n// Some JSX transpilation tools expect these functions to be defined on the\n// default export. Prefer named exports when importing directly.\nexport default {createElement, Fragment};\n","import {\n\tChildren,\n\tContext,\n\tElementValue,\n\tHydrationData,\n\tPortal,\n\tRenderer,\n\tRendererImpl,\n} from \"./crank.js\";\n\nconst SVG_NAMESPACE = \"http://www.w3.org/2000/svg\";\n\nexport const impl: Partial<RendererImpl<Node, string>> = {\n\tscope(\n\t\txmlns: string | undefined,\n\t\ttag: string | symbol,\n\t\tprops: Record<string, any>,\n\t): string | undefined {\n\t\tswitch (tag) {\n\t\t\tcase Portal:\n\t\t\t\txmlns = undefined;\n\t\t\t\tbreak;\n\t\t\tcase \"svg\":\n\t\t\t\txmlns = SVG_NAMESPACE;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn props.xmlns || xmlns;\n\t},\n\n\tcreate(\n\t\ttag: string | symbol,\n\t\t_props: unknown,\n\t\txmlns: string | undefined,\n\t): Node {\n\t\tif (typeof tag !== \"string\") {\n\t\t\tthrow new Error(`Unknown tag: ${tag.toString()}`);\n\t\t} else if (tag.toLowerCase() === \"svg\") {\n\t\t\txmlns = SVG_NAMESPACE;\n\t\t}\n\n\t\treturn xmlns\n\t\t\t? document.createElementNS(xmlns, tag)\n\t\t\t: document.createElement(tag);\n\t},\n\n\thydrate(\n\t\ttag: string | symbol,\n\t\tnode: Element,\n\t\tprops: Record<string, unknown>,\n\t): HydrationData<Element> | undefined {\n\t\tif (typeof tag !== \"string\" && tag !== Portal) {\n\t\t\tthrow new Error(`Unknown tag: ${tag.toString()}`);\n\t\t}\n\n\t\tif (\n\t\t\ttypeof tag === \"string\" &&\n\t\t\ttag.toUpperCase() !== (node as Element).tagName\n\t\t) {\n\t\t\t// TODO: consider pros and cons of hydration warnings\n\t\t\t//console.error(`Expected <${tag}> while hydrating but found:`, node);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst children: Array<string | Element> = [];\n\t\tfor (let i = 0; i < node.childNodes.length; i++) {\n\t\t\tconst child = node.childNodes[i];\n\t\t\tif (child.nodeType === Node.TEXT_NODE) {\n\t\t\t\tchildren.push((child as Text).data);\n\t\t\t} else if (child.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\tchildren.push(child as Element);\n\t\t\t}\n\t\t}\n\n\t\t// TODO: extract props from nodes\n\t\treturn {props, children};\n\t},\n\n\tpatch(\n\t\t_tag: string | symbol,\n\t\t// TODO: Why does this assignment work?\n\t\tnode: HTMLElement | SVGElement,\n\t\tname: string,\n\t\t// TODO: Stricter typings?\n\t\tvalue: unknown,\n\t\toldValue: unknown,\n\t\txmlns: string | undefined,\n\t): void {\n\t\tconst isSVG = xmlns === SVG_NAMESPACE;\n\t\tswitch (name) {\n\t\t\tcase \"style\": {\n\t\t\t\tconst style: CSSStyleDeclaration = node.style;\n\t\t\t\tif (style == null) {\n\t\t\t\t\tnode.setAttribute(\"style\", value as string);\n\t\t\t\t} else if (value == null || value === false) {\n\t\t\t\t\tnode.removeAttribute(\"style\");\n\t\t\t\t} else if (value === true) {\n\t\t\t\t\tnode.setAttribute(\"style\", \"\");\n\t\t\t\t} else if (typeof value === \"string\") {\n\t\t\t\t\tif (style.cssText !== value) {\n\t\t\t\t\t\tstyle.cssText = value;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof oldValue === \"string\") {\n\t\t\t\t\t\tstyle.cssText = \"\";\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const styleName in {...(oldValue as {}), ...(value as {})}) {\n\t\t\t\t\t\tconst styleValue = value && (value as any)[styleName];\n\t\t\t\t\t\tif (styleValue == null) {\n\t\t\t\t\t\t\tstyle.removeProperty(styleName);\n\t\t\t\t\t\t} else if (style.getPropertyValue(styleName) !== styleValue) {\n\t\t\t\t\t\t\tstyle.setProperty(styleName, styleValue);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"class\":\n\t\t\tcase \"className\":\n\t\t\t\tif (value === true) {\n\t\t\t\t\tnode.setAttribute(\"class\", \"\");\n\t\t\t\t} else if (value == null) {\n\t\t\t\t\tnode.removeAttribute(\"class\");\n\t\t\t\t} else if (!isSVG) {\n\t\t\t\t\tif (node.className !== value) {\n\t\t\t\t\t\t(node as any)[\"className\"] = value;\n\t\t\t\t\t}\n\t\t\t\t} else if (node.getAttribute(\"class\") !== value) {\n\t\t\t\t\tnode.setAttribute(\"class\", value as string);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"innerHTML\":\n\t\t\t\tif (value !== oldValue) {\n\t\t\t\t\tnode.innerHTML = value as any;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tdefault: {\n\t\t\t\tif (\n\t\t\t\t\tname in node &&\n\t\t\t\t\t// boolean properties will coerce strings, but sometimes they map to\n\t\t\t\t\t// enumerated attributes, where truthy strings (\"false\", \"no\") map to\n\t\t\t\t\t// falsy properties, so we use attributes in this case.\n\t\t\t\t\t!(\n\t\t\t\t\t\ttypeof value === \"string\" &&\n\t\t\t\t\t\ttypeof (node as any)[name] === \"boolean\"\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// walk up the object's prototype chain to find the owner of the\n\t\t\t\t\t// named property\n\t\t\t\t\tlet obj = node;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(obj, name)) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} while ((obj = Object.getPrototypeOf(obj)));\n\n\t\t\t\t\t// get the descriptor for the named property and check whether it\n\t\t\t\t\t// implies that the property is writable\n\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(obj, name);\n\t\t\t\t\tif (\n\t\t\t\t\t\tdescriptor != null &&\n\t\t\t\t\t\t(descriptor.writable === true || descriptor.set !== undefined)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ((node as any)[name] !== value || oldValue === undefined) {\n\t\t\t\t\t\t\t(node as any)[name] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// if the property wasn't writable, fall through to the code below\n\t\t\t\t\t// which uses setAttribute() instead of assigning directly.\n\t\t\t\t}\n\n\t\t\t\tif (value === true) {\n\t\t\t\t\tvalue = \"\";\n\t\t\t\t} else if (value == null || value === false) {\n\t\t\t\t\tnode.removeAttribute(name);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.getAttribute(name) !== value) {\n\t\t\t\t\tnode.setAttribute(name, value as any);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tarrange(\n\t\ttag: string | symbol,\n\t\tnode: Node,\n\t\tprops: Record<string, any>,\n\t\tchildren: Array<Element | string>,\n\t\t_oldProps: Record<string, any> | undefined,\n\t\toldChildren: Array<Element | string> | undefined,\n\t): void {\n\t\tif (tag === Portal && (node == null || typeof node.nodeType !== \"number\")) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Portal root is not a node. Received: ${JSON.stringify(\n\t\t\t\t\tnode && node.toString(),\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\t!(\"innerHTML\" in props) &&\n\t\t\t// We don’t want to update elements without explicit children (<div/>),\n\t\t\t// because these elements sometimes have child nodes added via raw\n\t\t\t// DOM manipulations.\n\t\t\t// However, if an element has previously rendered children, we clear the\n\t\t\t// them because it would be surprising not to clear Crank managed\n\t\t\t// children, even if the new element does not have explicit children.\n\t\t\t(\"children\" in props || (oldChildren && oldChildren.length))\n\t\t) {\n\t\t\tif (children.length === 0) {\n\t\t\t\tnode.textContent = \"\";\n\t\t\t} else {\n\t\t\t\tlet oldChild = node.firstChild;\n\t\t\t\tlet i = 0;\n\t\t\t\twhile (oldChild !== null && i < children.length) {\n\t\t\t\t\tconst newChild = children[i];\n\t\t\t\t\tif (oldChild === newChild) {\n\t\t\t\t\t\toldChild = oldChild.nextSibling;\n\t\t\t\t\t\ti++;\n\t\t\t\t\t} else if (typeof newChild === \"string\") {\n\t\t\t\t\t\tif (oldChild.nodeType === Node.TEXT_NODE) {\n\t\t\t\t\t\t\tif ((oldChild as Text).data !== newChild) {\n\t\t\t\t\t\t\t\t(oldChild as Text).data = newChild;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\toldChild = oldChild.nextSibling;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.insertBefore(document.createTextNode(newChild), oldChild);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ti++;\n\t\t\t\t\t} else if (oldChild.nodeType === Node.TEXT_NODE) {\n\t\t\t\t\t\tconst nextSibling = oldChild.nextSibling;\n\t\t\t\t\t\tnode.removeChild(oldChild);\n\t\t\t\t\t\toldChild = nextSibling;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.insertBefore(newChild, oldChild);\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\t// TODO: This is an optimization but we need to think a little more about other cases like prepending.\n\t\t\t\t\t\tif (oldChild !== children[i]) {\n\t\t\t\t\t\t\tconst nextSibling = oldChild.nextSibling;\n\t\t\t\t\t\t\tnode.removeChild(oldChild);\n\t\t\t\t\t\t\toldChild = nextSibling;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// remove excess DOM nodes\n\t\t\t\twhile (oldChild !== null) {\n\t\t\t\t\tconst nextSibling = oldChild.nextSibling;\n\t\t\t\t\tnode.removeChild(oldChild);\n\t\t\t\t\toldChild = nextSibling;\n\t\t\t\t}\n\n\t\t\t\t// append excess children\n\t\t\t\tfor (; i < children.length; i++) {\n\t\t\t\t\tconst newChild = children[i];\n\t\t\t\t\tnode.appendChild(\n\t\t\t\t\t\ttypeof newChild === \"string\"\n\t\t\t\t\t\t\t? document.createTextNode(newChild)\n\t\t\t\t\t\t\t: newChild,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\ttext(\n\t\ttext: string,\n\t\t_scope: string | undefined,\n\t\thydrationData: HydrationData<Element> | undefined,\n\t): string {\n\t\tif (hydrationData != null) {\n\t\t\tlet value = hydrationData.children.shift();\n\t\t\tif (typeof value !== \"string\" || !value.startsWith(text)) {\n\t\t\t\t// TODO: consider pros and cons of hydration warnings\n\t\t\t\t//console.error(`Expected \"${text}\" while hydrating but found:`, value);\n\t\t\t} else if (text.length < value.length) {\n\t\t\t\tvalue = value.slice(text.length);\n\t\t\t\thydrationData.children.unshift(value);\n\t\t\t}\n\t\t}\n\n\t\treturn text;\n\t},\n\n\traw(\n\t\tvalue: string | Node,\n\t\txmlns: string | undefined,\n\t\thydrationData: HydrationData<Element> | undefined,\n\t): ElementValue<Node> {\n\t\tlet result: ElementValue<Node>;\n\t\tif (typeof value === \"string\") {\n\t\t\tconst el =\n\t\t\t\txmlns == null\n\t\t\t\t\t? document.createElement(\"div\")\n\t\t\t\t\t: document.createElementNS(xmlns, \"svg\");\n\t\t\tel.innerHTML = value;\n\t\t\tif (el.childNodes.length === 0) {\n\t\t\t\tresult = undefined;\n\t\t\t} else if (el.childNodes.length === 1) {\n\t\t\t\tresult = el.childNodes[0];\n\t\t\t} else {\n\t\t\t\tresult = Array.from(el.childNodes);\n\t\t\t}\n\t\t} else {\n\t\t\tresult = value;\n\t\t}\n\n\t\tif (hydrationData != null) {\n\t\t\t// TODO: maybe we should warn on incorrect values\n\t\t\tif (Array.isArray(result)) {\n\t\t\t\tfor (let i = 0; i < result.length; i++) {\n\t\t\t\t\tconst node = result[i];\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof node !== \"string\" &&\n\t\t\t\t\t\t(node.nodeType === Node.ELEMENT_NODE ||\n\t\t\t\t\t\t\tnode.nodeType === Node.TEXT_NODE)\n\t\t\t\t\t) {\n\t\t\t\t\t\thydrationData.children.shift();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (result != null && typeof result !== \"string\") {\n\t\t\t\tif (\n\t\t\t\t\tresult.nodeType === Node.ELEMENT_NODE ||\n\t\t\t\t\tresult.nodeType === Node.TEXT_NODE\n\t\t\t\t) {\n\t\t\t\t\thydrationData.children.shift();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t},\n};\n\nexport class DOMRenderer extends Renderer<Node, string> {\n\tconstructor() {\n\t\tsuper(impl);\n\t}\n\n\trender(\n\t\tchildren: Children,\n\t\troot: Node,\n\t\tctx?: Context,\n\t): Promise<ElementValue<Node>> | ElementValue<Node> {\n\t\tvalidateRoot(root);\n\t\treturn super.render(children, root, ctx);\n\t}\n\n\thydrate(\n\t\tchildren: Children,\n\t\troot: Node,\n\t\tctx?: Context,\n\t): Promise<ElementValue<Node>> | ElementValue<Node> {\n\t\tvalidateRoot(root);\n\t\treturn super.hydrate(children, root, ctx);\n\t}\n}\n\nfunction validateRoot(root: unknown): asserts root is Node {\n\tif (\n\t\troot === null ||\n\t\t(typeof root === \"object\" && typeof (root as any).nodeType !== \"number\")\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`Render root is not a node. Received: ${JSON.stringify(\n\t\t\t\troot && root.toString(),\n\t\t\t)}`,\n\t\t);\n\t}\n}\n\nexport const renderer = new DOMRenderer();\n\ndeclare global {\n\tmodule Crank {\n\t\tinterface EventMap extends GlobalEventHandlersEventMap {}\n\t}\n}\n","import {Portal, Renderer} from \"./crank.js\";\nimport type {ElementValue, RendererImpl} from \"./crank.js\";\n\nconst voidTags = new Set([\n\t\"area\",\n\t\"base\",\n\t\"br\",\n\t\"col\",\n\t\"command\",\n\t\"embed\",\n\t\"hr\",\n\t\"img\",\n\t\"input\",\n\t\"keygen\",\n\t\"link\",\n\t\"meta\",\n\t\"param\",\n\t\"source\",\n\t\"track\",\n\t\"wbr\",\n]);\n\nfunction escape(text: string): string {\n\treturn text.replace(/[&<>\"']/g, (match) => {\n\t\tswitch (match) {\n\t\t\tcase \"&\":\n\t\t\t\treturn \"&\";\n\t\t\tcase \"<\":\n\t\t\t\treturn \"<\";\n\t\t\tcase \">\":\n\t\t\t\treturn \">\";\n\t\t\tcase '\"':\n\t\t\t\treturn \""\";\n\t\t\tcase \"'\":\n\t\t\t\treturn \"'\";\n\t\t\tdefault:\n\t\t\t\treturn \"\";\n\t\t}\n\t});\n}\n\nfunction printStyleObject(style: Record<string, any>): string {\n\tconst cssStrings = [];\n\tfor (const [name, value] of Object.entries(style)) {\n\t\tif (value != null) {\n\t\t\tcssStrings.push(`${name}:${value};`);\n\t\t}\n\t}\n\n\treturn cssStrings.join(\"\");\n}\n\nfunction printAttrs(props: Record<string, any>): string {\n\tconst attrs: string[] = [];\n\tfor (const [name, value] of Object.entries(props)) {\n\t\tswitch (true) {\n\t\t\tcase name === \"children\":\n\t\t\tcase name === \"innerHTML\":\n\t\t\t\tbreak;\n\t\t\tcase name === \"style\": {\n\t\t\t\tif (typeof value === \"string\") {\n\t\t\t\t\tattrs.push(`style=\"${escape(value)}\"`);\n\t\t\t\t} else if (typeof value === \"object\") {\n\t\t\t\t\tattrs.push(`style=\"${escape(printStyleObject(value))}\"`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase name === \"className\": {\n\t\t\t\tif (\"class\" in props || typeof value !== \"string\") {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tattrs.push(`class=\"${escape(value)}\"`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase typeof value === \"string\":\n\t\t\t\tattrs.push(`${escape(name)}=\"${escape(value)}\"`);\n\t\t\t\tbreak;\n\t\t\tcase typeof value === \"number\":\n\t\t\t\tattrs.push(`${escape(name)}=\"${value}\"`);\n\t\t\t\tbreak;\n\t\t\tcase value === true:\n\t\t\t\tattrs.push(`${escape(name)}`);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn attrs.join(\" \");\n}\n\ninterface Node {\n\tvalue: string;\n}\n\nfunction join(children: Array<Node | string>): string {\n\tlet result = \"\";\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tresult += typeof child === \"string\" ? child : child.value;\n\t}\n\n\treturn result;\n}\n\nexport const impl: Partial<RendererImpl<Node, undefined, any, string>> = {\n\tcreate(): Node {\n\t\treturn {value: \"\"};\n\t},\n\n\ttext(text: string): string {\n\t\treturn escape(text);\n\t},\n\n\tread(value: ElementValue<Node>): string {\n\t\tif (Array.isArray(value)) {\n\t\t\treturn join(value);\n\t\t} else if (typeof value === \"undefined\") {\n\t\t\treturn \"\";\n\t\t} else if (typeof value === \"string\") {\n\t\t\treturn value;\n\t\t} else {\n\t\t\treturn value.value;\n\t\t}\n\t},\n\n\tarrange(\n\t\ttag: string | symbol,\n\t\tnode: Node,\n\t\tprops: Record<string, any>,\n\t\tchildren: Array<Node | string>,\n\t): void {\n\t\tif (tag === Portal) {\n\t\t\treturn;\n\t\t} else if (typeof tag !== \"string\") {\n\t\t\tthrow new Error(`Unknown tag: ${tag.toString()}`);\n\t\t}\n\n\t\tconst attrs = printAttrs(props);\n\t\tconst open = `<${tag}${attrs.length ? \" \" : \"\"}${attrs}>`;\n\t\tlet result: string;\n\t\tif (voidTags.has(tag)) {\n\t\t\tresult = open;\n\t\t} else {\n\t\t\tconst close = `</${tag}>`;\n\t\t\tconst contents =\n\t\t\t\t\"innerHTML\" in props ? props[\"innerHTML\"] : join(children);\n\t\t\tresult = `${open}${contents}${close}`;\n\t\t}\n\n\t\tnode.value = result;\n\t},\n};\n\nexport class HTMLRenderer extends Renderer<Node, undefined, any, string> {\n\tconstructor() {\n\t\tsuper(impl);\n\t}\n}\n\nexport const renderer = new HTMLRenderer();\n\ndeclare global {\n\tmodule Crank {\n\t\tinterface EventMap extends GlobalEventHandlersEventMap {}\n\t}\n}\n"],"names":["impl","renderer"],"mappings":";;;;;;CAAA,MAAM,IAAI,GAAG,MAAK,GAAG,CAAC;CACtB,MAAM,QAAQ,GAAG,CAAI,KAAQ,KAAQ,KAAK,CAAC;CAE3C,SAAS,IAAI,CAAI,KAA+B,EAAA;KAC/C,OAAO,KAAK,KAAK,SAAS,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;CAC1E,CAAC;CAED,SAAS,MAAM,CAAI,GAAa,EAAA;CAC/B,IAAA,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;CACvE,CAAC;CAID;;;;;;CAMG;CACH,SAAS,QAAQ,CAChB,KAAkD,EAAA;KAElD,OAAO,KAAK,IAAI,IAAI;CACnB,UAAE,EAAE;CACJ,UAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;CACtB,cAAE,KAAK;CACP,cAAE,OAAO,KAAK,KAAK,QAAQ;CACzB,gBAAA,OAAQ,KAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU;mBACrD,CAAC,KAAK,CAAC;CACT;qBACE,CAAC,GAAI,KAAa,CAAC,CAAC;CACxB,CAAC;CAED,SAAS,cAAc,CACtB,KAAU,EAAA;KAEV,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;CAC1D,CAAC;CAED,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