import { applyReviver as a } from "./accelbyte-widgets720.mjs";
import { NODE_TYPE as f, isDocument as u } from "./accelbyte-widgets711.mjs";
import { toJS as m } from "./accelbyte-widgets716.mjs";
class g {
  constructor(e) {
    Object.defineProperty(this, f, { value: e });
  }
  clone() {
    const e = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
    return this.range && (e.range = this.range.slice()), e;
  }
  toJS(e, { mapAsMap: c, maxAliasCount: r, onAnchor: o, reviver: s } = {}) {
    if (!u(e))
      throw new TypeError("A document argument is required");
    const n = {
      anchors: /* @__PURE__ */ new Map(),
      doc: e,
      keep: !0,
      mapAsMap: c === !0,
      mapKeyWarned: !1,
      maxAliasCount: typeof r == "number" ? r : 100
    }, t = m(this, "", n);
    if (typeof o == "function")
      for (const { count: i, res: p } of n.anchors.values())
        o(p, i);
    return typeof s == "function" ? a(s, { "": t }, "", t) : t;
  }
}
export {
  g as NodeBase
};
