"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Spinner_exports = {};
__export(Spinner_exports, {
  default: () => Spinner_default
});
module.exports = __toCommonJS(Spinner_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_react = __toESM(require("react"));
var import_styled_components = __toESM(require("styled-components"));
var import_prop_types = require("prop-types");
var import_lodash = __toESM(require("lodash.get"));
const StyledSpinner = import_styled_components.default.span`
  ${({ color, size }) => `
    .spinner {
      display: inline-block;
      width: ${size}px;
      height: ${size}px;
      color: ${color};
      animation: 1.4s linear 0s infinite normal none running rotation;
    }
    .circular {
      display: block;
      height: 100%;
      width: 100%;
    }
    .path {
      stroke-dasharray: 80px, 200px;
      stroke-dashoffset: 0;
      -webkit-animation: 1.4s ease-in-out 0s infinite normal none running dash;
      animation: 1.6s ease-in-out 0s infinite normal none running dash;
      stroke-linecap: round;
      stroke: ${color};
    }
    @keyframes rotation {
      0% {
          transform: rotate(0deg);
      }
      100% {
          transform: rotate(360deg);
      }
    }
    @keyframes dash {
      0% {
        stroke-dasharray: 1px, 200px;
        stroke-dashoffset: 0;
      }
      50% {
        stroke-dasharray: 100px, 200px;
        stroke-dashoffset: -15px;
      }
      100% {
        stroke-dasharray: 100px, 200px;
        stroke-dashoffset: -125px;
      }
    }
  `}
`;
const Spinner = import_react.default.forwardRef(
  ({ size = "medium", color = "primary", theme }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
      StyledSpinner,
      {
        color: (0, import_lodash.default)(theme.yoga.colors, color, color),
        size: (0, import_lodash.default)(theme.yoga.spacing, size, size),
        ref,
        "aria-label": "loading-icon",
        children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "spinner", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className: "circular", viewBox: "22 22 44 44", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          "circle",
          {
            className: "path",
            fill: "none",
            strokeWidth: "3.6",
            cx: "44",
            cy: "44",
            r: "20.2"
          }
        ) }) })
      }
    );
  }
);
const commonSizes = [
  "xxxsmall",
  "xxsmall",
  "xsmall",
  "small",
  "medium",
  "large",
  "xlarge",
  "xxlarge",
  "xxxlarge",
  "huge",
  "xhuge"
];
Spinner.propTypes = {
  size: (0, import_prop_types.oneOfType)([(0, import_prop_types.oneOf)(commonSizes), import_prop_types.string, import_prop_types.number]),
  color: import_prop_types.string
};
var Spinner_default = (0, import_styled_components.withTheme)(Spinner);
