kenobi-js 0.1.42 → 0.1.44

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../../../node_modules/.pnpm/morphdom@2.7.7/node_modules/morphdom/dist/morphdom-esm.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/constants.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/util.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/options.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/create-element.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/component.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/diff/props.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/create-context.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/diff/children.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/diff/index.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/render.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/clone-element.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/diff/catch-error.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/hooks/src/index.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/jsx-runtime/src/utils.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/src/constants.js", "../../../node_modules/.pnpm/preact@10.27.2/node_modules/preact/jsx-runtime/src/index.js", "../src/cue-card.tsx"],
4
- "sourcesContent": ["/* eslint-disable no-console */\nimport morphdom from \"morphdom\";\n\nimport { CueCard } from \"./cue-card\";\nexport * from \"./cue-card\";\n\nconst VISITOR_QUERY_PARAM_KEY = \"kfor\";\nconst VISITOR_SESSION_STORAGE_KEY = \"kenobi_visitor_key\";\nconst TRANSFORMATION_DATA_ATTR_KEY = \"data-kenobi-transformation-identifier\";\n\ntype AnimationSplitTarget = \"line\" | \"word\" | \"character\";\n\nexport type AnimationName = string;\n\nexport type Easing = string;\n\n// Configurable overflow behavior for transition wrapper to prevent text clipping (e.g., gradient text descenders)\nexport type TransitionOverflow = \"hidden\" | \"visible\" | \"clip\";\n\nexport type KeyframeDefinition = Keyframe | Keyframe[];\nexport interface TextAnimationConfig {\n by: AnimationSplitTarget;\n delayMs?: number;\n staggerMs?: number;\n animationName?: AnimationName;\n keyframes?: KeyframeDefinition;\n durationMs?: number;\n}\n\nexport interface AnimationSettings {\n animationName?: AnimationName;\n keyframes?: KeyframeDefinition;\n durationMs?: number;\n delayMs?: number;\n}\n\nexport interface TransitionConfig {\n enabled?: boolean;\n /** The master duration for symmetrical transitions. */\n durationMs?: number;\n /** The master delay for symmetrical transitions. */\n delayMs?: number;\n easing?: Easing;\n animateSize?: boolean;\n /** Controls wrapper overflow to prevent clipping of text with descenders or gradient effects */\n overflow?: TransitionOverflow;\n textAnimation?: TextAnimationConfig;\n enter?: AnimationSettings;\n exit?: AnimationSettings;\n}\n\ntype NormalizedTransitionConfig = Required<\n Pick<\n TransitionConfig,\n \"enabled\" | \"durationMs\" | \"delayMs\" | \"easing\" | \"animateSize\" | \"overflow\"\n >\n> &\n TransitionConfig;\n\ntype AnimatableElement = HTMLElement | SVGElement;\n\nconst DEFAULT_TRANSITION_CONFIG: NormalizedTransitionConfig = {\n enabled: false,\n durationMs: 300,\n delayMs: 0,\n easing: \"ease\",\n animateSize: true,\n overflow: \"hidden\", // Default to hidden for clean size animations; use \"visible\" for gradient text\n};\n\nconst createNormalizedTransitionConfig = (\n config?: TransitionConfig\n): NormalizedTransitionConfig => ({\n enabled: config?.enabled ?? DEFAULT_TRANSITION_CONFIG.enabled,\n durationMs: config?.durationMs ?? DEFAULT_TRANSITION_CONFIG.durationMs,\n delayMs: config?.delayMs ?? DEFAULT_TRANSITION_CONFIG.delayMs,\n easing: config?.easing ?? DEFAULT_TRANSITION_CONFIG.easing,\n animateSize: config?.animateSize ?? DEFAULT_TRANSITION_CONFIG.animateSize,\n overflow: config?.overflow ?? DEFAULT_TRANSITION_CONFIG.overflow,\n textAnimation: config?.textAnimation,\n enter: config?.enter,\n exit: config?.exit,\n});\n\nconst mergeTransitionConfig = (\n base: NormalizedTransitionConfig,\n override?: TransitionConfig\n): NormalizedTransitionConfig => ({\n enabled: override?.enabled ?? base.enabled,\n durationMs: override?.durationMs ?? base.durationMs,\n delayMs: override?.delayMs ?? base.delayMs,\n easing: override?.easing ?? base.easing,\n animateSize: override?.animateSize ?? base.animateSize,\n overflow: override?.overflow ?? base.overflow,\n textAnimation: override?.textAnimation ?? base.textAnimation,\n enter: override?.enter ?? base.enter,\n exit: override?.exit ?? base.exit,\n});\n\nconst isAnimationName = (value: unknown): value is AnimationName =>\n typeof value === \"string\";\n\nconst isAnimatableElement = (\n element: Element\n): element is AnimatableElement => {\n if (element instanceof HTMLElement) return true;\n if (typeof SVGElement !== \"undefined\" && element instanceof SVGElement)\n return true;\n return false;\n};\n\nconst isEasing = (value: unknown): value is Easing => typeof value === \"string\";\n\n// Type guard for overflow config values (allows preventing text clipping in transitions)\nconst isTransitionOverflow = (value: unknown): value is TransitionOverflow =>\n value === \"hidden\" || value === \"visible\" || value === \"clip\";\n\nconst isAnimationSplitTarget = (\n value: unknown\n): value is AnimationSplitTarget =>\n value === \"line\" || value === \"word\" || value === \"character\";\n\nconst isKeyframeDefinition = (value: unknown): value is KeyframeDefinition => {\n if (typeof value !== \"object\" || value === null) return false;\n if (Array.isArray(value)) {\n return value.every((item) => typeof item === \"object\" && item !== null);\n }\n return true;\n};\n\nconst isAnimationSettings = (value: unknown): value is AnimationSettings => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n const { animationName, keyframes, durationMs, delayMs } = candidate;\n return (\n (animationName === undefined || isAnimationName(animationName)) &&\n (keyframes === undefined || isKeyframeDefinition(keyframes)) &&\n (durationMs === undefined || typeof durationMs === \"number\") &&\n (delayMs === undefined || typeof delayMs === \"number\")\n );\n};\n\nconst isTextAnimationConfig = (\n value: unknown\n): value is TextAnimationConfig => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n const { by, staggerMs, animationName, keyframes, delayMs, durationMs } =\n candidate;\n return (\n isAnimationSplitTarget(by) &&\n (delayMs === undefined || typeof delayMs === \"number\") &&\n (staggerMs === undefined || typeof staggerMs === \"number\") &&\n (durationMs === undefined || typeof durationMs === \"number\") &&\n (isAnimationName(animationName) || keyframes !== undefined) &&\n (keyframes === undefined || isKeyframeDefinition(keyframes))\n );\n};\n\nconst isTransitionConfig = (value: unknown): value is TransitionConfig => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n const {\n enabled,\n durationMs,\n delayMs,\n easing,\n animateSize,\n overflow,\n textAnimation,\n enter,\n exit,\n } = candidate;\n return (\n (enabled === undefined || typeof enabled === \"boolean\") &&\n (durationMs === undefined || typeof durationMs === \"number\") &&\n (delayMs === undefined || typeof delayMs === \"number\") &&\n (easing === undefined || isEasing(easing)) &&\n (animateSize === undefined || typeof animateSize === \"boolean\") &&\n (overflow === undefined || isTransitionOverflow(overflow)) &&\n (textAnimation === undefined || isTextAnimationConfig(textAnimation)) &&\n (enter === undefined || isAnimationSettings(enter)) &&\n (exit === undefined || isAnimationSettings(exit))\n );\n};\n\n/**\n * Manages and executes complex visual transitions for DOM elements.\n *\n * This class provides methods to smoothly replace elements, handle enter/exit\n * animations, and orchestrate staggered text animations, using the Web\n * Animations API (WAAPI). It is designed to handle dynamic content changes\n * gracefully, including changes in element size.\n */\nclass TransitionOrchestrator {\n /**\n * Replaces an existing element with a new one, applying coordinated enter,\n * exit, and size animations.\n *\n * The process involves creating a temporary wrapper to contain the animations,\n * measuring the new element's dimensions without causing layout shifts, and\n * then running all animations in parallel. Once complete, the wrapper is\n * replaced by the new element.\n *\n * @param oldElement The original element to be replaced.\n * @param newMarkup The HTML string for the new element.\n * @param config The transition configuration object.\n * @returns A promise that resolves with the new element after the transition completes.\n */\n public replaceWithTransition = async (\n oldElement: AnimatableElement,\n newMarkup: string,\n config: NormalizedTransitionConfig\n ): Promise<Element> => {\n //\n // SETUP\n //\n // The core challenge is to animate smoothly from the old element's state to\n // the new one, including size. To do this, we create a temporary `wrapper`\n // element that will contain both the exiting and entering elements, and\n // animate its dimensions from the old size to the new size.\n\n // 1. Create a wrapper and a clone of the old element.\n const wrapper = document.createElement(\"div\");\n wrapper.style.position = \"relative\";\n // Use configurable overflow (default \"hidden\") - set to \"visible\" to prevent gradient text clipping\n wrapper.style.overflow = config.overflow;\n\n const oldRect = oldElement.getBoundingClientRect();\n const oldStyle = window.getComputedStyle(oldElement);\n // `getBoundingClientRect` includes padding and border in width/height, so\n // we only need to copy the margin separately as it's not included.\n wrapper.style.display = oldStyle.display;\n wrapper.style.verticalAlign = oldStyle.verticalAlign;\n wrapper.style.width = `${oldRect.width}px`;\n wrapper.style.height = `${oldRect.height}px`;\n wrapper.style.margin = oldStyle.margin;\n\n const oldElClone = oldElement.cloneNode(true);\n\n // This check is necessary because `cloneNode` returns a generic Node.\n if (!(oldElClone instanceof Element) || !isAnimatableElement(oldElClone)) {\n throw new Error(\"oldElClone is not an AnimatableElement\");\n }\n\n // Position the clone absolutely within the wrapper to allow the new\n // element to be positioned on top of it.\n oldElClone.style.position = \"absolute\";\n oldElClone.style.top = \"0\";\n oldElClone.style.left = \"0\";\n oldElClone.style.width = \"100%\";\n oldElClone.style.height = \"100%\";\n oldElClone.style.margin = \"0\";\n oldElClone.style.pointerEvents = \"none\";\n wrapper.appendChild(oldElClone);\n\n // 2. Create the new element from the provided markup.\n const tempContainer = document.createElement(\"div\");\n tempContainer.innerHTML = newMarkup;\n const newElement = tempContainer.firstElementChild;\n if (\n !newElement ||\n !(newElement instanceof HTMLElement || newElement instanceof SVGElement)\n ) {\n // Fallback: if markup is empty or invalid, just animate the old element out.\n const exitAnim = this.exit(oldElement, config);\n await exitAnim.finished;\n return oldElement;\n }\n\n const originalStyle = newElement.style.cssText;\n\n // We must move text animation to after the element is in the DOM for an\n // accurate style computation, which is critical for gradient text.\n // if (config.textAnimation) {\n // this.applyTextAnimationToNode(newElement, config.textAnimation, config)\n // }\n\n //\n // MEASUREMENT\n //\n // To avoid the \"overshoot and snap\" problem, we must measure the new\n // element in a context that perfectly replicates its final position in the\n // DOM. Simply appending it to the body is not enough, as it won't inherit\n // the correct styles (e.g., flex, grid) from its parent.\n\n // 3. Perform a high-fidelity, contextual off-screen measurement.\n const parent = oldElement.parentNode;\n let newRect: DOMRect;\n\n // We create a clone of the parent element to ensure that the new element is\n // measured in a context that is identical to its final destination. This is\n // crucial for accurate dimensions, especially in flexbox or grid layouts.\n if (parent instanceof HTMLElement) {\n // Create a shallow clone of the parent; we don't need its children.\n const parentClone = parent.cloneNode(false) as HTMLElement;\n const parentStyles = window.getComputedStyle(parent);\n // Copy all computed styles from the original parent to the clone. This\n // is the key to an accurate measurement. A fallback is included for\n // Firefox, which does not support `cssText` on `CSSStyleDeclaration`.\n const cssText = parentStyles.cssText\n ? parentStyles.cssText\n : Array.from(parentStyles).reduce(\n (str, prop) =>\n `${str}${prop}:${parentStyles.getPropertyValue(prop)};`,\n \"\"\n );\n\n parentClone.style.cssText = cssText;\n // Position the clone off-screen to avoid affecting the layout.\n parentClone.style.position = \"absolute\";\n parentClone.style.top = \"-9999px\";\n parentClone.style.left = \"-9999px\";\n parentClone.style.visibility = \"hidden\";\n parentClone.style.pointerEvents = \"none\";\n\n parentClone.appendChild(newElement);\n document.body.appendChild(parentClone);\n\n // Text animations can affect element dimensions, so they must be applied\n // before we take the final measurement.\n if (config.textAnimation) {\n this.applyTextAnimationToNode(newElement, config.textAnimation, config);\n }\n\n newRect = newElement.getBoundingClientRect();\n document.body.removeChild(parentClone);\n } else {\n // Fallback to a less accurate method if the parent is not an HTMLElement.\n // This is a safety measure for edge cases where the parent might be a\n // DocumentFragment or another non-element node.\n const offscreenContainer = document.createElement(\"div\");\n offscreenContainer.style.position = \"absolute\";\n offscreenContainer.style.top = \"-9999px\";\n offscreenContainer.style.left = \"-9999px\";\n offscreenContainer.style.visibility = \"hidden\";\n\n offscreenContainer.appendChild(newElement);\n document.body.appendChild(offscreenContainer);\n\n if (config.textAnimation) {\n this.applyTextAnimationToNode(newElement, config.textAnimation, config);\n }\n\n newRect = newElement.getBoundingClientRect();\n document.body.removeChild(offscreenContainer);\n }\n\n //\n // ANIMATION\n //\n // With accurate measurements, we can now set up the final state and run the\n // animations for the exit, enter, and size transitions in parallel.\n\n // 4. Setup the new element for its entrance animation.\n newElement.style.cssText = originalStyle; // Restore original styles\n newElement.style.visibility = \"\";\n newElement.style.position = \"absolute\";\n newElement.style.top = \"0\";\n newElement.style.left = \"0\";\n newElement.style.width = `${newRect.width}px`;\n newElement.style.height = `${newRect.height}px`;\n newElement.style.margin = \"0\";\n newElement.style.opacity = \"0\"; // Start transparent for entry animation\n\n wrapper.appendChild(newElement);\n\n // Replace the original element with the wrapper in the DOM.\n oldElement.replaceWith(wrapper);\n\n // 5. Animate with the Web Animations API (WAAPI).\n const exitDelay = config.exit?.delayMs ?? config.delayMs;\n const exitDuration = config.exit?.durationMs ?? config.durationMs;\n const enterDelay = config.enter?.delayMs ?? config.delayMs;\n const enterDuration = config.enter?.durationMs ?? config.durationMs;\n\n const animations: Animation[] = [];\n\n // Exit animation\n const exitKeyframes = this.resolveKeyframes(config.exit?.keyframes);\n const exitAnim = oldElClone.animate(exitKeyframes, {\n duration: exitDuration,\n delay: exitDelay,\n easing: config.easing,\n fill: \"forwards\",\n });\n animations.push(exitAnim);\n\n // Enter animation\n const enterKeyframes = this.resolveKeyframes(config.enter?.keyframes);\n const enterAnim = newElement.animate(enterKeyframes, {\n duration: enterDuration,\n delay: enterDelay,\n easing: config.easing,\n fill: \"forwards\",\n });\n animations.push(enterAnim);\n\n // Size animation\n if (config.animateSize) {\n const sizeAnim = wrapper.animate(\n [\n { width: `${oldRect.width}px`, height: `${oldRect.height}px` },\n { width: `${newRect.width}px`, height: `${newRect.height}px` },\n ],\n {\n duration: enterDuration, // Match the enter animation\n delay: enterDelay,\n easing: config.easing,\n fill: \"forwards\",\n }\n );\n animations.push(sizeAnim);\n }\n\n // 6. Wait for all animations to finish.\n await Promise.all(animations.map((a) => a.finished));\n\n //\n // CLEANUP\n //\n // Once animations are complete, we replace the wrapper with the new element\n // and restore its original styles, leaving the DOM in a clean state.\n\n // 7. Cleanup and final DOM replacement.\n if (wrapper.parentNode) {\n wrapper.replaceWith(newElement);\n }\n newElement.style.cssText = originalStyle; // Restore original styles\n oldElClone.remove();\n\n return newElement;\n };\n\n /**\n * Triggers an enter animation on a given element.\n * @param element The element to animate.\n * @param config The transition configuration.\n * @returns The Animation object for the enter transition.\n */\n public enter = (\n element: AnimatableElement,\n config: NormalizedTransitionConfig\n ): Animation => {\n const enterDelay = config.enter?.delayMs ?? config.delayMs;\n const enterDuration = config.enter?.durationMs ?? config.durationMs;\n\n const keyframes = this.resolveKeyframes(config.enter?.keyframes);\n return element.animate(keyframes, {\n duration: enterDuration,\n delay: enterDelay,\n easing: config.easing,\n fill: \"forwards\",\n });\n };\n\n /**\n * Triggers an exit animation on a given element.\n * @param element The element to animate.\n * @param config The transition configuration.\n * @returns The Animation object for the exit transition.\n */\n public exit = (\n element: AnimatableElement,\n config: NormalizedTransitionConfig\n ): Animation => {\n const exitDelay = config.exit?.delayMs ?? config.delayMs;\n const exitDuration = config.exit?.durationMs ?? config.durationMs;\n\n const keyframes = this.resolveKeyframes(config.exit?.keyframes);\n return element.animate(keyframes, {\n duration: exitDuration,\n delay: exitDelay,\n easing: config.easing,\n fill: \"forwards\",\n });\n };\n\n /**\n * Resolves the keyframes to be used for an animation, prioritizing custom\n * definitions over presets.\n * @param definition An optional custom keyframe definition.\n * @returns An array of keyframes for use with WAAPI.\n */\n private resolveKeyframes = (definition?: KeyframeDefinition): Keyframe[] => {\n if (definition) {\n return Array.isArray(definition) ? definition : [definition];\n }\n return [];\n };\n\n /**\n * Traverses a DOM node to find text nodes and applies a staggered animation\n * to them by splitting the text into lines, words, or characters.\n *\n * Each segment is wrapped in a `<span>` and animated individually to create\n * a \"typewriter\" or \"reveal\" effect.\n *\n * @param element The root element to traverse for text nodes.\n * @param config The text animation configuration.\n * @param transitionConfig The parent transition configuration for timing.\n */\n private applyTextAnimationToNode = (\n element: Element,\n config: TextAnimationConfig,\n transitionConfig: NormalizedTransitionConfig\n ) => {\n const initialDelay = config.delayMs ?? 0;\n const computedStyle = window.getComputedStyle(element);\n const isBackgroundClippedToText =\n computedStyle.getPropertyValue(\"background-clip\") === \"text\" ||\n computedStyle.getPropertyValue(\"-webkit-background-clip\") === \"text\";\n\n // This recursive function will traverse the DOM, keeping track of the animation delay.\n const traverseAndAnimate = (\n node: Node,\n currentDelay: number,\n isBackgroundClippedToText: boolean\n ): number => {\n // If it's a text node, split and animate it.\n if (node.nodeType === Node.TEXT_NODE) {\n const text = node.textContent ?? \"\";\n if (text.trim().length === 0) {\n return currentDelay; // Don't animate whitespace-only nodes\n }\n\n // ------------\n // Special handling for character animation to prevent breaking words\n // ------------\n if (config.by === \"character\") {\n const words = text.split(/(\\s+)/);\n const fragment = document.createDocumentFragment();\n let delay = currentDelay;\n\n words.forEach((word) => {\n if (word.length === 0) return;\n\n // Preserve whitespace as plain text nodes\n if (word.trim().length === 0) {\n fragment.appendChild(document.createTextNode(word));\n return;\n }\n\n // Wrap words in a span that prevents line breaks inside the word\n const wordWrapper = document.createElement(\"span\");\n wordWrapper.style.display = \"inline-block\";\n wordWrapper.style.whiteSpace = \"nowrap\";\n\n if (isBackgroundClippedToText) {\n // Ensure the wrapper propagates background properties\n wordWrapper.style.setProperty(\"background\", \"inherit\");\n wordWrapper.style.setProperty(\"-webkit-background-clip\", \"text\");\n wordWrapper.style.setProperty(\"background-clip\", \"text\");\n wordWrapper.style.setProperty(\"color\", \"transparent\");\n }\n\n const chars = word.split(\"\");\n chars.forEach((char) => {\n const span = document.createElement(\"span\");\n span.textContent = char;\n span.style.display = \"inline-block\";\n span.style.opacity = \"0\";\n\n if (isBackgroundClippedToText) {\n span.style.setProperty(\"background\", \"inherit\");\n span.style.setProperty(\"-webkit-background-clip\", \"text\");\n span.style.setProperty(\"background-clip\", \"text\");\n span.style.setProperty(\"color\", \"transparent\");\n\n // Add padding to prevent clipping of descenders/gradients\n span.style.paddingBottom = \"0.1em\";\n span.style.marginBottom = \"-0.1em\";\n\n // Remove will-change if it's causing layer clipping issues\n // span.style.setProperty(\"will-change\", \"opacity, transform\");\n }\n\n const keyframes = this.resolveKeyframes(config.keyframes);\n const duration =\n config.durationMs ?? transitionConfig.durationMs ?? 300;\n const easing = transitionConfig.easing ?? \"ease\";\n\n const animation = span.animate(keyframes, {\n duration,\n easing,\n delay,\n fill: \"forwards\",\n });\n\n animation.addEventListener(\"finish\", () => {\n animation.commitStyles();\n animation.cancel();\n });\n\n wordWrapper.appendChild(span);\n delay += config.staggerMs ?? 50;\n });\n\n fragment.appendChild(wordWrapper);\n });\n\n node.parentNode?.replaceChild(fragment, node);\n return delay;\n }\n\n let segments: string[];\n switch (config.by) {\n case \"word\":\n segments = text.split(/(\\s+)/); // Preserve spaces as segments\n break;\n case \"line\":\n segments = text.split(\"\\n\");\n break;\n default:\n segments = text.split(\"\"); // Fallback (shouldn't happen with types)\n }\n\n const fragment = document.createDocumentFragment();\n let delay = currentDelay;\n\n segments.forEach((segment) => {\n if (segment.length === 0) return;\n const isWhitespace = segment.trim().length === 0;\n\n // Preserve whitespace as plain text nodes\n if (isWhitespace) {\n fragment.appendChild(document.createTextNode(segment));\n return;\n }\n\n const span = document.createElement(\"span\");\n span.textContent = segment;\n span.style.display = \"inline-block\";\n span.style.opacity = \"0\";\n\n if (isBackgroundClippedToText) {\n span.style.setProperty(\"background\", \"inherit\");\n span.style.setProperty(\"-webkit-background-clip\", \"text\");\n span.style.setProperty(\"background-clip\", \"text\");\n span.style.setProperty(\"color\", \"transparent\");\n span.style.setProperty(\"will-change\", \"opacity, transform\");\n }\n\n const keyframes = this.resolveKeyframes(config.keyframes);\n const duration =\n config.durationMs ?? transitionConfig.durationMs ?? 300;\n const easing = transitionConfig.easing ?? \"ease\";\n\n const animation = span.animate(keyframes, {\n duration,\n easing,\n delay,\n fill: \"forwards\",\n });\n\n animation.addEventListener(\"finish\", () => {\n animation.commitStyles();\n animation.cancel();\n });\n\n fragment.appendChild(span);\n delay += config.staggerMs ?? 50;\n });\n\n node.parentNode?.replaceChild(fragment, node);\n return delay; // Return the updated delay\n }\n\n // If it's an element node, traverse its children.\n if (node.nodeType === Node.ELEMENT_NODE) {\n let delay = currentDelay;\n // We must work with a static copy of child nodes, as the collection will be modified.\n const children = Array.from(node.childNodes);\n for (const child of children) {\n delay = traverseAndAnimate(child, delay, isBackgroundClippedToText);\n }\n return delay; // Return the final delay after traversing all children\n }\n\n // For any other node type, just continue with the same delay.\n return currentDelay;\n };\n\n // Start the traversal from the root element.\n traverseAndAnimate(element, initialDelay, isBackgroundClippedToText);\n };\n}\n\n/**\n * Response from the cue-card-config API endpoint.\n * Used to determine if a CueCard should be mounted and with what config.\n */\ninterface CueCardConfigResponse {\n enabled: boolean;\n config?: {\n theme?: \"glass\" | \"light\" | \"dark\";\n position?: \"top-center\" | \"top-right\";\n direction?: \"top-to-bottom\" | \"right-to-left\";\n fields: Array<{\n name: string;\n label: string;\n placeholder?: string;\n type?: \"text\" | \"email\" | \"tel\" | \"url\";\n required?: boolean;\n pattern?: string;\n minLength?: number;\n maxLength?: number;\n errorMessage?: string;\n }>;\n enableFocusMode?: boolean;\n showWatermark?: boolean;\n showKeyboardHints?: boolean;\n enableLauncher?: boolean;\n customTheme?: {\n fontFamily?: string;\n backgroundColor?: string;\n borderColor?: string;\n textColor?: string;\n subtitleColor?: string;\n primaryColor?: string;\n primaryTextColor?: string;\n borderRadius?: string;\n };\n textOverrides?: {\n titleResting?: string;\n titleSuccess?: string;\n titleError?: string;\n subtitleResting?: string;\n subtitleSuccess?: string;\n subtitleError?: string;\n btnResting?: string;\n btnSuccess?: string;\n btnLoading?: string;\n btnError?: string;\n launcherLabel?: string;\n };\n enableUndoToggle?: boolean;\n };\n}\n\nconst isCueCardConfigResponse = (\n value: unknown\n): value is CueCardConfigResponse => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n return typeof candidate.enabled === \"boolean\";\n};\n\n/**\n * Configuration options for the Kenobi instance.\n *\n * When `publicKey` is provided, Kenobi automatically:\n * 1. Mounts a CueCard UI for visitor input\n * 2. Handles form submission\n * 3. Calls the personalization API\n * 4. Applies transformations to the page\n *\n * Future: CueCard config will be fetched per-org from the database.\n * For now, default config matching the template editor is used.\n */\ninterface KenobiConfig {\n /**\n * Your Kenobi public key (pk_live_xxx or pk_test_xxx).\n * When provided, a CueCard is automatically mounted and the\n * personalization flow is handled end-to-end.\n */\n publicKey?: string;\n apiHost?: string;\n siteVersionId?: string;\n debug?: boolean;\n autoTransform?: boolean;\n transitionDefaults?: TransitionConfig;\n /**\n * When true, skips automatic CueCard mounting even when publicKey is set.\n * Use this when you want to manage the CueCard externally but still use\n * the SDK's personalize() method.\n */\n skipCueCardAutoMount?: boolean;\n}\n\ninterface ApplyTransformationsOpts {\n shouldConsolidate?: boolean;\n}\n\ninterface UndoOperationBase {\n type: \"Remove\" | \"Replace\" | \"SetInput\";\n ref: Element;\n}\n\ninterface UndoOperationRemove extends UndoOperationBase {\n type: \"Remove\";\n}\n\ninterface UndoOperationReplace extends UndoOperationBase {\n type: \"Replace\";\n content: string;\n}\n\ninterface UndoInputElementSet extends UndoOperationBase {\n type: \"SetInput\";\n content: string;\n}\n\ntype UndoOperation =\n | UndoOperationRemove\n | UndoOperationReplace\n | UndoInputElementSet;\n\ninterface ChangeStackEntry {\n undoOpts: UndoOperation;\n}\n\nexport type TransformationAction =\n | \"Replace\"\n | \"InsertBefore\"\n | \"InsertAfter\"\n | \"Delete\"\n | \"SetFormField\";\n\nexport interface Transformation {\n identifier: string;\n markup: string;\n selectorGuesses: string[];\n action: TransformationAction;\n transition?: TransitionConfig;\n}\n\nexport const TRANSFORMATION_ACTIONS: ReadonlySet<TransformationAction> =\n new Set([\"Replace\", \"InsertBefore\", \"InsertAfter\", \"Delete\", \"SetFormField\"]);\n\nconst isString = (value: unknown): value is string => typeof value === \"string\";\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => isString(item));\n\nconst isTransformationAction = (\n value: unknown\n): value is TransformationAction =>\n typeof value === \"string\" &&\n TRANSFORMATION_ACTIONS.has(value as TransformationAction);\n\nconst isTransformation = (value: unknown): value is Transformation => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n return (\n isString(candidate.identifier) &&\n typeof candidate.markup === \"string\" &&\n isStringArray(candidate.selectorGuesses) &&\n isTransformationAction(candidate.action) &&\n (candidate.transition === undefined ||\n isTransitionConfig(candidate.transition))\n );\n};\n\nconst parseTransformationsResponse = (payload: unknown): Transformation[] => {\n if (typeof payload !== \"object\" || payload === null) {\n throw new Error(\"Invalid response: expected object with data array\");\n }\n\n const data = (payload as Record<string, unknown>).data;\n if (!Array.isArray(data)) {\n throw new Error(\"Invalid response: data must be an array\");\n }\n\n data.forEach((item, index) => {\n if (!isTransformation(item)) {\n throw new Error(`Invalid transformation at index ${index}`);\n }\n });\n\n return data;\n};\n\nclass Kenobi {\n private config: KenobiConfig;\n private changeStack: Map<string, ChangeStackEntry> = new Map<\n string,\n ChangeStackEntry\n >();\n private visitorKey: string | null = null;\n private orchestrator: TransitionOrchestrator;\n private cueCardInstance: CueCard | null = null;\n //\n private currentPath: string;\n private currentUrl: string;\n private navTicking = false;\n private transitionDefaults: NormalizedTransitionConfig;\n\n // Undo toggle state\n private lastAppliedTransformations: Transformation[] = [];\n public isPersonalized = false;\n\n constructor(config?: KenobiConfig) {\n this.config = {\n apiHost: \"https://kenobi.ai/api\",\n debug: false,\n autoTransform: true,\n ...config,\n };\n\n this.transitionDefaults = createNormalizedTransitionConfig(\n this.config.transitionDefaults\n );\n this.orchestrator = new TransitionOrchestrator();\n\n this.syncVisitorKey();\n\n this.currentPath = this.getCurrentPath();\n this.currentUrl = this.getCurrentUrl();\n\n try {\n this.initNavigationListener();\n } catch (error) {\n this.log(\n \"error\",\n \"Failed to initialize navigation listener with error:\",\n error\n );\n }\n this.log(\"debug\", \"Kenobi initialized\");\n\n if (this.config.autoTransform) {\n this.log(\"debug\", \"Auto-transform is requested... Starting...\");\n void this.startAutoTransform();\n }\n\n // Auto-mount CueCard when publicKey is provided (unless skipCueCardAutoMount is set)\n if (this.config.publicKey && !this.config.skipCueCardAutoMount) {\n this.log(\"debug\", \"Public key provided, checking for active template...\");\n void this.initCueCard();\n }\n }\n\n private startAutoTransform = async () => {\n try {\n this.syncChangeStack();\n\n // All the waits!\n await this.waitForLoaded();\n\n if (this.isFramer()) {\n await this.waitForFrames();\n await this.waitForIdle();\n await this.waitForQuietDom(100, 1_000);\n }\n\n // Go go go!\n await this.transform();\n } catch (error) {\n this.log(\"error\", \"Auto-transformation flow failed with error:\", error);\n }\n };\n\n public transform = async () => {\n try {\n const startTime = new Date();\n this.log(\"debug\", \"Starting transform\");\n\n if (this.visitorKey === null) {\n this.log(\n \"debug\",\n `Couldn't find a visitor copy external ID with query param key \"${VISITOR_QUERY_PARAM_KEY}\"`,\n \"Exiting...\"\n );\n return;\n }\n\n let transformations: Transformation[] = [];\n\n try {\n transformations = await this.getTransformations(\n this.currentPath,\n this.visitorKey\n );\n } catch (error) {\n this.log(\n \"error_detailed\",\n \"An error occurred _getting_ transformations\",\n error\n );\n }\n\n try {\n await this.applyTransformations(transformations);\n } catch (error) {\n this.log(\n \"error_detailed\",\n \"An error occurred _applying_ transformations\",\n error\n );\n }\n\n // END!\n const endTime = new Date();\n const fnDuration = this.getDurationInMilliseconds(startTime, endTime);\n this.log(\n \"debug\",\n `Transformation complete, took ${this.formatThousands(fnDuration)} ms`\n );\n } catch (error) {\n this.log(\n \"error\",\n \"An unexpected, top-level error occurred during transformation\",\n error\n );\n }\n };\n\n /*\n ----\n -- UTILITIES\n ----\n */\n private log = (\n level: \"debug\" | \"info\" | \"warn\" | \"error\" | \"error_detailed\",\n message: string,\n ...rest: unknown[]\n ) => {\n const version =\n typeof window.__KENOBI_VERSION__ !== \"undefined\"\n ? window.__KENOBI_VERSION__\n : \"dev\";\n const masthead = `[Kenobi \u25D4] (v${version})`;\n const text = `${masthead} [${level.toLocaleUpperCase()}] :: ${message}`;\n switch (level) {\n case \"debug\":\n if (this.config.debug) console.log(text, ...rest);\n break;\n case \"info\":\n console.log(text, ...rest);\n break;\n case \"warn\":\n console.warn(text, ...rest);\n break;\n case \"error_detailed\":\n console.trace(...rest);\n // fallthrough\n case \"error\":\n console.error(text, ...rest);\n break;\n }\n };\n\n private resolveTransitionConfig = (\n override?: TransitionConfig\n ): NormalizedTransitionConfig =>\n mergeTransitionConfig(this.transitionDefaults, override);\n\n private retrieveElement = (selectorGuesses: string[]) => {\n if (\n !Array.isArray(selectorGuesses) ||\n selectorGuesses.some((s) => typeof s !== \"string\")\n ) {\n throw new Error(\n `Invalid selectorGuesses payload received: expected array of strings but got ${JSON.stringify(\n selectorGuesses\n )}`\n );\n }\n\n for (const selector of selectorGuesses) {\n const candidates = document.querySelectorAll(selector);\n if (candidates.length === 0) continue;\n\n // Single match - return directly\n if (candidates.length === 1) return candidates[0];\n\n // Multiple matches - filter to visible desktop elements and prefer above-fold\n const visible = Array.from(candidates).filter((el) => {\n const rect = el.getBoundingClientRect();\n const style = getComputedStyle(el);\n return (\n style.display !== \"none\" &&\n style.visibility !== \"hidden\" &&\n rect.width > 0 &&\n rect.height > 0\n );\n });\n\n if (visible.length === 0) continue;\n\n // Prefer element closest to viewport top (hero area)\n const sorted = visible.sort(\n (a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top\n );\n\n this.log(\n \"debug\",\n `Selector \"${selector}\" matched ${\n candidates.length\n } elements, selected topmost visible one at y=${\n sorted[0].getBoundingClientRect().top\n }`\n );\n\n return sorted[0];\n }\n throw new Error(\n `Could not find an element in the document with any of these selector patterns: ${selectorGuesses.join(\n \", \"\n )}`\n );\n };\n\n private getQueryParam = (key: string) => {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get(key);\n };\n\n private getCurrentPath = () => window.location.pathname;\n private getCurrentUrl = () =>\n window.location.pathname + window.location.search + window.location.hash;\n\n private getDurationInMilliseconds = (start: Date, end: Date) => +end - +start;\n\n private formatThousands = (number: number) =>\n new Intl.NumberFormat(\"en-US\").format(number);\n\n public setDebug = (value: boolean) => (this.config.debug = value);\n\n private isInputElement = (\n el: Element\n ): el is HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement => {\n if (\n !(el instanceof HTMLInputElement) &&\n !(el instanceof HTMLTextAreaElement) &&\n !(el instanceof HTMLSelectElement)\n )\n return false;\n\n return true;\n };\n\n /*\n ----\n -- UTILITIES // PAGE WAITING\n ----\n */\n\n private waitForFrames = () =>\n // waits 2 animation frames\n new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)));\n\n private waitForIdle = (timeout = 1000) => {\n return new Promise<void>((r) =>\n \"requestIdleCallback\" in window\n ? window.requestIdleCallback(() => r(), { timeout })\n : setTimeout(r, 50)\n );\n };\n\n private waitForLoaded = () => {\n if (document.readyState === \"complete\") return Promise.resolve();\n return new Promise<void>((r) =>\n window.addEventListener(\"load\", () => r(), { once: true })\n );\n };\n\n private waitForQuietDom = (maxWaitMs: number, quietMs: number) => {\n return new Promise<void>((resolve) => {\n let last = performance.now();\n const mo = new MutationObserver(() => {\n last = performance.now();\n });\n mo.observe(document.documentElement, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n const deadline = performance.now() + maxWaitMs;\n (function tick() {\n const now = performance.now();\n if (now - last >= quietMs) {\n mo.disconnect();\n resolve();\n return;\n }\n if (now >= deadline) {\n mo.disconnect();\n resolve();\n return;\n }\n requestAnimationFrame(tick);\n })();\n });\n };\n\n /*\n ----\n -- UTILITIES // PLATFORMS\n ----\n */\n\n private isFramer = () => {\n const scripts = Array.from(document.scripts).map((s) => s.src || \"\");\n const conditions = [\n \"__framer_events\" in window,\n document.querySelector(\n \"[data-framer-root],[data-framer-component],[data-framer-page]\"\n ),\n scripts.some((src) => /framerusercontent\\.com\\/sites/i.test(src)),\n ];\n return conditions.some((c) => !!c);\n };\n\n /*\n ----\n -- VISITOR STATE MANAGEMENT\n ----\n */\n private syncVisitorKey = () => {\n try {\n const queryParamValue = this.getQueryParam(VISITOR_QUERY_PARAM_KEY);\n if (queryParamValue) {\n this.log(\n \"debug\",\n `Query param value found (${queryParamValue}), pushing into session storage`\n );\n sessionStorage.setItem(VISITOR_SESSION_STORAGE_KEY, queryParamValue);\n this.visitorKey = queryParamValue;\n } else {\n this.visitorKey = sessionStorage.getItem(VISITOR_SESSION_STORAGE_KEY);\n }\n } catch (error) {\n this.log(\"error\", \"Failed to sync visitor key with error:\", error);\n }\n };\n\n private initNavigationListener = () => {\n // avoid double-hooking if multiple instances\n if (\"__KENOBI_NAV_HOOKED__\" in window) return;\n window.__KENOBI_NAV_HOOKED__ = true;\n\n const schedule = (src: string) => {\n if (this.navTicking) return;\n this.navTicking = true;\n queueMicrotask(() => {\n this.navTicking = false;\n const nextUrl = this.getCurrentUrl();\n if (nextUrl !== this.currentUrl) {\n this.currentUrl = nextUrl;\n this.currentPath = this.getCurrentPath(); // still just pathname for your API\n this.log(\"debug\", `URL changed (${src}) \u2192 ${location.href}`);\n if (this.config.autoTransform) {\n this.undoAll();\n void this.startAutoTransform();\n }\n // Sync CueCard visibility based on new path\n this.syncCueCardVisibility();\n }\n });\n };\n\n // 1) Navigation API (Chromium, Safari TP)\n if (\"navigation\" in window) {\n const nav = window.navigation;\n if (\n nav &&\n \"addEventListener\" in nav &&\n typeof nav.addEventListener === \"function\"\n ) {\n nav.addEventListener(\"navigate\", () => schedule(\"navigation:navigate\"));\n nav.addEventListener(\"currententrychange\", () =>\n schedule(\"navigation:entrychange\")\n );\n nav.addEventListener?.(\"navigatesuccess\", () =>\n schedule(\"navigation:success\")\n );\n }\n }\n\n // 2) History API hooks\n const origPush = history.pushState.bind(history);\n const origRepl = history.replaceState.bind(history);\n history.pushState = ((...args: Parameters<History[\"pushState\"]>) => {\n const ret = origPush(...args);\n schedule(\"pushState\");\n return ret;\n }) as History[\"pushState\"];\n history.replaceState = ((...args: Parameters<History[\"replaceState\"]>) => {\n const ret = origRepl(...args);\n schedule(\"replaceState\");\n return ret;\n }) as History[\"replaceState\"];\n\n // 3) Browser events\n window.addEventListener(\"popstate\", () => schedule(\"popstate\"));\n window.addEventListener(\"hashchange\", () => schedule(\"hashchange\"));\n\n // 4) Anchor clicks (covers some router edge cases)\n document.addEventListener(\n \"click\",\n (e) => {\n const t = e.target as Element | null;\n const a = t && (t.closest?.(\"a[href]\") as HTMLAnchorElement | null);\n if (!a) return;\n if (a.target && a.target !== \"_self\") return;\n const url = new URL(a.href, location.href);\n if (url.origin !== location.origin) return;\n // router may pushState on next tick\n setTimeout(() => schedule(\"click\"), 0);\n },\n true\n );\n\n // 5) Cheap last-resort poller (handles exotic SPA routers)\n setInterval(() => {\n const next = this.getCurrentUrl();\n if (next !== this.currentUrl) schedule(\"poll\");\n }, 1_000);\n };\n\n /*\n ----\n -- DATA RETRIEVAL\n ----\n */\n private getTransformations = async (\n path: string,\n visitorCopyId: string\n ): Promise<Transformation[]> => {\n const searchParams = new URLSearchParams({\n path,\n // siteId: this.config.siteId,\n // publicKey: this.config.publicKey,\n });\n\n const rawResponse = await fetch(\n `${\n this.config.apiHost\n }/v1/visitor-copy-transformations/${visitorCopyId}?${searchParams.toString()}`\n );\n const responseJson = await rawResponse.json();\n\n if (!rawResponse.ok) {\n throw new Error(\n `Network error (status ${\n rawResponse.status\n }) with json body: ${JSON.stringify(responseJson, null, 2)}`\n );\n }\n\n return parseTransformationsResponse(responseJson);\n };\n\n private validateTransitionPreconditions = (\n identifier: string,\n markup: string,\n transitionConfig: NormalizedTransitionConfig\n ): boolean => {\n if (transitionConfig.enabled) {\n const tempContainer = document.createElement(\"div\");\n tempContainer.innerHTML = markup;\n const prospectiveElement = tempContainer.firstElementChild;\n if (!prospectiveElement || !isAnimatableElement(prospectiveElement)) {\n this.log(\n \"warn\",\n `Transformation \"${identifier}\" was skipped: A transition was requested, but the element is not animatable.`\n );\n return false; // Indicates failure, caller should hard-exit.\n }\n }\n return true; // Indicates success\n };\n\n /*\n ----\n -- DOM + TRANSFORMATION MANIPULATION\n ----\n */\n public applyTransformations = async (\n transformations: Transformation[],\n opts?: ApplyTransformationsOpts\n ) => {\n this.log(\"debug\", `Starting ${transformations.length} transformations`);\n\n // \"Consolidation\" mode traverses the existing changestack and diffs it\n // against the provided transformations, so that only those provided here\n // and now will apply (all others will be undone).\n if (opts?.shouldConsolidate) {\n this.changeStack.forEach((_, key) => {\n const matchingTransformation = transformations.find(\n (tran) => tran.identifier === key\n );\n if (matchingTransformation) {\n this.undo(key);\n }\n });\n }\n\n for (const { identifier, ...transformation } of transformations) {\n try {\n if (this.changeStack.get(identifier)) {\n throw new Error(\"Transformation already exists in stack\");\n }\n\n const cursor = this.retrieveElement(transformation.selectorGuesses);\n\n switch (transformation.action) {\n case \"Replace\": {\n const originalOuterHtml = cursor.outerHTML;\n const transitionConfig = this.resolveTransitionConfig(\n transformation.transition\n );\n\n if (\n transitionConfig.enabled &&\n isAnimatableElement(cursor) &&\n \"animate\" in cursor\n ) {\n const newElement = await this.orchestrator.replaceWithTransition(\n cursor,\n transformation.markup,\n transitionConfig\n );\n this.setOrUpdateReplaceChangeRef(\n identifier,\n originalOuterHtml,\n newElement\n );\n } else {\n morphdom(cursor, transformation.markup, {});\n this.setOrUpdateReplaceChangeRef(\n identifier,\n originalOuterHtml,\n cursor\n );\n }\n\n if (cursor.nodeName === \"VIDEO\")\n (cursor as HTMLVideoElement).play();\n\n break;\n }\n\n case \"InsertBefore\": {\n const transitionConfig = this.resolveTransitionConfig(\n transformation.transition\n );\n\n // check for animatability before any mutations.\n if (\n !this.validateTransitionPreconditions(\n identifier,\n transformation.markup,\n transitionConfig\n )\n ) {\n break;\n }\n\n cursor.insertAdjacentHTML(\"beforebegin\", transformation.markup);\n const ref = cursor.previousElementSibling;\n if (ref === null) throw new Error(\"Element wasn't created\");\n ref.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n\n if (transitionConfig.enabled && isAnimatableElement(ref)) {\n const originalStyle = ref.style.cssText;\n ref.style.opacity = \"0\";\n const anim = this.orchestrator.enter(ref, {\n ...transitionConfig,\n delayMs:\n transitionConfig.enter?.delayMs ?? transitionConfig.delayMs,\n });\n anim.addEventListener(\n \"finish\",\n () => {\n ref.style.cssText = originalStyle;\n },\n {\n once: true,\n }\n );\n }\n\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"Remove\",\n ref,\n },\n });\n break;\n }\n\n case \"InsertAfter\": {\n const transitionConfig = this.resolveTransitionConfig(\n transformation.transition\n );\n\n // check for animatability before any mutations.\n if (\n !this.validateTransitionPreconditions(\n identifier,\n transformation.markup,\n transitionConfig\n )\n ) {\n break;\n }\n\n cursor.insertAdjacentHTML(\"afterend\", transformation.markup);\n const ref = cursor.nextElementSibling;\n if (ref === null) throw new Error(\"Element wasn't created\");\n ref.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n\n if (transitionConfig.enabled && isAnimatableElement(ref)) {\n const originalStyle = ref.style.cssText;\n ref.style.opacity = \"0\";\n const anim = this.orchestrator.enter(ref, {\n ...transitionConfig,\n delayMs:\n transitionConfig.enter?.delayMs ?? transitionConfig.delayMs,\n });\n anim.addEventListener(\n \"finish\",\n () => {\n ref.style.cssText = originalStyle;\n },\n {\n once: true,\n }\n );\n }\n\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"Remove\",\n ref,\n },\n });\n break;\n }\n\n case \"Delete\": {\n const originalOuterHtml = cursor.outerHTML;\n morphdom(\n cursor,\n `<div style=\"display: none;\" data-kenobi-delete-marker=\"true\"></div>`,\n {}\n );\n cursor.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"Replace\",\n ref: cursor,\n content: originalOuterHtml,\n },\n });\n break;\n }\n\n case \"SetFormField\": {\n if (!this.isInputElement(cursor))\n throw new Error(\"Element targeted is not of a supported type\");\n const originalValue = cursor.value;\n this.setInputValue(cursor, transformation.markup);\n cursor.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"SetInput\",\n ref: cursor,\n content: originalValue,\n },\n });\n }\n }\n } catch (err) {\n this.log(\n \"warn\",\n `Unable to apply transformation with identifier \"${identifier}\"`,\n err\n );\n }\n }\n\n // Store transformations for redo and mark as personalized\n this.lastAppliedTransformations = transformations;\n this.isPersonalized = true;\n this.updateCueCardPersonalizationState();\n };\n\n /**\n * Creates or updates an entry in the change stack for a \"Replace\" action,\n * enabling undo functionality.\n *\n * This function ensures that for any given transformation identifier, there is a\n * corresponding undo record. It handles both the initial creation of this\n * record and updates to it if a transformation is re-applied, for instance,\n * after a transition.\n *\n * @param identifier The unique identifier for the transformation.\n * @param originalOuterHtml The original outerHTML of the element before replacement.\n * @param ref The new element that has replaced the original one.\n */\n private setOrUpdateReplaceChangeRef = (\n identifier: string,\n originalOuterHtml: string,\n ref: Element\n ) => {\n // Check if an undo record for this identifier already exists.\n const existing = this.changeStack.get(identifier);\n\n // If no record exists, this is the first time we're applying this transformation.\n if (!existing) {\n // Mark the new element with a data attribute for tracking.\n ref.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n // Create a new entry in the change stack with the necessary undo information.\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"Replace\",\n ref, // The new element to be replaced back on undo.\n content: originalOuterHtml, // The original content to restore.\n },\n });\n return;\n }\n\n // If a record already exists, we are updating the reference.\n // This happens when a transition completes and the final element is different\n // from the one we started with (e.g., the wrapper).\n const previousRef = existing.undoOpts.ref;\n if (previousRef && previousRef !== ref && previousRef.isConnected) {\n // Clean up the data attribute from the old element reference if it's still in the DOM.\n previousRef.removeAttribute(TRANSFORMATION_DATA_ATTR_KEY);\n }\n\n // Mark the new element reference and update the change stack entry.\n ref.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n existing.undoOpts.ref = ref;\n };\n\n private syncChangeStack = () => {\n let pruned = 0;\n\n for (const [id, entry] of this.changeStack) {\n const ref = entry.undoOpts.ref;\n const alive = !!ref && (ref.isConnected || document.contains(ref));\n\n // drop if the node is gone\n if (!alive) {\n this.changeStack.delete(id);\n pruned++;\n continue;\n }\n\n // drop if our marker no longer matches (not our transform anymore)\n const marker = ref.getAttribute(TRANSFORMATION_DATA_ATTR_KEY);\n if (marker !== id) {\n this.changeStack.delete(id);\n pruned++;\n }\n }\n\n this.log(\n \"debug\",\n `syncChangeStack pruned ${this.formatThousands(pruned)} stale entries`\n );\n };\n\n public undo = (identifier: string) => {\n const stackItem = this.changeStack.get(identifier);\n\n if (stackItem === undefined) {\n throw new Error(\n `Cannot undo stack item with identifier ${identifier} as it does not exist.`\n );\n }\n\n const { undoOpts } = stackItem;\n switch (undoOpts.type) {\n case \"Remove\": {\n undoOpts.ref.remove();\n break;\n }\n case \"Replace\": {\n morphdom(undoOpts.ref, undoOpts.content);\n undoOpts.ref.removeAttribute(TRANSFORMATION_DATA_ATTR_KEY);\n break;\n }\n case \"SetInput\": {\n if (!this.isInputElement(undoOpts.ref))\n throw new Error(\"Element targeted is not of a supported type\");\n this.setInputValue(undoOpts.ref, undoOpts.content);\n undoOpts.ref.removeAttribute(TRANSFORMATION_DATA_ATTR_KEY);\n break;\n }\n }\n\n this.changeStack.delete(identifier);\n };\n\n public undoAll = () => {\n this.changeStack.forEach((_, ident) => this.undo(ident));\n };\n\n /**\n * Toggles between personalized and original content.\n * Updates CueCard state accordingly.\n */\n public toggleTransformations = async () => {\n if (this.isPersonalized) {\n // Currently personalized, switch to original\n this.undoAll();\n this.isPersonalized = false;\n this.log(\"debug\", \"Toggled to original content\");\n } else {\n // Currently showing original, re-apply transformations\n if (this.lastAppliedTransformations.length > 0) {\n await this.applyTransformations(this.lastAppliedTransformations, {\n shouldConsolidate: true,\n });\n }\n this.isPersonalized = true;\n this.log(\"debug\", \"Toggled to personalized content\");\n }\n this.updateCueCardPersonalizationState();\n };\n\n /**\n * Updates the CueCard's isPersonalized state to sync the toggle button.\n */\n private updateCueCardPersonalizationState = () => {\n if (this.cueCardInstance) {\n this.cueCardInstance.update({ isPersonalized: this.isPersonalized });\n }\n };\n\n private setInputValue = (\n el: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement,\n value: string\n ) => {\n const proto =\n el instanceof HTMLTextAreaElement\n ? HTMLTextAreaElement.prototype\n : el instanceof HTMLInputElement\n ? HTMLInputElement.prototype\n : HTMLSelectElement.prototype;\n\n const descriptor = Object.getOwnPropertyDescriptor(proto, \"value\");\n if (!descriptor?.set) {\n throw new Error(\"No value setter found\");\n }\n descriptor.set.call(el, value); // native setter updates the DOM property without clobbering React\n el.dispatchEvent(new Event(\"input\", { bubbles: true })); // React listens for this\n el.dispatchEvent(new Event(\"change\", { bubbles: true })); // some code listens to change\n };\n\n /*\n ----\n -- CUE CARD AUTO-MOUNT & PERSONALIZATION\n ----\n */\n\n /**\n * Fetches the CueCard configuration from the API to check if an active\n * template exists for the given path.\n *\n * @param pagePath - The page path to check for active template\n * @returns The config response, or null if the request failed\n */\n private fetchCueCardConfig = async (\n pagePath: string\n ): Promise<CueCardConfigResponse | null> => {\n if (!this.config.publicKey) return null;\n\n try {\n const searchParams = new URLSearchParams({\n publicKey: this.config.publicKey,\n pagePath,\n });\n\n const response = await fetch(\n `${this.config.apiHost}/v1/cue-card-config?${searchParams.toString()}`\n );\n\n if (!response.ok) {\n this.log(\n \"warn\",\n `CueCard config request failed with status ${response.status}`\n );\n return null;\n }\n\n const data = await response.json();\n\n if (!isCueCardConfigResponse(data)) {\n this.log(\"warn\", \"Invalid CueCard config response format\");\n return null;\n }\n\n return data;\n } catch (error) {\n this.log(\"error\", \"Failed to fetch CueCard config:\", error);\n return null;\n }\n };\n\n /**\n * Initializes and mounts a CueCard with configuration from the API.\n * Called automatically when publicKey is provided.\n *\n * The CueCard will only be mounted if an active template exists for\n * the current path on the server.\n */\n private initCueCard = async () => {\n if (this.cueCardInstance) {\n this.log(\"warn\", \"CueCard already initialized, skipping...\");\n return;\n }\n\n // Fetch config from API to check if active template exists for this path\n const configResponse = await this.fetchCueCardConfig(this.currentPath);\n\n if (!configResponse || !configResponse.enabled) {\n this.log(\n \"debug\",\n `CueCard not mounted: no active template for path \"${this.currentPath}\"`\n );\n return;\n }\n\n this.log(\"debug\", \"Active template found, mounting CueCard...\");\n\n // Use server config if available, otherwise fall back to defaults\n const serverConfig = configResponse.config;\n\n this.cueCardInstance = new CueCard({\n theme: serverConfig?.theme ?? \"light\",\n position: serverConfig?.position ?? \"top-center\",\n direction: serverConfig?.direction ?? \"top-to-bottom\",\n fields: serverConfig?.fields ?? [\n {\n name: \"companyDomain\",\n label: \"Company Name or Domain\",\n placeholder: \"example.com\",\n required: true,\n minLength: 3,\n errorMessage: \"Company name or domain is required\",\n },\n ],\n isVisible: true,\n enableFocusMode: serverConfig?.enableFocusMode ?? false,\n showWatermark: serverConfig?.showWatermark ?? false,\n showKeyboardHints: serverConfig?.showKeyboardHints ?? true,\n enableLauncher: serverConfig?.enableLauncher ?? true,\n customTheme: serverConfig?.customTheme,\n textOverrides: serverConfig?.textOverrides,\n enableUndoToggle: serverConfig?.enableUndoToggle ?? false,\n isPersonalized: this.isPersonalized,\n onDismiss: () => {\n this.log(\"debug\", \"CueCard dismissed by user\");\n this.dispatchKenobiEvent(\"cuecard:dismiss\", {\n pagePath: this.currentPath,\n });\n },\n onSubmitPersonalization: (values) => {\n this.log(\"debug\", \"CueCard submitted:\", values);\n void this.personalize(values);\n },\n onOpenChange: (isOpen) => {\n this.log(\"debug\", \"CueCard open state changed:\", isOpen);\n this.dispatchKenobiEvent(\"cuecard:openchange\", {\n isOpen,\n pagePath: this.currentPath,\n });\n },\n onTogglePersonalization: () => {\n this.log(\"debug\", \"CueCard toggle personalization\");\n void this.toggleTransformations();\n this.dispatchKenobiEvent(\"cuecard:toggle\", {\n isPersonalized: this.isPersonalized,\n pagePath: this.currentPath,\n });\n },\n });\n\n this.cueCardInstance.mount();\n this.log(\"debug\", \"CueCard mounted successfully\");\n };\n\n /**\n * Syncs CueCard visibility based on the current path.\n * Checks with the server if an active template exists for the new path.\n * Called after navigation changes.\n */\n private syncCueCardVisibility = async () => {\n // Only manage CueCard if publicKey is configured\n if (!this.config.publicKey) return;\n\n // Unmount existing CueCard on navigation (will re-mount if new path has active template)\n if (this.cueCardInstance) {\n this.log(\"debug\", `Navigation detected, unmounting CueCard`);\n this.cueCardInstance.unmount();\n this.cueCardInstance = null;\n }\n\n // Check if new path has an active template\n void this.initCueCard();\n };\n\n /**\n * Dispatches a custom event on window for external listeners.\n * Events are prefixed with \"kenobi:\" for namespacing.\n */\n private dispatchKenobiEvent = (\n eventName: string,\n detail: Record<string, unknown>\n ) => {\n const event = new CustomEvent(`kenobi:${eventName}`, {\n detail,\n bubbles: true,\n });\n window.dispatchEvent(event);\n this.log(\"debug\", `Dispatched event: kenobi:${eventName}`, detail);\n };\n\n /**\n * Triggers personalization by calling the API with the provided input.\n * Updates CueCard status during the flow and applies transformations.\n *\n * Dispatches events:\n * - `kenobi:personalization:start` - when personalization begins\n * - `kenobi:personalization:complete` - when personalization succeeds\n * - `kenobi:personalization:error` - when personalization fails\n *\n * @param input - User-provided fields (e.g., { companyDomain: \"acme.com\" })\n */\n public personalize = async (input: Record<string, string>): Promise<void> => {\n if (!this.config.publicKey) {\n this.log(\"error\", \"Cannot personalize: publicKey not configured\");\n return;\n }\n\n const startTime = new Date();\n this.log(\"debug\", \"Starting personalization with input:\", input);\n\n // Dispatch start event\n this.dispatchKenobiEvent(\"personalization:start\", {\n input,\n pagePath: this.currentPath,\n });\n\n // Update CueCard to loading state\n if (this.cueCardInstance) {\n this.cueCardInstance.update({ status: \"starting\", progressPct: 10 });\n }\n\n try {\n // Call the personalization API\n const response = await fetch(`${this.config.apiHost}/v1/personalize`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n publicKey: this.config.publicKey,\n input,\n pagePath: this.currentPath,\n }),\n });\n\n // Update progress\n if (this.cueCardInstance) {\n this.cueCardInstance.update({ progressPct: 50 });\n }\n\n if (!response.ok) {\n const errorBody = await response.json().catch(() => ({}));\n throw new Error(errorBody.error || `API error: ${response.status}`);\n }\n\n const result = await response.json();\n this.log(\"debug\", \"Personalization API response:\", result);\n\n // Update progress\n if (this.cueCardInstance) {\n this.cueCardInstance.update({ progressPct: 80 });\n }\n\n // Apply transformations\n if (result.transformations && Array.isArray(result.transformations)) {\n await this.applyTransformations(result.transformations, {\n shouldConsolidate: true,\n });\n }\n\n // Update CueCard to success state\n if (this.cueCardInstance) {\n this.cueCardInstance.update({ status: \"success\", progressPct: 100 });\n }\n\n const endTime = new Date();\n const duration = this.getDurationInMilliseconds(startTime, endTime);\n this.log(\n \"debug\",\n `Personalization complete, took ${this.formatThousands(duration)} ms`\n );\n\n // Dispatch complete event\n this.dispatchKenobiEvent(\"personalization:complete\", {\n input,\n pagePath: this.currentPath,\n durationMs: duration,\n transformationsCount: result.transformations?.length ?? 0,\n metadata: result.metadata,\n });\n } catch (error) {\n this.log(\"error\", \"Personalization failed:\", error);\n\n // Update CueCard to error state\n if (this.cueCardInstance) {\n this.cueCardInstance.update({ status: \"error\", progressPct: 0 });\n }\n\n // Dispatch error event\n this.dispatchKenobiEvent(\"personalization:error\", {\n input,\n pagePath: this.currentPath,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n };\n\n /**\n * Returns the CueCard instance if one was auto-mounted.\n * Useful for external control of the CueCard state.\n */\n public getCueCard = (): CueCard | null => {\n return this.cueCardInstance;\n };\n}\n\nexport { CueCard, Kenobi };\n", "var DOCUMENT_FRAGMENT_NODE = 11;\n\nfunction morphAttrs(fromNode, toNode) {\n var toNodeAttrs = toNode.attributes;\n var attr;\n var attrName;\n var attrNamespaceURI;\n var attrValue;\n var fromValue;\n\n // document-fragments dont have attributes so lets not do anything\n if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE || fromNode.nodeType === DOCUMENT_FRAGMENT_NODE) {\n return;\n }\n\n // update attributes on original DOM element\n for (var i = toNodeAttrs.length - 1; i >= 0; i--) {\n attr = toNodeAttrs[i];\n attrName = attr.name;\n attrNamespaceURI = attr.namespaceURI;\n attrValue = attr.value;\n\n if (attrNamespaceURI) {\n attrName = attr.localName || attrName;\n fromValue = fromNode.getAttributeNS(attrNamespaceURI, attrName);\n\n if (fromValue !== attrValue) {\n if (attr.prefix === 'xmlns'){\n attrName = attr.name; // It's not allowed to set an attribute with the XMLNS namespace without specifying the `xmlns` prefix\n }\n fromNode.setAttributeNS(attrNamespaceURI, attrName, attrValue);\n }\n } else {\n fromValue = fromNode.getAttribute(attrName);\n\n if (fromValue !== attrValue) {\n fromNode.setAttribute(attrName, attrValue);\n }\n }\n }\n\n // Remove any extra attributes found on the original DOM element that\n // weren't found on the target element.\n var fromNodeAttrs = fromNode.attributes;\n\n for (var d = fromNodeAttrs.length - 1; d >= 0; d--) {\n attr = fromNodeAttrs[d];\n attrName = attr.name;\n attrNamespaceURI = attr.namespaceURI;\n\n if (attrNamespaceURI) {\n attrName = attr.localName || attrName;\n\n if (!toNode.hasAttributeNS(attrNamespaceURI, attrName)) {\n fromNode.removeAttributeNS(attrNamespaceURI, attrName);\n }\n } else {\n if (!toNode.hasAttribute(attrName)) {\n fromNode.removeAttribute(attrName);\n }\n }\n }\n}\n\nvar range; // Create a range object for efficently rendering strings to elements.\nvar NS_XHTML = 'http://www.w3.org/1999/xhtml';\n\nvar doc = typeof document === 'undefined' ? undefined : document;\nvar HAS_TEMPLATE_SUPPORT = !!doc && 'content' in doc.createElement('template');\nvar HAS_RANGE_SUPPORT = !!doc && doc.createRange && 'createContextualFragment' in doc.createRange();\n\nfunction createFragmentFromTemplate(str) {\n var template = doc.createElement('template');\n template.innerHTML = str;\n return template.content.childNodes[0];\n}\n\nfunction createFragmentFromRange(str) {\n if (!range) {\n range = doc.createRange();\n range.selectNode(doc.body);\n }\n\n var fragment = range.createContextualFragment(str);\n return fragment.childNodes[0];\n}\n\nfunction createFragmentFromWrap(str) {\n var fragment = doc.createElement('body');\n fragment.innerHTML = str;\n return fragment.childNodes[0];\n}\n\n/**\n * This is about the same\n * var html = new DOMParser().parseFromString(str, 'text/html');\n * return html.body.firstChild;\n *\n * @method toElement\n * @param {String} str\n */\nfunction toElement(str) {\n str = str.trim();\n if (HAS_TEMPLATE_SUPPORT) {\n // avoid restrictions on content for things like `<tr><th>Hi</th></tr>` which\n // createContextualFragment doesn't support\n // <template> support not available in IE\n return createFragmentFromTemplate(str);\n } else if (HAS_RANGE_SUPPORT) {\n return createFragmentFromRange(str);\n }\n\n return createFragmentFromWrap(str);\n}\n\n/**\n * Returns true if two node's names are the same.\n *\n * NOTE: We don't bother checking `namespaceURI` because you will never find two HTML elements with the same\n * nodeName and different namespace URIs.\n *\n * @param {Element} a\n * @param {Element} b The target element\n * @return {boolean}\n */\nfunction compareNodeNames(fromEl, toEl) {\n var fromNodeName = fromEl.nodeName;\n var toNodeName = toEl.nodeName;\n var fromCodeStart, toCodeStart;\n\n if (fromNodeName === toNodeName) {\n return true;\n }\n\n fromCodeStart = fromNodeName.charCodeAt(0);\n toCodeStart = toNodeName.charCodeAt(0);\n\n // If the target element is a virtual DOM node or SVG node then we may\n // need to normalize the tag name before comparing. Normal HTML elements that are\n // in the \"http://www.w3.org/1999/xhtml\"\n // are converted to upper case\n if (fromCodeStart <= 90 && toCodeStart >= 97) { // from is upper and to is lower\n return fromNodeName === toNodeName.toUpperCase();\n } else if (toCodeStart <= 90 && fromCodeStart >= 97) { // to is upper and from is lower\n return toNodeName === fromNodeName.toUpperCase();\n } else {\n return false;\n }\n}\n\n/**\n * Create an element, optionally with a known namespace URI.\n *\n * @param {string} name the element name, e.g. 'div' or 'svg'\n * @param {string} [namespaceURI] the element's namespace URI, i.e. the value of\n * its `xmlns` attribute or its inferred namespace.\n *\n * @return {Element}\n */\nfunction createElementNS(name, namespaceURI) {\n return !namespaceURI || namespaceURI === NS_XHTML ?\n doc.createElement(name) :\n doc.createElementNS(namespaceURI, name);\n}\n\n/**\n * Copies the children of one DOM element to another DOM element\n */\nfunction moveChildren(fromEl, toEl) {\n var curChild = fromEl.firstChild;\n while (curChild) {\n var nextChild = curChild.nextSibling;\n toEl.appendChild(curChild);\n curChild = nextChild;\n }\n return toEl;\n}\n\nfunction syncBooleanAttrProp(fromEl, toEl, name) {\n if (fromEl[name] !== toEl[name]) {\n fromEl[name] = toEl[name];\n if (fromEl[name]) {\n fromEl.setAttribute(name, '');\n } else {\n fromEl.removeAttribute(name);\n }\n }\n}\n\nvar specialElHandlers = {\n OPTION: function(fromEl, toEl) {\n var parentNode = fromEl.parentNode;\n if (parentNode) {\n var parentName = parentNode.nodeName.toUpperCase();\n if (parentName === 'OPTGROUP') {\n parentNode = parentNode.parentNode;\n parentName = parentNode && parentNode.nodeName.toUpperCase();\n }\n if (parentName === 'SELECT' && !parentNode.hasAttribute('multiple')) {\n if (fromEl.hasAttribute('selected') && !toEl.selected) {\n // Workaround for MS Edge bug where the 'selected' attribute can only be\n // removed if set to a non-empty value:\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12087679/\n fromEl.setAttribute('selected', 'selected');\n fromEl.removeAttribute('selected');\n }\n // We have to reset select element's selectedIndex to -1, otherwise setting\n // fromEl.selected using the syncBooleanAttrProp below has no effect.\n // The correct selectedIndex will be set in the SELECT special handler below.\n parentNode.selectedIndex = -1;\n }\n }\n syncBooleanAttrProp(fromEl, toEl, 'selected');\n },\n /**\n * The \"value\" attribute is special for the <input> element since it sets\n * the initial value. Changing the \"value\" attribute without changing the\n * \"value\" property will have no effect since it is only used to the set the\n * initial value. Similar for the \"checked\" attribute, and \"disabled\".\n */\n INPUT: function(fromEl, toEl) {\n syncBooleanAttrProp(fromEl, toEl, 'checked');\n syncBooleanAttrProp(fromEl, toEl, 'disabled');\n\n if (fromEl.value !== toEl.value) {\n fromEl.value = toEl.value;\n }\n\n if (!toEl.hasAttribute('value')) {\n fromEl.removeAttribute('value');\n }\n },\n\n TEXTAREA: function(fromEl, toEl) {\n var newValue = toEl.value;\n if (fromEl.value !== newValue) {\n fromEl.value = newValue;\n }\n\n var firstChild = fromEl.firstChild;\n if (firstChild) {\n // Needed for IE. Apparently IE sets the placeholder as the\n // node value and vise versa. This ignores an empty update.\n var oldValue = firstChild.nodeValue;\n\n if (oldValue == newValue || (!newValue && oldValue == fromEl.placeholder)) {\n return;\n }\n\n firstChild.nodeValue = newValue;\n }\n },\n SELECT: function(fromEl, toEl) {\n if (!toEl.hasAttribute('multiple')) {\n var selectedIndex = -1;\n var i = 0;\n // We have to loop through children of fromEl, not toEl since nodes can be moved\n // from toEl to fromEl directly when morphing.\n // At the time this special handler is invoked, all children have already been morphed\n // and appended to / removed from fromEl, so using fromEl here is safe and correct.\n var curChild = fromEl.firstChild;\n var optgroup;\n var nodeName;\n while(curChild) {\n nodeName = curChild.nodeName && curChild.nodeName.toUpperCase();\n if (nodeName === 'OPTGROUP') {\n optgroup = curChild;\n curChild = optgroup.firstChild;\n // handle empty optgroups\n if (!curChild) {\n curChild = optgroup.nextSibling;\n optgroup = null;\n }\n } else {\n if (nodeName === 'OPTION') {\n if (curChild.hasAttribute('selected')) {\n selectedIndex = i;\n break;\n }\n i++;\n }\n curChild = curChild.nextSibling;\n if (!curChild && optgroup) {\n curChild = optgroup.nextSibling;\n optgroup = null;\n }\n }\n }\n\n fromEl.selectedIndex = selectedIndex;\n }\n }\n};\n\nvar ELEMENT_NODE = 1;\nvar DOCUMENT_FRAGMENT_NODE$1 = 11;\nvar TEXT_NODE = 3;\nvar COMMENT_NODE = 8;\n\nfunction noop() {}\n\nfunction defaultGetNodeKey(node) {\n if (node) {\n return (node.getAttribute && node.getAttribute('id')) || node.id;\n }\n}\n\nfunction morphdomFactory(morphAttrs) {\n\n return function morphdom(fromNode, toNode, options) {\n if (!options) {\n options = {};\n }\n\n if (typeof toNode === 'string') {\n if (fromNode.nodeName === '#document' || fromNode.nodeName === 'HTML' || fromNode.nodeName === 'BODY') {\n var toNodeHtml = toNode;\n toNode = doc.createElement('html');\n toNode.innerHTML = toNodeHtml;\n } else {\n toNode = toElement(toNode);\n }\n } else if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE$1) {\n toNode = toNode.firstElementChild;\n }\n\n var getNodeKey = options.getNodeKey || defaultGetNodeKey;\n var onBeforeNodeAdded = options.onBeforeNodeAdded || noop;\n var onNodeAdded = options.onNodeAdded || noop;\n var onBeforeElUpdated = options.onBeforeElUpdated || noop;\n var onElUpdated = options.onElUpdated || noop;\n var onBeforeNodeDiscarded = options.onBeforeNodeDiscarded || noop;\n var onNodeDiscarded = options.onNodeDiscarded || noop;\n var onBeforeElChildrenUpdated = options.onBeforeElChildrenUpdated || noop;\n var skipFromChildren = options.skipFromChildren || noop;\n var addChild = options.addChild || function(parent, child){ return parent.appendChild(child); };\n var childrenOnly = options.childrenOnly === true;\n\n // This object is used as a lookup to quickly find all keyed elements in the original DOM tree.\n var fromNodesLookup = Object.create(null);\n var keyedRemovalList = [];\n\n function addKeyedRemoval(key) {\n keyedRemovalList.push(key);\n }\n\n function walkDiscardedChildNodes(node, skipKeyedNodes) {\n if (node.nodeType === ELEMENT_NODE) {\n var curChild = node.firstChild;\n while (curChild) {\n\n var key = undefined;\n\n if (skipKeyedNodes && (key = getNodeKey(curChild))) {\n // If we are skipping keyed nodes then we add the key\n // to a list so that it can be handled at the very end.\n addKeyedRemoval(key);\n } else {\n // Only report the node as discarded if it is not keyed. We do this because\n // at the end we loop through all keyed elements that were unmatched\n // and then discard them in one final pass.\n onNodeDiscarded(curChild);\n if (curChild.firstChild) {\n walkDiscardedChildNodes(curChild, skipKeyedNodes);\n }\n }\n\n curChild = curChild.nextSibling;\n }\n }\n }\n\n /**\n * Removes a DOM node out of the original DOM\n *\n * @param {Node} node The node to remove\n * @param {Node} parentNode The nodes parent\n * @param {Boolean} skipKeyedNodes If true then elements with keys will be skipped and not discarded.\n * @return {undefined}\n */\n function removeNode(node, parentNode, skipKeyedNodes) {\n if (onBeforeNodeDiscarded(node) === false) {\n return;\n }\n\n if (parentNode) {\n parentNode.removeChild(node);\n }\n\n onNodeDiscarded(node);\n walkDiscardedChildNodes(node, skipKeyedNodes);\n }\n\n // // TreeWalker implementation is no faster, but keeping this around in case this changes in the future\n // function indexTree(root) {\n // var treeWalker = document.createTreeWalker(\n // root,\n // NodeFilter.SHOW_ELEMENT);\n //\n // var el;\n // while((el = treeWalker.nextNode())) {\n // var key = getNodeKey(el);\n // if (key) {\n // fromNodesLookup[key] = el;\n // }\n // }\n // }\n\n // // NodeIterator implementation is no faster, but keeping this around in case this changes in the future\n //\n // function indexTree(node) {\n // var nodeIterator = document.createNodeIterator(node, NodeFilter.SHOW_ELEMENT);\n // var el;\n // while((el = nodeIterator.nextNode())) {\n // var key = getNodeKey(el);\n // if (key) {\n // fromNodesLookup[key] = el;\n // }\n // }\n // }\n\n function indexTree(node) {\n if (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE$1) {\n var curChild = node.firstChild;\n while (curChild) {\n var key = getNodeKey(curChild);\n if (key) {\n fromNodesLookup[key] = curChild;\n }\n\n // Walk recursively\n indexTree(curChild);\n\n curChild = curChild.nextSibling;\n }\n }\n }\n\n indexTree(fromNode);\n\n function handleNodeAdded(el) {\n onNodeAdded(el);\n\n var curChild = el.firstChild;\n while (curChild) {\n var nextSibling = curChild.nextSibling;\n\n var key = getNodeKey(curChild);\n if (key) {\n var unmatchedFromEl = fromNodesLookup[key];\n // if we find a duplicate #id node in cache, replace `el` with cache value\n // and morph it to the child node.\n if (unmatchedFromEl && compareNodeNames(curChild, unmatchedFromEl)) {\n curChild.parentNode.replaceChild(unmatchedFromEl, curChild);\n morphEl(unmatchedFromEl, curChild);\n } else {\n handleNodeAdded(curChild);\n }\n } else {\n // recursively call for curChild and it's children to see if we find something in\n // fromNodesLookup\n handleNodeAdded(curChild);\n }\n\n curChild = nextSibling;\n }\n }\n\n function cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey) {\n // We have processed all of the \"to nodes\". If curFromNodeChild is\n // non-null then we still have some from nodes left over that need\n // to be removed\n while (curFromNodeChild) {\n var fromNextSibling = curFromNodeChild.nextSibling;\n if ((curFromNodeKey = getNodeKey(curFromNodeChild))) {\n // Since the node is keyed it might be matched up later so we defer\n // the actual removal to later\n addKeyedRemoval(curFromNodeKey);\n } else {\n // NOTE: we skip nested keyed nodes from being removed since there is\n // still a chance they will be matched up later\n removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n }\n curFromNodeChild = fromNextSibling;\n }\n }\n\n function morphEl(fromEl, toEl, childrenOnly) {\n var toElKey = getNodeKey(toEl);\n\n if (toElKey) {\n // If an element with an ID is being morphed then it will be in the final\n // DOM so clear it out of the saved elements collection\n delete fromNodesLookup[toElKey];\n }\n\n if (!childrenOnly) {\n // optional\n var beforeUpdateResult = onBeforeElUpdated(fromEl, toEl);\n if (beforeUpdateResult === false) {\n return;\n } else if (beforeUpdateResult instanceof HTMLElement) {\n fromEl = beforeUpdateResult;\n // reindex the new fromEl in case it's not in the same\n // tree as the original fromEl\n // (Phoenix LiveView sometimes returns a cloned tree,\n // but keyed lookups would still point to the original tree)\n indexTree(fromEl);\n }\n\n // update attributes on original DOM element first\n morphAttrs(fromEl, toEl);\n // optional\n onElUpdated(fromEl);\n\n if (onBeforeElChildrenUpdated(fromEl, toEl) === false) {\n return;\n }\n }\n\n if (fromEl.nodeName !== 'TEXTAREA') {\n morphChildren(fromEl, toEl);\n } else {\n specialElHandlers.TEXTAREA(fromEl, toEl);\n }\n }\n\n function morphChildren(fromEl, toEl) {\n var skipFrom = skipFromChildren(fromEl, toEl);\n var curToNodeChild = toEl.firstChild;\n var curFromNodeChild = fromEl.firstChild;\n var curToNodeKey;\n var curFromNodeKey;\n\n var fromNextSibling;\n var toNextSibling;\n var matchingFromEl;\n\n // walk the children\n outer: while (curToNodeChild) {\n toNextSibling = curToNodeChild.nextSibling;\n curToNodeKey = getNodeKey(curToNodeChild);\n\n // walk the fromNode children all the way through\n while (!skipFrom && curFromNodeChild) {\n fromNextSibling = curFromNodeChild.nextSibling;\n\n if (curToNodeChild.isSameNode && curToNodeChild.isSameNode(curFromNodeChild)) {\n curToNodeChild = toNextSibling;\n curFromNodeChild = fromNextSibling;\n continue outer;\n }\n\n curFromNodeKey = getNodeKey(curFromNodeChild);\n\n var curFromNodeType = curFromNodeChild.nodeType;\n\n // this means if the curFromNodeChild doesnt have a match with the curToNodeChild\n var isCompatible = undefined;\n\n if (curFromNodeType === curToNodeChild.nodeType) {\n if (curFromNodeType === ELEMENT_NODE) {\n // Both nodes being compared are Element nodes\n\n if (curToNodeKey) {\n // The target node has a key so we want to match it up with the correct element\n // in the original DOM tree\n if (curToNodeKey !== curFromNodeKey) {\n // The current element in the original DOM tree does not have a matching key so\n // let's check our lookup to see if there is a matching element in the original\n // DOM tree\n if ((matchingFromEl = fromNodesLookup[curToNodeKey])) {\n if (fromNextSibling === matchingFromEl) {\n // Special case for single element removals. To avoid removing the original\n // DOM node out of the tree (since that can break CSS transitions, etc.),\n // we will instead discard the current node and wait until the next\n // iteration to properly match up the keyed target element with its matching\n // element in the original tree\n isCompatible = false;\n } else {\n // We found a matching keyed element somewhere in the original DOM tree.\n // Let's move the original DOM node into the current position and morph\n // it.\n\n // NOTE: We use insertBefore instead of replaceChild because we want to go through\n // the `removeNode()` function for the node that is being discarded so that\n // all lifecycle hooks are correctly invoked\n fromEl.insertBefore(matchingFromEl, curFromNodeChild);\n\n // fromNextSibling = curFromNodeChild.nextSibling;\n\n if (curFromNodeKey) {\n // Since the node is keyed it might be matched up later so we defer\n // the actual removal to later\n addKeyedRemoval(curFromNodeKey);\n } else {\n // NOTE: we skip nested keyed nodes from being removed since there is\n // still a chance they will be matched up later\n removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n }\n\n curFromNodeChild = matchingFromEl;\n curFromNodeKey = getNodeKey(curFromNodeChild);\n }\n } else {\n // The nodes are not compatible since the \"to\" node has a key and there\n // is no matching keyed node in the source tree\n isCompatible = false;\n }\n }\n } else if (curFromNodeKey) {\n // The original has a key\n isCompatible = false;\n }\n\n isCompatible = isCompatible !== false && compareNodeNames(curFromNodeChild, curToNodeChild);\n if (isCompatible) {\n // We found compatible DOM elements so transform\n // the current \"from\" node to match the current\n // target DOM node.\n // MORPH\n morphEl(curFromNodeChild, curToNodeChild);\n }\n\n } else if (curFromNodeType === TEXT_NODE || curFromNodeType == COMMENT_NODE) {\n // Both nodes being compared are Text or Comment nodes\n isCompatible = true;\n // Simply update nodeValue on the original node to\n // change the text value\n if (curFromNodeChild.nodeValue !== curToNodeChild.nodeValue) {\n curFromNodeChild.nodeValue = curToNodeChild.nodeValue;\n }\n\n }\n }\n\n if (isCompatible) {\n // Advance both the \"to\" child and the \"from\" child since we found a match\n // Nothing else to do as we already recursively called morphChildren above\n curToNodeChild = toNextSibling;\n curFromNodeChild = fromNextSibling;\n continue outer;\n }\n\n // No compatible match so remove the old node from the DOM and continue trying to find a\n // match in the original DOM. However, we only do this if the from node is not keyed\n // since it is possible that a keyed node might match up with a node somewhere else in the\n // target tree and we don't want to discard it just yet since it still might find a\n // home in the final DOM tree. After everything is done we will remove any keyed nodes\n // that didn't find a home\n if (curFromNodeKey) {\n // Since the node is keyed it might be matched up later so we defer\n // the actual removal to later\n addKeyedRemoval(curFromNodeKey);\n } else {\n // NOTE: we skip nested keyed nodes from being removed since there is\n // still a chance they will be matched up later\n removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n }\n\n curFromNodeChild = fromNextSibling;\n } // END: while(curFromNodeChild) {}\n\n // If we got this far then we did not find a candidate match for\n // our \"to node\" and we exhausted all of the children \"from\"\n // nodes. Therefore, we will just append the current \"to\" node\n // to the end\n if (curToNodeKey && (matchingFromEl = fromNodesLookup[curToNodeKey]) && compareNodeNames(matchingFromEl, curToNodeChild)) {\n // MORPH\n if(!skipFrom){ addChild(fromEl, matchingFromEl); }\n morphEl(matchingFromEl, curToNodeChild);\n } else {\n var onBeforeNodeAddedResult = onBeforeNodeAdded(curToNodeChild);\n if (onBeforeNodeAddedResult !== false) {\n if (onBeforeNodeAddedResult) {\n curToNodeChild = onBeforeNodeAddedResult;\n }\n\n if (curToNodeChild.actualize) {\n curToNodeChild = curToNodeChild.actualize(fromEl.ownerDocument || doc);\n }\n addChild(fromEl, curToNodeChild);\n handleNodeAdded(curToNodeChild);\n }\n }\n\n curToNodeChild = toNextSibling;\n curFromNodeChild = fromNextSibling;\n }\n\n cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey);\n\n var specialElHandler = specialElHandlers[fromEl.nodeName];\n if (specialElHandler) {\n specialElHandler(fromEl, toEl);\n }\n } // END: morphChildren(...)\n\n var morphedNode = fromNode;\n var morphedNodeType = morphedNode.nodeType;\n var toNodeType = toNode.nodeType;\n\n if (!childrenOnly) {\n // Handle the case where we are given two DOM nodes that are not\n // compatible (e.g. <div> --> <span> or <div> --> TEXT)\n if (morphedNodeType === ELEMENT_NODE) {\n if (toNodeType === ELEMENT_NODE) {\n if (!compareNodeNames(fromNode, toNode)) {\n onNodeDiscarded(fromNode);\n morphedNode = moveChildren(fromNode, createElementNS(toNode.nodeName, toNode.namespaceURI));\n }\n } else {\n // Going from an element node to a text node\n morphedNode = toNode;\n }\n } else if (morphedNodeType === TEXT_NODE || morphedNodeType === COMMENT_NODE) { // Text or comment node\n if (toNodeType === morphedNodeType) {\n if (morphedNode.nodeValue !== toNode.nodeValue) {\n morphedNode.nodeValue = toNode.nodeValue;\n }\n\n return morphedNode;\n } else {\n // Text node to something else\n morphedNode = toNode;\n }\n }\n }\n\n if (morphedNode === toNode) {\n // The \"to node\" was not compatible with the \"from node\" so we had to\n // toss out the \"from node\" and use the \"to node\"\n onNodeDiscarded(fromNode);\n } else {\n if (toNode.isSameNode && toNode.isSameNode(morphedNode)) {\n return;\n }\n\n morphEl(morphedNode, toNode, childrenOnly);\n\n // We now need to loop over any keyed nodes that might need to be\n // removed. We only do the removal if we know that the keyed node\n // never found a match. When a keyed node is matched up we remove\n // it out of fromNodesLookup and we use fromNodesLookup to determine\n // if a keyed node has been matched up or not\n if (keyedRemovalList) {\n for (var i=0, len=keyedRemovalList.length; i<len; i++) {\n var elToRemove = fromNodesLookup[keyedRemovalList[i]];\n if (elToRemove) {\n removeNode(elToRemove, elToRemove.parentNode, false);\n }\n }\n }\n }\n\n if (!childrenOnly && morphedNode !== fromNode && fromNode.parentNode) {\n if (morphedNode.actualize) {\n morphedNode = morphedNode.actualize(fromNode.ownerDocument || doc);\n }\n // If we had to swap out the from node with a new node because the old\n // node was not compatible with the target node then we need to\n // replace the old DOM node in the original DOM tree. This is only\n // possible if the original DOM node was part of a DOM tree which\n // we know is the case if it has a parent node.\n fromNode.parentNode.replaceChild(morphedNode, fromNode);\n }\n\n return morphedNode;\n };\n}\n\nvar morphdom = morphdomFactory(morphAttrs);\n\nexport default morphdom;\n", "/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 1;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n", "import { EMPTY_ARR } from './constants';\n\nexport const isArray = Array.isArray;\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-expect-error We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {import('./index').ContainerNode} node The node to remove\n */\nexport function removeNode(node) {\n\tif (node && node.parentNode) node.parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n", "import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n", "import { slice } from './util';\nimport options from './options';\nimport { NULL, UNDEFINED } from './constants';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor for this\n * virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array<import('.').ComponentChildren>} [children] The children of the\n * virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != NULL) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === UNDEFINED) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, NULL);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\t/** @type {import('./internal').VNode} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: NULL,\n\t\t_parent: NULL,\n\t\t_depth: 0,\n\t\t_dom: NULL,\n\t\t_component: NULL,\n\t\tconstructor: UNDEFINED,\n\t\t_original: original == NULL ? ++vnodeId : original,\n\t\t_index: -1,\n\t\t_flags: 0\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == NULL && options.vnode != NULL) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: NULL };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != NULL && vnode.constructor == UNDEFINED;\n", "import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\nimport { MODE_HYDRATE, NULL } from './constants';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function BaseComponent(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nBaseComponent.prototype.setState = function (update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != NULL && this._nextState != this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == NULL) return;\n\n\tif (this._vnode) {\n\t\tif (callback) {\n\t\t\tthis._stateCallbacks.push(callback);\n\t\t}\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nBaseComponent.prototype.forceUpdate = function (callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](https://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {ComponentChildren | void}\n */\nBaseComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == NULL) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._index + 1)\n\t\t\t: NULL;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != NULL && sibling._dom != NULL) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : NULL;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet oldVNode = component._vnode,\n\t\toldDom = oldVNode._dom,\n\t\tcommitQueue = [],\n\t\trefQueue = [];\n\n\tif (component._parentDom) {\n\t\tconst newVNode = assign({}, oldVNode);\n\t\tnewVNode._original = oldVNode._original + 1;\n\t\tif (options.vnode) options.vnode(newVNode);\n\n\t\tdiff(\n\t\t\tcomponent._parentDom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tcomponent._parentDom.namespaceURI,\n\t\t\toldVNode._flags & MODE_HYDRATE ? [oldDom] : NULL,\n\t\t\tcommitQueue,\n\t\t\toldDom == NULL ? getDomSibling(oldVNode) : oldDom,\n\t\t\t!!(oldVNode._flags & MODE_HYDRATE),\n\t\t\trefQueue\n\t\t);\n\n\t\tnewVNode._original = oldVNode._original;\n\t\tnewVNode._parent._children[newVNode._index] = newVNode;\n\t\tcommitRoot(commitQueue, newVNode, refQueue);\n\t\toldVNode._dom = oldVNode._parent = null;\n\n\t\tif (newVNode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(newVNode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != NULL && vnode._component != NULL) {\n\t\tvnode._dom = vnode._component.base = NULL;\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child != NULL && child._dom != NULL) {\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array<import('./internal').Component>}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\nconst defer =\n\ttypeof Promise == 'function'\n\t\t? Promise.prototype.then.bind(Promise.resolve())\n\t\t: setTimeout;\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce != options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || defer)(process);\n\t}\n}\n\n/**\n * @param {import('./internal').Component} a\n * @param {import('./internal').Component} b\n */\nconst depthSort = (a, b) => a._vnode._depth - b._vnode._depth;\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\tlet c,\n\t\tl = 1;\n\n\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t// process() calls from getting scheduled while `queue` is still being consumed.\n\twhile (rerenderQueue.length) {\n\t\t// Keep the rerender queue sorted by (depth, insertion order). The queue\n\t\t// will initially be sorted on the first iteration only if it has more than 1 item.\n\t\t//\n\t\t// New items can be added to the queue e.g. when rerendering a provider, so we want to\n\t\t// keep the order from top to bottom with those new items so we can handle them in a\n\t\t// single pass\n\t\tif (rerenderQueue.length > l) {\n\t\t\trerenderQueue.sort(depthSort);\n\t\t}\n\n\t\tc = rerenderQueue.shift();\n\t\tl = rerenderQueue.length;\n\n\t\tif (c._dirty) {\n\t\t\trenderComponent(c);\n\t\t}\n\t}\n\tprocess._rerenderCount = 0;\n}\n\nprocess._rerenderCount = 0;\n", "import { IS_NON_DIMENSIONAL, NULL, SVG_NAMESPACE } from '../constants';\nimport options from '../options';\n\nfunction setStyle(style, key, value) {\n\tif (key[0] == '-') {\n\t\tstyle.setProperty(key, value == NULL ? '' : value);\n\t} else if (value == NULL) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\n\t}\n}\n\nconst CAPTURE_REGEX = /(PointerCapture)$|Capture$/i;\n\n// A logical clock to solve issues like https://github.com/preactjs/preact/issues/3927.\n// When the DOM performs an event it leaves micro-ticks in between bubbling up which means that\n// an event can trigger on a newly reated DOM-node while the event bubbles up.\n//\n// Originally inspired by Vue\n// (https://github.com/vuejs/core/blob/caeb8a68811a1b0f79/packages/runtime-dom/src/modules/events.ts#L90-L101),\n// but modified to use a logical clock instead of Date.now() in case event handlers get attached\n// and events get dispatched during the same millisecond.\n//\n// The clock is incremented after each new event dispatch. This allows 1 000 000 new events\n// per second for over 280 years before the value reaches Number.MAX_SAFE_INTEGER (2**53 - 1).\nlet eventClock = 0;\n\n/**\n * Set a property value on a DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to modify\n * @param {string} name The name of the property to set\n * @param {*} value The value to set the property to\n * @param {*} oldValue The old value the property had\n * @param {string} namespace Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, namespace) {\n\tlet useCapture;\n\n\to: if (name == 'style') {\n\t\tif (typeof value == 'string') {\n\t\t\tdom.style.cssText = value;\n\t\t} else {\n\t\t\tif (typeof oldValue == 'string') {\n\t\t\t\tdom.style.cssText = oldValue = '';\n\t\t\t}\n\n\t\t\tif (oldValue) {\n\t\t\t\tfor (name in oldValue) {\n\t\t\t\t\tif (!(value && name in value)) {\n\t\t\t\t\t\tsetStyle(dom.style, name, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tfor (name in value) {\n\t\t\t\t\tif (!oldValue || value[name] != oldValue[name]) {\n\t\t\t\t\t\tsetStyle(dom.style, name, value[name]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6\n\telse if (name[0] == 'o' && name[1] == 'n') {\n\t\tuseCapture = name != (name = name.replace(CAPTURE_REGEX, '$1'));\n\t\tconst lowerCaseName = name.toLowerCase();\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (lowerCaseName in dom || name == 'onFocusOut' || name == 'onFocusIn')\n\t\t\tname = lowerCaseName.slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._listeners[name + useCapture] = value;\n\n\t\tif (value) {\n\t\t\tif (!oldValue) {\n\t\t\t\tvalue._attached = eventClock;\n\t\t\t\tdom.addEventListener(\n\t\t\t\t\tname,\n\t\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\t\tuseCapture\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tvalue._attached = oldValue._attached;\n\t\t\t}\n\t\t} else {\n\t\t\tdom.removeEventListener(\n\t\t\t\tname,\n\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\tuseCapture\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (namespace == SVG_NAMESPACE) {\n\t\t\t// Normalize incorrect prop usage for SVG:\n\t\t\t// - xlink:href / xlinkHref --> href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname != 'width' &&\n\t\t\tname != 'height' &&\n\t\t\tname != 'href' &&\n\t\t\tname != 'list' &&\n\t\t\tname != 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname != 'tabIndex' &&\n\t\t\tname != 'download' &&\n\t\t\tname != 'rowSpan' &&\n\t\t\tname != 'colSpan' &&\n\t\t\tname != 'role' &&\n\t\t\tname != 'popover' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == NULL ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// aria- and data- attributes have no boolean representation.\n\t\t// A `false` value is different from the attribute not being\n\t\t// present, so we can't remove it. For non-boolean aria\n\t\t// attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost too many bytes. On top of\n\t\t// that other frameworks generally stringify `false`.\n\n\t\tif (typeof value == 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (value != NULL && (value !== false || name[4] == '-')) {\n\t\t\tdom.setAttribute(name, name == 'popover' && value == true ? '' : value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Create an event proxy function.\n * @param {boolean} useCapture Is the event handler for the capture phase.\n * @private\n */\nfunction createEventProxy(useCapture) {\n\t/**\n\t * Proxy an event to hooked event handlers\n\t * @param {import('../internal').PreactEvent} e The event object from the browser\n\t * @private\n\t */\n\treturn function (e) {\n\t\tif (this._listeners) {\n\t\t\tconst eventHandler = this._listeners[e.type + useCapture];\n\t\t\tif (e._dispatched == NULL) {\n\t\t\t\te._dispatched = eventClock++;\n\n\t\t\t\t// When `e._dispatched` is smaller than the time when the targeted event\n\t\t\t\t// handler was attached we know we have bubbled up to an element that was added\n\t\t\t\t// during patching the DOM.\n\t\t\t} else if (e._dispatched < eventHandler._attached) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn eventHandler(options.event ? options.event(e) : e);\n\t\t}\n\t};\n}\n\nconst eventProxy = createEventProxy(false);\nconst eventProxyCapture = createEventProxy(true);\n", "import { enqueueRender } from './component';\nimport { NULL } from './constants';\n\nexport let i = 0;\n\nexport function createContext(defaultValue) {\n\tfunction Context(props) {\n\t\tif (!this.getChildContext) {\n\t\t\t/** @type {Set<import('./internal').Component> | null} */\n\t\t\tlet subs = new Set();\n\t\t\tlet ctx = {};\n\t\t\tctx[Context._id] = this;\n\n\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\tthis.componentWillUnmount = () => {\n\t\t\t\tsubs = NULL;\n\t\t\t};\n\n\t\t\tthis.shouldComponentUpdate = function (_props) {\n\t\t\t\t// @ts-expect-error even\n\t\t\t\tif (this.props.value != _props.value) {\n\t\t\t\t\tsubs.forEach(c => {\n\t\t\t\t\t\tc._force = true;\n\t\t\t\t\t\tenqueueRender(c);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.sub = c => {\n\t\t\t\tsubs.add(c);\n\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\tif (subs) {\n\t\t\t\t\t\tsubs.delete(c);\n\t\t\t\t\t}\n\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\treturn props.children;\n\t}\n\n\tContext._id = '__cC' + i++;\n\tContext._defaultValue = defaultValue;\n\n\t/** @type {import('./internal').FunctionComponent} */\n\tContext.Consumer = (props, contextValue) => {\n\t\treturn props.children(contextValue);\n\t};\n\n\t// we could also get rid of _contextRef entirely\n\tContext.Provider =\n\t\tContext._contextRef =\n\t\tContext.Consumer.contextType =\n\t\t\tContext;\n\n\treturn Context;\n}\n", "import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport {\n\tEMPTY_OBJ,\n\tEMPTY_ARR,\n\tINSERT_VNODE,\n\tMATCHED,\n\tUNDEFINED,\n\tNULL\n} from '../constants';\nimport { isArray } from '../util';\nimport { getDomSibling } from '../component';\n\n/**\n * @typedef {import('../internal').ComponentChildren} ComponentChildren\n * @typedef {import('../internal').Component} Component\n * @typedef {import('../internal').PreactElement} PreactElement\n * @typedef {import('../internal').VNode} VNode\n */\n\n/**\n * Diff the children of a virtual node\n * @param {PreactElement} parentDom The DOM element whose children are being\n * diffed\n * @param {ComponentChildren[]} renderResult\n * @param {VNode} newParentVNode The new virtual node whose children should be\n * diff'ed against oldParentVNode\n * @param {VNode} oldParentVNode The old virtual node whose children should be\n * diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array<PreactElement>} excessDomChildren\n * @param {Array<Component>} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\tlet i,\n\t\t/** @type {VNode} */\n\t\toldVNode,\n\t\t/** @type {VNode} */\n\t\tchildVNode,\n\t\t/** @type {PreactElement} */\n\t\tnewDom,\n\t\t/** @type {PreactElement} */\n\t\tfirstChildDom;\n\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\t/** @type {VNode[]} */\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet newChildrenLength = renderResult.length;\n\n\toldDom = constructNewChildrenArray(\n\t\tnewParentVNode,\n\t\trenderResult,\n\t\toldChildren,\n\t\toldDom,\n\t\tnewChildrenLength\n\t);\n\n\tfor (i = 0; i < newChildrenLength; i++) {\n\t\tchildVNode = newParentVNode._children[i];\n\t\tif (childVNode == NULL) continue;\n\n\t\t// At this point, constructNewChildrenArray has assigned _index to be the\n\t\t// matchingIndex for this VNode's oldVNode (or -1 if there is no oldVNode).\n\t\tif (childVNode._index == -1) {\n\t\t\toldVNode = EMPTY_OBJ;\n\t\t} else {\n\t\t\toldVNode = oldChildren[childVNode._index] || EMPTY_OBJ;\n\t\t}\n\n\t\t// Update childVNode._index to its final index\n\t\tchildVNode._index = i;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tlet result = diff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating,\n\t\t\trefQueue\n\t\t);\n\n\t\t// Adjust DOM nodes\n\t\tnewDom = childVNode._dom;\n\t\tif (childVNode.ref && oldVNode.ref != childVNode.ref) {\n\t\t\tif (oldVNode.ref) {\n\t\t\t\tapplyRef(oldVNode.ref, NULL, childVNode);\n\t\t\t}\n\t\t\trefQueue.push(\n\t\t\t\tchildVNode.ref,\n\t\t\t\tchildVNode._component || newDom,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t}\n\n\t\tif (firstChildDom == NULL && newDom != NULL) {\n\t\t\tfirstChildDom = newDom;\n\t\t}\n\n\t\tlet shouldPlace = !!(childVNode._flags & INSERT_VNODE);\n\t\tif (shouldPlace || oldVNode._children === childVNode._children) {\n\t\t\toldDom = insert(childVNode, oldDom, parentDom, shouldPlace);\n\t\t} else if (typeof childVNode.type == 'function' && result !== UNDEFINED) {\n\t\t\toldDom = result;\n\t\t} else if (newDom) {\n\t\t\toldDom = newDom.nextSibling;\n\t\t}\n\n\t\t// Unset diffing flags\n\t\tchildVNode._flags &= ~(INSERT_VNODE | MATCHED);\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\treturn oldDom;\n}\n\n/**\n * @param {VNode} newParentVNode\n * @param {ComponentChildren[]} renderResult\n * @param {VNode[]} oldChildren\n */\nfunction constructNewChildrenArray(\n\tnewParentVNode,\n\trenderResult,\n\toldChildren,\n\toldDom,\n\tnewChildrenLength\n) {\n\t/** @type {number} */\n\tlet i;\n\t/** @type {VNode} */\n\tlet childVNode;\n\t/** @type {VNode} */\n\tlet oldVNode;\n\n\tlet oldChildrenLength = oldChildren.length,\n\t\tremainingOldChildren = oldChildrenLength;\n\n\tlet skew = 0;\n\n\tnewParentVNode._children = new Array(newChildrenLength);\n\tfor (i = 0; i < newChildrenLength; i++) {\n\t\t// @ts-expect-error We are reusing the childVNode variable to hold both the\n\t\t// pre and post normalized childVNode\n\t\tchildVNode = renderResult[i];\n\n\t\tif (\n\t\t\tchildVNode == NULL ||\n\t\t\ttypeof childVNode == 'boolean' ||\n\t\t\ttypeof childVNode == 'function'\n\t\t) {\n\t\t\tnewParentVNode._children[i] = NULL;\n\t\t\tcontinue;\n\t\t}\n\t\t// If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint' ||\n\t\t\tchildVNode.constructor == String\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tNULL,\n\t\t\t\tchildVNode,\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (childVNode.constructor == UNDEFINED && childVNode._depth > 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse = <div />\n\t\t\t// <div>{reuse}<span />{reuse}</div>\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tchildVNode.ref ? childVNode.ref : NULL,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\tconst skewedIndex = i + skew;\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Temporarily store the matchingIndex on the _index property so we can pull\n\t\t// out the oldVNode in diffChildren. We'll override this to the VNode's\n\t\t// final index after using this property to get the oldVNode\n\t\tconst matchingIndex = (childVNode._index = findMatchingIndex(\n\t\t\tchildVNode,\n\t\t\toldChildren,\n\t\t\tskewedIndex,\n\t\t\tremainingOldChildren\n\t\t));\n\n\t\toldVNode = NULL;\n\t\tif (matchingIndex != -1) {\n\t\t\toldVNode = oldChildren[matchingIndex];\n\t\t\tremainingOldChildren--;\n\t\t\tif (oldVNode) {\n\t\t\t\toldVNode._flags |= MATCHED;\n\t\t\t}\n\t\t}\n\n\t\t// Here, we define isMounting for the purposes of the skew diffing\n\t\t// algorithm. Nodes that are unsuspending are considered mounting and we detect\n\t\t// this by checking if oldVNode._original == null\n\t\tconst isMounting = oldVNode == NULL || oldVNode._original == NULL;\n\n\t\tif (isMounting) {\n\t\t\tif (matchingIndex == -1) {\n\t\t\t\t// When the array of children is growing we need to decrease the skew\n\t\t\t\t// as we are adding a new element to the array.\n\t\t\t\t// Example:\n\t\t\t\t// [1, 2, 3] --> [0, 1, 2, 3]\n\t\t\t\t// oldChildren newChildren\n\t\t\t\t//\n\t\t\t\t// The new element is at index 0, so our skew is 0,\n\t\t\t\t// we need to decrease the skew as we are adding a new element.\n\t\t\t\t// The decrease will cause us to compare the element at position 1\n\t\t\t\t// with value 1 with the element at position 0 with value 0.\n\t\t\t\t//\n\t\t\t\t// A linear concept is applied when the array is shrinking,\n\t\t\t\t// if the length is unchanged we can assume that no skew\n\t\t\t\t// changes are needed.\n\t\t\t\tif (newChildrenLength > oldChildrenLength) {\n\t\t\t\t\tskew--;\n\t\t\t\t} else if (newChildrenLength < oldChildrenLength) {\n\t\t\t\t\tskew++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we are mounting a DOM VNode, mark it for insertion\n\t\t\tif (typeof childVNode.type != 'function') {\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\n\t\t\t}\n\t\t} else if (matchingIndex != skewedIndex) {\n\t\t\t// When we move elements around i.e. [0, 1, 2] --> [1, 0, 2]\n\t\t\t// --> we diff 1, we find it at position 1 while our skewed index is 0 and our skew is 0\n\t\t\t// we set the skew to 1 as we found an offset.\n\t\t\t// --> we diff 0, we find it at position 0 while our skewed index is at 2 and our skew is 1\n\t\t\t// this makes us increase the skew again.\n\t\t\t// --> we diff 2, we find it at position 2 while our skewed index is at 4 and our skew is 2\n\t\t\t//\n\t\t\t// this becomes an optimization question where currently we see a 1 element offset as an insertion\n\t\t\t// or deletion i.e. we optimize for [0, 1, 2] --> [9, 0, 1, 2]\n\t\t\t// while a more than 1 offset we see as a swap.\n\t\t\t// We could probably build heuristics for having an optimized course of action here as well, but\n\t\t\t// might go at the cost of some bytes.\n\t\t\t//\n\t\t\t// If we wanted to optimize for i.e. only swaps we'd just do the last two code-branches and have\n\t\t\t// only the first item be a re-scouting and all the others fall in their skewed counter-part.\n\t\t\t// We could also further optimize for swaps\n\t\t\tif (matchingIndex == skewedIndex - 1) {\n\t\t\t\tskew--;\n\t\t\t} else if (matchingIndex == skewedIndex + 1) {\n\t\t\t\tskew++;\n\t\t\t} else {\n\t\t\t\tif (matchingIndex > skewedIndex) {\n\t\t\t\t\tskew--;\n\t\t\t\t} else {\n\t\t\t\t\tskew++;\n\t\t\t\t}\n\n\t\t\t\t// Move this VNode's DOM if the original index (matchingIndex) doesn't\n\t\t\t\t// match the new skew index (i + new skew)\n\t\t\t\t// In the former two branches we know that it matches after skewing\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remove remaining oldChildren if there are any. Loop forwards so that as we\n\t// unmount DOM from the beginning of the oldChildren, we can adjust oldDom to\n\t// point to the next child, which needs to be the first DOM node that won't be\n\t// unmounted.\n\tif (remainingOldChildren) {\n\t\tfor (i = 0; i < oldChildrenLength; i++) {\n\t\t\toldVNode = oldChildren[i];\n\t\t\tif (oldVNode != NULL && (oldVNode._flags & MATCHED) == 0) {\n\t\t\t\tif (oldVNode._dom == oldDom) {\n\t\t\t\t\toldDom = getDomSibling(oldVNode);\n\t\t\t\t}\n\n\t\t\t\tunmount(oldVNode, oldVNode);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * @param {VNode} parentVNode\n * @param {PreactElement} oldDom\n * @param {PreactElement} parentDom\n * @param {boolean} shouldPlace\n * @returns {PreactElement}\n */\nfunction insert(parentVNode, oldDom, parentDom, shouldPlace) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\n\tif (typeof parentVNode.type == 'function') {\n\t\tlet children = parentVNode._children;\n\t\tfor (let i = 0; children && i < children.length; i++) {\n\t\t\tif (children[i]) {\n\t\t\t\t// If we enter this code path on sCU bailout, where we copy\n\t\t\t\t// oldVNode._children to newVNode._children, we need to update the old\n\t\t\t\t// children's _parent pointer to point to the newVNode (parentVNode\n\t\t\t\t// here).\n\t\t\t\tchildren[i]._parent = parentVNode;\n\t\t\t\toldDom = insert(children[i], oldDom, parentDom, shouldPlace);\n\t\t\t}\n\t\t}\n\n\t\treturn oldDom;\n\t} else if (parentVNode._dom != oldDom) {\n\t\tif (shouldPlace) {\n\t\t\tif (oldDom && parentVNode.type && !oldDom.parentNode) {\n\t\t\t\toldDom = getDomSibling(parentVNode);\n\t\t\t}\n\t\t\tparentDom.insertBefore(parentVNode._dom, oldDom || NULL);\n\t\t}\n\t\toldDom = parentVNode._dom;\n\t}\n\n\tdo {\n\t\toldDom = oldDom && oldDom.nextSibling;\n\t} while (oldDom != NULL && oldDom.nodeType == 8);\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {ComponentChildren} children The unflattened children of a virtual\n * node\n * @returns {VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == NULL || typeof children == 'boolean') {\n\t} else if (isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\n/**\n * @param {VNode} childVNode\n * @param {VNode[]} oldChildren\n * @param {number} skewedIndex\n * @param {number} remainingOldChildren\n * @returns {number}\n */\nfunction findMatchingIndex(\n\tchildVNode,\n\toldChildren,\n\tskewedIndex,\n\tremainingOldChildren\n) {\n\tconst key = childVNode.key;\n\tconst type = childVNode.type;\n\tlet oldVNode = oldChildren[skewedIndex];\n\tconst matched = oldVNode != NULL && (oldVNode._flags & MATCHED) == 0;\n\n\t// We only need to perform a search if there are more children\n\t// (remainingOldChildren) to search. However, if the oldVNode we just looked\n\t// at skewedIndex was not already used in this diff, then there must be at\n\t// least 1 other (so greater than 1) remainingOldChildren to attempt to match\n\t// against. So the following condition checks that ensuring\n\t// remainingOldChildren > 1 if the oldVNode is not already used/matched. Else\n\t// if the oldVNode was null or matched, then there could needs to be at least\n\t// 1 (aka `remainingOldChildren > 0`) children to find and compare against.\n\t//\n\t// If there is an unkeyed functional VNode, that isn't a built-in like our Fragment,\n\t// we should not search as we risk re-using state of an unrelated VNode. (reverted for now)\n\tlet shouldSearch =\n\t\t// (typeof type != 'function' || type === Fragment || key) &&\n\t\tremainingOldChildren > (matched ? 1 : 0);\n\n\tif (\n\t\t(oldVNode === NULL && childVNode.key == null) ||\n\t\t(matched && key == oldVNode.key && type == oldVNode.type)\n\t) {\n\t\treturn skewedIndex;\n\t} else if (shouldSearch) {\n\t\tlet x = skewedIndex - 1;\n\t\tlet y = skewedIndex + 1;\n\t\twhile (x >= 0 || y < oldChildren.length) {\n\t\t\tconst childIndex = x >= 0 ? x-- : y++;\n\t\t\toldVNode = oldChildren[childIndex];\n\t\t\tif (\n\t\t\t\toldVNode != NULL &&\n\t\t\t\t(oldVNode._flags & MATCHED) == 0 &&\n\t\t\t\tkey == oldVNode.key &&\n\t\t\t\ttype == oldVNode.type\n\t\t\t) {\n\t\t\t\treturn childIndex;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1;\n}\n", "import {\n\tEMPTY_OBJ,\n\tMATH_NAMESPACE,\n\tMODE_HYDRATE,\n\tMODE_SUSPENDED,\n\tNULL,\n\tRESET_MODE,\n\tSVG_NAMESPACE,\n\tUNDEFINED,\n\tXHTML_NAMESPACE\n} from '../constants';\nimport { BaseComponent, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { setProperty } from './props';\nimport { assign, isArray, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * @typedef {import('../internal').ComponentChildren} ComponentChildren\n * @typedef {import('../internal').Component} Component\n * @typedef {import('../internal').PreactElement} PreactElement\n * @typedef {import('../internal').VNode} VNode\n */\n\n/**\n * @template {any} T\n * @typedef {import('../internal').Ref<T>} Ref<T>\n */\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {PreactElement} parentDom The parent of the DOM element\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array<PreactElement>} excessDomChildren\n * @param {Array<Component>} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\t/** @type {any} */\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor != UNDEFINED) return NULL;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._flags & MODE_SUSPENDED) {\n\t\tisHydrating = !!(oldVNode._flags & MODE_HYDRATE);\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\touter: if (typeof newType == 'function') {\n\t\ttry {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\t\t\tconst isClassComponent =\n\t\t\t\t'prototype' in newType && newType.prototype.render;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif (isClassComponent) {\n\t\t\t\t\t// @ts-expect-error The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-expect-error Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new BaseComponent(\n\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tc.props = newProps;\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc.context = componentContext;\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (isClassComponent && c._nextState == NULL) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (isClassComponent && newType.getDerivedStateFromProps != NULL) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\t\t\tc._vnode = newVNode;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\tnewType.getDerivedStateFromProps == NULL &&\n\t\t\t\t\tc.componentWillMount != NULL\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent && c.componentDidMount != NULL) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\tnewType.getDerivedStateFromProps == NULL &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != NULL\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != NULL &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false) ||\n\t\t\t\t\tnewVNode._original == oldVNode._original\n\t\t\t\t) {\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original != oldVNode._original) {\n\t\t\t\t\t\t// When we are dealing with a bail because of sCU we have to update\n\t\t\t\t\t\t// the props, state and dirty-state.\n\t\t\t\t\t\t// when we are dealing with strict-equality we don't as the child could still\n\t\t\t\t\t\t// be dirtied see #3883\n\t\t\t\t\t\tc.props = newProps;\n\t\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t\tc._dirty = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.some(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\n\t\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t\t}\n\t\t\t\t\tc._stateCallbacks = [];\n\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != NULL) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent && c.componentDidUpdate != NULL) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._parentDom = parentDom;\n\t\t\tc._force = false;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif (isClassComponent) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t}\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != NULL) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (isClassComponent && !isNew && c.getSnapshotBeforeUpdate != NULL) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet isTopLevelFragment =\n\t\t\t\ttmp != NULL && tmp.type === Fragment && tmp.key == NULL;\n\t\t\tlet renderResult = tmp;\n\n\t\t\tif (isTopLevelFragment) {\n\t\t\t\trenderResult = cloneNode(tmp.props.children);\n\t\t\t}\n\n\t\t\toldDom = diffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tisArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnamespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._flags &= RESET_MODE;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = NULL;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tnewVNode._original = NULL;\n\t\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\t\tif (isHydrating || excessDomChildren != NULL) {\n\t\t\t\tif (e.then) {\n\t\t\t\t\tnewVNode._flags |= isHydrating\n\t\t\t\t\t\t? MODE_HYDRATE | MODE_SUSPENDED\n\t\t\t\t\t\t: MODE_SUSPENDED;\n\n\t\t\t\t\twhile (oldDom && oldDom.nodeType == 8 && oldDom.nextSibling) {\n\t\t\t\t\t\toldDom = oldDom.nextSibling;\n\t\t\t\t\t}\n\n\t\t\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = NULL;\n\t\t\t\t\tnewVNode._dom = oldDom;\n\t\t\t\t} else {\n\t\t\t\t\tfor (let i = excessDomChildren.length; i--; ) {\n\t\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t\t}\n\t\t\t\t\tmarkAsForce(newVNode);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\tif (!e.then) markAsForce(newVNode);\n\t\t\t}\n\t\t\toptions._catchError(e, newVNode, oldVNode);\n\t\t}\n\t} else if (\n\t\texcessDomChildren == NULL &&\n\t\tnewVNode._original == oldVNode._original\n\t) {\n\t\tnewVNode._children = oldVNode._children;\n\t\tnewVNode._dom = oldVNode._dom;\n\t} else {\n\t\toldDom = newVNode._dom = diffElementNodes(\n\t\t\toldVNode._dom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\tisHydrating,\n\t\t\trefQueue\n\t\t);\n\t}\n\n\tif ((tmp = options.diffed)) tmp(newVNode);\n\n\treturn newVNode._flags & MODE_SUSPENDED ? undefined : oldDom;\n}\n\nfunction markAsForce(vnode) {\n\tif (vnode && vnode._component) vnode._component._force = true;\n\tif (vnode && vnode._children) vnode._children.forEach(markAsForce);\n}\n\n/**\n * @param {Array<Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {VNode} root\n */\nexport function commitRoot(commitQueue, root, refQueue) {\n\tfor (let i = 0; i < refQueue.length; i++) {\n\t\tapplyRef(refQueue[i], refQueue[++i], refQueue[++i]);\n\t}\n\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-expect-error Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-expect-error See above comment on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\nfunction cloneNode(node) {\n\tif (\n\t\ttypeof node != 'object' ||\n\t\tnode == NULL ||\n\t\t(node._depth && node._depth > 0)\n\t) {\n\t\treturn node;\n\t}\n\n\tif (isArray(node)) {\n\t\treturn node.map(cloneNode);\n\t}\n\n\treturn assign({}, node);\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {PreactElement} dom The DOM element representing the virtual nodes\n * being diffed\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array<PreactElement>} excessDomChildren\n * @param {Array<Component>} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n * @returns {PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating,\n\trefQueue\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = /** @type {string} */ (newVNode.type);\n\t/** @type {any} */\n\tlet i;\n\t/** @type {{ __html?: string }} */\n\tlet newHtml;\n\t/** @type {{ __html?: string }} */\n\tlet oldHtml;\n\t/** @type {ComponentChildren} */\n\tlet newChildren;\n\tlet value;\n\tlet inputValue;\n\tlet checked;\n\n\t// Tracks entering and exiting namespaces when descending through the tree.\n\tif (nodeType == 'svg') namespace = SVG_NAMESPACE;\n\telse if (nodeType == 'math') namespace = MATH_NAMESPACE;\n\telse if (!namespace) namespace = XHTML_NAMESPACE;\n\n\tif (excessDomChildren != NULL) {\n\t\tfor (i = 0; i < excessDomChildren.length; i++) {\n\t\t\tvalue = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tvalue &&\n\t\t\t\t'setAttribute' in value == !!nodeType &&\n\t\t\t\t(nodeType ? value.localName == nodeType : value.nodeType == 3)\n\t\t\t) {\n\t\t\t\tdom = value;\n\t\t\t\texcessDomChildren[i] = NULL;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == NULL) {\n\t\tif (nodeType == NULL) {\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tdom = document.createElementNS(\n\t\t\tnamespace,\n\t\t\tnodeType,\n\t\t\tnewProps.is && newProps\n\t\t);\n\n\t\t// we are creating a new node, so we can assume this is a new subtree (in\n\t\t// case we are hydrating), this deopts the hydrate\n\t\tif (isHydrating) {\n\t\t\tif (options._hydrationMismatch)\n\t\t\t\toptions._hydrationMismatch(newVNode, excessDomChildren);\n\t\t\tisHydrating = false;\n\t\t}\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = NULL;\n\t}\n\n\tif (nodeType == NULL) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data != newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\n\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\n\n\t\t// If we are in a situation where we are not hydrating but are using\n\t\t// existing DOM (e.g. replaceNode) we should read the existing DOM\n\t\t// attributes to diff them\n\t\tif (!isHydrating && excessDomChildren != NULL) {\n\t\t\toldProps = {};\n\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\tvalue = dom.attributes[i];\n\t\t\t\toldProps[value.name] = value.value;\n\t\t\t}\n\t\t}\n\n\t\tfor (i in oldProps) {\n\t\t\tvalue = oldProps[i];\n\t\t\tif (i == 'children') {\n\t\t\t} else if (i == 'dangerouslySetInnerHTML') {\n\t\t\t\toldHtml = value;\n\t\t\t} else if (!(i in newProps)) {\n\t\t\t\tif (\n\t\t\t\t\t(i == 'value' && 'defaultValue' in newProps) ||\n\t\t\t\t\t(i == 'checked' && 'defaultChecked' in newProps)\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tsetProperty(dom, i, NULL, value, namespace);\n\t\t\t}\n\t\t}\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tfor (i in newProps) {\n\t\t\tvalue = newProps[i];\n\t\t\tif (i == 'children') {\n\t\t\t\tnewChildren = value;\n\t\t\t} else if (i == 'dangerouslySetInnerHTML') {\n\t\t\t\tnewHtml = value;\n\t\t\t} else if (i == 'value') {\n\t\t\t\tinputValue = value;\n\t\t\t} else if (i == 'checked') {\n\t\t\t\tchecked = value;\n\t\t\t} else if (\n\t\t\t\t(!isHydrating || typeof value == 'function') &&\n\t\t\t\toldProps[i] !== value\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, value, oldProps[i], namespace);\n\t\t\t}\n\t\t}\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\tif (\n\t\t\t\t!isHydrating &&\n\t\t\t\t(!oldHtml ||\n\t\t\t\t\t(newHtml.__html != oldHtml.__html && newHtml.__html != dom.innerHTML))\n\t\t\t) {\n\t\t\t\tdom.innerHTML = newHtml.__html;\n\t\t\t}\n\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\tif (oldHtml) dom.innerHTML = '';\n\n\t\t\tdiffChildren(\n\t\t\t\t// @ts-expect-error\n\t\t\t\tnewVNode.type == 'template' ? dom.content : dom,\n\t\t\t\tisArray(newChildren) ? newChildren : [newChildren],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnodeType == 'foreignObject' ? XHTML_NAMESPACE : namespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != NULL) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// As above, don't diff props during hydration\n\t\tif (!isHydrating) {\n\t\t\ti = 'value';\n\t\t\tif (nodeType == 'progress' && inputValue == NULL) {\n\t\t\t\tdom.removeAttribute('value');\n\t\t\t} else if (\n\t\t\t\tinputValue != UNDEFINED &&\n\t\t\t\t// #2756 For the <progress>-element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(inputValue !== dom[i] ||\n\t\t\t\t\t(nodeType == 'progress' && !inputValue) ||\n\t\t\t\t\t// This is only for IE 11 to fix <select> value not being updated.\n\t\t\t\t\t// To avoid a stale select value we need to set the option.value\n\t\t\t\t\t// again, which triggers IE11 to re-evaluate the select value\n\t\t\t\t\t(nodeType == 'option' && inputValue != oldProps[i]))\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, inputValue, oldProps[i], namespace);\n\t\t\t}\n\n\t\t\ti = 'checked';\n\t\t\tif (checked != UNDEFINED && checked != dom[i]) {\n\t\t\t\tsetProperty(dom, i, checked, oldProps[i], namespace);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n/**\n * Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {Ref<any> & { _unmount?: unknown }} ref\n * @param {any} value\n * @param {VNode} vnode\n */\nexport function applyRef(ref, value, vnode) {\n\ttry {\n\t\tif (typeof ref == 'function') {\n\t\t\tlet hasRefUnmount = typeof ref._unmount == 'function';\n\t\t\tif (hasRefUnmount) {\n\t\t\t\t// @ts-ignore TS doesn't like moving narrowing checks into variables\n\t\t\t\tref._unmount();\n\t\t\t}\n\n\t\t\tif (!hasRefUnmount || value != NULL) {\n\t\t\t\t// Store the cleanup function on the function\n\t\t\t\t// instance object itself to avoid shape\n\t\t\t\t// transitioning vnode\n\t\t\t\tref._unmount = ref(value);\n\t\t\t}\n\t\t} else ref.current = value;\n\t} catch (e) {\n\t\toptions._catchError(e, vnode);\n\t}\n}\n\n/**\n * Unmount a virtual node from the tree and apply DOM changes\n * @param {VNode} vnode The virtual node to unmount\n * @param {VNode} parentVNode The parent of the VNode that initiated the unmount\n * @param {boolean} [skipRemove] Flag that indicates that a parent node of the\n * current element is already detached from the DOM.\n */\nexport function unmount(vnode, parentVNode, skipRemove) {\n\tlet r;\n\tif (options.unmount) options.unmount(vnode);\n\n\tif ((r = vnode.ref)) {\n\t\tif (!r.current || r.current == vnode._dom) {\n\t\t\tapplyRef(r, NULL, parentVNode);\n\t\t}\n\t}\n\n\tif ((r = vnode._component) != NULL) {\n\t\tif (r.componentWillUnmount) {\n\t\t\ttry {\n\t\t\t\tr.componentWillUnmount();\n\t\t\t} catch (e) {\n\t\t\t\toptions._catchError(e, parentVNode);\n\t\t\t}\n\t\t}\n\n\t\tr.base = r._parentDom = NULL;\n\t}\n\n\tif ((r = vnode._children)) {\n\t\tfor (let i = 0; i < r.length; i++) {\n\t\t\tif (r[i]) {\n\t\t\t\tunmount(\n\t\t\t\t\tr[i],\n\t\t\t\t\tparentVNode,\n\t\t\t\t\tskipRemove || typeof vnode.type != 'function'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!skipRemove) {\n\t\tremoveNode(vnode._dom);\n\t}\n\n\tvnode._component = vnode._parent = vnode._dom = UNDEFINED;\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n", "import { EMPTY_OBJ, NULL } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createElement, Fragment } from './create-element';\nimport options from './options';\nimport { slice } from './util';\n\n/**\n * Render a Preact virtual node into a DOM element\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to render into\n * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\n * existing DOM tree rooted at `replaceNode`\n */\nexport function render(vnode, parentDom, replaceNode) {\n\t// https://github.com/preactjs/preact/issues/3794\n\tif (parentDom == document) {\n\t\tparentDom = document.documentElement;\n\t}\n\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\n\t// element..\n\tlet isHydrating = typeof replaceNode == 'function';\n\n\t// To be able to support calling `render()` multiple times on the same\n\t// DOM node, we need to obtain a reference to the previous tree. We do\n\t// this by assigning a new `_children` property to DOM nodes which points\n\t// to the last rendered tree. By default this property is not present, which\n\t// means that we are mounting a new tree for the first time.\n\tlet oldVNode = isHydrating\n\t\t? NULL\n\t\t: (replaceNode && replaceNode._children) || parentDom._children;\n\n\tvnode = ((!isHydrating && replaceNode) || parentDom)._children =\n\t\tcreateElement(Fragment, NULL, [vnode]);\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [],\n\t\trefQueue = [];\n\tdiff(\n\t\tparentDom,\n\t\t// Determine the new vnode tree and store it on the DOM element on\n\t\t// our custom `_children` property.\n\t\tvnode,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.namespaceURI,\n\t\t!isHydrating && replaceNode\n\t\t\t? [replaceNode]\n\t\t\t: oldVNode\n\t\t\t\t? NULL\n\t\t\t\t: parentDom.firstChild\n\t\t\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t\t\t: NULL,\n\t\tcommitQueue,\n\t\t!isHydrating && replaceNode\n\t\t\t? replaceNode\n\t\t\t: oldVNode\n\t\t\t\t? oldVNode._dom\n\t\t\t\t: parentDom.firstChild,\n\t\tisHydrating,\n\t\trefQueue\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, vnode, refQueue);\n}\n\n/**\n * Update an existing DOM element with data from a Preact virtual node\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to update\n */\nexport function hydrate(vnode, parentDom) {\n\trender(vnode, parentDom, hydrate);\n}\n", "import { assign, slice } from './util';\nimport { createVNode } from './create-element';\nimport { NULL, UNDEFINED } from './constants';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./internal').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array<import('./internal').ComponentChildren>} rest Any additional arguments will be used\n * as replacement children.\n * @returns {import('./internal').VNode}\n */\nexport function cloneElement(vnode, props, children) {\n\tlet normalizedProps = assign({}, vnode.props),\n\t\tkey,\n\t\tref,\n\t\ti;\n\n\tlet defaultProps;\n\n\tif (vnode.type && vnode.type.defaultProps) {\n\t\tdefaultProps = vnode.type.defaultProps;\n\t}\n\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse if (props[i] === UNDEFINED && defaultProps != UNDEFINED) {\n\t\t\tnormalizedProps[i] = defaultProps[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\treturn createVNode(\n\t\tvnode.type,\n\t\tnormalizedProps,\n\t\tkey || vnode.key,\n\t\tref || vnode.ref,\n\t\tNULL\n\t);\n}\n", "import { NULL } from '../constants';\n\n/**\n * Find the closest error boundary to a thrown error and call it\n * @param {object} error The thrown value\n * @param {import('../internal').VNode} vnode The vnode that threw the error that was caught (except\n * for unmounting when this parameter is the highest parent that was being\n * unmounted)\n * @param {import('../internal').VNode} [oldVNode]\n * @param {import('../internal').ErrorInfo} [errorInfo]\n */\nexport function _catchError(error, vnode, oldVNode, errorInfo) {\n\t/** @type {import('../internal').Component} */\n\tlet component,\n\t\t/** @type {import('../internal').ComponentType} */\n\t\tctor,\n\t\t/** @type {boolean} */\n\t\thandled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif ((component = vnode._component) && !component._processingException) {\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError != NULL) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch != NULL) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\t// This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.\n\t\t\t\tif (handled) {\n\t\t\t\t\treturn (component._pendingError = component);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow error;\n}\n", "import { options as _options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {import('./internal').Component} */\nlet previousComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\n// Cast to use internal Options type\nconst options = /** @type {import('./internal').Options} */ (_options);\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\nlet oldRoot = options._root;\n\n// We take the minimum timeout for requestAnimationFrame to ensure that\n// the callback is invoked after the next frame. 35ms is based on a 30hz\n// refresh rate, which is the minimum rate for a smooth user experience.\nconst RAF_TIMEOUT = 35;\nlet prevRaf;\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions._diff = vnode => {\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._root = (vnode, parentDom) => {\n\tif (vnode && parentDom._children && parentDom._children._mask) {\n\t\tvnode._mask = parentDom._children._mask;\n\t}\n\n\tif (oldRoot) oldRoot(vnode, parentDom);\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\tif (previousComponent === currentComponent) {\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentComponent._renderCallbacks = [];\n\t\t\thooks._list.forEach(hookItem => {\n\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t}\n\t\t\t\thookItem._pendingArgs = hookItem._nextValue = undefined;\n\t\t\t});\n\t\t} else {\n\t\t\thooks._pendingEffects.forEach(invokeCleanup);\n\t\t\thooks._pendingEffects.forEach(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentIndex = 0;\n\t\t}\n\t}\n\tpreviousComponent = currentComponent;\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tif (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));\n\t\tc.__hooks._list.forEach(hookItem => {\n\t\t\tif (hookItem._pendingArgs) {\n\t\t\t\thookItem._args = hookItem._pendingArgs;\n\t\t\t}\n\t\t\thookItem._pendingArgs = undefined;\n\t\t});\n\t}\n\tpreviousComponent = currentComponent = null;\n};\n\n// TODO: Improve typing of commitQueue parameter\n/** @type {(vnode: import('./internal').VNode, commitQueue: any) => void} */\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.forEach(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.forEach(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tc.__hooks = undefined;\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({});\n\t}\n\n\treturn hooks._list[index];\n}\n\n/**\n * @template {unknown} S\n * @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} [initialState]\n * @returns {[S, (state: S) => void]}\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @template {unknown} S\n * @template {unknown} A\n * @param {import('./index').Reducer<S, A>} reducer\n * @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ S, (state: S) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst currentValue = hookState._nextValue\n\t\t\t\t\t? hookState._nextValue[0]\n\t\t\t\t\t: hookState._value[0];\n\t\t\t\tconst nextValue = hookState._reducer(currentValue, action);\n\n\t\t\t\tif (currentValue !== nextValue) {\n\t\t\t\t\thookState._nextValue = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\n\t\tif (!currentComponent._hasScuFromHooks) {\n\t\t\tcurrentComponent._hasScuFromHooks = true;\n\t\t\tlet prevScu = currentComponent.shouldComponentUpdate;\n\t\t\tconst prevCWU = currentComponent.componentWillUpdate;\n\n\t\t\t// If we're dealing with a forced update `shouldComponentUpdate` will\n\t\t\t// not be called. But we use that to update the hook values, so we\n\t\t\t// need to call it.\n\t\t\tcurrentComponent.componentWillUpdate = function (p, s, c) {\n\t\t\t\tif (this._force) {\n\t\t\t\t\tlet tmp = prevScu;\n\t\t\t\t\t// Clear to avoid other sCU hooks from being called\n\t\t\t\t\tprevScu = undefined;\n\t\t\t\t\tupdateHookState(p, s, c);\n\t\t\t\t\tprevScu = tmp;\n\t\t\t\t}\n\n\t\t\t\tif (prevCWU) prevCWU.call(this, p, s, c);\n\t\t\t};\n\n\t\t\t// This SCU has the purpose of bailing out after repeated updates\n\t\t\t// to stateful hooks.\n\t\t\t// we store the next value in _nextValue[0] and keep doing that for all\n\t\t\t// state setters, if we have next states and\n\t\t\t// all next states within a component end up being equal to their original state\n\t\t\t// we are safe to bail out for this specific component.\n\t\t\t/**\n\t\t\t *\n\t\t\t * @type {import('./internal').Component[\"shouldComponentUpdate\"]}\n\t\t\t */\n\t\t\t// @ts-ignore - We don't use TS to downtranspile\n\t\t\t// eslint-disable-next-line no-inner-declarations\n\t\t\tfunction updateHookState(p, s, c) {\n\t\t\t\tif (!hookState._component.__hooks) return true;\n\n\t\t\t\t/** @type {(x: import('./internal').HookState) => x is import('./internal').ReducerHookState} */\n\t\t\t\tconst isStateHook = x => !!x._component;\n\t\t\t\tconst stateHooks =\n\t\t\t\t\thookState._component.__hooks._list.filter(isStateHook);\n\n\t\t\t\tconst allHooksEmpty = stateHooks.every(x => !x._nextValue);\n\t\t\t\t// When we have no updated hooks in the component we invoke the previous SCU or\n\t\t\t\t// traverse the VDOM tree further.\n\t\t\t\tif (allHooksEmpty) {\n\t\t\t\t\treturn prevScu ? prevScu.call(this, p, s, c) : true;\n\t\t\t\t}\n\n\t\t\t\t// We check whether we have components with a nextValue set that\n\t\t\t\t// have values that aren't equal to one another this pushes\n\t\t\t\t// us to update further down the tree\n\t\t\t\tlet shouldUpdate = hookState._component.props !== p;\n\t\t\t\tstateHooks.forEach(hookItem => {\n\t\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\t\tconst currentValue = hookItem._value[0];\n\t\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t\t\thookItem._nextValue = undefined;\n\t\t\t\t\t\tif (currentValue !== hookItem._value[0]) shouldUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn prevScu\n\t\t\t\t\t? prevScu.call(this, p, s, c) || shouldUpdate\n\t\t\t\t\t: shouldUpdate;\n\t\t\t}\n\n\t\t\tcurrentComponent.shouldComponentUpdate = updateHookState;\n\t\t}\n\t}\n\n\treturn hookState._nextValue || hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\n/** @type {(initialValue: unknown) => unknown} */\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tconst result = ref(createHandle());\n\t\t\t\treturn () => {\n\t\t\t\t\tref(null);\n\t\t\t\t\tif (result && typeof result == 'function') result();\n\t\t\t\t};\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () => (ref.current = null);\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @template {unknown} T\n * @param {() => T} factory\n * @param {unknown[]} args\n * @returns {T}\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState<T>} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._value = factory();\n\t\tstate._args = args;\n\t\tstate._factory = factory;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {unknown[]} args\n * @returns {() => void}\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(\n\t\t\tformatter ? formatter(value) : /** @type {any}*/ (value)\n\t\t);\n\t}\n}\n\n/**\n * @param {(error: unknown, errorInfo: import('preact').ErrorInfo) => void} cb\n * @returns {[unknown, () => void]}\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = (err, errorInfo) => {\n\t\t\tif (state._value) state._value(err, errorInfo);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\n/** @type {() => string} */\nexport function useId() {\n\t/** @type {import('./internal').IdHookState} */\n\tconst state = getHookState(currentIndex++, 11);\n\tif (!state._value) {\n\t\t// Grab either the root node or the nearest async boundary node.\n\t\t/** @type {import('./internal').VNode} */\n\t\tlet root = currentComponent._vnode;\n\t\twhile (root !== null && !root._mask && root._parent !== null) {\n\t\t\troot = root._parent;\n\t\t}\n\n\t\tlet mask = root._mask || (root._mask = [0, 0]);\n\t\tstate._value = 'P' + mask[0] + '-' + mask[1]++;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tif (!component._parentDom || !component.__hooks) continue;\n\t\ttry {\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeCleanup);\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeEffect);\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n * @returns {void}\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').HookState} hook\n * @returns {void}\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n * @returns {void}\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {unknown[]} oldArgs\n * @param {unknown[]} newArgs\n * @returns {boolean}\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\n/**\n * @template Arg\n * @param {Arg} arg\n * @param {(arg: Arg) => any} f\n * @returns {any}\n */\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n", "const ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '&quot;';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&amp;';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '&lt;';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out += str.slice(last, i);\n\t\tout += ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out += str.slice(last, i);\n\treturn out;\n}\n", "/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 1;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n", "import { options, Fragment } from 'preact';\nimport { encodeEntities } from './utils';\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\n\nlet vnodeId = 0;\n\nconst isArray = Array.isArray;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {unknown} [isStaticChildren]\n * @param {unknown} [__source]\n * @param {unknown} [__self]\n */\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\n\tif (!props) props = {};\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = props,\n\t\tref,\n\t\ti;\n\n\tif ('ref' in normalizedProps) {\n\t\tnormalizedProps = {};\n\t\tfor (i in props) {\n\t\t\tif (i == 'ref') {\n\t\t\t\tref = props[i];\n\t\t\t} else {\n\t\t\t\tnormalizedProps[i] = props[i];\n\t\t\t}\n\t\t}\n\t}\n\n\t/** @type {VNode & { __source: any; __self: any }} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_component: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t_index: -1,\n\t\t_flags: 0,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\n/**\n * Create a template vnode. This function is not expected to be\n * used directly, but rather through a precompile JSX transform\n * @param {string[]} templates\n * @param {Array<string | null | VNode>} exprs\n * @returns {VNode}\n */\nfunction jsxTemplate(templates, ...exprs) {\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\n\t// Bypass render to string top level Fragment optimization\n\tvnode.key = vnode._vnode;\n\treturn vnode;\n}\n\nconst JS_TO_CSS = {};\nconst CSS_REGEX = /[A-Z]/g;\n\n/**\n * Unwrap potential signals.\n * @param {*} value\n * @returns {*}\n */\nfunction normalizeAttrValue(value) {\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.valueOf === 'function'\n\t\t? value.valueOf()\n\t\t: value;\n}\n\n/**\n * Serialize an HTML attribute to a string. This function is not\n * expected to be used directly, but rather through a precompile\n * JSX transform\n * @param {string} name The attribute name\n * @param {*} value The attribute value\n * @returns {string}\n */\nfunction jsxAttr(name, value) {\n\tif (options.attr) {\n\t\tconst result = options.attr(name, value);\n\t\tif (typeof result === 'string') return result;\n\t}\n\n\tvalue = normalizeAttrValue(value);\n\n\tif (name === 'ref' || name === 'key') return '';\n\tif (name === 'style' && typeof value === 'object') {\n\t\tlet str = '';\n\t\tfor (let prop in value) {\n\t\t\tlet val = value[prop];\n\t\t\tif (val != null && val !== '') {\n\t\t\t\tconst name =\n\t\t\t\t\tprop[0] == '-'\n\t\t\t\t\t\t? prop\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\t\tlet suffix = ';';\n\t\t\t\tif (\n\t\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t\t// Exclude custom-attributes\n\t\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\n\t\t\t\t) {\n\t\t\t\t\tsuffix = 'px;';\n\t\t\t\t}\n\t\t\t\tstr = str + name + ':' + val + suffix;\n\t\t\t}\n\t\t}\n\t\treturn name + '=\"' + encodeEntities(str) + '\"';\n\t}\n\n\tif (\n\t\tvalue == null ||\n\t\tvalue === false ||\n\t\ttypeof value === 'function' ||\n\t\ttypeof value === 'object'\n\t) {\n\t\treturn '';\n\t} else if (value === true) return name;\n\n\treturn name + '=\"' + encodeEntities('' + value) + '\"';\n}\n\n/**\n * Escape a dynamic child passed to `jsxTemplate`. This function\n * is not expected to be used directly, but rather through a\n * precompile JSX transform\n * @param {*} value\n * @returns {string | null | VNode | Array<string | null | VNode>}\n */\nfunction jsxEscape(value) {\n\tif (\n\t\tvalue == null ||\n\t\ttypeof value === 'boolean' ||\n\t\ttypeof value === 'function'\n\t) {\n\t\treturn null;\n\t}\n\n\tif (typeof value === 'object') {\n\t\t// Check for VNode\n\t\tif (value.constructor === undefined) return value;\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t}\n\n\treturn encodeEntities('' + value);\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment,\n\t// precompiled JSX transform\n\tjsxTemplate,\n\tjsxAttr,\n\tjsxEscape\n};\n", "/** @jsxImportSource preact */\nimport { Fragment, render, type FunctionalComponent } from \"preact\";\nimport { useCallback, useEffect, useRef, useState } from \"preact/hooks\";\n\n// -- Types --\nexport type CueCardPosition = \"top-center\" | \"top-right\";\nexport type CueCardDirection = \"top-to-bottom\" | \"right-to-left\";\nexport type CueCardTheme = \"glass\" | \"light\" | \"dark\";\nexport type PersonalizationStatus =\n | \"resting\"\n | \"starting\"\n | \"success\"\n | \"error\";\n\nexport type KeyboardModifier = \"ctrl\" | \"alt\" | \"shift\" | \"meta\";\n\nexport interface CueCardKeyboardShortcut {\n key: string;\n modifiers?: KeyboardModifier[];\n}\n\nexport interface PersonalizationInput {\n [key: string]: string;\n}\n\nexport interface PersonalizationField {\n name: string;\n label: string;\n placeholder?: string;\n type?: \"text\" | \"email\" | \"tel\" | \"url\";\n required?: boolean;\n pattern?: string;\n minLength?: number;\n maxLength?: number;\n errorMessage?: string;\n}\n\nexport interface CueCardThemeConfig {\n fontFamily?: string;\n backgroundColor?: string;\n borderColor?: string;\n textColor?: string;\n subtitleColor?: string;\n primaryColor?: string;\n primaryTextColor?: string;\n borderRadius?: string;\n}\n\nexport interface CueCardTextConfig {\n titleResting?: string;\n titleSuccess?: string;\n titleError?: string;\n subtitleResting?: string;\n subtitleSuccess?: string;\n subtitleError?: string;\n btnResting?: string;\n btnSuccess?: string;\n btnLoading?: string;\n btnError?: string;\n launcherLabel?: string;\n launcherLabelSuccess?: string;\n}\n\nexport interface CueCardConfig {\n position?: CueCardPosition;\n direction?: CueCardDirection;\n theme?: CueCardTheme;\n entranceDelayMs?: number;\n exitDelayMs?: number;\n fields: PersonalizationField[];\n hasPersonalization?: boolean;\n isVisible?: boolean;\n progressPct?: number;\n status?: PersonalizationStatus;\n enableTimer?: boolean;\n timerDurationMs?: number;\n\n // New config props\n customTheme?: CueCardThemeConfig;\n textOverrides?: CueCardTextConfig;\n enableFocusMode?: boolean;\n focusBlurIntensity?: string;\n focusDelayMs?: number;\n enableLauncher?: boolean;\n enableClickSheen?: boolean;\n showLauncherLogo?: boolean;\n launcherStyles?: Record<string, string>;\n launcherShineBorder?: {\n enabled: boolean;\n color?: string | string[];\n duration?: number;\n borderWidth?: number;\n };\n showKeyboardHints?: boolean;\n showWatermark?: boolean;\n keyboardShortcut?: CueCardKeyboardShortcut;\n mountMode?: \"overlay\" | \"inline\";\n mountNode?: HTMLElement;\n\n // Undo toggle feature\n enableUndoToggle?: boolean;\n isPersonalized?: boolean;\n\n onDismiss?: () => void;\n onExitComplete?: () => void;\n onEntranceComplete?: () => void;\n onSubmitPersonalization?: (values: PersonalizationInput) => void;\n onOpenChange?: (isOpen: boolean) => void;\n onTogglePersonalization?: () => void;\n}\n\n// -- Icons (Converted to light components) --\nconst ArrowRightIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n width=\"16\"\n height=\"16\"\n >\n <path d=\"M5 12h14M12 5l7 7-7 7\" />\n </svg>\n);\nconst CheckIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"16\"\n height=\"16\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 0 1 1.04-.208Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\nconst XMarkIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"16\"\n height=\"16\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\nconst LoaderIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"animate-spin\"\n >\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n);\nconst LogoIcon = () => (\n <svg\n width=\"32\"\n height=\"32\"\n viewBox=\"0 0 900 900\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"446\" cy=\"450\" r=\"424\" fill=\"black\" />\n <circle cx=\"450\" cy=\"450\" r=\"357\" fill=\"#E8E8E8\" />\n <ellipse\n cx=\"579.85\"\n cy=\"294.451\"\n rx=\"79.778\"\n ry=\"108.483\"\n transform=\"rotate(-46.2324 579.85 294.451)\"\n fill=\"black\"\n />\n </svg>\n);\nconst ArrowPathIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99\"\n />\n </svg>\n);\n\n// -- Styles --\nconst STYLES = `\n :host { --kb-font-family: system-ui, -apple-system, sans-serif; --kb-bg-container: rgba(255, 255, 255, 0.05); --kb-border-container: rgba(255, 255, 255, 0.2); --kb-shadow-container: 0 25px 50px -12px rgba(0, 0, 0, 0.25); --kb-backdrop-blur: 16px; --kb-text-title: #ffffff; --kb-text-subtitle: rgba(255, 255, 255, 0.7); --kb-btn-dismiss-bg: rgba(0, 0, 0, 0.7); --kb-btn-dismiss-border: rgba(255, 255, 255, 0.2); --kb-btn-dismiss-text: rgba(255, 255, 255, 0.8); --kb-btn-dismiss-hover-bg: rgba(0, 0, 0, 0.9); --kb-btn-dismiss-hover-text: #ffffff; --kb-btn-trigger-bg: #ffffff; --kb-btn-trigger-text: #000000; --kb-btn-trigger-hover-bg: rgba(255, 255, 255, 0.9); --kb-progress-track: rgba(255, 255, 255, 0.2); --kb-progress-indicator: #ffffff; --kb-popover-bg: rgba(255, 255, 255, 0.05); --kb-popover-border: rgba(255, 255, 255, 0.2); --kb-popover-text: #ffffff; --kb-input-bg: transparent; --kb-input-border: rgba(255, 255, 255, 0.3); --kb-input-text: #ffffff; --kb-input-placeholder: rgba(255, 255, 255, 0.6); --kb-form-label: #ffffff; --kb-success-color: #6ee7b7; --kb-error-text: #ef4444; --kb-focus-blur: 10px; --kb-kbd-bg: rgba(255, 255, 255, 0.15); --kb-kbd-border: rgba(255, 255, 255, 0.4); --kb-kbd-text: #ffffff; --kb-watermark-text: rgba(255, 255, 255, 0.4); font-family: var(--kb-font-family); }\n .theme-light { --kb-bg-container: #ffffff; --kb-border-container: #e2e8f0; --kb-shadow-container: 0 20px 25px -5px rgba(0, 0, 0, 0.1); --kb-backdrop-blur: 0px; --kb-text-title: #0f172a; --kb-text-subtitle: #475569; --kb-btn-dismiss-bg: #ffffff; --kb-btn-dismiss-border: #e2e8f0; --kb-btn-dismiss-text: #64748b; --kb-btn-dismiss-hover-bg: #f1f5f9; --kb-btn-dismiss-hover-text: #0f172a; --kb-btn-trigger-bg: #0f172a; --kb-btn-trigger-text: #ffffff; --kb-btn-trigger-hover-bg: #1e293b; --kb-progress-track: #e2e8f0; --kb-progress-indicator: #0f172a; --kb-popover-bg: #ffffff; --kb-popover-border: #e2e8f0; --kb-popover-text: #0f172a; --kb-input-bg: #ffffff; --kb-input-border: #cbd5e1; --kb-input-text: #0f172a; --kb-input-placeholder: #94a3b8; --kb-form-label: #334155; --kb-success-color: #059669; --kb-error-text: #ef4444; --kb-kbd-bg: #f1f5f9; --kb-kbd-border: #e2e8f0; --kb-kbd-text: #64748b; --kb-watermark-text: #94a3b8; }\n .theme-dark { --kb-bg-container: #0f172a; --kb-border-container: #334155; --kb-shadow-container: 0 25px 50px -12px rgba(0, 0, 0, 0.25); --kb-backdrop-blur: 0px; --kb-text-title: #f1f5f9; --kb-text-subtitle: #94a3b8; --kb-btn-dismiss-bg: #1e293b; --kb-btn-dismiss-border: #334155; --kb-btn-dismiss-text: #cbd5e1; --kb-btn-dismiss-hover-bg: #334155; --kb-btn-dismiss-hover-text: #ffffff; --kb-btn-trigger-bg: #ffffff; --kb-btn-trigger-text: #0f172a; --kb-btn-trigger-hover-bg: #f1f5f9; --kb-progress-track: #1e293b; --kb-progress-indicator: #ffffff; --kb-popover-bg: #0f172a; --kb-popover-border: #334155; --kb-popover-text: #f1f5f9; --kb-input-bg: #0f172a; --kb-input-border: #475569; --kb-input-text: #f1f5f9; --kb-input-placeholder: #94a3b8; --kb-form-label: #e2e8f0; --kb-success-color: #6ee7b7; --kb-error-text: #ef4444; --kb-kbd-bg: #1e293b; --kb-kbd-border: #334155; --kb-kbd-text: #94a3b8; --kb-watermark-text: #64748b; }\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n #cue-card-root { position: fixed; z-index: 2147483647; pointer-events: none; width: 100%; height: 0; top: 0; left: 0; isolation: isolate; }\n .container { position: absolute; pointer-events: auto; background-color: var(--kb-bg-container); border: 1px solid var(--kb-border-container); box-shadow: var(--kb-shadow-container); backdrop-filter: blur(var(--kb-backdrop-blur)); -webkit-backdrop-filter: blur(var(--kb-backdrop-blur)); border-radius: 0.25rem; border-bottom-left-radius: 0.25rem; border-bottom-right-radius: 0.25rem; padding: 1.25rem 1.5rem; width: auto; min-width: 400px; max-width: 90vw; opacity: 0; z-index: 1; font-family: var(--kb-font-family); }\n .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); transition: all 0.5s ease; z-index: 0; pointer-events: none; }\n .backdrop.active { background: rgba(0,0,0,0.1); backdrop-filter: blur(var(--kb-focus-blur)); -webkit-backdrop-filter: blur(var(--kb-focus-blur)); }\n .launcher { position: absolute; pointer-events: auto; background-color: var(--kb-bg-container); border: 1px solid var(--kb-border-container); box-shadow: var(--kb-shadow-container); backdrop-filter: blur(var(--kb-backdrop-blur)); -webkit-backdrop-filter: blur(var(--kb-backdrop-blur)); border-radius: 9999px; padding: 0.5rem 1rem; display: flex; align-items: center; gap: 0.75rem; cursor: pointer; transition: transform 0.2s, opacity 0.3s; opacity: 0; z-index: 1; color: var(--kb-text-title); font-weight: 500; font-size: 0.875rem; font-family: var(--kb-font-family); }\n .launcher .kbd-hint .kbd { background: var(--kb-kbd-bg); border: 1px solid var(--kb-kbd-border); color: var(--kb-kbd-text); }\n .launcher .kbd-hint .kbd-text { color: var(--kb-kbd-text); }\n .launcher:hover { transform: scale(1.02); background-color: var(--kb-bg-container); }\n .pos-top-center { left: 50%; translate: -50% 0; top: 1rem; }\n .pos-top-right { right: 1rem; top: 1rem; left: auto; }\n @media (max-width: 768px) { .pos-top-center, .pos-top-right { left: 0.5rem; right: 0.5rem; top: 0.5rem; translate: none; width: auto; max-width: none; } }\n :host(.kb-inline) { position: relative !important; z-index: auto !important; top: auto !important; left: auto !important; width: 100% !important; height: auto !important; pointer-events: auto !important; isolation: auto !important; display: block; }\n :host(.kb-inline) .container, :host(.kb-inline) .launcher { position: relative !important; left: auto !important; right: auto !important; top: auto !important; translate: none !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; box-shadow: none !important; }\n :host(.kb-inline) .container { opacity: 1 !important; transform: none !important; }\n :host(.kb-inline) .popover { position: static !important; transform: none !important; opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; margin-top: 0.75rem !important; }\n :host(.kb-inline) .backdrop, :host(.kb-inline) .launcher, :host(.kb-inline) .btn-dismiss { display: none !important; }\n .content-wrapper { display: flex; align-items: center; gap: 1rem; }\n .logo { width: 2.5rem; height: 2.5rem; display: none; }\n @media (min-width: 1024px) { .logo { display: block; } }\n .text-content { flex: 1; user-select: none; }\n .text-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }\n .title { color: var(--kb-text-title); font-size: 1rem; font-weight: 600; line-height: 1.5; }\n .subtitle { color: var(--kb-text-title); font-size: 0.875rem; line-height: 1.25; opacity: 0.8; }\n .btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 0.375rem; font-weight: 500; font-size: 0.875rem; line-height: 1.25rem; padding: 0.5rem 1rem; transition: all 0.2s; cursor: pointer; border: none; outline: none; }\n .btn-trigger { background-color: var(--kb-btn-trigger-bg); color: var(--kb-btn-trigger-text); min-width: 8rem; gap: 0.5rem; transition: opacity 0.2s ease-out, background-color 0.2s ease-out; }\n .btn-trigger.hidden { opacity: 0; pointer-events: none; }\n .btn-trigger:not(:disabled):hover { background-color: var(--kb-btn-trigger-hover-bg); }\n .btn-trigger:disabled { opacity: 0.8; cursor: not-allowed; }\n .btn-trigger.success { background-color: transparent; color: var(--kb-success-color); padding-right: 0.75rem; cursor: default; }\n .status-text { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--kb-text-subtitle); opacity: 0.8; }\n .btn-trigger.success:hover { background-color: transparent; }\n .animate-spin { animation: spin 1s linear infinite; }\n @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }\n @keyframes shine { 0% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } 100% { background-position: 0% 0%; } }\n @keyframes sheen-flash { 0% { opacity: 0; transform: translateX(-100%) skewX(-15deg); } 50% { opacity: 0.6; } 100% { opacity: 0; transform: translateX(200%) skewX(-15deg); } }\n .container-sheen { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: inherit; }\n .container-sheen::after { content: ''; position: absolute; top: 0; left: 0; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent); transform: translateX(-100%) skewX(-15deg); }\n .container-sheen.active::after { animation: sheen-flash 0.6s ease-out forwards; }\n .launcher-shine-border { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background-size: 300% 300%; animation: shine var(--shine-duration, 14s) linear infinite; mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask-composite: exclude; -webkit-mask-composite: xor; padding: var(--shine-border-width, 1px); }\n .btn-dismiss { position: absolute; top: -0.5rem; left: -0.5rem; width: 1.5rem; height: 1.5rem; padding: 0; border-radius: 9999px; display: flex; align-items: center; justify-content: center; background-color: var(--kb-btn-dismiss-bg); border: 1px solid var(--kb-btn-dismiss-border); color: var(--kb-btn-dismiss-text); cursor: pointer; transition: all 0.3s ease-out; z-index: 10; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }\n .btn-dismiss:hover { background-color: var(--kb-btn-dismiss-hover-bg); color: var(--kb-btn-dismiss-hover-text); }\n .progress-clip { position: absolute; inset: 0; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; overflow: hidden; pointer-events: none; }\n .progress-container { position: absolute; bottom: 0; left: 0; right: 0; height: 0.25rem; background-color: var(--kb-progress-track); overflow: hidden; pointer-events: none; border-radius: 0; }\n .progress-bar { height: 100%; background-color: var(--kb-progress-indicator); width: 0%; transition: width 0.3s ease; }\n .popover { position: absolute; top: 100%; left: 0; right: 0; margin-top: 0.375rem; background-color: var(--kb-popover-bg); border: 1px solid var(--kb-popover-border); border-radius: 0.25rem; border-top-left-radius: 0; border-top-right-radius: 0; padding: 1rem 1.5rem; color: var(--kb-popover-text); box-shadow: var(--kb-shadow-container); backdrop-filter: blur(var(--kb-backdrop-blur)); -webkit-backdrop-filter: blur(var(--kb-backdrop-blur)); opacity: 0; transform: translateY(-10px); pointer-events: none; visibility: hidden; transition: all 0.2s ease-out; }\n .popover.open { opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible; }\n .container.popover-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }\n .container.popover-open .progress-clip { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }\n .form-group { margin-bottom: 0; }\n .form-label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--kb-form-label); font-weight: 500; }\n .input-row { display: flex; gap: 0.5rem; }\n .form-input { flex: 1; background-color: var(--kb-input-bg); border: 1px solid var(--kb-input-border); color: var(--kb-input-text); border-radius: 0.375rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; outline: none; transition: border-color 0.2s; min-height: 44px; }\n .form-input::placeholder { color: var(--kb-input-placeholder); }\n .form-input:focus { border-color: var(--kb-progress-indicator); }\n .form-input.error { border-color: var(--kb-error-text); }\n .form-label.error { color: var(--kb-error-text); }\n .form-message { color: var(--kb-error-text); font-size: 0.75rem; margin-top: 0.25rem; font-weight: 500; }\n .btn-submit { background-color: var(--kb-btn-trigger-bg); color: var(--kb-btn-trigger-text); padding: 0.5rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }\n .btn-submit:disabled { opacity: 0.7; cursor: not-allowed; }\n .kbd-hint { display: flex; align-items: center; gap: 0.5rem; position: absolute; top: calc(100% + 0.5rem); left: 50%; transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; white-space: nowrap; }\n .kbd-hint.visible { opacity: 1; }\n .kbd-group { display: flex; align-items: center; gap: 0.25rem; }\n .kbd { font-family: inherit; font-size: 0.75rem; line-height: 1; padding: 0.25rem 0.375rem; border-radius: 0.25rem; background: var(--kb-kbd-bg); border: 1px solid var(--kb-kbd-border); color: var(--kb-kbd-text); font-weight: 500; min-width: 1.25rem; text-align: center; }\n .kbd-text { font-size: 0.75rem; color: var(--kb-kbd-text); }\n .watermark { text-align: center; font-size: 0.625rem; color: var(--kb-watermark-text); opacity: 0.8; font-weight: 500; letter-spacing: 0.025em; }\n .watermark a { color: inherit; text-decoration: none; cursor: pointer; }\n .watermark a:hover { text-decoration: underline; text-decoration-color: var(--kb-watermark-text); }\n .popover-watermark { position: absolute; top: 100%; left: 0; right: 0; text-align: center; font-size: 0.625rem; color: var(--kb-watermark-text); opacity: 0.6; font-weight: 500; letter-spacing: 0.025em; padding-top: 0.5rem; }\n .popover-watermark a { color: inherit; text-decoration: none; cursor: pointer; }\n .popover-watermark a:hover { text-decoration: underline; opacity: 1; }\n /* Launcher hint positioning */\n .launcher .kbd-hint { position: static; transform: none; opacity: 0.6; transition: opacity 0.2s; }\n .launcher:hover .kbd-hint { opacity: 1; }\n .pos-top-right.launcher .kbd-hint { left: auto; right: auto; }\n /* Launcher dismiss button */\n .launcher .btn-dismiss.launcher-dismiss { top: -0.375rem; left: -0.375rem; width: 1.25rem; height: 1.25rem; opacity: 0; transition: opacity 0.2s ease-out, background-color 0.3s ease-out, color 0.3s ease-out; }\n .launcher:hover .btn-dismiss.launcher-dismiss { opacity: 1; }\n /* Launcher logo */\n .launcher-logo { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }\n .launcher-logo svg { width: 20px; height: 20px; }\n /* Mobile: hide keyboard hints, show dismiss button */\n @media (max-width: 768px) {\n .launcher .kbd-hint { display: none; }\n .launcher .btn-dismiss.launcher-dismiss { opacity: 1; }\n }\n /* Toggle personalization button */\n .btn-toggle-personalization { position: relative; width: 1.75rem; height: 1.75rem; padding: 0; border-radius: 9999px; display: flex; align-items: center; justify-content: center; background-color: var(--kb-btn-dismiss-bg); border: 1px solid var(--kb-btn-dismiss-border); color: var(--kb-btn-dismiss-text); cursor: pointer; transition: all 0.2s ease-out; flex-shrink: 0; margin-left: 0.25rem; }\n .btn-toggle-personalization:hover { background-color: var(--kb-btn-dismiss-hover-bg); color: var(--kb-btn-dismiss-hover-text); transform: scale(1.05); }\n .btn-toggle-personalization svg { width: 14px; height: 14px; }\n /* Custom tooltip for toggle button */\n .btn-toggle-personalization .toggle-tooltip { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; background-color: var(--kb-bg-container); border: 1px solid var(--kb-border-container); color: var(--kb-text-title); font-size: 0.7rem; font-weight: 500; padding: 0.25rem 0.5rem; border-radius: 4px; opacity: 0; visibility: hidden; transition: opacity 0.15s ease-out, visibility 0.15s ease-out; pointer-events: none; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }\n .btn-toggle-personalization:hover .toggle-tooltip { opacity: 1; visibility: visible; }\n`;\n\n// -- Animation Hook --\nconst useEnterExitAnimation = (\n ref: preact.RefObject<HTMLElement>,\n isVisible: boolean,\n config: {\n direction: CueCardDirection;\n position: CueCardPosition;\n entranceDelayMs: number;\n exitDelayMs: number;\n onEntranceComplete?: () => void;\n onExitComplete?: () => void;\n }\n) => {\n const hasEnteredRef = useRef(false);\n const currentAnimRef = useRef<Animation | null>(null);\n\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n\n // Cancel any running animation to prevent overlaps\n if (currentAnimRef.current) {\n currentAnimRef.current.cancel();\n currentAnimRef.current = null;\n }\n\n const isTopDown = config.direction === \"top-to-bottom\";\n const initialTransform = isTopDown\n ? `translateY(-60px)`\n : `translateX(60px)`;\n const exitTransform = isTopDown ? `translateY(-20px)` : `translateX(20px)`;\n const finalTransform = \"translate(0, 0)\";\n\n if (isVisible) {\n // Show element before entrance animation\n element.style.visibility = \"visible\";\n hasEnteredRef.current = true;\n\n const anim = element.animate(\n [\n { opacity: 0, transform: initialTransform },\n { opacity: 1, transform: finalTransform },\n ],\n {\n duration: 500,\n delay: config.entranceDelayMs,\n easing: \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n fill: \"forwards\",\n }\n );\n currentAnimRef.current = anim;\n anim.onfinish = () => {\n currentAnimRef.current = null;\n config.onEntranceComplete?.();\n };\n } else {\n // Exit\n if (hasEnteredRef.current) {\n const anim = element.animate(\n [\n { opacity: 1, transform: finalTransform },\n { opacity: 0, transform: exitTransform },\n ],\n {\n duration: 350,\n delay: config.exitDelayMs,\n easing: \"ease-in-out\",\n fill: \"forwards\",\n }\n );\n currentAnimRef.current = anim;\n anim.onfinish = () => {\n // Hide element after exit animation completes\n element.style.visibility = \"hidden\";\n currentAnimRef.current = null;\n config.onExitComplete?.();\n };\n } else {\n // Never entered, ensure it's hidden immediately\n element.style.opacity = \"0\";\n element.style.transform = exitTransform;\n element.style.visibility = \"hidden\";\n }\n }\n }, [isVisible, config.direction]);\n};\n\n// -- Helper to map custom theme to CSS variables --\nconst getThemeStyles = (theme?: CueCardThemeConfig) => {\n if (!theme) return {};\n const styles: Record<string, string | undefined> = {};\n\n if (theme.fontFamily) styles[\"--kb-font-family\"] = theme.fontFamily;\n if (theme.backgroundColor) {\n styles[\"--kb-bg-container\"] = theme.backgroundColor;\n styles[\"--kb-popover-bg\"] = theme.backgroundColor;\n }\n if (theme.borderColor) {\n styles[\"--kb-border-container\"] = theme.borderColor;\n styles[\"--kb-popover-border\"] = theme.borderColor;\n }\n if (theme.textColor) {\n styles[\"--kb-text-title\"] = theme.textColor;\n styles[\"--kb-popover-text\"] = theme.textColor;\n }\n if (theme.subtitleColor) styles[\"--kb-text-subtitle\"] = theme.subtitleColor;\n if (theme.borderRadius) {\n styles[\"border-radius\"] = theme.borderRadius;\n styles[\"border-bottom-left-radius\"] = theme.borderRadius;\n styles[\"border-bottom-right-radius\"] = theme.borderRadius;\n }\n\n // Button & Accents\n if (theme.primaryColor) {\n styles[\"--kb-btn-trigger-bg\"] = theme.primaryColor;\n styles[\"--kb-progress-indicator\"] = theme.primaryColor;\n styles[\"--kb-success-color\"] = theme.primaryColor;\n }\n if (theme.primaryTextColor) {\n styles[\"--kb-btn-trigger-text\"] = theme.primaryTextColor;\n }\n\n return styles as any; // Preact style types can be strict\n};\n\n// -- Components --\n\nconst CueCardContent: FunctionalComponent<{\n config: CueCardConfig;\n isOpen: boolean;\n skipFocus?: boolean;\n setIsOpen: (val: boolean) => void;\n}> = ({ config, isOpen, skipFocus, setIsOpen }) => {\n const isInline = config.mountMode === \"inline\";\n const containerRef = useRef<HTMLDivElement>(null);\n const launcherRef = useRef<HTMLDivElement>(null);\n const backdropRef = useRef<HTMLDivElement>(null);\n const firstInputRef = useRef<HTMLInputElement>(null);\n const formRef = useRef<HTMLFormElement>(null);\n\n const [mode, setMode] = useState<\"card\" | \"launcher\">(\"card\");\n const [isDismissed, setIsDismissed] = useState(false);\n const [hasHadSuccess, setHasHadSuccess] = useState(false);\n const [isExitingToLauncher, setIsExitingToLauncher] = useState(false);\n const hasEnteredRef = useRef(false);\n const isShowingInitialSuccessRef = useRef(false);\n const justReopenedRef = useRef(false);\n const previousModeRef = useRef<\"card\" | \"launcher\">(\"card\");\n const prevStatusRef = useRef(config.status); // Add this\n const prevVisibilityRef = useRef(!!config.isVisible);\n const timerStartRef = useRef<number | null>(null);\n const timerRafRef = useRef<number | null>(null);\n const hasTimerCompletedRef = useRef(false);\n const [isHovering, setIsHovering] = useState(false);\n const [sheenActive, setSheenActive] = useState(false);\n const [errors, setErrors] = useState<Record<string, string>>({});\n const [timerProgress, setTimerProgressState] = useState(0);\n const timerProgressRef = useRef(0);\n const timerEnabled = config.enableTimer !== false;\n const timerDuration = Math.max(500, config.timerDurationMs ?? 20_000);\n\n const setTimerProgress = useCallback((value: number) => {\n timerProgressRef.current = value;\n setTimerProgressState(value);\n }, []);\n\n useEffect(() => {\n if (config.isVisible) {\n setMode(\"card\");\n hasEnteredRef.current = false;\n setIsDismissed(false);\n }\n }, [config.isVisible]);\n\n // -- Render-time State Logic --\n\n // 1. Detect re-opening (Launcher -> Card) and clear initial success flag\n // This ensures that when we re-open, we don't show the old success state\n if (mode === \"card\" && previousModeRef.current === \"launcher\") {\n isShowingInitialSuccessRef.current = false;\n }\n\n // 2. Handle success transition immediately during render to ensure no flash of wrong state\n if (config.status === \"success\" && prevStatusRef.current !== \"success\") {\n // If we just transitioned to success and we're in card mode, show the success state\n if (mode === \"card\") {\n isShowingInitialSuccessRef.current = true;\n }\n } else if (config.status !== \"success\") {\n isShowingInitialSuccessRef.current = false;\n }\n // Update tracking ref\n prevStatusRef.current = config.status;\n\n // Track mode transitions to detect reopening\n useEffect(() => {\n const wasLauncher = previousModeRef.current === \"launcher\";\n const isCard = mode === \"card\";\n\n // If we transitioned from launcher to card after success, mark as reopening\n if (wasLauncher && isCard && hasHadSuccess) {\n justReopenedRef.current = true;\n setTimeout(() => {\n justReopenedRef.current = false;\n }, 100);\n }\n\n if (mode === \"launcher\") {\n setIsHovering(false);\n }\n\n if (wasLauncher && isCard && timerEnabled) {\n setTimerProgress(0);\n timerStartRef.current = null;\n hasTimerCompletedRef.current = false;\n }\n }, [mode, setTimerProgress, timerEnabled]);\n\n // Track success state and auto-dismiss to launcher\n useEffect(() => {\n if (config.status === \"success\") {\n setHasHadSuccess(true);\n\n // Auto-dismiss to launcher after a short delay if launcher is enabled\n // Only if we are currently showing the initial success state\n if (\n config.enableLauncher &&\n mode === \"card\" &&\n isShowingInitialSuccessRef.current\n ) {\n const timer = setTimeout(() => {\n setMode(\"launcher\");\n // Don't clear isShowingInitialSuccessRef here, let it persist during exit animation\n // We clear it in the render-time logic when switching back to card mode\n }, 2000); // 2 second delay after success\n\n return () => clearTimeout(timer);\n }\n }\n }, [config.status, config.enableLauncher, mode]);\n\n // Reset the idle timer when the card becomes visible again\n useEffect(() => {\n if (config.isVisible && !prevVisibilityRef.current && timerEnabled) {\n setTimerProgress(0);\n timerStartRef.current = null;\n hasTimerCompletedRef.current = false;\n }\n prevVisibilityRef.current = !!config.isVisible;\n }, [config.isVisible, setTimerProgress, timerEnabled]);\n\n // Update previous mode ref (runs after other effects)\n useEffect(() => {\n previousModeRef.current = mode;\n }, [mode]);\n\n // Store skipFocus in a ref so it persists for the effect\n const skipFocusRef = useRef(false);\n if (skipFocus) {\n skipFocusRef.current = true;\n }\n\n useEffect(() => {\n if (isOpen) {\n // Reset form if opening after success (preparing for \"Show me again\")\n if (hasHadSuccess && formRef.current) {\n formRef.current.reset();\n }\n\n // Focus the first input when the popover opens (unless skipFocus is set)\n // Use a small delay to ensure the popover is visible (CSS transition is 200ms)\n const shouldSkipFocus = skipFocusRef.current;\n skipFocusRef.current = false; // Reset after reading\n\n if (!shouldSkipFocus) {\n const focusTimer = setTimeout(() => {\n if (firstInputRef.current) {\n firstInputRef.current.focus();\n }\n }, 100);\n\n return () => clearTimeout(focusTimer);\n }\n }\n }, [isOpen]);\n\n // Track previous isOpen state to detect transitions\n const prevIsOpenForExpandRef = useRef(isOpen);\n useEffect(() => {\n const wasOpen = prevIsOpenForExpandRef.current;\n prevIsOpenForExpandRef.current = isOpen;\n\n // Only expand from launcher to card when isOpen changes from false to true\n if (!wasOpen && isOpen && mode === \"launcher\") {\n setMode(\"card\");\n }\n }, [isOpen, mode]);\n\n // Track if we're transitioning between modes (need delay for crossfade)\n const isFirstAppearance = !hasEnteredRef.current;\n const wasLauncherPreviously = previousModeRef.current === \"launcher\";\n\n // Card entrance delay: use config delay on first appearance, or wait for launcher exit when reopening\n const cardEntranceDelay = isFirstAppearance\n ? config.entranceDelayMs || 0\n : wasLauncherPreviously && mode === \"card\"\n ? 400 // Wait for launcher exit\n : 0;\n\n if (!isInline) {\n useEnterExitAnimation(\n containerRef,\n !!config.isVisible && mode === \"card\" && !isDismissed,\n {\n direction: config.direction || \"top-to-bottom\",\n position: config.position || \"top-center\",\n entranceDelayMs: cardEntranceDelay,\n exitDelayMs: 75,\n onEntranceComplete: () => {\n config.onEntranceComplete?.();\n hasEnteredRef.current = true;\n },\n onExitComplete: () => {\n if (!config.isVisible || isDismissed) config.onExitComplete?.();\n },\n }\n );\n\n // Delay launcher entrance to allow card exit animation to complete\n // Card exit: 75ms delay + 350ms duration = 425ms total\n const launcherEntranceDelay = 400;\n\n useEnterExitAnimation(\n launcherRef,\n !!config.isVisible && mode === \"launcher\" && !isDismissed,\n {\n direction: config.direction || \"top-to-bottom\",\n position: config.position || \"top-center\",\n entranceDelayMs: launcherEntranceDelay,\n exitDelayMs: 75,\n }\n );\n }\n\n useEffect(() => {\n const el = backdropRef.current;\n if (!el) return;\n\n // Check if status is success AND we're showing the initial success state\n // When reopening from launcher, isShowingInitialSuccessRef is false so blur should apply\n const isShowingSuccessState =\n config.status === \"success\" && isShowingInitialSuccessRef.current;\n\n if (\n config.enableFocusMode &&\n mode === \"card\" &&\n config.isVisible &&\n !isShowingSuccessState\n ) {\n const timer = setTimeout(() => {\n el.classList.add(\"active\");\n }, config.focusDelayMs || 500);\n return () => clearTimeout(timer);\n } else {\n el.classList.remove(\"active\");\n }\n }, [\n config.enableFocusMode,\n mode,\n config.isVisible,\n config.focusDelayMs,\n config.status,\n ]);\n\n useEffect(() => {\n if (!config.isVisible) return;\n\n const handleKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n // ESC always goes directly to launcher (or dismisses if no launcher)\n if (mode === \"card\") {\n // Don't close form first - go straight to launcher to avoid button flash\n if (config.enableLauncher) {\n setIsExitingToLauncher(true);\n setMode(\"launcher\");\n // Reset isOpen after card has fully exited\n setTimeout(() => {\n setIsOpen(false);\n setIsExitingToLauncher(false);\n }, 500);\n } else {\n setIsOpen(false);\n config.onDismiss?.();\n }\n }\n return;\n }\n\n // Helper to check if configured shortcut matches event\n const matchesShortcut = (\n e: KeyboardEvent,\n shortcut?: CueCardKeyboardShortcut\n ) => {\n const s = shortcut || { key: \"p\", modifiers: [\"meta\", \"ctrl\"] }; // Default: Cmd+P or Ctrl+P\n\n // Check Key\n if (e.key.toLowerCase() !== s.key.toLowerCase()) return false;\n\n // Check Modifiers\n const mods = s.modifiers || [];\n // For default (Cmd OR Ctrl), we check if either is present if both are listed in our 'default' logic above\n // But for strict config, we usually want ALL specified modifiers to be pressed.\n\n // If custom shortcut provided:\n if (shortcut) {\n const hasMeta = mods.includes(\"meta\") === e.metaKey;\n const hasCtrl = mods.includes(\"ctrl\") === e.ctrlKey;\n const hasAlt = mods.includes(\"alt\") === e.altKey;\n const hasShift = mods.includes(\"shift\") === e.shiftKey;\n return hasMeta && hasCtrl && hasAlt && hasShift;\n }\n\n // Default fallback logic (Cmd OR Ctrl + P)\n // We treat 'meta' or 'ctrl' as \"Command or Control\" loosely for the default\n const isCmdOrCtrl = e.metaKey || e.ctrlKey;\n return isCmdOrCtrl;\n };\n\n if (matchesShortcut(e, config.keyboardShortcut)) {\n e.preventDefault();\n if (mode === \"launcher\") {\n setMode(\"card\");\n setIsOpen(true);\n } else if (mode === \"card\") {\n if (config.enableLauncher) {\n setMode(\"launcher\");\n } else {\n config.onDismiss?.();\n }\n }\n }\n };\n\n window.addEventListener(\"keydown\", handleKey);\n return () => window.removeEventListener(\"keydown\", handleKey);\n }, [\n config.isVisible,\n isOpen,\n mode,\n config.enableLauncher,\n setIsOpen,\n config.onDismiss,\n ]);\n\n const isMac =\n typeof navigator !== \"undefined\" && /Mac/.test(navigator.userAgent);\n\n // Determine display keys for hint\n const shortcutDisplay = (() => {\n if (config.keyboardShortcut) {\n const mods = config.keyboardShortcut.modifiers || [];\n const keys: string[] = [];\n if (mods.includes(\"meta\")) keys.push(isMac ? \"\u2318\" : \"Win\");\n if (mods.includes(\"ctrl\")) keys.push(\"Ctrl\");\n if (mods.includes(\"alt\")) keys.push(isMac ? \"Opt\" : \"Alt\");\n if (mods.includes(\"shift\")) keys.push(\"Shift\");\n keys.push(config.keyboardShortcut.key.toUpperCase());\n return keys;\n }\n // Default\n return [isMac ? \"\u2318\" : \"Ctrl\", \"P\"];\n })();\n\n const isPending = config.status === \"starting\";\n const isSuccess = config.status === \"success\";\n const isError = config.status === \"error\";\n\n // Only show success styling during the initial success phase, not when re-opening\n const showAsSuccess = isSuccess && isShowingInitialSuccessRef.current;\n\n const txt = config.textOverrides || {};\n\n const titleText = (() => {\n if (isSuccess) return txt.titleSuccess || \"Personalization complete\";\n if (isPending) return \"Starting personalization\"; // usually transitional, rarely customized\n if (isError) return txt.titleError || \"Let's try that again\";\n return config.hasPersonalization\n ? \"Personalization ready\"\n : txt.titleResting || \"Personalization available\";\n })();\n\n const subtitleText = (() => {\n if (isSuccess) return txt.subtitleSuccess || \"Take a look\";\n if (isPending) return \"Hang tight...\";\n if (isError)\n return txt.subtitleError || \"Something went wrong. Tap to retry.\";\n return txt.subtitleResting || \"This page can adapt to you\";\n })();\n\n const buttonText = (() => {\n if (isPending) return txt.btnLoading || \"Starting...\";\n if (isError) return txt.btnError || \"Try again\";\n\n // If currently showing initial success state, show \"Personalised\"\n if (isSuccess && isShowingInitialSuccessRef.current) {\n return txt.btnSuccess || \"Personalised\";\n }\n\n // If we've had success at all, show \"Show me again\"\n if (hasHadSuccess) {\n return \"Show me again\";\n }\n\n // Initial state: show \"Show me\"\n return txt.btnResting || \"Show me\";\n })();\n\n const validateField = (\n name: string,\n value: string,\n fieldConfig?: PersonalizationField\n ): string | null => {\n if (!fieldConfig) return null;\n\n // Required check\n if (fieldConfig.required && !value.trim()) {\n return fieldConfig.errorMessage || `${fieldConfig.label} is required`;\n }\n\n if (!value) return null; // Skip other checks if empty and not required\n\n // Email check\n if (fieldConfig.type === \"email\") {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n if (!emailRegex.test(value)) {\n return fieldConfig.errorMessage || \"Please enter a valid email address\";\n }\n }\n\n // URL check\n if (fieldConfig.type === \"url\") {\n try {\n new URL(value);\n } catch {\n return (\n fieldConfig.errorMessage ||\n \"Please enter a valid URL (e.g., https://example.com)\"\n );\n }\n }\n\n // Min length\n if (fieldConfig.minLength && value.length < fieldConfig.minLength) {\n return (\n fieldConfig.errorMessage ||\n `Must be at least ${fieldConfig.minLength} characters`\n );\n }\n\n // Max length\n if (fieldConfig.maxLength && value.length > fieldConfig.maxLength) {\n return (\n fieldConfig.errorMessage ||\n `Must be at most ${fieldConfig.maxLength} characters`\n );\n }\n\n // Pattern check\n if (fieldConfig.pattern) {\n const regex = new RegExp(fieldConfig.pattern);\n if (!regex.test(value)) {\n return fieldConfig.errorMessage || \"Invalid format\";\n }\n }\n\n return null;\n };\n\n const handleSubmit = (e: Event) => {\n e.preventDefault();\n if (isPending) return;\n\n const formData = new FormData(e.target as HTMLFormElement);\n const values: PersonalizationInput = {};\n const newErrors: Record<string, string> = {};\n let hasErrors = false;\n\n formData.forEach((value, key) => {\n const strValue = value.toString();\n values[key] = strValue;\n\n const fieldConfig = config.fields.find((f) => f.name === key);\n const error = validateField(key, strValue, fieldConfig);\n if (error) {\n newErrors[key] = error;\n hasErrors = true;\n }\n });\n\n if (hasErrors) {\n setErrors(newErrors);\n return;\n }\n\n setErrors({});\n setIsOpen(false);\n config.onSubmitPersonalization?.(values);\n };\n\n const handleInput = (e: Event) => {\n const target = e.target as HTMLInputElement;\n const name = target.name;\n\n // If there's an existing error for this field, re-validate on input\n if (errors[name]) {\n const fieldConfig = config.fields.find((f) => f.name === name);\n const error = validateField(name, target.value, fieldConfig);\n\n setErrors((prev) => {\n const next = { ...prev };\n if (error) {\n next[name] = error;\n } else {\n delete next[name];\n }\n return next;\n });\n }\n };\n\n const togglePopover = (e: Event) => {\n e.stopPropagation();\n if (isPending || isSuccess) return;\n const opening = !isOpen;\n setIsOpen(opening);\n\n // Trigger sheen effect when opening\n if (opening && config.enableClickSheen) {\n setSheenActive(true);\n setTimeout(() => setSheenActive(false), 600);\n }\n };\n\n // Timer-driven progress bar for first load\n useEffect(() => {\n if (!timerEnabled) return;\n if (hasTimerCompletedRef.current) return;\n\n const shouldRun =\n config.isVisible &&\n mode === \"card\" &&\n config.status === \"resting\" &&\n !isOpen &&\n !isHovering;\n\n if (!shouldRun) {\n if (timerRafRef.current !== null) {\n cancelAnimationFrame(timerRafRef.current);\n timerRafRef.current = null;\n }\n timerStartRef.current = null;\n return;\n }\n\n const tick = (timestamp: number) => {\n if (timerStartRef.current === null) {\n timerStartRef.current =\n timestamp - (timerProgressRef.current / 100) * timerDuration;\n }\n\n const elapsed = timestamp - timerStartRef.current;\n const pct = Math.min(1, elapsed / timerDuration);\n const nextProgress = pct * 100;\n setTimerProgress(nextProgress);\n\n if (pct >= 1) {\n hasTimerCompletedRef.current = true;\n timerStartRef.current = null;\n timerRafRef.current = null;\n if (config.enableLauncher) {\n setMode(\"launcher\");\n setIsOpen(false);\n } else {\n config.onDismiss?.();\n }\n return;\n }\n\n timerRafRef.current = requestAnimationFrame(tick);\n };\n\n timerRafRef.current = requestAnimationFrame(tick);\n\n return () => {\n if (timerRafRef.current !== null) {\n cancelAnimationFrame(timerRafRef.current);\n timerRafRef.current = null;\n }\n };\n }, [\n config.enableLauncher,\n config.isVisible,\n config.onDismiss,\n config.status,\n isHovering,\n isOpen,\n mode,\n setIsOpen,\n timerDuration,\n timerEnabled,\n setTimerProgress,\n ]);\n\n useEffect(() => {\n return () => {\n if (timerRafRef.current !== null) {\n cancelAnimationFrame(timerRafRef.current);\n }\n };\n }, []);\n\n const clampedProgress = Math.max(0, Math.min(100, config.progressPct ?? 0));\n const displayedProgress = timerEnabled ? timerProgress : clampedProgress;\n\n // Compute visibility flags for pointer-events (same conditions as animations)\n const isContainerVisible =\n !!config.isVisible && mode === \"card\" && !isDismissed;\n const isLauncherVisible =\n !!config.isVisible && mode === \"launcher\" && !isDismissed;\n const isAnythingVisible = isContainerVisible || isLauncherVisible;\n\n return (\n <Fragment>\n <div\n ref={backdropRef}\n class=\"backdrop\"\n style={{ display: isAnythingVisible ? \"block\" : \"none\" }}\n />\n <div\n ref={containerRef}\n class={`container theme-${config.theme || \"glass\"} pos-${\n config.position || \"top-center\"\n }${isOpen ? \" popover-open\" : \"\"}`}\n style={{\n ...getThemeStyles(config.customTheme),\n pointerEvents: isContainerVisible ? \"auto\" : \"none\",\n }}\n onClick={() => !isOpen && !isPending && !isSuccess && setIsOpen(true)}\n onMouseEnter={() => setIsHovering(true)}\n onMouseLeave={() => setIsHovering(false)}\n >\n {config.enableClickSheen && (\n <div class={`container-sheen${sheenActive ? \" active\" : \"\"}`} />\n )}\n <button\n class=\"btn-dismiss\"\n aria-label=\"Dismiss\"\n onClick={(e) => {\n e.stopPropagation();\n hasTimerCompletedRef.current = true;\n if (config.enableLauncher) {\n setMode(\"launcher\");\n } else {\n config.onDismiss?.();\n }\n }}\n >\n <XMarkIcon />\n </button>\n\n <div class=\"content-wrapper\">\n {/* <div class=\"logo\">\n <LogoIcon />\n </div> */}\n\n <div class=\"text-content\">\n <div class=\"text-row\">\n <div>\n <div class=\"title\">{titleText}</div>\n <div class=\"subtitle\">{subtitleText}</div>\n </div>\n\n {isPending ? (\n <span class=\"status-text\">\n <LoaderIcon /> {buttonText}\n </span>\n ) : (\n <button\n class={`btn btn-trigger ${showAsSuccess ? \"success\" : \"\"}${\n isOpen || isExitingToLauncher ? \" hidden\" : \"\"\n }`}\n disabled={showAsSuccess}\n onClick={togglePopover}\n >\n {showAsSuccess ? (\n <Fragment>\n <CheckIcon /> {buttonText}\n </Fragment>\n ) : (\n buttonText\n )}\n </button>\n )}\n </div>\n </div>\n </div>\n\n <div class=\"progress-clip\">\n <div class=\"progress-container\">\n <div\n class=\"progress-bar\"\n style={{\n width: `${displayedProgress}%`,\n }}\n />\n </div>\n </div>\n\n <div\n class={`popover ${isOpen ? \"open\" : \"\"}`}\n onClick={(e) => e.stopPropagation()}\n >\n <form onSubmit={handleSubmit} ref={formRef}>\n {config.fields.map((field, idx) => (\n <div class=\"form-group\" key={field.name}>\n <label\n class={`form-label ${errors[field.name] ? \"error\" : \"\"}`}\n >\n {field.label}\n </label>\n <div class=\"input-row\">\n <input\n ref={idx === 0 ? firstInputRef : undefined}\n class={`form-input ${errors[field.name] ? \"error\" : \"\"}`}\n name={field.name}\n type={field.type || \"text\"}\n placeholder={field.placeholder}\n required={field.required}\n onInput={handleInput}\n // Auto-focus logic could be added here with another useEffect/ref\n />\n {config.fields.length === 1 && (\n <button\n type=\"submit\"\n class=\"btn btn-submit\"\n disabled={isPending}\n >\n {isPending ? <LoaderIcon /> : <ArrowRightIcon />}\n </button>\n )}\n </div>\n {errors[field.name] && (\n <div class=\"form-message\">{errors[field.name]}</div>\n )}\n </div>\n ))}\n {config.fields.length > 1 && (\n <button\n type=\"submit\"\n class=\"btn btn-submit\"\n style={{ width: \"100%\" }}\n disabled={isPending}\n >\n {isPending ? <LoaderIcon /> : <ArrowRightIcon />}\n </button>\n )}\n </form>\n {config.showWatermark && (\n <div class=\"popover-watermark\">\n Powered by{\" \"}\n <a\n href=\"https://kenobi.ai\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Kenobi\n </a>\n </div>\n )}\n </div>\n\n {config.showKeyboardHints && config.enableFocusMode && (\n <div\n class={`kbd-hint ${\n !isOpen && !isPending && !isSuccess ? \"visible\" : \"\"\n }`}\n >\n <div class=\"kbd-group\">\n <div class=\"kbd\">Esc</div>\n </div>\n <span class=\"kbd-text\">to dismiss</span>\n </div>\n )}\n </div>\n\n <div\n ref={launcherRef}\n class={`launcher theme-${config.theme || \"glass\"} pos-${\n config.position || \"top-center\"\n }`}\n style={{\n ...getThemeStyles(config.customTheme),\n ...config.launcherStyles,\n pointerEvents: isLauncherVisible ? \"auto\" : \"none\",\n }}\n onClick={(e) => {\n e.stopPropagation();\n setIsDismissed(false);\n setMode(\"card\");\n setIsOpen(true);\n }}\n role=\"button\"\n tabIndex={0}\n >\n {config.launcherShineBorder?.enabled && (\n <div\n class=\"launcher-shine-border\"\n style={{\n \"--shine-duration\": `${\n config.launcherShineBorder.duration || 14\n }s`,\n \"--shine-border-width\": `${\n config.launcherShineBorder.borderWidth || 1\n }px`,\n backgroundImage: `radial-gradient(transparent, transparent, ${\n Array.isArray(config.launcherShineBorder.color)\n ? config.launcherShineBorder.color.join(\",\")\n : config.launcherShineBorder.color || \"rgba(255,255,255,0.5)\"\n }, transparent, transparent)`,\n }}\n />\n )}\n <button\n class=\"btn-dismiss launcher-dismiss\"\n aria-label=\"Dismiss\"\n onClick={(e) => {\n e.stopPropagation();\n setIsDismissed(true);\n config.onDismiss?.();\n }}\n >\n <XMarkIcon />\n </button>\n {config.showLauncherLogo !== false && (\n <div class=\"launcher-logo\">\n <LogoIcon />\n </div>\n )}\n {hasHadSuccess\n ? config.textOverrides?.launcherLabelSuccess ||\n config.textOverrides?.launcherLabel ||\n \"Personalize again\"\n : config.textOverrides?.launcherLabel || \"Personalize\"}\n\n {config.enableUndoToggle && hasHadSuccess && (\n <button\n class=\"btn-toggle-personalization\"\n aria-label={\n config.isPersonalized ? \"Show original\" : \"Show personalized\"\n }\n onClick={(e) => {\n e.stopPropagation();\n config.onTogglePersonalization?.();\n }}\n >\n <ArrowPathIcon />\n <span class=\"toggle-tooltip\">\n {config.isPersonalized ? \"Show original\" : \"Show personalized\"}\n </span>\n </button>\n )}\n\n {config.showKeyboardHints && (\n <div class=\"kbd-hint visible\">\n <div class=\"kbd-group\">\n {shortcutDisplay.map((k, i) => (\n <div class=\"kbd\" key={i}>\n {k}\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n </Fragment>\n );\n};\n\n// -- Main Class Wrapper (API compatible with old version) --\n\nexport class CueCard {\n private host: HTMLElement;\n private shadow: ShadowRoot;\n private config: CueCardConfig;\n private isOpen = false;\n private skipFocus = false;\n private mountTarget: HTMLElement | null = null;\n\n constructor(config: CueCardConfig) {\n this.config = {\n position: \"top-center\",\n direction: \"top-to-bottom\",\n theme: \"glass\",\n entranceDelayMs: 0,\n exitDelayMs: 75,\n hasPersonalization: false,\n isVisible: false,\n progressPct: 0,\n status: \"resting\",\n enableTimer: true,\n timerDurationMs: 20_000,\n enableLauncher: true,\n enableFocusMode: false,\n focusBlurIntensity: \"10px\",\n focusDelayMs: 500,\n showKeyboardHints: false,\n showWatermark: true,\n mountMode: \"overlay\",\n ...config,\n };\n this.mountTarget = config.mountNode ?? null;\n\n this.host = document.createElement(\"div\");\n this.host.id = \"kenobi-cue-card-root\";\n this.applyHostStyles();\n\n this.shadow = this.host.attachShadow({ mode: \"open\" });\n\n // Inject Styles once\n const style = document.createElement(\"style\");\n style.textContent = STYLES;\n this.shadow.appendChild(style);\n\n // Create a mount point inside shadow DOM for Preact\n const mountPoint = document.createElement(\"div\");\n this.shadow.appendChild(mountPoint);\n }\n\n private applyHostStyles() {\n const isInline = this.config.mountMode === \"inline\";\n this.host.classList.toggle(\"kb-inline\", isInline);\n\n // Apply configurable CSS variables to the host\n const focusBlur = this.config.focusBlurIntensity ?? \"10px\";\n\n if (isInline) {\n this.host.style.cssText = `\n position: relative !important;\n z-index: auto !important;\n top: auto !important;\n left: auto !important;\n width: 100% !important;\n height: auto !important;\n pointer-events: auto !important;\n isolation: auto !important;\n display: block !important;\n --kb-focus-blur: ${focusBlur};\n `;\n return;\n }\n\n this.host.style.cssText = `\n position: fixed !important;\n z-index: 2147483647 !important;\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: 0 !important;\n pointer-events: none !important;\n isolation: isolate !important;\n --kb-focus-blur: ${focusBlur};\n `;\n }\n\n public mount(target?: HTMLElement) {\n const resolvedTarget =\n target || this.config.mountNode || this.mountTarget || document.body;\n this.mountTarget = resolvedTarget;\n\n if (!resolvedTarget.contains(this.host)) {\n resolvedTarget.appendChild(this.host);\n }\n\n this.applyHostStyles();\n this.render();\n }\n\n public unmount() {\n // Cleanup Preact tree\n render(null, this.shadow.lastElementChild as HTMLElement);\n this.host.remove();\n }\n\n public update(newState: Partial<CueCardConfig>) {\n // Close form when transitioning to 'starting' status\n if (newState.status === \"starting\" && this.config.status !== \"starting\") {\n this.isOpen = false;\n }\n\n this.config = { ...this.config, ...newState };\n this.applyHostStyles();\n this.render();\n }\n\n public setTheme(theme: CueCardTheme) {\n this.update({ theme });\n }\n\n public openForm(skipFocus?: boolean) {\n this.isOpen = true;\n this.skipFocus = skipFocus ?? false;\n this.render();\n }\n\n private render() {\n // We render the Preact component into the shadow root mount point\n const mountPoint = this.shadow.lastElementChild as HTMLElement;\n const skipFocusOnce = this.skipFocus;\n this.skipFocus = false; // Reset after reading\n\n render(\n <CueCardContent\n config={this.config}\n isOpen={this.isOpen}\n skipFocus={skipFocusOnce}\n setIsOpen={(val) => {\n this.isOpen = val;\n this.config.onOpenChange?.(val);\n this.render(); // Re-render on state change since we are outside the react tree\n }}\n />,\n mountPoint\n );\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,MAAI,yBAAyB;AAE7B,WAAS,WAAW,UAAU,QAAQ;AAClC,QAAI,cAAc,OAAO;AACzB,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AAGJ,QAAI,OAAO,aAAa,0BAA0B,SAAS,aAAa,wBAAwB;AAC9F;AAAA,IACF;AAGA,aAASA,KAAI,YAAY,SAAS,GAAGA,MAAK,GAAGA,MAAK;AAC9C,aAAO,YAAYA,EAAC;AACpB,iBAAW,KAAK;AAChB,yBAAmB,KAAK;AACxB,kBAAY,KAAK;AAEjB,UAAI,kBAAkB;AAClB,mBAAW,KAAK,aAAa;AAC7B,oBAAY,SAAS,eAAe,kBAAkB,QAAQ;AAE9D,YAAI,cAAc,WAAW;AACzB,cAAI,KAAK,WAAW,SAAQ;AACxB,uBAAW,KAAK;AAAA,UACpB;AACA,mBAAS,eAAe,kBAAkB,UAAU,SAAS;AAAA,QACjE;AAAA,MACJ,OAAO;AACH,oBAAY,SAAS,aAAa,QAAQ;AAE1C,YAAI,cAAc,WAAW;AACzB,mBAAS,aAAa,UAAU,SAAS;AAAA,QAC7C;AAAA,MACJ;AAAA,IACJ;AAIA,QAAI,gBAAgB,SAAS;AAE7B,aAASC,KAAI,cAAc,SAAS,GAAGA,MAAK,GAAGA,MAAK;AAChD,aAAO,cAAcA,EAAC;AACt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AAA,MACd,GAFoB;AA/mClB,WAAK,SAAS;AAAA,QACZ,SAAS;AAAA,QACT,OAAO;AAAA,QACP,eAAe;AAAA,QACf,GAAG;AAAA,MACL;AAEA,WAAK,qBAAqB;AAAA,QACxB,KAAK,OAAO;AAAA,MACd;AACA,WAAK,eAAe,IAAI,uBAAuB;AAE/C,WAAK,eAAe;AAEpB,WAAK,cAAc,KAAK,eAAe;AACvC,WAAK,aAAa,KAAK,cAAc;AAErC,UAAI;AACF,aAAK,uBAAuB;AAAA,MAC9B,SAAS,OAAO;AACd,aAAK;AAAA,UACH;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AACA,WAAK,IAAI,SAAS,oBAAoB;AAEtC,UAAI,KAAK,OAAO,eAAe;AAC7B,aAAK,IAAI,SAAS,4CAA4C;AAC9D,aAAK,KAAK,mBAAmB;AAAA,MAC/B;AAGA,UAAI,KAAK,OAAO,aAAa,CAAC,KAAK,OAAO,sBAAsB;AAC9D,aAAK,IAAI,SAAS,sDAAsD;AACxE,aAAK,KAAK,YAAY;AAAA,MACxB;AAAA,IACF;AAAA,EA4kCF;AAtoCa;AAAb,MAAM,SAAN;",
6
- "names": ["i", "d", "morphAttrs", "morphdom", "childrenOnly", "slice", "options", "vnodeId", "isValidElement", "rerenderQueue", "prevDebounce", "defer", "depthSort", "CAPTURE_REGEX", "eventClock", "eventProxy", "eventProxyCapture", "i", "EMPTY_OBJ", "EMPTY_ARR", "IS_NON_DIMENSIONAL", "isArray", "Array", "assign", "obj", "props", "removeNode", "node", "parentNode", "removeChild", "createElement", "type", "children", "key", "ref", "normalizedProps", "arguments", "length", "call", "defaultProps", "createVNode", "original", "vnode", "__k", "__", "__b", "__e", "__c", "constructor", "__v", "__i", "__u", "Fragment", "props", "children", "BaseComponent", "context", "this", "getDomSibling", "vnode", "childIndex", "__", "__i", "sibling", "__k", "length", "__e", "type", "updateParentDomPointers", "i", "child", "__c", "base", "enqueueRender", "c", "__d", "rerenderQueue", "push", "process", "__r", "prevDebounce", "options", "debounceRendering", "defer", "component", "newVNode", "oldVNode", "oldDom", "commitQueue", "refQueue", "l", "sort", "depthSort", "shift", "__v", "__P", "assign", "diff", "__n", "namespaceURI", "__u", "commitRoot", "diffChildren", "parentDom", "renderResult", "newParentVNode", "oldParentVNode", "globalContext", "namespace", "excessDomChildren", "isHydrating", "childVNode", "newDom", "firstChildDom", "result", "shouldPlace", "oldChildren", "EMPTY_ARR", "newChildrenLength", "constructNewChildrenArray", "EMPTY_OBJ", "ref", "applyRef", "insert", "nextSibling", "skewedIndex", "matchingIndex", "oldChildrenLength", "remainingOldChildren", "skew", "Array", "constructor", "String", "createVNode", "isArray", "undefined", "__b", "key", "findMatchingIndex", "unmount", "parentVNode", "parentNode", "insertBefore", "nodeType", "findMatchingIndex", "childVNode", "oldChildren", "skewedIndex", "remainingOldChildren", "x", "y", "childIndex", "key", "type", "oldVNode", "matched", "__u", "length", "setStyle", "style", "value", "setProperty", "IS_NON_DIMENSIONAL", "test", "dom", "name", "oldValue", "namespace", "useCapture", "lowerCaseName", "o", "cssText", "replace", "CAPTURE_REGEX", "toLowerCase", "slice", "l", "_attached", "eventClock", "addEventListener", "eventProxyCapture", "eventProxy", "removeEventListener", "e", "removeAttribute", "setAttribute", "createEventProxy", "this", "eventHandler", "_dispatched", "options", "event", "diff", "parentDom", "newVNode", "globalContext", "excessDomChildren", "commitQueue", "oldDom", "isHydrating", "refQueue", "tmp", "c", "isNew", "oldProps", "oldState", "snapshot", "clearProcessingException", "newProps", "isClassComponent", "provider", "componentContext", "i", "renderHook", "count", "renderResult", "newType", "undefined", "constructor", "__e", "__b", "outer", "props", "prototype", "render", "contextType", "__c", "__", "__E", "BaseComponent", "doRender", "sub", "state", "context", "__n", "__d", "__h", "_sb", "__s", "getDerivedStateFromProps", "assign", "__v", "componentWillMount", "componentDidMount", "push", "componentWillReceiveProps", "shouldComponentUpdate", "__k", "some", "vnode", "componentWillUpdate", "componentDidUpdate", "__P", "__r", "getChildContext", "getSnapshotBeforeUpdate", "Fragment", "cloneNode", "children", "diffChildren", "isArray", "base", "then", "MODE_HYDRATE", "nodeType", "nextSibling", "indexOf", "removeNode", "markAsForce", "diffElementNodes", "diffed", "forEach", "commitRoot", "root", "applyRef", "cb", "call", "node", "map", "newHtml", "oldHtml", "newChildren", "inputValue", "checked", "localName", "document", "createTextNode", "createElementNS", "is", "__m", "data", "childNodes", "EMPTY_OBJ", "attributes", "__html", "innerHTML", "content", "getDomSibling", "ref", "hasRefUnmount", "current", "unmount", "parentVNode", "skipRemove", "r", "componentWillUnmount", "replaceNode", "documentElement", "createElement", "namespaceURI", "firstChild", "slice", "EMPTY_ARR", "options", "__e", "error", "vnode", "oldVNode", "errorInfo", "component", "ctor", "handled", "__", "__c", "constructor", "getDerivedStateFromError", "setState", "__d", "componentDidCatch", "__E", "e", "vnodeId", "isValidElement", "undefined", "BaseComponent", "prototype", "update", "callback", "s", "this", "__s", "state", "assign", "props", "__v", "_sb", "push", "enqueueRender", "forceUpdate", "__h", "render", "Fragment", "rerenderQueue", "defer", "Promise", "then", "bind", "resolve", "setTimeout", "depthSort", "a", "b", "__b", "process", "__r", "CAPTURE_REGEX", "eventClock", "eventProxy", "createEventProxy", "eventProxyCapture", "i", "currentIndex", "currentComponent", "previousComponent", "prevRaf", "currentHook", "afterPaintEffects", "options", "_options", "oldBeforeDiff", "__b", "oldBeforeRender", "__r", "oldAfterDiff", "diffed", "oldCommit", "__c", "oldBeforeUnmount", "unmount", "oldRoot", "__", "getHookState", "index", "type", "__h", "hooks", "__H", "length", "push", "useState", "initialState", "useReducer", "invokeOrReturn", "reducer", "init", "hookState", "_reducer", "action", "currentValue", "__N", "nextValue", "setState", "__f", "updateHookState", "p", "s", "c", "stateHooks", "filter", "x", "every", "prevScu", "call", "this", "shouldUpdate", "props", "forEach", "hookItem", "shouldComponentUpdate", "prevCWU", "componentWillUpdate", "__e", "tmp", "useEffect", "callback", "args", "state", "__s", "argsChanged", "_pendingArgs", "useRef", "initialValue", "currentHook", "useMemo", "current", "useMemo", "factory", "args", "state", "getHookState", "currentIndex", "argsChanged", "__H", "__", "__h", "useCallback", "callback", "currentHook", "flushAfterPaintEffects", "component", "afterPaintEffects", "shift", "__P", "__H", "__h", "forEach", "invokeCleanup", "invokeEffect", "e", "options", "__e", "__v", "__b", "vnode", "currentComponent", "oldBeforeDiff", "__", "parentDom", "__k", "__m", "oldRoot", "__r", "oldBeforeRender", "currentIndex", "hooks", "__c", "previousComponent", "hookItem", "__N", "_pendingArgs", "diffed", "oldAfterDiff", "c", "length", "push", "prevRaf", "requestAnimationFrame", "afterNextFrame", "commitQueue", "some", "filter", "cb", "oldCommit", "unmount", "oldBeforeUnmount", "hasErrored", "s", "HAS_RAF", "callback", "raf", "done", "clearTimeout", "timeout", "cancelAnimationFrame", "setTimeout", "hook", "comp", "cleanup", "argsChanged", "oldArgs", "newArgs", "arg", "index", "invokeOrReturn", "f", "vnodeId", "createVNode", "type", "props", "key", "isStaticChildren", "__source", "__self", "ref", "i", "normalizedProps", "vnode", "__k", "__", "__b", "__e", "__c", "constructor", "__v", "vnodeId", "__i", "__u", "defaultProps", "options", "u", "A", "y", "d", "q", "e", "s", "f", "k", "i", "exitAnim", "a", "isBackgroundClippedToText", "fragment", "delay", "s", "r", "c", "e", "t", "_"]
4
+ "sourcesContent": ["/* eslint-disable no-console */\nimport morphdom from \"morphdom\";\n\nimport { CueCard } from \"./cue-card\";\nexport * from \"./cue-card\";\n\ndeclare global {\n interface Window {\n __kenobiIdentityResolution?: unknown;\n }\n}\n\nconst VISITOR_QUERY_PARAM_KEY = \"kfor\";\nconst VISITOR_SESSION_STORAGE_KEY = \"kenobi_visitor_key\";\nconst TRANSFORMATION_DATA_ATTR_KEY = \"data-kenobi-transformation-identifier\";\n\ntype AnimationSplitTarget = \"line\" | \"word\" | \"character\";\n\nexport type AnimationName = string;\n\nexport type Easing = string;\n\n// Configurable overflow behavior for transition wrapper to prevent text clipping (e.g., gradient text descenders)\nexport type TransitionOverflow = \"hidden\" | \"visible\" | \"clip\";\n\nexport type KeyframeDefinition = Keyframe | Keyframe[];\nexport interface TextAnimationConfig {\n by: AnimationSplitTarget;\n delayMs?: number;\n staggerMs?: number;\n animationName?: AnimationName;\n keyframes?: KeyframeDefinition;\n durationMs?: number;\n}\n\nexport interface AnimationSettings {\n animationName?: AnimationName;\n keyframes?: KeyframeDefinition;\n durationMs?: number;\n delayMs?: number;\n}\n\nexport interface TransitionConfig {\n enabled?: boolean;\n /** The master duration for symmetrical transitions. */\n durationMs?: number;\n /** The master delay for symmetrical transitions. */\n delayMs?: number;\n easing?: Easing;\n animateSize?: boolean;\n /** Controls wrapper overflow to prevent clipping of text with descenders or gradient effects */\n overflow?: TransitionOverflow;\n textAnimation?: TextAnimationConfig;\n enter?: AnimationSettings;\n exit?: AnimationSettings;\n}\n\ntype NormalizedTransitionConfig = Required<\n Pick<\n TransitionConfig,\n \"enabled\" | \"durationMs\" | \"delayMs\" | \"easing\" | \"animateSize\" | \"overflow\"\n >\n> &\n TransitionConfig;\n\ntype AnimatableElement = HTMLElement | SVGElement;\n\nconst DEFAULT_TRANSITION_CONFIG: NormalizedTransitionConfig = {\n enabled: false,\n durationMs: 300,\n delayMs: 0,\n easing: \"ease\",\n animateSize: true,\n overflow: \"hidden\", // Default to hidden for clean size animations; use \"visible\" for gradient text\n};\n\nconst createNormalizedTransitionConfig = (\n config?: TransitionConfig\n): NormalizedTransitionConfig => ({\n enabled: config?.enabled ?? DEFAULT_TRANSITION_CONFIG.enabled,\n durationMs: config?.durationMs ?? DEFAULT_TRANSITION_CONFIG.durationMs,\n delayMs: config?.delayMs ?? DEFAULT_TRANSITION_CONFIG.delayMs,\n easing: config?.easing ?? DEFAULT_TRANSITION_CONFIG.easing,\n animateSize: config?.animateSize ?? DEFAULT_TRANSITION_CONFIG.animateSize,\n overflow: config?.overflow ?? DEFAULT_TRANSITION_CONFIG.overflow,\n textAnimation: config?.textAnimation,\n enter: config?.enter,\n exit: config?.exit,\n});\n\nconst mergeTransitionConfig = (\n base: NormalizedTransitionConfig,\n override?: TransitionConfig\n): NormalizedTransitionConfig => ({\n enabled: override?.enabled ?? base.enabled,\n durationMs: override?.durationMs ?? base.durationMs,\n delayMs: override?.delayMs ?? base.delayMs,\n easing: override?.easing ?? base.easing,\n animateSize: override?.animateSize ?? base.animateSize,\n overflow: override?.overflow ?? base.overflow,\n textAnimation: override?.textAnimation ?? base.textAnimation,\n enter: override?.enter ?? base.enter,\n exit: override?.exit ?? base.exit,\n});\n\nconst isAnimationName = (value: unknown): value is AnimationName =>\n typeof value === \"string\";\n\nconst isAnimatableElement = (\n element: Element\n): element is AnimatableElement => {\n if (element instanceof HTMLElement) return true;\n if (typeof SVGElement !== \"undefined\" && element instanceof SVGElement)\n return true;\n return false;\n};\n\nconst isEasing = (value: unknown): value is Easing => typeof value === \"string\";\n\n// Type guard for overflow config values (allows preventing text clipping in transitions)\nconst isTransitionOverflow = (value: unknown): value is TransitionOverflow =>\n value === \"hidden\" || value === \"visible\" || value === \"clip\";\n\nconst isAnimationSplitTarget = (\n value: unknown\n): value is AnimationSplitTarget =>\n value === \"line\" || value === \"word\" || value === \"character\";\n\nconst isKeyframeDefinition = (value: unknown): value is KeyframeDefinition => {\n if (typeof value !== \"object\" || value === null) return false;\n if (Array.isArray(value)) {\n return value.every((item) => typeof item === \"object\" && item !== null);\n }\n return true;\n};\n\nconst isAnimationSettings = (value: unknown): value is AnimationSettings => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n const { animationName, keyframes, durationMs, delayMs } = candidate;\n return (\n (animationName === undefined || isAnimationName(animationName)) &&\n (keyframes === undefined || isKeyframeDefinition(keyframes)) &&\n (durationMs === undefined || typeof durationMs === \"number\") &&\n (delayMs === undefined || typeof delayMs === \"number\")\n );\n};\n\nconst isTextAnimationConfig = (\n value: unknown\n): value is TextAnimationConfig => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n const { by, staggerMs, animationName, keyframes, delayMs, durationMs } =\n candidate;\n return (\n isAnimationSplitTarget(by) &&\n (delayMs === undefined || typeof delayMs === \"number\") &&\n (staggerMs === undefined || typeof staggerMs === \"number\") &&\n (durationMs === undefined || typeof durationMs === \"number\") &&\n (isAnimationName(animationName) || keyframes !== undefined) &&\n (keyframes === undefined || isKeyframeDefinition(keyframes))\n );\n};\n\nconst isTransitionConfig = (value: unknown): value is TransitionConfig => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n const {\n enabled,\n durationMs,\n delayMs,\n easing,\n animateSize,\n overflow,\n textAnimation,\n enter,\n exit,\n } = candidate;\n return (\n (enabled === undefined || typeof enabled === \"boolean\") &&\n (durationMs === undefined || typeof durationMs === \"number\") &&\n (delayMs === undefined || typeof delayMs === \"number\") &&\n (easing === undefined || isEasing(easing)) &&\n (animateSize === undefined || typeof animateSize === \"boolean\") &&\n (overflow === undefined || isTransitionOverflow(overflow)) &&\n (textAnimation === undefined || isTextAnimationConfig(textAnimation)) &&\n (enter === undefined || isAnimationSettings(enter)) &&\n (exit === undefined || isAnimationSettings(exit))\n );\n};\n\n/**\n * Manages and executes complex visual transitions for DOM elements.\n *\n * This class provides methods to smoothly replace elements, handle enter/exit\n * animations, and orchestrate staggered text animations, using the Web\n * Animations API (WAAPI). It is designed to handle dynamic content changes\n * gracefully, including changes in element size.\n */\nclass TransitionOrchestrator {\n /**\n * Replaces an existing element with a new one, applying coordinated enter,\n * exit, and size animations.\n *\n * The process involves creating a temporary wrapper to contain the animations,\n * measuring the new element's dimensions without causing layout shifts, and\n * then running all animations in parallel. Once complete, the wrapper is\n * replaced by the new element.\n *\n * @param oldElement The original element to be replaced.\n * @param newMarkup The HTML string for the new element.\n * @param config The transition configuration object.\n * @returns A promise that resolves with the new element after the transition completes.\n */\n public replaceWithTransition = async (\n oldElement: AnimatableElement,\n newMarkup: string,\n config: NormalizedTransitionConfig\n ): Promise<Element> => {\n //\n // SETUP\n //\n // The core challenge is to animate smoothly from the old element's state to\n // the new one, including size. To do this, we create a temporary `wrapper`\n // element that will contain both the exiting and entering elements, and\n // animate its dimensions from the old size to the new size.\n\n // 1. Create a wrapper and a clone of the old element.\n const wrapper = document.createElement(\"div\");\n wrapper.style.position = \"relative\";\n // Use configurable overflow (default \"hidden\") - set to \"visible\" to prevent gradient text clipping\n wrapper.style.overflow = config.overflow;\n\n const oldRect = oldElement.getBoundingClientRect();\n const oldStyle = window.getComputedStyle(oldElement);\n // `getBoundingClientRect` includes padding and border in width/height, so\n // we only need to copy the margin separately as it's not included.\n wrapper.style.display = oldStyle.display;\n wrapper.style.verticalAlign = oldStyle.verticalAlign;\n wrapper.style.width = `${oldRect.width}px`;\n wrapper.style.height = `${oldRect.height}px`;\n wrapper.style.margin = oldStyle.margin;\n\n const oldElClone = oldElement.cloneNode(true);\n\n // This check is necessary because `cloneNode` returns a generic Node.\n if (!(oldElClone instanceof Element) || !isAnimatableElement(oldElClone)) {\n throw new Error(\"oldElClone is not an AnimatableElement\");\n }\n\n // Position the clone absolutely within the wrapper to allow the new\n // element to be positioned on top of it.\n oldElClone.style.position = \"absolute\";\n oldElClone.style.top = \"0\";\n oldElClone.style.left = \"0\";\n oldElClone.style.width = \"100%\";\n oldElClone.style.height = \"100%\";\n oldElClone.style.margin = \"0\";\n oldElClone.style.pointerEvents = \"none\";\n wrapper.appendChild(oldElClone);\n\n // 2. Create the new element from the provided markup.\n const tempContainer = document.createElement(\"div\");\n tempContainer.innerHTML = newMarkup;\n const newElement = tempContainer.firstElementChild;\n if (\n !newElement ||\n !(newElement instanceof HTMLElement || newElement instanceof SVGElement)\n ) {\n // Fallback: if markup is empty or invalid, just animate the old element out.\n const exitAnim = this.exit(oldElement, config);\n await exitAnim.finished;\n return oldElement;\n }\n\n const originalStyle = newElement.style.cssText;\n\n // We must move text animation to after the element is in the DOM for an\n // accurate style computation, which is critical for gradient text.\n // if (config.textAnimation) {\n // this.applyTextAnimationToNode(newElement, config.textAnimation, config)\n // }\n\n //\n // MEASUREMENT\n //\n // To avoid the \"overshoot and snap\" problem, we must measure the new\n // element in a context that perfectly replicates its final position in the\n // DOM. Simply appending it to the body is not enough, as it won't inherit\n // the correct styles (e.g., flex, grid) from its parent.\n\n // 3. Perform a high-fidelity, contextual off-screen measurement.\n const parent = oldElement.parentNode;\n let newRect: DOMRect;\n\n // We create a clone of the parent element to ensure that the new element is\n // measured in a context that is identical to its final destination. This is\n // crucial for accurate dimensions, especially in flexbox or grid layouts.\n if (parent instanceof HTMLElement) {\n // Create a shallow clone of the parent; we don't need its children.\n const parentClone = parent.cloneNode(false) as HTMLElement;\n const parentStyles = window.getComputedStyle(parent);\n // Copy all computed styles from the original parent to the clone. This\n // is the key to an accurate measurement. A fallback is included for\n // Firefox, which does not support `cssText` on `CSSStyleDeclaration`.\n const cssText = parentStyles.cssText\n ? parentStyles.cssText\n : Array.from(parentStyles).reduce(\n (str, prop) =>\n `${str}${prop}:${parentStyles.getPropertyValue(prop)};`,\n \"\"\n );\n\n parentClone.style.cssText = cssText;\n // Position the clone off-screen to avoid affecting the layout.\n parentClone.style.position = \"absolute\";\n parentClone.style.top = \"-9999px\";\n parentClone.style.left = \"-9999px\";\n parentClone.style.visibility = \"hidden\";\n parentClone.style.pointerEvents = \"none\";\n\n parentClone.appendChild(newElement);\n document.body.appendChild(parentClone);\n\n // Text animations can affect element dimensions, so they must be applied\n // before we take the final measurement.\n if (config.textAnimation) {\n this.applyTextAnimationToNode(newElement, config.textAnimation, config);\n }\n\n newRect = newElement.getBoundingClientRect();\n document.body.removeChild(parentClone);\n } else {\n // Fallback to a less accurate method if the parent is not an HTMLElement.\n // This is a safety measure for edge cases where the parent might be a\n // DocumentFragment or another non-element node.\n const offscreenContainer = document.createElement(\"div\");\n offscreenContainer.style.position = \"absolute\";\n offscreenContainer.style.top = \"-9999px\";\n offscreenContainer.style.left = \"-9999px\";\n offscreenContainer.style.visibility = \"hidden\";\n\n offscreenContainer.appendChild(newElement);\n document.body.appendChild(offscreenContainer);\n\n if (config.textAnimation) {\n this.applyTextAnimationToNode(newElement, config.textAnimation, config);\n }\n\n newRect = newElement.getBoundingClientRect();\n document.body.removeChild(offscreenContainer);\n }\n\n //\n // ANIMATION\n //\n // With accurate measurements, we can now set up the final state and run the\n // animations for the exit, enter, and size transitions in parallel.\n\n // 4. Setup the new element for its entrance animation.\n newElement.style.cssText = originalStyle; // Restore original styles\n newElement.style.visibility = \"\";\n newElement.style.position = \"absolute\";\n newElement.style.top = \"0\";\n newElement.style.left = \"0\";\n newElement.style.width = `${newRect.width}px`;\n newElement.style.height = `${newRect.height}px`;\n newElement.style.margin = \"0\";\n newElement.style.opacity = \"0\"; // Start transparent for entry animation\n\n wrapper.appendChild(newElement);\n\n // Replace the original element with the wrapper in the DOM.\n oldElement.replaceWith(wrapper);\n\n // 5. Animate with the Web Animations API (WAAPI).\n const exitDelay = config.exit?.delayMs ?? config.delayMs;\n const exitDuration = config.exit?.durationMs ?? config.durationMs;\n const enterDelay = config.enter?.delayMs ?? config.delayMs;\n const enterDuration = config.enter?.durationMs ?? config.durationMs;\n\n const animations: Animation[] = [];\n\n // Exit animation\n const exitKeyframes = this.resolveKeyframes(config.exit?.keyframes);\n const exitAnim = oldElClone.animate(exitKeyframes, {\n duration: exitDuration,\n delay: exitDelay,\n easing: config.easing,\n fill: \"forwards\",\n });\n animations.push(exitAnim);\n\n // Enter animation\n const enterKeyframes = this.resolveKeyframes(config.enter?.keyframes);\n const enterAnim = newElement.animate(enterKeyframes, {\n duration: enterDuration,\n delay: enterDelay,\n easing: config.easing,\n fill: \"forwards\",\n });\n animations.push(enterAnim);\n\n // Size animation\n if (config.animateSize) {\n const sizeAnim = wrapper.animate(\n [\n { width: `${oldRect.width}px`, height: `${oldRect.height}px` },\n { width: `${newRect.width}px`, height: `${newRect.height}px` },\n ],\n {\n duration: enterDuration, // Match the enter animation\n delay: enterDelay,\n easing: config.easing,\n fill: \"forwards\",\n }\n );\n animations.push(sizeAnim);\n }\n\n // 6. Wait for all animations to finish.\n await Promise.all(animations.map((a) => a.finished));\n\n //\n // CLEANUP\n //\n // Once animations are complete, we replace the wrapper with the new element\n // and restore its original styles, leaving the DOM in a clean state.\n\n // 7. Cleanup and final DOM replacement.\n if (wrapper.parentNode) {\n wrapper.replaceWith(newElement);\n }\n newElement.style.cssText = originalStyle; // Restore original styles\n oldElClone.remove();\n\n return newElement;\n };\n\n /**\n * Triggers an enter animation on a given element.\n * @param element The element to animate.\n * @param config The transition configuration.\n * @returns The Animation object for the enter transition.\n */\n public enter = (\n element: AnimatableElement,\n config: NormalizedTransitionConfig\n ): Animation => {\n const enterDelay = config.enter?.delayMs ?? config.delayMs;\n const enterDuration = config.enter?.durationMs ?? config.durationMs;\n\n const keyframes = this.resolveKeyframes(config.enter?.keyframes);\n return element.animate(keyframes, {\n duration: enterDuration,\n delay: enterDelay,\n easing: config.easing,\n fill: \"forwards\",\n });\n };\n\n /**\n * Triggers an exit animation on a given element.\n * @param element The element to animate.\n * @param config The transition configuration.\n * @returns The Animation object for the exit transition.\n */\n public exit = (\n element: AnimatableElement,\n config: NormalizedTransitionConfig\n ): Animation => {\n const exitDelay = config.exit?.delayMs ?? config.delayMs;\n const exitDuration = config.exit?.durationMs ?? config.durationMs;\n\n const keyframes = this.resolveKeyframes(config.exit?.keyframes);\n return element.animate(keyframes, {\n duration: exitDuration,\n delay: exitDelay,\n easing: config.easing,\n fill: \"forwards\",\n });\n };\n\n /**\n * Resolves the keyframes to be used for an animation, prioritizing custom\n * definitions over presets.\n * @param definition An optional custom keyframe definition.\n * @returns An array of keyframes for use with WAAPI.\n */\n private resolveKeyframes = (definition?: KeyframeDefinition): Keyframe[] => {\n if (definition) {\n return Array.isArray(definition) ? definition : [definition];\n }\n return [];\n };\n\n /**\n * Traverses a DOM node to find text nodes and applies a staggered animation\n * to them by splitting the text into lines, words, or characters.\n *\n * Each segment is wrapped in a `<span>` and animated individually to create\n * a \"typewriter\" or \"reveal\" effect.\n *\n * @param element The root element to traverse for text nodes.\n * @param config The text animation configuration.\n * @param transitionConfig The parent transition configuration for timing.\n */\n private applyTextAnimationToNode = (\n element: Element,\n config: TextAnimationConfig,\n transitionConfig: NormalizedTransitionConfig\n ) => {\n const initialDelay = config.delayMs ?? 0;\n const computedStyle = window.getComputedStyle(element);\n const isBackgroundClippedToText =\n computedStyle.getPropertyValue(\"background-clip\") === \"text\" ||\n computedStyle.getPropertyValue(\"-webkit-background-clip\") === \"text\";\n\n // This recursive function will traverse the DOM, keeping track of the animation delay.\n const traverseAndAnimate = (\n node: Node,\n currentDelay: number,\n isBackgroundClippedToText: boolean\n ): number => {\n // If it's a text node, split and animate it.\n if (node.nodeType === Node.TEXT_NODE) {\n const text = node.textContent ?? \"\";\n if (text.trim().length === 0) {\n return currentDelay; // Don't animate whitespace-only nodes\n }\n\n // ------------\n // Special handling for character animation to prevent breaking words\n // ------------\n if (config.by === \"character\") {\n const words = text.split(/(\\s+)/);\n const fragment = document.createDocumentFragment();\n let delay = currentDelay;\n\n words.forEach((word) => {\n if (word.length === 0) return;\n\n // Preserve whitespace as plain text nodes\n if (word.trim().length === 0) {\n fragment.appendChild(document.createTextNode(word));\n return;\n }\n\n // Wrap words in a span that prevents line breaks inside the word\n const wordWrapper = document.createElement(\"span\");\n wordWrapper.style.display = \"inline-block\";\n wordWrapper.style.whiteSpace = \"nowrap\";\n\n if (isBackgroundClippedToText) {\n // Ensure the wrapper propagates background properties\n wordWrapper.style.setProperty(\"background\", \"inherit\");\n wordWrapper.style.setProperty(\"-webkit-background-clip\", \"text\");\n wordWrapper.style.setProperty(\"background-clip\", \"text\");\n wordWrapper.style.setProperty(\"color\", \"transparent\");\n }\n\n const chars = word.split(\"\");\n chars.forEach((char) => {\n const span = document.createElement(\"span\");\n span.textContent = char;\n span.style.display = \"inline-block\";\n span.style.opacity = \"0\";\n\n if (isBackgroundClippedToText) {\n span.style.setProperty(\"background\", \"inherit\");\n span.style.setProperty(\"-webkit-background-clip\", \"text\");\n span.style.setProperty(\"background-clip\", \"text\");\n span.style.setProperty(\"color\", \"transparent\");\n\n // Add padding to prevent clipping of descenders/gradients\n span.style.paddingBottom = \"0.1em\";\n span.style.marginBottom = \"-0.1em\";\n\n // Remove will-change if it's causing layer clipping issues\n // span.style.setProperty(\"will-change\", \"opacity, transform\");\n }\n\n const keyframes = this.resolveKeyframes(config.keyframes);\n const duration =\n config.durationMs ?? transitionConfig.durationMs ?? 300;\n const easing = transitionConfig.easing ?? \"ease\";\n\n const animation = span.animate(keyframes, {\n duration,\n easing,\n delay,\n fill: \"forwards\",\n });\n\n animation.addEventListener(\"finish\", () => {\n animation.commitStyles();\n animation.cancel();\n });\n\n wordWrapper.appendChild(span);\n delay += config.staggerMs ?? 50;\n });\n\n fragment.appendChild(wordWrapper);\n });\n\n node.parentNode?.replaceChild(fragment, node);\n return delay;\n }\n\n let segments: string[];\n switch (config.by) {\n case \"word\":\n segments = text.split(/(\\s+)/); // Preserve spaces as segments\n break;\n case \"line\":\n segments = text.split(\"\\n\");\n break;\n default:\n segments = text.split(\"\"); // Fallback (shouldn't happen with types)\n }\n\n const fragment = document.createDocumentFragment();\n let delay = currentDelay;\n\n segments.forEach((segment) => {\n if (segment.length === 0) return;\n const isWhitespace = segment.trim().length === 0;\n\n // Preserve whitespace as plain text nodes\n if (isWhitespace) {\n fragment.appendChild(document.createTextNode(segment));\n return;\n }\n\n const span = document.createElement(\"span\");\n span.textContent = segment;\n span.style.display = \"inline-block\";\n span.style.opacity = \"0\";\n\n if (isBackgroundClippedToText) {\n span.style.setProperty(\"background\", \"inherit\");\n span.style.setProperty(\"-webkit-background-clip\", \"text\");\n span.style.setProperty(\"background-clip\", \"text\");\n span.style.setProperty(\"color\", \"transparent\");\n span.style.setProperty(\"will-change\", \"opacity, transform\");\n }\n\n const keyframes = this.resolveKeyframes(config.keyframes);\n const duration =\n config.durationMs ?? transitionConfig.durationMs ?? 300;\n const easing = transitionConfig.easing ?? \"ease\";\n\n const animation = span.animate(keyframes, {\n duration,\n easing,\n delay,\n fill: \"forwards\",\n });\n\n animation.addEventListener(\"finish\", () => {\n animation.commitStyles();\n animation.cancel();\n });\n\n fragment.appendChild(span);\n delay += config.staggerMs ?? 50;\n });\n\n node.parentNode?.replaceChild(fragment, node);\n return delay; // Return the updated delay\n }\n\n // If it's an element node, traverse its children.\n if (node.nodeType === Node.ELEMENT_NODE) {\n let delay = currentDelay;\n // We must work with a static copy of child nodes, as the collection will be modified.\n const children = Array.from(node.childNodes);\n for (const child of children) {\n delay = traverseAndAnimate(child, delay, isBackgroundClippedToText);\n }\n return delay; // Return the final delay after traversing all children\n }\n\n // For any other node type, just continue with the same delay.\n return currentDelay;\n };\n\n // Start the traversal from the root element.\n traverseAndAnimate(element, initialDelay, isBackgroundClippedToText);\n };\n}\n\n/**\n * Response from the cue-card-config API endpoint.\n * Used to determine if a CueCard should be mounted and with what config.\n */\ninterface CueCardConfigResponse {\n enabled: boolean;\n config?: {\n theme?: \"glass\" | \"light\" | \"dark\";\n position?: \"top-center\" | \"top-right\";\n direction?: \"top-to-bottom\" | \"right-to-left\";\n fields: Array<{\n name: string;\n label: string;\n placeholder?: string;\n type?: \"text\" | \"email\" | \"tel\" | \"url\";\n required?: boolean;\n pattern?: string;\n minLength?: number;\n maxLength?: number;\n errorMessage?: string;\n }>;\n enableFocusMode?: boolean;\n showWatermark?: boolean;\n showKeyboardHints?: boolean;\n enableLauncher?: boolean;\n customTheme?: {\n fontFamily?: string;\n backgroundColor?: string;\n borderColor?: string;\n textColor?: string;\n subtitleColor?: string;\n primaryColor?: string;\n primaryTextColor?: string;\n borderRadius?: string;\n };\n textOverrides?: {\n titleResting?: string;\n titleSuccess?: string;\n titleError?: string;\n subtitleResting?: string;\n subtitleSuccess?: string;\n subtitleError?: string;\n btnResting?: string;\n btnSuccess?: string;\n btnLoading?: string;\n btnError?: string;\n launcherLabel?: string;\n launcherLabelSuccess?: string;\n launcherLabelDeanonymized?: string;\n launcherLabelDeanonymizedSuccess?: string;\n };\n enableUndoToggle?: boolean;\n deanonymization?: {\n provider: \"Kenobi\";\n timeoutMs?: number;\n logoUrlTemplate?: string;\n snitcher?: {\n spotterToken: string;\n profileId: string;\n apiEndpoint?: string;\n cdn?: string;\n namespace?: string;\n };\n };\n };\n}\n\ntype IdentityResolutionDetail = {\n type?: \"business\" | \"isp\" | \"unknown\";\n domain?: string | null;\n company?: {\n name?: string;\n domain?: string;\n };\n};\n\ntype PersonalizationApiResult = {\n transformations?: Transformation[];\n metadata?: Record<string, unknown>;\n};\n\ntype PersonalizationPredictionSource = \"deanonymized\";\n\ntype PreparedPersonalization = {\n input: Record<string, string>;\n result: PersonalizationApiResult;\n source?: PersonalizationPredictionSource;\n};\n\ntype PersonalizationRequestOptions = {\n notifySlack?: boolean;\n notifyOnly?: boolean;\n predictionSource?: PersonalizationPredictionSource;\n prefetchedTransformations?: Transformation[];\n prefetchedMetadata?: Record<string, unknown>;\n};\n\nconst IDENTITY_RESOLVED_EVENT = \"kenobi:identity-resolved\";\nconst DEFAULT_DEANON_TIMEOUT_MS = 1600;\n\nconst isCueCardConfigResponse = (\n value: unknown\n): value is CueCardConfigResponse => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n return typeof candidate.enabled === \"boolean\";\n};\n\n/**\n * Configuration options for the Kenobi instance.\n *\n * When `publicKey` is provided, Kenobi automatically:\n * 1. Mounts a CueCard UI for visitor input\n * 2. Handles form submission\n * 3. Calls the personalization API\n * 4. Applies transformations to the page\n *\n * Future: CueCard config will be fetched per-org from the database.\n * For now, default config matching the template editor is used.\n */\ninterface KenobiConfig {\n /**\n * Your Kenobi public key (pk_live_xxx or pk_test_xxx).\n * When provided, a CueCard is automatically mounted and the\n * personalization flow is handled end-to-end.\n */\n publicKey?: string;\n apiHost?: string;\n siteVersionId?: string;\n debug?: boolean;\n autoTransform?: boolean;\n transitionDefaults?: TransitionConfig;\n /**\n * When true, skips automatic CueCard mounting even when publicKey is set.\n * Use this when you want to manage the CueCard externally but still use\n * the SDK's personalize() method.\n */\n skipCueCardAutoMount?: boolean;\n}\n\ninterface ApplyTransformationsOpts {\n shouldConsolidate?: boolean;\n}\n\ninterface UndoOperationBase {\n type: \"Remove\" | \"Replace\" | \"SetInput\";\n ref: Element;\n}\n\ninterface UndoOperationRemove extends UndoOperationBase {\n type: \"Remove\";\n}\n\ninterface UndoOperationReplace extends UndoOperationBase {\n type: \"Replace\";\n content: string;\n}\n\ninterface UndoInputElementSet extends UndoOperationBase {\n type: \"SetInput\";\n content: string;\n}\n\ntype UndoOperation =\n | UndoOperationRemove\n | UndoOperationReplace\n | UndoInputElementSet;\n\ninterface ChangeStackEntry {\n undoOpts: UndoOperation;\n}\n\nexport type TransformationAction =\n | \"Replace\"\n | \"InsertBefore\"\n | \"InsertAfter\"\n | \"Delete\"\n | \"SetFormField\";\n\nexport interface Transformation {\n identifier: string;\n markup: string;\n selectorGuesses: string[];\n action: TransformationAction;\n transition?: TransitionConfig;\n}\n\nexport interface PersonalizeApiResponse {\n transformations?: Transformation[];\n metadata?: Record<string, unknown>;\n}\n\nexport const TRANSFORMATION_ACTIONS: ReadonlySet<TransformationAction> =\n new Set([\"Replace\", \"InsertBefore\", \"InsertAfter\", \"Delete\", \"SetFormField\"]);\n\nconst isString = (value: unknown): value is string => typeof value === \"string\";\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => isString(item));\n\nconst isTransformationAction = (\n value: unknown\n): value is TransformationAction =>\n typeof value === \"string\" &&\n TRANSFORMATION_ACTIONS.has(value as TransformationAction);\n\nconst isTransformation = (value: unknown): value is Transformation => {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as Record<string, unknown>;\n return (\n isString(candidate.identifier) &&\n typeof candidate.markup === \"string\" &&\n isStringArray(candidate.selectorGuesses) &&\n isTransformationAction(candidate.action) &&\n (candidate.transition === undefined ||\n isTransitionConfig(candidate.transition))\n );\n};\n\nconst parseTransformationsResponse = (payload: unknown): Transformation[] => {\n if (typeof payload !== \"object\" || payload === null) {\n throw new Error(\"Invalid response: expected object with data array\");\n }\n\n const data = (payload as Record<string, unknown>).data;\n if (!Array.isArray(data)) {\n throw new Error(\"Invalid response: data must be an array\");\n }\n\n data.forEach((item, index) => {\n if (!isTransformation(item)) {\n throw new Error(`Invalid transformation at index ${index}`);\n }\n });\n\n return data;\n};\n\nclass Kenobi {\n private config: KenobiConfig;\n private changeStack: Map<string, ChangeStackEntry> = new Map<\n string,\n ChangeStackEntry\n >();\n private visitorKey: string | null = null;\n private orchestrator: TransitionOrchestrator;\n private cueCardInstance: CueCard | null = null;\n private preparedPersonalization: PreparedPersonalization | null = null;\n private isPreparingPersonalization = false;\n private preparePersonalizationPromise: Promise<PersonalizationApiResult | null> | null =\n null;\n private deanonymizationPrefetchCleanup: (() => void) | null = null;\n //\n private currentPath: string;\n private currentUrl: string;\n private navTicking = false;\n private transitionDefaults: NormalizedTransitionConfig;\n\n // Undo toggle state\n private lastAppliedTransformations: Transformation[] = [];\n public isPersonalized = false;\n\n constructor(config?: KenobiConfig) {\n this.config = {\n apiHost: \"https://kenobi.ai/api\",\n debug: false,\n autoTransform: true,\n ...config,\n };\n\n this.transitionDefaults = createNormalizedTransitionConfig(\n this.config.transitionDefaults\n );\n this.orchestrator = new TransitionOrchestrator();\n\n this.syncVisitorKey();\n\n this.currentPath = this.getCurrentPath();\n this.currentUrl = this.getCurrentUrl();\n\n try {\n this.initNavigationListener();\n } catch (error) {\n this.log(\n \"error\",\n \"Failed to initialize navigation listener with error:\",\n error\n );\n }\n this.log(\"debug\", \"Kenobi initialized\");\n\n if (this.config.autoTransform) {\n this.log(\"debug\", \"Auto-transform is requested... Starting...\");\n void this.startAutoTransform();\n }\n\n // Auto-mount CueCard when publicKey is provided (unless skipCueCardAutoMount is set)\n if (this.config.publicKey && !this.config.skipCueCardAutoMount) {\n this.log(\"debug\", \"Public key provided, checking for active template...\");\n void this.initCueCard();\n }\n }\n\n private startAutoTransform = async () => {\n try {\n this.syncChangeStack();\n\n // All the waits!\n await this.waitForLoaded();\n\n if (this.isFramer()) {\n await this.waitForFrames();\n await this.waitForIdle();\n await this.waitForQuietDom(100, 1_000);\n }\n\n // Go go go!\n await this.transform();\n } catch (error) {\n this.log(\"error\", \"Auto-transformation flow failed with error:\", error);\n }\n };\n\n public transform = async () => {\n try {\n const startTime = new Date();\n this.log(\"debug\", \"Starting transform\");\n\n if (this.visitorKey === null) {\n this.log(\n \"debug\",\n `Couldn't find a visitor copy external ID with query param key \"${VISITOR_QUERY_PARAM_KEY}\"`,\n \"Exiting...\"\n );\n return;\n }\n\n let transformations: Transformation[] = [];\n\n try {\n transformations = await this.getTransformations(\n this.currentPath,\n this.visitorKey\n );\n } catch (error) {\n this.log(\n \"error_detailed\",\n \"An error occurred _getting_ transformations\",\n error\n );\n }\n\n try {\n await this.applyTransformations(transformations);\n } catch (error) {\n this.log(\n \"error_detailed\",\n \"An error occurred _applying_ transformations\",\n error\n );\n }\n\n // END!\n const endTime = new Date();\n const fnDuration = this.getDurationInMilliseconds(startTime, endTime);\n this.log(\n \"debug\",\n `Transformation complete, took ${this.formatThousands(fnDuration)} ms`\n );\n } catch (error) {\n this.log(\n \"error\",\n \"An unexpected, top-level error occurred during transformation\",\n error\n );\n }\n };\n\n /*\n ----\n -- UTILITIES\n ----\n */\n private log = (\n level: \"debug\" | \"info\" | \"warn\" | \"error\" | \"error_detailed\",\n message: string,\n ...rest: unknown[]\n ) => {\n const version =\n typeof window.__KENOBI_VERSION__ !== \"undefined\"\n ? window.__KENOBI_VERSION__\n : \"dev\";\n const masthead = `[Kenobi \u25D4] (v${version})`;\n const text = `${masthead} [${level.toLocaleUpperCase()}] :: ${message}`;\n switch (level) {\n case \"debug\":\n if (this.config.debug) console.log(text, ...rest);\n break;\n case \"info\":\n console.log(text, ...rest);\n break;\n case \"warn\":\n console.warn(text, ...rest);\n break;\n case \"error_detailed\":\n console.trace(...rest);\n // fallthrough\n case \"error\":\n console.error(text, ...rest);\n break;\n }\n };\n\n private resolveTransitionConfig = (\n override?: TransitionConfig\n ): NormalizedTransitionConfig =>\n mergeTransitionConfig(this.transitionDefaults, override);\n\n private retrieveElement = (selectorGuesses: string[]) => {\n if (\n !Array.isArray(selectorGuesses) ||\n selectorGuesses.some((s) => typeof s !== \"string\")\n ) {\n throw new Error(\n `Invalid selectorGuesses payload received: expected array of strings but got ${JSON.stringify(\n selectorGuesses\n )}`\n );\n }\n\n for (const selector of selectorGuesses) {\n const candidates = document.querySelectorAll(selector);\n if (candidates.length === 0) continue;\n\n // Single match - return directly\n if (candidates.length === 1) return candidates[0];\n\n // Multiple matches - filter to visible desktop elements and prefer above-fold\n const visible = Array.from(candidates).filter((el) => {\n const rect = el.getBoundingClientRect();\n const style = getComputedStyle(el);\n return (\n style.display !== \"none\" &&\n style.visibility !== \"hidden\" &&\n rect.width > 0 &&\n rect.height > 0\n );\n });\n\n if (visible.length === 0) continue;\n\n // Prefer element closest to viewport top (hero area)\n const sorted = visible.sort(\n (a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top\n );\n\n this.log(\n \"debug\",\n `Selector \"${selector}\" matched ${\n candidates.length\n } elements, selected topmost visible one at y=${\n sorted[0].getBoundingClientRect().top\n }`\n );\n\n return sorted[0];\n }\n throw new Error(\n `Could not find an element in the document with any of these selector patterns: ${selectorGuesses.join(\n \", \"\n )}`\n );\n };\n\n private getQueryParam = (key: string) => {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get(key);\n };\n\n private getCurrentPath = () => window.location.pathname;\n private getCurrentUrl = () =>\n window.location.pathname + window.location.search + window.location.hash;\n\n private getDurationInMilliseconds = (start: Date, end: Date) => +end - +start;\n\n private formatThousands = (number: number) =>\n new Intl.NumberFormat(\"en-US\").format(number);\n\n public setDebug = (value: boolean) => (this.config.debug = value);\n\n private isInputElement = (\n el: Element\n ): el is HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement => {\n if (\n !(el instanceof HTMLInputElement) &&\n !(el instanceof HTMLTextAreaElement) &&\n !(el instanceof HTMLSelectElement)\n )\n return false;\n\n return true;\n };\n\n /*\n ----\n -- UTILITIES // PAGE WAITING\n ----\n */\n\n private waitForFrames = () =>\n // waits 2 animation frames\n new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)));\n\n private waitForIdle = (timeout = 1000) => {\n return new Promise<void>((r) =>\n \"requestIdleCallback\" in window\n ? window.requestIdleCallback(() => r(), { timeout })\n : setTimeout(r, 50)\n );\n };\n\n private waitForLoaded = () => {\n if (document.readyState === \"complete\") return Promise.resolve();\n return new Promise<void>((r) =>\n window.addEventListener(\"load\", () => r(), { once: true })\n );\n };\n\n private waitForQuietDom = (maxWaitMs: number, quietMs: number) => {\n return new Promise<void>((resolve) => {\n let last = performance.now();\n const mo = new MutationObserver(() => {\n last = performance.now();\n });\n mo.observe(document.documentElement, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n const deadline = performance.now() + maxWaitMs;\n (function tick() {\n const now = performance.now();\n if (now - last >= quietMs) {\n mo.disconnect();\n resolve();\n return;\n }\n if (now >= deadline) {\n mo.disconnect();\n resolve();\n return;\n }\n requestAnimationFrame(tick);\n })();\n });\n };\n\n /*\n ----\n -- UTILITIES // PLATFORMS\n ----\n */\n\n private isFramer = () => {\n const scripts = Array.from(document.scripts).map((s) => s.src || \"\");\n const conditions = [\n \"__framer_events\" in window,\n document.querySelector(\n \"[data-framer-root],[data-framer-component],[data-framer-page]\"\n ),\n scripts.some((src) => /framerusercontent\\.com\\/sites/i.test(src)),\n ];\n return conditions.some((c) => !!c);\n };\n\n /*\n ----\n -- VISITOR STATE MANAGEMENT\n ----\n */\n private syncVisitorKey = () => {\n try {\n const queryParamValue = this.getQueryParam(VISITOR_QUERY_PARAM_KEY);\n if (queryParamValue) {\n this.log(\n \"debug\",\n `Query param value found (${queryParamValue}), pushing into session storage`\n );\n sessionStorage.setItem(VISITOR_SESSION_STORAGE_KEY, queryParamValue);\n this.visitorKey = queryParamValue;\n } else {\n this.visitorKey = sessionStorage.getItem(VISITOR_SESSION_STORAGE_KEY);\n }\n } catch (error) {\n this.log(\"error\", \"Failed to sync visitor key with error:\", error);\n }\n };\n\n private initNavigationListener = () => {\n // avoid double-hooking if multiple instances\n if (\"__KENOBI_NAV_HOOKED__\" in window) return;\n window.__KENOBI_NAV_HOOKED__ = true;\n\n const schedule = (src: string) => {\n if (this.navTicking) return;\n this.navTicking = true;\n queueMicrotask(() => {\n this.navTicking = false;\n const nextUrl = this.getCurrentUrl();\n if (nextUrl !== this.currentUrl) {\n this.currentUrl = nextUrl;\n this.currentPath = this.getCurrentPath(); // still just pathname for your API\n this.log(\"debug\", `URL changed (${src}) \u2192 ${location.href}`);\n if (this.config.autoTransform) {\n this.undoAll();\n void this.startAutoTransform();\n }\n // Sync CueCard visibility based on new path\n this.syncCueCardVisibility();\n }\n });\n };\n\n // 1) Navigation API (Chromium, Safari TP)\n if (\"navigation\" in window) {\n const nav = window.navigation;\n if (\n nav &&\n \"addEventListener\" in nav &&\n typeof nav.addEventListener === \"function\"\n ) {\n nav.addEventListener(\"navigate\", () => schedule(\"navigation:navigate\"));\n nav.addEventListener(\"currententrychange\", () =>\n schedule(\"navigation:entrychange\")\n );\n nav.addEventListener?.(\"navigatesuccess\", () =>\n schedule(\"navigation:success\")\n );\n }\n }\n\n // 2) History API hooks\n const origPush = history.pushState.bind(history);\n const origRepl = history.replaceState.bind(history);\n history.pushState = ((...args: Parameters<History[\"pushState\"]>) => {\n const ret = origPush(...args);\n schedule(\"pushState\");\n return ret;\n }) as History[\"pushState\"];\n history.replaceState = ((...args: Parameters<History[\"replaceState\"]>) => {\n const ret = origRepl(...args);\n schedule(\"replaceState\");\n return ret;\n }) as History[\"replaceState\"];\n\n // 3) Browser events\n window.addEventListener(\"popstate\", () => schedule(\"popstate\"));\n window.addEventListener(\"hashchange\", () => schedule(\"hashchange\"));\n\n // 4) Anchor clicks (covers some router edge cases)\n document.addEventListener(\n \"click\",\n (e) => {\n const t = e.target as Element | null;\n const a = t && (t.closest?.(\"a[href]\") as HTMLAnchorElement | null);\n if (!a) return;\n if (a.target && a.target !== \"_self\") return;\n const url = new URL(a.href, location.href);\n if (url.origin !== location.origin) return;\n // router may pushState on next tick\n setTimeout(() => schedule(\"click\"), 0);\n },\n true\n );\n\n // 5) Cheap last-resort poller (handles exotic SPA routers)\n setInterval(() => {\n const next = this.getCurrentUrl();\n if (next !== this.currentUrl) schedule(\"poll\");\n }, 1_000);\n };\n\n /*\n ----\n -- DATA RETRIEVAL\n ----\n */\n private getTransformations = async (\n path: string,\n visitorCopyId: string\n ): Promise<Transformation[]> => {\n const searchParams = new URLSearchParams({\n path,\n // siteId: this.config.siteId,\n // publicKey: this.config.publicKey,\n });\n\n const rawResponse = await fetch(\n `${\n this.config.apiHost\n }/v1/visitor-copy-transformations/${visitorCopyId}?${searchParams.toString()}`\n );\n const responseJson = await rawResponse.json();\n\n if (!rawResponse.ok) {\n throw new Error(\n `Network error (status ${\n rawResponse.status\n }) with json body: ${JSON.stringify(responseJson, null, 2)}`\n );\n }\n\n return parseTransformationsResponse(responseJson);\n };\n\n private validateTransitionPreconditions = (\n identifier: string,\n markup: string,\n transitionConfig: NormalizedTransitionConfig\n ): boolean => {\n if (transitionConfig.enabled) {\n const tempContainer = document.createElement(\"div\");\n tempContainer.innerHTML = markup;\n const prospectiveElement = tempContainer.firstElementChild;\n if (!prospectiveElement || !isAnimatableElement(prospectiveElement)) {\n this.log(\n \"warn\",\n `Transformation \"${identifier}\" was skipped: A transition was requested, but the element is not animatable.`\n );\n return false; // Indicates failure, caller should hard-exit.\n }\n }\n return true; // Indicates success\n };\n\n /*\n ----\n -- DOM + TRANSFORMATION MANIPULATION\n ----\n */\n public applyTransformations = async (\n transformations: Transformation[],\n opts?: ApplyTransformationsOpts\n ) => {\n this.log(\"debug\", `Starting ${transformations.length} transformations`);\n\n // \"Consolidation\" mode traverses the existing changestack and diffs it\n // against the provided transformations, so that only those provided here\n // and now will apply (all others will be undone).\n if (opts?.shouldConsolidate) {\n this.changeStack.forEach((_, key) => {\n const matchingTransformation = transformations.find(\n (tran) => tran.identifier === key\n );\n if (matchingTransformation) {\n this.undo(key);\n }\n });\n }\n\n for (const { identifier, ...transformation } of transformations) {\n try {\n if (this.changeStack.get(identifier)) {\n throw new Error(\"Transformation already exists in stack\");\n }\n\n const cursor = this.retrieveElement(transformation.selectorGuesses);\n\n switch (transformation.action) {\n case \"Replace\": {\n const originalOuterHtml = cursor.outerHTML;\n const transitionConfig = this.resolveTransitionConfig(\n transformation.transition\n );\n\n if (\n transitionConfig.enabled &&\n isAnimatableElement(cursor) &&\n \"animate\" in cursor\n ) {\n const newElement = await this.orchestrator.replaceWithTransition(\n cursor,\n transformation.markup,\n transitionConfig\n );\n this.setOrUpdateReplaceChangeRef(\n identifier,\n originalOuterHtml,\n newElement\n );\n } else {\n morphdom(cursor, transformation.markup, {});\n this.setOrUpdateReplaceChangeRef(\n identifier,\n originalOuterHtml,\n cursor\n );\n }\n\n if (cursor.nodeName === \"VIDEO\")\n (cursor as HTMLVideoElement).play();\n\n break;\n }\n\n case \"InsertBefore\": {\n const transitionConfig = this.resolveTransitionConfig(\n transformation.transition\n );\n\n // check for animatability before any mutations.\n if (\n !this.validateTransitionPreconditions(\n identifier,\n transformation.markup,\n transitionConfig\n )\n ) {\n break;\n }\n\n cursor.insertAdjacentHTML(\"beforebegin\", transformation.markup);\n const ref = cursor.previousElementSibling;\n if (ref === null) throw new Error(\"Element wasn't created\");\n ref.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n\n if (transitionConfig.enabled && isAnimatableElement(ref)) {\n const originalStyle = ref.style.cssText;\n ref.style.opacity = \"0\";\n const anim = this.orchestrator.enter(ref, {\n ...transitionConfig,\n delayMs:\n transitionConfig.enter?.delayMs ?? transitionConfig.delayMs,\n });\n anim.addEventListener(\n \"finish\",\n () => {\n ref.style.cssText = originalStyle;\n },\n {\n once: true,\n }\n );\n }\n\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"Remove\",\n ref,\n },\n });\n break;\n }\n\n case \"InsertAfter\": {\n const transitionConfig = this.resolveTransitionConfig(\n transformation.transition\n );\n\n // check for animatability before any mutations.\n if (\n !this.validateTransitionPreconditions(\n identifier,\n transformation.markup,\n transitionConfig\n )\n ) {\n break;\n }\n\n cursor.insertAdjacentHTML(\"afterend\", transformation.markup);\n const ref = cursor.nextElementSibling;\n if (ref === null) throw new Error(\"Element wasn't created\");\n ref.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n\n if (transitionConfig.enabled && isAnimatableElement(ref)) {\n const originalStyle = ref.style.cssText;\n ref.style.opacity = \"0\";\n const anim = this.orchestrator.enter(ref, {\n ...transitionConfig,\n delayMs:\n transitionConfig.enter?.delayMs ?? transitionConfig.delayMs,\n });\n anim.addEventListener(\n \"finish\",\n () => {\n ref.style.cssText = originalStyle;\n },\n {\n once: true,\n }\n );\n }\n\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"Remove\",\n ref,\n },\n });\n break;\n }\n\n case \"Delete\": {\n const originalOuterHtml = cursor.outerHTML;\n morphdom(\n cursor,\n `<div style=\"display: none;\" data-kenobi-delete-marker=\"true\"></div>`,\n {}\n );\n cursor.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"Replace\",\n ref: cursor,\n content: originalOuterHtml,\n },\n });\n break;\n }\n\n case \"SetFormField\": {\n if (!this.isInputElement(cursor))\n throw new Error(\"Element targeted is not of a supported type\");\n const originalValue = cursor.value;\n this.setInputValue(cursor, transformation.markup);\n cursor.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"SetInput\",\n ref: cursor,\n content: originalValue,\n },\n });\n }\n }\n } catch (err) {\n this.log(\n \"warn\",\n `Unable to apply transformation with identifier \"${identifier}\"`,\n err\n );\n }\n }\n\n // Store transformations for redo and mark as personalized\n this.lastAppliedTransformations = transformations;\n this.isPersonalized = true;\n this.updateCueCardPersonalizationState();\n };\n\n /**\n * Creates or updates an entry in the change stack for a \"Replace\" action,\n * enabling undo functionality.\n *\n * This function ensures that for any given transformation identifier, there is a\n * corresponding undo record. It handles both the initial creation of this\n * record and updates to it if a transformation is re-applied, for instance,\n * after a transition.\n *\n * @param identifier The unique identifier for the transformation.\n * @param originalOuterHtml The original outerHTML of the element before replacement.\n * @param ref The new element that has replaced the original one.\n */\n private setOrUpdateReplaceChangeRef = (\n identifier: string,\n originalOuterHtml: string,\n ref: Element\n ) => {\n // Check if an undo record for this identifier already exists.\n const existing = this.changeStack.get(identifier);\n\n // If no record exists, this is the first time we're applying this transformation.\n if (!existing) {\n // Mark the new element with a data attribute for tracking.\n ref.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n // Create a new entry in the change stack with the necessary undo information.\n this.changeStack.set(identifier, {\n undoOpts: {\n type: \"Replace\",\n ref, // The new element to be replaced back on undo.\n content: originalOuterHtml, // The original content to restore.\n },\n });\n return;\n }\n\n // If a record already exists, we are updating the reference.\n // This happens when a transition completes and the final element is different\n // from the one we started with (e.g., the wrapper).\n const previousRef = existing.undoOpts.ref;\n if (previousRef && previousRef !== ref && previousRef.isConnected) {\n // Clean up the data attribute from the old element reference if it's still in the DOM.\n previousRef.removeAttribute(TRANSFORMATION_DATA_ATTR_KEY);\n }\n\n // Mark the new element reference and update the change stack entry.\n ref.setAttribute(TRANSFORMATION_DATA_ATTR_KEY, identifier);\n existing.undoOpts.ref = ref;\n };\n\n private syncChangeStack = () => {\n let pruned = 0;\n\n for (const [id, entry] of this.changeStack) {\n const ref = entry.undoOpts.ref;\n const alive = !!ref && (ref.isConnected || document.contains(ref));\n\n // drop if the node is gone\n if (!alive) {\n this.changeStack.delete(id);\n pruned++;\n continue;\n }\n\n // drop if our marker no longer matches (not our transform anymore)\n const marker = ref.getAttribute(TRANSFORMATION_DATA_ATTR_KEY);\n if (marker !== id) {\n this.changeStack.delete(id);\n pruned++;\n }\n }\n\n this.log(\n \"debug\",\n `syncChangeStack pruned ${this.formatThousands(pruned)} stale entries`\n );\n };\n\n public undo = (identifier: string) => {\n const stackItem = this.changeStack.get(identifier);\n\n if (stackItem === undefined) {\n throw new Error(\n `Cannot undo stack item with identifier ${identifier} as it does not exist.`\n );\n }\n\n const { undoOpts } = stackItem;\n switch (undoOpts.type) {\n case \"Remove\": {\n undoOpts.ref.remove();\n break;\n }\n case \"Replace\": {\n morphdom(undoOpts.ref, undoOpts.content);\n undoOpts.ref.removeAttribute(TRANSFORMATION_DATA_ATTR_KEY);\n break;\n }\n case \"SetInput\": {\n if (!this.isInputElement(undoOpts.ref))\n throw new Error(\"Element targeted is not of a supported type\");\n this.setInputValue(undoOpts.ref, undoOpts.content);\n undoOpts.ref.removeAttribute(TRANSFORMATION_DATA_ATTR_KEY);\n break;\n }\n }\n\n this.changeStack.delete(identifier);\n };\n\n public undoAll = () => {\n this.changeStack.forEach((_, ident) => this.undo(ident));\n };\n\n /**\n * Toggles between personalized and original content.\n * Updates CueCard state accordingly.\n */\n public toggleTransformations = async () => {\n if (this.isPersonalized) {\n // Currently personalized, switch to original\n this.undoAll();\n this.isPersonalized = false;\n this.log(\"debug\", \"Toggled to original content\");\n } else {\n // Currently showing original, re-apply transformations\n if (this.lastAppliedTransformations.length > 0) {\n await this.applyTransformations(this.lastAppliedTransformations, {\n shouldConsolidate: true,\n });\n }\n this.isPersonalized = true;\n this.log(\"debug\", \"Toggled to personalized content\");\n }\n this.updateCueCardPersonalizationState();\n };\n\n /**\n * Updates the CueCard's isPersonalized state to sync the toggle button.\n */\n private updateCueCardPersonalizationState = () => {\n if (this.cueCardInstance) {\n this.cueCardInstance.update({ isPersonalized: this.isPersonalized });\n }\n };\n\n private setInputValue = (\n el: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement,\n value: string\n ) => {\n const proto =\n el instanceof HTMLTextAreaElement\n ? HTMLTextAreaElement.prototype\n : el instanceof HTMLInputElement\n ? HTMLInputElement.prototype\n : HTMLSelectElement.prototype;\n\n const descriptor = Object.getOwnPropertyDescriptor(proto, \"value\");\n if (!descriptor?.set) {\n throw new Error(\"No value setter found\");\n }\n descriptor.set.call(el, value); // native setter updates the DOM property without clobbering React\n el.dispatchEvent(new Event(\"input\", { bubbles: true })); // React listens for this\n el.dispatchEvent(new Event(\"change\", { bubbles: true })); // some code listens to change\n };\n\n /*\n ----\n -- CUE CARD AUTO-MOUNT & PERSONALIZATION\n ----\n */\n\n /**\n * Fetches the CueCard configuration from the API to check if an active\n * template exists for the given path.\n *\n * @param pagePath - The page path to check for active template\n * @returns The config response, or null if the request failed\n */\n private fetchCueCardConfig = async (\n pagePath: string\n ): Promise<CueCardConfigResponse | null> => {\n if (!this.config.publicKey) return null;\n\n try {\n const searchParams = new URLSearchParams({\n publicKey: this.config.publicKey,\n pagePath,\n });\n\n const response = await fetch(\n `${this.config.apiHost}/v1/cue-card-config?${searchParams.toString()}`\n );\n\n if (!response.ok) {\n this.log(\n \"warn\",\n `CueCard config request failed with status ${response.status}`\n );\n return null;\n }\n\n const data = await response.json();\n\n if (!isCueCardConfigResponse(data)) {\n this.log(\"warn\", \"Invalid CueCard config response format\");\n return null;\n }\n\n return data;\n } catch (error) {\n this.log(\"error\", \"Failed to fetch CueCard config:\", error);\n return null;\n }\n };\n\n /**\n * Initializes and mounts a CueCard with configuration from the API.\n * Called automatically when publicKey is provided.\n *\n * The CueCard will only be mounted if an active template exists for\n * the current path on the server.\n */\n private initCueCard = async () => {\n if (this.cueCardInstance) {\n this.log(\"warn\", \"CueCard already initialized, skipping...\");\n return;\n }\n\n // Fetch config from API to check if active template exists for this path\n const configResponse = await this.fetchCueCardConfig(this.currentPath);\n\n if (!configResponse || !configResponse.enabled) {\n this.log(\n \"debug\",\n `CueCard not mounted: no active template for path \"${this.currentPath}\"`\n );\n return;\n }\n\n this.log(\"debug\", \"Active template found, mounting CueCard...\");\n\n // Use server config if available, otherwise fall back to defaults\n const serverConfig = configResponse.config;\n const deanonymizationConfig = serverConfig?.deanonymization;\n const shouldWaitForDeanonymization = !!deanonymizationConfig?.provider;\n\n this.cueCardInstance = new CueCard({\n theme: serverConfig?.theme ?? \"light\",\n position: serverConfig?.position ?? \"top-center\",\n direction: serverConfig?.direction ?? \"top-to-bottom\",\n fields: serverConfig?.fields ?? [\n {\n name: \"companyDomain\",\n label: \"Company Name or Domain\",\n placeholder: \"example.com\",\n required: true,\n minLength: 3,\n errorMessage: \"Company name or domain is required\",\n },\n ],\n isVisible: !shouldWaitForDeanonymization,\n enableFocusMode: serverConfig?.enableFocusMode ?? false,\n showWatermark: serverConfig?.showWatermark ?? false,\n showKeyboardHints: serverConfig?.showKeyboardHints ?? true,\n enableLauncher: serverConfig?.enableLauncher ?? true,\n customTheme: serverConfig?.customTheme,\n textOverrides: serverConfig?.textOverrides,\n enableUndoToggle: serverConfig?.enableUndoToggle ?? false,\n deanonymization: deanonymizationConfig,\n isPersonalized: this.isPersonalized,\n onDismiss: () => {\n this.log(\"debug\", \"CueCard dismissed by user\");\n this.dispatchKenobiEvent(\"cuecard:dismiss\", {\n pagePath: this.currentPath,\n });\n },\n onSubmitPersonalization: (values) => {\n this.log(\"debug\", \"CueCard submitted:\", values);\n void this.personalize(values);\n },\n onOpenChange: (isOpen) => {\n this.log(\"debug\", \"CueCard open state changed:\", isOpen);\n this.dispatchKenobiEvent(\"cuecard:openchange\", {\n isOpen,\n pagePath: this.currentPath,\n });\n },\n onTogglePersonalization: () => {\n this.log(\"debug\", \"CueCard toggle personalization\");\n void this.toggleTransformations();\n this.dispatchKenobiEvent(\"cuecard:toggle\", {\n isPersonalized: this.isPersonalized,\n pagePath: this.currentPath,\n });\n },\n });\n\n this.cueCardInstance.mount();\n if (shouldWaitForDeanonymization) {\n this.setupDeanonymizationPrefetch(\n deanonymizationConfig,\n serverConfig?.fields\n );\n }\n this.log(\"debug\", \"CueCard mounted successfully\");\n };\n\n private isSameInput = (\n a: Record<string, string>,\n b: Record<string, string>\n ): boolean => {\n const aKeys = Object.keys(a).sort();\n const bKeys = Object.keys(b).sort();\n if (aKeys.length !== bKeys.length) return false;\n for (let i = 0; i < aKeys.length; i += 1) {\n const key = aKeys[i];\n if (key !== bKeys[i]) return false;\n if ((a[key] ?? \"\") !== (b[key] ?? \"\")) return false;\n }\n return true;\n };\n\n private buildInputFromFields = (\n fields: Array<{ name: string }>,\n companyName: string,\n companyDomain: string\n ): Record<string, string> | null => {\n const fallback = companyDomain || companyName;\n if (!fallback) return null;\n const input: Record<string, string> = {};\n fields.forEach((field) => {\n const key = field.name;\n const lowerKey = key.toLowerCase();\n if (lowerKey.includes(\"domain\")) {\n input[key] = companyDomain || fallback;\n return;\n }\n if (lowerKey.includes(\"company\")) {\n input[key] = companyName || fallback;\n return;\n }\n input[key] = fallback;\n });\n return input;\n };\n\n private buildDeanonymizedInput = (\n detail: IdentityResolutionDetail,\n fields?: Array<{ name: string }>\n ): Record<string, string> | null => {\n const name = detail.company?.name || detail.domain || \"\";\n const domain = detail.company?.domain || detail.domain || \"\";\n if (!fields || fields.length === 0) {\n if (!name && !domain) return null;\n return {\n companyName: name || domain,\n companyDomain: domain || name,\n };\n }\n return this.buildInputFromFields(fields, name, domain);\n };\n\n private requestPersonalization = async (\n input: Record<string, string>,\n options?: PersonalizationRequestOptions\n ): Promise<PersonalizationApiResult> => {\n const payload: Record<string, unknown> = {\n publicKey: this.config.publicKey,\n input,\n pagePath: this.currentPath,\n };\n\n if (options?.notifySlack === false) {\n payload.notifySlack = false;\n }\n if (options?.notifyOnly) {\n payload.notifyOnly = true;\n }\n if (options?.predictionSource) {\n payload.predictionSource = options.predictionSource;\n }\n if (options?.prefetchedTransformations) {\n payload.prefetchedTransformations = options.prefetchedTransformations;\n }\n if (options?.prefetchedMetadata) {\n payload.prefetchedMetadata = options.prefetchedMetadata;\n }\n\n const response = await fetch(`${this.config.apiHost}/v1/personalize`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(payload),\n });\n\n if (!response.ok) {\n const errorBody = await response.json().catch(() => ({}));\n throw new Error(errorBody.error || `API error: ${response.status}`);\n }\n\n const result = (await response.json()) as PersonalizationApiResult;\n this.log(\"debug\", \"Personalization API response:\", result);\n return result;\n };\n\n public preparePersonalization = async (\n input: Record<string, string>,\n options?: { source?: PersonalizationPredictionSource }\n ): Promise<PersonalizationApiResult | null> => {\n if (!this.config.publicKey) {\n this.log(\"error\", \"Cannot prepare personalization: publicKey not configured\");\n return null;\n }\n\n if (\n this.preparedPersonalization?.input &&\n this.isSameInput(this.preparedPersonalization.input, input)\n ) {\n if (options?.source && !this.preparedPersonalization.source) {\n this.preparedPersonalization = {\n ...this.preparedPersonalization,\n source: options.source,\n };\n }\n return this.preparedPersonalization.result;\n }\n\n if (this.preparePersonalizationPromise) {\n return this.preparePersonalizationPromise;\n }\n this.isPreparingPersonalization = true;\n\n this.preparePersonalizationPromise = (async () => {\n try {\n const result = await this.requestPersonalization(input, {\n notifySlack: false,\n predictionSource: options?.source,\n });\n this.preparedPersonalization = { input, result, source: options?.source };\n this.dispatchKenobiEvent(\"personalization:ready\", {\n input,\n pagePath: this.currentPath,\n transformationsCount: result.transformations?.length ?? 0,\n metadata: result.metadata,\n source: options?.source,\n });\n return result;\n } catch (error) {\n this.log(\"error\", \"Personalization prefetch failed:\", error);\n return null;\n } finally {\n this.isPreparingPersonalization = false;\n this.preparePersonalizationPromise = null;\n }\n })();\n\n return this.preparePersonalizationPromise;\n };\n\n private notifyPreparedPersonalization = async (\n prepared: PreparedPersonalization\n ): Promise<void> => {\n if (!prepared.result.transformations || !prepared.result.metadata) {\n this.log(\n \"warn\",\n \"Prepared personalization missing transformations or metadata for notify\"\n );\n return;\n }\n\n try {\n await this.requestPersonalization(prepared.input, {\n notifySlack: true,\n notifyOnly: true,\n predictionSource: prepared.source,\n prefetchedTransformations: prepared.result.transformations,\n prefetchedMetadata: prepared.result.metadata,\n });\n } catch (error) {\n this.log(\n \"warn\",\n \"Failed to send Slack notification for prepared personalization:\",\n error\n );\n }\n };\n\n private setupDeanonymizationPrefetch = (\n config?: { timeoutMs?: number },\n fields?: Array<{ name: string }>\n ) => {\n if (!this.cueCardInstance) return;\n if (typeof window === \"undefined\") {\n this.cueCardInstance.update({ isVisible: true });\n return;\n }\n\n if (this.deanonymizationPrefetchCleanup) return;\n\n let resolved = false;\n let hasIdentity = false;\n let shouldDisableDeanonymization = false;\n const finish = () => {\n if (resolved) return;\n resolved = true;\n if (shouldDisableDeanonymization) {\n this.cueCardInstance?.update({\n deanonymization: undefined,\n isVisible: true,\n });\n } else {\n this.cueCardInstance?.update({ isVisible: true });\n }\n this.deanonymizationPrefetchCleanup?.();\n this.deanonymizationPrefetchCleanup = null;\n };\n\n const handleIdentity = async (\n event: Event | { detail?: IdentityResolutionDetail }\n ) => {\n if (resolved) return;\n const detail = (event as CustomEvent<IdentityResolutionDetail>).detail;\n hasIdentity = true;\n if (detail?.type !== \"business\") {\n finish();\n return;\n }\n\n const input = this.buildDeanonymizedInput(detail, fields);\n if (!input) {\n finish();\n return;\n }\n\n const prepared = await this.preparePersonalization(input, {\n source: \"deanonymized\",\n });\n if (!prepared) {\n shouldDisableDeanonymization = true;\n }\n\n finish();\n };\n\n const cachedIdentity = window.__kenobiIdentityResolution as\n | IdentityResolutionDetail\n | null\n | undefined;\n if (cachedIdentity) {\n void handleIdentity({ detail: cachedIdentity });\n }\n\n window.addEventListener(IDENTITY_RESOLVED_EVENT, handleIdentity);\n const timeoutMs = config?.timeoutMs ?? DEFAULT_DEANON_TIMEOUT_MS;\n const timeoutId = window.setTimeout(() => {\n if (!hasIdentity) {\n finish();\n }\n }, timeoutMs + 50);\n\n this.deanonymizationPrefetchCleanup = () => {\n window.removeEventListener(IDENTITY_RESOLVED_EVENT, handleIdentity);\n window.clearTimeout(timeoutId);\n };\n };\n\n /**\n * Syncs CueCard visibility based on the current path.\n * Checks with the server if an active template exists for the new path.\n * Called after navigation changes.\n */\n private syncCueCardVisibility = async () => {\n // Only manage CueCard if publicKey is configured\n if (!this.config.publicKey) return;\n\n // Unmount existing CueCard on navigation (will re-mount if new path has active template)\n if (this.cueCardInstance) {\n this.log(\"debug\", `Navigation detected, unmounting CueCard`);\n this.cueCardInstance.unmount();\n this.cueCardInstance = null;\n }\n\n // Check if new path has an active template\n void this.initCueCard();\n };\n\n /**\n * Dispatches a custom event on window for external listeners.\n * Events are prefixed with \"kenobi:\" for namespacing.\n */\n private dispatchKenobiEvent = (\n eventName: string,\n detail: Record<string, unknown>\n ) => {\n const event = new CustomEvent(`kenobi:${eventName}`, {\n detail,\n bubbles: true,\n });\n window.dispatchEvent(event);\n this.log(\"debug\", `Dispatched event: kenobi:${eventName}`, detail);\n };\n\n /**\n * Triggers personalization by calling the API with the provided input.\n * Updates CueCard status during the flow and applies transformations.\n *\n * Dispatches events:\n * - `kenobi:personalization:start` - when personalization begins\n * - `kenobi:personalization:complete` - when personalization succeeds\n * - `kenobi:personalization:error` - when personalization fails\n *\n * @param input - User-provided fields (e.g., { companyDomain: \"acme.com\" })\n */\n public personalize = async (\n input: Record<string, string>\n ): Promise<PersonalizeApiResponse | null> => {\n if (!this.config.publicKey) {\n this.log(\"error\", \"Cannot personalize: publicKey not configured\");\n return null;\n }\n\n const startTime = new Date();\n this.log(\"debug\", \"Starting personalization with input:\", input);\n\n const prepared =\n this.preparedPersonalization?.input &&\n this.isSameInput(this.preparedPersonalization.input, input)\n ? this.preparedPersonalization\n : null;\n const isDeanonymizedInput = prepared?.source === \"deanonymized\";\n\n // Dispatch start event\n this.dispatchKenobiEvent(\"personalization:start\", {\n input,\n pagePath: this.currentPath,\n deanonymized: isDeanonymizedInput,\n });\n\n try {\n // Update CueCard to loading state\n if (this.cueCardInstance) {\n this.cueCardInstance.update({\n status: \"starting\",\n progressPct: prepared ? 80 : 10,\n });\n }\n\n if (prepared) {\n void this.notifyPreparedPersonalization(prepared);\n }\n\n const result = prepared\n ? prepared.result\n : await this.requestPersonalization(input);\n\n // Apply transformations\n if (result.transformations && Array.isArray(result.transformations)) {\n await this.applyTransformations(result.transformations, {\n shouldConsolidate: true,\n });\n }\n\n if (prepared) {\n this.preparedPersonalization = null;\n }\n\n // Update CueCard to success state\n if (this.cueCardInstance) {\n this.cueCardInstance.update({ status: \"success\", progressPct: 100 });\n }\n\n const endTime = new Date();\n const duration = this.getDurationInMilliseconds(startTime, endTime);\n this.log(\n \"debug\",\n `Personalization complete, took ${this.formatThousands(duration)} ms`\n );\n\n // Dispatch complete event\n this.dispatchKenobiEvent(\"personalization:complete\", {\n input,\n pagePath: this.currentPath,\n durationMs: duration,\n transformationsCount: result.transformations?.length ?? 0,\n metadata: result.metadata,\n source: prepared ? \"prefetch\" : \"api\",\n deanonymized: isDeanonymizedInput,\n });\n\n return result;\n } catch (error) {\n this.log(\"error\", \"Personalization failed:\", error);\n\n // Update CueCard to error state\n if (this.cueCardInstance) {\n this.cueCardInstance.update({ status: \"error\", progressPct: 0 });\n }\n\n // Dispatch error event\n this.dispatchKenobiEvent(\"personalization:error\", {\n input,\n pagePath: this.currentPath,\n error: error instanceof Error ? error.message : String(error),\n deanonymized: isDeanonymizedInput,\n });\n }\n\n return null;\n };\n\n /**\n * Returns the CueCard instance if one was auto-mounted.\n * Useful for external control of the CueCard state.\n */\n public getCueCard = (): CueCard | null => {\n return this.cueCardInstance;\n };\n}\n\nexport { CueCard, Kenobi };\n", "var DOCUMENT_FRAGMENT_NODE = 11;\n\nfunction morphAttrs(fromNode, toNode) {\n var toNodeAttrs = toNode.attributes;\n var attr;\n var attrName;\n var attrNamespaceURI;\n var attrValue;\n var fromValue;\n\n // document-fragments dont have attributes so lets not do anything\n if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE || fromNode.nodeType === DOCUMENT_FRAGMENT_NODE) {\n return;\n }\n\n // update attributes on original DOM element\n for (var i = toNodeAttrs.length - 1; i >= 0; i--) {\n attr = toNodeAttrs[i];\n attrName = attr.name;\n attrNamespaceURI = attr.namespaceURI;\n attrValue = attr.value;\n\n if (attrNamespaceURI) {\n attrName = attr.localName || attrName;\n fromValue = fromNode.getAttributeNS(attrNamespaceURI, attrName);\n\n if (fromValue !== attrValue) {\n if (attr.prefix === 'xmlns'){\n attrName = attr.name; // It's not allowed to set an attribute with the XMLNS namespace without specifying the `xmlns` prefix\n }\n fromNode.setAttributeNS(attrNamespaceURI, attrName, attrValue);\n }\n } else {\n fromValue = fromNode.getAttribute(attrName);\n\n if (fromValue !== attrValue) {\n fromNode.setAttribute(attrName, attrValue);\n }\n }\n }\n\n // Remove any extra attributes found on the original DOM element that\n // weren't found on the target element.\n var fromNodeAttrs = fromNode.attributes;\n\n for (var d = fromNodeAttrs.length - 1; d >= 0; d--) {\n attr = fromNodeAttrs[d];\n attrName = attr.name;\n attrNamespaceURI = attr.namespaceURI;\n\n if (attrNamespaceURI) {\n attrName = attr.localName || attrName;\n\n if (!toNode.hasAttributeNS(attrNamespaceURI, attrName)) {\n fromNode.removeAttributeNS(attrNamespaceURI, attrName);\n }\n } else {\n if (!toNode.hasAttribute(attrName)) {\n fromNode.removeAttribute(attrName);\n }\n }\n }\n}\n\nvar range; // Create a range object for efficently rendering strings to elements.\nvar NS_XHTML = 'http://www.w3.org/1999/xhtml';\n\nvar doc = typeof document === 'undefined' ? undefined : document;\nvar HAS_TEMPLATE_SUPPORT = !!doc && 'content' in doc.createElement('template');\nvar HAS_RANGE_SUPPORT = !!doc && doc.createRange && 'createContextualFragment' in doc.createRange();\n\nfunction createFragmentFromTemplate(str) {\n var template = doc.createElement('template');\n template.innerHTML = str;\n return template.content.childNodes[0];\n}\n\nfunction createFragmentFromRange(str) {\n if (!range) {\n range = doc.createRange();\n range.selectNode(doc.body);\n }\n\n var fragment = range.createContextualFragment(str);\n return fragment.childNodes[0];\n}\n\nfunction createFragmentFromWrap(str) {\n var fragment = doc.createElement('body');\n fragment.innerHTML = str;\n return fragment.childNodes[0];\n}\n\n/**\n * This is about the same\n * var html = new DOMParser().parseFromString(str, 'text/html');\n * return html.body.firstChild;\n *\n * @method toElement\n * @param {String} str\n */\nfunction toElement(str) {\n str = str.trim();\n if (HAS_TEMPLATE_SUPPORT) {\n // avoid restrictions on content for things like `<tr><th>Hi</th></tr>` which\n // createContextualFragment doesn't support\n // <template> support not available in IE\n return createFragmentFromTemplate(str);\n } else if (HAS_RANGE_SUPPORT) {\n return createFragmentFromRange(str);\n }\n\n return createFragmentFromWrap(str);\n}\n\n/**\n * Returns true if two node's names are the same.\n *\n * NOTE: We don't bother checking `namespaceURI` because you will never find two HTML elements with the same\n * nodeName and different namespace URIs.\n *\n * @param {Element} a\n * @param {Element} b The target element\n * @return {boolean}\n */\nfunction compareNodeNames(fromEl, toEl) {\n var fromNodeName = fromEl.nodeName;\n var toNodeName = toEl.nodeName;\n var fromCodeStart, toCodeStart;\n\n if (fromNodeName === toNodeName) {\n return true;\n }\n\n fromCodeStart = fromNodeName.charCodeAt(0);\n toCodeStart = toNodeName.charCodeAt(0);\n\n // If the target element is a virtual DOM node or SVG node then we may\n // need to normalize the tag name before comparing. Normal HTML elements that are\n // in the \"http://www.w3.org/1999/xhtml\"\n // are converted to upper case\n if (fromCodeStart <= 90 && toCodeStart >= 97) { // from is upper and to is lower\n return fromNodeName === toNodeName.toUpperCase();\n } else if (toCodeStart <= 90 && fromCodeStart >= 97) { // to is upper and from is lower\n return toNodeName === fromNodeName.toUpperCase();\n } else {\n return false;\n }\n}\n\n/**\n * Create an element, optionally with a known namespace URI.\n *\n * @param {string} name the element name, e.g. 'div' or 'svg'\n * @param {string} [namespaceURI] the element's namespace URI, i.e. the value of\n * its `xmlns` attribute or its inferred namespace.\n *\n * @return {Element}\n */\nfunction createElementNS(name, namespaceURI) {\n return !namespaceURI || namespaceURI === NS_XHTML ?\n doc.createElement(name) :\n doc.createElementNS(namespaceURI, name);\n}\n\n/**\n * Copies the children of one DOM element to another DOM element\n */\nfunction moveChildren(fromEl, toEl) {\n var curChild = fromEl.firstChild;\n while (curChild) {\n var nextChild = curChild.nextSibling;\n toEl.appendChild(curChild);\n curChild = nextChild;\n }\n return toEl;\n}\n\nfunction syncBooleanAttrProp(fromEl, toEl, name) {\n if (fromEl[name] !== toEl[name]) {\n fromEl[name] = toEl[name];\n if (fromEl[name]) {\n fromEl.setAttribute(name, '');\n } else {\n fromEl.removeAttribute(name);\n }\n }\n}\n\nvar specialElHandlers = {\n OPTION: function(fromEl, toEl) {\n var parentNode = fromEl.parentNode;\n if (parentNode) {\n var parentName = parentNode.nodeName.toUpperCase();\n if (parentName === 'OPTGROUP') {\n parentNode = parentNode.parentNode;\n parentName = parentNode && parentNode.nodeName.toUpperCase();\n }\n if (parentName === 'SELECT' && !parentNode.hasAttribute('multiple')) {\n if (fromEl.hasAttribute('selected') && !toEl.selected) {\n // Workaround for MS Edge bug where the 'selected' attribute can only be\n // removed if set to a non-empty value:\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12087679/\n fromEl.setAttribute('selected', 'selected');\n fromEl.removeAttribute('selected');\n }\n // We have to reset select element's selectedIndex to -1, otherwise setting\n // fromEl.selected using the syncBooleanAttrProp below has no effect.\n // The correct selectedIndex will be set in the SELECT special handler below.\n parentNode.selectedIndex = -1;\n }\n }\n syncBooleanAttrProp(fromEl, toEl, 'selected');\n },\n /**\n * The \"value\" attribute is special for the <input> element since it sets\n * the initial value. Changing the \"value\" attribute without changing the\n * \"value\" property will have no effect since it is only used to the set the\n * initial value. Similar for the \"checked\" attribute, and \"disabled\".\n */\n INPUT: function(fromEl, toEl) {\n syncBooleanAttrProp(fromEl, toEl, 'checked');\n syncBooleanAttrProp(fromEl, toEl, 'disabled');\n\n if (fromEl.value !== toEl.value) {\n fromEl.value = toEl.value;\n }\n\n if (!toEl.hasAttribute('value')) {\n fromEl.removeAttribute('value');\n }\n },\n\n TEXTAREA: function(fromEl, toEl) {\n var newValue = toEl.value;\n if (fromEl.value !== newValue) {\n fromEl.value = newValue;\n }\n\n var firstChild = fromEl.firstChild;\n if (firstChild) {\n // Needed for IE. Apparently IE sets the placeholder as the\n // node value and vise versa. This ignores an empty update.\n var oldValue = firstChild.nodeValue;\n\n if (oldValue == newValue || (!newValue && oldValue == fromEl.placeholder)) {\n return;\n }\n\n firstChild.nodeValue = newValue;\n }\n },\n SELECT: function(fromEl, toEl) {\n if (!toEl.hasAttribute('multiple')) {\n var selectedIndex = -1;\n var i = 0;\n // We have to loop through children of fromEl, not toEl since nodes can be moved\n // from toEl to fromEl directly when morphing.\n // At the time this special handler is invoked, all children have already been morphed\n // and appended to / removed from fromEl, so using fromEl here is safe and correct.\n var curChild = fromEl.firstChild;\n var optgroup;\n var nodeName;\n while(curChild) {\n nodeName = curChild.nodeName && curChild.nodeName.toUpperCase();\n if (nodeName === 'OPTGROUP') {\n optgroup = curChild;\n curChild = optgroup.firstChild;\n // handle empty optgroups\n if (!curChild) {\n curChild = optgroup.nextSibling;\n optgroup = null;\n }\n } else {\n if (nodeName === 'OPTION') {\n if (curChild.hasAttribute('selected')) {\n selectedIndex = i;\n break;\n }\n i++;\n }\n curChild = curChild.nextSibling;\n if (!curChild && optgroup) {\n curChild = optgroup.nextSibling;\n optgroup = null;\n }\n }\n }\n\n fromEl.selectedIndex = selectedIndex;\n }\n }\n};\n\nvar ELEMENT_NODE = 1;\nvar DOCUMENT_FRAGMENT_NODE$1 = 11;\nvar TEXT_NODE = 3;\nvar COMMENT_NODE = 8;\n\nfunction noop() {}\n\nfunction defaultGetNodeKey(node) {\n if (node) {\n return (node.getAttribute && node.getAttribute('id')) || node.id;\n }\n}\n\nfunction morphdomFactory(morphAttrs) {\n\n return function morphdom(fromNode, toNode, options) {\n if (!options) {\n options = {};\n }\n\n if (typeof toNode === 'string') {\n if (fromNode.nodeName === '#document' || fromNode.nodeName === 'HTML' || fromNode.nodeName === 'BODY') {\n var toNodeHtml = toNode;\n toNode = doc.createElement('html');\n toNode.innerHTML = toNodeHtml;\n } else {\n toNode = toElement(toNode);\n }\n } else if (toNode.nodeType === DOCUMENT_FRAGMENT_NODE$1) {\n toNode = toNode.firstElementChild;\n }\n\n var getNodeKey = options.getNodeKey || defaultGetNodeKey;\n var onBeforeNodeAdded = options.onBeforeNodeAdded || noop;\n var onNodeAdded = options.onNodeAdded || noop;\n var onBeforeElUpdated = options.onBeforeElUpdated || noop;\n var onElUpdated = options.onElUpdated || noop;\n var onBeforeNodeDiscarded = options.onBeforeNodeDiscarded || noop;\n var onNodeDiscarded = options.onNodeDiscarded || noop;\n var onBeforeElChildrenUpdated = options.onBeforeElChildrenUpdated || noop;\n var skipFromChildren = options.skipFromChildren || noop;\n var addChild = options.addChild || function(parent, child){ return parent.appendChild(child); };\n var childrenOnly = options.childrenOnly === true;\n\n // This object is used as a lookup to quickly find all keyed elements in the original DOM tree.\n var fromNodesLookup = Object.create(null);\n var keyedRemovalList = [];\n\n function addKeyedRemoval(key) {\n keyedRemovalList.push(key);\n }\n\n function walkDiscardedChildNodes(node, skipKeyedNodes) {\n if (node.nodeType === ELEMENT_NODE) {\n var curChild = node.firstChild;\n while (curChild) {\n\n var key = undefined;\n\n if (skipKeyedNodes && (key = getNodeKey(curChild))) {\n // If we are skipping keyed nodes then we add the key\n // to a list so that it can be handled at the very end.\n addKeyedRemoval(key);\n } else {\n // Only report the node as discarded if it is not keyed. We do this because\n // at the end we loop through all keyed elements that were unmatched\n // and then discard them in one final pass.\n onNodeDiscarded(curChild);\n if (curChild.firstChild) {\n walkDiscardedChildNodes(curChild, skipKeyedNodes);\n }\n }\n\n curChild = curChild.nextSibling;\n }\n }\n }\n\n /**\n * Removes a DOM node out of the original DOM\n *\n * @param {Node} node The node to remove\n * @param {Node} parentNode The nodes parent\n * @param {Boolean} skipKeyedNodes If true then elements with keys will be skipped and not discarded.\n * @return {undefined}\n */\n function removeNode(node, parentNode, skipKeyedNodes) {\n if (onBeforeNodeDiscarded(node) === false) {\n return;\n }\n\n if (parentNode) {\n parentNode.removeChild(node);\n }\n\n onNodeDiscarded(node);\n walkDiscardedChildNodes(node, skipKeyedNodes);\n }\n\n // // TreeWalker implementation is no faster, but keeping this around in case this changes in the future\n // function indexTree(root) {\n // var treeWalker = document.createTreeWalker(\n // root,\n // NodeFilter.SHOW_ELEMENT);\n //\n // var el;\n // while((el = treeWalker.nextNode())) {\n // var key = getNodeKey(el);\n // if (key) {\n // fromNodesLookup[key] = el;\n // }\n // }\n // }\n\n // // NodeIterator implementation is no faster, but keeping this around in case this changes in the future\n //\n // function indexTree(node) {\n // var nodeIterator = document.createNodeIterator(node, NodeFilter.SHOW_ELEMENT);\n // var el;\n // while((el = nodeIterator.nextNode())) {\n // var key = getNodeKey(el);\n // if (key) {\n // fromNodesLookup[key] = el;\n // }\n // }\n // }\n\n function indexTree(node) {\n if (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE$1) {\n var curChild = node.firstChild;\n while (curChild) {\n var key = getNodeKey(curChild);\n if (key) {\n fromNodesLookup[key] = curChild;\n }\n\n // Walk recursively\n indexTree(curChild);\n\n curChild = curChild.nextSibling;\n }\n }\n }\n\n indexTree(fromNode);\n\n function handleNodeAdded(el) {\n onNodeAdded(el);\n\n var curChild = el.firstChild;\n while (curChild) {\n var nextSibling = curChild.nextSibling;\n\n var key = getNodeKey(curChild);\n if (key) {\n var unmatchedFromEl = fromNodesLookup[key];\n // if we find a duplicate #id node in cache, replace `el` with cache value\n // and morph it to the child node.\n if (unmatchedFromEl && compareNodeNames(curChild, unmatchedFromEl)) {\n curChild.parentNode.replaceChild(unmatchedFromEl, curChild);\n morphEl(unmatchedFromEl, curChild);\n } else {\n handleNodeAdded(curChild);\n }\n } else {\n // recursively call for curChild and it's children to see if we find something in\n // fromNodesLookup\n handleNodeAdded(curChild);\n }\n\n curChild = nextSibling;\n }\n }\n\n function cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey) {\n // We have processed all of the \"to nodes\". If curFromNodeChild is\n // non-null then we still have some from nodes left over that need\n // to be removed\n while (curFromNodeChild) {\n var fromNextSibling = curFromNodeChild.nextSibling;\n if ((curFromNodeKey = getNodeKey(curFromNodeChild))) {\n // Since the node is keyed it might be matched up later so we defer\n // the actual removal to later\n addKeyedRemoval(curFromNodeKey);\n } else {\n // NOTE: we skip nested keyed nodes from being removed since there is\n // still a chance they will be matched up later\n removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n }\n curFromNodeChild = fromNextSibling;\n }\n }\n\n function morphEl(fromEl, toEl, childrenOnly) {\n var toElKey = getNodeKey(toEl);\n\n if (toElKey) {\n // If an element with an ID is being morphed then it will be in the final\n // DOM so clear it out of the saved elements collection\n delete fromNodesLookup[toElKey];\n }\n\n if (!childrenOnly) {\n // optional\n var beforeUpdateResult = onBeforeElUpdated(fromEl, toEl);\n if (beforeUpdateResult === false) {\n return;\n } else if (beforeUpdateResult instanceof HTMLElement) {\n fromEl = beforeUpdateResult;\n // reindex the new fromEl in case it's not in the same\n // tree as the original fromEl\n // (Phoenix LiveView sometimes returns a cloned tree,\n // but keyed lookups would still point to the original tree)\n indexTree(fromEl);\n }\n\n // update attributes on original DOM element first\n morphAttrs(fromEl, toEl);\n // optional\n onElUpdated(fromEl);\n\n if (onBeforeElChildrenUpdated(fromEl, toEl) === false) {\n return;\n }\n }\n\n if (fromEl.nodeName !== 'TEXTAREA') {\n morphChildren(fromEl, toEl);\n } else {\n specialElHandlers.TEXTAREA(fromEl, toEl);\n }\n }\n\n function morphChildren(fromEl, toEl) {\n var skipFrom = skipFromChildren(fromEl, toEl);\n var curToNodeChild = toEl.firstChild;\n var curFromNodeChild = fromEl.firstChild;\n var curToNodeKey;\n var curFromNodeKey;\n\n var fromNextSibling;\n var toNextSibling;\n var matchingFromEl;\n\n // walk the children\n outer: while (curToNodeChild) {\n toNextSibling = curToNodeChild.nextSibling;\n curToNodeKey = getNodeKey(curToNodeChild);\n\n // walk the fromNode children all the way through\n while (!skipFrom && curFromNodeChild) {\n fromNextSibling = curFromNodeChild.nextSibling;\n\n if (curToNodeChild.isSameNode && curToNodeChild.isSameNode(curFromNodeChild)) {\n curToNodeChild = toNextSibling;\n curFromNodeChild = fromNextSibling;\n continue outer;\n }\n\n curFromNodeKey = getNodeKey(curFromNodeChild);\n\n var curFromNodeType = curFromNodeChild.nodeType;\n\n // this means if the curFromNodeChild doesnt have a match with the curToNodeChild\n var isCompatible = undefined;\n\n if (curFromNodeType === curToNodeChild.nodeType) {\n if (curFromNodeType === ELEMENT_NODE) {\n // Both nodes being compared are Element nodes\n\n if (curToNodeKey) {\n // The target node has a key so we want to match it up with the correct element\n // in the original DOM tree\n if (curToNodeKey !== curFromNodeKey) {\n // The current element in the original DOM tree does not have a matching key so\n // let's check our lookup to see if there is a matching element in the original\n // DOM tree\n if ((matchingFromEl = fromNodesLookup[curToNodeKey])) {\n if (fromNextSibling === matchingFromEl) {\n // Special case for single element removals. To avoid removing the original\n // DOM node out of the tree (since that can break CSS transitions, etc.),\n // we will instead discard the current node and wait until the next\n // iteration to properly match up the keyed target element with its matching\n // element in the original tree\n isCompatible = false;\n } else {\n // We found a matching keyed element somewhere in the original DOM tree.\n // Let's move the original DOM node into the current position and morph\n // it.\n\n // NOTE: We use insertBefore instead of replaceChild because we want to go through\n // the `removeNode()` function for the node that is being discarded so that\n // all lifecycle hooks are correctly invoked\n fromEl.insertBefore(matchingFromEl, curFromNodeChild);\n\n // fromNextSibling = curFromNodeChild.nextSibling;\n\n if (curFromNodeKey) {\n // Since the node is keyed it might be matched up later so we defer\n // the actual removal to later\n addKeyedRemoval(curFromNodeKey);\n } else {\n // NOTE: we skip nested keyed nodes from being removed since there is\n // still a chance they will be matched up later\n removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n }\n\n curFromNodeChild = matchingFromEl;\n curFromNodeKey = getNodeKey(curFromNodeChild);\n }\n } else {\n // The nodes are not compatible since the \"to\" node has a key and there\n // is no matching keyed node in the source tree\n isCompatible = false;\n }\n }\n } else if (curFromNodeKey) {\n // The original has a key\n isCompatible = false;\n }\n\n isCompatible = isCompatible !== false && compareNodeNames(curFromNodeChild, curToNodeChild);\n if (isCompatible) {\n // We found compatible DOM elements so transform\n // the current \"from\" node to match the current\n // target DOM node.\n // MORPH\n morphEl(curFromNodeChild, curToNodeChild);\n }\n\n } else if (curFromNodeType === TEXT_NODE || curFromNodeType == COMMENT_NODE) {\n // Both nodes being compared are Text or Comment nodes\n isCompatible = true;\n // Simply update nodeValue on the original node to\n // change the text value\n if (curFromNodeChild.nodeValue !== curToNodeChild.nodeValue) {\n curFromNodeChild.nodeValue = curToNodeChild.nodeValue;\n }\n\n }\n }\n\n if (isCompatible) {\n // Advance both the \"to\" child and the \"from\" child since we found a match\n // Nothing else to do as we already recursively called morphChildren above\n curToNodeChild = toNextSibling;\n curFromNodeChild = fromNextSibling;\n continue outer;\n }\n\n // No compatible match so remove the old node from the DOM and continue trying to find a\n // match in the original DOM. However, we only do this if the from node is not keyed\n // since it is possible that a keyed node might match up with a node somewhere else in the\n // target tree and we don't want to discard it just yet since it still might find a\n // home in the final DOM tree. After everything is done we will remove any keyed nodes\n // that didn't find a home\n if (curFromNodeKey) {\n // Since the node is keyed it might be matched up later so we defer\n // the actual removal to later\n addKeyedRemoval(curFromNodeKey);\n } else {\n // NOTE: we skip nested keyed nodes from being removed since there is\n // still a chance they will be matched up later\n removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n }\n\n curFromNodeChild = fromNextSibling;\n } // END: while(curFromNodeChild) {}\n\n // If we got this far then we did not find a candidate match for\n // our \"to node\" and we exhausted all of the children \"from\"\n // nodes. Therefore, we will just append the current \"to\" node\n // to the end\n if (curToNodeKey && (matchingFromEl = fromNodesLookup[curToNodeKey]) && compareNodeNames(matchingFromEl, curToNodeChild)) {\n // MORPH\n if(!skipFrom){ addChild(fromEl, matchingFromEl); }\n morphEl(matchingFromEl, curToNodeChild);\n } else {\n var onBeforeNodeAddedResult = onBeforeNodeAdded(curToNodeChild);\n if (onBeforeNodeAddedResult !== false) {\n if (onBeforeNodeAddedResult) {\n curToNodeChild = onBeforeNodeAddedResult;\n }\n\n if (curToNodeChild.actualize) {\n curToNodeChild = curToNodeChild.actualize(fromEl.ownerDocument || doc);\n }\n addChild(fromEl, curToNodeChild);\n handleNodeAdded(curToNodeChild);\n }\n }\n\n curToNodeChild = toNextSibling;\n curFromNodeChild = fromNextSibling;\n }\n\n cleanupFromEl(fromEl, curFromNodeChild, curFromNodeKey);\n\n var specialElHandler = specialElHandlers[fromEl.nodeName];\n if (specialElHandler) {\n specialElHandler(fromEl, toEl);\n }\n } // END: morphChildren(...)\n\n var morphedNode = fromNode;\n var morphedNodeType = morphedNode.nodeType;\n var toNodeType = toNode.nodeType;\n\n if (!childrenOnly) {\n // Handle the case where we are given two DOM nodes that are not\n // compatible (e.g. <div> --> <span> or <div> --> TEXT)\n if (morphedNodeType === ELEMENT_NODE) {\n if (toNodeType === ELEMENT_NODE) {\n if (!compareNodeNames(fromNode, toNode)) {\n onNodeDiscarded(fromNode);\n morphedNode = moveChildren(fromNode, createElementNS(toNode.nodeName, toNode.namespaceURI));\n }\n } else {\n // Going from an element node to a text node\n morphedNode = toNode;\n }\n } else if (morphedNodeType === TEXT_NODE || morphedNodeType === COMMENT_NODE) { // Text or comment node\n if (toNodeType === morphedNodeType) {\n if (morphedNode.nodeValue !== toNode.nodeValue) {\n morphedNode.nodeValue = toNode.nodeValue;\n }\n\n return morphedNode;\n } else {\n // Text node to something else\n morphedNode = toNode;\n }\n }\n }\n\n if (morphedNode === toNode) {\n // The \"to node\" was not compatible with the \"from node\" so we had to\n // toss out the \"from node\" and use the \"to node\"\n onNodeDiscarded(fromNode);\n } else {\n if (toNode.isSameNode && toNode.isSameNode(morphedNode)) {\n return;\n }\n\n morphEl(morphedNode, toNode, childrenOnly);\n\n // We now need to loop over any keyed nodes that might need to be\n // removed. We only do the removal if we know that the keyed node\n // never found a match. When a keyed node is matched up we remove\n // it out of fromNodesLookup and we use fromNodesLookup to determine\n // if a keyed node has been matched up or not\n if (keyedRemovalList) {\n for (var i=0, len=keyedRemovalList.length; i<len; i++) {\n var elToRemove = fromNodesLookup[keyedRemovalList[i]];\n if (elToRemove) {\n removeNode(elToRemove, elToRemove.parentNode, false);\n }\n }\n }\n }\n\n if (!childrenOnly && morphedNode !== fromNode && fromNode.parentNode) {\n if (morphedNode.actualize) {\n morphedNode = morphedNode.actualize(fromNode.ownerDocument || doc);\n }\n // If we had to swap out the from node with a new node because the old\n // node was not compatible with the target node then we need to\n // replace the old DOM node in the original DOM tree. This is only\n // possible if the original DOM node was part of a DOM tree which\n // we know is the case if it has a parent node.\n fromNode.parentNode.replaceChild(morphedNode, fromNode);\n }\n\n return morphedNode;\n };\n}\n\nvar morphdom = morphdomFactory(morphAttrs);\n\nexport default morphdom;\n", "/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 1;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n", "import { EMPTY_ARR } from './constants';\n\nexport const isArray = Array.isArray;\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-expect-error We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {import('./index').ContainerNode} node The node to remove\n */\nexport function removeNode(node) {\n\tif (node && node.parentNode) node.parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n", "import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n", "import { slice } from './util';\nimport options from './options';\nimport { NULL, UNDEFINED } from './constants';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor for this\n * virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array<import('.').ComponentChildren>} [children] The children of the\n * virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != NULL) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === UNDEFINED) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, NULL);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\t/** @type {import('./internal').VNode} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: NULL,\n\t\t_parent: NULL,\n\t\t_depth: 0,\n\t\t_dom: NULL,\n\t\t_component: NULL,\n\t\tconstructor: UNDEFINED,\n\t\t_original: original == NULL ? ++vnodeId : original,\n\t\t_index: -1,\n\t\t_flags: 0\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == NULL && options.vnode != NULL) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: NULL };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != NULL && vnode.constructor == UNDEFINED;\n", "import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\nimport { MODE_HYDRATE, NULL } from './constants';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function BaseComponent(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nBaseComponent.prototype.setState = function (update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != NULL && this._nextState != this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == NULL) return;\n\n\tif (this._vnode) {\n\t\tif (callback) {\n\t\t\tthis._stateCallbacks.push(callback);\n\t\t}\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nBaseComponent.prototype.forceUpdate = function (callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](https://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {ComponentChildren | void}\n */\nBaseComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == NULL) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._index + 1)\n\t\t\t: NULL;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != NULL && sibling._dom != NULL) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : NULL;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet oldVNode = component._vnode,\n\t\toldDom = oldVNode._dom,\n\t\tcommitQueue = [],\n\t\trefQueue = [];\n\n\tif (component._parentDom) {\n\t\tconst newVNode = assign({}, oldVNode);\n\t\tnewVNode._original = oldVNode._original + 1;\n\t\tif (options.vnode) options.vnode(newVNode);\n\n\t\tdiff(\n\t\t\tcomponent._parentDom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tcomponent._parentDom.namespaceURI,\n\t\t\toldVNode._flags & MODE_HYDRATE ? [oldDom] : NULL,\n\t\t\tcommitQueue,\n\t\t\toldDom == NULL ? getDomSibling(oldVNode) : oldDom,\n\t\t\t!!(oldVNode._flags & MODE_HYDRATE),\n\t\t\trefQueue\n\t\t);\n\n\t\tnewVNode._original = oldVNode._original;\n\t\tnewVNode._parent._children[newVNode._index] = newVNode;\n\t\tcommitRoot(commitQueue, newVNode, refQueue);\n\t\toldVNode._dom = oldVNode._parent = null;\n\n\t\tif (newVNode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(newVNode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != NULL && vnode._component != NULL) {\n\t\tvnode._dom = vnode._component.base = NULL;\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child != NULL && child._dom != NULL) {\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array<import('./internal').Component>}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\nconst defer =\n\ttypeof Promise == 'function'\n\t\t? Promise.prototype.then.bind(Promise.resolve())\n\t\t: setTimeout;\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce != options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || defer)(process);\n\t}\n}\n\n/**\n * @param {import('./internal').Component} a\n * @param {import('./internal').Component} b\n */\nconst depthSort = (a, b) => a._vnode._depth - b._vnode._depth;\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\tlet c,\n\t\tl = 1;\n\n\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t// process() calls from getting scheduled while `queue` is still being consumed.\n\twhile (rerenderQueue.length) {\n\t\t// Keep the rerender queue sorted by (depth, insertion order). The queue\n\t\t// will initially be sorted on the first iteration only if it has more than 1 item.\n\t\t//\n\t\t// New items can be added to the queue e.g. when rerendering a provider, so we want to\n\t\t// keep the order from top to bottom with those new items so we can handle them in a\n\t\t// single pass\n\t\tif (rerenderQueue.length > l) {\n\t\t\trerenderQueue.sort(depthSort);\n\t\t}\n\n\t\tc = rerenderQueue.shift();\n\t\tl = rerenderQueue.length;\n\n\t\tif (c._dirty) {\n\t\t\trenderComponent(c);\n\t\t}\n\t}\n\tprocess._rerenderCount = 0;\n}\n\nprocess._rerenderCount = 0;\n", "import { IS_NON_DIMENSIONAL, NULL, SVG_NAMESPACE } from '../constants';\nimport options from '../options';\n\nfunction setStyle(style, key, value) {\n\tif (key[0] == '-') {\n\t\tstyle.setProperty(key, value == NULL ? '' : value);\n\t} else if (value == NULL) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\n\t}\n}\n\nconst CAPTURE_REGEX = /(PointerCapture)$|Capture$/i;\n\n// A logical clock to solve issues like https://github.com/preactjs/preact/issues/3927.\n// When the DOM performs an event it leaves micro-ticks in between bubbling up which means that\n// an event can trigger on a newly reated DOM-node while the event bubbles up.\n//\n// Originally inspired by Vue\n// (https://github.com/vuejs/core/blob/caeb8a68811a1b0f79/packages/runtime-dom/src/modules/events.ts#L90-L101),\n// but modified to use a logical clock instead of Date.now() in case event handlers get attached\n// and events get dispatched during the same millisecond.\n//\n// The clock is incremented after each new event dispatch. This allows 1 000 000 new events\n// per second for over 280 years before the value reaches Number.MAX_SAFE_INTEGER (2**53 - 1).\nlet eventClock = 0;\n\n/**\n * Set a property value on a DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to modify\n * @param {string} name The name of the property to set\n * @param {*} value The value to set the property to\n * @param {*} oldValue The old value the property had\n * @param {string} namespace Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, namespace) {\n\tlet useCapture;\n\n\to: if (name == 'style') {\n\t\tif (typeof value == 'string') {\n\t\t\tdom.style.cssText = value;\n\t\t} else {\n\t\t\tif (typeof oldValue == 'string') {\n\t\t\t\tdom.style.cssText = oldValue = '';\n\t\t\t}\n\n\t\t\tif (oldValue) {\n\t\t\t\tfor (name in oldValue) {\n\t\t\t\t\tif (!(value && name in value)) {\n\t\t\t\t\t\tsetStyle(dom.style, name, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tfor (name in value) {\n\t\t\t\t\tif (!oldValue || value[name] != oldValue[name]) {\n\t\t\t\t\t\tsetStyle(dom.style, name, value[name]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6\n\telse if (name[0] == 'o' && name[1] == 'n') {\n\t\tuseCapture = name != (name = name.replace(CAPTURE_REGEX, '$1'));\n\t\tconst lowerCaseName = name.toLowerCase();\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (lowerCaseName in dom || name == 'onFocusOut' || name == 'onFocusIn')\n\t\t\tname = lowerCaseName.slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._listeners[name + useCapture] = value;\n\n\t\tif (value) {\n\t\t\tif (!oldValue) {\n\t\t\t\tvalue._attached = eventClock;\n\t\t\t\tdom.addEventListener(\n\t\t\t\t\tname,\n\t\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\t\tuseCapture\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tvalue._attached = oldValue._attached;\n\t\t\t}\n\t\t} else {\n\t\t\tdom.removeEventListener(\n\t\t\t\tname,\n\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\tuseCapture\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (namespace == SVG_NAMESPACE) {\n\t\t\t// Normalize incorrect prop usage for SVG:\n\t\t\t// - xlink:href / xlinkHref --> href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname != 'width' &&\n\t\t\tname != 'height' &&\n\t\t\tname != 'href' &&\n\t\t\tname != 'list' &&\n\t\t\tname != 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname != 'tabIndex' &&\n\t\t\tname != 'download' &&\n\t\t\tname != 'rowSpan' &&\n\t\t\tname != 'colSpan' &&\n\t\t\tname != 'role' &&\n\t\t\tname != 'popover' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == NULL ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// aria- and data- attributes have no boolean representation.\n\t\t// A `false` value is different from the attribute not being\n\t\t// present, so we can't remove it. For non-boolean aria\n\t\t// attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost too many bytes. On top of\n\t\t// that other frameworks generally stringify `false`.\n\n\t\tif (typeof value == 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (value != NULL && (value !== false || name[4] == '-')) {\n\t\t\tdom.setAttribute(name, name == 'popover' && value == true ? '' : value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Create an event proxy function.\n * @param {boolean} useCapture Is the event handler for the capture phase.\n * @private\n */\nfunction createEventProxy(useCapture) {\n\t/**\n\t * Proxy an event to hooked event handlers\n\t * @param {import('../internal').PreactEvent} e The event object from the browser\n\t * @private\n\t */\n\treturn function (e) {\n\t\tif (this._listeners) {\n\t\t\tconst eventHandler = this._listeners[e.type + useCapture];\n\t\t\tif (e._dispatched == NULL) {\n\t\t\t\te._dispatched = eventClock++;\n\n\t\t\t\t// When `e._dispatched` is smaller than the time when the targeted event\n\t\t\t\t// handler was attached we know we have bubbled up to an element that was added\n\t\t\t\t// during patching the DOM.\n\t\t\t} else if (e._dispatched < eventHandler._attached) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn eventHandler(options.event ? options.event(e) : e);\n\t\t}\n\t};\n}\n\nconst eventProxy = createEventProxy(false);\nconst eventProxyCapture = createEventProxy(true);\n", "import { enqueueRender } from './component';\nimport { NULL } from './constants';\n\nexport let i = 0;\n\nexport function createContext(defaultValue) {\n\tfunction Context(props) {\n\t\tif (!this.getChildContext) {\n\t\t\t/** @type {Set<import('./internal').Component> | null} */\n\t\t\tlet subs = new Set();\n\t\t\tlet ctx = {};\n\t\t\tctx[Context._id] = this;\n\n\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\tthis.componentWillUnmount = () => {\n\t\t\t\tsubs = NULL;\n\t\t\t};\n\n\t\t\tthis.shouldComponentUpdate = function (_props) {\n\t\t\t\t// @ts-expect-error even\n\t\t\t\tif (this.props.value != _props.value) {\n\t\t\t\t\tsubs.forEach(c => {\n\t\t\t\t\t\tc._force = true;\n\t\t\t\t\t\tenqueueRender(c);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.sub = c => {\n\t\t\t\tsubs.add(c);\n\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\tif (subs) {\n\t\t\t\t\t\tsubs.delete(c);\n\t\t\t\t\t}\n\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\treturn props.children;\n\t}\n\n\tContext._id = '__cC' + i++;\n\tContext._defaultValue = defaultValue;\n\n\t/** @type {import('./internal').FunctionComponent} */\n\tContext.Consumer = (props, contextValue) => {\n\t\treturn props.children(contextValue);\n\t};\n\n\t// we could also get rid of _contextRef entirely\n\tContext.Provider =\n\t\tContext._contextRef =\n\t\tContext.Consumer.contextType =\n\t\t\tContext;\n\n\treturn Context;\n}\n", "import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport {\n\tEMPTY_OBJ,\n\tEMPTY_ARR,\n\tINSERT_VNODE,\n\tMATCHED,\n\tUNDEFINED,\n\tNULL\n} from '../constants';\nimport { isArray } from '../util';\nimport { getDomSibling } from '../component';\n\n/**\n * @typedef {import('../internal').ComponentChildren} ComponentChildren\n * @typedef {import('../internal').Component} Component\n * @typedef {import('../internal').PreactElement} PreactElement\n * @typedef {import('../internal').VNode} VNode\n */\n\n/**\n * Diff the children of a virtual node\n * @param {PreactElement} parentDom The DOM element whose children are being\n * diffed\n * @param {ComponentChildren[]} renderResult\n * @param {VNode} newParentVNode The new virtual node whose children should be\n * diff'ed against oldParentVNode\n * @param {VNode} oldParentVNode The old virtual node whose children should be\n * diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array<PreactElement>} excessDomChildren\n * @param {Array<Component>} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\tlet i,\n\t\t/** @type {VNode} */\n\t\toldVNode,\n\t\t/** @type {VNode} */\n\t\tchildVNode,\n\t\t/** @type {PreactElement} */\n\t\tnewDom,\n\t\t/** @type {PreactElement} */\n\t\tfirstChildDom;\n\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\t/** @type {VNode[]} */\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet newChildrenLength = renderResult.length;\n\n\toldDom = constructNewChildrenArray(\n\t\tnewParentVNode,\n\t\trenderResult,\n\t\toldChildren,\n\t\toldDom,\n\t\tnewChildrenLength\n\t);\n\n\tfor (i = 0; i < newChildrenLength; i++) {\n\t\tchildVNode = newParentVNode._children[i];\n\t\tif (childVNode == NULL) continue;\n\n\t\t// At this point, constructNewChildrenArray has assigned _index to be the\n\t\t// matchingIndex for this VNode's oldVNode (or -1 if there is no oldVNode).\n\t\tif (childVNode._index == -1) {\n\t\t\toldVNode = EMPTY_OBJ;\n\t\t} else {\n\t\t\toldVNode = oldChildren[childVNode._index] || EMPTY_OBJ;\n\t\t}\n\n\t\t// Update childVNode._index to its final index\n\t\tchildVNode._index = i;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tlet result = diff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating,\n\t\t\trefQueue\n\t\t);\n\n\t\t// Adjust DOM nodes\n\t\tnewDom = childVNode._dom;\n\t\tif (childVNode.ref && oldVNode.ref != childVNode.ref) {\n\t\t\tif (oldVNode.ref) {\n\t\t\t\tapplyRef(oldVNode.ref, NULL, childVNode);\n\t\t\t}\n\t\t\trefQueue.push(\n\t\t\t\tchildVNode.ref,\n\t\t\t\tchildVNode._component || newDom,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t}\n\n\t\tif (firstChildDom == NULL && newDom != NULL) {\n\t\t\tfirstChildDom = newDom;\n\t\t}\n\n\t\tlet shouldPlace = !!(childVNode._flags & INSERT_VNODE);\n\t\tif (shouldPlace || oldVNode._children === childVNode._children) {\n\t\t\toldDom = insert(childVNode, oldDom, parentDom, shouldPlace);\n\t\t} else if (typeof childVNode.type == 'function' && result !== UNDEFINED) {\n\t\t\toldDom = result;\n\t\t} else if (newDom) {\n\t\t\toldDom = newDom.nextSibling;\n\t\t}\n\n\t\t// Unset diffing flags\n\t\tchildVNode._flags &= ~(INSERT_VNODE | MATCHED);\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\treturn oldDom;\n}\n\n/**\n * @param {VNode} newParentVNode\n * @param {ComponentChildren[]} renderResult\n * @param {VNode[]} oldChildren\n */\nfunction constructNewChildrenArray(\n\tnewParentVNode,\n\trenderResult,\n\toldChildren,\n\toldDom,\n\tnewChildrenLength\n) {\n\t/** @type {number} */\n\tlet i;\n\t/** @type {VNode} */\n\tlet childVNode;\n\t/** @type {VNode} */\n\tlet oldVNode;\n\n\tlet oldChildrenLength = oldChildren.length,\n\t\tremainingOldChildren = oldChildrenLength;\n\n\tlet skew = 0;\n\n\tnewParentVNode._children = new Array(newChildrenLength);\n\tfor (i = 0; i < newChildrenLength; i++) {\n\t\t// @ts-expect-error We are reusing the childVNode variable to hold both the\n\t\t// pre and post normalized childVNode\n\t\tchildVNode = renderResult[i];\n\n\t\tif (\n\t\t\tchildVNode == NULL ||\n\t\t\ttypeof childVNode == 'boolean' ||\n\t\t\ttypeof childVNode == 'function'\n\t\t) {\n\t\t\tnewParentVNode._children[i] = NULL;\n\t\t\tcontinue;\n\t\t}\n\t\t// If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint' ||\n\t\t\tchildVNode.constructor == String\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tNULL,\n\t\t\t\tchildVNode,\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (childVNode.constructor == UNDEFINED && childVNode._depth > 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse = <div />\n\t\t\t// <div>{reuse}<span />{reuse}</div>\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tchildVNode.ref ? childVNode.ref : NULL,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\tconst skewedIndex = i + skew;\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Temporarily store the matchingIndex on the _index property so we can pull\n\t\t// out the oldVNode in diffChildren. We'll override this to the VNode's\n\t\t// final index after using this property to get the oldVNode\n\t\tconst matchingIndex = (childVNode._index = findMatchingIndex(\n\t\t\tchildVNode,\n\t\t\toldChildren,\n\t\t\tskewedIndex,\n\t\t\tremainingOldChildren\n\t\t));\n\n\t\toldVNode = NULL;\n\t\tif (matchingIndex != -1) {\n\t\t\toldVNode = oldChildren[matchingIndex];\n\t\t\tremainingOldChildren--;\n\t\t\tif (oldVNode) {\n\t\t\t\toldVNode._flags |= MATCHED;\n\t\t\t}\n\t\t}\n\n\t\t// Here, we define isMounting for the purposes of the skew diffing\n\t\t// algorithm. Nodes that are unsuspending are considered mounting and we detect\n\t\t// this by checking if oldVNode._original == null\n\t\tconst isMounting = oldVNode == NULL || oldVNode._original == NULL;\n\n\t\tif (isMounting) {\n\t\t\tif (matchingIndex == -1) {\n\t\t\t\t// When the array of children is growing we need to decrease the skew\n\t\t\t\t// as we are adding a new element to the array.\n\t\t\t\t// Example:\n\t\t\t\t// [1, 2, 3] --> [0, 1, 2, 3]\n\t\t\t\t// oldChildren newChildren\n\t\t\t\t//\n\t\t\t\t// The new element is at index 0, so our skew is 0,\n\t\t\t\t// we need to decrease the skew as we are adding a new element.\n\t\t\t\t// The decrease will cause us to compare the element at position 1\n\t\t\t\t// with value 1 with the element at position 0 with value 0.\n\t\t\t\t//\n\t\t\t\t// A linear concept is applied when the array is shrinking,\n\t\t\t\t// if the length is unchanged we can assume that no skew\n\t\t\t\t// changes are needed.\n\t\t\t\tif (newChildrenLength > oldChildrenLength) {\n\t\t\t\t\tskew--;\n\t\t\t\t} else if (newChildrenLength < oldChildrenLength) {\n\t\t\t\t\tskew++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we are mounting a DOM VNode, mark it for insertion\n\t\t\tif (typeof childVNode.type != 'function') {\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\n\t\t\t}\n\t\t} else if (matchingIndex != skewedIndex) {\n\t\t\t// When we move elements around i.e. [0, 1, 2] --> [1, 0, 2]\n\t\t\t// --> we diff 1, we find it at position 1 while our skewed index is 0 and our skew is 0\n\t\t\t// we set the skew to 1 as we found an offset.\n\t\t\t// --> we diff 0, we find it at position 0 while our skewed index is at 2 and our skew is 1\n\t\t\t// this makes us increase the skew again.\n\t\t\t// --> we diff 2, we find it at position 2 while our skewed index is at 4 and our skew is 2\n\t\t\t//\n\t\t\t// this becomes an optimization question where currently we see a 1 element offset as an insertion\n\t\t\t// or deletion i.e. we optimize for [0, 1, 2] --> [9, 0, 1, 2]\n\t\t\t// while a more than 1 offset we see as a swap.\n\t\t\t// We could probably build heuristics for having an optimized course of action here as well, but\n\t\t\t// might go at the cost of some bytes.\n\t\t\t//\n\t\t\t// If we wanted to optimize for i.e. only swaps we'd just do the last two code-branches and have\n\t\t\t// only the first item be a re-scouting and all the others fall in their skewed counter-part.\n\t\t\t// We could also further optimize for swaps\n\t\t\tif (matchingIndex == skewedIndex - 1) {\n\t\t\t\tskew--;\n\t\t\t} else if (matchingIndex == skewedIndex + 1) {\n\t\t\t\tskew++;\n\t\t\t} else {\n\t\t\t\tif (matchingIndex > skewedIndex) {\n\t\t\t\t\tskew--;\n\t\t\t\t} else {\n\t\t\t\t\tskew++;\n\t\t\t\t}\n\n\t\t\t\t// Move this VNode's DOM if the original index (matchingIndex) doesn't\n\t\t\t\t// match the new skew index (i + new skew)\n\t\t\t\t// In the former two branches we know that it matches after skewing\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remove remaining oldChildren if there are any. Loop forwards so that as we\n\t// unmount DOM from the beginning of the oldChildren, we can adjust oldDom to\n\t// point to the next child, which needs to be the first DOM node that won't be\n\t// unmounted.\n\tif (remainingOldChildren) {\n\t\tfor (i = 0; i < oldChildrenLength; i++) {\n\t\t\toldVNode = oldChildren[i];\n\t\t\tif (oldVNode != NULL && (oldVNode._flags & MATCHED) == 0) {\n\t\t\t\tif (oldVNode._dom == oldDom) {\n\t\t\t\t\toldDom = getDomSibling(oldVNode);\n\t\t\t\t}\n\n\t\t\t\tunmount(oldVNode, oldVNode);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * @param {VNode} parentVNode\n * @param {PreactElement} oldDom\n * @param {PreactElement} parentDom\n * @param {boolean} shouldPlace\n * @returns {PreactElement}\n */\nfunction insert(parentVNode, oldDom, parentDom, shouldPlace) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\n\tif (typeof parentVNode.type == 'function') {\n\t\tlet children = parentVNode._children;\n\t\tfor (let i = 0; children && i < children.length; i++) {\n\t\t\tif (children[i]) {\n\t\t\t\t// If we enter this code path on sCU bailout, where we copy\n\t\t\t\t// oldVNode._children to newVNode._children, we need to update the old\n\t\t\t\t// children's _parent pointer to point to the newVNode (parentVNode\n\t\t\t\t// here).\n\t\t\t\tchildren[i]._parent = parentVNode;\n\t\t\t\toldDom = insert(children[i], oldDom, parentDom, shouldPlace);\n\t\t\t}\n\t\t}\n\n\t\treturn oldDom;\n\t} else if (parentVNode._dom != oldDom) {\n\t\tif (shouldPlace) {\n\t\t\tif (oldDom && parentVNode.type && !oldDom.parentNode) {\n\t\t\t\toldDom = getDomSibling(parentVNode);\n\t\t\t}\n\t\t\tparentDom.insertBefore(parentVNode._dom, oldDom || NULL);\n\t\t}\n\t\toldDom = parentVNode._dom;\n\t}\n\n\tdo {\n\t\toldDom = oldDom && oldDom.nextSibling;\n\t} while (oldDom != NULL && oldDom.nodeType == 8);\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {ComponentChildren} children The unflattened children of a virtual\n * node\n * @returns {VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == NULL || typeof children == 'boolean') {\n\t} else if (isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\n/**\n * @param {VNode} childVNode\n * @param {VNode[]} oldChildren\n * @param {number} skewedIndex\n * @param {number} remainingOldChildren\n * @returns {number}\n */\nfunction findMatchingIndex(\n\tchildVNode,\n\toldChildren,\n\tskewedIndex,\n\tremainingOldChildren\n) {\n\tconst key = childVNode.key;\n\tconst type = childVNode.type;\n\tlet oldVNode = oldChildren[skewedIndex];\n\tconst matched = oldVNode != NULL && (oldVNode._flags & MATCHED) == 0;\n\n\t// We only need to perform a search if there are more children\n\t// (remainingOldChildren) to search. However, if the oldVNode we just looked\n\t// at skewedIndex was not already used in this diff, then there must be at\n\t// least 1 other (so greater than 1) remainingOldChildren to attempt to match\n\t// against. So the following condition checks that ensuring\n\t// remainingOldChildren > 1 if the oldVNode is not already used/matched. Else\n\t// if the oldVNode was null or matched, then there could needs to be at least\n\t// 1 (aka `remainingOldChildren > 0`) children to find and compare against.\n\t//\n\t// If there is an unkeyed functional VNode, that isn't a built-in like our Fragment,\n\t// we should not search as we risk re-using state of an unrelated VNode. (reverted for now)\n\tlet shouldSearch =\n\t\t// (typeof type != 'function' || type === Fragment || key) &&\n\t\tremainingOldChildren > (matched ? 1 : 0);\n\n\tif (\n\t\t(oldVNode === NULL && childVNode.key == null) ||\n\t\t(matched && key == oldVNode.key && type == oldVNode.type)\n\t) {\n\t\treturn skewedIndex;\n\t} else if (shouldSearch) {\n\t\tlet x = skewedIndex - 1;\n\t\tlet y = skewedIndex + 1;\n\t\twhile (x >= 0 || y < oldChildren.length) {\n\t\t\tconst childIndex = x >= 0 ? x-- : y++;\n\t\t\toldVNode = oldChildren[childIndex];\n\t\t\tif (\n\t\t\t\toldVNode != NULL &&\n\t\t\t\t(oldVNode._flags & MATCHED) == 0 &&\n\t\t\t\tkey == oldVNode.key &&\n\t\t\t\ttype == oldVNode.type\n\t\t\t) {\n\t\t\t\treturn childIndex;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1;\n}\n", "import {\n\tEMPTY_OBJ,\n\tMATH_NAMESPACE,\n\tMODE_HYDRATE,\n\tMODE_SUSPENDED,\n\tNULL,\n\tRESET_MODE,\n\tSVG_NAMESPACE,\n\tUNDEFINED,\n\tXHTML_NAMESPACE\n} from '../constants';\nimport { BaseComponent, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { setProperty } from './props';\nimport { assign, isArray, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * @typedef {import('../internal').ComponentChildren} ComponentChildren\n * @typedef {import('../internal').Component} Component\n * @typedef {import('../internal').PreactElement} PreactElement\n * @typedef {import('../internal').VNode} VNode\n */\n\n/**\n * @template {any} T\n * @typedef {import('../internal').Ref<T>} Ref<T>\n */\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {PreactElement} parentDom The parent of the DOM element\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array<PreactElement>} excessDomChildren\n * @param {Array<Component>} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\t/** @type {any} */\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor != UNDEFINED) return NULL;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._flags & MODE_SUSPENDED) {\n\t\tisHydrating = !!(oldVNode._flags & MODE_HYDRATE);\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\touter: if (typeof newType == 'function') {\n\t\ttry {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\t\t\tconst isClassComponent =\n\t\t\t\t'prototype' in newType && newType.prototype.render;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif (isClassComponent) {\n\t\t\t\t\t// @ts-expect-error The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-expect-error Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new BaseComponent(\n\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tc.props = newProps;\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc.context = componentContext;\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (isClassComponent && c._nextState == NULL) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (isClassComponent && newType.getDerivedStateFromProps != NULL) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\t\t\tc._vnode = newVNode;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\tnewType.getDerivedStateFromProps == NULL &&\n\t\t\t\t\tc.componentWillMount != NULL\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent && c.componentDidMount != NULL) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\tnewType.getDerivedStateFromProps == NULL &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != NULL\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != NULL &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false) ||\n\t\t\t\t\tnewVNode._original == oldVNode._original\n\t\t\t\t) {\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original != oldVNode._original) {\n\t\t\t\t\t\t// When we are dealing with a bail because of sCU we have to update\n\t\t\t\t\t\t// the props, state and dirty-state.\n\t\t\t\t\t\t// when we are dealing with strict-equality we don't as the child could still\n\t\t\t\t\t\t// be dirtied see #3883\n\t\t\t\t\t\tc.props = newProps;\n\t\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t\tc._dirty = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.some(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\n\t\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t\t}\n\t\t\t\t\tc._stateCallbacks = [];\n\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != NULL) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent && c.componentDidUpdate != NULL) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._parentDom = parentDom;\n\t\t\tc._force = false;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif (isClassComponent) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t}\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != NULL) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (isClassComponent && !isNew && c.getSnapshotBeforeUpdate != NULL) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet isTopLevelFragment =\n\t\t\t\ttmp != NULL && tmp.type === Fragment && tmp.key == NULL;\n\t\t\tlet renderResult = tmp;\n\n\t\t\tif (isTopLevelFragment) {\n\t\t\t\trenderResult = cloneNode(tmp.props.children);\n\t\t\t}\n\n\t\t\toldDom = diffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tisArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnamespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._flags &= RESET_MODE;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = NULL;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tnewVNode._original = NULL;\n\t\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\t\tif (isHydrating || excessDomChildren != NULL) {\n\t\t\t\tif (e.then) {\n\t\t\t\t\tnewVNode._flags |= isHydrating\n\t\t\t\t\t\t? MODE_HYDRATE | MODE_SUSPENDED\n\t\t\t\t\t\t: MODE_SUSPENDED;\n\n\t\t\t\t\twhile (oldDom && oldDom.nodeType == 8 && oldDom.nextSibling) {\n\t\t\t\t\t\toldDom = oldDom.nextSibling;\n\t\t\t\t\t}\n\n\t\t\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = NULL;\n\t\t\t\t\tnewVNode._dom = oldDom;\n\t\t\t\t} else {\n\t\t\t\t\tfor (let i = excessDomChildren.length; i--; ) {\n\t\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t\t}\n\t\t\t\t\tmarkAsForce(newVNode);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\tif (!e.then) markAsForce(newVNode);\n\t\t\t}\n\t\t\toptions._catchError(e, newVNode, oldVNode);\n\t\t}\n\t} else if (\n\t\texcessDomChildren == NULL &&\n\t\tnewVNode._original == oldVNode._original\n\t) {\n\t\tnewVNode._children = oldVNode._children;\n\t\tnewVNode._dom = oldVNode._dom;\n\t} else {\n\t\toldDom = newVNode._dom = diffElementNodes(\n\t\t\toldVNode._dom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\tisHydrating,\n\t\t\trefQueue\n\t\t);\n\t}\n\n\tif ((tmp = options.diffed)) tmp(newVNode);\n\n\treturn newVNode._flags & MODE_SUSPENDED ? undefined : oldDom;\n}\n\nfunction markAsForce(vnode) {\n\tif (vnode && vnode._component) vnode._component._force = true;\n\tif (vnode && vnode._children) vnode._children.forEach(markAsForce);\n}\n\n/**\n * @param {Array<Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {VNode} root\n */\nexport function commitRoot(commitQueue, root, refQueue) {\n\tfor (let i = 0; i < refQueue.length; i++) {\n\t\tapplyRef(refQueue[i], refQueue[++i], refQueue[++i]);\n\t}\n\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-expect-error Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-expect-error See above comment on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\nfunction cloneNode(node) {\n\tif (\n\t\ttypeof node != 'object' ||\n\t\tnode == NULL ||\n\t\t(node._depth && node._depth > 0)\n\t) {\n\t\treturn node;\n\t}\n\n\tif (isArray(node)) {\n\t\treturn node.map(cloneNode);\n\t}\n\n\treturn assign({}, node);\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {PreactElement} dom The DOM element representing the virtual nodes\n * being diffed\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array<PreactElement>} excessDomChildren\n * @param {Array<Component>} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n * @returns {PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating,\n\trefQueue\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = /** @type {string} */ (newVNode.type);\n\t/** @type {any} */\n\tlet i;\n\t/** @type {{ __html?: string }} */\n\tlet newHtml;\n\t/** @type {{ __html?: string }} */\n\tlet oldHtml;\n\t/** @type {ComponentChildren} */\n\tlet newChildren;\n\tlet value;\n\tlet inputValue;\n\tlet checked;\n\n\t// Tracks entering and exiting namespaces when descending through the tree.\n\tif (nodeType == 'svg') namespace = SVG_NAMESPACE;\n\telse if (nodeType == 'math') namespace = MATH_NAMESPACE;\n\telse if (!namespace) namespace = XHTML_NAMESPACE;\n\n\tif (excessDomChildren != NULL) {\n\t\tfor (i = 0; i < excessDomChildren.length; i++) {\n\t\t\tvalue = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tvalue &&\n\t\t\t\t'setAttribute' in value == !!nodeType &&\n\t\t\t\t(nodeType ? value.localName == nodeType : value.nodeType == 3)\n\t\t\t) {\n\t\t\t\tdom = value;\n\t\t\t\texcessDomChildren[i] = NULL;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == NULL) {\n\t\tif (nodeType == NULL) {\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tdom = document.createElementNS(\n\t\t\tnamespace,\n\t\t\tnodeType,\n\t\t\tnewProps.is && newProps\n\t\t);\n\n\t\t// we are creating a new node, so we can assume this is a new subtree (in\n\t\t// case we are hydrating), this deopts the hydrate\n\t\tif (isHydrating) {\n\t\t\tif (options._hydrationMismatch)\n\t\t\t\toptions._hydrationMismatch(newVNode, excessDomChildren);\n\t\t\tisHydrating = false;\n\t\t}\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = NULL;\n\t}\n\n\tif (nodeType == NULL) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data != newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\n\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\n\n\t\t// If we are in a situation where we are not hydrating but are using\n\t\t// existing DOM (e.g. replaceNode) we should read the existing DOM\n\t\t// attributes to diff them\n\t\tif (!isHydrating && excessDomChildren != NULL) {\n\t\t\toldProps = {};\n\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\tvalue = dom.attributes[i];\n\t\t\t\toldProps[value.name] = value.value;\n\t\t\t}\n\t\t}\n\n\t\tfor (i in oldProps) {\n\t\t\tvalue = oldProps[i];\n\t\t\tif (i == 'children') {\n\t\t\t} else if (i == 'dangerouslySetInnerHTML') {\n\t\t\t\toldHtml = value;\n\t\t\t} else if (!(i in newProps)) {\n\t\t\t\tif (\n\t\t\t\t\t(i == 'value' && 'defaultValue' in newProps) ||\n\t\t\t\t\t(i == 'checked' && 'defaultChecked' in newProps)\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tsetProperty(dom, i, NULL, value, namespace);\n\t\t\t}\n\t\t}\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tfor (i in newProps) {\n\t\t\tvalue = newProps[i];\n\t\t\tif (i == 'children') {\n\t\t\t\tnewChildren = value;\n\t\t\t} else if (i == 'dangerouslySetInnerHTML') {\n\t\t\t\tnewHtml = value;\n\t\t\t} else if (i == 'value') {\n\t\t\t\tinputValue = value;\n\t\t\t} else if (i == 'checked') {\n\t\t\t\tchecked = value;\n\t\t\t} else if (\n\t\t\t\t(!isHydrating || typeof value == 'function') &&\n\t\t\t\toldProps[i] !== value\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, value, oldProps[i], namespace);\n\t\t\t}\n\t\t}\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\tif (\n\t\t\t\t!isHydrating &&\n\t\t\t\t(!oldHtml ||\n\t\t\t\t\t(newHtml.__html != oldHtml.__html && newHtml.__html != dom.innerHTML))\n\t\t\t) {\n\t\t\t\tdom.innerHTML = newHtml.__html;\n\t\t\t}\n\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\tif (oldHtml) dom.innerHTML = '';\n\n\t\t\tdiffChildren(\n\t\t\t\t// @ts-expect-error\n\t\t\t\tnewVNode.type == 'template' ? dom.content : dom,\n\t\t\t\tisArray(newChildren) ? newChildren : [newChildren],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnodeType == 'foreignObject' ? XHTML_NAMESPACE : namespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != NULL) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// As above, don't diff props during hydration\n\t\tif (!isHydrating) {\n\t\t\ti = 'value';\n\t\t\tif (nodeType == 'progress' && inputValue == NULL) {\n\t\t\t\tdom.removeAttribute('value');\n\t\t\t} else if (\n\t\t\t\tinputValue != UNDEFINED &&\n\t\t\t\t// #2756 For the <progress>-element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(inputValue !== dom[i] ||\n\t\t\t\t\t(nodeType == 'progress' && !inputValue) ||\n\t\t\t\t\t// This is only for IE 11 to fix <select> value not being updated.\n\t\t\t\t\t// To avoid a stale select value we need to set the option.value\n\t\t\t\t\t// again, which triggers IE11 to re-evaluate the select value\n\t\t\t\t\t(nodeType == 'option' && inputValue != oldProps[i]))\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, inputValue, oldProps[i], namespace);\n\t\t\t}\n\n\t\t\ti = 'checked';\n\t\t\tif (checked != UNDEFINED && checked != dom[i]) {\n\t\t\t\tsetProperty(dom, i, checked, oldProps[i], namespace);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n/**\n * Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {Ref<any> & { _unmount?: unknown }} ref\n * @param {any} value\n * @param {VNode} vnode\n */\nexport function applyRef(ref, value, vnode) {\n\ttry {\n\t\tif (typeof ref == 'function') {\n\t\t\tlet hasRefUnmount = typeof ref._unmount == 'function';\n\t\t\tif (hasRefUnmount) {\n\t\t\t\t// @ts-ignore TS doesn't like moving narrowing checks into variables\n\t\t\t\tref._unmount();\n\t\t\t}\n\n\t\t\tif (!hasRefUnmount || value != NULL) {\n\t\t\t\t// Store the cleanup function on the function\n\t\t\t\t// instance object itself to avoid shape\n\t\t\t\t// transitioning vnode\n\t\t\t\tref._unmount = ref(value);\n\t\t\t}\n\t\t} else ref.current = value;\n\t} catch (e) {\n\t\toptions._catchError(e, vnode);\n\t}\n}\n\n/**\n * Unmount a virtual node from the tree and apply DOM changes\n * @param {VNode} vnode The virtual node to unmount\n * @param {VNode} parentVNode The parent of the VNode that initiated the unmount\n * @param {boolean} [skipRemove] Flag that indicates that a parent node of the\n * current element is already detached from the DOM.\n */\nexport function unmount(vnode, parentVNode, skipRemove) {\n\tlet r;\n\tif (options.unmount) options.unmount(vnode);\n\n\tif ((r = vnode.ref)) {\n\t\tif (!r.current || r.current == vnode._dom) {\n\t\t\tapplyRef(r, NULL, parentVNode);\n\t\t}\n\t}\n\n\tif ((r = vnode._component) != NULL) {\n\t\tif (r.componentWillUnmount) {\n\t\t\ttry {\n\t\t\t\tr.componentWillUnmount();\n\t\t\t} catch (e) {\n\t\t\t\toptions._catchError(e, parentVNode);\n\t\t\t}\n\t\t}\n\n\t\tr.base = r._parentDom = NULL;\n\t}\n\n\tif ((r = vnode._children)) {\n\t\tfor (let i = 0; i < r.length; i++) {\n\t\t\tif (r[i]) {\n\t\t\t\tunmount(\n\t\t\t\t\tr[i],\n\t\t\t\t\tparentVNode,\n\t\t\t\t\tskipRemove || typeof vnode.type != 'function'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!skipRemove) {\n\t\tremoveNode(vnode._dom);\n\t}\n\n\tvnode._component = vnode._parent = vnode._dom = UNDEFINED;\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n", "import { EMPTY_OBJ, NULL } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createElement, Fragment } from './create-element';\nimport options from './options';\nimport { slice } from './util';\n\n/**\n * Render a Preact virtual node into a DOM element\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to render into\n * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\n * existing DOM tree rooted at `replaceNode`\n */\nexport function render(vnode, parentDom, replaceNode) {\n\t// https://github.com/preactjs/preact/issues/3794\n\tif (parentDom == document) {\n\t\tparentDom = document.documentElement;\n\t}\n\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\n\t// element..\n\tlet isHydrating = typeof replaceNode == 'function';\n\n\t// To be able to support calling `render()` multiple times on the same\n\t// DOM node, we need to obtain a reference to the previous tree. We do\n\t// this by assigning a new `_children` property to DOM nodes which points\n\t// to the last rendered tree. By default this property is not present, which\n\t// means that we are mounting a new tree for the first time.\n\tlet oldVNode = isHydrating\n\t\t? NULL\n\t\t: (replaceNode && replaceNode._children) || parentDom._children;\n\n\tvnode = ((!isHydrating && replaceNode) || parentDom)._children =\n\t\tcreateElement(Fragment, NULL, [vnode]);\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [],\n\t\trefQueue = [];\n\tdiff(\n\t\tparentDom,\n\t\t// Determine the new vnode tree and store it on the DOM element on\n\t\t// our custom `_children` property.\n\t\tvnode,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.namespaceURI,\n\t\t!isHydrating && replaceNode\n\t\t\t? [replaceNode]\n\t\t\t: oldVNode\n\t\t\t\t? NULL\n\t\t\t\t: parentDom.firstChild\n\t\t\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t\t\t: NULL,\n\t\tcommitQueue,\n\t\t!isHydrating && replaceNode\n\t\t\t? replaceNode\n\t\t\t: oldVNode\n\t\t\t\t? oldVNode._dom\n\t\t\t\t: parentDom.firstChild,\n\t\tisHydrating,\n\t\trefQueue\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, vnode, refQueue);\n}\n\n/**\n * Update an existing DOM element with data from a Preact virtual node\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to update\n */\nexport function hydrate(vnode, parentDom) {\n\trender(vnode, parentDom, hydrate);\n}\n", "import { assign, slice } from './util';\nimport { createVNode } from './create-element';\nimport { NULL, UNDEFINED } from './constants';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./internal').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array<import('./internal').ComponentChildren>} rest Any additional arguments will be used\n * as replacement children.\n * @returns {import('./internal').VNode}\n */\nexport function cloneElement(vnode, props, children) {\n\tlet normalizedProps = assign({}, vnode.props),\n\t\tkey,\n\t\tref,\n\t\ti;\n\n\tlet defaultProps;\n\n\tif (vnode.type && vnode.type.defaultProps) {\n\t\tdefaultProps = vnode.type.defaultProps;\n\t}\n\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse if (props[i] === UNDEFINED && defaultProps != UNDEFINED) {\n\t\t\tnormalizedProps[i] = defaultProps[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\treturn createVNode(\n\t\tvnode.type,\n\t\tnormalizedProps,\n\t\tkey || vnode.key,\n\t\tref || vnode.ref,\n\t\tNULL\n\t);\n}\n", "import { NULL } from '../constants';\n\n/**\n * Find the closest error boundary to a thrown error and call it\n * @param {object} error The thrown value\n * @param {import('../internal').VNode} vnode The vnode that threw the error that was caught (except\n * for unmounting when this parameter is the highest parent that was being\n * unmounted)\n * @param {import('../internal').VNode} [oldVNode]\n * @param {import('../internal').ErrorInfo} [errorInfo]\n */\nexport function _catchError(error, vnode, oldVNode, errorInfo) {\n\t/** @type {import('../internal').Component} */\n\tlet component,\n\t\t/** @type {import('../internal').ComponentType} */\n\t\tctor,\n\t\t/** @type {boolean} */\n\t\thandled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif ((component = vnode._component) && !component._processingException) {\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError != NULL) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch != NULL) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\t// This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.\n\t\t\t\tif (handled) {\n\t\t\t\t\treturn (component._pendingError = component);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow error;\n}\n", "import { options as _options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {import('./internal').Component} */\nlet previousComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\n// Cast to use internal Options type\nconst options = /** @type {import('./internal').Options} */ (_options);\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\nlet oldRoot = options._root;\n\n// We take the minimum timeout for requestAnimationFrame to ensure that\n// the callback is invoked after the next frame. 35ms is based on a 30hz\n// refresh rate, which is the minimum rate for a smooth user experience.\nconst RAF_TIMEOUT = 35;\nlet prevRaf;\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions._diff = vnode => {\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._root = (vnode, parentDom) => {\n\tif (vnode && parentDom._children && parentDom._children._mask) {\n\t\tvnode._mask = parentDom._children._mask;\n\t}\n\n\tif (oldRoot) oldRoot(vnode, parentDom);\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\tif (previousComponent === currentComponent) {\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentComponent._renderCallbacks = [];\n\t\t\thooks._list.forEach(hookItem => {\n\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t}\n\t\t\t\thookItem._pendingArgs = hookItem._nextValue = undefined;\n\t\t\t});\n\t\t} else {\n\t\t\thooks._pendingEffects.forEach(invokeCleanup);\n\t\t\thooks._pendingEffects.forEach(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentIndex = 0;\n\t\t}\n\t}\n\tpreviousComponent = currentComponent;\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tif (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));\n\t\tc.__hooks._list.forEach(hookItem => {\n\t\t\tif (hookItem._pendingArgs) {\n\t\t\t\thookItem._args = hookItem._pendingArgs;\n\t\t\t}\n\t\t\thookItem._pendingArgs = undefined;\n\t\t});\n\t}\n\tpreviousComponent = currentComponent = null;\n};\n\n// TODO: Improve typing of commitQueue parameter\n/** @type {(vnode: import('./internal').VNode, commitQueue: any) => void} */\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.forEach(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.forEach(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tc.__hooks = undefined;\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({});\n\t}\n\n\treturn hooks._list[index];\n}\n\n/**\n * @template {unknown} S\n * @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} [initialState]\n * @returns {[S, (state: S) => void]}\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @template {unknown} S\n * @template {unknown} A\n * @param {import('./index').Reducer<S, A>} reducer\n * @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ S, (state: S) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst currentValue = hookState._nextValue\n\t\t\t\t\t? hookState._nextValue[0]\n\t\t\t\t\t: hookState._value[0];\n\t\t\t\tconst nextValue = hookState._reducer(currentValue, action);\n\n\t\t\t\tif (currentValue !== nextValue) {\n\t\t\t\t\thookState._nextValue = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\n\t\tif (!currentComponent._hasScuFromHooks) {\n\t\t\tcurrentComponent._hasScuFromHooks = true;\n\t\t\tlet prevScu = currentComponent.shouldComponentUpdate;\n\t\t\tconst prevCWU = currentComponent.componentWillUpdate;\n\n\t\t\t// If we're dealing with a forced update `shouldComponentUpdate` will\n\t\t\t// not be called. But we use that to update the hook values, so we\n\t\t\t// need to call it.\n\t\t\tcurrentComponent.componentWillUpdate = function (p, s, c) {\n\t\t\t\tif (this._force) {\n\t\t\t\t\tlet tmp = prevScu;\n\t\t\t\t\t// Clear to avoid other sCU hooks from being called\n\t\t\t\t\tprevScu = undefined;\n\t\t\t\t\tupdateHookState(p, s, c);\n\t\t\t\t\tprevScu = tmp;\n\t\t\t\t}\n\n\t\t\t\tif (prevCWU) prevCWU.call(this, p, s, c);\n\t\t\t};\n\n\t\t\t// This SCU has the purpose of bailing out after repeated updates\n\t\t\t// to stateful hooks.\n\t\t\t// we store the next value in _nextValue[0] and keep doing that for all\n\t\t\t// state setters, if we have next states and\n\t\t\t// all next states within a component end up being equal to their original state\n\t\t\t// we are safe to bail out for this specific component.\n\t\t\t/**\n\t\t\t *\n\t\t\t * @type {import('./internal').Component[\"shouldComponentUpdate\"]}\n\t\t\t */\n\t\t\t// @ts-ignore - We don't use TS to downtranspile\n\t\t\t// eslint-disable-next-line no-inner-declarations\n\t\t\tfunction updateHookState(p, s, c) {\n\t\t\t\tif (!hookState._component.__hooks) return true;\n\n\t\t\t\t/** @type {(x: import('./internal').HookState) => x is import('./internal').ReducerHookState} */\n\t\t\t\tconst isStateHook = x => !!x._component;\n\t\t\t\tconst stateHooks =\n\t\t\t\t\thookState._component.__hooks._list.filter(isStateHook);\n\n\t\t\t\tconst allHooksEmpty = stateHooks.every(x => !x._nextValue);\n\t\t\t\t// When we have no updated hooks in the component we invoke the previous SCU or\n\t\t\t\t// traverse the VDOM tree further.\n\t\t\t\tif (allHooksEmpty) {\n\t\t\t\t\treturn prevScu ? prevScu.call(this, p, s, c) : true;\n\t\t\t\t}\n\n\t\t\t\t// We check whether we have components with a nextValue set that\n\t\t\t\t// have values that aren't equal to one another this pushes\n\t\t\t\t// us to update further down the tree\n\t\t\t\tlet shouldUpdate = hookState._component.props !== p;\n\t\t\t\tstateHooks.forEach(hookItem => {\n\t\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\t\tconst currentValue = hookItem._value[0];\n\t\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t\t\thookItem._nextValue = undefined;\n\t\t\t\t\t\tif (currentValue !== hookItem._value[0]) shouldUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn prevScu\n\t\t\t\t\t? prevScu.call(this, p, s, c) || shouldUpdate\n\t\t\t\t\t: shouldUpdate;\n\t\t\t}\n\n\t\t\tcurrentComponent.shouldComponentUpdate = updateHookState;\n\t\t}\n\t}\n\n\treturn hookState._nextValue || hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\n/** @type {(initialValue: unknown) => unknown} */\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tconst result = ref(createHandle());\n\t\t\t\treturn () => {\n\t\t\t\t\tref(null);\n\t\t\t\t\tif (result && typeof result == 'function') result();\n\t\t\t\t};\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () => (ref.current = null);\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @template {unknown} T\n * @param {() => T} factory\n * @param {unknown[]} args\n * @returns {T}\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState<T>} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._value = factory();\n\t\tstate._args = args;\n\t\tstate._factory = factory;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {unknown[]} args\n * @returns {() => void}\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(\n\t\t\tformatter ? formatter(value) : /** @type {any}*/ (value)\n\t\t);\n\t}\n}\n\n/**\n * @param {(error: unknown, errorInfo: import('preact').ErrorInfo) => void} cb\n * @returns {[unknown, () => void]}\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = (err, errorInfo) => {\n\t\t\tif (state._value) state._value(err, errorInfo);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\n/** @type {() => string} */\nexport function useId() {\n\t/** @type {import('./internal').IdHookState} */\n\tconst state = getHookState(currentIndex++, 11);\n\tif (!state._value) {\n\t\t// Grab either the root node or the nearest async boundary node.\n\t\t/** @type {import('./internal').VNode} */\n\t\tlet root = currentComponent._vnode;\n\t\twhile (root !== null && !root._mask && root._parent !== null) {\n\t\t\troot = root._parent;\n\t\t}\n\n\t\tlet mask = root._mask || (root._mask = [0, 0]);\n\t\tstate._value = 'P' + mask[0] + '-' + mask[1]++;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tif (!component._parentDom || !component.__hooks) continue;\n\t\ttry {\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeCleanup);\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeEffect);\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n * @returns {void}\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').HookState} hook\n * @returns {void}\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n * @returns {void}\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {unknown[]} oldArgs\n * @param {unknown[]} newArgs\n * @returns {boolean}\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\n/**\n * @template Arg\n * @param {Arg} arg\n * @param {(arg: Arg) => any} f\n * @returns {any}\n */\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n", "const ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '&quot;';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&amp;';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '&lt;';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out += str.slice(last, i);\n\t\tout += ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out += str.slice(last, i);\n\treturn out;\n}\n", "/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 1;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n", "import { options, Fragment } from 'preact';\nimport { encodeEntities } from './utils';\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\n\nlet vnodeId = 0;\n\nconst isArray = Array.isArray;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {unknown} [isStaticChildren]\n * @param {unknown} [__source]\n * @param {unknown} [__self]\n */\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\n\tif (!props) props = {};\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = props,\n\t\tref,\n\t\ti;\n\n\tif ('ref' in normalizedProps) {\n\t\tnormalizedProps = {};\n\t\tfor (i in props) {\n\t\t\tif (i == 'ref') {\n\t\t\t\tref = props[i];\n\t\t\t} else {\n\t\t\t\tnormalizedProps[i] = props[i];\n\t\t\t}\n\t\t}\n\t}\n\n\t/** @type {VNode & { __source: any; __self: any }} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_component: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t_index: -1,\n\t\t_flags: 0,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\n/**\n * Create a template vnode. This function is not expected to be\n * used directly, but rather through a precompile JSX transform\n * @param {string[]} templates\n * @param {Array<string | null | VNode>} exprs\n * @returns {VNode}\n */\nfunction jsxTemplate(templates, ...exprs) {\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\n\t// Bypass render to string top level Fragment optimization\n\tvnode.key = vnode._vnode;\n\treturn vnode;\n}\n\nconst JS_TO_CSS = {};\nconst CSS_REGEX = /[A-Z]/g;\n\n/**\n * Unwrap potential signals.\n * @param {*} value\n * @returns {*}\n */\nfunction normalizeAttrValue(value) {\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.valueOf === 'function'\n\t\t? value.valueOf()\n\t\t: value;\n}\n\n/**\n * Serialize an HTML attribute to a string. This function is not\n * expected to be used directly, but rather through a precompile\n * JSX transform\n * @param {string} name The attribute name\n * @param {*} value The attribute value\n * @returns {string}\n */\nfunction jsxAttr(name, value) {\n\tif (options.attr) {\n\t\tconst result = options.attr(name, value);\n\t\tif (typeof result === 'string') return result;\n\t}\n\n\tvalue = normalizeAttrValue(value);\n\n\tif (name === 'ref' || name === 'key') return '';\n\tif (name === 'style' && typeof value === 'object') {\n\t\tlet str = '';\n\t\tfor (let prop in value) {\n\t\t\tlet val = value[prop];\n\t\t\tif (val != null && val !== '') {\n\t\t\t\tconst name =\n\t\t\t\t\tprop[0] == '-'\n\t\t\t\t\t\t? prop\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\t\tlet suffix = ';';\n\t\t\t\tif (\n\t\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t\t// Exclude custom-attributes\n\t\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\n\t\t\t\t) {\n\t\t\t\t\tsuffix = 'px;';\n\t\t\t\t}\n\t\t\t\tstr = str + name + ':' + val + suffix;\n\t\t\t}\n\t\t}\n\t\treturn name + '=\"' + encodeEntities(str) + '\"';\n\t}\n\n\tif (\n\t\tvalue == null ||\n\t\tvalue === false ||\n\t\ttypeof value === 'function' ||\n\t\ttypeof value === 'object'\n\t) {\n\t\treturn '';\n\t} else if (value === true) return name;\n\n\treturn name + '=\"' + encodeEntities('' + value) + '\"';\n}\n\n/**\n * Escape a dynamic child passed to `jsxTemplate`. This function\n * is not expected to be used directly, but rather through a\n * precompile JSX transform\n * @param {*} value\n * @returns {string | null | VNode | Array<string | null | VNode>}\n */\nfunction jsxEscape(value) {\n\tif (\n\t\tvalue == null ||\n\t\ttypeof value === 'boolean' ||\n\t\ttypeof value === 'function'\n\t) {\n\t\treturn null;\n\t}\n\n\tif (typeof value === 'object') {\n\t\t// Check for VNode\n\t\tif (value.constructor === undefined) return value;\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t}\n\n\treturn encodeEntities('' + value);\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment,\n\t// precompiled JSX transform\n\tjsxTemplate,\n\tjsxAttr,\n\tjsxEscape\n};\n", "/** @jsxImportSource preact */\nimport { Fragment, render, type FunctionalComponent } from \"preact\";\nimport { useCallback, useEffect, useRef, useState } from \"preact/hooks\";\n\n// -- Types --\nexport type CueCardPosition = \"top-center\" | \"top-right\";\nexport type CueCardDirection = \"top-to-bottom\" | \"right-to-left\";\nexport type CueCardTheme = \"glass\" | \"light\" | \"dark\";\nexport type PersonalizationStatus =\n | \"resting\"\n | \"starting\"\n | \"success\"\n | \"error\";\n\nexport type KeyboardModifier = \"ctrl\" | \"alt\" | \"shift\" | \"meta\";\n\nexport interface CueCardKeyboardShortcut {\n key: string;\n modifiers?: KeyboardModifier[];\n}\n\nexport type LauncherActionStatus = \"loading\" | \"ready\" | \"idle\";\n\nexport interface LauncherAction {\n status: LauncherActionStatus;\n tooltip?: string;\n onClick?: () => void;\n}\n\nexport interface PersonalizationInput {\n [key: string]: string;\n}\n\nexport interface PersonalizationField {\n name: string;\n label: string;\n placeholder?: string;\n type?: \"text\" | \"email\" | \"tel\" | \"url\";\n required?: boolean;\n pattern?: string;\n minLength?: number;\n maxLength?: number;\n errorMessage?: string;\n}\n\nexport interface CueCardThemeConfig {\n fontFamily?: string;\n backgroundColor?: string;\n borderColor?: string;\n textColor?: string;\n subtitleColor?: string;\n primaryColor?: string;\n primaryTextColor?: string;\n borderRadius?: string;\n}\n\nexport interface CueCardTextConfig {\n titleResting?: string;\n titleSuccess?: string;\n titleError?: string;\n subtitleResting?: string;\n subtitleSuccess?: string;\n subtitleError?: string;\n btnResting?: string;\n btnSuccess?: string;\n btnLoading?: string;\n btnError?: string;\n launcherLabel?: string;\n launcherLabelSuccess?: string;\n launcherLabelDeanonymized?: string;\n launcherLabelDeanonymizedSuccess?: string;\n}\n\nexport type CueCardDeanonymizationProvider = \"Kenobi\";\n\nexport interface CueCardDeanonymizationConfig {\n provider: CueCardDeanonymizationProvider;\n timeoutMs?: number;\n logoUrlTemplate?: string;\n snitcher?: {\n spotterToken: string;\n profileId: string;\n apiEndpoint?: string;\n cdn?: string;\n namespace?: string;\n };\n}\n\nexport interface DeanonymizedCompany {\n name: string;\n domain?: string;\n logoUrl?: string;\n}\n\nexport interface CueCardConfig {\n position?: CueCardPosition;\n direction?: CueCardDirection;\n theme?: CueCardTheme;\n entranceDelayMs?: number;\n exitDelayMs?: number;\n fields: PersonalizationField[];\n hasPersonalization?: boolean;\n isVisible?: boolean;\n progressPct?: number;\n status?: PersonalizationStatus;\n enableTimer?: boolean;\n timerDurationMs?: number;\n\n // New config props\n customTheme?: CueCardThemeConfig;\n textOverrides?: CueCardTextConfig;\n enableFocusMode?: boolean;\n focusBlurIntensity?: string;\n focusDelayMs?: number;\n enableLauncher?: boolean;\n enableClickSheen?: boolean;\n showLauncherLogo?: boolean;\n launcherAction?: LauncherAction;\n launcherStyles?: Record<string, string>;\n launcherShineBorder?: {\n enabled: boolean;\n color?: string | string[];\n duration?: number;\n borderWidth?: number;\n };\n showKeyboardHints?: boolean;\n showWatermark?: boolean;\n keyboardShortcut?: CueCardKeyboardShortcut;\n mountMode?: \"overlay\" | \"inline\";\n mountNode?: HTMLElement;\n\n // Undo toggle feature\n enableUndoToggle?: boolean;\n isPersonalized?: boolean;\n deanonymization?: CueCardDeanonymizationConfig;\n\n onDismiss?: () => void;\n onExitComplete?: () => void;\n onEntranceComplete?: () => void;\n onSubmitPersonalization?: (values: PersonalizationInput) => void;\n onOpenChange?: (isOpen: boolean) => void;\n onTogglePersonalization?: () => void;\n}\n\n// -- Icons (Converted to light components) --\nconst ArrowRightIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n width=\"16\"\n height=\"16\"\n >\n <path d=\"M5 12h14M12 5l7 7-7 7\" />\n </svg>\n);\nconst CheckIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"16\"\n height=\"16\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 0 1 1.04-.208Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\nconst XMarkIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"16\"\n height=\"16\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\nconst LoaderIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"animate-spin\"\n >\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n);\nconst LogoIcon = () => (\n <svg\n width=\"32\"\n height=\"32\"\n viewBox=\"0 0 900 900\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"446\" cy=\"450\" r=\"424\" fill=\"black\" />\n <circle cx=\"450\" cy=\"450\" r=\"357\" fill=\"#E8E8E8\" />\n <ellipse\n cx=\"579.85\"\n cy=\"294.451\"\n rx=\"79.778\"\n ry=\"108.483\"\n transform=\"rotate(-46.2324 579.85 294.451)\"\n fill=\"black\"\n />\n </svg>\n);\nconst SparklesIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"14\"\n height=\"14\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M9 4.5a.75.75 0 0 1 .721.544l.813 2.846a3.75 3.75 0 0 0 2.576 2.576l2.846.813a.75.75 0 0 1 0 1.442l-2.846.813a3.75 3.75 0 0 0-2.576 2.576l-.813 2.846a.75.75 0 0 1-1.442 0l-.813-2.846a3.75 3.75 0 0 0-2.576-2.576l-2.846-.813a.75.75 0 0 1 0-1.442l2.846-.813A3.75 3.75 0 0 0 7.466 7.89l.813-2.846A.75.75 0 0 1 9 4.5ZM18 1.5a.75.75 0 0 1 .728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 0 1 0 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 0 1-1.456 0l-.258-1.036a2.625 2.625 0 0 0-1.91-1.91l-1.036-.258a.75.75 0 0 1 0-1.456l1.036-.258a2.625 2.625 0 0 0 1.91-1.91l.258-1.036A.75.75 0 0 1 18 1.5ZM16.5 15a.75.75 0 0 1 .712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 0 1 0 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 0 1-1.422 0l-.395-1.183a1.5 1.5 0 0 0-.948-.948l-1.183-.395a.75.75 0 0 1 0-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0 1 16.5 15Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\nconst ArrowPathIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n width=\"16\"\n height=\"16\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99\"\n />\n </svg>\n);\n\ntype SnitcherSpotterCompany = {\n id?: string;\n name?: string;\n domain?: string;\n industry?: string;\n location?: string;\n employee_range?: string;\n founded_year?: number;\n description?: string;\n geo?: {\n city?: string;\n country?: string;\n country_code?: string;\n region?: string;\n postal_code?: string;\n full_address?: string;\n address?: string;\n };\n profiles?: {\n linkedin?: { url?: string };\n twitter?: { url?: string };\n facebook?: { url?: string };\n crunchbase?: { url?: string };\n };\n};\n\ntype SnitcherSpotterResponse = {\n type?: string;\n domain?: string;\n ip?: string;\n company?: SnitcherSpotterCompany;\n};\n\ntype IdentityResolutionDetail = {\n provider?: string;\n type?: \"business\" | \"isp\" | \"unknown\";\n domain?: string | null;\n ip?: string;\n company?: {\n id?: string;\n name?: string;\n domain?: string;\n logoUrl?: string;\n industry?: string;\n location?: string;\n employeeRange?: string;\n foundedYear?: number;\n description?: string;\n geo?: {\n city?: string;\n country?: string;\n countryCode?: string;\n region?: string;\n postalCode?: string;\n address?: string;\n };\n profiles?: {\n linkedin?: string;\n twitter?: string;\n facebook?: string;\n crunchbase?: string;\n };\n };\n raw?: unknown;\n};\n\ndeclare global {\n interface Window {\n SpotterSettings?: {\n token?: string;\n callback?: (response: SnitcherSpotterResponse) => void;\n };\n Snitcher?: unknown;\n __kenobiIdentityResolution?: unknown;\n __kenobiSnitcherLoaded?: boolean;\n __kenobiSnitcherLoading?: boolean;\n }\n}\n\nconst IDENTITY_RESOLVED_EVENT = \"kenobi:identity-resolved\";\nconst KENOBI_SNITCHER_SCRIPT_ID = \"kenobi-snitcher\";\nconst DEFAULT_DEANON_TIMEOUT_MS = 1600;\n\nconst dispatchCueCardEvent = (eventName: string, detail: Record<string, unknown>) => {\n if (typeof window === \"undefined\") return;\n window.dispatchEvent(\n new CustomEvent(`kenobi:${eventName}`, {\n detail,\n bubbles: true,\n })\n );\n};\n\nconst resolveDeanonymizedCompany = (\n detail?: IdentityResolutionDetail | null\n): DeanonymizedCompany | null => {\n if (!detail || detail.type !== \"business\") return null;\n const company = detail.company;\n const name = company?.name || detail.domain || undefined;\n const domain = company?.domain || detail.domain || undefined;\n if (!name) return null;\n return {\n name,\n domain,\n logoUrl: company?.logoUrl || (domain ? `https://logo.clearbit.com/${domain}` : undefined),\n };\n};\n\nconst normalizeDomain = (value?: string) => {\n if (!value) return \"\";\n return value\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/\\/.*$/, \"\")\n .replace(/:\\d+$/, \"\")\n .replace(/^www\\./i, \"\")\n .trim()\n .toLowerCase();\n};\n\nconst ensureKenobiSnitcherLoaded = (config?: CueCardDeanonymizationConfig) => {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") return;\n if (window.__kenobiSnitcherLoaded || window.__kenobiSnitcherLoading) return;\n if (window.Snitcher || window.SpotterSettings) {\n window.__kenobiSnitcherLoaded = true;\n return;\n }\n if (document.getElementById(KENOBI_SNITCHER_SCRIPT_ID)) {\n window.__kenobiSnitcherLoaded = true;\n return;\n }\n\n const snitcher = config?.snitcher;\n if (!snitcher?.spotterToken || !snitcher.profileId) {\n return;\n }\n\n window.__kenobiSnitcherLoading = true;\n\n const resolvedLogoTemplate =\n config?.logoUrlTemplate || \"https://logo.clearbit.com/{domain}\";\n const apiEndpoint =\n snitcher.apiEndpoint ||\n `${window.location.origin}/api/snitcher-proxy/radar`;\n const cdn = snitcher.cdn || `${window.location.origin}/api/snitcher-proxy/cdn`;\n const namespace = snitcher.namespace || \"Snitcher\";\n\n const snitcherScript = `\n (function () {\n function spotterCb(response) {\n var rawDomain = (response.company && response.company.domain) || response.domain || \"\";\n var normalizedDomain = rawDomain\n .replace(/^https?:\\\\/\\\\//i, \"\")\n .replace(/\\\\/.*$/, \"\")\n .replace(/:\\\\d+$/, \"\")\n .replace(/^www\\\\./i, \"\");\n var identity = {\n provider: \"snitcher\",\n type: response.type === \"business\" ? \"business\" : \"unknown\",\n domain: response.domain || null,\n ip: response.ip,\n company: response.company\n ? {\n id: response.company.id,\n name: response.company.name || response.domain,\n domain: response.company.domain || response.domain,\n logoUrl: \"${resolvedLogoTemplate}\".replace(\"{domain}\", normalizedDomain),\n industry: response.company.industry,\n location: response.company.location,\n employeeRange: response.company.employee_range,\n foundedYear: response.company.founded_year,\n description: response.company.description,\n geo: response.company.geo\n ? {\n city: response.company.geo.city,\n country: response.company.geo.country,\n countryCode: response.company.geo.country_code,\n region: response.company.geo.region,\n postalCode: response.company.geo.postal_code,\n address:\n response.company.geo.full_address ||\n response.company.geo.address,\n }\n : undefined,\n profiles: response.company.profiles\n ? {\n linkedin: response.company.profiles.linkedin?.url,\n twitter: response.company.profiles.twitter?.url,\n facebook: response.company.profiles.facebook?.url,\n crunchbase: response.company.profiles.crunchbase?.url,\n }\n : undefined,\n }\n : undefined,\n raw: response,\n };\n\n window.__kenobiIdentityResolution = identity;\n window.dispatchEvent(\n new CustomEvent(\"${IDENTITY_RESOLVED_EVENT}\", {\n detail: identity,\n bubbles: true,\n })\n );\n }\n\n window.SpotterSettings = {\n token: \"${snitcher.spotterToken}\",\n callback: spotterCb,\n };\n\n !(function (e) {\n \"use strict\";\n var t = e && e.namespace;\n if (t && e.profileId && e.cdn) {\n var i = window[t];\n if (((i && Array.isArray(i)) || (i = window[t] = []), !i.initialized && !i._loaded))\n if (i._loaded) console && console.warn(\"[Radar] Duplicate initialization attempted\");\n else {\n i._loaded = !0;\n [\n \"track\",\n \"page\",\n \"identify\",\n \"group\",\n \"alias\",\n \"ready\",\n \"debug\",\n \"on\",\n \"off\",\n \"once\",\n \"trackClick\",\n \"trackSubmit\",\n \"trackLink\",\n \"trackForm\",\n \"pageview\",\n \"screen\",\n \"reset\",\n \"register\",\n \"setAnonymousId\",\n \"addSourceMiddleware\",\n \"addIntegrationMiddleware\",\n \"addDestinationMiddleware\",\n \"giveCookieConsent\",\n ].forEach(function (e) {\n var a;\n i[e] =\n ((a = e),\n function () {\n var e = window[t];\n if (e.initialized) return e[a].apply(e, arguments);\n var i = [].slice.call(arguments);\n return i.unshift(a), e.push(i), e;\n });\n }),\n -1 === e.apiEndpoint.indexOf(\"http\") &&\n (e.apiEndpoint = \"https://\" + e.apiEndpoint),\n (i.bootstrap = function () {\n var t,\n i = document.createElement(\"script\");\n (i.async = !0),\n (i.type = \"text/javascript\"),\n (i.id = \"__radar__\"),\n i.setAttribute(\"data-settings\", JSON.stringify(e)),\n (i.src = [\n -1 !== (t = e.cdn).indexOf(\"http\") ? \"\" : \"https://\",\n t,\n \"/releases/latest/radar.min.js\",\n ].join(\"\"));\n var a = document.scripts[0];\n a.parentNode.insertBefore(i, a);\n }),\n i.bootstrap();\n }\n } else\n \"undefined\" != typeof console &&\n console.error(\"[Radar] Configuration incomplete\");\n })({\n apiEndpoint: \"${apiEndpoint}\",\n cdn: \"${cdn}\",\n namespace: \"${namespace}\",\n profileId: \"${snitcher.profileId}\",\n });\n })();\n `;\n\n const script = document.createElement(\"script\");\n script.id = KENOBI_SNITCHER_SCRIPT_ID;\n script.type = \"text/javascript\";\n script.text = snitcherScript;\n document.head?.appendChild(script);\n window.__kenobiSnitcherLoaded = true;\n window.__kenobiSnitcherLoading = false;\n};\n\n// -- Styles --\nconst STYLES = `\n :host { --kb-font-family: system-ui, -apple-system, sans-serif; --kb-bg-container: rgba(255, 255, 255, 0.05); --kb-border-container: rgba(255, 255, 255, 0.2); --kb-shadow-container: 0 25px 50px -12px rgba(0, 0, 0, 0.25); --kb-backdrop-blur: 16px; --kb-text-title: #ffffff; --kb-text-subtitle: rgba(255, 255, 255, 0.7); --kb-btn-dismiss-bg: rgba(0, 0, 0, 0.7); --kb-btn-dismiss-border: rgba(255, 255, 255, 0.2); --kb-btn-dismiss-text: rgba(255, 255, 255, 0.8); --kb-btn-dismiss-hover-bg: rgba(0, 0, 0, 0.9); --kb-btn-dismiss-hover-text: #ffffff; --kb-btn-trigger-bg: #ffffff; --kb-btn-trigger-text: #000000; --kb-btn-trigger-hover-bg: rgba(255, 255, 255, 0.9); --kb-progress-track: rgba(255, 255, 255, 0.2); --kb-progress-indicator: #ffffff; --kb-popover-bg: rgba(255, 255, 255, 0.05); --kb-popover-border: rgba(255, 255, 255, 0.2); --kb-popover-text: #ffffff; --kb-input-bg: transparent; --kb-input-border: rgba(255, 255, 255, 0.3); --kb-input-text: #ffffff; --kb-input-placeholder: rgba(255, 255, 255, 0.6); --kb-form-label: #ffffff; --kb-success-color: #6ee7b7; --kb-error-text: #ef4444; --kb-focus-blur: 10px; --kb-kbd-bg: rgba(255, 255, 255, 0.15); --kb-kbd-border: rgba(255, 255, 255, 0.4); --kb-kbd-text: #ffffff; --kb-watermark-text: rgba(255, 255, 255, 0.4); font-family: var(--kb-font-family); }\n .theme-light { --kb-bg-container: #ffffff; --kb-border-container: #e2e8f0; --kb-shadow-container: 0 20px 25px -5px rgba(0, 0, 0, 0.1); --kb-backdrop-blur: 0px; --kb-text-title: #0f172a; --kb-text-subtitle: #475569; --kb-btn-dismiss-bg: #ffffff; --kb-btn-dismiss-border: #e2e8f0; --kb-btn-dismiss-text: #64748b; --kb-btn-dismiss-hover-bg: #f1f5f9; --kb-btn-dismiss-hover-text: #0f172a; --kb-btn-trigger-bg: #0f172a; --kb-btn-trigger-text: #ffffff; --kb-btn-trigger-hover-bg: #1e293b; --kb-progress-track: #e2e8f0; --kb-progress-indicator: #0f172a; --kb-popover-bg: #ffffff; --kb-popover-border: #e2e8f0; --kb-popover-text: #0f172a; --kb-input-bg: #ffffff; --kb-input-border: #cbd5e1; --kb-input-text: #0f172a; --kb-input-placeholder: #94a3b8; --kb-form-label: #334155; --kb-success-color: #059669; --kb-error-text: #ef4444; --kb-kbd-bg: #f1f5f9; --kb-kbd-border: #e2e8f0; --kb-kbd-text: #64748b; --kb-watermark-text: #94a3b8; }\n .theme-dark { --kb-bg-container: #0f172a; --kb-border-container: #334155; --kb-shadow-container: 0 25px 50px -12px rgba(0, 0, 0, 0.25); --kb-backdrop-blur: 0px; --kb-text-title: #f1f5f9; --kb-text-subtitle: #94a3b8; --kb-btn-dismiss-bg: #1e293b; --kb-btn-dismiss-border: #334155; --kb-btn-dismiss-text: #cbd5e1; --kb-btn-dismiss-hover-bg: #334155; --kb-btn-dismiss-hover-text: #ffffff; --kb-btn-trigger-bg: #ffffff; --kb-btn-trigger-text: #0f172a; --kb-btn-trigger-hover-bg: #f1f5f9; --kb-progress-track: #1e293b; --kb-progress-indicator: #ffffff; --kb-popover-bg: #0f172a; --kb-popover-border: #334155; --kb-popover-text: #f1f5f9; --kb-input-bg: #0f172a; --kb-input-border: #475569; --kb-input-text: #f1f5f9; --kb-input-placeholder: #94a3b8; --kb-form-label: #e2e8f0; --kb-success-color: #6ee7b7; --kb-error-text: #ef4444; --kb-kbd-bg: #1e293b; --kb-kbd-border: #334155; --kb-kbd-text: #94a3b8; --kb-watermark-text: #64748b; }\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n #cue-card-root { position: fixed; z-index: 2147483647; pointer-events: none; width: 100%; height: 0; top: 0; left: 0; isolation: isolate; }\n .container { position: absolute; pointer-events: auto; background-color: var(--kb-bg-container); border: 1px solid var(--kb-border-container); box-shadow: var(--kb-shadow-container); backdrop-filter: blur(var(--kb-backdrop-blur)); -webkit-backdrop-filter: blur(var(--kb-backdrop-blur)); border-radius: 0.25rem; border-bottom-left-radius: 0.25rem; border-bottom-right-radius: 0.25rem; padding: 1.25rem 1.5rem; width: auto; min-width: 400px; max-width: 90vw; opacity: 0; z-index: 1; font-family: var(--kb-font-family); }\n .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); transition: all 0.5s ease; z-index: 0; pointer-events: none; }\n .backdrop.active { background: rgba(0,0,0,0.1); backdrop-filter: blur(var(--kb-focus-blur)); -webkit-backdrop-filter: blur(var(--kb-focus-blur)); }\n .launcher { position: absolute; pointer-events: auto; background-color: var(--kb-bg-container); border: 1px solid var(--kb-border-container); box-shadow: var(--kb-shadow-container); backdrop-filter: blur(var(--kb-backdrop-blur)); -webkit-backdrop-filter: blur(var(--kb-backdrop-blur)); border-radius: 9999px; padding: 0.5rem 1rem; display: flex; align-items: center; gap: 0.75rem; cursor: pointer; transition: transform 0.2s, opacity 0.3s; opacity: 0; z-index: 1; color: var(--kb-text-title); font-weight: 500; font-size: 0.875rem; font-family: var(--kb-font-family); }\n .launcher:hover { transform: scale(1.02); background-color: var(--kb-bg-container); }\n .kb-chip-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }\n .kb-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.8rem; border-radius: 9999px; border: 1px solid rgba(255,255,255,0.85); background: linear-gradient(135deg, rgba(255,255,255,0.28), rgba(255,255,255,0.08)); color: var(--kb-text-title); font-size: 0.8rem; font-weight: 600; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 8px 18px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.45); }\n .kb-chip-logo { width: 18px; height: 18px; border-radius: 9999px; overflow: hidden; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; }\n .kb-chip-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }\n .kb-chip-fallback { width: 18px; height: 18px; border-radius: 9999px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: var(--kb-text-title); background: rgba(255,255,255,0.25); }\n .kb-chip-action { margin-left: 0.35rem; font-size: 0.7rem; color: var(--kb-text-subtitle); text-decoration: underline; background: none; border: none; padding: 0; cursor: pointer; }\n .kb-chip-action:hover { color: var(--kb-text-title); }\n .kb-chip--launcher { padding: 0.25rem 0.65rem; font-size: 0.7rem; }\n .kb-chip-row.launcher-row { margin-bottom: 0; }\n .launcher-label { display: inline-flex; align-items: center; gap: 0.5rem; }\n .subtitle-chip { margin-top: 0.35rem; }\n .pos-top-center { left: 50%; translate: -50% 0; top: 1rem; }\n .pos-top-right { right: 1rem; top: 1rem; left: auto; }\n @media (max-width: 768px) { .pos-top-center, .pos-top-right { left: 0.5rem; right: 0.5rem; top: 0.5rem; translate: none; width: auto; max-width: none; } }\n :host(.kb-inline) { position: relative !important; z-index: auto !important; top: auto !important; left: auto !important; width: 100% !important; height: auto !important; pointer-events: auto !important; isolation: auto !important; display: block; }\n :host(.kb-inline) .container, :host(.kb-inline) .launcher { position: relative !important; left: auto !important; right: auto !important; top: auto !important; translate: none !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; box-shadow: none !important; }\n :host(.kb-inline) .container { opacity: 1 !important; transform: none !important; }\n :host(.kb-inline) .popover { position: static !important; transform: none !important; opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; margin-top: 0.75rem !important; }\n :host(.kb-inline) .backdrop, :host(.kb-inline) .launcher, :host(.kb-inline) .btn-dismiss { display: none !important; }\n .content-wrapper { display: flex; align-items: center; gap: 1rem; }\n .logo { width: 2.5rem; height: 2.5rem; display: none; }\n @media (min-width: 1024px) { .logo { display: block; } }\n .text-content { flex: 1; user-select: none; }\n .text-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }\n .title { color: var(--kb-text-title); font-size: 1rem; font-weight: 600; line-height: 1.5; }\n .subtitle-text { color: var(--kb-text-title); font-size: 0.875rem; line-height: 1.25; opacity: 0.8; }\n .btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 0.375rem; font-weight: 500; font-size: 0.875rem; line-height: 1.25rem; padding: 0.5rem 1rem; transition: all 0.2s; cursor: pointer; border: none; outline: none; }\n .btn-trigger { background-color: var(--kb-btn-trigger-bg); color: var(--kb-btn-trigger-text); min-width: 8rem; gap: 0.5rem; transition: opacity 0.2s ease-out, background-color 0.2s ease-out; }\n .btn-trigger.hidden { opacity: 0; pointer-events: none; }\n .btn-trigger:not(:disabled):hover { background-color: var(--kb-btn-trigger-hover-bg); }\n .btn-trigger:disabled { opacity: 0.8; cursor: not-allowed; }\n .btn-trigger.success { background-color: transparent; color: var(--kb-success-color); padding-right: 0.75rem; cursor: default; }\n .status-text { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--kb-text-subtitle); opacity: 0.8; }\n .btn-trigger.success:hover { background-color: transparent; }\n .animate-spin { animation: spin 1s linear infinite; }\n @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }\n @keyframes shine { 0% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } 100% { background-position: 0% 0%; } }\n @keyframes sheen-flash { 0% { opacity: 0; transform: translateX(-100%) skewX(-15deg); } 50% { opacity: 0.6; } 100% { opacity: 0; transform: translateX(200%) skewX(-15deg); } }\n .container-sheen { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: inherit; }\n .container-sheen::after { content: ''; position: absolute; top: 0; left: 0; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent); transform: translateX(-100%) skewX(-15deg); }\n .container-sheen.active::after { animation: sheen-flash 0.6s ease-out forwards; }\n .launcher-shine-border { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background-size: 300% 300%; animation: shine var(--shine-duration, 14s) linear infinite; mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask-composite: exclude; -webkit-mask-composite: xor; padding: var(--shine-border-width, 1px); }\n .btn-dismiss { position: absolute; top: -0.5rem; left: -0.5rem; width: 1.5rem; height: 1.5rem; padding: 0; border-radius: 9999px; display: flex; align-items: center; justify-content: center; background-color: var(--kb-btn-dismiss-bg); border: 1px solid var(--kb-btn-dismiss-border); color: var(--kb-btn-dismiss-text); cursor: pointer; transition: all 0.3s ease-out; z-index: 10; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }\n .btn-dismiss:hover { background-color: var(--kb-btn-dismiss-hover-bg); color: var(--kb-btn-dismiss-hover-text); }\n .progress-clip { position: absolute; inset: 0; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; overflow: hidden; pointer-events: none; }\n .progress-container { position: absolute; bottom: 0; left: 0; right: 0; height: 0.25rem; background-color: var(--kb-progress-track); overflow: hidden; pointer-events: none; border-radius: 0; }\n .progress-bar { height: 100%; background-color: var(--kb-progress-indicator); width: 0%; transition: width 0.3s ease; }\n .popover { position: absolute; top: 100%; left: 0; right: 0; margin-top: 0.375rem; background-color: var(--kb-popover-bg); border: 1px solid var(--kb-popover-border); border-radius: 0.25rem; border-top-left-radius: 0; border-top-right-radius: 0; padding: 1rem 1.5rem; color: var(--kb-popover-text); box-shadow: var(--kb-shadow-container); backdrop-filter: blur(var(--kb-backdrop-blur)); -webkit-backdrop-filter: blur(var(--kb-backdrop-blur)); opacity: 0; transform: translateY(-10px); pointer-events: none; visibility: hidden; transition: all 0.2s ease-out; }\n .popover.open { opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible; }\n .container.popover-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }\n .container.popover-open .progress-clip { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }\n .form-group { margin-bottom: 0; }\n .form-label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--kb-form-label); font-weight: 500; }\n .input-row { display: flex; gap: 0.5rem; }\n .form-input { flex: 1; background-color: var(--kb-input-bg); border: 1px solid var(--kb-input-border); color: var(--kb-input-text); border-radius: 0.375rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; outline: none; transition: border-color 0.2s; min-height: 44px; }\n .form-input::placeholder { color: var(--kb-input-placeholder); }\n .form-input:focus { border-color: var(--kb-progress-indicator); }\n .form-input.error { border-color: var(--kb-error-text); }\n .form-label.error { color: var(--kb-error-text); }\n .form-message { color: var(--kb-error-text); font-size: 0.75rem; margin-top: 0.25rem; font-weight: 500; }\n .btn-submit { background-color: var(--kb-btn-trigger-bg); color: var(--kb-btn-trigger-text); padding: 0.5rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }\n .btn-submit:disabled { opacity: 0.7; cursor: not-allowed; }\n .kbd-hint { display: flex; align-items: center; gap: 0.5rem; position: absolute; top: calc(100% + 0.5rem); left: 50%; transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; white-space: nowrap; }\n .kbd-hint.visible { opacity: 1; }\n .kbd-group { display: flex; align-items: center; gap: 0.25rem; }\n .kbd { font-family: inherit; font-size: 0.75rem; line-height: 1; padding: 0.25rem 0.375rem; border-radius: 0.25rem; background: var(--kb-kbd-bg); border: 1px solid var(--kb-kbd-border); color: var(--kb-kbd-text); font-weight: 500; min-width: 1.25rem; text-align: center; }\n .kbd-text { font-size: 0.75rem; color: var(--kb-kbd-text); }\n .watermark { text-align: center; font-size: 0.625rem; color: var(--kb-watermark-text); opacity: 0.8; font-weight: 500; letter-spacing: 0.025em; }\n .watermark a { color: inherit; text-decoration: none; cursor: pointer; }\n .watermark a:hover { text-decoration: underline; text-decoration-color: var(--kb-watermark-text); }\n .popover-watermark { position: absolute; top: 100%; left: 0; right: 0; text-align: center; font-size: 0.625rem; color: var(--kb-watermark-text); opacity: 0.6; font-weight: 500; letter-spacing: 0.025em; padding-top: 0.5rem; }\n .popover-watermark a { color: inherit; text-decoration: none; cursor: pointer; }\n .popover-watermark a:hover { text-decoration: underline; opacity: 1; }\n /* Launcher helper hint (below launcher) */\n .launcher-hint { position: absolute; top: calc(100% + 0.4rem); left: 50%; transform: translateX(-50%); pointer-events: none; white-space: nowrap; }\n .launcher-hint.visible { opacity: 0.65; }\n /* Launcher dismiss button */\n .launcher .btn-dismiss.launcher-dismiss { top: -0.375rem; left: -0.375rem; width: 1.25rem; height: 1.25rem; opacity: 0; transition: opacity 0.2s ease-out, background-color 0.3s ease-out, color 0.3s ease-out; }\n .launcher:hover .btn-dismiss.launcher-dismiss { opacity: 1; }\n /* Launcher logo */\n .launcher-logo { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }\n .launcher-logo svg { width: 20px; height: 20px; }\n /* Mobile: show dismiss button */\n @media (max-width: 768px) {\n .launcher .btn-dismiss.launcher-dismiss { opacity: 1; }\n }\n /* Toggle personalization button */\n .btn-toggle-personalization { position: relative; width: 1.75rem; height: 1.75rem; padding: 0; border-radius: 9999px; display: flex; align-items: center; justify-content: center; background-color: var(--kb-btn-dismiss-bg); border: 1px solid var(--kb-btn-dismiss-border); color: var(--kb-btn-dismiss-text); cursor: pointer; transition: all 0.2s ease-out; flex-shrink: 0; margin-left: 0.25rem; }\n .btn-toggle-personalization:hover { background-color: var(--kb-btn-dismiss-hover-bg); color: var(--kb-btn-dismiss-hover-text); transform: scale(1.05); }\n .btn-toggle-personalization svg { width: 14px; height: 14px; }\n /* Custom tooltip for toggle button */\n .btn-toggle-personalization .toggle-tooltip { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; background-color: var(--kb-bg-container); border: 1px solid var(--kb-border-container); color: var(--kb-text-title); font-size: 0.7rem; font-weight: 500; padding: 0.25rem 0.5rem; border-radius: 4px; opacity: 0; visibility: hidden; transition: opacity 0.15s ease-out, visibility 0.15s ease-out; pointer-events: none; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }\n .btn-toggle-personalization:hover .toggle-tooltip { opacity: 1; visibility: visible; }\n .btn-toggle-personalization.loading { cursor: default; opacity: 0.7; }\n .btn-toggle-personalization.loading:hover { transform: none; }\n .btn-toggle-personalization:disabled { cursor: default; }\n .launcher-domain { text-decoration: underline; text-underline-offset: 2px; }\n .launcher-actions { display: flex; align-items: center; gap: 0.25rem; }\n`;\n\n// -- Animation Hook --\nconst useEnterExitAnimation = (\n ref: preact.RefObject<HTMLElement>,\n isVisible: boolean,\n config: {\n direction: CueCardDirection;\n position: CueCardPosition;\n entranceDelayMs: number;\n exitDelayMs: number;\n onEntranceComplete?: () => void;\n onExitComplete?: () => void;\n }\n) => {\n const hasEnteredRef = useRef(false);\n const currentAnimRef = useRef<Animation | null>(null);\n\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n\n // Cancel any running animation to prevent overlaps\n if (currentAnimRef.current) {\n currentAnimRef.current.cancel();\n currentAnimRef.current = null;\n }\n\n const isTopDown = config.direction === \"top-to-bottom\";\n const initialTransform = isTopDown\n ? `translateY(-60px)`\n : `translateX(60px)`;\n const exitTransform = isTopDown ? `translateY(-20px)` : `translateX(20px)`;\n const finalTransform = \"translate(0, 0)\";\n\n if (isVisible) {\n // Show element before entrance animation\n element.style.visibility = \"visible\";\n hasEnteredRef.current = true;\n\n const anim = element.animate(\n [\n { opacity: 0, transform: initialTransform },\n { opacity: 1, transform: finalTransform },\n ],\n {\n duration: 500,\n delay: config.entranceDelayMs,\n easing: \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n fill: \"forwards\",\n }\n );\n currentAnimRef.current = anim;\n anim.onfinish = () => {\n currentAnimRef.current = null;\n config.onEntranceComplete?.();\n };\n } else {\n // Exit\n if (hasEnteredRef.current) {\n const anim = element.animate(\n [\n { opacity: 1, transform: finalTransform },\n { opacity: 0, transform: exitTransform },\n ],\n {\n duration: 350,\n delay: config.exitDelayMs,\n easing: \"ease-in-out\",\n fill: \"forwards\",\n }\n );\n currentAnimRef.current = anim;\n anim.onfinish = () => {\n // Hide element after exit animation completes\n element.style.visibility = \"hidden\";\n currentAnimRef.current = null;\n config.onExitComplete?.();\n };\n } else {\n // Never entered, ensure it's hidden immediately\n element.style.opacity = \"0\";\n element.style.transform = exitTransform;\n element.style.visibility = \"hidden\";\n }\n }\n }, [isVisible, config.direction]);\n};\n\n// -- Helper to map custom theme to CSS variables --\nconst getThemeStyles = (theme?: CueCardThemeConfig) => {\n if (!theme) return {};\n const styles: Record<string, string | undefined> = {};\n\n if (theme.fontFamily) styles[\"--kb-font-family\"] = theme.fontFamily;\n if (theme.backgroundColor) {\n styles[\"--kb-bg-container\"] = theme.backgroundColor;\n styles[\"--kb-popover-bg\"] = theme.backgroundColor;\n }\n if (theme.borderColor) {\n styles[\"--kb-border-container\"] = theme.borderColor;\n styles[\"--kb-popover-border\"] = theme.borderColor;\n }\n if (theme.textColor) {\n styles[\"--kb-text-title\"] = theme.textColor;\n styles[\"--kb-popover-text\"] = theme.textColor;\n }\n if (theme.subtitleColor) styles[\"--kb-text-subtitle\"] = theme.subtitleColor;\n if (theme.borderRadius) {\n styles[\"border-radius\"] = theme.borderRadius;\n styles[\"border-bottom-left-radius\"] = theme.borderRadius;\n styles[\"border-bottom-right-radius\"] = theme.borderRadius;\n }\n\n // Button & Accents\n if (theme.primaryColor) {\n styles[\"--kb-btn-trigger-bg\"] = theme.primaryColor;\n styles[\"--kb-progress-indicator\"] = theme.primaryColor;\n styles[\"--kb-success-color\"] = theme.primaryColor;\n }\n if (theme.primaryTextColor) {\n styles[\"--kb-btn-trigger-text\"] = theme.primaryTextColor;\n }\n\n return styles as any; // Preact style types can be strict\n};\n\n// -- Components --\n\nconst CueCardContent: FunctionalComponent<{\n config: CueCardConfig;\n isOpen: boolean;\n skipFocus?: boolean;\n setIsOpen: (val: boolean) => void;\n deanonymizedCompany?: DeanonymizedCompany | null;\n onClearDeanonymizedCompany?: () => void;\n}> = ({\n config,\n isOpen,\n skipFocus,\n setIsOpen,\n deanonymizedCompany,\n onClearDeanonymizedCompany,\n}) => {\n const isInline = config.mountMode === \"inline\";\n const containerRef = useRef<HTMLDivElement>(null);\n const launcherRef = useRef<HTMLDivElement>(null);\n const backdropRef = useRef<HTMLDivElement>(null);\n const firstInputRef = useRef<HTMLInputElement>(null);\n const formRef = useRef<HTMLFormElement>(null);\n\n const [mode, setMode] = useState<\"card\" | \"launcher\">(\"card\");\n const [isDismissed, setIsDismissed] = useState(false);\n const [hasHadSuccess, setHasHadSuccess] = useState(false);\n const [isExitingToLauncher, setIsExitingToLauncher] = useState(false);\n const hasEnteredRef = useRef(false);\n const isShowingInitialSuccessRef = useRef(false);\n const justReopenedRef = useRef(false);\n const previousModeRef = useRef<\"card\" | \"launcher\">(\"card\");\n const prevStatusRef = useRef(config.status); // Add this\n const prevVisibilityRef = useRef(!!config.isVisible);\n const timerStartRef = useRef<number | null>(null);\n const timerRafRef = useRef<number | null>(null);\n const hasTimerCompletedRef = useRef(false);\n const [isHovering, setIsHovering] = useState(false);\n const [sheenActive, setSheenActive] = useState(false);\n const [errors, setErrors] = useState<Record<string, string>>({});\n const [timerProgress, setTimerProgressState] = useState(0);\n const timerProgressRef = useRef(0);\n const timerEnabled = config.enableTimer !== false;\n const timerDuration = Math.max(500, config.timerDurationMs ?? 20_000);\n const isPending = config.status === \"starting\";\n const isSuccess = config.status === \"success\";\n const isError = config.status === \"error\";\n const isDeanonymized = !!deanonymizedCompany;\n const isPopoverEnabled = !isDeanonymized;\n const isPopoverOpen = isPopoverEnabled ? isOpen : false;\n const deanonymizedLabel =\n deanonymizedCompany?.name || deanonymizedCompany?.domain || \"\";\n const deanonymizedDomain = deanonymizedCompany?.domain;\n\n const setTimerProgress = useCallback((value: number) => {\n timerProgressRef.current = value;\n setTimerProgressState(value);\n }, []);\n\n useEffect(() => {\n if (config.isVisible) {\n setMode(\"card\");\n hasEnteredRef.current = false;\n setIsDismissed(false);\n }\n }, [config.isVisible]);\n\n // -- Render-time State Logic --\n\n // 1. Detect re-opening (Launcher -> Card) and clear initial success flag\n // This ensures that when we re-open, we don't show the old success state\n if (mode === \"card\" && previousModeRef.current === \"launcher\") {\n isShowingInitialSuccessRef.current = false;\n }\n\n // 2. Handle success transition immediately during render to ensure no flash of wrong state\n if (config.status === \"success\" && prevStatusRef.current !== \"success\") {\n // If we just transitioned to success and we're in card mode, show the success state\n if (mode === \"card\") {\n isShowingInitialSuccessRef.current = true;\n }\n } else if (config.status !== \"success\") {\n isShowingInitialSuccessRef.current = false;\n }\n // Update tracking ref\n prevStatusRef.current = config.status;\n\n // Track mode transitions to detect reopening\n useEffect(() => {\n const wasLauncher = previousModeRef.current === \"launcher\";\n const isCard = mode === \"card\";\n\n // If we transitioned from launcher to card after success, mark as reopening\n if (wasLauncher && isCard && hasHadSuccess) {\n justReopenedRef.current = true;\n setTimeout(() => {\n justReopenedRef.current = false;\n }, 100);\n }\n\n if (mode === \"launcher\") {\n setIsHovering(false);\n }\n\n if (wasLauncher && isCard && timerEnabled) {\n setTimerProgress(0);\n timerStartRef.current = null;\n hasTimerCompletedRef.current = false;\n }\n }, [mode, setTimerProgress, timerEnabled]);\n\n // Track success state and auto-dismiss to launcher\n useEffect(() => {\n if (config.status === \"success\") {\n setHasHadSuccess(true);\n\n // Auto-dismiss to launcher after a short delay if launcher is enabled\n // Only if we are currently showing the initial success state\n if (\n config.enableLauncher &&\n mode === \"card\" &&\n isShowingInitialSuccessRef.current\n ) {\n const timer = setTimeout(() => {\n setMode(\"launcher\");\n // Don't clear isShowingInitialSuccessRef here, let it persist during exit animation\n // We clear it in the render-time logic when switching back to card mode\n }, 2000); // 2 second delay after success\n\n return () => clearTimeout(timer);\n }\n }\n }, [config.status, config.enableLauncher, mode]);\n\n // Reset the idle timer when the card becomes visible again\n useEffect(() => {\n if (config.isVisible && !prevVisibilityRef.current && timerEnabled) {\n setTimerProgress(0);\n timerStartRef.current = null;\n hasTimerCompletedRef.current = false;\n }\n prevVisibilityRef.current = !!config.isVisible;\n }, [config.isVisible, setTimerProgress, timerEnabled]);\n\n // Update previous mode ref (runs after other effects)\n useEffect(() => {\n previousModeRef.current = mode;\n }, [mode]);\n\n // Store skipFocus in a ref so it persists for the effect\n const skipFocusRef = useRef(false);\n if (skipFocus) {\n skipFocusRef.current = true;\n }\n\n useEffect(() => {\n if (isPopoverOpen) {\n // Reset form if opening after success (preparing for \"Show me again\")\n if (hasHadSuccess && formRef.current) {\n formRef.current.reset();\n }\n\n // Focus the first input when the popover opens (unless skipFocus is set)\n // Use a small delay to ensure the popover is visible (CSS transition is 200ms)\n const shouldSkipFocus = skipFocusRef.current;\n skipFocusRef.current = false; // Reset after reading\n\n if (!shouldSkipFocus) {\n const focusTimer = setTimeout(() => {\n if (firstInputRef.current) {\n firstInputRef.current.focus();\n }\n }, 100);\n\n return () => clearTimeout(focusTimer);\n }\n }\n }, [isPopoverOpen]);\n\n // Track previous isOpen state to detect transitions\n const prevIsOpenForExpandRef = useRef(isPopoverOpen);\n useEffect(() => {\n const wasOpen = prevIsOpenForExpandRef.current;\n prevIsOpenForExpandRef.current = isPopoverOpen;\n\n // Only expand from launcher to card when isOpen changes from false to true\n if (!wasOpen && isPopoverOpen && mode === \"launcher\") {\n setMode(\"card\");\n }\n }, [isPopoverOpen, mode]);\n\n // Track if we're transitioning between modes (need delay for crossfade)\n const isFirstAppearance = !hasEnteredRef.current;\n const wasLauncherPreviously = previousModeRef.current === \"launcher\";\n\n // Card entrance delay: use config delay on first appearance, or wait for launcher exit when reopening\n const cardEntranceDelay = isFirstAppearance\n ? config.entranceDelayMs || 0\n : wasLauncherPreviously && mode === \"card\"\n ? 400 // Wait for launcher exit\n : 0;\n\n if (!isInline) {\n useEnterExitAnimation(\n containerRef,\n !!config.isVisible && mode === \"card\" && !isDismissed,\n {\n direction: config.direction || \"top-to-bottom\",\n position: config.position || \"top-center\",\n entranceDelayMs: cardEntranceDelay,\n exitDelayMs: 75,\n onEntranceComplete: () => {\n config.onEntranceComplete?.();\n hasEnteredRef.current = true;\n },\n onExitComplete: () => {\n if (!config.isVisible || isDismissed) config.onExitComplete?.();\n },\n }\n );\n\n // Delay launcher entrance to allow card exit animation to complete\n // Card exit: 75ms delay + 350ms duration = 425ms total\n const launcherEntranceDelay = 400;\n\n useEnterExitAnimation(\n launcherRef,\n !!config.isVisible && mode === \"launcher\" && !isDismissed,\n {\n direction: config.direction || \"top-to-bottom\",\n position: config.position || \"top-center\",\n entranceDelayMs: launcherEntranceDelay,\n exitDelayMs: 75,\n }\n );\n }\n\n useEffect(() => {\n const el = backdropRef.current;\n if (!el) return;\n\n // Check if status is success AND we're showing the initial success state\n // When reopening from launcher, isShowingInitialSuccessRef is false so blur should apply\n const isShowingSuccessState =\n config.status === \"success\" && isShowingInitialSuccessRef.current;\n\n if (\n config.enableFocusMode &&\n mode === \"card\" &&\n config.isVisible &&\n !isShowingSuccessState\n ) {\n const timer = setTimeout(() => {\n el.classList.add(\"active\");\n }, config.focusDelayMs || 500);\n return () => clearTimeout(timer);\n } else {\n el.classList.remove(\"active\");\n }\n }, [\n config.enableFocusMode,\n mode,\n config.isVisible,\n config.focusDelayMs,\n config.status,\n ]);\n\n useEffect(() => {\n if (!config.isVisible) return;\n\n const handleKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n // ESC always goes directly to launcher (or dismisses if no launcher)\n if (mode === \"card\") {\n // Don't close form first - go straight to launcher to avoid button flash\n if (config.enableLauncher) {\n setIsExitingToLauncher(true);\n setMode(\"launcher\");\n // Reset isOpen after card has fully exited\n setTimeout(() => {\n setIsOpen(false);\n setIsExitingToLauncher(false);\n }, 500);\n } else {\n setIsOpen(false);\n config.onDismiss?.();\n }\n }\n return;\n }\n\n // Helper to check if configured shortcut matches event\n const matchesShortcut = (\n e: KeyboardEvent,\n shortcut?: CueCardKeyboardShortcut\n ) => {\n const s = shortcut || { key: \"p\", modifiers: [\"meta\", \"ctrl\"] }; // Default: Cmd+P or Ctrl+P\n\n // Check Key\n if (e.key.toLowerCase() !== s.key.toLowerCase()) return false;\n\n // Check Modifiers\n const mods = s.modifiers || [];\n // For default (Cmd OR Ctrl), we check if either is present if both are listed in our 'default' logic above\n // But for strict config, we usually want ALL specified modifiers to be pressed.\n\n // If custom shortcut provided:\n if (shortcut) {\n const hasMeta = mods.includes(\"meta\") === e.metaKey;\n const hasCtrl = mods.includes(\"ctrl\") === e.ctrlKey;\n const hasAlt = mods.includes(\"alt\") === e.altKey;\n const hasShift = mods.includes(\"shift\") === e.shiftKey;\n return hasMeta && hasCtrl && hasAlt && hasShift;\n }\n\n // Default fallback logic (Cmd OR Ctrl + P)\n // We treat 'meta' or 'ctrl' as \"Command or Control\" loosely for the default\n const isCmdOrCtrl = e.metaKey || e.ctrlKey;\n return isCmdOrCtrl;\n };\n\n if (matchesShortcut(e, config.keyboardShortcut)) {\n e.preventDefault();\n if (mode === \"launcher\") {\n setMode(\"card\");\n setIsOpen(isPopoverEnabled);\n } else if (mode === \"card\") {\n if (config.enableLauncher) {\n setMode(\"launcher\");\n } else {\n config.onDismiss?.();\n }\n }\n }\n };\n\n window.addEventListener(\"keydown\", handleKey);\n return () => window.removeEventListener(\"keydown\", handleKey);\n }, [\n config.isVisible,\n isPopoverOpen,\n mode,\n config.enableLauncher,\n setIsOpen,\n config.onDismiss,\n isPopoverEnabled,\n ]);\n\n const [isMobile, setIsMobile] = useState(false);\n const isMac =\n typeof navigator !== \"undefined\" && /Mac/.test(navigator.userAgent);\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n const media = window.matchMedia(\"(max-width: 768px)\");\n const update = () => setIsMobile(media.matches);\n update();\n if (\"addEventListener\" in media) {\n media.addEventListener(\"change\", update);\n return () => media.removeEventListener(\"change\", update);\n }\n window.addEventListener(\"resize\", update);\n return () => window.removeEventListener(\"resize\", update);\n }, []);\n\n const launcherHint = (() => {\n if (isMobile) {\n return { keys: [] as string[], label: \"tap to launch\" };\n }\n\n if (config.keyboardShortcut) {\n const mods = config.keyboardShortcut.modifiers || [];\n const keys: string[] = [];\n if (mods.includes(\"meta\")) keys.push(isMac ? \"\u2318\" : \"Ctrl\");\n if (mods.includes(\"ctrl\")) keys.push(\"Ctrl\");\n if (mods.includes(\"alt\")) keys.push(isMac ? \"Opt\" : \"Alt\");\n if (mods.includes(\"shift\")) keys.push(\"Shift\");\n keys.push(config.keyboardShortcut.key.toUpperCase());\n return { keys, label: \"to launch\" };\n }\n\n return { keys: [isMac ? \"\u2318\" : \"Ctrl\", \"P\"], label: \"to launch\" };\n })();\n\n const [logoFailed, setLogoFailed] = useState(false);\n const [logoAttempt, setLogoAttempt] = useState<\"primary\" | \"fallback\">(\n \"primary\"\n );\n\n useEffect(() => {\n setLogoFailed(false);\n setLogoAttempt(\"primary\");\n }, [deanonymizedCompany?.logoUrl, deanonymizedLabel, deanonymizedDomain]);\n\n useEffect(() => {\n if (!isPopoverEnabled && isOpen) {\n setIsOpen(false);\n }\n }, [isPopoverEnabled, isOpen, setIsOpen]);\n\n const logoUrlTemplate = config.deanonymization?.logoUrlTemplate;\n const normalizedLogoDomain = normalizeDomain(deanonymizedDomain);\n const fallbackLogoUrl = normalizedLogoDomain\n ? `https://logo.clearbit.com/${normalizedLogoDomain}`\n : undefined;\n const primaryLogoUrl =\n normalizedLogoDomain && logoUrlTemplate\n ? logoUrlTemplate.replace(\"{domain}\", normalizedLogoDomain)\n : deanonymizedCompany?.logoUrl || fallbackLogoUrl;\n const resolvedLogoUrl =\n logoAttempt === \"fallback\" && fallbackLogoUrl && fallbackLogoUrl !== primaryLogoUrl\n ? fallbackLogoUrl\n : primaryLogoUrl;\n\n // Only show success styling during the initial success phase, not when re-opening\n const showAsSuccess = isSuccess && isShowingInitialSuccessRef.current;\n\n const txt = config.textOverrides || {};\n\n const titleText = (() => {\n if (isSuccess) return txt.titleSuccess || \"Personalization complete\";\n if (isPending) return \"Starting personalization\"; // usually transitional, rarely customized\n if (isError) return txt.titleError || \"Let's try that again\";\n return config.hasPersonalization\n ? \"Personalization ready\"\n : txt.titleResting || \"Personalization available\";\n })();\n\n const subtitleText = (() => {\n if (isSuccess) return txt.subtitleSuccess || \"Take a look\";\n if (isPending) return \"Hang tight...\";\n if (isError)\n return txt.subtitleError || \"Something went wrong. Tap to retry.\";\n return txt.subtitleResting || \"This page can adapt to you\";\n })();\n\n const buttonText = (() => {\n if (isPending) return txt.btnLoading || \"Starting...\";\n if (isError) return txt.btnError || \"Try again\";\n\n // If currently showing initial success state, show \"Personalised\"\n if (isSuccess && isShowingInitialSuccessRef.current) {\n return txt.btnSuccess || \"Personalised\";\n }\n\n // If we've had success at all, show \"Show me again\"\n if (hasHadSuccess) {\n return \"Show me again\";\n }\n\n // Initial state: show \"Show me\"\n return txt.btnResting || \"Show me\";\n })();\n\n const launcherLabelText = (() => {\n if (isDeanonymized) {\n if (hasHadSuccess) {\n return (\n txt.launcherLabelDeanonymizedSuccess ||\n txt.launcherLabelDeanonymized ||\n \"See it again for\"\n );\n }\n return txt.launcherLabelDeanonymized || \"See it in action for\";\n }\n if (hasHadSuccess) {\n return (\n txt.launcherLabelSuccess || txt.launcherLabel || \"Personalize again\"\n );\n }\n return txt.launcherLabel || \"Personalize\";\n })();\n\n const renderDeanonymizedChip = (variant: \"card\" | \"launcher\") => {\n if (!deanonymizedCompany || !deanonymizedLabel) return null;\n const isLauncher = variant === \"launcher\";\n const fallbackLetter = deanonymizedLabel.trim().slice(0, 1).toUpperCase();\n const showLogo = !!resolvedLogoUrl && !logoFailed;\n return (\n <div class={`kb-chip ${isLauncher ? \"kb-chip--launcher\" : \"\"}`}>\n {showLogo ? (\n <span class=\"kb-chip-logo\">\n <img\n src={resolvedLogoUrl}\n alt=\"\"\n referrerPolicy=\"no-referrer\"\n onError={() => {\n if (\n logoAttempt === \"primary\" &&\n fallbackLogoUrl &&\n fallbackLogoUrl !== primaryLogoUrl\n ) {\n setLogoAttempt(\"fallback\");\n return;\n }\n setLogoFailed(true);\n }}\n />\n </span>\n ) : (\n <span class=\"kb-chip-fallback\">{fallbackLetter}</span>\n )}\n <span>{deanonymizedLabel}</span>\n {onClearDeanonymizedCompany && (\n <button\n class=\"kb-chip-action\"\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n onClearDeanonymizedCompany();\n setIsOpen(true);\n }}\n >\n Not you?\n </button>\n )}\n </div>\n );\n };\n\n const buildDeanonymizedValues = () => {\n const normalizedInputDomain = normalizeDomain(deanonymizedDomain);\n const fallbackValue = (\n normalizedInputDomain ||\n deanonymizedDomain ||\n deanonymizedLabel ||\n \"\"\n ).toString();\n const values: PersonalizationInput = {};\n\n config.fields.forEach((field) => {\n const key = field.name;\n const lowerKey = key.toLowerCase();\n if (lowerKey.includes(\"domain\")) {\n values[key] = normalizedInputDomain || fallbackValue;\n return;\n }\n if (lowerKey.includes(\"company\")) {\n values[key] = deanonymizedLabel;\n return;\n }\n values[key] = fallbackValue;\n });\n\n return values;\n };\n\n const submitValues = (values: PersonalizationInput) => {\n const newErrors: Record<string, string> = {};\n let hasErrors = false;\n\n config.fields.forEach((field) => {\n const rawValue = values[field.name] ?? \"\";\n const value = typeof rawValue === \"string\" ? rawValue : String(rawValue);\n const error = validateField(field.name, value, field);\n if (error) {\n newErrors[field.name] = error;\n hasErrors = true;\n }\n });\n\n if (hasErrors) {\n setErrors(newErrors);\n return;\n }\n\n setErrors({});\n setIsOpen(false);\n config.onSubmitPersonalization?.(values);\n };\n\n const validateField = (\n name: string,\n value: string,\n fieldConfig?: PersonalizationField\n ): string | null => {\n if (!fieldConfig) return null;\n\n // Required check\n if (fieldConfig.required && !value.trim()) {\n return fieldConfig.errorMessage || `${fieldConfig.label} is required`;\n }\n\n if (!value) return null; // Skip other checks if empty and not required\n\n // Email check\n if (fieldConfig.type === \"email\") {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n if (!emailRegex.test(value)) {\n return fieldConfig.errorMessage || \"Please enter a valid email address\";\n }\n }\n\n // URL check\n if (fieldConfig.type === \"url\") {\n try {\n new URL(value);\n } catch {\n return (\n fieldConfig.errorMessage ||\n \"Please enter a valid URL (e.g., https://example.com)\"\n );\n }\n }\n\n // Min length\n if (fieldConfig.minLength && value.length < fieldConfig.minLength) {\n return (\n fieldConfig.errorMessage ||\n `Must be at least ${fieldConfig.minLength} characters`\n );\n }\n\n // Max length\n if (fieldConfig.maxLength && value.length > fieldConfig.maxLength) {\n return (\n fieldConfig.errorMessage ||\n `Must be at most ${fieldConfig.maxLength} characters`\n );\n }\n\n // Pattern check\n if (fieldConfig.pattern) {\n const regex = new RegExp(fieldConfig.pattern);\n if (!regex.test(value)) {\n return fieldConfig.errorMessage || \"Invalid format\";\n }\n }\n\n return null;\n };\n\n const handleSubmit = (e: Event) => {\n e.preventDefault();\n if (isPending) return;\n\n const formData = new FormData(e.target as HTMLFormElement);\n const values: PersonalizationInput = {};\n\n formData.forEach((value, key) => {\n const strValue = value.toString();\n values[key] = strValue;\n });\n\n submitValues(values);\n };\n\n const handleInput = (e: Event) => {\n const target = e.target as HTMLInputElement;\n const name = target.name;\n\n // If there's an existing error for this field, re-validate on input\n if (errors[name]) {\n const fieldConfig = config.fields.find((f) => f.name === name);\n const error = validateField(name, target.value, fieldConfig);\n\n setErrors((prev) => {\n const next = { ...prev };\n if (error) {\n next[name] = error;\n } else {\n delete next[name];\n }\n return next;\n });\n }\n };\n\n const handleDeanonymizedSubmit = () => {\n if (isPending || !isDeanonymized) return;\n submitValues(buildDeanonymizedValues());\n };\n\n const togglePopover = (e: Event) => {\n e.stopPropagation();\n if (isDeanonymized) return;\n if (isPending || isSuccess) return;\n const opening = !isPopoverOpen;\n setIsOpen(opening);\n\n // Trigger sheen effect when opening\n if (opening && config.enableClickSheen) {\n setSheenActive(true);\n setTimeout(() => setSheenActive(false), 600);\n }\n };\n\n // Timer-driven progress bar for first load\n useEffect(() => {\n if (!timerEnabled) return;\n if (hasTimerCompletedRef.current) return;\n\n const shouldRun =\n config.isVisible &&\n mode === \"card\" &&\n config.status === \"resting\" &&\n !isPopoverOpen &&\n !isHovering;\n\n if (!shouldRun) {\n if (timerRafRef.current !== null) {\n cancelAnimationFrame(timerRafRef.current);\n timerRafRef.current = null;\n }\n timerStartRef.current = null;\n return;\n }\n\n const tick = (timestamp: number) => {\n if (timerStartRef.current === null) {\n timerStartRef.current =\n timestamp - (timerProgressRef.current / 100) * timerDuration;\n }\n\n const elapsed = timestamp - timerStartRef.current;\n const pct = Math.min(1, elapsed / timerDuration);\n const nextProgress = pct * 100;\n setTimerProgress(nextProgress);\n\n if (pct >= 1) {\n hasTimerCompletedRef.current = true;\n timerStartRef.current = null;\n timerRafRef.current = null;\n if (config.enableLauncher) {\n setMode(\"launcher\");\n setIsOpen(false);\n } else {\n config.onDismiss?.();\n }\n return;\n }\n\n timerRafRef.current = requestAnimationFrame(tick);\n };\n\n timerRafRef.current = requestAnimationFrame(tick);\n\n return () => {\n if (timerRafRef.current !== null) {\n cancelAnimationFrame(timerRafRef.current);\n timerRafRef.current = null;\n }\n };\n }, [\n config.enableLauncher,\n config.isVisible,\n config.onDismiss,\n config.status,\n isHovering,\n isPopoverOpen,\n mode,\n setIsOpen,\n timerDuration,\n timerEnabled,\n setTimerProgress,\n ]);\n\n useEffect(() => {\n return () => {\n if (timerRafRef.current !== null) {\n cancelAnimationFrame(timerRafRef.current);\n }\n };\n }, []);\n\n const clampedProgress = Math.max(0, Math.min(100, config.progressPct ?? 0));\n const displayedProgress = timerEnabled ? timerProgress : clampedProgress;\n\n // Compute visibility flags for pointer-events (same conditions as animations)\n const isContainerVisible =\n !!config.isVisible && mode === \"card\" && !isDismissed;\n const isLauncherVisible =\n !!config.isVisible && mode === \"launcher\" && !isDismissed;\n const isAnythingVisible = isContainerVisible || isLauncherVisible;\n const showLauncherHint = !!config.showKeyboardHints && isLauncherVisible;\n\n return (\n <Fragment>\n <div\n ref={backdropRef}\n class=\"backdrop\"\n style={{ display: isAnythingVisible ? \"block\" : \"none\" }}\n />\n <div\n ref={containerRef}\n class={`container theme-${config.theme || \"glass\"} pos-${\n config.position || \"top-center\"\n }${isPopoverOpen ? \" popover-open\" : \"\"}`}\n style={{\n ...getThemeStyles(config.customTheme),\n pointerEvents: isContainerVisible ? \"auto\" : \"none\",\n }}\n onClick={() =>\n !isPopoverOpen &&\n !isPending &&\n !isSuccess &&\n isPopoverEnabled &&\n setIsOpen(true)\n }\n onMouseEnter={() => setIsHovering(true)}\n onMouseLeave={() => setIsHovering(false)}\n >\n {config.enableClickSheen && (\n <div class={`container-sheen${sheenActive ? \" active\" : \"\"}`} />\n )}\n <button\n class=\"btn-dismiss\"\n aria-label=\"Dismiss\"\n onClick={(e) => {\n e.stopPropagation();\n hasTimerCompletedRef.current = true;\n if (config.enableLauncher) {\n setMode(\"launcher\");\n } else {\n config.onDismiss?.();\n }\n }}\n >\n <XMarkIcon />\n </button>\n\n <div class=\"content-wrapper\">\n {/* <div class=\"logo\">\n <LogoIcon />\n </div> */}\n\n <div class=\"text-content\">\n <div class=\"text-row\">\n <div>\n <div class=\"title\">{titleText}</div>\n {isDeanonymized ? (\n <div class=\"subtitle-chip\">\n {renderDeanonymizedChip(\"card\")}\n </div>\n ) : (\n <div class=\"subtitle-text\">{subtitleText}</div>\n )}\n </div>\n\n {isPending ? (\n <span class=\"status-text\">\n <LoaderIcon /> {buttonText}\n </span>\n ) : (\n <button\n class={`btn btn-trigger ${showAsSuccess ? \"success\" : \"\"}${\n isPopoverOpen || isExitingToLauncher ? \" hidden\" : \"\"\n }`}\n disabled={showAsSuccess}\n onClick={isDeanonymized ? handleDeanonymizedSubmit : togglePopover}\n >\n {showAsSuccess ? (\n <Fragment>\n <CheckIcon /> {buttonText}\n </Fragment>\n ) : (\n buttonText\n )}\n </button>\n )}\n </div>\n </div>\n </div>\n\n <div class=\"progress-clip\">\n <div class=\"progress-container\">\n <div\n class=\"progress-bar\"\n style={{\n width: `${displayedProgress}%`,\n }}\n />\n </div>\n </div>\n\n {!isDeanonymized && (\n <div\n class={`popover ${isPopoverOpen ? \"open\" : \"\"}`}\n onClick={(e) => e.stopPropagation()}\n >\n <form onSubmit={handleSubmit} ref={formRef}>\n {config.fields.map((field, idx) => (\n <div class=\"form-group\" key={field.name}>\n <label\n class={`form-label ${errors[field.name] ? \"error\" : \"\"}`}\n >\n {field.label}\n </label>\n <div class=\"input-row\">\n <input\n ref={idx === 0 ? firstInputRef : undefined}\n class={`form-input ${errors[field.name] ? \"error\" : \"\"}`}\n name={field.name}\n type={field.type || \"text\"}\n placeholder={field.placeholder}\n required={field.required}\n onInput={handleInput}\n // Auto-focus logic could be added here with another useEffect/ref\n />\n {config.fields.length === 1 && (\n <button\n type=\"submit\"\n class=\"btn btn-submit\"\n disabled={isPending}\n >\n {isPending ? <LoaderIcon /> : <ArrowRightIcon />}\n </button>\n )}\n </div>\n {errors[field.name] && (\n <div class=\"form-message\">{errors[field.name]}</div>\n )}\n </div>\n ))}\n {config.fields.length > 1 && (\n <button\n type=\"submit\"\n class=\"btn btn-submit\"\n style={{ width: \"100%\" }}\n disabled={isPending}\n >\n {isPending ? <LoaderIcon /> : <ArrowRightIcon />}\n </button>\n )}\n </form>\n {config.showWatermark && (\n <div class=\"popover-watermark\">\n Powered by{\" \"}\n <a\n href=\"https://kenobi.ai\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Kenobi\n </a>\n </div>\n )}\n </div>\n )}\n\n {config.showKeyboardHints && config.enableFocusMode && (\n <div\n class={`kbd-hint ${\n !isPopoverOpen && !isPending && !isSuccess ? \"visible\" : \"\"\n }`}\n >\n <div class=\"kbd-group\">\n <div class=\"kbd\">Esc</div>\n </div>\n <span class=\"kbd-text\">to dismiss</span>\n </div>\n )}\n </div>\n\n <div\n ref={launcherRef}\n class={`launcher theme-${config.theme || \"glass\"} pos-${\n config.position || \"top-center\"\n }`}\n style={{\n ...getThemeStyles(config.customTheme),\n ...config.launcherStyles,\n pointerEvents: isLauncherVisible ? \"auto\" : \"none\",\n }}\n onClick={(e) => {\n e.stopPropagation();\n setIsDismissed(false);\n setMode(\"card\");\n setIsOpen(isPopoverEnabled);\n }}\n role=\"button\"\n tabIndex={0}\n >\n {config.launcherShineBorder?.enabled && (\n <div\n class=\"launcher-shine-border\"\n style={{\n \"--shine-duration\": `${\n config.launcherShineBorder.duration || 14\n }s`,\n \"--shine-border-width\": `${\n config.launcherShineBorder.borderWidth || 1\n }px`,\n backgroundImage: `radial-gradient(transparent, transparent, ${\n Array.isArray(config.launcherShineBorder.color)\n ? config.launcherShineBorder.color.join(\",\")\n : config.launcherShineBorder.color || \"rgba(255,255,255,0.5)\"\n }, transparent, transparent)`,\n }}\n />\n )}\n <button\n class=\"btn-dismiss launcher-dismiss\"\n aria-label=\"Dismiss\"\n onClick={(e) => {\n e.stopPropagation();\n setIsDismissed(true);\n config.onDismiss?.();\n }}\n >\n <XMarkIcon />\n </button>\n {config.showLauncherLogo !== false && (\n <div class=\"launcher-logo\">\n <LogoIcon />\n </div>\n )}\n <div class=\"launcher-label\">\n <span>\n {(() => {\n // Parse \"For {domain}\" pattern to underline the domain\n const forMatch = launcherLabelText.match(/^(For\\s+)(.+)$/i);\n if (forMatch) {\n return (\n <Fragment>\n {forMatch[1]}\n <span class=\"launcher-domain\">{forMatch[2]}</span>\n </Fragment>\n );\n }\n return launcherLabelText;\n })()}\n </span>\n {isDeanonymized && renderDeanonymizedChip(\"launcher\")}\n </div>\n\n <div class=\"launcher-actions\">\n {config.enableUndoToggle && hasHadSuccess && (\n <button\n class=\"btn-toggle-personalization\"\n aria-label={\n config.isPersonalized ? \"Show original\" : \"Show personalized\"\n }\n onClick={(e) => {\n e.stopPropagation();\n config.onTogglePersonalization?.();\n }}\n >\n <ArrowPathIcon />\n <span class=\"toggle-tooltip\">\n {config.isPersonalized ? \"Show original\" : \"Show personalized\"}\n </span>\n </button>\n )}\n\n {config.launcherAction &&\n config.launcherAction.status !== \"idle\" &&\n hasHadSuccess && (\n <button\n class={`btn-toggle-personalization${\n config.launcherAction.status === \"loading\" ? \" loading\" : \"\"\n }`}\n aria-label={config.launcherAction.tooltip || \"Action\"}\n onClick={(e) => {\n e.stopPropagation();\n config.launcherAction?.onClick?.();\n }}\n disabled={config.launcherAction.status === \"loading\"}\n >\n {config.launcherAction.status === \"loading\" ? (\n <LoaderIcon />\n ) : (\n <ArrowRightIcon />\n )}\n {config.launcherAction.tooltip && (\n <span class=\"toggle-tooltip\">\n {config.launcherAction.tooltip}\n </span>\n )}\n </button>\n )}\n </div>\n\n {showLauncherHint && (\n <div class=\"kbd-hint visible launcher-hint\" aria-hidden=\"true\">\n {launcherHint.keys.length > 0 && (\n <div class=\"kbd-group\">\n {launcherHint.keys.map((key, index) => (\n <div class=\"kbd\" key={index}>\n {key}\n </div>\n ))}\n </div>\n )}\n <span class=\"kbd-text\">{launcherHint.label}</span>\n </div>\n )}\n </div>\n </Fragment>\n );\n};\n\n// -- Main Class Wrapper (API compatible with old version) --\n\nexport class CueCard {\n private host: HTMLElement;\n private shadow: ShadowRoot;\n private config: CueCardConfig;\n private isOpen = false;\n private skipFocus = false;\n private mountTarget: HTMLElement | null = null;\n private deanonymizedCompany: DeanonymizedCompany | null = null;\n private deanonymizationStatus: \"idle\" | \"pending\" | \"resolved\" | \"failed\" =\n \"idle\";\n private deanonymizationCleanup: (() => void) | null = null;\n private hasStartedDeanonymization = false;\n\n constructor(config: CueCardConfig) {\n this.config = {\n position: \"top-center\",\n direction: \"top-to-bottom\",\n theme: \"glass\",\n entranceDelayMs: 0,\n exitDelayMs: 75,\n hasPersonalization: false,\n isVisible: false,\n progressPct: 0,\n status: \"resting\",\n enableTimer: true,\n timerDurationMs: 20_000,\n enableLauncher: true,\n enableFocusMode: false,\n focusBlurIntensity: \"10px\",\n focusDelayMs: 500,\n showKeyboardHints: false,\n showWatermark: true,\n mountMode: \"overlay\",\n ...config,\n };\n this.mountTarget = config.mountNode ?? null;\n if (this.isDeanonymizationEnabled()) {\n this.deanonymizationStatus = \"pending\";\n }\n\n this.host = document.createElement(\"div\");\n this.host.id = \"kenobi-cue-card-root\";\n this.applyHostStyles();\n\n this.shadow = this.host.attachShadow({ mode: \"open\" });\n\n // Inject Styles once\n const style = document.createElement(\"style\");\n style.textContent = STYLES;\n this.shadow.appendChild(style);\n\n // Create a mount point inside shadow DOM for Preact\n const mountPoint = document.createElement(\"div\");\n this.shadow.appendChild(mountPoint);\n }\n\n private applyHostStyles() {\n const isInline = this.config.mountMode === \"inline\";\n this.host.classList.toggle(\"kb-inline\", isInline);\n\n // Apply configurable CSS variables to the host\n const focusBlur = this.config.focusBlurIntensity ?? \"10px\";\n\n if (isInline) {\n this.host.style.cssText = `\n position: relative !important;\n z-index: auto !important;\n top: auto !important;\n left: auto !important;\n width: 100% !important;\n height: auto !important;\n pointer-events: auto !important;\n isolation: auto !important;\n display: block !important;\n --kb-focus-blur: ${focusBlur};\n `;\n return;\n }\n\n this.host.style.cssText = `\n position: fixed !important;\n z-index: 2147483647 !important;\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: 0 !important;\n pointer-events: none !important;\n isolation: isolate !important;\n --kb-focus-blur: ${focusBlur};\n `;\n }\n\n public mount(target?: HTMLElement) {\n const resolvedTarget =\n target || this.config.mountNode || this.mountTarget || document.body;\n this.mountTarget = resolvedTarget;\n\n if (!resolvedTarget.contains(this.host)) {\n resolvedTarget.appendChild(this.host);\n }\n\n this.applyHostStyles();\n this.startDeanonymization();\n this.render();\n }\n\n public unmount() {\n // Cleanup Preact tree\n render(null, this.shadow.lastElementChild as HTMLElement);\n this.host.remove();\n this.deanonymizationCleanup?.();\n this.deanonymizationCleanup = null;\n }\n\n public update(newState: Partial<CueCardConfig>) {\n // Close form when transitioning to 'starting' status\n if (newState.status === \"starting\" && this.config.status !== \"starting\") {\n this.isOpen = false;\n }\n\n const wasDeanonymizationEnabled = this.isDeanonymizationEnabled();\n this.config = { ...this.config, ...newState };\n const isDeanonymizationEnabled = this.isDeanonymizationEnabled();\n\n if (isDeanonymizationEnabled && !wasDeanonymizationEnabled) {\n this.deanonymizationStatus = \"pending\";\n this.startDeanonymization();\n }\n if (!isDeanonymizationEnabled && wasDeanonymizationEnabled) {\n this.deanonymizedCompany = null;\n this.deanonymizationStatus = \"idle\";\n this.deanonymizationCleanup?.();\n this.deanonymizationCleanup = null;\n this.hasStartedDeanonymization = false;\n }\n\n this.applyHostStyles();\n this.render();\n }\n\n private isDeanonymizationEnabled() {\n return this.config.deanonymization?.provider === \"Kenobi\";\n }\n\n private startDeanonymization() {\n if (!this.isDeanonymizationEnabled()) return;\n if (this.hasStartedDeanonymization) return;\n if (this.deanonymizationStatus !== \"pending\") return;\n\n this.hasStartedDeanonymization = true;\n\n if (typeof window === \"undefined\") {\n this.deanonymizationStatus = \"failed\";\n this.render();\n return;\n }\n\n const cachedIdentity = window.__kenobiIdentityResolution as\n | IdentityResolutionDetail\n | null\n | undefined;\n if (cachedIdentity) {\n this.handleDeanonymizationResult(cachedIdentity);\n return;\n }\n\n const handleEvent = (event: Event) => {\n const detail = (event as CustomEvent<IdentityResolutionDetail>).detail;\n this.handleDeanonymizationResult(detail);\n };\n\n window.addEventListener(IDENTITY_RESOLVED_EVENT, handleEvent);\n ensureKenobiSnitcherLoaded(this.config.deanonymization);\n\n const timeoutMs =\n this.config.deanonymization?.timeoutMs ?? DEFAULT_DEANON_TIMEOUT_MS;\n const timeoutId = window.setTimeout(() => {\n window.removeEventListener(IDENTITY_RESOLVED_EVENT, handleEvent);\n this.handleDeanonymizationResult(null);\n }, timeoutMs);\n\n this.deanonymizationCleanup = () => {\n window.removeEventListener(IDENTITY_RESOLVED_EVENT, handleEvent);\n window.clearTimeout(timeoutId);\n };\n }\n\n private handleDeanonymizationResult(\n detail?: IdentityResolutionDetail | null\n ) {\n if (this.deanonymizationStatus !== \"pending\") return;\n\n this.deanonymizationCleanup?.();\n this.deanonymizationCleanup = null;\n\n const company = resolveDeanonymizedCompany(detail);\n this.deanonymizedCompany = company;\n this.deanonymizationStatus = company ? \"resolved\" : \"failed\";\n if (company) {\n dispatchCueCardEvent(\"deanonymization:success\", {\n company,\n detail,\n });\n } else {\n dispatchCueCardEvent(\"deanonymization:fail\", {\n detail,\n });\n }\n this.render();\n }\n\n private getRenderConfig() {\n if (this.deanonymizationStatus === \"pending\") {\n return { ...this.config, isVisible: false };\n }\n return this.config;\n }\n\n private clearDeanonymizedCompany = () => {\n const previousCompany = this.deanonymizedCompany;\n const shouldResetStatus =\n this.config.status === \"success\" || this.config.isPersonalized;\n\n if (this.config.isPersonalized) {\n this.config.onTogglePersonalization?.();\n }\n\n this.deanonymizedCompany = null;\n this.deanonymizationStatus = \"failed\";\n if (previousCompany) {\n dispatchCueCardEvent(\"deanonymization:not-you\", {\n company: previousCompany,\n });\n }\n\n if (shouldResetStatus) {\n this.config = {\n ...this.config,\n status: \"resting\",\n progressPct: 0,\n isPersonalized: false,\n };\n }\n\n this.render();\n };\n\n public setTheme(theme: CueCardTheme) {\n this.update({ theme });\n }\n\n public openForm(skipFocus?: boolean) {\n this.isOpen = true;\n this.skipFocus = skipFocus ?? false;\n this.render();\n }\n\n private render() {\n // We render the Preact component into the shadow root mount point\n const mountPoint = this.shadow.lastElementChild as HTMLElement;\n const skipFocusOnce = this.skipFocus;\n this.skipFocus = false; // Reset after reading\n\n render(\n <CueCardContent\n config={this.getRenderConfig()}\n isOpen={this.isOpen}\n skipFocus={skipFocusOnce}\n deanonymizedCompany={this.deanonymizedCompany}\n onClearDeanonymizedCompany={this.clearDeanonymizedCompany}\n setIsOpen={(val) => {\n this.isOpen = val;\n this.config.onOpenChange?.(val);\n this.render(); // Re-render on state change since we are outside the react tree\n }}\n />,\n mountPoint\n );\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,MAAI,yBAAyB;AAE7B,WAAS,WAAW,UAAU,QAAQ;AAClC,QAAI,cAAc,OAAO;AACzB,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AAGJ,QAAI,OAAO,aAAa,0BAA0B,SAAS,aAAa,wBAAwB;AAC9F;AAAA,IACF;AAGA,aAASA,KAAI,YAAY,SAAS,GAAGA,MAAK,GAAGA,MAAK;AAC9C,aAAO,YAAYA,EAAC;AACpB,iBAAW,KAAK;AAChB,yBAAmB,KAAK;AACxB,kBAAY,KAAK;AAEjB,UAAI,kBAAkB;AAClB,mBAAW,KAAK,aAAa;AAC7B,oBAAY,SAAS,eAAe,kBAAkB,QAAQ;AAE9D,YAAI,cAAc,WAAW;AACzB,cAAI,KAAK,WAAW,SAAQ;AACxB,uBAAW,KAAK;AAAA,UACpB;AACA,mBAAS,eAAe,kBAAkB,UAAU,SAAS;AAAA,QACjE;AAAA,MACJ,OAAO;AACH,oBAAY,SAAS,aAAa,QAAQ;AAE1C,YAAI,cAAc,WAAW;AACzB,mBAAS,aAAa,UAAU,SAAS;AAAA,QAC7C;AAAA,MACJ;AAAA,IACJ;AAIA,QAAI,gBAAgB,SAAS;AAE7B,aAASC,KAAI,cAAc,SAAS,GAAGA,MAAK,GAAGA,MAAK;AAChD,aAAO,cAAcA,EAAC;AACtB,iBAAW,KAAK;AAChB,yBAAmB,KAAK;AAExB,UAAI,kBAAkB;AAClB,mBAAW,KAAK,aAAa;AAE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AAA,QACf,GAAG;AAAA,MACL;AAEA,WAAK,qBAAqB;AAAA,QACxB,KAAK,OAAO;AAAA,MACd;AACA,WAAK,eAAe,IAAI,uBAAuB;AAE/C,WAAK,eAAe;AAEpB,WAAK,cAAc,KAAK,eAAe;AACvC,WAAK,aAAa,KAAK,cAAc;AAErC,UAAI;AACF,aAAK,uBAAuB;AAAA,MAC9B,SAAS,OAAO;AACd,aAAK;AAAA,UACH;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AACA,WAAK,IAAI,SAAS,oBAAoB;AAEtC,UAAI,KAAK,OAAO,eAAe;AAC7B,aAAK,IAAI,SAAS,4CAA4C;AAC9D,aAAK,KAAK,mBAAmB;AAAA,MAC/B;AAGA,UAAI,KAAK,OAAO,aAAa,CAAC,KAAK,OAAO,sBAAsB;AAC9D,aAAK,IAAI,SAAS,sDAAsD;AACxE,aAAK,KAAK,YAAY;AAAA,MACxB;AAAA,IACF;AAAA,EA01CF;AAz5Ca;AAAb,MAAM,SAAN;",
6
+ "names": ["i", "d", "morphAttrs", "morphdom", "childrenOnly", "slice", "options", "vnodeId", "isValidElement", "rerenderQueue", "prevDebounce", "defer", "depthSort", "CAPTURE_REGEX", "eventClock", "eventProxy", "eventProxyCapture", "i", "EMPTY_OBJ", "EMPTY_ARR", "IS_NON_DIMENSIONAL", "isArray", "Array", "assign", "obj", "props", "removeNode", "node", "parentNode", "removeChild", "createElement", "type", "children", "key", "ref", "normalizedProps", "arguments", "length", "call", "defaultProps", "createVNode", "original", "vnode", "__k", "__", "__b", "__e", "__c", "constructor", "__v", "__i", "__u", "Fragment", "props", "children", "BaseComponent", "context", "this", "getDomSibling", "vnode", "childIndex", "__", "__i", "sibling", "__k", "length", "__e", "type", "updateParentDomPointers", "i", "child", "__c", "base", "enqueueRender", "c", "__d", "rerenderQueue", "push", "process", "__r", "prevDebounce", "options", "debounceRendering", "defer", "component", "newVNode", "oldVNode", "oldDom", "commitQueue", "refQueue", "l", "sort", "depthSort", "shift", "__v", "__P", "assign", "diff", "__n", "namespaceURI", "__u", "commitRoot", "diffChildren", "parentDom", "renderResult", "newParentVNode", "oldParentVNode", "globalContext", "namespace", "excessDomChildren", "isHydrating", "childVNode", "newDom", "firstChildDom", "result", "shouldPlace", "oldChildren", "EMPTY_ARR", "newChildrenLength", "constructNewChildrenArray", "EMPTY_OBJ", "ref", "applyRef", "insert", "nextSibling", "skewedIndex", "matchingIndex", "oldChildrenLength", "remainingOldChildren", "skew", "Array", "constructor", "String", "createVNode", "isArray", "undefined", "__b", "key", "findMatchingIndex", "unmount", "parentVNode", "parentNode", "insertBefore", "nodeType", "findMatchingIndex", "childVNode", "oldChildren", "skewedIndex", "remainingOldChildren", "x", "y", "childIndex", "key", "type", "oldVNode", "matched", "__u", "length", "setStyle", "style", "value", "setProperty", "IS_NON_DIMENSIONAL", "test", "dom", "name", "oldValue", "namespace", "useCapture", "lowerCaseName", "o", "cssText", "replace", "CAPTURE_REGEX", "toLowerCase", "slice", "l", "_attached", "eventClock", "addEventListener", "eventProxyCapture", "eventProxy", "removeEventListener", "e", "removeAttribute", "setAttribute", "createEventProxy", "this", "eventHandler", "_dispatched", "options", "event", "diff", "parentDom", "newVNode", "globalContext", "excessDomChildren", "commitQueue", "oldDom", "isHydrating", "refQueue", "tmp", "c", "isNew", "oldProps", "oldState", "snapshot", "clearProcessingException", "newProps", "isClassComponent", "provider", "componentContext", "i", "renderHook", "count", "renderResult", "newType", "undefined", "constructor", "__e", "__b", "outer", "props", "prototype", "render", "contextType", "__c", "__", "__E", "BaseComponent", "doRender", "sub", "state", "context", "__n", "__d", "__h", "_sb", "__s", "getDerivedStateFromProps", "assign", "__v", "componentWillMount", "componentDidMount", "push", "componentWillReceiveProps", "shouldComponentUpdate", "__k", "some", "vnode", "componentWillUpdate", "componentDidUpdate", "__P", "__r", "getChildContext", "getSnapshotBeforeUpdate", "Fragment", "cloneNode", "children", "diffChildren", "isArray", "base", "then", "MODE_HYDRATE", "nodeType", "nextSibling", "indexOf", "removeNode", "markAsForce", "diffElementNodes", "diffed", "forEach", "commitRoot", "root", "applyRef", "cb", "call", "node", "map", "newHtml", "oldHtml", "newChildren", "inputValue", "checked", "localName", "document", "createTextNode", "createElementNS", "is", "__m", "data", "childNodes", "EMPTY_OBJ", "attributes", "__html", "innerHTML", "content", "getDomSibling", "ref", "hasRefUnmount", "current", "unmount", "parentVNode", "skipRemove", "r", "componentWillUnmount", "replaceNode", "documentElement", "createElement", "namespaceURI", "firstChild", "slice", "EMPTY_ARR", "options", "__e", "error", "vnode", "oldVNode", "errorInfo", "component", "ctor", "handled", "__", "__c", "constructor", "getDerivedStateFromError", "setState", "__d", "componentDidCatch", "__E", "e", "vnodeId", "isValidElement", "undefined", "BaseComponent", "prototype", "update", "callback", "s", "this", "__s", "state", "assign", "props", "__v", "_sb", "push", "enqueueRender", "forceUpdate", "__h", "render", "Fragment", "rerenderQueue", "defer", "Promise", "then", "bind", "resolve", "setTimeout", "depthSort", "a", "b", "__b", "process", "__r", "CAPTURE_REGEX", "eventClock", "eventProxy", "createEventProxy", "eventProxyCapture", "i", "currentIndex", "currentComponent", "previousComponent", "prevRaf", "currentHook", "afterPaintEffects", "options", "_options", "oldBeforeDiff", "__b", "oldBeforeRender", "__r", "oldAfterDiff", "diffed", "oldCommit", "__c", "oldBeforeUnmount", "unmount", "oldRoot", "__", "getHookState", "index", "type", "__h", "hooks", "__H", "length", "push", "useState", "initialState", "useReducer", "invokeOrReturn", "reducer", "init", "hookState", "_reducer", "action", "currentValue", "__N", "nextValue", "setState", "__f", "updateHookState", "p", "s", "c", "stateHooks", "filter", "x", "every", "prevScu", "call", "this", "shouldUpdate", "props", "forEach", "hookItem", "shouldComponentUpdate", "prevCWU", "componentWillUpdate", "__e", "tmp", "useEffect", "callback", "args", "state", "__s", "argsChanged", "_pendingArgs", "useRef", "initialValue", "currentHook", "useMemo", "current", "useMemo", "factory", "args", "state", "getHookState", "currentIndex", "argsChanged", "__H", "__", "__h", "useCallback", "callback", "currentHook", "flushAfterPaintEffects", "component", "afterPaintEffects", "shift", "__P", "__H", "__h", "forEach", "invokeCleanup", "invokeEffect", "e", "options", "__e", "__v", "__b", "vnode", "currentComponent", "oldBeforeDiff", "__", "parentDom", "__k", "__m", "oldRoot", "__r", "oldBeforeRender", "currentIndex", "hooks", "__c", "previousComponent", "hookItem", "__N", "_pendingArgs", "diffed", "oldAfterDiff", "c", "length", "push", "prevRaf", "requestAnimationFrame", "afterNextFrame", "commitQueue", "some", "filter", "cb", "oldCommit", "unmount", "oldBeforeUnmount", "hasErrored", "s", "HAS_RAF", "callback", "raf", "done", "clearTimeout", "timeout", "cancelAnimationFrame", "setTimeout", "hook", "comp", "cleanup", "argsChanged", "oldArgs", "newArgs", "arg", "index", "invokeOrReturn", "f", "vnodeId", "createVNode", "type", "props", "key", "isStaticChildren", "__source", "__self", "ref", "i", "normalizedProps", "vnode", "__k", "__", "__b", "__e", "__c", "constructor", "__v", "vnodeId", "__i", "__u", "defaultProps", "options", "u", "u", "A", "y", "d", "q", "e", "s", "f", "exitAnim", "a", "isBackgroundClippedToText", "fragment", "delay", "IDENTITY_RESOLVED_EVENT", "DEFAULT_DEANON_TIMEOUT_MS", "s", "r", "c", "e", "t", "_", "i"]
7
7
  }