import { sliceBy as e } from "../domain.js";
import { notEmpty as t } from "@milaboratories/helpers";
var n = /* @__PURE__ */ new WeakMap(), r = class {
	dataHeight;
	constructor(e, r, i) {
		this.datum = e, this.resolveHeight = r, this.resolvePrimaryKey = i;
		let a = e.reduce((e, t, n) => (e.indices.set(n, e.total), e.total += this.resolveHeight(t, n) + 1, e), {
			total: 0,
			indices: /* @__PURE__ */ new Map()
		});
		this.dataHeight = a.total;
		let o = e.map((e, n) => ({
			dataRow: e,
			index: n,
			primaryKey: this.resolvePrimaryKey(e, n),
			offset: t(a.indices.get(n)),
			height: this.resolveHeight(e, n)
		}));
		n.set(this, o);
	}
	get rows() {
		return n.get(this);
	}
	async getHeight() {
		return this.dataHeight;
	}
	async getRows(t, n) {
		return e(this.rows, (e) => {
			let r = e.offset;
			return t < r + e.height && r < n + t;
		});
	}
};
export { r as RawData };

//# sourceMappingURL=RawData.js.map