import{V as g,m as N}from"./VCheckboxBtn-CeJlTA3J.js";import{g as U,p as A,j as S,cr as K,J as L,cs as R,n as z,ct as E,cu as b,o as P,ae as V,ap as j,ai as q,cv as D,ay as J,az as p,aA as m,ah as M,aB as k,q as h,E as u,i as G,ax as H,aP as O}from"./index-It2prjj_.js";const Q=A({...D(),...q(N(),["inline"])},"VCheckbox"),X=U()({name:"VCheckbox",inheritAttrs:!1,props:Q(),emits:{"update:modelValue":e=>!0,"update:focused":e=>!0},setup(e,l){let{attrs:r,slots:c}=l;const n=S(e,"modelValue"),{isFocused:t,focus:s,blur:a}=K(e),o=L(),y=R();return z(()=>{const[i,v]=E(r),d=b.filterProps(e),w=g.filterProps(e);return P(b,V({ref:o,class:["v-checkbox",e.class]},i,d,{modelValue:n.value,"onUpdate:modelValue":f=>n.value=f,id:e.id||`checkbox-${y}`,focused:t.value,style:e.style}),{...c,default:f=>{let{id:x,messagesId:B,isDisabled:C,isReadonly:I,isValid:$}=f;return P(g,V(w,{id:x.value,"aria-describedby":B.value,disabled:C.value,readonly:I.value},v,{error:$.value===!1,modelValue:n.value,"onUpdate:modelValue":F=>n.value=F,onFocus:s,onBlur:a}),c)}})}),j({},o)}}),Y=J({__name:"NowPlayingBadge",props:{showBadge:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0},badgeStyle:{default:""},iconStyle:{default:""}},setup(e){return(l,r)=>(m(),p(M,null,[e.showBadge?(m(),p("span",{key:0,style:h(e.badgeStyle),class:"now-playing-badge","aria-label":"Now playing"}," Now playing ",4)):k("",!0),e.showIcon?(m(),p("div",{key:1,style:h(e.iconStyle),class:"now-playing-icon"},[...r[0]||(r[0]=[u("div",{class:"bar"},null,-1),u("div",{class:"bar"},null,-1),u("div",{class:"bar"},null,-1),u("div",{class:"bar"},null,-1)])],4)):k("",!0)],64))}});function Z(){const e=G(()=>H.currentUser);function l(t,s){if(!e.value?.preferences)return s;const a=e.value.preferences[t];return a!==void 0?a:s}async function r(t,s){if(!e.value){console.warn("Cannot set preference: no user logged in");return}const a={...e.value.preferences,[t]:s};e.value.preferences=a;try{await O.updateUser(e.value.user_id,{preferences:a})}catch(o){console.error("Failed to update user preferences:",o)}}function c(t,s){const a=`${t}.${s}`;return l(`itemsListing.${a}`,{})||{}}async function n(t,s,a,o){const i=`itemsListing.${`${t}.${s}`}`,d={...c(t,s),[a]:o};await r(i,d)}return{currentUser:e,getPreference:l,setPreference:r,getItemsListingPreferences:c,setItemsListingPreference:n}}export{X as V,Y as _,Z as u};
