import { _ as i, f as l, g as s, h as d, m as o, n as m, s as c, t as p, v as T } from "./chunk-K5T4RW27.js";
var f = class extends p {
  static {
    o(this, "TreemapTokenBuilder");
  }
  constructor() {
    super(["treemap"]);
  }
}, u = /classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/, v = class extends m {
  static {
    o(this, "TreemapValueConverter");
  }
  runCustomConverter(r, e, a) {
    if (r.name === "NUMBER2") return parseFloat(e.replace(/,/g, ""));
    if (r.name === "SEPARATOR") return e.substring(1, e.length - 1);
    if (r.name === "STRING2") return e.substring(1, e.length - 1);
    if (r.name === "INDENTATION") return e.length;
    if (r.name === "ClassDef") {
      if (typeof e != "string") return e;
      const t = u.exec(e);
      if (t) return {
        $type: "ClassDefStatement",
        className: t[1],
        styleText: t[2] || void 0
      };
    }
  }
};
function n(r) {
  const e = r.validation.TreemapValidator, a = r.validation.ValidationRegistry;
  if (a) {
    const t = { Treemap: e.checkSingleRoot.bind(e) };
    a.register(t, e);
  }
}
o(n, "registerValidationChecks");
var g = class {
  static {
    o(this, "TreemapValidator");
  }
  checkSingleRoot(r, e) {
    let a;
    for (const t of r.TreemapRows)
      t.item && (a === void 0 && t.indent === void 0 ? a = 0 : t.indent === void 0 ? e("error", "Multiple root nodes are not allowed in a treemap.", {
        node: t,
        property: "item"
      }) : a !== void 0 && a >= parseInt(t.indent, 10) && e("error", "Multiple root nodes are not allowed in a treemap.", {
        node: t,
        property: "item"
      }));
  }
}, h = {
  parser: {
    TokenBuilder: /* @__PURE__ */ o(() => new f(), "TokenBuilder"),
    ValueConverter: /* @__PURE__ */ o(() => new v(), "ValueConverter")
  },
  validation: { TreemapValidator: /* @__PURE__ */ o(() => new g(), "TreemapValidator") }
};
function C(r = d) {
  const e = s(T(r), c), a = s(i({ shared: e }), l, h);
  return e.ServiceRegistry.register(a), n(a), {
    shared: e,
    Treemap: a
  };
}
o(C, "createTreemapServices");
export {
  C as n,
  h as t
};

//# sourceMappingURL=chunk-LIHQZDEY.js.map