import{n as e}from"./rolldown-runtime-DAXXjFlN.js";import{An as t,Cr as n,En as r,Fn as i,Fr as a,Kn as o,Mn as s,Nn as c,Pn as l,Rn as ee,Sr as u,Vn as d,ar as f,dn as p,gr as m,jn as h,mn as g,nr as _,rr as v,vr as y,xr as b,zn as x}from"./vendor-Dnfj1twE.js";import{i as S,u as te}from"./vendor-vue--4CNL3BY.js";import{Ht as C,Vt as w}from"./vendor-quasar-BP3JemFi.js";import{Ht as T,Vt as E,oo as D,or as O,so as k,sr as ne}from"./ws-Dl8XkIy4.js";import{n as A,r as j}from"./windowing-Dae4UrVi.js";import{bn as M,yn as N}from"./auth-tS4c9ju3.js";import{n as P,t as F}from"./CTooltip-DrlRH-Bh.js";import{g as I,h as L,m as R,p as re}from"./AMPlaybackActions-Vw0z-V-k.js";var z,B,V,H,U,W,G,K=e((()=>{P(),C(),p(),S(),T(),A(),O(),M(),R(),I(),z={class:`nav-glyph icon`},B={class:`popup-icon`},V={class:`popup-content`},H=190,U=34,W=38,G=d({__name:`VolumePopup`,props:{direction:{default:`left`}},setup(e){let d=e,p=ne(),S=a(null),C=a(null),T=o(`windowContext`,null)||j(),D=h(()=>T&&T!==window),O=o(`setControlsOpen`,null),k=h(()=>T||window),A=h(()=>k.value.document.body),M=a(!1),P=a(!1),I=a(null),R=a({left:0,right:0,top:0});function G(){if(!I.value)return;let e=I.value.getBoundingClientRect();if(e.width===0||e.height===0)return;let t=k.value.innerWidth,n=Math.max(8,t-e.right);R.value={left:Math.max(8,e.left),right:n,top:e.top+e.height/2-U/2}}let K=h(()=>{let e=d.direction===`right`?{left:`${R.value.left}px`}:{right:`${R.value.right}px`};return{position:`fixed`,top:`${R.value.top}px`,"--popup-width":`${H}px`,"--popup-height":`${U}px`,"--popup-collapsed-width":`${W}px`,...e}}),q=h(()=>{if(!I.value)return{};let e=I.value.getBoundingClientRect(),t=k.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 J(){if(E(`audio.volumeDisplaySPL.enabled`)){let e=Number(E(`audio.volumeDisplaySPL.calibration`)??90)+Math.round(Math.log10(p.normalizedVolume)*20);return`${Number.isFinite(e)?e:0} dB SPL`}return`${Math.round(p.normalizedVolume*100)}%`}let Y=h(()=>{let e=Math.round(p.normalizedVolume/E(`audio.maxVolume`)*100);return e===0?`volume-x`:e<25?`volume`:e<50?`volume-1`:`volume-2`});function X(e){let t=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail)),n=p.normalizedVolume,r=+(E(`audio.volumeStep`)??.01),i=+n+t*r;i>1?p.normalizedVolume=1:i<0?p.normalizedVolume=0:p.normalizedVolume=i}function ie(){M.value||G(),M.value=!M.value}function Z(){I.value&&(M.value=!1,C.value?.open(I.value))}function Q(e){let t=e.target;I.value&&!I.value.contains(t)&&(t.closest(`.custom-volume-popup`)||(M.value=!1))}m(M,e=>{O&&O(e)});let{width:ae}=te(I);m(ae,e=>{e===0&&M.value&&(M.value=!1)});function $(){M.value&&G()}return _(()=>{k.value.addEventListener(`click`,Q),k.value.addEventListener(`resize`,$)}),v(()=>{k.value.removeEventListener(`click`,Q),k.value.removeEventListener(`resize`,$),O&&O(!1)}),(a,o)=>{let d=F;return f(),i(`div`,{class:`volume-popup-wrapper`,ref_key:`buttonRef`,ref:I,onMouseenter:o[0]||=e=>P.value=!0,onMouseleave:o[1]||=e=>P.value=!1},[x(N,{class:b([`volume-button`,{"is-open":M.value}]),onWheel:r(X,[`prevent`]),onClick:ie,onContextmenu:r(Z,[`prevent`])},{default:y(()=>[s(`div`,z,[x(w,{name:`svguse:cider-assets/cider-icons/icons.svg#`+Y.value,size:`16px`},null,8,[`name`])])]),menu:y(()=>[D.value?l(``,!0):(f(),c(d,{key:0},{default:y(()=>[ee(n(J()),1)]),_:1}))]),_:1},8,[`class`]),(f(),c(t,{to:A.value},[x(g,{name:`volume-bubble`},{default:y(()=>[M.value?(f(),i(`div`,{key:0,class:b([`custom-volume-popup window-nodrag`,`bubble-${e.direction}`]),style:u(K.value),onWheel:r(X,[`prevent`]),onContextmenu:r(Z,[`prevent`])},[s(`div`,B,[x(w,{name:`svguse:cider-assets/cider-icons/icons.svg#`+Y.value,size:`16px`},null,8,[`name`])]),s(`div`,V,[x(re,{ref_key:`volumeSlider`,ref:S,"ios-style":``},null,512)])],38)):l(``,!0)]),_:1})],8,[`to`])),D.value?(f(),c(t,{key:0,to:A.value},[x(g,{name:`fade`},{default:y(()=>[P.value&&!M.value?(f(),i(`div`,{key:0,class:`custom-tooltip`,style:u(q.value)},n(J()),5)):l(``,!0)]),_:1})],8,[`to`])):l(``,!0),x(L,{ref_key:`quickMenu`,ref:C},null,512)],544)}}})})),q=e((()=>{})),J,Y=e((()=>{K(),K(),q(),k(),J=D(G,[[`__scopeId`,`data-v-0b783161`]])}));export{Y as n,J as t};