{"version":3,"names":["getComputedStyle","getParentNode","isElement","isHTMLElement","isLastTraversableNode","isShadowRoot","isWebKit","createEffect","untrack","createChangeEventDetails","REASONS","contains","ownerDocument","readOption","createStableCallback","Timeout","useTimeout","isInsideNestedPortal","useFloatingTree","createAttribute","getTarget","isEventTargetWithin","isRootElement","getNodeChildren","bubbleHandlerKeys","intentional","sloppy","alwaysFalse","normalizeProp","normalizable","resolved","escapeKey","outsidePress","obj","undefined","useDismiss","context","props","resolveStore","ctx","rootStore","initialStore","dataRef","outsidePressProp","outsidePressEvent","referencePress","referencePressEvent","externalTree","getEnabled","enabled","getEscapeKey","tree","outsidePressFn","outsidePressEnabled","getOutsidePressEventProp","pressStartedInsideRef","current","pressStartPreventedRef","suppressNextOutsideClickRef","getBubblesPair","bubbles","getEscapeKeyBubbles","touchStateRef","cancelDismissOnEndTimeout","clearInsideReactTreeTimeout","clearInsideReactTree","clear","insideReactTree","isComposingRef","currentPointerTypeRef","isReferencePressEnabled","closeOnEscapeKeyDown","event","liveStore","state","open","key","liveDataRef","nodeId","floatingContext","children","nodesRef","escapeKeyBubbles","length","shouldDismiss","child","__escapeKeyBubbles","eventDetails","setOpen","isPropagationAllowed","stopPropagation","markInsideReactTree","start","floatingElement","outsidePressBubbles","snapshot","store","__outsidePressBubbles","compositionTimeout","preventedPressSuppressionTimeout","handleCompositionStart","handleCompositionEnd","suppressImmediateOutsideClickAfterPreventedStart","resetPressStartState","getOutsidePressEvent","type","computedType","outsidePressEventValue","shouldIgnoreEvent","computedOutsidePressEvent","isEventWithinFloatingTree","targetIsInsideChildren","some","node","elements","floating","domReferenceElement","isInjectedThirdPartyPress","target","markers","ancestor","nextParent","every","marker","isPressOnScrollbar","el","lastTraversableNode","style","scrollRe","isScrollableX","test","overflowX","isScrollableY","overflowY","canScrollX","clientWidth","scrollWidth","canScrollY","clientHeight","scrollHeight","isRTL","direction","mouseEvent","pressedVerticalScrollbar","offsetX","offsetWidth","pressedHorizontalScrollbar","offsetY","closeOnPressOutside","inertSelector","targetRoot","getRootNode","Array","from","querySelectorAll","triggers","triggerElements","hasElement","hasMatchingElement","trigger","handlePointerDown","pointerType","handleTouchStart","touch","touches","startTime","Date","now","startX","clientX","startY","clientY","dismissOnTouchEnd","dismissOnMouseDown","addTargetEventListenerOnce","listener","handler","removeEventListener","addEventListener","handleTouchStartCapture","closeOnPressOutsideCapture","targetEvent","handlePressEndCapture","pressStartedInsideDefaultPrevented","handleTouchMove","deltaX","Math","abs","deltaY","distance","sqrt","handleTouchMoveCapture","handleTouchEnd","handleTouchEndCapture","markNestedPortalPressCapture","nestedPortalLatchEvents","doc","cleanups","push","cleanup","buildReference","handlePress","triggerPress","bag","onKeyDown","onClick","markPressStartedInsideReactTree","button","markInsidePressStartPrevented","defaultPrevented","onPointerDown","onMouseDown","onClickCapture","onMouseDownCapture","onPointerDownCapture","onMouseUpCapture","onTouchEndCapture","onTouchMoveCapture","isStaticallyDisabled","reference"],"sources":["use-dismiss.ts"],"sourcesContent":["/**\n * Port of Base UI React's `useDismiss` hook.\n *\n * React source:\n *   `base-ui/packages/react/src/floating-ui-react/hooks/useDismiss.ts`\n *\n * Dismisses the floating element on:\n *  - Escape key (gated by `escapeKey`).\n *  - Outside press (gated by `outsidePress`) — driven by an\n *    `intentional`/`sloppy` press-type state machine:\n *      * `intentional` — mouse fires on `pointerup`; touch requires a\n *        minimal movement or `touchend` within a short window.\n *      * `sloppy` — mouse fires on `pointerdown`; touch fires on\n *        `touchend` (within 1 s) or a scroll-away gesture.\n *  - Reference press (gated by `referencePress`) — the bubble handler\n *    fires on `onPointerDown` when `sloppy` and `onClick` when\n *    `intentional`; a fallback `onClick` also fires in `sloppy` mode so\n *    keyboard activation keeps working.\n *\n * ### React → Solid deviations\n *\n * 1. `useEffect` with deps → `createEffect` in split compute/apply form.\n *    The apply runs whenever any tracked read changes. We purposely\n *    track a memoised options-snapshot getter to match React's dep\n *    array: the effect re-installs listeners when `open`, `enabled`,\n *    `escapeKey`, `outsidePress` (only boolean/fn swap), or `doc`\n *    identity changes.\n *\n * 2. `useRef` → `MutableRef<T>` (keeps the `.current` read/write shape\n *    callers elsewhere in the port already use).\n *\n * 3. `useStableCallback` → `createStableCallback` from\n *    `src/internals/stable-callback.ts`. Used to stabilise listener\n *    identity so `addEventListener` / `removeEventListener` pair up.\n *\n * 4. React's `isReactEvent` branch (unwrap `.nativeEvent`) is dropped —\n *    Solid event handlers receive native events directly, so the\n *    keydown handler takes a plain `KeyboardEvent`.\n *\n * 5. React's `useTimeout` (from `@base-ui/utils`) maps to the\n *    `useTimeout` helper at `src/internals/use-timeout.ts`. The `Timeout`\n *    class ships `start(delay, fn)` + `clear()` with the same\n *    semantics.\n *\n * 6. Shadow-DOM-safe `contains()` from `src/internals/dom/contains.ts`\n *    replaces raw `node.contains(target)`.\n *\n * 7. Tree-aware dismissal (parent popover not dismissing when click\n *    lands inside a child floating element, gated by `bubbles.*`)\n *    follows React 1:1 — the parent reads `__escapeKeyBubbles` /\n *    `__outsidePressBubbles` latches stamped on each child's\n *    `dataRef` during its own `useDismiss` effect.\n */\nimport {\n\tgetComputedStyle,\n\tgetParentNode,\n\tisElement,\n\tisHTMLElement,\n\tisLastTraversableNode,\n\tisShadowRoot,\n\tisWebKit,\n} from \"@floating-ui/utils/dom\";\nimport { createEffect, untrack } from \"solid-js\";\nimport {\n\ttype BaseUIChangeEventDetails,\n\tcreateChangeEventDetails,\n\tREASONS,\n} from \"../../change-event-details\";\nimport { contains } from \"../../dom/contains\";\nimport { ownerDocument } from \"../../dom/owner-document\";\nimport { type MaybeAccessor, readOption } from \"../../maybe-accessor\";\nimport { createStableCallback } from \"../../stable-callback\";\nimport { Timeout, useTimeout } from \"../../use-timeout\";\nimport { isInsideNestedPortal } from \"../components/floating-portal\";\nimport { useFloatingTree } from \"../components/floating-tree\";\nimport type { FloatingTreeStore } from \"../components/floating-tree-store\";\nimport type {\n\tElementProps,\n\tElementPropsBag,\n\tFloatingContext,\n\tFloatingRootContext,\n\tMutableRef,\n} from \"../types\";\nimport { createAttribute } from \"../utils/create-attribute\";\nimport {\n\tgetTarget,\n\tisEventTargetWithin,\n\tisRootElement,\n} from \"../utils/element\";\nimport { getNodeChildren } from \"../utils/nodes\";\n\ntype PressType = \"intentional\" | \"sloppy\";\n\nconst bubbleHandlerKeys = {\n\tintentional: \"onClick\",\n\tsloppy: \"onPointerDown\",\n} as const;\n\nfunction alwaysFalse() {\n\treturn false;\n}\n\n/**\n * Normalise `bubbles` into an explicit `{ escapeKey, outsidePress }`\n * pair. Shorthand boolean applies to both; object form fills defaults.\n * Accessors on either the outer `bubbles` prop or the nested fields are\n * resolved at the call site. Defaults (matching React):\n * `escapeKey: false`, `outsidePress: true`.\n */\nfunction normalizeProp(\n\tnormalizable?:\n\t\t| MaybeAccessor<\n\t\t\t\t| boolean\n\t\t\t\t| {\n\t\t\t\t\t\tescapeKey?: MaybeAccessor<boolean> | undefined;\n\t\t\t\t\t\toutsidePress?: MaybeAccessor<boolean> | undefined;\n\t\t\t\t  }\n\t\t  >\n\t\t| undefined,\n): { escapeKey: boolean; outsidePress: boolean } {\n\tconst resolved =\n\t\ttypeof normalizable === \"function\"\n\t\t\t? (normalizable as () => unknown)()\n\t\t\t: normalizable;\n\tif (typeof resolved === \"boolean\") {\n\t\treturn { escapeKey: resolved, outsidePress: resolved };\n\t}\n\tconst obj = resolved as\n\t\t| {\n\t\t\t\tescapeKey?: MaybeAccessor<boolean> | undefined;\n\t\t\t\toutsidePress?: MaybeAccessor<boolean> | undefined;\n\t\t  }\n\t\t| undefined;\n\treturn {\n\t\tescapeKey: obj?.escapeKey === undefined ? false : readOption(obj.escapeKey),\n\t\toutsidePress:\n\t\t\tobj?.outsidePress === undefined ? true : readOption(obj.outsidePress),\n\t};\n}\n\nexport interface UseDismissProps {\n\t/**\n\t * Whether the Hook is enabled, including all internal Effects and event\n\t * handlers. Accepts an accessor for reactive flips (solidify.md P3).\n\t * @default true\n\t */\n\tenabled?: MaybeAccessor<boolean> | undefined;\n\t/**\n\t * Whether to dismiss the floating element upon pressing the `esc` key.\n\t * Accepts an accessor for reactive flips.\n\t * @default true\n\t */\n\tescapeKey?: MaybeAccessor<boolean> | undefined;\n\t/**\n\t * Whether to dismiss the floating element upon pressing the reference\n\t * element. You likely want to ensure the `move` option in the `useHover()`\n\t * Hook has been disabled when this is in use.\n\t *\n\t * A lazy getter invoked when handling reference press events.\n\t * @default false\n\t */\n\treferencePress?: (() => boolean) | undefined;\n\t/**\n\t * The type of event to use to determine a \"press\".\n\t * - `sloppy` is `pointerdown` on mouse input, but special touch handling\n\t *   on touch input.\n\t * - `intentional` is lazy on both mouse + touch input (equivalent to\n\t *   `click`).\n\t * @default 'sloppy'\n\t */\n\treferencePressEvent?: PressType | undefined;\n\t/**\n\t * Whether to dismiss the floating element upon pressing outside of the\n\t * floating element.\n\t * If you have another element, like a toast, that is rendered outside the\n\t * floating element's tree and don't want the floating element to close\n\t * when pressing it, you can guard the check like so:\n\t * ```jsx\n\t * useDismiss(context, {\n\t *   outsidePress: (event) => !event.target.closest('.toast'),\n\t * });\n\t * ```\n\t * @default true\n\t */\n\toutsidePress?:\n\t\t| boolean\n\t\t| ((event: MouseEvent | TouchEvent) => boolean)\n\t\t| undefined;\n\t/**\n\t * The type of event to use to determine an outside \"press\".\n\t * - `intentional` requires an intentional click — mouse fires on\n\t *   `pointerup`, touch requires minimal `touchmove`s.\n\t * - `sloppy` fires on `pointerdown` for mouse; touch fires on\n\t *   `touchend` (within 1 s) or on scroll-away after `touchstart`.\n\t *\n\t * Can be a per-input record or a lazy getter returning either form.\n\t * @default 'sloppy'\n\t */\n\toutsidePressEvent?:\n\t\t| PressType\n\t\t| { mouse: PressType; touch: PressType }\n\t\t| (() => PressType | { mouse: PressType; touch: PressType })\n\t\t| undefined;\n\t/**\n\t * Determines whether event listeners bubble upwards through a tree of\n\t * floating elements. Accepts an accessor — including accessors on the\n\t * nested `escapeKey` / `outsidePress` fields — so reactive callers can\n\t * flip submenu escape-bubbling (solidify.md P3).\n\t */\n\tbubbles?:\n\t\t| MaybeAccessor<\n\t\t\t\t| boolean\n\t\t\t\t| {\n\t\t\t\t\t\tescapeKey?: MaybeAccessor<boolean> | undefined;\n\t\t\t\t\t\toutsidePress?: MaybeAccessor<boolean> | undefined;\n\t\t\t\t  }\n\t\t  >\n\t\t| undefined;\n\t/**\n\t * External `FloatingTreeStore` to use when the context-provided one is\n\t * not reachable.\n\t */\n\texternalTree?: FloatingTreeStore | undefined;\n}\n\n/**\n * Closes the floating element when a dismissal is requested — by default,\n * when the user presses `Escape` or outside of the floating element.\n * @see https://floating-ui.com/docs/useDismiss\n */\nexport function useDismiss(\n\tcontext:\n\t\t| FloatingRootContext\n\t\t| FloatingContext\n\t\t| (() => FloatingRootContext | FloatingContext),\n\tprops: UseDismissProps = {},\n): ElementProps {\n\t/**\n\t * Resolve the active floating root store. Accepts either a bare\n\t * context or an accessor so navigation-menu-style compounds can swap\n\t * the root context without re-installing the hook.\n\t */\n\tconst resolveStore = () => {\n\t\tconst ctx =\n\t\t\ttypeof context === \"function\"\n\t\t\t\t? (context as () => FloatingRootContext | FloatingContext)()\n\t\t\t\t: context;\n\t\treturn \"rootStore\" in ctx ? ctx.rootStore : ctx;\n\t};\n\t// The initial store snapshot — handlers that don't re-run on each\n\t// event (e.g. capture-phase listeners) use the live `resolveStore()`\n\t// at call time instead of this binding. `dataRef` is read eagerly\n\t// from the initial snapshot; when the context swaps later, outside\n\t// handlers resolve the live store but still look at the caller's\n\t// original dataRef for the short-lived latches.\n\t// One-shot snapshot (see comment above). `resolveStore` reads the reactive\n\t// `floatingRootContext` accessor (navigation-menu List passes an accessor),\n\t// so untrack the body-time read to avoid `[STRICT_READ_UNTRACKED]`.\n\tconst initialStore = untrack(resolveStore);\n\tconst { dataRef } = initialStore.context;\n\n\t// Untrack the body-time destructure: parents may pass signal-derived\n\t// values via JSX, making each `props.foo` access fire\n\t// `[STRICT_READ_UNTRACKED]` under the strict-read scope set up by\n\t// `devComponent(...)`. These fields are not `MaybeAccessor` shapes —\n\t// they're snapshot values — so a one-shot read matches the React\n\t// fork's semantics.\n\tconst {\n\t\toutsidePress: outsidePressProp = true,\n\t\toutsidePressEvent = \"sloppy\",\n\t\treferencePress = alwaysFalse,\n\t\treferencePressEvent = \"sloppy\",\n\t\texternalTree,\n\t} = untrack(() => ({\n\t\toutsidePress: props.outsidePress,\n\t\toutsidePressEvent: props.outsidePressEvent,\n\t\treferencePress: props.referencePress,\n\t\treferencePressEvent: props.referencePressEvent,\n\t\texternalTree: props.externalTree,\n\t}));\n\n\tconst getEnabled = (): boolean =>\n\t\tprops.enabled === undefined ? true : readOption(props.enabled);\n\tconst getEscapeKey = (): boolean =>\n\t\tprops.escapeKey === undefined ? true : readOption(props.escapeKey);\n\n\tconst tree = useFloatingTree(externalTree);\n\n\t// React: `useStableCallback(typeof fn === 'function' ? fn : () => false)`.\n\t// We mirror by wrapping in a stable callback that routes to the latest\n\t// predicate (or a constant `false` for non-fn values).\n\tconst outsidePressFn = createStableCallback<\n\t\t(event: MouseEvent | TouchEvent) => boolean\n\t>(() =>\n\t\ttypeof outsidePressProp === \"function\" ? outsidePressProp : alwaysFalse,\n\t);\n\tconst outsidePress: boolean | ((event: MouseEvent | TouchEvent) => boolean) =\n\t\ttypeof outsidePressProp === \"function\" ? outsidePressFn : outsidePressProp;\n\tconst outsidePressEnabled = outsidePress !== false;\n\n\tconst getOutsidePressEventProp = createStableCallback<\n\t\t() =>\n\t\t\t| PressType\n\t\t\t| { mouse: PressType; touch: PressType }\n\t\t\t| (() => PressType | { mouse: PressType; touch: PressType })\n\t>(() => () => outsidePressEvent);\n\n\t// State machine refs (React `useRef(false)` equivalents).\n\tconst pressStartedInsideRef: MutableRef<boolean> = { current: false };\n\tconst pressStartPreventedRef: MutableRef<boolean> = { current: false };\n\t// Ignore only the very next outside click after dragging from inside to outside.\n\tconst suppressNextOutsideClickRef: MutableRef<boolean> = { current: false };\n\n\t// Lazy readers for bubbles — each call re-reads the reactive source\n\t// so flips (e.g. closeParentOnEsc in menu submenus) take\n\t// effect without recomposing the consumer.\n\tconst getBubblesPair = (): { escapeKey: boolean; outsidePress: boolean } =>\n\t\tnormalizeProp(props.bubbles);\n\tconst getEscapeKeyBubbles = (): boolean => getBubblesPair().escapeKey;\n\n\tconst touchStateRef: MutableRef<{\n\t\tstartTime: number;\n\t\tstartX: number;\n\t\tstartY: number;\n\t\tdismissOnTouchEnd: boolean;\n\t\tdismissOnMouseDown: boolean;\n\t} | null> = { current: null };\n\n\tconst cancelDismissOnEndTimeout = useTimeout();\n\tconst clearInsideReactTreeTimeout = useTimeout();\n\n\tconst clearInsideReactTree = createStableCallback<() => void>(() => () => {\n\t\tclearInsideReactTreeTimeout.clear();\n\t\tdataRef.current.insideReactTree = false;\n\t});\n\n\tconst isComposingRef: MutableRef<boolean> = { current: false };\n\tconst currentPointerTypeRef: MutableRef<string> = { current: \"\" };\n\n\tconst isReferencePressEnabled = createStableCallback<() => boolean>(\n\t\t() => referencePress,\n\t);\n\n\tconst closeOnEscapeKeyDown = createStableCallback<\n\t\t(event: KeyboardEvent) => void\n\t>(() => (event: KeyboardEvent) => {\n\t\tconst liveStore = resolveStore();\n\t\tif (\n\t\t\t!liveStore.state.open ||\n\t\t\t!getEnabled() ||\n\t\t\t!getEscapeKey() ||\n\t\t\tevent.key !== \"Escape\"\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Wait until IME is settled. Pressing `Escape` while composing should\n\t\t// close the compose menu, but not the floating element.\n\t\tif (isComposingRef.current) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst liveDataRef = liveStore.context.dataRef;\n\t\tconst nodeId = liveDataRef.current.floatingContext?.nodeId as\n\t\t\t| string\n\t\t\t| undefined;\n\n\t\tconst children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];\n\n\t\tconst escapeKeyBubbles = getEscapeKeyBubbles();\n\t\tif (!escapeKeyBubbles) {\n\t\t\tif (children.length > 0) {\n\t\t\t\tlet shouldDismiss = true;\n\n\t\t\t\tfor (const child of children) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tchild.context?.open &&\n\t\t\t\t\t\t!child.context.dataRef.current.__escapeKeyBubbles\n\t\t\t\t\t) {\n\t\t\t\t\t\tshouldDismiss = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!shouldDismiss) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst eventDetails = createChangeEventDetails(REASONS.escapeKey, event);\n\n\t\tliveStore.setOpen(false, eventDetails);\n\n\t\tif (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\t});\n\n\tconst markInsideReactTree = createStableCallback<() => void>(() => () => {\n\t\tdataRef.current.insideReactTree = true;\n\t\tclearInsideReactTreeTimeout.start(0, clearInsideReactTree);\n\t});\n\n\t// Main effect: install document listeners when `open && enabled`.\n\t// React uses `useEffect` with a big dep array; Solid's `createEffect`\n\t// re-runs whenever any of the tracked reads below change. We read\n\t// `store.useState('open')` through the reactive accessor so the\n\t// effect re-runs on open toggles.\n\tcreateEffect(\n\t\t() => {\n\t\t\t// Track the resolved store so a context swap re-installs\n\t\t\t// listeners on the new one. `useState` tracks open /\n\t\t\t// floating so open flips also re-run.\n\t\t\tconst liveStore = resolveStore();\n\t\t\t// Track bubbles so the dataRef latch is rewritten when the\n\t\t\t// underlying accessor flips (solidify.md P3).\n\t\t\tconst bubbles = getBubblesPair();\n\t\t\treturn {\n\t\t\t\tliveStore,\n\t\t\t\topen: liveStore.state.open,\n\t\t\t\tfloatingElement: liveStore.state.floatingElement,\n\t\t\t\tenabled: getEnabled(),\n\t\t\t\tescapeKey: getEscapeKey(),\n\t\t\t\tescapeKeyBubbles: bubbles.escapeKey,\n\t\t\t\toutsidePressBubbles: bubbles.outsidePress,\n\t\t\t};\n\t\t},\n\t\t(snapshot) => {\n\t\t\tconst store = snapshot.liveStore;\n\t\t\tconst dataRef = store.context.dataRef;\n\t\t\tconst {\n\t\t\t\topen,\n\t\t\t\tenabled,\n\t\t\t\tescapeKey,\n\t\t\t\tescapeKeyBubbles,\n\t\t\t\toutsidePressBubbles,\n\t\t\t} = snapshot;\n\t\t\tif (!open || !enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdataRef.current.__escapeKeyBubbles = escapeKeyBubbles;\n\t\t\tdataRef.current.__outsidePressBubbles = outsidePressBubbles;\n\n\t\t\tconst compositionTimeout = new Timeout();\n\t\t\tconst preventedPressSuppressionTimeout = new Timeout();\n\n\t\t\tfunction handleCompositionStart() {\n\t\t\t\tcompositionTimeout.clear();\n\t\t\t\tisComposingRef.current = true;\n\t\t\t}\n\n\t\t\tfunction handleCompositionEnd() {\n\t\t\t\t// Safari fires `compositionend` before `keydown`, so we need to\n\t\t\t\t// wait until the next tick to set `isComposing` to `false`.\n\t\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=165004\n\t\t\t\tcompositionTimeout.start(\n\t\t\t\t\t// 0 ms / 1 ms don't work in Safari. 5 ms is consistent.\n\t\t\t\t\tisWebKit() ? 5 : 0,\n\t\t\t\t\t() => {\n\t\t\t\t\t\tisComposingRef.current = false;\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfunction suppressImmediateOutsideClickAfterPreventedStart() {\n\t\t\t\tsuppressNextOutsideClickRef.current = true;\n\t\t\t\t// Firefox can emit the synthetic outside click in a later task\n\t\t\t\t// after pointer-lock exit, so microtask clearing is too early.\n\t\t\t\tpreventedPressSuppressionTimeout.start(0, () => {\n\t\t\t\t\tsuppressNextOutsideClickRef.current = false;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction resetPressStartState() {\n\t\t\t\tpressStartedInsideRef.current = false;\n\t\t\t\tpressStartPreventedRef.current = false;\n\t\t\t}\n\n\t\t\tfunction getOutsidePressEvent(): PressType {\n\t\t\t\tconst type = currentPointerTypeRef.current as\n\t\t\t\t\t| \"pen\"\n\t\t\t\t\t| \"mouse\"\n\t\t\t\t\t| \"touch\"\n\t\t\t\t\t| \"\";\n\t\t\t\tconst computedType = type === \"pen\" || !type ? \"mouse\" : type;\n\n\t\t\t\tconst outsidePressEventValue = getOutsidePressEventProp();\n\t\t\t\tconst resolved =\n\t\t\t\t\ttypeof outsidePressEventValue === \"function\"\n\t\t\t\t\t\t? outsidePressEventValue()\n\t\t\t\t\t\t: outsidePressEventValue;\n\n\t\t\t\tif (typeof resolved === \"string\") {\n\t\t\t\t\treturn resolved;\n\t\t\t\t}\n\n\t\t\t\treturn resolved[computedType];\n\t\t\t}\n\n\t\t\tfunction shouldIgnoreEvent(event: Event): boolean {\n\t\t\t\tconst computedOutsidePressEvent = getOutsidePressEvent();\n\t\t\t\treturn (\n\t\t\t\t\t(computedOutsidePressEvent === \"intentional\" &&\n\t\t\t\t\t\tevent.type !== \"click\") ||\n\t\t\t\t\t(computedOutsidePressEvent === \"sloppy\" && event.type === \"click\")\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfunction isEventWithinFloatingTree(event: Event): boolean {\n\t\t\t\tconst nodeId = dataRef.current.floatingContext?.nodeId as\n\t\t\t\t\t| string\n\t\t\t\t\t| undefined;\n\t\t\t\tconst targetIsInsideChildren =\n\t\t\t\t\t!!tree &&\n\t\t\t\t\tgetNodeChildren(tree.nodesRef.current, nodeId).some((node) =>\n\t\t\t\t\t\tisEventTargetWithin(event, node.context?.elements.floating),\n\t\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\tisEventTargetWithin(event, store.state.floatingElement) ||\n\t\t\t\t\tisEventTargetWithin(event, store.state.domReferenceElement) ||\n\t\t\t\t\ttargetIsInsideChildren ||\n\t\t\t\t\t// Presses inside popups portaled out of our DOM subtree but\n\t\t\t\t\t// logically nested under us (a Select popup inside a Dialog,\n\t\t\t\t\t// say) are not outside presses. React covers this via portal\n\t\t\t\t\t// synthetic-event propagation (`insideReactTree`); Solid\n\t\t\t\t\t// events follow the DOM tree, so we walk the logical portal\n\t\t\t\t\t// ancestry instead. See `isInsideNestedPortal`.\n\t\t\t\t\tisInsideNestedPortal(getTarget(event), store.state.floatingElement)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// A press landed on a third-party element injected (e.g. a\n\t\t\t// `[data-inert]` overlay) after the floating element rendered, so\n\t\t\t// none of the recorded markers sit on the target's ancestor chain.\n\t\t\t// Walks the target up to its last-traversable ancestor and checks\n\t\t\t// that against the marker set.\n\t\t\tfunction isInjectedThirdPartyPress(\n\t\t\t\ttarget: EventTarget | null,\n\t\t\t\tmarkers: Element[],\n\t\t\t\tfloatingElement: Element | null,\n\t\t\t): boolean {\n\t\t\t\tif (\n\t\t\t\t\t!markers.length ||\n\t\t\t\t\t!isElement(target) ||\n\t\t\t\t\tisRootElement(target as Element) ||\n\t\t\t\t\t// Clicked on a direct ancestor (e.g. FloatingOverlay).\n\t\t\t\t\tcontains(target as Element, floatingElement)\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tlet ancestor: Element | null = target as Element;\n\t\t\t\twhile (ancestor && !isLastTraversableNode(ancestor)) {\n\t\t\t\t\tconst nextParent = getParentNode(ancestor);\n\t\t\t\t\tif (isLastTraversableNode(nextParent) || !isElement(nextParent)) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tancestor = nextParent as Element;\n\t\t\t\t}\n\n\t\t\t\t// If the target root contains none of the markers, the element\n\t\t\t\t// was injected after the floating element rendered.\n\t\t\t\treturn markers.every(\n\t\t\t\t\t(marker) => !contains(ancestor, marker as Element),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// A press on the target element's scrollbar gutter (rather than its\n\t\t\t// content). Skipped for touch — scrollbars don't receive touch\n\t\t\t// events on most platforms.\n\t\t\tfunction isPressOnScrollbar(\n\t\t\t\tevent: MouseEvent | PointerEvent | TouchEvent,\n\t\t\t\ttarget: EventTarget | null,\n\t\t\t): boolean {\n\t\t\t\tif (!isHTMLElement(target) || \"touches\" in event) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst el = target as HTMLElement;\n\t\t\t\tconst lastTraversableNode = isLastTraversableNode(el);\n\t\t\t\tconst style = getComputedStyle(el);\n\t\t\t\tconst scrollRe = /auto|scroll/;\n\t\t\t\tconst isScrollableX =\n\t\t\t\t\tlastTraversableNode || scrollRe.test(style.overflowX);\n\t\t\t\tconst isScrollableY =\n\t\t\t\t\tlastTraversableNode || scrollRe.test(style.overflowY);\n\n\t\t\t\tconst canScrollX =\n\t\t\t\t\tisScrollableX &&\n\t\t\t\t\tel.clientWidth > 0 &&\n\t\t\t\t\tel.scrollWidth > el.clientWidth;\n\t\t\t\tconst canScrollY =\n\t\t\t\t\tisScrollableY &&\n\t\t\t\t\tel.clientHeight > 0 &&\n\t\t\t\t\tel.scrollHeight > el.clientHeight;\n\n\t\t\t\tconst isRTL = style.direction === \"rtl\";\n\n\t\t\t\tconst mouseEvent = event as MouseEvent;\n\t\t\t\tconst pressedVerticalScrollbar =\n\t\t\t\t\tcanScrollY &&\n\t\t\t\t\t(isRTL\n\t\t\t\t\t\t? mouseEvent.offsetX <= el.offsetWidth - el.clientWidth\n\t\t\t\t\t\t: mouseEvent.offsetX > el.clientWidth);\n\t\t\t\tconst pressedHorizontalScrollbar =\n\t\t\t\t\tcanScrollX && mouseEvent.offsetY > el.clientHeight;\n\n\t\t\t\treturn pressedVerticalScrollbar || pressedHorizontalScrollbar;\n\t\t\t}\n\n\t\t\tfunction closeOnPressOutside(\n\t\t\t\tevent: MouseEvent | PointerEvent | TouchEvent,\n\t\t\t) {\n\t\t\t\tif (shouldIgnoreEvent(event)) {\n\t\t\t\t\tclearInsideReactTree();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (dataRef.current.insideReactTree) {\n\t\t\t\t\tclearInsideReactTree();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst target = getTarget(event);\n\t\t\t\tconst inertSelector = `[${createAttribute(\"inert\")}]`;\n\t\t\t\tconst targetRoot = isElement(target)\n\t\t\t\t\t? (target as Element).getRootNode()\n\t\t\t\t\t: null;\n\t\t\t\tconst markers = Array.from(\n\t\t\t\t\t(isShadowRoot(targetRoot)\n\t\t\t\t\t\t? (targetRoot as ShadowRoot)\n\t\t\t\t\t\t: ownerDocument(store.state.floatingElement)\n\t\t\t\t\t).querySelectorAll(inertSelector),\n\t\t\t\t);\n\n\t\t\t\tconst triggers = store.context.triggerElements;\n\n\t\t\t\t// If another trigger is clicked, don't close the floating element.\n\t\t\t\tif (\n\t\t\t\t\ttarget &&\n\t\t\t\t\t(triggers.hasElement(target as Element) ||\n\t\t\t\t\t\ttriggers.hasMatchingElement((trigger) =>\n\t\t\t\t\t\t\tcontains(trigger, target as Element),\n\t\t\t\t\t\t))\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check if the click occurred on a third-party element injected\n\t\t\t\t// after the floating element rendered.\n\t\t\t\tif (\n\t\t\t\t\tisInjectedThirdPartyPress(\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tmarkers,\n\t\t\t\t\t\tstore.state.floatingElement,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check if the click occurred on the scrollbar.\n\t\t\t\tif (isPressOnScrollbar(event, target)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (isEventWithinFloatingTree(event)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// In intentional mode, a press that starts inside and ends\n\t\t\t\t// outside gets one suppressed outside click. Run this after\n\t\t\t\t// inside-target checks so inside clicks don't consume the\n\t\t\t\t// one-shot suppression.\n\t\t\t\tif (\n\t\t\t\t\tgetOutsidePressEvent() === \"intentional\" &&\n\t\t\t\t\tsuppressNextOutsideClickRef.current\n\t\t\t\t) {\n\t\t\t\t\tpreventedPressSuppressionTimeout.clear();\n\t\t\t\t\tsuppressNextOutsideClickRef.current = false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\ttypeof outsidePress === \"function\" &&\n\t\t\t\t\t!outsidePress(event as MouseEvent | TouchEvent)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst nodeId = dataRef.current.floatingContext?.nodeId as\n\t\t\t\t\t| string\n\t\t\t\t\t| undefined;\n\t\t\t\tconst children = tree\n\t\t\t\t\t? getNodeChildren(tree.nodesRef.current, nodeId)\n\t\t\t\t\t: [];\n\t\t\t\tif (children.length > 0) {\n\t\t\t\t\tlet shouldDismiss = true;\n\n\t\t\t\t\tfor (const child of children) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tchild.context?.open &&\n\t\t\t\t\t\t\t!child.context.dataRef.current.__outsidePressBubbles\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tshouldDismiss = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!shouldDismiss) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tstore.setOpen(\n\t\t\t\t\tfalse,\n\t\t\t\t\tcreateChangeEventDetails(\n\t\t\t\t\t\tREASONS.outsidePress,\n\t\t\t\t\t\tevent as MouseEvent | PointerEvent | TouchEvent,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tclearInsideReactTree();\n\t\t\t}\n\n\t\t\tfunction handlePointerDown(event: PointerEvent) {\n\t\t\t\tif (\n\t\t\t\t\tgetOutsidePressEvent() !== \"sloppy\" ||\n\t\t\t\t\tevent.pointerType === \"touch\" ||\n\t\t\t\t\t!store.state.open ||\n\t\t\t\t\t!enabled ||\n\t\t\t\t\tisEventTargetWithin(event, store.state.floatingElement) ||\n\t\t\t\t\tisEventTargetWithin(event, store.state.domReferenceElement)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcloseOnPressOutside(event);\n\t\t\t}\n\n\t\t\tfunction handleTouchStart(event: TouchEvent) {\n\t\t\t\tif (\n\t\t\t\t\tgetOutsidePressEvent() !== \"sloppy\" ||\n\t\t\t\t\t!store.state.open ||\n\t\t\t\t\t!enabled ||\n\t\t\t\t\tisEventTargetWithin(event, store.state.floatingElement) ||\n\t\t\t\t\tisEventTargetWithin(event, store.state.domReferenceElement)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst touch = event.touches[0];\n\t\t\t\tif (touch) {\n\t\t\t\t\ttouchStateRef.current = {\n\t\t\t\t\t\tstartTime: Date.now(),\n\t\t\t\t\t\tstartX: touch.clientX,\n\t\t\t\t\t\tstartY: touch.clientY,\n\t\t\t\t\t\tdismissOnTouchEnd: false,\n\t\t\t\t\t\tdismissOnMouseDown: true,\n\t\t\t\t\t};\n\n\t\t\t\t\tcancelDismissOnEndTimeout.start(1000, () => {\n\t\t\t\t\t\tif (touchStateRef.current) {\n\t\t\t\t\t\t\ttouchStateRef.current.dismissOnTouchEnd = false;\n\t\t\t\t\t\t\ttouchStateRef.current.dismissOnMouseDown = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction addTargetEventListenerOnce<EventType extends Event>(\n\t\t\t\tevent: EventType,\n\t\t\t\tlistener: (event: EventType) => void,\n\t\t\t) {\n\t\t\t\tconst target = getTarget(event);\n\t\t\t\tif (!target) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst handler = () => {\n\t\t\t\t\tlistener(event);\n\t\t\t\t\t(target as EventTarget).removeEventListener(event.type, handler);\n\t\t\t\t};\n\t\t\t\t(target as EventTarget).addEventListener(event.type, handler);\n\t\t\t}\n\n\t\t\tfunction handleTouchStartCapture(event: TouchEvent) {\n\t\t\t\tcurrentPointerTypeRef.current = \"touch\";\n\t\t\t\taddTargetEventListenerOnce(event, handleTouchStart);\n\t\t\t}\n\n\t\t\tfunction closeOnPressOutsideCapture(event: PointerEvent | MouseEvent) {\n\t\t\t\tcancelDismissOnEndTimeout.clear();\n\n\t\t\t\tif (event.type === \"pointerdown\") {\n\t\t\t\t\tcurrentPointerTypeRef.current = (event as PointerEvent).pointerType;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tevent.type === \"mousedown\" &&\n\t\t\t\t\ttouchStateRef.current &&\n\t\t\t\t\t!touchStateRef.current.dismissOnMouseDown\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taddTargetEventListenerOnce(event, (targetEvent) => {\n\t\t\t\t\tif (targetEvent.type === \"pointerdown\") {\n\t\t\t\t\t\thandlePointerDown(targetEvent as PointerEvent);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcloseOnPressOutside(targetEvent as MouseEvent);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction handlePressEndCapture(event: PointerEvent | MouseEvent) {\n\t\t\t\tif (!pressStartedInsideRef.current) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst pressStartedInsideDefaultPrevented =\n\t\t\t\t\tpressStartPreventedRef.current;\n\t\t\t\tresetPressStartState();\n\n\t\t\t\tif (getOutsidePressEvent() !== \"intentional\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (event.type === \"pointercancel\") {\n\t\t\t\t\tif (pressStartedInsideDefaultPrevented) {\n\t\t\t\t\t\tsuppressImmediateOutsideClickAfterPreventedStart();\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (isEventWithinFloatingTree(event)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If pointerdown was prevented, no click may be generated for\n\t\t\t\t// that interaction. However, Firefox may still emit an\n\t\t\t\t// immediate click after pointerup (e.g. NumberField scrub with\n\t\t\t\t// pointer lock), so suppress for one tick.\n\t\t\t\tif (pressStartedInsideDefaultPrevented) {\n\t\t\t\t\tsuppressImmediateOutsideClickAfterPreventedStart();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Avoid suppressing when outsidePress explicitly ignores this\n\t\t\t\t// target.\n\t\t\t\tif (\n\t\t\t\t\ttypeof outsidePress === \"function\" &&\n\t\t\t\t\t!outsidePress(event as MouseEvent)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tpreventedPressSuppressionTimeout.clear();\n\t\t\t\tsuppressNextOutsideClickRef.current = true;\n\t\t\t\tclearInsideReactTree();\n\t\t\t}\n\n\t\t\tfunction handleTouchMove(event: TouchEvent) {\n\t\t\t\tif (\n\t\t\t\t\tgetOutsidePressEvent() !== \"sloppy\" ||\n\t\t\t\t\t!touchStateRef.current ||\n\t\t\t\t\tisEventTargetWithin(event, store.state.floatingElement) ||\n\t\t\t\t\tisEventTargetWithin(event, store.state.domReferenceElement)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst touch = event.touches[0];\n\t\t\t\tif (!touch) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);\n\t\t\t\tconst deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);\n\t\t\t\tconst distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n\n\t\t\t\tif (distance > 5) {\n\t\t\t\t\ttouchStateRef.current.dismissOnTouchEnd = true;\n\t\t\t\t}\n\n\t\t\t\tif (distance > 10) {\n\t\t\t\t\tcloseOnPressOutside(event);\n\t\t\t\t\tcancelDismissOnEndTimeout.clear();\n\t\t\t\t\ttouchStateRef.current = null;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction handleTouchMoveCapture(event: TouchEvent) {\n\t\t\t\taddTargetEventListenerOnce(event, handleTouchMove);\n\t\t\t}\n\n\t\t\tfunction handleTouchEnd(event: TouchEvent) {\n\t\t\t\tif (\n\t\t\t\t\tgetOutsidePressEvent() !== \"sloppy\" ||\n\t\t\t\t\t!touchStateRef.current ||\n\t\t\t\t\tisEventTargetWithin(event, store.state.floatingElement) ||\n\t\t\t\t\tisEventTargetWithin(event, store.state.domReferenceElement)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (touchStateRef.current.dismissOnTouchEnd) {\n\t\t\t\t\tcloseOnPressOutside(event);\n\t\t\t\t}\n\n\t\t\t\tcancelDismissOnEndTimeout.clear();\n\t\t\t\ttouchStateRef.current = null;\n\t\t\t}\n\n\t\t\tfunction handleTouchEndCapture(event: TouchEvent) {\n\t\t\t\taddTargetEventListenerOnce(event, handleTouchEnd);\n\t\t\t}\n\n\t\t\t// Solid analogue of React's synthetic capture propagation across\n\t\t\t// portals for the `insideReactTree` latch. The floating bag's\n\t\t\t// `on*Capture: markInsideReactTree` handlers (attached to the\n\t\t\t// floating element) only fire for DOM descendants; in React they\n\t\t\t// also fire for presses inside popups PORTALED out of the DOM\n\t\t\t// subtree but logically nested under us, because synthetic events\n\t\t\t// climb the component tree across portals. Without this, a press\n\t\t\t// that starts on a nested trigger and ends inside the nested\n\t\t\t// popup fires its `click` on the nearest common DOM ancestor —\n\t\t\t// our own portal wrapper — which fails every within-tree check\n\t\t\t// and dismisses the ancestor overlay (Select inside a Sheet:\n\t\t\t// press trigger, release over an item, sheet closes).\n\t\t\tfunction markNestedPortalPressCapture(event: Event) {\n\t\t\t\tif (\n\t\t\t\t\tisInsideNestedPortal(getTarget(event), store.state.floatingElement)\n\t\t\t\t) {\n\t\t\t\t\tmarkInsideReactTree();\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Same press-phase events the floating bag latches on.\n\t\t\tconst nestedPortalLatchEvents = [\n\t\t\t\t\"click\",\n\t\t\t\t\"mousedown\",\n\t\t\t\t\"pointerdown\",\n\t\t\t\t\"mouseup\",\n\t\t\t\t\"touchend\",\n\t\t\t\t\"touchmove\",\n\t\t\t] as const;\n\n\t\t\tconst doc = ownerDocument(snapshot.floatingElement);\n\t\t\tconst cleanups: Array<() => void> = [];\n\n\t\t\tif (escapeKey) {\n\t\t\t\tdoc.addEventListener(\"keydown\", closeOnEscapeKeyDown);\n\t\t\t\tdoc.addEventListener(\"compositionstart\", handleCompositionStart);\n\t\t\t\tdoc.addEventListener(\"compositionend\", handleCompositionEnd);\n\t\t\t\tcleanups.push(() => {\n\t\t\t\t\tdoc.removeEventListener(\"keydown\", closeOnEscapeKeyDown);\n\t\t\t\t\tdoc.removeEventListener(\"compositionstart\", handleCompositionStart);\n\t\t\t\t\tdoc.removeEventListener(\"compositionend\", handleCompositionEnd);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (outsidePressEnabled) {\n\t\t\t\tfor (const type of nestedPortalLatchEvents) {\n\t\t\t\t\tdoc.addEventListener(type, markNestedPortalPressCapture, true);\n\t\t\t\t}\n\t\t\t\tcleanups.push(() => {\n\t\t\t\t\tfor (const type of nestedPortalLatchEvents) {\n\t\t\t\t\t\tdoc.removeEventListener(type, markNestedPortalPressCapture, true);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tdoc.addEventListener(\n\t\t\t\t\t\"click\",\n\t\t\t\t\tcloseOnPressOutsideCapture as EventListener,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tdoc.addEventListener(\n\t\t\t\t\t\"pointerdown\",\n\t\t\t\t\tcloseOnPressOutsideCapture as EventListener,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tdoc.addEventListener(\n\t\t\t\t\t\"pointerup\",\n\t\t\t\t\thandlePressEndCapture as EventListener,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tdoc.addEventListener(\n\t\t\t\t\t\"pointercancel\",\n\t\t\t\t\thandlePressEndCapture as EventListener,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tdoc.addEventListener(\n\t\t\t\t\t\"mousedown\",\n\t\t\t\t\tcloseOnPressOutsideCapture as EventListener,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tdoc.addEventListener(\n\t\t\t\t\t\"mouseup\",\n\t\t\t\t\thandlePressEndCapture as EventListener,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tdoc.addEventListener(\n\t\t\t\t\t\"touchstart\",\n\t\t\t\t\thandleTouchStartCapture as EventListener,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tdoc.addEventListener(\n\t\t\t\t\t\"touchmove\",\n\t\t\t\t\thandleTouchMoveCapture as EventListener,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tdoc.addEventListener(\n\t\t\t\t\t\"touchend\",\n\t\t\t\t\thandleTouchEndCapture as EventListener,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tcleanups.push(() => {\n\t\t\t\t\tdoc.removeEventListener(\n\t\t\t\t\t\t\"click\",\n\t\t\t\t\t\tcloseOnPressOutsideCapture as EventListener,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tdoc.removeEventListener(\n\t\t\t\t\t\t\"pointerdown\",\n\t\t\t\t\t\tcloseOnPressOutsideCapture as EventListener,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tdoc.removeEventListener(\n\t\t\t\t\t\t\"pointerup\",\n\t\t\t\t\t\thandlePressEndCapture as EventListener,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tdoc.removeEventListener(\n\t\t\t\t\t\t\"pointercancel\",\n\t\t\t\t\t\thandlePressEndCapture as EventListener,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tdoc.removeEventListener(\n\t\t\t\t\t\t\"mousedown\",\n\t\t\t\t\t\tcloseOnPressOutsideCapture as EventListener,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tdoc.removeEventListener(\n\t\t\t\t\t\t\"mouseup\",\n\t\t\t\t\t\thandlePressEndCapture as EventListener,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tdoc.removeEventListener(\n\t\t\t\t\t\t\"touchstart\",\n\t\t\t\t\t\thandleTouchStartCapture as EventListener,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tdoc.removeEventListener(\n\t\t\t\t\t\t\"touchmove\",\n\t\t\t\t\t\thandleTouchMoveCapture as EventListener,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t\tdoc.removeEventListener(\n\t\t\t\t\t\t\"touchend\",\n\t\t\t\t\t\thandleTouchEndCapture as EventListener,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\tfor (const cleanup of cleanups) {\n\t\t\t\t\tcleanup();\n\t\t\t\t}\n\t\t\t\tcompositionTimeout.clear();\n\t\t\t\tpreventedPressSuppressionTimeout.clear();\n\t\t\t\tresetPressStartState();\n\t\t\t\tsuppressNextOutsideClickRef.current = false;\n\t\t\t};\n\t\t},\n\t);\n\n\t// React runs `useEffect(clearInsideReactTree, [outsidePress, clearInsideReactTree])`\n\t// to reset the latch whenever `outsidePress` identity changes. In Solid,\n\t// the effect fires once per mount — `outsidePress` identity is stable\n\t// for the lifetime of the hook instance (we wrap fn form in a stable\n\t// callback), so a single reset suffices.\n\tcreateEffect(\n\t\t() => undefined,\n\t\t() => {\n\t\t\tclearInsideReactTree();\n\t\t},\n\t);\n\n\t// Build reference bag: bubble-phase handler keyed by press type, plus\n\t// an always-on `onKeyDown` for escape. When press type is not\n\t// `intentional`, also wire `onClick` so keyboard activation still\n\t// dismisses.\n\tfunction buildReference(): ElementPropsBag {\n\t\tconst handlePress = (event: PointerEvent | MouseEvent) => {\n\t\t\tif (!isReferencePressEnabled() || !getEnabled()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolveStore().setOpen(\n\t\t\t\tfalse,\n\t\t\t\tcreateChangeEventDetails(\n\t\t\t\t\tREASONS.triggerPress,\n\t\t\t\t\tevent,\n\t\t\t\t) as BaseUIChangeEventDetails<string>,\n\t\t\t);\n\t\t};\n\t\tconst bag: ElementPropsBag = {\n\t\t\tonKeyDown: closeOnEscapeKeyDown,\n\t\t};\n\t\tbag[bubbleHandlerKeys[referencePressEvent]] = handlePress;\n\t\tif (referencePressEvent !== \"intentional\") {\n\t\t\tbag.onClick = (event: MouseEvent) => {\n\t\t\t\tif (!isReferencePressEnabled() || !getEnabled()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresolveStore().setOpen(\n\t\t\t\t\tfalse,\n\t\t\t\t\tcreateChangeEventDetails(\n\t\t\t\t\t\tREASONS.triggerPress,\n\t\t\t\t\t\tevent,\n\t\t\t\t\t) as BaseUIChangeEventDetails<string>,\n\t\t\t\t);\n\t\t\t};\n\t\t}\n\t\treturn bag;\n\t}\n\n\tconst markPressStartedInsideReactTree = createStableCallback<\n\t\t(event: PointerEvent | MouseEvent) => void\n\t>(() => (event: PointerEvent | MouseEvent) => {\n\t\tconst liveStore = resolveStore();\n\t\tif (!liveStore.state.open || !getEnabled() || event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst target = getTarget(event) as Element | null;\n\t\t// Only treat presses that start within the floating DOM subtree as\n\t\t// inside. This avoids suppressing parent dismissal when interacting\n\t\t// with nested portals.\n\t\tif (!contains(liveStore.state.floatingElement, target)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!pressStartedInsideRef.current) {\n\t\t\tpressStartedInsideRef.current = true;\n\t\t\tpressStartPreventedRef.current = false;\n\t\t}\n\t});\n\n\tconst markInsidePressStartPrevented = createStableCallback<\n\t\t(event: PointerEvent | MouseEvent) => void\n\t>(() => (event: PointerEvent | MouseEvent) => {\n\t\tconst liveStore = resolveStore();\n\t\tif (!liveStore.state.open || !getEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tif (!event.defaultPrevented) {\n\t\t\treturn;\n\t\t}\n\t\tif (pressStartedInsideRef.current) {\n\t\t\tpressStartPreventedRef.current = true;\n\t\t}\n\t});\n\n\tconst floating: ElementPropsBag = {\n\t\tonKeyDown: closeOnEscapeKeyDown,\n\t\t// `onMouseDown` may be blocked if `event.preventDefault()` is\n\t\t// called in `onPointerDown`, such as with `<NumberField.ScrubArea>`.\n\t\tonPointerDown: markInsidePressStartPrevented,\n\t\tonMouseDown: markInsidePressStartPrevented,\n\t\tonClickCapture: markInsideReactTree,\n\t\tonMouseDownCapture(event: MouseEvent) {\n\t\t\tmarkInsideReactTree();\n\t\t\tmarkPressStartedInsideReactTree(event);\n\t\t},\n\t\tonPointerDownCapture(event: PointerEvent) {\n\t\t\tmarkInsideReactTree();\n\t\t\tmarkPressStartedInsideReactTree(event);\n\t\t},\n\t\tonMouseUpCapture: markInsideReactTree,\n\t\tonTouchEndCapture: markInsideReactTree,\n\t\tonTouchMoveCapture: markInsideReactTree,\n\t};\n\n\t// When `enabled` is a literal `false`, mirror React and return an\n\t// empty bag. When it's an accessor, always return the bag so handlers\n\t// can reactively short-circuit via `getEnabled()`. The body-time\n\t// `props.enabled` access is wrapped in `untrack` so the strict-read\n\t// scope established by `devComponent(...)` does not warn — accessor\n\t// reads happen later inside already-tracked event handlers / effects.\n\tconst isStaticallyDisabled = untrack(\n\t\t() => typeof props.enabled !== \"function\" && !getEnabled(),\n\t);\n\tif (isStaticallyDisabled) {\n\t\treturn {};\n\t}\n\n\tconst reference = buildReference();\n\treturn { reference, floating, trigger: reference };\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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