import { useMemo } from "react";
import { bottomPositionForHandle, heightForHandleWithPosition, leftPositionForHandle, rightPositionForHandle, topPositionForHandle, transformForHandle, widthForHandleWithPosition } from "./ButtonHandleStyleUtils.js";
const useButtonHandleSizeAndPosition = ({ position, positionPercent, numHandles, customPositionAndOffsets })=>{
    const width = useMemo(()=>widthForHandleWithPosition({
            position,
            numHandles,
            customWidth: customPositionAndOffsets?.width
        }), [
        customPositionAndOffsets?.width,
        position,
        numHandles
    ]);
    const height = useMemo(()=>heightForHandleWithPosition({
            position,
            numHandles,
            customHeight: customPositionAndOffsets?.height
        }), [
        customPositionAndOffsets?.height,
        position,
        numHandles
    ]);
    const top = useMemo(()=>topPositionForHandle({
            position,
            positionPercent,
            customHeight: customPositionAndOffsets?.height,
            customTop: customPositionAndOffsets?.top,
            customBottom: customPositionAndOffsets?.bottom
        }), [
        customPositionAndOffsets?.top,
        customPositionAndOffsets?.bottom,
        customPositionAndOffsets?.height,
        position,
        positionPercent
    ]);
    const bottom = useMemo(()=>bottomPositionForHandle({
            position,
            positionPercent,
            customHeight: customPositionAndOffsets?.height,
            customTop: customPositionAndOffsets?.top,
            customBottom: customPositionAndOffsets?.bottom
        }), [
        customPositionAndOffsets?.bottom,
        customPositionAndOffsets?.top,
        customPositionAndOffsets?.height,
        position,
        positionPercent
    ]);
    const left = useMemo(()=>leftPositionForHandle({
            position,
            positionPercent,
            customWidth: customPositionAndOffsets?.width,
            customRight: customPositionAndOffsets?.right,
            customLeft: customPositionAndOffsets?.left
        }), [
        customPositionAndOffsets?.left,
        customPositionAndOffsets?.right,
        customPositionAndOffsets?.width,
        position,
        positionPercent
    ]);
    const right = useMemo(()=>rightPositionForHandle({
            position,
            positionPercent,
            customWidth: customPositionAndOffsets?.width,
            customRight: customPositionAndOffsets?.right,
            customLeft: customPositionAndOffsets?.left
        }), [
        customPositionAndOffsets?.right,
        customPositionAndOffsets?.left,
        customPositionAndOffsets?.width,
        position,
        positionPercent
    ]);
    const transform = useMemo(()=>transformForHandle({
            position,
            customPositionAndOffsets
        }), [
        position,
        customPositionAndOffsets
    ]);
    return {
        width,
        height,
        top,
        bottom,
        left,
        right,
        transform
    };
};
export { useButtonHandleSizeAndPosition };
