"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeDragCancelListener = makeDragCancelListener;
exports.listenDragCancel = listenDragCancel;
const pointer_1 = require("../pointer");
function makeDragCancelListener(listener, _global = false) {
    return (component) => {
        return listenDragCancel(component, listener);
    };
}
function listenDragCancel(component, listener, _global = false) {
    const { $element } = component;
    const dragCancelListener = (_event) => {
        const { $context } = component;
        const event = {
            ...(0, pointer_1.applyContextTransformToPointerEvent)($context, _event),
            dataTransfer: null,
        };
        listener(event, _event);
    };
    $element.addEventListener('dragcancel', dragCancelListener);
    return () => {
        $element.removeEventListener('dragcancel', dragCancelListener);
    };
}
//# sourceMappingURL=dragcancel.js.map