"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _chunkSNSG4HBQcjs = require('./chunk-SNSG4HBQ.cjs');



var _chunkOBHJBBPCcjs = require('./chunk-OBHJBBPC.cjs');


var _chunkQQDRBCBYcjs = require('./chunk-QQDRBCBY.cjs');

// src/components/Toggle.tsx
var _styled = require('@emotion/styled'); var _styled2 = _interopRequireDefault(_styled);
var _jsxruntime = require('@emotion/react/jsx-runtime');
var defaultProps = {
  on: false,
  ml: 0,
  mt: 0,
  mb: 0,
  disabled: false
};
function Toggle({
  onChange,
  bg,
  ml = defaultProps.ml,
  mt = defaultProps.mt,
  mb = defaultProps.mb,
  on = defaultProps.on,
  disabled = defaultProps.disabled,
  label,
  id
}) {
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, ToggleContainer, { mb, ml, mt, children: [
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      ToggleButton,
      {
        bg,
        isOn: on,
        onClick: () => onChange(!on),
        disabled,
        type: "button",
        id
      }
    ),
    label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToggleLabel, { htmlFor: id, children: label })
  ] });
}
var width = 44;
var circleDim = 20;
var circleOffset = 2;
var ToggleButton = _styled2.default.call(void 0, _chunkSNSG4HBQcjs.UnstyledButton)`
  color: ${_chunkQQDRBCBYcjs.colors.white};
  font-weight: 500;
  border-radius: 44px;
  width: ${width}px;
  height: 24px;
  opacity: ${({ disabled }) => disabled ? 0.3 : 1};
  background-color: ${({ bg, theme, isOn }) => {
  if (bg) {
    return _chunkOBHJBBPCcjs.getColor.call(void 0, theme, bg);
  } else if (isOn) {
    return theme.success;
  }
  return _chunkOBHJBBPCcjs.themeOr.call(void 0, theme.c1Neutral, theme.c4Neutral)({ theme });
}};
  position: relative;
  &:after {
    content: "";
    display: block;
    position: absolute;
    border-radius: 50%;
    transition: right 0.1s;
    box-shadow:
      0 3px 8px 0 rgba(0, 0, 0, 0.15),
      0 3px 1px 0 rgba(0, 0, 0, 0.06);
    background-color: ${_chunkQQDRBCBYcjs.colors.white};
    width: ${circleDim}px;
    height: ${circleDim}px;
    top: ${circleOffset}px;
    right: ${({ isOn }) => isOn ? `${circleOffset}px` : `${width - circleDim - circleOffset}px`};
  }
`;
var gap = 12;
var ToggleContainer = _styled2.default.span`
  display: flex;
  margin-bottom: ${({ mb }) => mb}px;
  margin-top: ${({ mt }) => mt}px;
  margin-left: ${({ ml }) => ml}px;
  align-items: center;
  gap: ${gap}px;
`;
var ToggleLabel = _styled2.default.label`
  width: calc(100% - ${width + gap}px);
  cursor: pointer;
`;




exports.Toggle = Toggle; exports.ToggleContainer = ToggleContainer;
