import { LayoutBreakPoint, } from './types';
import { hasOwnProperty } from '../../utils/hasOwn';
var BREAKPOINT_MAP = Object.keys(LayoutBreakPoint).reduce(function (m, k) {
    m[LayoutBreakPoint[k]] = k;
    return m;
}, {});
export var BREAKPOINTS = Object.keys(BREAKPOINT_MAP);
export function getValueForBreakpoint(breakpoints, valueMap) {
    if (typeof valueMap === 'number') {
        return valueMap;
    }
    for (var i = 0; i < BREAKPOINTS.length; i++) {
        var brk = BREAKPOINTS[i];
        var breakpointName = BREAKPOINT_MAP[brk];
        if (breakpoints[brk]) {
            var val = valueMap[breakpointName];
            if (val !== undefined) {
                return val;
            }
        }
    }
    if (hasOwnProperty(valueMap, 'fallback')) {
        return valueMap.fallback;
    }
    return 0;
}
