"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.FcrIconPhoneCall = 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");
var _jsxRuntime = require("react/jsx-runtime");
var FcrIconPhoneCall = exports.FcrIconPhoneCall = function FcrIconPhoneCall(props) {
  var _props$size = props.size,
    size = _props$size === void 0 ? 32 : _props$size,
    _props$isMuted = props.isMuted,
    isMuted = _props$isMuted === void 0 ? true : _props$isMuted,
    _props$mutedIconColor = props.mutedIconColors,
    mutedIconColors = _props$mutedIconColor === void 0 ? {
      iconPrimary: 'var(--fcr_ui_scene_ramp_red6)'
    } : _props$mutedIconColor,
    _props$iconColors = props.iconColors,
    iconColors = _props$iconColors === void 0 ? {
      iconPrimary: 'var(--fcr_ui_scene_ramp_green6)'
    } : _props$iconColors,
    className = props.className;
  var _useState = (0, _react.useState)(0),
    _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
    phoneCallFrame = _useState2[0],
    setPhoneCallFrame = _useState2[1];
  (0, _react.useEffect)(function () {
    // 假设有 0 1 2 三帧，[0, 1, 2, 1, 0] 共花费 1 秒，帧间隔为 0.25 秒
    var timer = setInterval(function () {
      return setPhoneCallFrame(function (frame) {
        return (frame + 1) % 4;
      });
    }, 250);
    return function () {
      return clearInterval(timer);
    };
  }, []);
  var icon = phoneCallFrame === 0 ? _type.FcrIconType.FCR_PHONECALL1 : phoneCallFrame === 2 ? _type.FcrIconType.FCR_PHONECALL3 : _type.FcrIconType.FCR_PHONECALL2;
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_icon.FcrIcon, {
    type: isMuted ? _type.FcrIconType.FCR_PHONECALL_SILENCE : icon,
    size: size,
    colors: isMuted ? mutedIconColors : iconColors,
    className: className
  });
};