"use client";
const require_create_event_handler = require("../../core/utils/create-event-handler/create-event-handler.cjs");
//#region packages/@mantine/core/src/utils/Floating/create-context-menu-handlers.ts
function createContextMenuHandlers({ childProps, disabled, opened, setReference, open }) {
	const onMouseDown = require_create_event_handler.createEventHandler(childProps.onMouseDown, (event) => {
		if (disabled) return;
		if (event.button === 2) event.stopPropagation();
	});
	return {
		onContextMenu: require_create_event_handler.createEventHandler(childProps.onContextMenu, (event) => {
			if (disabled || event.defaultPrevented) return;
			event.preventDefault();
			const { clientX, clientY } = event;
			const contextElement = event.currentTarget;
			setReference({
				getBoundingClientRect: () => ({
					x: clientX,
					y: clientY,
					width: 0,
					height: 0,
					top: clientY,
					left: clientX,
					right: clientX,
					bottom: clientY,
					toJSON: () => void 0
				}),
				contextElement
			});
			open();
		}),
		onMouseDown,
		"data-expanded": opened ? true : void 0
	};
}
//#endregion
exports.createContextMenuHandlers = createContextMenuHandlers;

//# sourceMappingURL=create-context-menu-handlers.cjs.map