import{$ as e,C as t,I as n,J as r,L as i,N as a,O as o,P as s,Q as c,V as l,W as u,X as d,Z as f,b as p,h as m,v as h,w as g,x as _}from"./app-hx74OzLv.js";import{t as v}from"./i18n-C6IJoid2.js";var y={class:`group fixed right-6 top-1/2 z-30 hidden -translate-y-1/2 select-none flex-col items-center lg: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=o({__name:`ReadingScrubber`,props:{target:{},count:{}},setup(o){let T=o,E=r(0),D=r(!1),O=r(null),k=r(!1),A=p(()=>Math.max(0,T.count??0)),j=p(()=>{let e=A.value;return e<2||e>40?[]:Array.from({length:e},(t,n)=>n/(e-1))}),M=p(()=>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 s(V),a(H),l(()=>T.target,()=>{H(),V()}),(r,a)=>u((n(),g(`div`,y,[A.value?(n(),g(`div`,b,[_(`div`,x,e(A.value),1),_(`div`,null,e(d(v)(`replies`)),1)])):t(``,!0),_(`div`,{ref_key:`track`,ref:O,class:`relative h-[52vh] w-4 cursor-pointer`,title:d(v)(`Reading progress — drag to jump`),onPointerdown:L,onPointermove:R,onPointerup:z,onPointerleave:z},[a[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:c({height:E.value*100+`%`})},null,4),(n(!0),g(h,null,i(j.value,(e,t)=>(n(),g(`div`,{key:t,class:f([`absolute left-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-surface ring-2 transition-colors`,e<=E.value+.001?`ring-primary`:`ring-line`]),style:c({top:e*100+`%`})},null,6))),128)),_(`div`,{class:`absolute left-1/2 -translate-x-1/2 -translate-y-1/2`,style:c({top:E.value*100+`%`})},[...a[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?(n(),g(`div`,C,e(M.value)+`/`+e(A.value),1)):t(``,!0)],512)),[[m,k.value]])}});export{T as t};