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