/*!
 * KoliBri - The accessible HTML-Standard
 */
import { s as setFocus, b as setClick, d as delegateFocus$1, a as delegateClick$1 } from './element-focus.js';

function createCtaRef() {
    const ref = ((el) => {
        ref.el = el;
    });
    ref.el = undefined;
    return ref;
}
function makeMethodDecorator(fn) {
    return (_target, _key, descriptor) => {
        descriptor.value = async function () {
            return fn(this);
        };
        return descriptor;
    };
}
function makeFocusDecorator(fn) {
    return (_target, _key, descriptor) => {
        descriptor.value = async function (options) {
            return fn(this, options);
        };
        return descriptor;
    };
}
function directFocus(refPropName) {
    return makeFocusDecorator((self, options) => {
        var _a;
        const element = (_a = self[refPropName]) === null || _a === void 0 ? void 0 : _a.el;
        return element ? setFocus(element, options) : Promise.resolve();
    });
}
function directClick(refPropName) {
    return makeMethodDecorator((self) => {
        const element = self[refPropName].el;
        return element ? setClick(element) : Promise.resolve();
    });
}
function delegateFocus(refPropName) {
    return makeFocusDecorator((self, options) => {
        const host = self['host'];
        if (!host)
            return Promise.resolve();
        return delegateFocus$1(host, () => {
            var _a;
            const element = (_a = self[refPropName]) === null || _a === void 0 ? void 0 : _a.el;
            return element ? setFocus(element, options) : Promise.resolve();
        });
    });
}
function delegateClick(refPropName) {
    return makeMethodDecorator((self) => delegateClick$1(self['host'], () => {
        const element = self[refPropName].el;
        return element ? setClick(element) : Promise.resolve();
    }));
}

export { delegateClick as a, directFocus as b, createCtaRef as c, delegateFocus as d, directClick as e };
//# sourceMappingURL=element-interaction.js.map

//# sourceMappingURL=element-interaction.js.map