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