import{$ as e,C as t,F as n,G as r,H as i,L as a,P as o,Q as s,R as c,Y as l,Z as u,b as d,et as f,h as p,k as m,v as h,w as g,x as _}from"./app-CAV_k0tk.js";import{t as v}from"./i18n-CNs07Srl.js";var y={class:`group fixed left-[calc(50%+24.5rem)] top-1/2 z-30 hidden -translate-y-1/2 select-none flex-col items-center rounded-[20px] bg-surface-2/80 px-2.5 py-4 shadow-sm ring-1 ring-line backdrop-blur-sm xl:flex`},b={key:0,class:`mb-2.5 text-center text-[11px] font-semibold leading-tight text-ink-muted`},x={class:`text-ink-2`},S=[`title`],C={key:1,class:`mt-2.5 text-[11px] font-bold tabular-nums text-ink-2`},w=700,T=m({__name:`ReadingScrubber`,props:{target:{},count:{}},setup(m){let T=m,E=l(0),D=l(!1),O=l(null),k=l(!1),A=d(()=>Math.max(0,T.count??0)),j=d(()=>{let e=A.value;return e<2||e>40?[]:Array.from({length:e},(t,n)=>n/(e-1))}),M=d(()=>A.value<1?0:Math.min(A.value,Math.max(1,Math.round(E.value*(A.value-1))+1)));function N(){return T.target?Math.max(1,T.target.scrollHeight-T.target.clientHeight):Math.max(1,document.documentElement.scrollHeight-window.innerHeight)}function P(){return T.target?T.target.scrollTop:window.scrollY}function F(){let e=N();k.value=e>=w,E.value=Math.min(1,Math.max(0,P()/e))}function I(e){let t=O.value;if(!t)return;let n=t.getBoundingClientRect(),r=Math.min(1,Math.max(0,(e-n.top)/n.height))*N();T.target?T.target.scrollTo({top:r}):window.scrollTo({top:r})}function L(e){D.value=!0,e.target.setPointerCapture?.(e.pointerId),I(e.clientY)}function R(e){D.value&&I(e.clientY)}function z(){D.value=!1}let B=null;function V(){B=T.target??window,B.addEventListener(`scroll`,F,{passive:!0}),window.addEventListener(`resize`,F),F()}function H(){B?.removeEventListener(`scroll`,F),window.removeEventListener(`resize`,F)}return n(V),o(H),i(()=>T.target,()=>{H(),V()}),(n,i)=>r((a(),g(`div`,y,[A.value?(a(),g(`div`,b,[_(`div`,x,f(A.value),1),_(`div`,null,f(u(v)(`replies`)),1)])):t(``,!0),_(`div`,{ref_key:`track`,ref:O,class:`relative h-[52vh] w-4 cursor-pointer`,title:u(v)(`Reading progress — drag to jump`),onPointerdown:L,onPointermove:R,onPointerup:z,onPointerleave:z},[i[1]||=_(`div`,{class:`absolute left-1/2 top-0 h-full w-px -translate-x-1/2 rounded-full bg-line`},null,-1),_(`div`,{class:`absolute left-1/2 top-0 w-[3px] -translate-x-1/2 rounded-full bg-primary`,style:e({height:E.value*100+`%`})},null,4),(a(!0),g(h,null,c(j.value,(t,n)=>(a(),g(`div`,{key:n,class:s([`absolute left-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-surface ring-2 transition-colors`,t<=E.value+.001?`ring-primary`:`ring-line`]),style:e({top:t*100+`%`})},null,6))),128)),_(`div`,{class:`absolute left-1/2 -translate-x-1/2 -translate-y-1/2`,style:e({top:E.value*100+`%`})},[...i[0]||=[_(`div`,{class:`h-3.5 w-3.5 rounded-full bg-primary shadow ring-2 ring-surface transition-transform group-hover:scale-110`},null,-1)]],4)],40,S),A.value?(a(),g(`div`,C,f(M.value)+`/`+f(A.value),1)):t(``,!0)],512)),[[p,k.value]])}});export{T as t};