"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 getFallbackProps () {
        return getFallbackProps;
    },
    get sizeFormatting () {
        return sizeFormatting;
    }
});
function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
var sizeFormatting = function sizeFormatting(size) {
    var deviceScale = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
    var scalingPixelBasis = 16;
    if (typeof size === 'number' || !size.endsWith('rem') && !size.endsWith('px')) {
        return "".concat(Number(size) / (scalingPixelBasis * deviceScale), "rem");
    }
    return size;
};
var getFallbackProps = function getFallbackProps(props, initialInnerProps) {
    var size = props.size;
    var color = props.color || initialInnerProps.color;
    if (typeof size === 'number' || size && !Number.isNaN(parseInt(size, 10))) {
        var wrapperSize = sizeFormatting(size);
        return {
            wrapperWidth: wrapperSize,
            wrapperHeight: wrapperSize,
            svgWidth: size,
            svgHeight: size,
            color: color
        };
    }
    return _object_spread_props(_object_spread({}, initialInnerProps), {
        color: color
    });
};
