/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import { Point } from "@vertexvis/geometry";
export function getMouseClientPosition(event, offsets) {
    const pt = Point.create(event.clientX, event.clientY);
    if (offsets == null) {
        return pt;
    }
    else {
        return Point.subtract(pt, Point.create(offsets.left, offsets.top));
    }
}
/**
 * Returns a CSS transform that will center an element at the given position.
 */
export function cssTransformCenterAt(position) {
    const { x, y } = position;
    return `translate(-50%, -50%) translate(${x}px, ${y}px)`;
}
/**
 * Returns a CSS value for a cursor.
 */
export function cssCursor(cursor) {
    var _a, _b;
    if (typeof cursor === 'string') {
        return cursor;
    }
    else {
        const parts = [
            `url("${cursor.url}")`,
            (_a = cursor.offsetX) !== null && _a !== void 0 ? _a : 0,
            (_b = cursor.offsetY) !== null && _b !== void 0 ? _b : 0,
            ', auto',
        ];
        return parts.join(' ');
    }
}
export function getWindowDevicePixelRatio() {
    if (typeof window !== 'undefined') {
        return window.devicePixelRatio;
    }
    return 1;
}
//# sourceMappingURL=dom.js.map
