{"version":3,"names":["dynamic","createEffect","createMemo","omit","onCleanup","untrack","composeRefs","userRef","useDelayGroup","useHover","safePolygon","mergeRootProps","resolveClassStyle","useButton","useIsoLayoutEffect","OPEN_DELAY","useTooltipProviderContext","useTooltipRootContext","TooltipTrigger","props","rootContext","disabled","own","undefined","Boolean","nativeButton","delayProp","delay","closeDelayProp","closeDelay","delayGroup","floatingRootContext","open","isInstantPhase","phase","setIsInstantPhase","setInstantType","providerContext","closeOnClick","v","setCloseOnClick","hoverProps","enabled","mouseOnly","handleClose","disableHoverablePopup","groupDelay","delayRef","current","providerOpen","providerClose","groupOpenValue","groupCloseValue","close","hasProvider","buttonProps","ref","buttonRef","focusableWhenDisabled","native","interactions","referenceProps","getReferenceProps","isActive","id","activeTriggerId","state","store","handle","registeredId","registeredElement","triggerRef","el","s","context","triggerElements","getById","delete","add","setTriggerElement","active","payload","hasPayload","setPayload","markActive","setActiveTriggerId","stateAttrs","data-popup-open","onPointerEnter","onFocus","onClick","userClassStyle","userProps","merged","reference","Tag","as"],"sources":["tooltip-trigger.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { createEffect, createMemo, omit, onCleanup, untrack } from \"solid-js\";\nimport { composeRefs, userRef } from \"../../internals/compose-refs\";\nimport { useDelayGroup } from \"../../internals/floating-ui/components/floating-delay-group\";\nimport { useHover } from \"../../internals/floating-ui/hooks/use-hover\";\nimport { safePolygon } from \"../../internals/floating-ui/safe-polygon\";\nimport type { Delay } from \"../../internals/floating-ui/types\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type {\n\tBaseUIComponentProps,\n\tNativeButtonProps,\n} from \"../../internals/types\";\nimport { useButton } from \"../../internals/use-button/use-button\";\nimport { useIsoLayoutEffect } from \"../../internals/use-iso-layout-effect\";\nimport { OPEN_DELAY } from \"../constants\";\nimport type { TooltipHandle } from \"../store/tooltip-store\";\nimport { useTooltipProviderContext } from \"../tooltip-provider-context\";\nimport { useTooltipRootContext } from \"../tooltip-root-context\";\n\nexport interface TooltipTriggerState {\n\topen: boolean;\n}\n\nexport interface TooltipTriggerProps<Payload = unknown>\n\textends NativeButtonProps,\n\t\tBaseUIComponentProps<\"button\", TooltipTriggerState> {\n\t/**\n\t * Tag/component to render. Defaults to `\"button\"`. Replaces the\n\t * pre-spike `render` prop (axis G).\n\t */\n\tas?: ValidComponent;\n\t/** @default 600 */\n\tdelay?: number | undefined;\n\t/** @default 0 */\n\tcloseDelay?: number | undefined;\n\t/** @default false */\n\tdisabled?: boolean | undefined;\n\t/** @default false */\n\tcloseOnClick?: boolean | undefined;\n\thandle?: TooltipHandle<Payload> | undefined;\n\tid?: string | undefined;\n\tpayload?: Payload | undefined;\n}\n\n/**\n * An element to attach the tooltip to. Renders a `<button>` element.\n *\n * Solid 2.0-native rewire (§1 wave 2): replaces `renderElement` with\n * `dynamic(() => props.as ?? \"button\")` and composes hover +\n * useButton + reference props + state-attr getters via `mergeRootProps`.\n */\nexport function TooltipTrigger<Payload = unknown>(\n\tprops: TooltipTriggerProps<Payload>,\n): JSX.Element {\n\tconst rootContext = useTooltipRootContext();\n\n\tconst disabled = (): boolean => {\n\t\tconst own = props.disabled;\n\t\tif (own !== undefined) return Boolean(own);\n\t\treturn rootContext.disabled();\n\t};\n\tconst nativeButton = (): boolean => props.nativeButton ?? true;\n\n\tconst delayProp = (): number => props.delay ?? OPEN_DELAY;\n\tconst closeDelayProp = (): number => props.closeDelay ?? 0;\n\n\tconst delayGroup = useDelayGroup(rootContext.floatingRootContext, {\n\t\tget open() {\n\t\t\treturn rootContext.open();\n\t\t},\n\t});\n\n\tuseIsoLayoutEffect(\n\t\t() => delayGroup.isInstantPhase,\n\t\t(phase) => {\n\t\t\trootContext.setIsInstantPhase(phase);\n\t\t\tif (phase) {\n\t\t\t\trootContext.setInstantType(\"delay\");\n\t\t\t}\n\t\t},\n\t);\n\n\tconst providerContext = useTooltipProviderContext();\n\n\tuseIsoLayoutEffect(\n\t\t() => props.closeOnClick ?? false,\n\t\t(v) => {\n\t\t\trootContext.setCloseOnClick(v);\n\t\t},\n\t);\n\n\tconst hoverProps = useHover(rootContext.floatingRootContext, {\n\t\tget enabled() {\n\t\t\treturn !disabled();\n\t\t},\n\t\tmouseOnly: true,\n\t\tget handleClose() {\n\t\t\treturn rootContext.disableHoverablePopup() ? null : safePolygon();\n\t\t},\n\t\tdelay: (): Delay => {\n\t\t\tconst groupDelay = delayGroup.delayRef.current;\n\t\t\tconst providerOpen = providerContext?.delay;\n\t\t\tconst providerClose = providerContext?.closeDelay;\n\n\t\t\tconst groupOpenValue =\n\t\t\t\ttypeof groupDelay === \"object\" ? groupDelay.open : undefined;\n\t\t\tconst groupCloseValue =\n\t\t\t\ttypeof groupDelay === \"object\" ? groupDelay.close : undefined;\n\n\t\t\tlet open: number = delayProp();\n\t\t\tif (delayGroup.hasProvider && groupOpenValue === 0) {\n\t\t\t\topen = 0;\n\t\t\t} else if (delayGroup.hasProvider) {\n\t\t\t\topen = props.delay ?? providerOpen ?? delayProp();\n\t\t\t}\n\n\t\t\tlet close: number = closeDelayProp();\n\t\t\tif (props.closeDelay == null && delayGroup.hasProvider) {\n\t\t\t\tclose = groupCloseValue ?? providerClose ?? closeDelayProp();\n\t\t\t}\n\n\t\t\treturn { open, close };\n\t\t},\n\t});\n\n\tconst { props: buttonProps, ref: buttonRef } = useButton({\n\t\tdisabled,\n\t\tfocusableWhenDisabled: () => true,\n\t\tnative: nativeButton,\n\t});\n\n\tconst interactions = rootContext.interactions;\n\tconst referenceProps = interactions.getReferenceProps();\n\n\tconst isActive = createMemo<boolean>(() => {\n\t\tconst id = props.id;\n\t\tif (id === undefined) return true;\n\t\treturn rootContext.activeTriggerId() === id;\n\t});\n\n\tconst state = createMemo<TooltipTriggerState>(() => ({\n\t\topen: rootContext.open() && isActive(),\n\t}));\n\n\t// Trigger registration in the store's trigger map.\n\tconst store = () => props.handle?.store ?? rootContext.store;\n\tlet registeredId: string | null = null;\n\tlet registeredElement: HTMLElement | null = null;\n\tconst triggerRef = (el: HTMLElement | null) =>\n\t\tuntrack(() => {\n\t\t\tconst id = props.id;\n\t\t\tconst s = store();\n\n\t\t\tif (registeredId !== null && registeredElement !== null) {\n\t\t\t\tconst current = s.context.triggerElements.getById(registeredId);\n\t\t\t\tif (current === registeredElement) {\n\t\t\t\t\ts.context.triggerElements.delete(registeredId);\n\t\t\t\t}\n\t\t\t\tregisteredId = null;\n\t\t\t\tregisteredElement = null;\n\t\t\t}\n\n\t\t\tif (el && id !== undefined) {\n\t\t\t\ts.context.triggerElements.add(id, el);\n\t\t\t\tregisteredId = id;\n\t\t\t\tregisteredElement = el;\n\t\t\t}\n\n\t\t\tif (id === undefined || isActive()) {\n\t\t\t\trootContext.setTriggerElement(el);\n\t\t\t}\n\t\t});\n\n\tonCleanup(() => {\n\t\tif (registeredId !== null && registeredElement !== null) {\n\t\t\tconst s = store();\n\t\t\tconst current = s.context.triggerElements.getById(registeredId);\n\t\t\tif (current === registeredElement) {\n\t\t\t\ts.context.triggerElements.delete(registeredId);\n\t\t\t}\n\t\t}\n\t});\n\n\tcreateEffect(\n\t\t// `\"payload\" in props` is a reactive `has` read — snapshot it in\n\t\t// compute; the apply scope is strict-read.\n\t\t() => ({\n\t\t\tactive: isActive(),\n\t\t\tpayload: props.payload,\n\t\t\thasPayload: \"payload\" in props,\n\t\t}),\n\t\t({ active, payload, hasPayload }) => {\n\t\t\tif (active && hasPayload) {\n\t\t\t\trootContext.setPayload(payload);\n\t\t\t}\n\t\t},\n\t);\n\n\tconst markActive = (): void => {\n\t\tconst id = props.id;\n\t\tif (id !== undefined) {\n\t\t\trootContext.setActiveTriggerId(id);\n\t\t}\n\t\tif (\"payload\" in props) {\n\t\t\trootContext.setPayload(props.payload);\n\t\t}\n\t};\n\n\tconst stateAttrs = {\n\t\tget \"data-popup-open\"() {\n\t\t\treturn state().open ? \"\" : undefined;\n\t\t},\n\t\tget id() {\n\t\t\treturn props.id;\n\t\t},\n\t\tonPointerEnter: markActive,\n\t\tonFocus: markActive,\n\t\tonClick: markActive,\n\t};\n\n\tconst userClassStyle = resolveClassStyle(props, () => state());\n\n\tconst userProps = omit(\n\t\tprops,\n\t\t\"as\",\n\t\t\"class\",\n\t\t\"style\",\n\t\t\"attrs\",\n\n\t\t\"disabled\",\n\t\t\"nativeButton\",\n\t\t\"delay\",\n\t\t\"closeDelay\",\n\t\t\"closeOnClick\",\n\t\t\"handle\",\n\t\t\"payload\",\n\t);\n\n\tlet merged: Record<string, unknown> = mergeRootProps(\n\t\thoverProps.reference ?? {},\n\t\treferenceProps,\n\t);\n\tmerged = mergeRootProps(merged, buttonProps);\n\tmerged = mergeRootProps(merged, stateAttrs);\n\tmerged = mergeRootProps(merged, userClassStyle);\n\tmerged = mergeRootProps(merged, userProps);\n\n\tconst Tag = dynamic(() => props.as ?? \"button\");\n\treturn (\n\t\t<Tag {...merged} ref={composeRefs(buttonRef, triggerRef, userRef(props))} />\n\t);\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,YAAY,EAAEC,UAAU,EAAEC,IAAI,EAAEC,SAAS,EAAEC,OAAO,QAAQ,UAAU;AAC7E,SAASC,WAAW,EAAEC,OAAO,QAAQ,8BAA8B;AACnE,SAASC,aAAa,QAAQ,6DAA6D;AAC3F,SAASC,QAAQ,QAAQ,6CAA6C;AACtE,SAASC,WAAW,QAAQ,0CAA0C;AAEtE,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,iBAAiB,QAAQ,qCAAqC;AAKvE,SAASC,SAAS,QAAQ,uCAAuC;AACjE,SAASC,kBAAkB,QAAQ,uCAAuC;AAC1E,SAASC,UAAU,QAAQ,cAAc;AAEzC,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,qBAAqB,QAAQ,yBAAyB;AA2B/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cA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