import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import "core-js/modules/web.timers.js";
import { useEffect, useState } from 'react';
import { FcrIcon } from '../icon';
import { FcrIconType } from '../icon/type';
import { jsx as _jsx } from "react/jsx-runtime";
export var 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 = useState(0),
    _useState2 = _slicedToArray(_useState, 2),
    phoneCallFrame = _useState2[0],
    setPhoneCallFrame = _useState2[1];
  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 ? FcrIconType.FCR_PHONECALL1 : phoneCallFrame === 2 ? FcrIconType.FCR_PHONECALL3 : FcrIconType.FCR_PHONECALL2;
  return /*#__PURE__*/_jsx(FcrIcon, {
    type: isMuted ? FcrIconType.FCR_PHONECALL_SILENCE : icon,
    size: size,
    colors: isMuted ? mutedIconColors : iconColors,
    className: className
  });
};