{"version":3,"names":["onCleanup","Timeout","isInteractiveElement","HoverInteraction","constructor","pointerType","undefined","interactedInside","handler","blockMouseMove","performedPointerEventsMutation","pointerEventsScopeElement","pointerEventsReferenceElement","pointerEventsFloatingElement","restTimeoutPending","openChangeTimeout","restTimeout","handleCloseOptions","create","dispose","clear","pointerEventsMutationOwnerByScopeElement","WeakMap","clearSafePolygonPointerEventsMutation","instance","scopeElement","get","style","removeProperty","delete","applySafePolygonPointerEventsMutation","options","referenceElement","floatingElement","existingOwner","set","pointerEvents","useHoverInteractionSharedState","store","data","context","dataRef","current","hoverInteractionState"],"sources":["use-hover-interaction-shared-state.ts"],"sourcesContent":["/**\n * Stage 4.4 port of Base UI React's `useHoverInteractionSharedState`.\n *\n * React source:\n *   `base-ui/packages/react/src/floating-ui-react/hooks/useHoverInteractionSharedState.ts`\n *\n * Exposes the `HoverInteraction` class — a plain mutable bag of state\n * shared between `useHoverReferenceInteraction` (reference-side) and\n * `useHoverFloatingInteraction` (floating-side) so both can cooperate on\n * cursor-type tracking, timers, and safe-polygon bookkeeping.\n *\n * The instance is attached to `rootStore.context.dataRef.current` under a\n * `hoverInteractionState` key so independent hook instances on the same\n * floating root share the same mutable bag (matches React).\n *\n * ### React → Solid deviations\n *\n * 1. `useRefWithInit(HoverInteraction.create)` → plain variable access.\n *    Solid component bodies run once per mount, so `new HoverInteraction()`\n *    at setup time matches React's one-shot initialization.\n * 2. `useOnMount(dispose)` → `onCleanup(dispose)` registered during setup.\n *    Same effect: timers get cleared when the owning scope disposes.\n * 3. No reactivity is involved — all fields are plain mutables. The class\n *    shape, `dispose()` semantics, and `Timeout` usage are copied 1:1.\n */\n\nimport { onCleanup } from \"solid-js\";\nimport { Timeout } from \"../../use-timeout\";\nimport type { FloatingRootStore } from \"../components/floating-root-store\";\nimport type { ContextData } from \"../types\";\nimport { isInteractiveElement } from \"../utils/element\";\nimport type { SafePolygonOptions } from \"./use-hover-shared\";\n\nexport { isInteractiveElement };\n\n/**\n * Shared mutable state bag for a single floating root's hover cluster.\n */\nexport class HoverInteraction {\n\tpointerType: string | undefined;\n\tinteractedInside: boolean;\n\thandler: ((event: MouseEvent) => void) | undefined;\n\tblockMouseMove: boolean;\n\tperformedPointerEventsMutation: boolean;\n\tpointerEventsScopeElement: HTMLElement | SVGSVGElement | null;\n\tpointerEventsReferenceElement: HTMLElement | SVGSVGElement | null;\n\tpointerEventsFloatingElement: HTMLElement | null;\n\trestTimeoutPending: boolean;\n\topenChangeTimeout: Timeout;\n\trestTimeout: Timeout;\n\thandleCloseOptions: SafePolygonOptions | undefined;\n\n\tconstructor() {\n\t\tthis.pointerType = undefined;\n\t\tthis.interactedInside = false;\n\t\tthis.handler = undefined;\n\t\tthis.blockMouseMove = true;\n\t\tthis.performedPointerEventsMutation = false;\n\t\tthis.pointerEventsScopeElement = null;\n\t\tthis.pointerEventsReferenceElement = null;\n\t\tthis.pointerEventsFloatingElement = null;\n\t\tthis.restTimeoutPending = false;\n\t\tthis.openChangeTimeout = new Timeout();\n\t\tthis.restTimeout = new Timeout();\n\t\tthis.handleCloseOptions = undefined;\n\t}\n\n\tstatic create(): HoverInteraction {\n\t\treturn new HoverInteraction();\n\t}\n\n\tdispose = (): void => {\n\t\tthis.openChangeTimeout.clear();\n\t\tthis.restTimeout.clear();\n\t};\n}\n\ntype PointerEventsMutationState = Pick<\n\tHoverInteraction,\n\t| \"performedPointerEventsMutation\"\n\t| \"pointerEventsScopeElement\"\n\t| \"pointerEventsReferenceElement\"\n\t| \"pointerEventsFloatingElement\"\n>;\n\n/**\n * Track which `HoverInteraction` instance currently owns the pointer-events\n * mutation for a given scope element. Only the owner may clear the styles,\n * preventing sibling hover surfaces from stomping on each other.\n */\nconst pointerEventsMutationOwnerByScopeElement = new WeakMap<\n\tHTMLElement | SVGSVGElement,\n\tPointerEventsMutationState\n>();\n\nexport function clearSafePolygonPointerEventsMutation(\n\tinstance: PointerEventsMutationState,\n): void {\n\tif (!instance.performedPointerEventsMutation) {\n\t\treturn;\n\t}\n\n\tconst scopeElement = instance.pointerEventsScopeElement;\n\n\tif (\n\t\tscopeElement &&\n\t\tpointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance\n\t) {\n\t\tinstance.pointerEventsScopeElement?.style.removeProperty(\"pointer-events\");\n\t\tinstance.pointerEventsReferenceElement?.style.removeProperty(\n\t\t\t\"pointer-events\",\n\t\t);\n\t\tinstance.pointerEventsFloatingElement?.style.removeProperty(\n\t\t\t\"pointer-events\",\n\t\t);\n\t\tpointerEventsMutationOwnerByScopeElement.delete(scopeElement);\n\t}\n\n\tinstance.performedPointerEventsMutation = false;\n\tinstance.pointerEventsScopeElement = null;\n\tinstance.pointerEventsReferenceElement = null;\n\tinstance.pointerEventsFloatingElement = null;\n}\n\nexport function applySafePolygonPointerEventsMutation(\n\tinstance: PointerEventsMutationState,\n\toptions: {\n\t\tscopeElement: HTMLElement | SVGSVGElement;\n\t\treferenceElement: HTMLElement | SVGSVGElement;\n\t\tfloatingElement: HTMLElement;\n\t},\n): void {\n\tconst { scopeElement, referenceElement, floatingElement } = options;\n\n\tconst existingOwner =\n\t\tpointerEventsMutationOwnerByScopeElement.get(scopeElement);\n\tif (existingOwner && existingOwner !== instance) {\n\t\tclearSafePolygonPointerEventsMutation(existingOwner);\n\t}\n\n\tclearSafePolygonPointerEventsMutation(instance);\n\tinstance.performedPointerEventsMutation = true;\n\tinstance.pointerEventsScopeElement = scopeElement;\n\tinstance.pointerEventsReferenceElement = referenceElement;\n\tinstance.pointerEventsFloatingElement = floatingElement;\n\tpointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);\n\n\tscopeElement.style.pointerEvents = \"none\";\n\treferenceElement.style.pointerEvents = \"auto\";\n\tfloatingElement.style.pointerEvents = \"auto\";\n}\n\ntype HoverContextData = ContextData & {\n\thoverInteractionState?: HoverInteraction | undefined;\n};\n\n/**\n * Returns the `HoverInteraction` bag for the given root store, creating\n * and caching it on the shared `dataRef` if needed. All hover hooks that\n * cooperate on the same root share a single instance.\n */\nexport function useHoverInteractionSharedState(\n\tstore: FloatingRootStore,\n): HoverInteraction {\n\tconst data = store.context.dataRef.current as HoverContextData;\n\tif (!data.hoverInteractionState) {\n\t\tdata.hoverInteractionState = HoverInteraction.create();\n\t}\n\n\tconst instance = data.hoverInteractionState;\n\n\t// React uses `useOnMount(disposeEffect)` — run `dispose()` on unmount.\n\t// In Solid, the owning scope's `onCleanup` is the direct analogue.\n\tonCleanup(() => {\n\t\tinstance.dispose();\n\t});\n\n\treturn instance;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,QAAQ,UAAU;AACpC,SAASC,OAAO,QAAQ,mBAAmB;AAG3C,SAASC,oBAAoB,QAAQ,kBAAkB;AAGvD,SAASA,oBAAoB;;AAE7B;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAAC;EAc7BC,WAAWA,CAAA,EAAG;IACb,IAAI,CAACC,WAAW,GAAGC,SAAS;IAC5B,IAAI,CAACC,gBAAgB,GAAG,KAAK;IAC7B,IAAI,CAACC,OAAO,GAAGF,SAAS;IACxB,IAAI,CAACG,cAAc,GAAG,IAAI;IAC1B,IAAI,CAACC,8BAA8B,GAAG,KAAK;IAC3C,IAAI,CAACC,yBAAyB,GAAG,IAAI;IACrC,IAAI,CAACC,6BAA6B,GAAG,IAAI;IACzC,IAAI,CAACC,4BAA4B,GAAG,IAAI;IACxC,IAAI,CAACC,kBAAkB,GAAG,KAAK;IAC/B,IAAI,CAACC,iBAAiB,GAAG,IAAId,OAAO,CAAC,CAAC;IACtC,IAAI,CAACe,WAAW,GAAG,IAAIf,OAAO,CAAC,CAAC;IAChC,IAAI,CAACgB,kBAAkB,GAAGX,SAAS;EACpC;EAEA,OAAOY,MAAMA,CAAA,EAAqB;IACjC,OAAO,IAAIf,gBAAgB,CAAC,CAAC;EA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