var h=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var b=(l,r)=>{var a={};for(var s in l)V.call(l,s)&&r.indexOf(s)<0&&(a[s]=l[s]);if(l!=null&&h)for(var s of h(l))r.indexOf(s)<0&&S.call(l,s)&&(a[s]=l[s]);return a};import{a1 as f,W as B,E as y,ai as u,aj as c,ak as m,al as w,an as R,a9 as e,ag as g,aS as v,p as $,aR as E}from"../jse/index-index-BUJ_4tQs.js";import{bK as F,bk as k,c6 as K,bm as P,c7 as T,bC as j,al as L,bL as _,bo as M}from"./bootstrap-Bqxdt4iG.js";const[N,z]=P("SwitchRoot");var H=f({__name:"SwitchRoot",props:{defaultValue:{type:Boolean,required:!1},modelValue:{type:[Boolean,null],required:!1,default:void 0},disabled:{type:Boolean,required:!1},id:{type:String,required:!1},value:{type:String,required:!1,default:"on"},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:modelValue"],setup(l,{emit:r}){const a=l,s=r,{disabled:o}=B(a),d=F(a,"modelValue",s,{defaultValue:a.defaultValue,passive:a.modelValue===void 0});function i(){o.value||(d.value=!d.value)}const{forwardRef:p,currentElement:n}=k(),q=K(n),C=y(()=>{var t;return a.id&&n.value?(t=document.querySelector(`[for="${a.id}"]`))==null?void 0:t.innerText:void 0});return z({modelValue:d,toggleCheck:i,disabled:o}),(t,D)=>(c(),u(e(_),g(t.$attrs,{id:t.id,ref:e(p),role:"switch",type:t.as==="button"?"button":void 0,value:t.value,"aria-label":t.$attrs["aria-label"]||C.value,"aria-checked":e(d),"aria-required":t.required,"data-state":e(d)?"checked":"unchecked","data-disabled":e(o)?"":void 0,"as-child":t.asChild,as:t.as,disabled:e(o),onClick:i,onKeydown:j(L(i,["prevent"]),["enter"])}),{default:m(()=>[w(t.$slots,"default",{modelValue:e(d)}),e(q)&&t.name?(c(),u(e(T),{key:0,type:"checkbox",name:t.name,disabled:e(o),required:t.required,value:t.value,checked:!!e(d)},null,8,["name","disabled","required","value","checked"])):R("v-if",!0)]),_:3},16,["id","type","value","aria-label","aria-checked","aria-required","data-state","data-disabled","as-child","as","disabled","onKeydown"]))}}),I=H,W=f({__name:"SwitchThumb",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(l){const r=N();return k(),(a,s)=>{var o;return c(),u(e(_),{"data-state":(o=e(r).modelValue)!=null&&o.value?"checked":"unchecked","data-disabled":e(r).disabled.value?"":void 0,"as-child":a.asChild,as:a.as},{default:m(()=>[w(a.$slots,"default")]),_:3},8,["data-state","data-disabled","as-child","as"])}}}),A=W;const Q=f({__name:"Switch",props:{defaultValue:{type:Boolean},modelValue:{type:[Boolean,null]},disabled:{type:Boolean},id:{},value:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{}},emits:["update:modelValue"],setup(l,{emit:r}){const a=l,s=r,o=y(()=>{const n=a,{class:i}=n;return b(n,["class"])}),d=M(o,s);return(i,p)=>(c(),u(e(I),g(e(d),{class:e(v)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a.class)}),{default:m(()=>[$(e(A),{class:E(e(v)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"))},null,8,["class"])]),_:1},16,["class"]))}});export{Q as _};
