function _array_like_to_array(arr, len) {
    if (len == null || len > arr.length) len = arr.length;
    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
    return arr2;
}
function _array_without_holes(arr) {
    if (Array.isArray(arr)) return _array_like_to_array(arr);
}
function _iterable_to_array(iter) {
    if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _non_iterable_spread() {
    throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _to_consumable_array(arr) {
    return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
}
function _unsupported_iterable_to_array(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _array_like_to_array(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
import React from "react";
import { classes, privateTokens } from "../Rating.tokens";
import { IconStarFill16, IconStarFill24, IconStarFill36, IconStarHalfFill16, IconStarHalfFill24, IconStarHalfFill36, IconStarOutline16, IconStarOutline24, IconStarOutline36 } from "../../_Icon";
import { Star } from "../Rating.styles";
var iconMap = function iconMap(componentSize) {
    var iconProps = {
        color: 'inherit',
        sizeCustomProperty: privateTokens.iconSize
    };
    switch(componentSize){
        case 'displayL':
        case 'displayM':
        case 'displayS':
        case 'h1':
        case 'h2':
            return {
                fill: /*#__PURE__*/ React.createElement(IconStarFill36, iconProps),
                halfFill: /*#__PURE__*/ React.createElement(IconStarHalfFill36, iconProps),
                outline: /*#__PURE__*/ React.createElement(IconStarOutline36, iconProps)
            };
        case 'h3':
        case 'h4':
        case 'h5':
        case 'h6':
        case 'l':
        case 'm':
            return {
                fill: /*#__PURE__*/ React.createElement(IconStarFill24, iconProps),
                halfFill: /*#__PURE__*/ React.createElement(IconStarHalfFill24, iconProps),
                outline: /*#__PURE__*/ React.createElement(IconStarOutline24, iconProps)
            };
        case 's':
        case 'xs':
        case 'xxs':
            return {
                fill: /*#__PURE__*/ React.createElement(IconStarFill16, iconProps),
                halfFill: /*#__PURE__*/ React.createElement(IconStarHalfFill16, iconProps),
                outline: /*#__PURE__*/ React.createElement(IconStarOutline16, iconProps)
            };
        default:
            return {
                fill: /*#__PURE__*/ React.createElement(IconStarFill24, iconProps),
                halfFill: /*#__PURE__*/ React.createElement(IconStarHalfFill24, iconProps),
                outline: /*#__PURE__*/ React.createElement(IconStarOutline24, iconProps)
            };
    }
};
export var getIcons = function getIcons(param) {
    var innerValue = param.innerValue, size = param.size, _param_iconQuantity = param.iconQuantity, iconQuantity = _param_iconQuantity === void 0 ? 5 : _param_iconQuantity, iconSlot = param.iconSlot, iconSlotOutline = param.iconSlotOutline, iconSlotHalf = param.iconSlotHalf;
    var _iconMap = iconMap(size), fill = _iconMap.fill, halfFill = _iconMap.halfFill, outline = _iconMap.outline;
    if (iconQuantity === 1) {
        return /*#__PURE__*/ React.createElement(Star, {
            className: classes.singleIcon
        }, iconSlot || fill);
    }
    var filledIcons = Array.from({
        length: Math.floor(Number(innerValue))
    }, function(_, index) {
        return /*#__PURE__*/ React.createElement(Star, {
            key: "filled_".concat(index, "_").concat(innerValue)
        }, iconSlot || fill);
    });
    if (Number(innerValue) > 0 && !Number.isInteger(Number(innerValue))) {
        filledIcons.push(/*#__PURE__*/ React.createElement(Star, {
            key: "half-fill"
        }, iconSlotHalf || halfFill));
    }
    var outlineIconsLength = iconQuantity - filledIcons.length;
    var outlineIcons = Array.from({
        length: outlineIconsLength
    }, function(_, index) {
        return /*#__PURE__*/ React.createElement(Star, {
            key: "outline_".concat(index, "_").concat(innerValue),
            className: classes.iconOutline
        }, iconSlotOutline || outline);
    });
    return _to_consumable_array(filledIcons).concat(_to_consumable_array(outlineIcons));
};
