"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../../utils");
var _ = require("lodash");
var Formats = {
    default: function (val) { return val; },
    number: function (val) { return Math.floor(val); },
    usd: function (val) { return utils_1.Format.formatUSD(Math.floor(val)); },
    chinese: function (val) { return utils_1.Format.formatNumber(val); },
    decimal: function (val) { return utils_1.Format.formatDecimal(val); },
    percent: function (val) { return utils_1.Format.formatDecimal(val) + '%'; },
    size: function (val) { return utils_1.Format.formatSize(val); },
};
var Transition = {
    number: function (from, to, p) { return Math.floor(from + p * (to - from)); },
    usd: function (from, to, p) { return utils_1.Format.formatUSD(Math.floor(from + p * (to - from))); },
    chinese: function (from, to, p) { return utils_1.Format.formatNumber(from + p * (to - from)); },
    decimal: function (from, to, p) { return utils_1.Format.formatDecimal(from + p * (to - from)); },
    percent: function (from, to, p) { return utils_1.Format.formatDecimal((from + p * (to - from)) * 100) + '%'; },
    size: function (from, to, p) { return utils_1.Format.formatSize((from + p * (to - from)) * 100); },
};
var default_1 = /** @class */ (function () {
    function default_1() {
    }
    default_1.buildFormat = function (format) {
        if (format === void 0) { format = 'number'; }
        if (_.has(Formats, format)) {
            return Formats[format];
        }
        return Formats.number;
    };
    default_1.buildTransition = function (format) {
        if (format === void 0) { format = 'number'; }
        if (_.has(Transition, format)) {
            return Transition[format];
        }
        return Transition.number;
    };
    return default_1;
}());
exports.default = default_1;
