"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "TextSkeleton", {
    enumerable: true,
    get: function() {
        return TextSkeleton;
    }
});
var _react = /*#__PURE__*/ _interop_require_default(require("react"));
var _styledcomponents = /*#__PURE__*/ _interop_require_default(require("styled-components"));
var _Skeleton = require("./Skeleton");
var _LineSkeleton = require("./LineSkeleton");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
function _object_without_properties(source, excluded) {
    if (source == null) return {};
    var target = {}, sourceKeys, key, i;
    if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
        sourceKeys = Reflect.ownKeys(source);
        for(i = 0; i < sourceKeys.length; i++){
            key = sourceKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
        return target;
    }
    target = _object_without_properties_loose(source, excluded);
    if (Object.getOwnPropertySymbols) {
        sourceKeys = Object.getOwnPropertySymbols(source);
        for(i = 0; i < sourceKeys.length; i++){
            key = sourceKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
    }
    return target;
}
function _object_without_properties_loose(source, excluded) {
    if (source == null) return {};
    var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
    for(i = 0; i < sourceKeys.length; i++){
        key = sourceKeys[i];
        if (excluded.indexOf(key) >= 0) continue;
        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
        target[key] = source[key];
    }
    return target;
}
var variousWidth = [
    7.58,
    5.27,
    13.54,
    6.63,
    0.28,
    14.8,
    0.33,
    11.26,
    14.1,
    10.59,
    3.38,
    13.5,
    7.71,
    3.34,
    7.96
];
var StyledTextSkeleton = _styledcomponents.default.div.withConfig({
    displayName: "TextSkeleton__StyledTextSkeleton",
    componentId: "sc-90ee6487-0"
})([
    "display:flex;flex-direction:column;width:100%;"
]);
var TextSkeleton = function TextSkeleton(_0) {
    var lines = _0.lines, width = _0.width, roundness = _0.roundness, _0_size = _0.size, size = _0_size === void 0 ? _Skeleton.DEFAULT_TEXT_SIZE : _0_size, props = _object_without_properties(_0, [
        "lines",
        "width",
        "roundness",
        "size"
    ]);
    return /*#__PURE__*/ _react.default.createElement(StyledTextSkeleton, props, Array.from(Array(lines), function(_, i) {
        var w;
        if (width) {
            // TODO; https://github.com/salute-developers/plasma/issues/230
            w = width;
        } else {
            switch(true){
                // Последняя строка
                case i === lines - 1 && lines !== 1:
                    w = 45 - variousWidth[i % variousWidth.length];
                    break;
                // Единственная или первая из двух
                case lines === 1 || lines === 2:
                    w = 100;
                    break;
                default:
                    w = 100 - variousWidth[i % variousWidth.length];
            }
        }
        return /*#__PURE__*/ _react.default.createElement(_LineSkeleton.LineSkeleton, {
            key: "line:".concat(i),
            size: size,
            roundness: roundness,
            style: {
                width: "".concat(w, "%")
            }
        });
    }));
};
