import { GAP as s } from "../constants.js";
import { clamp as a } from "@milaboratories/helpers";
class y {
  constructor(i, r, t) {
    this.api = i, this.rowHeight = r, this.resolvePrimaryKey = t;
  }
  get height() {
    return this.rowHeight + s;
  }
  async getHeight() {
    return await this.api.count() * this.height;
  }
  async getRows(i, r) {
    const t = a(Math.floor(i / this.height), 0, Number.POSITIVE_INFINITY), o = Math.ceil(r + 40 / this.height);
    return (await this.api.query({ offset: t, limit: o })).map((e, h) => ({
      dataRow: e,
      index: t + h,
      primaryKey: this.resolvePrimaryKey(e, t + h),
      offset: (t + h) * (this.rowHeight + s),
      height: this.rowHeight
    }));
  }
}
export {
  y as AsyncData
};
//# sourceMappingURL=AsyncData.js.map
