import { _ as _defineProperty } from '../_verture/defineProperty-62acccfc.js';
import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
import { jsx, jsxs } from 'react/jsx-runtime';
import RcSwitch from 'rc-switch';
import clsx from 'clsx';
import LoadingOutlined from '@iam-com/icons/LoadingF';
import Label from '../Label/index.js';
import { $ as $prefixCls, a as $rcPrefixCls } from '../_verture/constant-66aa48a1.js';
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
import '../_verture/typeof-498dd2b1.js';
import '../Help/index.js';
import '../Tooltip/index.js';
import '../_verture/slicedToArray-76060636.js';
import '../_verture/unsupportedIterableToArray-cb478f24.js';
import 'react';
import 'rc-tooltip';
import 'rc-tooltip/lib/placements';
import '@iam-com/icons/Help';

var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/3 下午5:58\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-switch {\n  position: relative;\n  display: inline-block;\n  min-width: 32px;\n  height: 18px;\n  vertical-align: middle;\n  background-color: transparent;\n  border: 0;\n  border-radius: 100px;\n  cursor: pointer;\n  transition: all 0.2s;\n  user-select: none;\n}\n.paraui-v3-switch:before {\n  position: absolute;\n  top: 2px;\n  left: 0;\n  width: 100%;\n  height: 14px;\n  border-radius: 100px;\n  background-color: rgba(171, 176, 185, 0.4);\n  content: \"\";\n  transition: all 0.2s;\n}\n.paraui-v3-switch:focus {\n  outline: 0;\n  box-shadow: none;\n}\n.paraui-v3-switch.component-switch-checked:focus {\n  box-shadow: none;\n}\n.paraui-v3-switch:focus:hover {\n  box-shadow: none;\n}\n.paraui-v3-switch.component-switch-checked:before {\n  background-color: rgba(54, 102, 214, 0.2);\n}\n.paraui-v3-switch-loading, .paraui-v3-switch.component-switch-disabled {\n  cursor: not-allowed;\n  opacity: 0.4;\n}\n.paraui-v3-switch-loading *, .paraui-v3-switch.component-switch-disabled * {\n  box-shadow: none;\n  cursor: not-allowed;\n}\n.paraui-v3-switch .component-switch-inner {\n  display: block;\n  margin: 0 7px 0 25px;\n  color: rgb(255, 255, 255);\n  font-size: 14px;\n  transition: margin 0.2s;\n}\n.paraui-v3-switch.component-switch-checked .component-switch-inner {\n  margin: 0 25px 0 7px;\n}\n.paraui-v3-switch .component-switch-handle {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 18px;\n  height: 18px;\n  transition: all 0.2s ease-in-out;\n}\n.paraui-v3-switch .component-switch-handle::before {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  background-color: #8996AA;\n  border-radius: 9px;\n  box-shadow: none;\n  transition: all 0.2s ease-in-out;\n  content: \"\";\n}\n.paraui-v3-switch.component-switch-checked .component-switch-handle {\n  left: calc(100% - 18px);\n}\n.paraui-v3-switch.component-switch-checked .component-switch-handle::before {\n  background-color: rgb(54, 102, 214);\n}\n.paraui-v3-switch:not(.paraui-v3-switch-disabled):active .component-switch-handle::before {\n  right: -30%;\n  left: 0;\n}\n.paraui-v3-switch:not(.paraui-v3-switch-disabled):active.component-switch-checked .component-switch-handle::before {\n  right: 0;\n  left: -30%;\n}\n.paraui-v3-switch .component-switch-loading-icon {\n  position: relative;\n  top: 1px;\n  color: rgb(54, 102, 214);\n  vertical-align: top;\n  animation: switchLoadingCircle 1s infinite linear;\n}\n.paraui-v3-switch.component-switch-checked .component-switch-loading-icon {\n  color: rgb(255, 255, 255);\n}\n.paraui-v3-switch-small {\n  min-width: 28px;\n  height: 14px;\n  line-height: 14px;\n}\n.paraui-v3-switch-small .component-switch-inner {\n  margin: 0 5px 0 18px;\n  font-size: 14px;\n}\n.paraui-v3-switch-small .component-switch-handle {\n  width: 12px;\n  height: 12px;\n  top: 3px;\n  left: 2px;\n}\n.paraui-v3-switch-small .component-switch-loading-icon {\n  top: 1.5px;\n  font-size: 9px;\n}\n.paraui-v3-switch-small.component-switch-checked .component-switch-inner {\n  margin: 0 18px 0 5px;\n}\n.paraui-v3-switch-small.component-switch-checked .component-switch-handle {\n  left: calc(100% - 12px - 2px);\n}\n@keyframes switchLoadingCircle {\n  100% {\n    transform: rotate(360deg);\n  }\n}\n\n.paraui-v3-switch-label {\n  display: inline-flex;\n}\n.paraui-v3-switch-label .component-switch-text {\n  color: rgba(46, 55, 67, 0.7);\n  font-size: 14px;\n  font-weight: 400;\n}\n.paraui-v3-switch-label-top {\n  flex-direction: column-reverse;\n  align-items: flex-start;\n}\n.paraui-v3-switch-label-top .component-switch-text {\n  margin-bottom: 8px;\n}\n.paraui-v3-switch-label-bottom {\n  flex-direction: column;\n  align-items: flex-start;\n}\n.paraui-v3-switch-label-bottom .component-switch-text {\n  margin-top: 8px;\n  margin-bottom: 0;\n}\n.paraui-v3-switch-label-start {\n  flex-direction: row-reverse;\n  align-items: center;\n}\n.paraui-v3-switch-label-start .component-switch-text {\n  margin-right: 8px;\n  margin-bottom: 0;\n}\n.paraui-v3-switch-label-end {\n  flex-direction: row;\n  align-items: center;\n}\n.paraui-v3-switch-label-end .component-switch-text {\n  margin-left: 8px;\n  margin-bottom: 0;\n}";
styleInject(css_248z);

//Switch 开关
var Switch = function Switch(props) {
  props.compact;
    props.size;
    var loading = props.loading,
    disabled = props.disabled,
    className = props.className,
    label = props.label,
    labelTooltip = props.labelTooltip,
    _props$labelPlacement = props.labelPlacement,
    labelPlacement = _props$labelPlacement === void 0 ? 'top' : _props$labelPlacement,
    restProps = __rest(props, ["compact", "size", "loading", "disabled", "className", "label", "labelTooltip", "labelPlacement"]);
  //cls
  var classes = clsx("".concat($prefixCls, "-switch"), _defineProperty({}, "".concat($prefixCls, "-switch-loading"), loading), className);
  //label cls
  var labelClasses = clsx("".concat($prefixCls, "-switch-label"), "".concat($prefixCls, "-switch-label-").concat(labelPlacement));
  //loading circle
  var loadingIcon = jsx("div", Object.assign({
    className: "".concat($rcPrefixCls, "-switch-handle")
  }, {
    children: loading && jsx(LoadingOutlined, {
      className: "".concat($rcPrefixCls, "-switch-loading-icon")
    })
  }));
  if (label) {
    return jsxs("span", Object.assign({
      className: labelClasses
    }, {
      children: [jsx(RcSwitch, Object.assign({}, restProps, {
        prefixCls: "".concat($rcPrefixCls, "-switch"),
        className: classes,
        disabled: disabled || loading,
        loadingIcon: loadingIcon
      })), jsx(Label, Object.assign({
        label: label
      }, labelTooltip, {
        className: "".concat($rcPrefixCls, "-switch-text")
      }))]
    }));
  }
  return jsx(RcSwitch, Object.assign({}, restProps, {
    prefixCls: "".concat($rcPrefixCls, "-switch"),
    className: classes,
    disabled: disabled || loading,
    loadingIcon: loadingIcon
  }));
};

export { Switch, Switch as default };
