import{r as t,h as e,g as o}from"./p-c1e62c18.js";const r=class{constructor(e){t(this,e),this.itemCount=500,this.rowHeight=50,this.renderAhead=0,this.scrollTop=0}componentDidRender(){setTimeout((()=>{this.height=this.el?this.el.offsetHeight:0}),100)}render(){const{height:t,itemCount:o,renderAhead:r,rowHeight:n,scrollTop:i}=this,s=()=>n,l=()=>{let t=[0];for(let e=1;e<o;e++)t.push(t[e-1]+s());return t},c=l()[o-1]+s();console.log("scrollTop",i);const a=()=>function(t,e,o){let r=0,n=o-1;for(;n!==r;){const o=Math.floor((n-r)/2+r);if(e[o]<=t&&e[o+1]>t)return o;if(o===r)return n;e[o]<=t?r=o:n=o}return o}(i,l(),o);console.log("firstVisibleNode()",a());const h=Math.max(0,a()-r);console.log("startNode",h);const d=Math.min(o-1,function(t,e,o,r){let n;for(n=e;n<o;n++)if(t[n]>t[e]+r)return n;return n}(l(),a(),o,t)+r)-h+1,u=l()[h];return console.log("visibleNodeCount",d),console.log("viewportHeight",t),console.log("totalHeight",c),e("div",{style:{height:"800px",overflow:"auto",flex:"1",display:"block"},onScroll:t=>{console.log(t.target.scrollTop),this.scrollTop=t.target.scrollTop}},e("div",{style:{height:c+"px",overflow:"hidden",willChange:"transform",position:"relative"}},e("div",{style:{transform:`translateY(${u}px)`}},(()=>new Array(d).fill(null).map(((t,e)=>this.renderRow(e+h))))())))}get el(){return o(this)}};r.style=":host{flex:1;display:block;overflow:hidden;flex-direction:column}.table-progress-container{display:flex;align-items:center;justify-content:center;min-height:calc(14 * var(--spacing-unit))}.error-container{padding:calc(4 * var(--spacing-unit))}";export{r as dvn_virtual_scroll}