"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
var _chunk5KRCPBZRcjs = require('./chunk-5KRCPBZR.cjs');var _chunk5NXYDZPPcjs = require('./chunk-5NXYDZPP.cjs');var _react = require('react'); var s = _interopRequireWildcard(_react);function R(B){let{checked:r,defaultChecked:i,disabled:u,onBlur:d,onChange:f,onFocus:h,onFocusVisible:b,readOnly:F,required:g}=B,[x,V]=_chunk5NXYDZPPcjs.g.call(void 0, {controlled:r,default:Boolean(i),name:"Switch",state:"checked"}),_=o=>e=>{var l;e.nativeEvent.defaultPrevented||(V(e.target.checked),_optionalChain([f, 'optionalCall', _2 => _2(e)]),(l=o.onChange)==null||l.call(o,e))},{isFocusVisibleRef:n,onBlur:S,onFocus:v,ref:w}=_chunk5NXYDZPPcjs.j.call(void 0, ),[t,c]=s.useState(!1);u&&t&&c(!1),s.useEffect(()=>{n.current=t},[t,n]);let a=s.useRef(null),y=o=>e=>{var l;a.current||(a.current=e.currentTarget),v(e),n.current===!0&&(c(!0),_optionalChain([b, 'optionalCall', _3 => _3(e)])),_optionalChain([h, 'optionalCall', _4 => _4(e)]),(l=o.onFocus)==null||l.call(o,e)},I=o=>e=>{var l;S(e),n.current===!1&&c(!1),_optionalChain([d, 'optionalCall', _5 => _5(e)]),(l=o.onBlur)==null||l.call(o,e)},H=_chunk5NXYDZPPcjs.i.call(void 0, w,a),$=(o={})=>_chunk5KRCPBZRcjs.a.call(void 0, {checked:r,defaultChecked:i,disabled:u,readOnly:F,ref:H,required:g,type:"checkbox"},o,{onChange:_(o),onFocus:y(o),onBlur:I(o)});return{checked:x,disabled:Boolean(u),focusVisible:t,getInputProps:$,readOnly:Boolean(F)}}exports.a = R;
