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