"use strict";

require("core-js/modules/es.object.define-property.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FcrIconFrame = void 0;
require("core-js/modules/web.timers.js");
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _react = require("react");
var _icon = require("../icon");
var _type = require("../icon/type");
require("./index.css");
var _jsxRuntime = require("react/jsx-runtime");
var FcrIconFrame = exports.FcrIconFrame = function FcrIconFrame(props) {
  var _props$frameIcons = props.frameIcons,
    frameIcons = _props$frameIcons === void 0 ? [] : _props$frameIcons,
    _props$size = props.size,
    size = _props$size === void 0 ? 24 : _props$size,
    _props$iconColors = props.iconColors,
    iconColors = _props$iconColors === void 0 ? {
      iconPrimary: 'var(--fcr_web_ui_scene_mainicon1)'
    } : _props$iconColors;
  var _useState = (0, _react.useState)(frameIcons.length ? frameIcons[0] : _type.FcrIconType.FCR_NOTICE),
    _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
    icon = _useState2[0],
    setIcon = _useState2[1];
  (0, _react.useEffect)(function () {
    if (frameIcons.length === 0) return;
    var timer = setInterval(function () {
      setIcon(frameIcons[Math.floor(Math.random() * frameIcons.length)]);
    }, 500);
    return function () {
      return timer && clearInterval(timer);
    };
  }, []);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_icon.FcrIcon, {
    type: icon,
    size: size,
    colors: iconColors
  });
};