import{n as e}from"./rolldown-runtime-CMxvf4Kt.js";import{Bn as t,Cn as n,Ln as r,On as i,Qn as a,Rn as o,Xn as s,Xt as c,_n as l,bn as u,cn as d,fn as f,gn as p,hn as m,hr as h,mn as g,nr as _,pn as v,qt as y,rr as b,xn as x}from"./vendor-C4JLrdLj.js";import{Gt as S,Kt as C,nt as w,rt as T}from"./vendor-quasar-BMuYn1t2.js";import{Jr as E,b as D,h as O,m as k,qr as A,x as j}from"./ws-JRT2XE7Y.js";import{n as M,r as N}from"./windowing-QYK-VWMM.js";import{Lt as P,Rt as F}from"./smart-playlist-store-DUBQztY1.js";import{g as I,h as L,m as R,p as z}from"./AMPlaybackActions-CHMHzCPG.js";var B,V,H,U=e((()=>{C(),T(),y(),j(),M(),k(),F(),R(),I(),B={class:`nav-glyph icon`},V={class:`popup-content`},H=n({__name:`VolumePopup`,setup(e){let n=O(),y=h(null),C=h(null),T=i(`windowContext`,null)||N(),E=v(()=>T&&T!==window),k=i(`setControlsOpen`,null),A=v(()=>T||window),j=v(()=>A.value.document.body),M=h(!1),F=h(!1),I=h(null),R=v(()=>{if(!I.value)return{};let e=I.value.getBoundingClientRect(),t=A.value.innerHeight,n=A.value.innerWidth,r=e.top,i=t-e.bottom;e.left,n-e.right;let a,o=e.left+e.width/2,s=`translateX(-50%)`;if(r>=72)a=e.top-12,s=`translate(-50%, -100%)`;else if(i>=72)a=e.bottom+12,s=`translateX(-50%)`;else{t-24;let e=(t-60)/2;a=Math.max(12,Math.min(e,t-60-12)),s=`translateX(-50%)`}let c=n-180/2-12;return o=Math.max(102,Math.min(o,c)),{position:`fixed`,left:`${o}px`,top:`${a}px`,transform:s}}),H=v(()=>{if(!I.value)return{};let e=I.value.getBoundingClientRect(),t=A.value.innerHeight;return e.top>=38?{position:`fixed`,left:`${e.left+e.width/2}px`,bottom:`${t-e.top+8}px`,transform:`translateX(-50%)`,zIndex:`99999`}:{position:`fixed`,left:`${e.right+8}px`,top:`${e.top+e.height/2}px`,transform:`translateY(-50%)`,zIndex:`99999`}});function U(){if(D(`audio.volumeDisplaySPL.enabled`)){let e=Number(D(`audio.volumeDisplaySPL.calibration`)??90)+Math.round(Math.log10(n.normalizedVolume)*20);return`${Number.isFinite(e)?e:0} dB SPL`}return`${Math.round(n.normalizedVolume*100)}%`}let W=v(()=>{let e=Math.round(n.normalizedVolume/D(`audio.maxVolume`)*100);return e===0?`volume-x`:e<25?`volume`:e<50?`volume-1`:`volume-2`});function G(e){let t=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail)),r=n.normalizedVolume,i=+(D(`audio.volumeStep`)??.01),a=+r+t*i;a>1?n.normalizedVolume=1:a<0?n.normalizedVolume=0:n.normalizedVolume=a}function K(){M.value=!M.value}function q(){I.value&&(M.value=!1,C.value?.open(I.value))}function J(e){let t=e.target;I.value&&!I.value.contains(t)&&(t.closest(`.custom-volume-popup`)||(M.value=!1))}return s(M,e=>{k&&k(e)}),r(()=>{A.value.addEventListener(`click`,J)}),o(()=>{A.value.removeEventListener(`click`,J),k&&k(!1)}),(e,n)=>(t(),l(`div`,{class:`volume-popup-wrapper`,ref_key:`buttonRef`,ref:I,onMouseenter:n[0]||=e=>F.value=!0,onMouseleave:n[1]||=e=>F.value=!1},[x(P,{class:`volume-button`,onWheel:d(G,[`prevent`]),onClick:K,onContextmenu:d(q,[`prevent`])},{default:a(()=>[g(`div`,B,[x(S,{name:`svguse:cider-assets/cider-icons/icons.svg#`+W.value,size:`16px`},null,8,[`name`])])]),menu:a(()=>[E.value?p(``,!0):(t(),m(w,{key:0},{default:a(()=>[u(b(U()),1)]),_:1}))]),_:1}),(t(),m(f,{to:j.value},[x(c,{name:`fade`},{default:a(()=>[M.value?(t(),l(`div`,{key:0,class:`custom-volume-popup window-nodrag`,style:_(R.value)},[g(`div`,V,[x(z,{ref_key:`volumeSlider`,ref:y},null,512)])],4)):p(``,!0)]),_:1})],8,[`to`])),E.value?(t(),m(f,{key:0,to:j.value},[x(c,{name:`fade`},{default:a(()=>[F.value&&!M.value?(t(),l(`div`,{key:0,class:`custom-tooltip`,style:_(H.value)},b(U()),5)):p(``,!0)]),_:1})],8,[`to`])):p(``,!0),x(L,{ref_key:`quickMenu`,ref:C},null,512)],544))}})})),W=e((()=>{})),G,K=e((()=>{U(),U(),W(),E(),G=A(H,[[`__scopeId`,`data-v-83129b75`]])}));export{K as n,G as t};