"use client";
import { useDraggable } from "../draggable/useDraggable.js";
import { useEnsuredId } from "../useEnsuredId.js";
/**
 * Used to control the state for the `WindowSplitter` component.
 *
 * @example
 * Custom Implementation
 * ```tsx
 * import { useWindowSplitter, WindowSplitterImplementation } from "@react-md/core";
 * import { useState } from "react";
 *
 * // this is pretty much the `useWindowSplitter` implementation
 * export function useMyCustomWindowSplitter(): WindowSplitterImplementation {
 *   const [dragging, setDragging] = useState(false);
 *   const [value, setValue] = useState(0);
 *   const splitter = useWindowSplitter({
 *     min: 0,
 *     max: 100,
 *     value,
 *     setValue,
 *     dragging,
 *     setDragging,
 *   });
 *
 *   return {
 *     ...splitter,
 *     value,
 *     setValue,
 *     dragging,
 *   }
 * }
 * ```
 *
 * @remarks \@since 6.0.0
 */ export function useWindowSplitter(options) {
    const { id: propId, reversed = false, vertical } = options;
    const id = useEnsuredId(propId, "splitter");
    const draggableImplementation = useDraggable(options);
    const { dragging, percentage, draggableRef, mouseEventHandlers, keyboardEventHandlers } = draggableImplementation;
    return {
        ...draggableImplementation,
        splitterProps: {
            "aria-orientation": vertical ? "vertical" : undefined,
            "aria-valuenow": Math.ceil(percentage * 100),
            "aria-valuemin": 0,
            "aria-valuemax": 100,
            id,
            ref: draggableRef,
            role: "separator",
            dragging,
            reversed,
            ...mouseEventHandlers,
            ...keyboardEventHandlers
        }
    };
}

//# sourceMappingURL=useWindowSplitter.js.map