/**
 * Patched version of requestAnimationFrame that avoids ngzone
 * Use only when you know ngzone should not run
 */
const raf = (h) => {
    if (typeof __zone_symbol__requestAnimationFrame === "function") {
        return __zone_symbol__requestAnimationFrame(h);
    }
    if (typeof requestAnimationFrame === "function") {
        return requestAnimationFrame(h);
    }
    return setTimeout(h);
};
const now = (ev) => {
    return ev.timeStamp || Date.now();
};
function deferEvent(event) {
    return debounceEvent(event, 0);
}
function debounceEvent(event, wait) {
    const original = event._original || event;
    return {
        _original: event,
        emit: debounce(original.emit.bind(original), wait)
    };
}
function debounce(func, wait = 0) {
    let timer;
    return (...args) => {
        clearTimeout(timer);
        timer = setTimeout(func, wait, ...args);
    };
}
function hasShadowDom(el) {
    return !!el.shadowRoot && !!el.attachShadow;
}
const sleep = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds));

export { deferEvent as a, debounceEvent as d, hasShadowDom as h, now as n, raf as r, sleep as s };

//# sourceMappingURL=helpers-09d305fe.js.map