import{Cr as e,In as t,J as n,K as r,Kn as i,Or as a,Ot as o,Qn as s,Qt as c,Un as l,W as u,Y as d,Yt as f,br as p,cn as m,in as h,kr as g,o as _,p as v,pr as y,rr as b,s as x,v as S,wt as C,yn as w}from"./index-Brwv1ztr.js";import{n as T,t as E}from"./VSelectionControl-Dk5pUZnN.js";var D=m({indeterminate:Boolean,inset:Boolean,flat:Boolean,loading:{type:[Boolean,String],default:!1},...x(),...T()},`VSwitch`),O=h()({name:`VSwitch`,inheritAttrs:!1,props:D(),emits:{"update:focused":e=>!0,"update:modelValue":e=>!0,"update:indeterminate":e=>!0},setup(m,{attrs:h,slots:x}){let T=f(m,`indeterminate`),D=f(m,`modelValue`),{loaderClasses:O}=r(m),{isFocused:k,focus:A,blur:j}=v(m),M=p(),N=p(),P=t&&window.matchMedia(`(forced-colors: active)`).matches,F=e(()=>typeof m.loading==`string`&&m.loading!==``?m.loading:m.color),I=y(),L=e(()=>m.id||`switch-${I}`);function R(){T.value&&=!1}function z(e){e.stopPropagation(),e.preventDefault(),M.value?.input?.click()}return c(()=>{let[e,t]=w(h),r=_.filterProps(m),c=E.filterProps(m);return s(_,b({ref:N,class:[`v-switch`,{"v-switch--flat":m.flat},{"v-switch--inset":m.inset},{"v-switch--indeterminate":T.value},O.value,m.class]},e,r,{modelValue:D.value,"onUpdate:modelValue":e=>D.value=e,id:L.value,focused:k.value,style:m.style}),{...x,default:({id:e,messagesId:r,isDisabled:f,isReadonly:p,isValid:h})=>{let _={model:D,isValid:h};return s(E,b({ref:M},c,{modelValue:D.value,"onUpdate:modelValue":[e=>D.value=e,R],id:e.value,"aria-describedby":r.value,type:`checkbox`,"aria-checked":T.value?`mixed`:void 0,disabled:f.value,readonly:p.value,onFocus:A,onBlur:j},t),{...x,default:({backgroundColorClasses:e,backgroundColorStyles:t})=>i(`div`,{class:a([`v-switch__track`,P?void 0:e.value]),style:g(t.value),onClick:z},[x[`track-true`]&&i(`div`,{key:`prepend`,class:`v-switch__track-true`},[x[`track-true`](_)]),x[`track-false`]&&i(`div`,{key:`append`,class:`v-switch__track-false`},[x[`track-false`](_)])]),input:({inputNode:e,icon:t,backgroundColorClasses:r,backgroundColorStyles:c})=>i(l,null,[e,i(`div`,{class:a([`v-switch__thumb`,{"v-switch__thumb--filled":t||m.loading},m.inset||P?void 0:r.value]),style:g(m.inset?void 0:c.value)},[x.thumb?s(C,{defaults:{VIcon:{icon:t,size:`x-small`}}},{default:()=>[x.thumb({..._,icon:t})]}):s(o,null,{default:()=>[m.loading?s(u,{name:`v-switch`,active:!0,color:h.value===!1?void 0:F.value},{default:e=>x.loader?x.loader(e):s(n,{active:e.isActive,color:e.color,indeterminate:!0,size:`16`,width:`2`},null)}):t&&s(d,{key:String(t),icon:t,size:`x-small`},null)]})])])})}})}),S({},N)}});export{O as t};