import{r as e,h as t,g as o}from"./p-cb5076d4.js";const n=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:n,rowHeight:i,scrollTop:r}=this,s=()=>i,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 n=0,i=o-1;for(;i!==n;){const o=Math.floor((i-n)/2+n);if(t[o]<=e&&t[o+1]>e)return o;if(o===n)return i;t[o]<=e?n=o:i=o}return o}(r,l(),o);console.log("firstVisibleNode()",a());const h=Math.max(0,a()-n);console.log("startNode",h);const f=Math.min(o-1,function(e,t,o,n){let i;for(i=t;i<o;i++)if(e[i]>e[t]+n)return i;return i}(l(),a(),o,e)+n)-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)}};n.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{n as dvn_virtual_scroll}