var c = Object.defineProperty;
var m = (r, t, e) => t in r ? c(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
var g = (r, t, e) => m(r, typeof t != "symbol" ? t + "" : t, e);
import { GAP as y } from "../constants.js";
import { sliceBy as l } from "../domain.js";
import { notEmpty as p } from "@milaboratories/helpers";
const n = /* @__PURE__ */ new WeakMap();
class K {
  constructor(t, e, h) {
    g(this, "dataHeight");
    this.datum = t, this.resolveHeight = e, this.resolvePrimaryKey = h;
    const i = t.reduce(
      (s, o, a) => (s.indices.set(a, s.total), s.total += this.resolveHeight(o, a) + y, s),
      {
        total: 0,
        indices: /* @__PURE__ */ new Map()
      }
    );
    this.dataHeight = i.total;
    const f = t.map((s, o) => ({
      dataRow: s,
      index: o,
      primaryKey: this.resolvePrimaryKey(s, o),
      offset: p(i.indices.get(o)),
      height: this.resolveHeight(s, o)
    }));
    n.set(this, f);
  }
  get rows() {
    return n.get(this);
  }
  async getHeight() {
    return this.dataHeight;
  }
  async getRows(t, e) {
    return l(this.rows, (h) => {
      const i = h.offset;
      return t < i + h.height && i < e + t;
    });
  }
}
export {
  K as RawData
};
//# sourceMappingURL=RawData.js.map
