export const OVERLAY_OPEN_CLASS = 'anj-overlay-open';
export var ActionKey;
(function (ActionKey) {
    ActionKey["ArrowUp"] = "ArrowUp";
    ActionKey["ArrowDown"] = "ArrowDown";
    ActionKey["Enter"] = "Enter";
    ActionKey["Escape"] = "Escape";
})(ActionKey || (ActionKey = {}));
export const ActionKeys = Object.values(ActionKey);
export var BreakPoint;
(function (BreakPoint) {
    BreakPoint[BreakPoint["Xsmall"] = 0] = "Xsmall";
    BreakPoint[BreakPoint["Small"] = 576] = "Small";
    BreakPoint[BreakPoint["Medium"] = 768] = "Medium";
    BreakPoint[BreakPoint["Large"] = 992] = "Large";
    BreakPoint[BreakPoint["Xlarge"] = 1200] = "Xlarge";
})(BreakPoint || (BreakPoint = {}));
export var PagerSizeOption;
(function (PagerSizeOption) {
    PagerSizeOption[PagerSizeOption["Xsmall"] = 10] = "Xsmall";
    PagerSizeOption[PagerSizeOption["Small"] = 15] = "Small";
    PagerSizeOption[PagerSizeOption["Medium"] = 20] = "Medium";
    PagerSizeOption[PagerSizeOption["Large"] = 30] = "Large";
    PagerSizeOption[PagerSizeOption["XLarge"] = 50] = "XLarge";
})(PagerSizeOption || (PagerSizeOption = {}));
export const boolValueChanged = (newValue, oldValue) => {
    return !(!newValue && !oldValue);
};
export const onBoolValueChanged = (newValue, oldValue, cb) => {
    const changed = boolValueChanged(newValue, oldValue);
    if (changed) {
        cb(newValue);
    }
    return newValue;
};
export const coerceToNumber = (value, defValue) => {
    return typeof value === 'string' && !isNaN(value) ? parseInt(value, 10) : defValue;
};
export const concatClasses = (...args) => {
    let classList = [];
    // Really wanted to do this as a reducer but it never worked out
    args.forEach((arg) => {
        classList = arg && Array.isArray(arg) ? classList.concat(arg) : classList.concat([arg]);
    });
    return classList.join(' ');
};
export const debounce = (func, wait = 0) => {
    let timer;
    return (...args) => {
        clearTimeout(timer);
        timer = setTimeout(func, wait, ...args);
    };
};
export const debounceEvent = (event, wait) => {
    const original = event._original || event;
    return {
        _original: event,
        emit: debounce(original.emit.bind(original), wait)
    };
};
export const derivedId = (id, postfix) => {
    return `${id}-${postfix}`;
};
export const evalToBool = (value) => {
    return value !== null && value !== 'false' && value !== '0';
};
export const enterAsClick = (cb) => {
    return (event) => {
        if (event.code === 'Enter') {
            cb(event);
        }
    };
};
export const hasValue = (value) => {
    if (Array.isArray(value)) {
        return value.length > 0;
    }
    else if (typeof value === 'string') {
        return (value && value.trim().length > 0);
    }
    else {
        return (value !== null && value !== undefined);
    }
};
