import { FloatingDelayGroup } from "../../internals/floating-ui/components/floating-delay-group.jsx";
import { TooltipProviderContext } from "../tooltip-provider-context.jsx";
/**
 * Provides a shared delay for multiple tooltips. The grouping logic ensures
 * that once a tooltip becomes visible, the adjacent tooltips will be shown
 * instantly. Mirrors Base UI React's `<Tooltip.Provider>`.
 *
 * Solid 2 notes:
 *
 * - `FloatingDelayGroup` lives under the floating-ui-react Solid port and
 *   owns the `delayRef` / instant-phase coordination. The provider only
 *   contributes the consumer-configurable `delay` / `closeDelay` values —
 *   sibling triggers read them via `useTooltipProviderContext`.
 * - Timeout defaults to 400 ms (matches React).
 */
export function TooltipProvider(props) {
  const contextValue = {
    get delay() {
      return props.delay;
    },
    get closeDelay() {
      return props.closeDelay;
    }
  };
  const timeout = () => props.timeout ?? 400;

  // `FloatingDelayGroup` expects a `Delay` object (or number). We construct
  // one lazily so the provider re-renders pick up `delay` / `closeDelay`
  // prop changes without dropping the group context.
  const delayValue = {
    get open() {
      return props.delay;
    },
    get close() {
      return props.closeDelay;
    }
  };
  return <TooltipProviderContext value={contextValue}>
			<FloatingDelayGroup delay={delayValue} timeoutMs={timeout()}>
				{props.children}
			</FloatingDelayGroup>
		</TooltipProviderContext>;
}
//# sourceMappingURL=tooltip-provider.jsx.map
