import{a as e,n as t}from"./chunk-BneVvdWh.js";import{t as n}from"./react-C7IZe2D1.js";import{ht as r,t as i}from"./dist-DtfJeYQK.js";import{t as a}from"./jsx-runtime-C2wGStra.js";import{n as o,t as s}from"./dist-Cc1j9Pjk.js";var c,l,u,d=t((()=>{c=`Switch__mFYAU`,l=`thumb__IEKpQ`,u={Switch:c,thumb:l}})),f,p,m,h,g,_=t((()=>{f=e(n(),1),i(),s(),d(),p=a(),m=(0,f.createContext)({checked:!1}),h=()=>(0,f.useContext)(m),g=(0,f.forwardRef)(function({checked:e,defaultChecked:t,onCheckedChange:n,onClick:i,className:a,children:s,dataset:c,...l},d){let[h,g]=(0,f.useState)(t??!1),_=e!==void 0,v=_?e:h,y=e=>{if(i?.(e),e.defaultPrevented)return;let t=!v;_||g(t),n?.(t)};return(0,p.jsx)(m.Provider,{value:{checked:v},children:(0,p.jsx)(`button`,{type:`button`,...l,...r(c,{preplyDsComponent:o.Switch}),ref:d,role:`switch`,"aria-checked":v,"data-checked":v,className:[u.Switch,a].filter(Boolean).join(` `),onClick:y,children:s})})});try{h.displayName=`useSwitchContext`,h.__docgenInfo={description:"Returns the checked state of the nearest `SwitchRoot` ancestor.\nUse this when building a fully custom thumb that needs the checked value in JS.",displayName:`useSwitchContext`,props:{}}}catch{}try{g.displayName=`SwitchRoot`,g.__docgenInfo={description:``,displayName:`SwitchRoot`,props:{checked:{defaultValue:null,description:``,name:`checked`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},onCheckedChange:{defaultValue:null,description:``,name:`onCheckedChange`,required:!1,type:{name:`enum`,value:[{value:`(checked: boolean) => void`}]}},dataset:{defaultValue:null,description:``,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}})),v,y,b,x=t((()=>{v=e(n(),1),_(),d(),y=a(),b=(0,v.forwardRef)(function({className:e,children:t,...n},r){let{checked:i}=h();return(0,y.jsx)(`span`,{...n,ref:r,className:[u.thumb,e].filter(Boolean).join(` `),"data-checked":i,children:t})});try{b.displayName=`SwitchThumb`,b.__docgenInfo={description:``,displayName:`SwitchThumb`,props:{}}}catch{}}));export{h as a,_ as i,x as n,g as r,b as t};