import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { forwardRef } from 'react';
import { base as base$1 } from './variations/_view/base.js';
import { base as base$2 } from './variations/_size/base.js';
import { StyledSVG, StyledBackgroundCircle, StyledProgressCircle, StyledContent, base } from './ProgressBarCircular.styles.js';
import { classes } from './ProgressBarCircular.tokens.js';

var _excluded = ["value", "maxValue", "size", "view", "children", "className", "strokeSize", "hasTrack", "reverse"];
var progressBarCircularRoot = function progressBarCircularRoot(Root) {
  return /*#__PURE__*/forwardRef(function (props, ref) {
    var _props$value = props.value,
      value = _props$value === void 0 ? 0 : _props$value,
      _props$maxValue = props.maxValue,
      maxValue = _props$maxValue === void 0 ? 100 : _props$maxValue,
      size = props.size,
      view = props.view,
      children = props.children,
      className = props.className,
      strokeSize = props.strokeSize,
      _props$hasTrack = props.hasTrack,
      hasTrack = _props$hasTrack === void 0 ? true : _props$hasTrack,
      reverse = props.reverse,
      rest = _objectWithoutProperties(props, _excluded);
    var clampedValue = Math.min(Math.max(value, 0), maxValue);
    var percentage = clampedValue / maxValue * 100;
    var center = 50;
    return /*#__PURE__*/React__default.createElement(Root, _extends({
      ref: ref,
      view: view,
      size: size,
      className: className
    }, rest), /*#__PURE__*/React__default.createElement(StyledSVG, {
      width: "100%",
      height: "100%",
      viewBox: "0 0 100 100",
      className: classes.svg
    }, hasTrack && /*#__PURE__*/React__default.createElement(StyledBackgroundCircle, {
      customStrokeWidth: strokeSize,
      cx: center,
      cy: center,
      className: classes.backgroundCircle
    }), /*#__PURE__*/React__default.createElement(StyledProgressCircle, {
      cx: center,
      cy: center,
      customStrokeWidth: strokeSize,
      className: classes.progressCircle,
      percent: percentage,
      reverse: reverse,
      transform: "rotate(-90 50 50)"
    })), children && /*#__PURE__*/React__default.createElement(StyledContent, {
      className: classes.content
    }, children));
  });
};
var progressBarCircularConfig = {
  name: 'ProgressBarCircular',
  tag: 'div',
  layout: progressBarCircularRoot,
  base: base,
  variations: {
    view: {
      css: base$1
    },
    size: {
      css: base$2
    }
  },
  defaults: {
    view: 'primary',
    size: 'm'
  }
};

export { progressBarCircularConfig, progressBarCircularRoot };
