"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get applySpacing () {
        return applySpacing;
    },
    get spacing () {
        return spacing;
    },
    get spacingFns () {
        return spacingFns;
    }
});
const baseSpacing = {
    0: '0',
    2: '0.125rem',
    4: '0.25rem',
    8: '0.5rem',
    10: '0.625rem',
    12: '0.75rem',
    16: '1rem',
    18: '1.125rem',
    20: '1.25rem',
    24: '1.5rem',
    32: '2rem'
};
const spacing = {
    ...baseSpacing,
    '0x': baseSpacing[0],
    '1x': baseSpacing[2],
    '2x': baseSpacing[4],
    '4x': baseSpacing[8],
    '5x': baseSpacing[10],
    '6x': baseSpacing[12],
    '8x': baseSpacing[16],
    '9x': baseSpacing[18],
    '10x': baseSpacing[20],
    '12x': baseSpacing[24],
    '16x': baseSpacing[32]
};
const createSpacingFn = (params)=>(value)=>{
        return params.reduce((acc, cur)=>({
                ...acc,
                [cur]: spacing[value]
            }), {});
    };
const m = createSpacingFn([
    'margin'
]);
const mt = createSpacingFn([
    'marginTop'
]);
const mr = createSpacingFn([
    'marginRight'
]);
const ml = createSpacingFn([
    'marginLeft'
]);
const mb = createSpacingFn([
    'marginBottom'
]);
const mx = createSpacingFn([
    'marginLeft',
    'marginRight'
]);
const my = createSpacingFn([
    'marginTop',
    'marginBottom'
]);
const p = createSpacingFn([
    'padding'
]);
const pt = createSpacingFn([
    'paddingTop'
]);
const pr = createSpacingFn([
    'paddingRight'
]);
const pl = createSpacingFn([
    'paddingLeft'
]);
const pb = createSpacingFn([
    'paddingBottom'
]);
const px = createSpacingFn([
    'paddingLeft',
    'paddingRight'
]);
const py = createSpacingFn([
    'paddingTop',
    'paddingBottom'
]);
const spacingFns = {
    m,
    mt,
    mr,
    ml,
    mb,
    mx,
    my,
    p,
    pt,
    pr,
    pl,
    pb,
    px,
    py
};
const spacingFnsList = Object.entries(spacingFns);
const applySpacing = (props)=>spacingFnsList.reduce((styles, [fnName, fn])=>{
        if (fnName in props) {
            return {
                ...styles,
                ...fn(props[fnName])
            };
        }
        return styles;
    }, {});
